Dynamics CRM “Could Not Load Type” errors

 

Ever experienced errors of such like:

“Could not load type 'Microsoft.Xrm.Sdk.Workflow.ICustomActivityExecutionContext' from assembly 'Microsoft.Xrm.Sdk.Workflow, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'”?

Whether it refers to a custom dll or to a CRM internal one as in the above example, sometimes this kind of issue occurs and are not sure where it is coming from.

Here are a few tips which can help:

1. The first step should be to take a CRM trace to try to get more details about the error. You can do this using the diag tool or enabling tracing in the registry keys:

https://support.microsoft.com/kb/907490

2. Next step would be to open Process Monitor to see where exactly it is searching for the dll and what is happening. You can download the tool from here:

https://technet.microsoft.com/en-us/sysinternals/bb896645.aspx

Start the Process Monitor trace until you get the error and then stop it. You can analyse it using these filters:

- For example, if the issue happens for the Async service you can use this filter:

Process Name – is - CrmAsyncService.exe – then include –> Add

clip_image001

- Another filter to leave only the rows related to the assembly mentioned in the error would be:

Path – contains - Sdk.Workflow – then Include -> Add

clip_image002

Click Apply and OK. Now you should see a list like this one:

clip_image003

If you take a look at the Result, Operation and Path columns you will see more information on how and where CRM is trying to access that dll.

3. Fusion logs

If you have installed the Visual Studio tools (https://msdn.microsoft.com/en-us/library/e74a18c4(v=VS.100).aspx):

- Open a Visual Studio command prompt as administrator and launch “fuslogvw”. This will open the fusion logs viewer.

- Settings -> Log bind failures, to log only the binds which have failed, and then indicate where you want the logs to be stored:

clip_image004

- Or Settings -> Log all binds to disk, to log all

- Perform an ISSReset and open CRM -> it will generate all the logs in the path you chose and will appear in the viewer as well.

If you do not have the Visual Studio tools:

- Go to :

        HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
  
 - Add: 
 DWORD LogFailures value set to 1
 DWORD LogResourceBinds value set to 1
 String LogPath set to the path where you wish to store them (for example C:\FusionLog\)
  
 - If you want to log all binds and not only errors: 
        DWORD ForceLog value set to 1
  
 - IISReset and open CRM -> it will generate all logs in the path we chose

- Now open the logs for the dll mentioned in the error to see where it is looking for it, where it is creating the native image etc… and if there are any failures.

- Disable it (in the fusion log viewer or setting the registry keys to 0) once you are finished.

Best Regards

EMEA Dynamics CRM Support Team

Share this Blog Article on Twitter

Tweet

Follow Us on Twitter

Follow @MSDynCRMSupport