none
addinn dont work correctlu on 64 bit mechin RRS feed

  • Question

  •  Hi all,

     

    Till now i thought that the only thing that maters is the bitness of office installed on client machine.

    However when installing this simple addin on client machine with windows7 64 bit and office 2007, which by default can be 32 only. The screen of outlook keeps getting stuck can someone please tell me how to compile the addin correctly before deploying it?

    Thanks

    Patric

     

    The code: (should work on any office and any machine):

    Public Class ThisAddIn
        Private Sub ThisAddIn_Startup() Handles Me.Startup
        End Sub
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        End Sub
    End Class

    The screen:

    Sunday, June 17, 2012 7:18 AM

Answers

  • I've been doing research on this. The problem, it turns out, is the result of a number of factors combining in unexpected ways:

    1 - 32 bit applications on 64 bit Windows use the SysWow64 emulation/compatibility layer, which makes transitions between the user and kernel portions of the stack consume more stack space than equivalent native 32 on 32 or 64 on 64 transitions.

    2 - VSTO implements a message hook which, in practice, ends up recursively calling into itself as it walks the chain of parent/child windows.

    3 - Recursive calls through message hooks transition to and from kernel multiple times at each level of recursion.

    4 - In Outlook, the chain of parent/child windows is deeper in the Calendar module than anywhere else.

    Putting these all together, when you have a VSTO add-in in Outlook and the Calendar module is displayed, during redraw we see a fairly deep recursive call chain that walks fairly deep on the stack. In native 32 bit code on a 32 bit OS, or 64 on 64, this does not reach a depth so as to consume the entire stack.

    However, when Outlook is 32 bit and Windows is 64 bit, this recursive call chain gets deep enough to the point where a call fails because there is no more stack space to handle it. This in turn sends error results back up the call chain, ultimately causing the draw operation to fail.

    Incidently, this behavior can be reproduced by several other 32 bit applications simply by attaching Spy++ (which operates through a message hook) to the application and displaying a sufficiently complicated window.

    This behavior is considered a bug by Windows, which they have evaluated several times, but so far have concluded that a fix would be too risky to attempt.

    Our recommendation at this time (I do understand how painful this is) is to not use VSTO for this scenario and instead implement your add-in directly. And, of course, make sure not to use a windows message hook in your implementation.

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:09 PM
    Thursday, June 28, 2012 1:44 PM
    Answerer
  • i deployed quite a few vsto based add-ins for office 2010 32 bit on 64 bit windows and never encountered that problem, although from Stephen;s response one can take conclusion that it should also be a victim of that bug. Stephen, care to correct me?

    In your place i would go with path of minimal resitance:

    1. for all working scenarios (all expect office 2007 on win 64 bit) i would stick with vsto add-in

    2. i would create shared add-in for this single case and reuse all logic from existing vsto add-in minus all classes related specifically to VSTO

    3. slowly, over time i would migrate all add-ins to shared ones, if you will find out that you really need to support all uncommon configurations. This way if new office comes out and c++ code for shared add-in will not work, you still have working vsto add-in that can be deployed to bleeding edge clients.

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 1:15 PM
  • The primary differences with shared addins is:

    No ribbon or form region designers, you implement them using ribbon XML and directly designing form regions and supplying all the code and callbacks.

    No automatic shimming for an isolated AppDomain. You achieve that using the COM Shim Wizard, which is included in VS 2010. You have to download it for VS 2008 and earlier.

    You don't get Startup and Shutdown events, you directly handle the Extensibility events.

    Other than that all the code can be re-used that was in the VSTO addin.

    If there are any questions about the shared addin process starting a new thread might be best.

    I just ran into a situation where a VSTO addin I had sent to my customer over a year ago has been seeing the exact same problem Steve described. All problem instances are Outlook 2010 x86 running on Windows x64. That would most likely be the most common configuration, as MS encourages users to no install 64 bit Office unless really needed, and most newer Windows setups would be 64 bit. We're just starting to convert that addin to a shared model next week. I think this will be a problem that might arise more and more in the future.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 2:06 PM
    Moderator
  • Based on the information presented by Stephen Griffin, I would say that the best and perhaps the only way for you going forward would be to either convert to a shared addin or completely re-write everything in unmanaged code. As a shared addin would allow you to re-use almost all of your existing code I'd say that's your best approach.

    It's really not that big a deal, and at least you got this information before you deployed your code.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 2:54 PM
    Moderator
  • Why do you want to change your code from VB.NET to C#? I use both depending on what the customer wants, unless you have a good reason why go through all the effort of translating from one to the other?

    I'm not sure about any step by step guides for a shared addin. You can take a look at www.outlookcode.com, there should be samples there. I have some templates on my Web site, but they don't include shimming or installers, they mostly would demonstrate some template code and use of the Extensibility events. However, they haven't been updated in years, so some of what they have is out of date (they're written using VS 2005). Those are at http://www.slovaktech.com/outlook_2007_templates.htm. They do demonstrate ribbon callbacks and XML though.

    There are also probably samples at CodePlex.

    A really good idea is to review the information about shimming and handling the ribbon interfaces, as well as information on support for multiple versions of Office applications in the blogs of Misha Shneerson and Andrew Whitechapel, both former members of the VSTO team:

    http://blogs.msdn.com/b/mshneer/archive/2010/03/19/com-shim-wizards-for-vs-2010.aspx

    http://blogs.msdn.com/b/mshneer/archive/2010/02/24/taking-com-shim-wizards-to-64-bit.aspx

    http://blogs.msdn.com/b/mshneer/archive/2008/06/03/targeting-multiple-versions-of-office-without-pias.aspx

    http://blogs.msdn.com/b/andreww/archive/2008/08/27/com-shim-wizard-2-3-1-0.aspx

    http://blogs.msdn.com/b/andreww/archive/2008/06/03/add-ins-for-multiple-office-versions-without-pias.aspx

    All of their blog posts are a wealth of information. I've learned a tremendous amount from their blogs and email contacts with them. If I were you I'd read everything they had to write.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 3:56 PM
    Moderator

All replies

  • always compile it as anycpu. do you use any kind of pinvoke in your add-in?
    Sunday, June 17, 2012 11:20 AM
  • Hi Damian,

    good to hear from you, 

    I am sending now to the client addin compiled as anycpu lets see if that works...

    No pinvoke

    This is the addin:

    Public Class ThisAddIn
        Private Sub ThisAddIn_Startup() Handles Me.Startup
        End Sub
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        End Sub
    End Class
    Sunday, June 17, 2012 12:41 PM
  •  

    Hi Damian,

    this simple addin does not work even if compiled as anycpu.

    However i did something that maybe cusses the problem

    When first compiling the addin in the References Tab

    Microsoft.Office.Interop.Outlook Copy to local is false and when running outlook

    I got a bug

    so insted i did,

    Microsoft.Office.Interop.Outlook Copy to local is true and deployed the addin

    Do you thing it is related to the problem?

    the bug:

    Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

    ************** Exception Text **************

    System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

    File name: 'Microsoft.Office.Interop.Outlook, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'

       at sagi.ThisAddIn.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.4971 (win7RTMGDR.050727-4900)

        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/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

    ----------------------------------------

    System

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4971 (win7RTMGDR.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

    ----------------------------------------

    System.Core

        Assembly Version: 3.5.0.0

        Win32 Version: 3.5.30729.4926 built by: NetFXw7

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll

    ----------------------------------------

    System.Configuration

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

    ----------------------------------------

    System.Xml

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll

    ----------------------------------------

    System.Security

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4951 (win7RTMGDR.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Security/2.0.0.0__b03f5f7f11d50a3a/System.Security.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

    ----------------------------------------

    System.AddIn

        Assembly Version: 3.5.0.0

        Win32 Version: 3.5.30729.5005 built by: Win7RTMGDR

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.AddIn/3.5.0.0__b77a5c561934e089/System.AddIn.dll

    ----------------------------------------

    Microsoft.VisualStudio.Tools.Applications.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.Applications.Runtime.v10.0/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Tools.Applications.Runtime.v10.0.dll

    ----------------------------------------

    System.Deployment

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Deployment/2.0.0.0__b03f5f7f11d50a3a/System.Deployment.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.Windows.Forms

        Assembly Version: 2.0.0.0

        Win32 Version: 2.0.50727.4977 (win7RTMGDR.050727-4900)

        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.4974 (win7RTMGDR.050727-4900)

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

    ----------------------------------------

    System.Xml.Linq

        Assembly Version: 3.5.0.0

        Win32 Version: 3.5.30729.4926 built by: NetFXw7

        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll

    ----------------------------------------

    sagi

        Assembly Version: 1.0.0.0

        Win32 Version: 1.0.0.0

        CodeBase: file:///C:/Users/pniela/Documents/Visual%20Studio%202010/Projects/sagi/sagi/bin/Release/sagi.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

    ----------------------------------------

    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.Contract

        Assembly Version: 2.0.0.0

        Win32 Version: 3.5.30729.4926 built by: NetFXw7

        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

    -----
    Sunday, June 17, 2012 1:17 PM
  • well, not really a bug, only shows that client does not have PIA installed. Could you try to install PIA there and see if problem goes away?
    Sunday, June 17, 2012 6:32 PM
  •  

    Hi,

    No it is not the case, i installed Office2007PIARedist and the simple addin does not work.

    the client machine in 64 bit windows7 but with office 2007 witch is 32 bit..

    Monday, June 18, 2012 8:12 AM
  • hmm, now that you mention it again - how did you manage to install 2007 plugin on 64 bit machine? i thought it was impossible, what vsto and .net do you use in your plugin? and by impossible i was not referring to installation process per se, but rather that plugin will refuse to start altoegether.
    Monday, June 18, 2012 9:05 AM
  • Way not install a 2007 plugin on 64 bit?

    I always thought that the bitness of office is what maters and not the bitness of the machine.

    In this case the client has office 32 bit (office 2007 by default).

    Maybe I will compile the addin using 64 bit and look if it solve the problem.

    By VSTO version do you mean  - what is installed in the Programs and Features tab of my computer?

    In that case Microsoft visual studio 2010 tools for office runtime (86)

    .net – VS2010 32 bit.

    Patric

    Monday, June 18, 2012 12:14 PM
  •  

    Hi,

    Tried to install 64 bit addin on the client machine and got that addin is disabled.

    this is probably because the bitness of office is 32

    This is very strange that the only bug in office is the screen every thing else work just fine

    Monday, June 18, 2012 12:35 PM
  • i vaguely remember that there was no way to make plugin load that was build against VSTOR 2010 on 64 bit machine with 2007 office. I will double check it.
    Monday, June 18, 2012 12:35 PM
  • Thanks
    Monday, June 18, 2012 1:01 PM
  • this is what i get when trying to install vstor 2010 32bit on win7 64 bit machine:

    How did you manage to install vstor 2010 32 bit there? of course installing vstor 2010 64 bit will load succesfully add-ins but _only_ on office 2010. For office 2007 we are out of luck. So maybe this is root of your problems?

    Monday, June 18, 2012 2:15 PM
  •  

    Hi Damian,

    I have installed there vstor 2010 64 so in this point of view it is OK but the addin load successfully and it is on office 2007, only the screen is damaged.

    If I understand correctly what you are saying is that i can’t do anything to solve the screen problem?

    I think it is strange because the client have outlook addins installed on his computer which don’t damage the screen so how could a simple addin like mine can do such damage?

    Monday, June 18, 2012 3:18 PM
  • my point is that i do not know how to reproduce your situation since vstor 2010 64 bit does not work with office 2007 (at least i think so) so your add-in should not load at all. Can someone from MS confirm this? if not, i will try tomorrow to install vstor 64 bit on office 2007 but i'm pretty sure i went down this path a year ago and failed. Are you completly sure that your add-in actually loads there on outlook 2007? could you show us screenshot of add-in window from outlook on that machine?
    Monday, June 18, 2012 3:40 PM
  • in 30 minuts he will send the screenshot
    Monday, June 18, 2012 4:24 PM
  •  Hi,

     

    Name of addin sagi, you can see that it is loaded.

    Compiled as anycpu ,VS2010. on a 32 bit machine.

     

    Installed on 64 bit machine with office 2007 32 bit.

    You can see that there are more addins installed and they don’t make any bugs…

    Moreover, I installed on client machine VS 2010 and the bug still exist (in debug mode)

    It is a compilation issue or references attached….

    Monday, June 18, 2012 5:42 PM
  • other add-ins load because not all add-ins use vsto to run. i;m very suprised it shows as loaded, but i see it was instaled using clickonce and that is a path i did not test, maybe it works. Is there any change client can test your plugin on 32 bit windows, matching bitness of office? (or install office 2010?)
    Monday, June 18, 2012 7:21 PM
  • Hi,

    I have test my addin on 32 bit machine, XP service pack 2 and win7 both with office 2007

    Also I installed it on win7 32 bit with office 2010 32 bit. It works just fine

    But there I install vstor 2010 32bit .

    (Install automatically when addin is installed)

    My original adds in is not instaled with clickonce i have my own Installer.....

    And it works. Only the machine with 64 bit is problematic with the "Screen BUG"

    your comment "other add-ins load because not all add-ins use vsto to run" can you please alaborate?

    what other platforms do we have?, i am currently using the outlookaddin project in VS office tab under VB tab

    Tuesday, June 19, 2012 10:59 AM
  • they could be written using any other language, c++, vb6, etc. vsto is a technology that makes it easy to write and load office add-ins written in .net. for all other languages/runtimes, vsto has no meaning. and if your add-in is not deployed by clickonce, but rather msi, then how come it is loaded from c:\users\user\appdata\local\temp\...\sagi.vsto?
    Tuesday, June 19, 2012 11:18 AM
  • this is just a sample addin do you wish to see MSI installer? i can send you the project..

    Patric


    • Edited by Patrick12_3 Tuesday, June 19, 2012 11:23 AM
    Tuesday, June 19, 2012 11:21 AM
  • no need, if it works for you then i guess it will work for me. Anyway, i still stand by the option that vsto add-ins on office 2007 on 64bit windows do not work and that is main culprit for your problems. if you want, try to mimic exactly client env (office 2007 on win7 64 bit) and try to load your add-in there.
    Tuesday, June 19, 2012 11:44 AM
  •  

    I have tried it I have loaded my addin (a complex one) and it is loaded fine and handle all events and outlook objects.

    I am relapsing com object creating com objects handle Folder.Item events (add, change..)

    All is fine except the screen.

    It is hard for me to grasp that the screen problem is related to 64 bit machine with office 2007 while i am doing lots of complex things in my code

    The sample addin that i used is to find out if something in my code is doing the screen problem,

    but we can see that even in the sample addin which is simple the problem exist...

    Are you able lo install the addin on win7 with office 2007? does that addin have screen problems?

    The client machine is with me and I installed several time the addin win7 64 bit office 2007 

    Patric

    Tuesday, June 19, 2012 1:46 PM
  • installation of windows 7 64 bit and office 2007 is not a problem - what a problem is (for me at least) is to make add-in that uses vsto to run there. I cannot achieve this and therefore i cannot even try to reproduce problem. Sorry, maybe someone else will have some ideas what the problem may be.
    Tuesday, June 19, 2012 2:11 PM
  •  

    Hi Damian.

    I appreciate your help and support.

     Can someone please help me solve this strange problem?

     Patric

    Wednesday, June 20, 2012 6:49 AM
  • Hi,

    Can someone please help; I am getting a strange error after installing a simple addin on a 64 bit machine with office 2007.

    I asked around and no one knows how to solve this problem....

    Thanks a Lot

    Patric

    This is the addin:

    Public Class ThisAddIn
        Private Sub ThisAddIn_Startup() Handles Me.Startup
        End Sub
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        End Sub
    End Class
     

    This is the error: you can see screen all massed up:

    Thursday, June 21, 2012 11:46 AM
  • Hi Patrick12_3,

    I will consult senior engineers look into this issue. And I don't think dupliate thread will make more help for you. There might be some time delay. Thanks for your patience.

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, June 22, 2012 5:38 AM
    Moderator
  • since you will ask for some internal help, please also ask them if vsto based add-ins are supported in such configuration - win 64 bit with office 2007, if so, how. Only vstor 2010 64 bit can be installed there and i cannot make it work with office 2007.
    Friday, June 22, 2012 6:57 AM
  • I don't think this is a question of compatibility - it looks more like a screen painting issue.

    Can you elaborate on what you're doing to generate a screen that looks like that? Are you saying that you start Outlook, and without touching anything, that's what you see? (I'm guessing no.) Or are you resizing the window or something?

    Does the problem only happen in the Calendar module? Or does it happen with the Mail and Contacts modules as well? Do Outlook's menus work? Or is Outlook completely unresponsive? More details on the behavior you see will help us better figure out what's going on.

    Friday, June 22, 2012 6:44 PM
    Answerer
  • Hi Stephen, Tom and Damian,

    Sorry for not responding I didn’t have the time to look at the thread.

    Well, the problem happens only when I resizing the window of outlook itself.

    And only on calendar view.

    When I start outlook everything looks fine and when resizing outlook only the calendar screen get mixed up…. All the manus work correctly and I can’t see any problems with other screens such as mail, inbox… only calendar.

    However, when I switch from calendar view to inbox and return to calendar view again the screen look fine (the bug is gone) .. but if I try to resize outlook again (only on calendar view) the screen shows the same problem as I mentioned.

    I really appreciate your help.

    Thanks a lot

    Patric

    Saturday, June 23, 2012 10:50 AM
  • Thanks for the clarification. And is the code you quoted above the entirety of your add-in? There's no other code in it?
    Monday, June 25, 2012 1:50 AM
    Answerer
  • Hi,

    Yes that is the code

    only:

    Public Class ThisAddIn
        Private Sub ThisAddIn_Startup() Handles Me.Startup
        End Sub
        Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        End Sub
    End Class

    Thanks for your help.

    Patric

    Monday, June 25, 2012 8:49 AM
  •  

    Hi Stephen,

    Did you have the chance to look further to my problem?

    I would appreciate any help on the subject,

     

    Thanks a lot.

    Patric.

    Wednesday, June 27, 2012 9:17 AM
  • I've been doing research on this. The problem, it turns out, is the result of a number of factors combining in unexpected ways:

    1 - 32 bit applications on 64 bit Windows use the SysWow64 emulation/compatibility layer, which makes transitions between the user and kernel portions of the stack consume more stack space than equivalent native 32 on 32 or 64 on 64 transitions.

    2 - VSTO implements a message hook which, in practice, ends up recursively calling into itself as it walks the chain of parent/child windows.

    3 - Recursive calls through message hooks transition to and from kernel multiple times at each level of recursion.

    4 - In Outlook, the chain of parent/child windows is deeper in the Calendar module than anywhere else.

    Putting these all together, when you have a VSTO add-in in Outlook and the Calendar module is displayed, during redraw we see a fairly deep recursive call chain that walks fairly deep on the stack. In native 32 bit code on a 32 bit OS, or 64 on 64, this does not reach a depth so as to consume the entire stack.

    However, when Outlook is 32 bit and Windows is 64 bit, this recursive call chain gets deep enough to the point where a call fails because there is no more stack space to handle it. This in turn sends error results back up the call chain, ultimately causing the draw operation to fail.

    Incidently, this behavior can be reproduced by several other 32 bit applications simply by attaching Spy++ (which operates through a message hook) to the application and displaying a sufficiently complicated window.

    This behavior is considered a bug by Windows, which they have evaluated several times, but so far have concluded that a fix would be too risky to attempt.

    Our recommendation at this time (I do understand how painful this is) is to not use VSTO for this scenario and instead implement your add-in directly. And, of course, make sure not to use a windows message hook in your implementation.

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:09 PM
    Thursday, June 28, 2012 1:44 PM
    Answerer
  • Can Outlook instead increase its stack size?

    I have seen a similar problem under IIS, where the latest versions only specify a 512 kB stack (older versions used 1Mb) and if you have a fairly complex native executable, IIS would not be able to load it if its is compiled in the debug mode.


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!


    Thursday, June 28, 2012 5:02 PM
  •  

    Hi Stephen,

    Wow.... this is a serious problem I don’t know how to implement my addin directly.

    I only know how to use VSTO.

    Can you please post a reference on how to implement the addin directly?

    What about Dmitry’s suggestion? To increase the stuck size?, can I do it by code?

    This I think can solve the problem…

     

    I appreciate your help and support, and hope that we could find a simple solution to this problem.

     

    Thanks again.

    Friday, June 29, 2012 9:32 AM
  • Please remember that there is also a solution to ask user to either use 32 bit windows (if they have 64 bit they also have 32 bit) or matching office bitness (this is harder since they would need to upgrade to office 2010)
    Friday, June 29, 2012 9:42 AM
  • Hi Damian,

    You are suggesting to filter all users with windows 32 bit and office 2007

    It can be done but this will reduce Income.

    A good question it what is the proportion of 32 bit and office 2007 from all office users?

    I am looking right now on how to create shared addin’s I am assuming that this is what Stephen suggested, well this is a lot of work … tell me Damian is it possible to implement calendar events in this platform? I am not familiar with shared addins..

    Do you have a good reference to Stephen suggestion?

    I hope that Dmitry’s sugetion will be possible (to increase outlook size).

    Till now I have encountered just this problem (windows of 32 bit and office 2007) and I want to start testing the application in all combinations. Before I start can you please point me to the right direction?

    I can see 4 combination

    1. OS (windows7, Vista, XP service pack 2,3). 32 bit
    2. OS (windows7, Vista) 64 bit
    3. office 2007, 2010 32 bit
    4. office 2010 64 bit

    Did I miss some combinations? Is that all?

    Thanks Alot

    Patric.

    Friday, June 29, 2012 10:12 AM
  • Hi Stephen, Dmitry and Damian,

    This post freaked me out a little bit,

    So before I deploy the application to all users, can you please tell me what should I look for? Meaning: do you know of more office bugs that will cause the application to fail?

    My addin: office 2007.

    Thanks J

    Patric

    Friday, June 29, 2012 10:19 AM
  • which post freaked you out?

    As for shared add-ins, i think there is already wizard to download that will generate c++ stub to load your add-in (.net based) into spearate app-domain. Maybe Ken will be albe to provide direct link. From Stephen description we see that problem lies with VSTO (which uses message hook), so using shared add-in approach you will be free of this curse. I guess maintenance will be low as once compiled, this code will not change. But of course you will be at the mercy of guys releasing upgraded wizard once new office comes out (in six months or so) as this is done usually a little bit after release of new office.

    Friday, June 29, 2012 11:18 AM
  • What is freaking me out is the difference of office versions I need to know if my addin will work there.

    I test my addin (2007)

    Office 2007, windows 32 bit – OK.

    Office 2007 windows 64 bit NOT OK.

    Office 2010 32 bit windows 32 bit OK.

    I need to do some more testing on a 64 bit but before I start

    Can you please tell me from your experience if I need to expect problems with?

    1. Office 2010 32 bit on windows 64 bit.
    2. Office 2010 64 bit on windows 64 bit.
    3. And later test the new office release.

    About: Office 2007 windows 64 bit “NOT OK”.

    The options are to use the wizard or write the code again..

    Can you please ask Ken to post a direct link to that wizard? For now to solve only

    The issue with office 2007 and windows 64 bit., and if the client upgrade to office 2010

    I can send him a new installation …

    Appreciate it.

    Patric

    Friday, June 29, 2012 12:15 PM
  • i deployed quite a few vsto based add-ins for office 2010 32 bit on 64 bit windows and never encountered that problem, although from Stephen;s response one can take conclusion that it should also be a victim of that bug. Stephen, care to correct me?

    In your place i would go with path of minimal resitance:

    1. for all working scenarios (all expect office 2007 on win 64 bit) i would stick with vsto add-in

    2. i would create shared add-in for this single case and reuse all logic from existing vsto add-in minus all classes related specifically to VSTO

    3. slowly, over time i would migrate all add-ins to shared ones, if you will find out that you really need to support all uncommon configurations. This way if new office comes out and c++ code for shared add-in will not work, you still have working vsto add-in that can be deployed to bleeding edge clients.

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 1:15 PM
  • the stack size is a field in the executable's PE header; it is set at compile time (when outlook.exe is built by MS).

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.3 is now available!

    Friday, June 29, 2012 1:47 PM
  • The primary differences with shared addins is:

    No ribbon or form region designers, you implement them using ribbon XML and directly designing form regions and supplying all the code and callbacks.

    No automatic shimming for an isolated AppDomain. You achieve that using the COM Shim Wizard, which is included in VS 2010. You have to download it for VS 2008 and earlier.

    You don't get Startup and Shutdown events, you directly handle the Extensibility events.

    Other than that all the code can be re-used that was in the VSTO addin.

    If there are any questions about the shared addin process starting a new thread might be best.

    I just ran into a situation where a VSTO addin I had sent to my customer over a year ago has been seeing the exact same problem Steve described. All problem instances are Outlook 2010 x86 running on Windows x64. That would most likely be the most common configuration, as MS encourages users to no install 64 bit Office unless really needed, and most newer Windows setups would be 64 bit. We're just starting to convert that addin to a shared model next week. I think this will be a problem that might arise more and more in the future.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 2:06 PM
    Moderator
  • Hi Damian and Ken.

    I understand from your post that it is best not to develop addins in VSTO yet.

    The reason is  that MS encourages users to no install 64 bit Office unless really needed so in the future there will be  lots of Office 32 bit installed on Windows 64 bit. And as Ken said even in office 2010 32 bit there are problems with addins developed in VSTO running on windows 64 bit.

    Please correct me if I understood wrong. This is so important.

    Now this is freaking me outJ..

    I didn’t deployed the addin yet so if what you are saying is correct the best way for me is

    To convert my addin to shared model now?

    Thanks a lot for you support.

    Patric

    Friday, June 29, 2012 2:30 PM
  • Based on the information presented by Stephen Griffin, I would say that the best and perhaps the only way for you going forward would be to either convert to a shared addin or completely re-write everything in unmanaged code. As a shared addin would allow you to re-use almost all of your existing code I'd say that's your best approach.

    It's really not that big a deal, and at least you got this information before you deployed your code.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 2:54 PM
    Moderator
  • I am so sad...

    OK I agree, the best approach is to minimize future bugs and they will append if I deploy in VSTO.

    Unfortunately I don’t know anything about shared addin.

    I am suggesting starting a new thread of building outlook shared addin

    Ken do you have links and information a step by step of how to build an outlook shared addin?. I searched the web and didn’t find something serious…

    I have an idea I wrote my addin in VB so now is a good chance to write the code in c#

    Do you agree?

    What do you say? Can you guys help me with that?J

    Patric

    Friday, June 29, 2012 3:28 PM
  • Why do you want to change your code from VB.NET to C#? I use both depending on what the customer wants, unless you have a good reason why go through all the effort of translating from one to the other?

    I'm not sure about any step by step guides for a shared addin. You can take a look at www.outlookcode.com, there should be samples there. I have some templates on my Web site, but they don't include shimming or installers, they mostly would demonstrate some template code and use of the Extensibility events. However, they haven't been updated in years, so some of what they have is out of date (they're written using VS 2005). Those are at http://www.slovaktech.com/outlook_2007_templates.htm. They do demonstrate ribbon callbacks and XML though.

    There are also probably samples at CodePlex.

    A really good idea is to review the information about shimming and handling the ribbon interfaces, as well as information on support for multiple versions of Office applications in the blogs of Misha Shneerson and Andrew Whitechapel, both former members of the VSTO team:

    http://blogs.msdn.com/b/mshneer/archive/2010/03/19/com-shim-wizards-for-vs-2010.aspx

    http://blogs.msdn.com/b/mshneer/archive/2010/02/24/taking-com-shim-wizards-to-64-bit.aspx

    http://blogs.msdn.com/b/mshneer/archive/2008/06/03/targeting-multiple-versions-of-office-without-pias.aspx

    http://blogs.msdn.com/b/andreww/archive/2008/08/27/com-shim-wizard-2-3-1-0.aspx

    http://blogs.msdn.com/b/andreww/archive/2008/06/03/add-ins-for-multiple-office-versions-without-pias.aspx

    All of their blog posts are a wealth of information. I've learned a tremendous amount from their blogs and email contacts with them. If I were you I'd read everything they had to write.


    Ken Slovak MVP - Outlook

    • Marked as answer by Patrick12_3 Friday, June 29, 2012 4:08 PM
    Friday, June 29, 2012 3:56 PM
    Moderator
  •  

    Thank you all for your help.

    I will read Ken's links and I think I will start a new thread about shared addin soon.

    Tank you Ken, Stephen and Damian

    Thank a lot

     

    Patrick

    Friday, June 29, 2012 4:08 PM