Microsoft Developer Network > Forums Home > Microsoft Visual Studio 2010 Beta 2 Forums > Visual Studio Extensibility Beta 2 > Isolated Shell: Writing to output window pane causes unrecoverable hang
Ask a questionAsk a question
 

AnswerIsolated Shell: Writing to output window pane causes unrecoverable hang

  • Wednesday, November 04, 2009 2:47 AMSalec Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hello,
         I'm current using a custom project type built using the MPF for Visual Studio 2010 found at http://mpfproj10.codeplex.com/   I'm having a problem where whenever the IDEBuildLogger goes to write an item to the OutputWindowPane it will cause a unrecoverable hang.

        The hang happens  with the following line in IDEBuildLogger.cs of MPF:
    Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.OutputWindowPane.OutputStringThreadSafe(msg.ToString()));

    Anyone have any suggestions as to how this can be fixed?
    •  

Answers

  • Friday, November 06, 2009 12:54 AMPaul HarringtonMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Salec,

    You are hitting a well-known incompatibility problem with the MPF Project and Visual Studio Beta 2.

    The problem is that in Beta 2, the build runs on a Background Thread and, when "StartBuild" is called, the UI thread no longer pumps messages preventing calls through the logger from getting through.

    Unfortunately, at this time we don't have a complete solution for you, but we're working on it and we will post updates to the CodePlex project.

    - Paul Harrington
    Visual Studio Platform and Ecosystem
    • Marked As Answer bySalec Friday, November 06, 2009 1:00 AM
    •  

All Replies

  • Wednesday, November 04, 2009 4:17 AMSalec Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    At first I thought the problem was related to my project references.  When I deleted the references and re added them making sure that they were not an older version it removed a "Object reference not set to instance of an object." message I was getting in my output window. 

    Unfortunately the hangup still occurs.  I've found it also occcurs with the following line again in IDEBuildLogger in the function AddToErrorList:
    this.taskProvider.Tasks.Add(task);

    If I comment out these lines, my isolated shell will run just fine (minus any logging which is quite aggrivating).
  • Wednesday, November 04, 2009 7:24 PMSalec Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Some further Infomation:
    This only seems to be a problem from within whatever thread is created when InvokeMSBuild is called.  If I add a task to the taskProvider or attemp to write to the IVsOutputWindowPane inter face before OR after InvokeMSBuild, I can do it successfully.  It makes me think that perhaps these interfaces are not threadsafe or perhaps something is not initialized properly.

    The following message is displayed in my debug output just before the shell hangs:

    *** HR originated: -2147024774
    ***   Source File: d:\iso_whid\x86fre\base\isolation\com\copyout.cpp, line 1302


    *** HR propagated: -2147024774
    ***   Source File: d:\iso_whid\x86fre\base\isolation\com\enumidentityattribute.cpp, line 144

    Again, any help would be greatly appreciated since right now I cannot add any errors or display anything during a build :(
  • Thursday, November 05, 2009 7:01 PMSalec Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've built an example shell project that is a completely stripped down custom project example which still causes shell hangs.

    http://www.salec.net/forum_stuff/VS2010TestShell.zip

    To reproduce the hang:
    • Build and run the shell
    • Create a new "My Custom Project" project
    • Build the project
    You'll have to put a breakpoint inside of IDEBuildLogger.cs:190 to watch it hang when writing to the IVsOutputWindowPane.

    Has anyone else been able to create a custom project inside of Beta 2?
  • Friday, November 06, 2009 12:54 AMPaul HarringtonMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi Salec,

    You are hitting a well-known incompatibility problem with the MPF Project and Visual Studio Beta 2.

    The problem is that in Beta 2, the build runs on a Background Thread and, when "StartBuild" is called, the UI thread no longer pumps messages preventing calls through the logger from getting through.

    Unfortunately, at this time we don't have a complete solution for you, but we're working on it and we will post updates to the CodePlex project.

    - Paul Harrington
    Visual Studio Platform and Ecosystem
    • Marked As Answer bySalec Friday, November 06, 2009 1:00 AM
    •  
  • Friday, November 06, 2009 1:00 AMSalec Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Excellent, I'm glad to know that this bug is well known and not something unique to my code.  I will keep checking codeplex for the update.