Debugger.Launch()现在在升级到.NET 4.0后崩溃我的Windows服务

Mar*_*ark 6 .net c# debugging .net-4.0 visual-studio-2010

对于调试环境,我们在代码中有一个条件Debugger.Launch语句,允许开发人员调试windows服务的启动代码.我们今天刚升级到.NET 4.0.自升级以来,如果我们退出JIT窗口(即我们选择不调试),Windows服务就会崩溃(进程正在终止).它曾经简单地恢复.如果我们接受附加,申请不会终止并且工作正常.

编辑

另一个奇怪的事情是抛出的异常不再是Launch for User异常.它现在是一个未处理的Microsoft .NET框架异常.我试图用它来包围一个试试看看我得到了什么.我调试时无法捕获异常,因为此时不会发生异常.如果我尝试将异常记录到文件,服务崩溃,我什么都没得到.

有任何解决这个问题的方法吗?有什么理由吗?

更多信息

我刚刚创建了一个空白的新窗体应用程序.


        public Form1()
        {
            try
            {
                MessageBox.Show("hello");
                System.Diagnostics.Debugger.Launch();

            }
            catch
            {
                MessageBox.Show("error");
            }
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            InitializeComponent();
        }

        void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            MessageBox.Show(e.ToString());
        }
Run Code Online (Sandbox Code Playgroud)

我得到了第一个"你好".然后我得到一个JIT窗口,上面写着"未处理的Microsoft .NET异常已经发生".如果我不附加,它会在没有消息或任何事情的情况下崩溃.

我试过WinDbg而不是.我对这些工具一点也不熟悉.这是我得到的.它似乎根本没用

Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.


Loading Dump File [C:\Users\moueis\TestDebugging_100927_104956.dmp]
User Mini Dump File with Full Memory: Only application data is available

Comment: '
*** C:\Users\moueis\Desktop\procdump.exe  TestDebugging.exe -e -ma
*** Unhandled exception'
Symbol search path is: *** Invalid ***
****************************************************************************
* Symbol loading may be unreliable without a symbol search path.           *
* Use .symfix to have the debugger choose a symbol path.                   *
* After setting your symbol path, use .reload to refresh symbol locations. *
****************************************************************************
Executable search path is: 
Windows 7 Version 7600 MP (8 procs) Free x64
Product: Server, suite: TerminalServer SingleUserTS
Machine Name:
Debug session time: Mon Sep 27 10:49:56.000 2010 (UTC - 4:00)
System Uptime: 11 days 20:41:04.714
Process Uptime: 0 days 0:00:22.000
.........................................
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for KERNELBASE.dll - 
KERNELBASE!DebugBreak+0x2:
000007fe`fd432442 cc              int     3

这发生在超过1台机器上(但是,它们非常相似).

再次提供更多信息

这显然很容易重现.它出现在内部的多个系统上,我收到外部方的确认,只需使用.NET 4.0窗口中使用.NET 4.0的代码片段就可以重现问题

Law*_*ton 1

我遇到了同样的问题,并通过一些谷歌搜索找到了它的 Microsoft Connect 报告