locked
ToolWindows.OutputWindow is throwing ArgumentException in VS2010 German Version RRS feed

  • Question

  • When I try to create an output window with the following line of code using VS2010 English Version there is no issue

    EnvDTE.OutputWindow outputWindow = applicationObject.ToolWindows.OutputWindow;

    outputWindowPane = outputWindow.OutputWindowPanes.Add("My Output");

    However when I use VS2010 German Version it fails. Following line throws ArgumentException

    EnvDTE.OutputWindow outputWindow = applicationObject.ToolWindows.OutputWindow;

    stack trace is as follows :

     at Microsoft.VisualStudio.Platform.WindowManagement.DTE.WindowsCollection.Item(Object index)
       at Microsoft.VisualStudio.Platform.WindowManagement.DTE.Windows.<>c__DisplayClassd.<Item>b__c()
       at Microsoft.VisualStudio.Shell.ThreadHelper.Invoke[TResult](Func`1 method)
       at Microsoft.VisualStudio.Platform.WindowManagement.DTE.Windows.Item(Object index)


    Please let me know what I have to do to run EnvDTE.OutputWindow outputWindow = applicationObject.ToolWindows.OutputWindow without any exception and irrespecive of the language

    Thursday, November 4, 2010 10:51 AM

Answers

  • What you are doing should work, the look-up of the output window is done by GUID identifier and thus language independent. 

    I am looking to get a German version of 2010 locally so I can see if I can repro this and where it may be failing. 

    Is there more info you can give me about this scenario?  The callstack above is truncated, do you have a full (managed and native with 'Just My Code' disabled and Microsoft Symbol Servers enabled (it looks like you already have this since the above frames are resolved)) callstack of the failure case? 

    When are you doing this specifically (is this early in startup?  During some command execution?  In response to some other VS related event you are listening to)?

    Ryan

    Thursday, November 4, 2010 6:19 PM

All replies

  • What you are doing should work, the look-up of the output window is done by GUID identifier and thus language independent. 

    I am looking to get a German version of 2010 locally so I can see if I can repro this and where it may be failing. 

    Is there more info you can give me about this scenario?  The callstack above is truncated, do you have a full (managed and native with 'Just My Code' disabled and Microsoft Symbol Servers enabled (it looks like you already have this since the above frames are resolved)) callstack of the failure case? 

    When are you doing this specifically (is this early in startup?  During some command execution?  In response to some other VS related event you are listening to)?

    Ryan

    Thursday, November 4, 2010 6:19 PM
  • So I got a German SKU of 2010 installed, made a package, grabbed the DTE2 object and called ToolWindows.OutputWindow, and it all works fine for me.  So I think I would need more info / stand alone repro to investigate more.

    Ryan

    Thursday, November 4, 2010 11:18 PM
  • Hi Ryan,

    Thank you so much for looking into this.

    i used "de_visual_studio_2010_professional_web_installer_x86_519372" to install German VS2010

    Thanks for the pointers, I also tried to set up a very basic testcase and found that following is causing the exception

     System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
      System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", true);
        EnvDTE.OutputWindow outputWindow = _applicationObject.ToolWindows.OutputWindow;

    If I comment line "System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", true);" then everything runs fine without exception otherwise OutputWindow is throwing exception.

    Is it not correct to include System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US", true); in German version VS2010? My OS is XP English version.

    -Vidisha

     

    Monday, November 8, 2010 9:35 AM
  • Still no repro for me, this code (on Win7 ENU + VS 2010 German) works just fine and returns the Output Window

    System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US", true);
    DTE2 dte = (DTE2)GetService(typeof(SDTE));
    var window = dte.ToolWindows.OutputWindow;

    That said, what are you trying to accomplish exactly by setting the UI thread culture to en-US?  I am not a localization/globalization expert but that seems very wrong.  If I have installed a German version of VS I would expect my UI threads culture to be German, not en-US.

    Ryan

    Tuesday, November 9, 2010 3:51 AM
  • I agree to what you are saying that we should not paly around with culture

    Therefore I removed culture code and now output window has no problem.

    Thanks! for your help.

    -Vidisha

    Friday, November 12, 2010 1:35 PM