Dotnet agent : Btm trace is not showing few methods in the method stack trace.

Community post

Shared by the Applicare community. It has not been re-checked against Applicare 10.0, so confirm the steps in your environment or contact Support.

The btm trace may not show few methods in the method stack trace. The possible reason may be the method is inlined .

[Screenshot 1 is not available on this page.]

The JIT compiler compiles and optimizes the code of a managed application during the application run. The compiler uses specific algorithms to decide whether to inline a function or not. Eg: If a method is too small or the execution of code in a method takes less time than the method invocation, then the funtion will be inlined.

_Sample code:

[HttpGet]_ public ActionResult<string> Get() { PrintTime(); // code here return ""; }

public void PrintTime() { WriteTimeToConsole(); }

public void WriteTimeToConsole()

{

Console.WriteLine(new DateTime());

}

In the above code the method PrintTime() simply invokes another method and doesn't do any business logic. In this case that method will be inlined automatically by the compiler.

There are few ways to avoid inlining a function by the compiler. One way is to to specify the NoInlining method attribute in source code.

[MethodImpl(MethodImplOptions.NoInlining)] public void PrintTime()

{ WriteTimeToConsole(); }

Generally it is not a good idea to avoid function inline. Because it will impact application performance.

Join the discussion

Comments, voting and following are kept by Zendesk and need a Help Center account. This button opens the original discussion there.

Opens Zendesk · needs internet and sign-in

Still stuck? Contact support