private static void TraceContext(this ITracingService tracingservice, IPluginExecutionContext plugincontext, bool parentcontext, bool attributetypes, bool convertqueries, IOrganizationService service, int depth) { if (plugincontext.Stage != 30) { tracingservice.Trace("--- Context {0} Trace Start ---", depth); tracingservice.Trace("Message : {0}", plugincontext.MessageName); tracingservice.Trace("Stage : {0}", plugincontext.Stage); tracingservice.Trace("Mode : {0}", plugincontext.Mode); tracingservice.Trace("Depth : {0}", plugincontext.Depth); tracingservice.Trace("Entity : {0}", plugincontext.PrimaryEntityName); if (!plugincontext.PrimaryEntityId.Equals(Guid.Empty)) { tracingservice.Trace("Id : {0}", plugincontext.PrimaryEntityId); } tracingservice.Trace(""); tracingservice.TraceAndAlign("InputParameters", plugincontext.InputParameters, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("OutputParameters", plugincontext.OutputParameters, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("SharedVariables", plugincontext.SharedVariables, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("PreEntityImages", plugincontext.PreEntityImages, attributetypes, convertqueries, service); tracingservice.TraceAndAlign("PostEntityImages", plugincontext.PostEntityImages, attributetypes, convertqueries, service); tracingservice.Trace("--- Context {0} Trace End ---", depth); } if (parentcontext && plugincontext.ParentContext != null) { tracingservice.TraceContext(plugincontext.ParentContext, parentcontext, attributetypes, convertqueries, service, depth + 1); } tracingservice.Trace(""); }
/// <summary> /// Dumps everything interesting from the plugin context to the plugin trace log /// </summary> /// <param name="tracingservice">The tracer to trace the trace.</param> /// <param name="context">The plugin or workflow context to trace.</param> /// <param name="parentcontext">Set to true if any parent contexts shall be traced too.</param> /// <param name="attributetypes">Set to true to include information about attribute types.</param> /// <param name="convertqueries">Set to true if any QueryExpression queries shall be converted to FetchXML and traced. Requires parameter service to be set.</param> /// <param name="expandcollections">Set to true if EntityCollection objects should list all contained Entity objects with all fields available.</param> /// <param name="includestage30">Set to true to also include plugins in internal stage.</param> /// <param name="service">Service used if convertqueries is true, may be null if not used.</param> public static void TraceContext(this ITracingService tracingservice, IExecutionContext context, bool parentcontext, bool attributetypes, bool convertqueries, bool expandcollections, bool includestage30, IOrganizationService service) { try { tracingservice.TraceContext(context, parentcontext, attributetypes, convertqueries, expandcollections, includestage30, service, 1); } catch (Exception ex) { tracingservice.Trace("--- Exception while trying to TraceContext ---"); tracingservice.Trace($"Message : {ex.Message}"); } }
/// <summary> /// Dumps everything interesting from the plugin context to the plugin trace log /// </summary> /// <param name="tracingservice"></param> /// <param name="plugincontext">The plugin context to trace.</param> /// <param name="parentcontext">Set to true if any parent contexts shall be traced too.</param> /// <param name="attributetypes">Set to true to include information about attribute types.</param> /// <param name="convertqueries">Set to true if any QueryExpression queries shall be converted to FetchXML and traced. Requires parameter service to be set.</param> /// <param name="service">Service used if convertqueries is true, may be null if not used.</param> public static void TraceContext(this ITracingService tracingservice, IPluginExecutionContext plugincontext, bool parentcontext, bool attributetypes, bool convertqueries, IOrganizationService service) { tracingservice.TraceContext(plugincontext, parentcontext, attributetypes, convertqueries, service, 1); }
/// <summary> /// Default settings for the TraceContext /// </summary> /// <param name="tracingservice">The tracer to trace the trace.</param> /// <param name="context">The plugin or workflow context to trace.</param> public static void TraceContext(this ITracingService tracingservice, IExecutionContext context) => tracingservice.TraceContext(context, false, true, false, false, false, null);