Photo by Charanjeet Dhiman on Unsplash
Short post today. Some time ago I was developing plugins for a new customer and I decided to start using dependent assemblies. After initial setup everything worked and I started writing some code. Everything looked OK but problems started when I tried to debug the code. I installed the profiler, hit execute and… got an unexpected exception in the Plug-in Profiler. What?
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: The given key was not present in the dictionary. (Fault Detail is equal to Exception details:
ErrorCode: 0x80040224
Message: The given key was not present in the dictionary.
TimeStamp:
OriginalException: PluginExecution
ExceptionSource: PluginExecution
--
).
Wait, what? Surely Plugin-in Trace Logs has more information right?

Nope! So what’s the problem? It’s the profiler which doesn’t work with dependent assemblies! I didn’t notice that and at that time I didn’t see any article describing it. Fortunately, thanks to a friend of mine – Michał Zawadzki, the whole situation was handled quickly. If you stumble across this problem, just head over to appsettings.json in you plugin registration tool folder and update LegacyPluginProfiler option to false. This will automatically install the profiler that can handle such plugins.
Hope this helps.
BTW, as a side note, when you want to add plugin to a solution it’s not where you’d expect it to be. It’s not under developer like regular plugins are:

You need to go all the way to Other and scroll down until you see Plugin Package.

Happy coding!