none
System.OverflowException when running 2010-addin on 2013. Any ideas? RRS feed

  • Question

  • I have a potential customer of a product of mine reporting a problem with a plugin I've created for Outlook 2010, built for .NET 3.5 in Visual Studio 2010, which makes it link in the v9.0-runtime (e.g Microsoft.Office.Tools.v9.0.dll). The project is set to "Any CPU" build config.

    I have done successful testing myself, but this particular user gets the following error. Anyone have any tips on what might be wrong?

    He is running on Windows 8 64bit w/Outlook 2013

    ************** Exception Text **************
    System.OverflowException: Arithmetic operation resulted in an overflow.
       at Microsoft.VisualStudio.Tools.Applications.InteropAdapter.GetRemoteHashCode()
       at Microsoft.VisualStudio.Tools.Applications.ProxyManager.ContractComparator..ctor(Object remoteObject)
       at Microsoft.VisualStudio.Tools.Applications.ProxyManager.GetBucketForRemoteObjectOrContract(Object remoteObjectOrContract, Boolean createIfDoesNotExist)
       at Microsoft.VisualStudio.Tools.Applications.ProxyManager.GetProxy(Object proxy, Type reflectedType)
       at Microsoft.VisualStudio.Tools.Applications.Internal.ProxyHelpers.FireEvent(EventHandler`1 handler, Object sender, IContract adapter, Object comObject, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
       at Microsoft.VisualStudio.Tools.Applications.TypeServices.ObjectFromContract(IContract remoteContract, Type expectedType, TypeInfrastructureManager typeInfrastructureManager)
       at Microsoft.VisualStudio.Tools.Applications.Internal.IHostItemProviderProxy.ObjectFromContract(IContract contract, Type primaryType)
       at Microsoft.VisualStudio.Tools.Office.Internal.IOfficeHostItemProviderProxy.ObjectFromContract(IContract contract, Type primaryType)
       at Microsoft.VisualStudio.Tools.Office.Internal.IOfficeHostItemProviderProxy.GetHostObject(Type primaryType, String primaryCookie)
       at Microsoft.VisualStudio.Tools.Office.RemoteComponent.GetHostItem[T](Type type, String cookie)
       at O2010Addin.GTAddin.Initialize()
       at Microsoft.VisualStudio.Tools.Office.EntryPointComponentBase.Microsoft.VisualStudio.Tools.Applications.Runtime.IEntryPoint.Initialize(IServiceProvider hostContext)
       at Microsoft.VisualStudio.Tools.Applications.AddInAdapter.ExecutePhase(ExecutionPhases executionPhases)
       at Microsoft.VisualStudio.Tools.Office.Internal.OfficeAddInAdapterBase.InitializeEntryPointsHelper()
     
     
    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.6387 (Win8RTM.050727-6300)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.Runtime.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Runtime.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Runtime.v10.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Hosting.v10.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v10.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.v9.0.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.6387 (Win8RTM.050727-6300)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    GogTasks2010
        Assembly Version: 5.8.4.0
        Win32 Version: 5.8.4.0
        CodeBase: file:///C:/Program%20Files%20(x86)/GogTasks/GogTasks2010.DLL
    ----------------------------------------
    Microsoft.Office.Tools.Outlook.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Tools.Outlook.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Outlook.v9.0.dll
    ----------------------------------------
    Microsoft.Office.Tools.Common.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Tools.Common.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.Common.v9.0.dll
    ----------------------------------------
    Microsoft.Office.Tools.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Tools.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.Office.Tools.v9.0.dll
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.6387 (Win8RTM.050727-6300)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.6387 (Win8RTM.050727-6300)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    office
        Assembly Version: 15.0.0.0
        Win32 Version: 15.0.4433.1506
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/office/15.0.0.0__71e9bce111e9429c/office.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.AddInAdapter.v9.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.AddInAdapter.v9.0.dll
    ----------------------------------------
    System.AddIn
        Assembly Version: 3.5.0.0
        Win32 Version: 3.5.30729.6387 built by: Win8RTM
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.AddIn/3.5.0.0__b77a5c561934e089/System.AddIn.dll
    ----------------------------------------
    System.AddIn.Contract
        Assembly Version: 2.0.0.0
        Win32 Version: 3.5.30729.6387 built by: Win8RTM
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.AddIn.Contract/2.0.0.0__b03f5f7f11d50a3a/System.AddIn.Contract.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.Contract.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Contract.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Contract.v9.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.Contract.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Contract.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Contract.v9.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Adapter.v9.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.Outlook.HostAdapter.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Outlook.HostAdapter.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Outlook.HostAdapter.v10.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.HostAdapter.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.HostAdapter.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.HostAdapter.v10.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0
        Assembly Version: 9.0.0.0
        Win32 Version: 9.0.30729.4130
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.ServerDocument.v9.0.dll
    ----------------------------------------
    Microsoft.VisualStudio.Tools.Office.Contract.v10.0
        Assembly Version: 10.0.0.0
        Win32 Version: 10.0.31119.0
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualStudio.Tools.Office.Contract.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Office.Contract.v10.0.dll
    ----------------------------------------
    Microsoft.Office.Interop.Outlook
        Assembly Version: 15.0.0.0
        Win32 Version: 15.0.4420.1017
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.Office.Interop.Outlook/15.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Outlook.dll
    ----------------------------------------


    Monday, December 24, 2012 11:47 AM

All replies

  • Hi FrodeNilsen2,

    Thanks for posting in the MSDN forum.

    I will involve some experts into your thread to see whether they can help you. There might be some time delay, appreciate for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 25, 2012 1:24 AM
    Moderator
  • Hi,

    I suspect the problem results from your addin code, below shows up in the callstack:

    O2010Addin.GTAddin.Initialize()

    Do you have some complex logic in there? Please share this piece of code if possible.

    I have tried the scenario, run Outlook 2010, .NET 3.5 addin on Outlook 2013, Windows 8, it works well. Please check your code.

    best regards,


    Forrest Guo | MSDN Community Support | Feedback to manager

    Tuesday, December 25, 2012 2:30 PM
    Moderator
  • The Initialize()-method is code generated by Visual Studio:

            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Tools.Office.ProgrammingModel.dll", "10.0.0.0")]
            [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Never)]
            protected override void Initialize() {
                base.Initialize();
                this.Application = this.GetHostItem<Microsoft.Office.Interop.Outlook.Application>(typeof(Microsoft.Office.Interop.Outlook.Application), "Application");
                Globals.GTAddin = this;
                global::System.Windows.Forms.Application.EnableVisualStyles();
                this.InitializeCachedData();
                this.InitializeControls();
                this.InitializeComponents();
                this.InitializeData();
            }

    Since the Initialize-method in turn calls GetHostItem(), which ends up calling Microsoft.VisualStudio.Tools.Applications.InteropAdapter.GetRemoteHashCode() which then causes the Overflow-error, I was more suspecting the error to be something related to 64-bit vs 32 bit architectures and libraries. I was hoping someone had experienced the same problem.

    I will do some more testing myself tomorrow to see if I can reproduce the error locally. Very difficult to "remote debug" through mail correspondance with a client.

    In the mean time, Happy New Year! :-)

    Monday, December 31, 2012 3:56 PM
  • We have the exact same problem, so you're definitely not alone.

    Problem is: when I install Visual STudio to debug it further, it all of a sudden works.

    I'm currently thinking it might be related to the referenced assemblies: interop/VSTO/.NET itself, which are different.

    Still doing further debugging, even though that's hard with OfficeAddins, especially if you can't use Vis Studio (since it suddenly starts working then, as if it knows..)

    Tuesday, January 8, 2013 11:12 AM
  • Hi,

    I'll report the issue through internal channel. Further investigation requires a reproduce environment. If you have simplified steps, please let me know.

    thanks.


    Forrest Guo | MSDN Community Support | Feedback to manager

    Tuesday, January 8, 2013 3:29 PM
    Moderator
  • Thank you.

    We'll investigate some further, in the hopes of coming up with a reproduction.
    I did get it to work sometimes, with explicit clean installs of .NET and VSTO v4, but sometime,s it simply doesn't work. Once it's 'broken', on a machine, I can't find any way to fix it for that machine.

    Is the stacktrace helpful in ay way? (reported by original poster, same as the one we get.)

    Wednesday, January 9, 2013 10:36 AM
  • I think we might have found the problem...

    We can reproduce on a clean Windows 8, where:
    - we install Outlook 2013
    - we install .NET 3.5 
    - we install VSTO v4
    - we install our addin

    ==> broken.

    If we install VSTO v4 PRIOR to installing .NET 3.5 (so it installs on .NET 4 framework?), everything works just fine...

    ==> compatibility issues with VSTO4 and .NET 3.5 (on Win8?)

    (our addin is built, targeting .NET 3.5, will now test what happens when we target 4.0..)

    Friday, February 22, 2013 9:10 AM
  • And another update...

    Since our initial problem, a new version of the VSTO runtime was released.
    Using this one seems to resolve the issue...

    (only downside: older VSTO runtime was 5MB or so, the new one is > 40??)


    Monday, February 25, 2013 9:26 AM
  • Hello, I experience the same problem with the new VSTO build on Windows 8.1, Office x64. My add-in is targeting .NET 3.5.

    Are there any workarounds that doesn't require installing Visual Studio?

    Thursday, June 12, 2014 11:45 AM