Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Unable to write complete call stack details using stringWriter or JSONTextWriter as it gets truncated

(0) ShareShare
ReportReport
Posted on by

Hello team 

With below code ,when I write my call stack details from stringWriter OR jsonTextWriter. I see at application insight end  that call stack is truncated  and subsequent write code below callStack ('Txt After writing call stack')   is not written in telemetry.

During debugging I can see truncated value in tootip and in value window of my variable callStack which is source type , and when changed to view with Text visualizer I can see full complete call stack.

What can I do to ensure that my application insight receives the full call stack and not truncated one. 

class myClass
{
 public myMethod()
	{
	
		
        System.IO.StringWriter stringWriter = new System.IO.StringWriter();
        Newtonsoft.Json.JsonTextWriter jsonWriter = new Newtonsoft.Json.JsonTextWriter(stringWriter);
        source callStack = con2Str(xSession::xppCallStack());
        int callStackLength = strLen(callStack);
		
		
		 //Option 1 jsonWriter
        jsonWriter.WriteStartObject();
        jsonWriter.WritePropertyName('JSON Call stack get length of call stack');
        jsonWriter.WriteValue(callStackLength);
        jsonWriter.WritePropertyName('JSON Call stack');
        jsonWriter.WriteValue(callStack);
		jsonWriter.WritePropertyName('JSON After writing call stack');
        jsonWriter.WriteValue('Txt After writing call stack');
		jsonWriter.WriteEndObject(); 
		
		//Option 2 stringWriter
		stringWriter.WriteLine('SW Call stack get length of call stack');
        stringWriter.WriteLine(callStackLength);
        stringWriter.WriteLine('SW Call stack');
        stringWriter.WriteLine(callStack);
       	stringWriter.WriteLine('SW After writing call stack');
        stringWriter.WriteLine('Txt After writing call stack');
		
		SysGlobalTelemetry::logEvent(stringWriter.ToString());
		 
		SysGlobalTelemetry::logMetric(stringWriter.ToString(), timeCounter);
		
	}
}

       
       

I can see the following place from where OOTB system sends full call stack, however cannot see telemeteryclient class detail to figure how actually it is sent.

Thanks

Mav

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans