Commandbars problem in Whidbey Beta2 (System.AccessViolationException)

It seems a very simple code does not work any more in Beta2. That is, Controls.Add yields a System.AccessViolationException. Here's an example (taken from a very basic addin, referencing the new Microsoft.VisualStudio.Commandbars):

Dim cbX As CommandBar
cbX = CType(applicationObject.CommandBars, CommandBars).Item("MenuBar")

Dim cbpX As CommandBarPopup
cbpX = CType(cbX.Controls.Item("Tools"), CommandBarPopup)

Dim cbbX As CommandBarButton
Try
    cbbX = CType(cbpX.Controls.Add(MsoControlType.msoControlButton, _
                 , , , True), CommandBarButton)  <-- Exception
    cbbX.Caption = "Xxx"
    cbbX.Visible = True
Catch oE As System.Exception
    MsgBox("Exception: " & oE.Message)
End Try

Anybody has a clue as to what's happening A million thanks!

Mike.



Answer this question

Commandbars problem in Whidbey Beta2 (System.AccessViolationException)

  • mniccole

    Thanks Carlos,

    June CTP is only available to MSDN subscribers. I suppose that I just have to wait for the next Beta.
     
    I fail to understand why Microsoft, with every release of VS since VB6, have so many problems with something as basic as creating toolwindows, extending IDE menus and adding toolbars.

    For guys like us who develop add-ins for VS, it is very frustrating. We are not able to release the Beta versions of our products because of these bugs. There must be other guys like us who are suffering too.

    Regards,
    Joginder
     



  • GrindEspresso

    This is a defect. There is no workaround yet.


  • BirkanGA

    Worst nightmare confirmed.

    It is *very* bad. We won't be able to release a version of our tool supporting Beta2 because of this.

    Mike.

  • MrMartin

    Yep. I get many emails asking when we will release a VS 2005 version of VG.net. There is no point in struggling with these bugs.

  • MobiTech

    Yes, it is very frustrating. But you can do 2 things: keep frustrated, or take action and report every single bug that you find in the MSDN Product Feedback Center:

    http://lab.msdn.microsoft.com/ProductFeedback/

    I have reported quite a few and most of them are fixed. The August CTP seems to solve all commandbar / button problems but one that be postponed until next release or Service pack, one crash deleting custom buttons from the Solution Explorer toolbar.

    There will not be a Beta 3, but a Release Candidate 1 in September:

    http://blogs.msdn.com/somasegar/archive/2005/08/22/451026.aspx

    Best regards,

    Carlos Quintero
    Visual Basic MVP



  • Jeffy John

    Beta 2 is broken and there is nothing to prevent it. You need the June CTP, much more stable but still with some crash from time to time.

    Best regards,

    Carlos Quintero
    MZ-Tools
    www.mztools.com


  • Rich Wilson - SCCP team

    Hi Mike,

    There is a workaround, although I don’t know if it will meet your needs. This info was posted by Craig Skibo (member of the VS extensibility team) in the Yahoo forum:

    "This is broken in Beta 2, but has since been fixed. There is data behind each item that you create with CommandBar.Controls.Add(...), but because of a bug we were allocating 0 bytes for that structure. When we would write to it, we either buffer overflow or crash. The only known workaround is to use the DTE.Command.AddControl method."

    Kind regards,

    Carlos Quintero (MZ-Tools)

    PS: the Yahoo forum is http://groups.yahoo.com/group/vsnetaddin/ just in case you want to join it (free). We all are on the same boat...


  • aabudara

    Hi,

    I have the same problem when creating a Toolbar and a cascaded menus. Ha anyone got a working solution for Beta2  

    We are not able to release our Add-in to VS 2005 Beta 2 without a soultion. Please help. I have spent a whole day yesterday without any success.

    Regards,
    joginder Nahil
    www.starprint2000.com


  • Commandbars problem in Whidbey Beta2 (System.AccessViolationException)