Previous Thread:   Adding Controls To Word Document

3/1/2006 4:49:21 PM    PInvokeStackImbalance error when debugging VSTO 2005 solution with active VSTO 2003 smarttags
Hi,  
  
I'm creating VSTO solutions for almost two years now. The existing solutions  
  
are built on top of VSTO 2003 and include a research provider, smart tag and  
  
Outlook COM-Addin. Everything is written in C#, targeting the .NET Framework  
  
1.1.  
  
I now have installed VSTO 2005 and receive the following error when  
  
debugging:  
  
PInvokeStackImbalance was detected  
  
Message: A call to PInvoke function  
  
'WRDomainSetup!WRDomainSetup.EverettPolicy::GetRequestedRuntimeInfo' has  
  
unbalanced the stack. This is likely because the managed PInvoke signature  
  
does not match the unmanaged target signature. Check that the calling  
  
convention and parameters of the PInvoke signature match the target  
  
unmanaged signature.  
  
It occurs in the  
  
this.ActionsPane.Controls.Add(userControl);  
  
call of the ThisDocument_Startup method of a Word Document project.  
  
It only happens if my existing smarttag - which is based on VSTO 2003 - is  
  
installed. I do not mean "running", I mean installed. Even If I uncheck the  
  
smarttag actions in Word, I still get the same error. However, after  
  
removing the smarttag settings in  
  
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Actions and  
  
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Recognizers,  
  
debugging the VSTO 2005 solution works fine. I have no runtime issues, at  
  
least I haven't found anything so far. It's only a debugging problem.  
  
Any ideas?  
  
Thanks,  
  
Michael  
  
http://www.stunnware.com/crm  
  
----------------------------------------------------------