openshac
openshac

Reputation: 5165

Visual Studio 2010 Macro Hangs when launching a Dialog

I have written a Macro which launches a dialog where the user selects a value from a combo box. Unfortunately the dialog box shows and I get an hourglass for between 1 and 20 seconds.

There are a couple of workaronds I have found which seem to help:

  1. A quick CTRL-Alt-Del followed by Escape.
  2. Clicking on the spinning macro animation in the task bar.
  3. Minimising and then maximising the dialog from the taskbar.

However this is getting to be a real pain, does anyone know what is going on to cause this and how I can prevent the hanging?

The code I am using to launch the dialog is

    Dim winptr As New WinWrapper()
    frm.ShowDialog(winptr)

and

'' This class is used to set the proper parent to any UI that you may display from within a macro.
Public Class WinWrapper
    Implements System.Windows.Forms.IWin32Window

    Overridable ReadOnly Property Handle() As System.IntPtr Implements System.Windows.Forms.IWin32Window.Handle
        Get
            Dim iptr As New System.IntPtr(DTE.MainWindow.HWnd)
            Return iptr
        End Get
    End Property
End Class

Upvotes: 3

Views: 668

Answers (4)

Samuel
Samuel

Reputation: 8935

Closing the VS Macro Editor for some reason mostly corrects the problem for me. I still see delays of 2 to 3 seconds.

Upvotes: 0

David R.
David R.

Reputation: 11

I get simular hangups whenever my macros call the MsgBox function. It seems that the hangups disapear after rerunning the macro a few times (This may be a hint to what the bug is) but thats not a workable solution either.

Upvotes: 1

surfasb
surfasb

Reputation: 968

I thought Visual Studios 2010 macros do not support Winforms.

http://msdn.microsoft.com/en-us/library/bxk3af4y.aspx

VS Macros do not currently support Windows Forms.

Upvotes: 0

jcpennypincher
jcpennypincher

Reputation: 4030

If you install SP1 there are several bug fixes including a fix for VS 2010 hanging and the Visual studio "Out of Virtual memory Error"

Upvotes: 0

Related Questions