c# - Can an application get notified when the debugger detaches? -


when detaching vs debugger using f4 aka stop debugging vs debugger raise signal or exception can caught in c++ or c# application? same question when attaches though that's of less use me - although guess solved having seperate thread spin on isdebuggerpresent in c++ instance.

there no event sent visual studio. can simulate so:

      var t = new thread(new threadstart(() =>       {         while (true)         {           if (!debugger.isattached)           {             //check if isattached changed raise custom event debuggerdetached           }           else           {             //check if isattached changed raise custom event debuggerattached           }            thread.sleep(100);         }       }));        t.start(); 

Comments