How to diagnose plugin errors in Dynamics 365

Image for post
Image for post

This blog talks about a plugin error which I have seen a number of times when using the Plugin Developer Toolkit, it will discuss how to diagnose plugin errors in general.

Knowledge helps when things go wrong

There is always a difference between theoretical knowledge and practical knowledge. You can learn the theory of something but find it’s different when you try to use the theory in practical use (e.g. after reading about plugins you then try to write a plugin) you there are gaps in knowledge which you quickly find.

When developers start to plugins they usually go through

  • learn to write plugin code, find lots of errors
  • Deploy plugin, error haven’t signed the plugin, error permissions etc.
  • Slowly but surely the developers experience fewer problems or problems they know how to resolve

In-depth knowledge of how Microsoft Dynamics 365 works and the underlying plugin infrastructure becomes important when things go wrong. When errors appear, developers need to understand the cause of the error but why it’s complaining, the answer is usually understandable.

  • The Dynamics plugin execution framework
  • The roles and privileges needed to deploy plugins

Some useful Hosk Plugin blog posts

I use the plugin registration tool to inspect what plugins and steps are deployed and the ability to change the view to see what plugins are deployed for each entity is useful when investigating bugs on Dynamics 365 solutions you are not familiar with.

Most of the time you don’t want to mix using the plugin registration tool and the CRM developer toolkit because the developer toolkit will overwrite the changes you make manually next a developer uses it to deploy CRM customizations.

The plugin registration tool is great for viewing the plugins deployed and its portability allows you to use it in customer environments.

Dealing with Plugin errors

If When you experience a plugin error I would recommend you first read my blog on common problems because I cover the most common errors.

Stop and think about the cause of the problem. Many developers can go into panic mode when they encounter an error, instead of thinking about the problem they instantly go and get a senior developer to help them.

Then when the senior developer is at their desk, they explain the problem. The process of explaining the problem to the developer, the solution to the problem can become clear. This is known as rubber ducking or I call this Cardboard developer

When you encounter a plugin problem or CRM developer problems, follow these steps

  1. Stop
  2. Engage Brain\Think
  3. What’s happening?
  4. What should happen?
  5. Make a list of the possible causes of the problem
  6. Investigate your list

If you can’t resolve the problem, you can then at tell the developer what you know, what you have tried.

I don’t encourage any developers to suffer in silence but it’s more beneficial for your learning if you try to understand and resolve problems yourself. The benefit of trying to resolve the problem yourself is you get in the habit and become less dependent on the help of your colleagues.

Don’t Assume, know

Don’t Assume, Know is a Hosk mantra I tell myself when investigating problems or debugging. I have wasted many hours investigating problems and looking for solutions based on an incorrect assumption. When dealing with problems, assume nothing, check assumptions and cross them off. Lots of times you will find the problem.

Plugin Error Messages

The error messages Microsoft Dynamics 365 are a mixture of a confusing statement with a nugget of truth tucked inside. Developers new to Dynamics development they are just unhelpful messages.

As your experience and knowledge increases you will find they often point you in the right direction but you need to have built up a map of the Dynamics 365 landscape, so you know where to go and check.

Plugin Error Example

This is common error I have experienced a few times but I was trying to deploy a plugin using the CRM developer toolkit and I got this error

Error registering plugins and/or workflows. Plug-in assembly does not contain the required types or assembly content cannot be updated.

Lets break down the message to try and decipher the problem

  1. It can’t register the plugin/workflow
  2. Plugin Assembly does not contain required types or the assembly cannot be updated.
  3. So we know the plugin assembly (the DLL) exists but it cannot update it.

The first thing to do is know not assume. So I opened the Plugin Registration tool and found the DLL. I could see it had three steps.

I then looked at the RegisterFile.crmregister file and found this had two steps.

The problem was because we were trying to update an assembly with 2 steps but the assembly had 3 steps. It couldn’t update the assembly because it was too different and this error message was letting us know (in a slightly confusing way).

I have experienced this problem before and the solution to the problem is to unregister the Assembly and install it again.

This problem has occurred when I have created new plugins and sometimes when I have updated a plugin maybe in a different solution but for some reason I couldn’t update the DLL.

In this case how the extra step got into the assembly was a complete mystery but it’s OK to delete the plugin assembly because I knew I was going to deploy it again and install a new version of the Plugin assembly.

Written by

Have been working with Dynamics 365 since version 4 and enjoy reading and delivering enterprise projects

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store