代码之家  ›  专栏  ›  技术社区  ›  djv

如何在Visual Studio中以编程方式分离调试器

  •  0
  • djv  · 技术社区  · 13 年前

    我只想在退出Visual Studio中的应用程序时分离调试器。关闭后,清理过程需要几秒钟,我不想等待。我在VB.net工作:

    Private Sub frmBladeAlignment_FormClosing(ByVal sender As Object,
                                              ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing
        Select Case e.CloseReason
            Case CloseReason.UserClosing
                Select Case MessageBox.Show("Are you sure you wish to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    Case DialogResult.Yes
                        e.Cancel = False
                    Case DialogResult.No
                        e.Cancel = True
                End Select
            Case else
                e.Cancel = False
        End Select
    
        If Not e.CancelThen
            Me.Enabled = False
            Me.Text = "APPLICATION IS CLOSING"
            Application.DoEvents()
            If Debugger.IsAttached Then
                ' detach debugger here
            End If
        End If
    End Sub
    
    ' this is an MDI application and many operations 
    ' are done in child forms when the main form 
    ' is closing
    

    我看过 System.Diagnostics.Debugger 上课,但没有发现任何有用的东西。

    http://msdn.microsoft.com/en-us/library/System.Diagnostics.Debugger.aspx

    1 回复  |  直到 13 年前
        1
  •  0
  •   Community Mohan Dere    9 年前
    推荐文章