any way to check profiler mode in C# dynamics 365?

61 Views Asked by At

In plugin, I want to trace Fetch-XML Query when it is in profiling mode only.

Like we check for debug mode:

#if DEBUG
Console.WriteLine("Debug version");
#endif
1

There are 1 best solutions below

0
On

The official way to do this is to use the Tracing Service in your plug-in, which writes to the Plugin Trace Log. Normally, you’d only want the trace written to the log when there is an exception. But if you are debugging, you can also configure Dynamics to write all trace logs even for successful plugin executions. Just be sure to use this temporarily, as it will affect performance of all plugins that use tracing.

Here is a good resource that explains how to configure the Plugin Trace Log and use the Tracing Service: https://www.powerobjects.com/2016/07/05/debugging-your-plug-ins-with-the-plug-in-trace-log/