This is likely a side-effect of me being rather new to coding in C# and coding CRM solutions however I came across an issue in that I needed to create some tracing on a plugin however I couldn’t add it as a parameter of the Execute function.
I’ll cover two ways to enable tracing within a custom plugin, the standard way which everyone suggests and a workaround which I used –
The standard method is to use “IServiceProvider serviceProvider “as a parameter for the Execute method as below and then to retrieve the Tracing Service from it –
Which is great however I needed to do it a slightly different way in my case –
I was using “CodeActivityContext” as a parameter for Execute due to it being a custom workflow action and as such couldn’t get the TracingService in the same manner, instead I had to retrieve it from the executionContext –