Troubleshooting tips

Applies to Dynamics 365 (online), version 9.x

The following information is provided as an aid in diagnosing certain common issues that may arise when developing applications using the .NET SDK assemblies. More content will be added to this topic as time goes on.

For more information about enabling tracing in an on-premises Dynamics 365 Customer Engagement server, see Monitor and troubleshooting Microsoft Dynamics CRM.

Handle the MessageSecurityException exception when you use the Dynamics 365 web services

When you use the Dynamics 365 APIs to connect to the Dynamics 365 (online) organization or discovery services you could receive the following exception:

Unhandled Exception: System.ServiceModel.Security.MessageSecurityException: An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.  

To fix this, you can try deleting the device registration folder named LiveDeviceID in your profile folder C:\Users\<username>. Then, try to connect again.

Exceptions that can occur when running CrmSvcUtil

When you run the CrmSvcUtil.exe tool to generate early-bound entity types, you might receive an exception with the following message.

The type initializer for Microsoft.Xrm.Client.CodeGeneration.CodeCustomization threw an exception.  

This error can be caused if the build version of the CrmSvcUtil tool and Microsoft.Xrm.Client.CodeGeneration.dll assembly aren’t the same. When you develop applications using the .NET SDK assemblies, always use the CrmSvcUtil tool and assemblies that are provided in the same version of the NuGet package.

See also

Troubleshooting and Error Handling
Web Service Error Codes