The following code works fine in AGD 10.3.1, but managed debug assistant throws a PInvokeStackImbalance error in AGD 10.4 (ESRI.ArcGIS.ADF.Local!ESRI.ArcGIS.ADF.Native::memcpy). Any fix other than ignoring this kind of exception?
private void LoadCustomizations()
{
try
{
ICommandBar pContextMenu = GetCommandBar("{7D931EAE-D31F-11D2-9F40-00C04F6BC78E}");
if (pContextMenu == null)
{
return;
}
UID pUIDSubmit = new UID();
pUIDSubmit.Value = "SubmitVersion.cmdSubmitVersion";
Object indexObj = Type.Missing;
ICommandBar subVercmd = pContextMenu.Add(pUIDSubmit, ref indexObj) as ICommandBar;
((ICommandItem)pContextMenu).Refresh();
m_isMenuPresent = true;
}
Check out this Technical Article (http://support.esri.com/technical-article/000012655). I believe the problem discussed in Article 000012655 also occurs in 10.3.x version. Based on the Article, I don't think there are other ways to fix it other than unchecking the exception settings, since it appears to be a framework-level issue and there is nothing in the code that we can modify.