2015-02-02 4 views
0

멀티 스레드 C# 프로젝트가 있습니다. 불필요하게 공유 된 객체를 잠근 잠금을 제거하고 공유 객체를 단일 스레드로 만들려고했습니다. 이벤트 뷰어 나 디버그에서 실행되지 않는 것이 이제 프로세스가 충돌하고 오류없이 실행됩니다. 누구든지 나를 진단 할 수있는 방법을 제안 할 수 있습니까? 왜냐하면 비주얼 스튜디오만으로는 아무 것도하지 않고 프로세스를 멈추게 해줌으로써 나를 붙잡을 수 있기 때문입니다. 마지막 수단은 WinDbg이며이를 피하고 싶습니다.디버그시 C# 응용 프로그램이 충돌 함

+0

당신이 모든 예외에 휴식 비주얼 스튜디오를 사용하는지 확인하여 충돌의 원인이되는 예외를 건너 뛰고이 운터를 찾을 수 있습니다. ctrl + alt + e를 눌러 예외 창을 엽니 다. – SgtRock

답변

1

당신이 처리되지 않은 응용 프로그램 도메인 예외로 훅을 시도 할 수 있습니다 - 또한 http://msdn.microsoft.com/en-GB/library/system.appdomain.unhandledexception.aspx

체크 아웃 처리되지 않은 스레드 예외 : https://msdn.microsoft.com/en-GB/library/system.windows.forms.application.threadexception.aspx

(응용 프로그램 도메인 링크에서 예제 코드)

using System; 
using System.Security.Permissions; 

public class Example 
{ 
    [SecurityPermission(SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlAppDomain)] 
    public static void Main() 
    { 
     AppDomain currentDomain = AppDomain.CurrentDomain; 
     currentDomain.UnhandledException += new UnhandledExceptionEventHandler(MyHandler); 

     try { 
     throw new Exception("1"); 
     } catch (Exception e) { 
     Console.WriteLine("Catch clause caught : {0} \n", e.Message); 
     } 

     throw new Exception("2"); 
    } 

    static void MyHandler(object sender, UnhandledExceptionEventArgs args) 
    { 
     Exception e = (Exception) args.ExceptionObject; 
     Console.WriteLine("MyHandler caught : " + e.Message); 
     Console.WriteLine("Runtime terminating: {0}", args.IsTerminating); 
    } 
} 
// The example displays the following output: 
//  Catch clause caught : 1 
//   
//  MyHandler caught : 2 
//  Runtime terminating: True 
//   
//  Unhandled Exception: System.Exception: 2 
//   at Example.Main() 
+0

그것은 잡히지 않았다 .. – gilmishal

+0

이상한 ... 내가 생각할 수있는 유일한 다른 옵션은 MrWombat이 말한 것처럼 모든 오류를 없애는 것입니다. – NDJ

0

Visual Studio에서 디버거 중단을 유발하는 예외를 확인하는 것도 좋은 방법입니다.

당신은 Debug->Exceptions...이 나 Crtl+D, E

아마 비주얼 스튜디오와 단지

관련 문제