PInvokeStackImbalance was detected

I am trying to create a smartdocument using Office 2003 professional edition and implementing the same on VS.NET 2005 edition. As soon as I load the winword.exe(as startup from VS.NET 2005) and attach the manifest in debug mode the following error is displayed. Can someone shed some light on how to overcome, any Microsoft VSTO team members, pls help.

ERROR:

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.

TIA.

Regards

Vishnu (Microsoft Visual C# MVP 2003-2005)




Answer this question

PInvokeStackImbalance was detected

  • Haresh

    Hi,

    This Forum is for VSTO-specific issues. Have you considered using VSTO to create the custom task pane

    You also might try posting your question to one of the Office newsgroups. Additionally, the following link provides some articles on creating smart documents: http://msdn.microsoft.com/office/understanding/smarttags/articles/

    I hope this helps,

    Kathleen McGrath



  • Todd Wenzel

    Hi Misha,

    I'm getting a similar problem when following the VSTO 2005 Excel Lab at http://msdn.microsoft.com/office/default.aspx pull=/library/en-us/odc_vsto2005_tr/html/OfficeVSTO2005ExcelLabs.asp

    I get the problem when trying exercise 3. The problem occurs when I use the completed project, and when I'm following the exercise (typing the code myself.)

    I've included a list of the dlls loaded in the process with their versions at the end of this post.

    What is IBF And is there a newer version I can use which might fix this problem please

    Cheers,

    Daniel Bryars

    Process: EXCEL.EXE Pid: 3888

    Name Description Company Name Version
    ~DF84A8.tmp
    ~DF84A8.tmp
    15EA8131.emf
    23DDE9F0.emf
    2A2B157E.emf
    Accessibility.ni.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    advapi32.dll Advanced Windows 32 Base API Microsoft Corporation 5.01.2600.2180
    Asset Allocations.xls
    AssetAllocations.DLL AssetAllocations Microsoft 1.00.0000.0000
    Async.dll Pi Toolbox Asynchronous Job DLL Pi Research 2.08.0224.0000
    clbcatq.dll Microsoft Corporation 2001.12.4414.0308
    comctl32.dll User Experience Controls Library Microsoft Corporation 6.00.2900.2180
    comctl32.dll Common Controls Library Microsoft Corporation 5.82.2900.2180
    comres.dll Microsoft Corporation 2001.12.4414.0258
    crypt32.dll Crypto API32 Microsoft Corporation 5.131.2600.2180
    cryptdll.dll Cryptography Manager Microsoft Corporation 5.01.2600.2180
    cryptnet.dll Crypto Network Related API Microsoft Corporation 5.131.2600.2180
    ctype.nls
    CustomMarshalers.dll Microsoft .NET Framework Custom Marshalers Microsoft Corporation 2.00.50727.0042
    CustomMarshalers.ni.dll Microsoft .NET Framework Custom Marshalers Microsoft Corporation 2.00.50727.0042
    dciman32.dll DCI Manager Microsoft Corporation 5.01.2600.2180
    diasymreader.dll Dia based SymReader Microsoft Corporation 8.00.50727.0042
    dnsapi.dll DNS Client API DLL Microsoft Corporation 5.01.2600.2180
    EXCEL.EXE Microsoft Office Excel Microsoft Corporation 11.00.8012.0000
    EXCEL.EXE Microsoft Office Excel Microsoft Corporation 11.00.8012.0000
    Field.dll Field DLL Pi Research 6.29.0224.0000
    FwcWsp.dll Microsoft Firewall Client Windows Sockets 2 Service Provider Microsoft (R) Corporation 4.00.3439.0050
    gdi32.dll GDI Client DLL Microsoft Corporation 5.01.2600.2818
    GDIPLUS.DLL Microsoft GDI+ Microsoft Corporation 6.00.3275.0000
    GdiPlus.dll Microsoft GDI+ Microsoft Corporation 5.01.3102.2180
    GoogleDesktopAPI2.dll
    GoogleDesktopOffice.dll
    GoogleDesktopResources_en.dll
    hnetcfg.dll Home Networking Configuration Manager Microsoft Corporation 5.01.2600.2180
    imagehlp.dll Windows NT Image Helper Microsoft Corporation 5.01.2600.2180
    instapi.dll SQL Server Instance API DLL Microsoft Corporation 2005.90.1399.0000
    iphlpapi.dll IP Helper API Microsoft Corporation 5.01.2600.2180
    kerberos.dll Kerberos Security Package Microsoft Corporation 5.01.2600.2698
    kernel32.dll Windows NT BASE API Client DLL Microsoft Corporation 5.01.2600.2180
    l_intl.nls
    locale.nls
    MFC71ENU.DLL MFC Language Specific Resources Microsoft Corporation 7.10.3077.0000
    mfc71u.dll MFCDLL Shared Library - Retail Version Microsoft Corporation 7.10.3077.0000
    Microsoft.Office.Interop.Excel.dll Microsoft.Office.Interop.Excel Microsoft Corporation 11.00.5530.0000
    Microsoft.Office.Interop.SmartTag.dll Microsoft.Office.Interop.SmartTag Microsoft Corporation 11.00.5530.0000
    Microsoft.Office.Tools.Common.dll Microsoft.Office.Tools.Common.dll Microsoft Corporation 8.00.50727.0042
    Microsoft.Office.Tools.Excel.dll Microsoft.Office.Tools.Excel.dll Microsoft Corporation 8.00.50727.0042
    Microsoft.Vbe.Interop.dll Microsoft.Vbe.Interop Microsoft Corporation 11.00.5530.0000
    Microsoft.VisualBasic.dll Visual Basic Runtime Library Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.OfficeTools.Controls.ContainerControl.dll Microsoft.VisualStudio.OfficeTools.Controls.ContainerControl.dll Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.OfficeTools.Controls.ManagedWrapper.dll Microsoft.VisualStudio.OfficeTools.Controls.ManagedWrapper.dll Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapper.dll Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapper Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapper.dll Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapper Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapperUI.dll Microsoft.VisualStudio.OfficeTools.Controls.UnmanagedWrapperUI Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.Tools.Applications.Runtime.dll Microsoft.VisualStudio.Tools.Applications.Runtime.dll Microsoft Corporation 8.00.50727.0042
    Microsoft.VisualStudio.Tools.Applications.Runtime.ni.dll Microsoft.VisualStudio.Tools.Applications.Runtime.dll Microsoft Corporation 8.00.50727.0042
    Microsoft_VisualStudio_OfficeTools_UnmanagedWrapper.exd
    micross.ttf
    msasn1.dll ASN.1 Runtime APIs Microsoft Corporation 5.01.2600.2180
    mscoree.dll Microsoft .NET Runtime Execution Engine Microsoft Corporation 2.00.50727.0042
    mscorjit.dll Microsoft .NET Runtime Just-In-Time Compiler Microsoft Corporation 2.00.50727.0042
    mscorlib.ni.dll Microsoft Common Language Runtime Class Library Microsoft Corporation 2.00.50727.0042
    mscorrc.dll Microsoft .NET Runtime resources Microsoft Corporation 2.00.50727.0042
    mscorrc.dll Microsoft .NET Runtime resources Microsoft Corporation 2.00.50727.0042
    mscorsec.dll Microsoft .NET Security module Microsoft Corporation 2.00.50727.0042
    mscorwks.dll Microsoft .NET Runtime Common Language Runtime - WorkStation Microsoft Corporation 2.00.50727.0042
    MSCTF.dll MSCTF Server DLL Microsoft Corporation 5.01.2600.2180
    msi.dll Windows Installer Microsoft Corporation 3.01.4000.2435
    MSO.DLL Microsoft Office 2003 component Microsoft Corporation 11.00.6568.0000
    MSO.DLL Microsoft Office 2003 component Microsoft Corporation 11.00.6568.0000
    MSOINTL.DLL Microsoft Office 2003 component Microsoft Corporation 11.00.6565.0000
    msv1_0.dll Microsoft Authentication Package v1.0 Microsoft Corporation 5.01.2600.2180
    msvcp71.dll MicrosoftR C++ Runtime Library Microsoft Corporation 7.10.3077.0000
    MSVCR71.DLL MicrosoftR C Runtime Library Microsoft Corporation 7.10.2179.0000
    msvcr80.dll MicrosoftR C Runtime Library Microsoft Corporation 8.00.50727.0042
    msvcrt.dll Windows NT CRT DLL Microsoft Corporation 7.00.2600.2180
    mswsock.dll Microsoft Windows Sockets 2.0 Service Provider Microsoft Corporation 5.01.2600.2180
    netapi32.dll Net Win32 API DLL Microsoft Corporation 5.01.2600.2180
    ntdll.dll NT Layer DLL Microsoft Corporation 5.01.2600.2180
    ntdsapi.dll NT5DS Microsoft Corporation 5.01.2600.2180
    OFFICE.DLL Microsoft.Office.Core Microsoft Corporation 11.00.5530.0000
    ole32.dll Microsoft OLE for Windows Microsoft Corporation 5.01.2600.2726
    oleaut32.dll Microsoft Corporation 5.01.2600.2180
    oledlg.dll Microsoft Windows(TM) OLE 2.0 User Interface Support Microsoft Corporation 5.01.2600.0000
    OTKLOADR.DLL Assembly loader Microsoft Corporation 7.10.5077.0000
    Pi Toolbox - 3888.xml
    powrprof.dll Power Profile Helper DLL Microsoft Corporation 6.00.2900.2180
    psapi.dll Process Status Helper Microsoft Corporation 5.01.2600.2180
    rasadhlp.dll Remote Access AutoDial Helper Microsoft Corporation 5.01.2600.2180
    rasapi32.dll Remote Access API Microsoft Corporation 5.01.2600.2180
    rasman.dll Remote Access Connection Manager Microsoft Corporation 5.01.2600.2180
    RICHED20.DLL Rich Text Edit Control, v5.0 Microsoft Corporation 5.50.0099.2010
    rpcrt4.dll Remote Procedure Call Runtime Microsoft Corporation 5.01.2600.2180
    rsaenh.dll Microsoft Enhanced Cryptographic Provider Microsoft Corporation 5.01.2600.2161
    rtutils.dll Routing Utilities Microsoft Corporation 5.01.2600.2180
    schannel.dll TLS / SSL Security Provider Microsoft Corporation 5.01.2600.2180
    secur32.dll Security Support Provider Interface Microsoft Corporation 5.01.2600.2180
    security.dll Security Support Provider Interface Microsoft Corporation 5.01.2600.2180
    sensapi.dll SENS Connectivity API DLL Microsoft Corporation 5.01.2600.2180
    setupapi.dll Windows Setup API Microsoft Corporation 5.01.2600.2180
    shell32.dll Windows Shell Common Dll Microsoft Corporation 6.00.2900.2869
    shfolder.dll Shell Folder Service Microsoft Corporation 6.00.2900.2180
    shlwapi.dll Shell Light-weight Utility Library Microsoft Corporation 6.00.2900.2861
    softpub.dll Softpub Forwarder DLL Microsoft Corporation 5.131.2600.0000
    sortkey.nlp
    sortkey.nls
    sorttbls.nlp
    sorttbls.nls
    stdole2.tlb Microsoft OLE 3.50 for Windows NT(TM) and Windows 95(TM) Operating Systems Microsoft Corporation 3.50.5014.0000
    sxs.dll Fusion 2.5 Microsoft Corporation 5.01.2600.2180
    System.Configuration.dll System.Configuration.dll Microsoft Corporation 2.00.50727.0042
    System.Data.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Drawing.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Drawing.ni.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.EnterpriseServices.dll Microsoft .NET Services Support Infrastructure Microsoft Corporation 2.00.50727.0042
    System.ni.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Transactions.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Windows.Forms.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Windows.Forms.ni.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Xml.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    System.Xml.ni.dll .NET Framework Microsoft Corporation 2.00.50727.0042
    tapi32.dll MicrosoftR Windows(TM) Telephony API Client DLL Microsoft Corporation 5.01.2600.2180
    unicode.nls
    urlmon.dll OLE32 Extensions for Win32 Microsoft Corporation 6.00.2900.2870
    user32.dll Windows XP USER API Client DLL Microsoft Corporation 5.01.2600.2622
    userenv.dll Userenv Microsoft Corporation 5.01.2600.2180
    uxtheme.dll Microsoft UxTheme Library Microsoft Corporation 6.00.2900.2180
    VBASupport.dll VBASupport DLL Pi Research 2.05.0224.0000
    VBE6.DLL Visual Basic Design Time Environment Microsoft Corporation 6.04.0099.0072
    VBE6.DLL Visual Basic Design Time Environment Microsoft Corporation 6.04.0099.0072
    VBE6.DLL Visual Basic Design Time Environment Microsoft Corporation 6.04.0099.0072
    VBE6EXT.OLB Microsoft Visual Basic for Applications Extensibility Microsoft Corporation 6.00.0099.0069
    VBE6INTL.DLL Visual Basic Environment International Resources Microsoft Corporation 6.04.0097.0059
    version.dll Version Checking and File Installation Libraries Microsoft Corporation 5.01.2600.2180
    VSTOExcelAdaptor.dll Excel Visual Studio Design Time Adaptor Addin Microsoft Corporation 8.00.50727.0042
    VSTOLoader.dll VSTOLoader Component Microsoft Corporation 8.00.50727.0042
    VSTOLoader.dll VSTOLoader Component Microsoft Corporation 8.00.50727.0042
    VSTORuntime.dll VSTORuntime Microsoft Corporation 8.00.50727.0042
    VSTORuntimeStorageCtrl.dll VSTORuntimeStorageCtrl Microsoft Corporation 8.00.50727.0042
    VSTORuntimeStorageCtrl.dll VSTORuntimeStorageCtrl Microsoft Corporation 8.00.50727.0042
    VSTORuntimeStorageCtrl.dll VSTORuntimeStorageCtrl Microsoft Corporation 8.00.50727.0042
    VSTOStgLib.exd
    winhttp.dll Windows HTTP Services Microsoft Corporation 5.01.2600.2180
    wininet.dll Internet Extensions for Win32 Microsoft Corporation 6.00.2900.2861
    winmm.dll MCI API DLL Microsoft Corporation 5.01.2600.2180
    winsta.dll Winstation Library Microsoft Corporation 5.01.2600.2180
    wintrust.dll Microsoft Trust Verification APIs Microsoft Corporation 5.131.2600.2180
    wldap32.dll Win32 LDAP API DLL Microsoft Corporation 5.01.2600.2180
    ws2_32.dll Windows Socket 2.0 32-Bit DLL Microsoft Corporation 5.01.2600.2180
    ws2help.dll Windows Socket 2.0 Helper for Windows NT Microsoft Corporation 5.01.2600.2180
    wshtcpip.dll Windows Sockets Helper DLL Microsoft Corporation 5.01.2600.2180
    wtsapi32.dll Windows Terminal Server SDK APIs Microsoft Corporation 5.01.2600.2180
    XLINTL32.DLL Microsoft Office 2003 component Microsoft Corporation 11.00.6565.0000
    xpsp2res.dll Service Pack 2 Messages Microsoft Corporation 5.01.2600.2180


  • Cypris

    FYI, found a post here which fixed my problem:

    http://www.eggheadcafe.com/forumarchives/vsnetvstoolsoffice/mar2006/post26092421.asp

    I removed my own smart tag registry entries from:

    HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Actions and

    HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Recognizers

    Cheers,

    Daniel


  • WM8S

    Vishnu,

    Can you post the list of all the DLLs and their versions, both managed and unmanaged, that are loaded into the process

    We have seen this issue before and IBF 1.0 on the machine is the usual suspect. I have not been able to pinpoint what exactly causes this behavior though.



  • Jason Locke

    I did getover the PInvokeStackImbalance by disabling the MDAConfig entry...

    However, there is something wrong with VS.NET 2005 edition...it does not allow to debug the DLLs with ISmartDocument implementation which is attached to template using manifest.....

    Please note that am not using VSTO 2005 or IBF.

    After trying hard...I gave up on VS.NET 2005 and going back to VS.NET 2003..a shame but reality....looks like no one from MSFT cares:-)..hmmm.



  • PInvokeStackImbalance was detected