I guess the feature you are searching for is called FirstChanceException
and can be accessed via the
AppDomain.FirstChanceException Event
Essentially this event provides a hook to get information about any (managed) exception getting thrown in the AppDomain
.
You can not handle the Exception this way! It is only a sort of notification
Update:
regarding your comment about a "swallowed exception" on another answer - and just a shot into the dark:
On x64 systems exceptions that get thrown in a windows' onLoad method can not be caught in your Main() method.
see this SO article for reference
Update 2:
As for Threads
I think that you would have to implement it yourself. This would involve some sort of polling and would harm performance, but I guess for debugging it is OK in most cases.
This could be done using
var threads = Process.GetCurrentProcess().Threads;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…