Error: Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in...
When debugging in Visual Studio 2013 or Visual Studio 2015 with ArcGIS Engine applications and ArcGIS for Desktop add-ins that reference ESRI.ARCGIS.ADF.Local.dll, The following error can occur:
Error: "Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in '<Path to add-in or application dll/exe>'."
Error messages may be encountered such as the following:
The reference to ESRI.ARCGIS.ADF.Local.dll in ArcGIS Engine applications or ArcGIS Desktop add-ins can throw the PInvokeStackImbalance message.
Solution or Workaround
To resolve this issue, uncheck the 'Break when this exception type is thrown' checkbox in the error message dialog and continue debugging.