开发者

Exceptions not being thrown in .net

开发者 https://www.devze.com 2023-01-06 16:24 出处:网络
I turned my pc on this morning, and when I started testing some apps, I noticed that no exceptions are thrown (no dialog or anything).

I turned my pc on this morning, and when I started testing some apps, I noticed that no exceptions are thrown (no dialog or anything).

The code just stops executing and nothing happen开发者_运维百科s!

Example:

private void Form1_Load(object sender, EventArgs e)
{
    throw new Exception("error");
    //anything below will not execute
}

visual studio doesn't show any error dialog, I also tried to run the .exe directly and nothing happens as well...

I tested it with .net 2.0, 3.5 and 4.0! All the same...

any idea whats wrong?


Visual Studio: CTRL+ALT+E -> Enable "Thrown" under Common Language Runtime Exceptions.


I know of two possible reasons:

  1. You assigned an unhandled exception handler to your AppDomain that does nothing
  2. The code throwing the exception runs on a different thread

What does the Windows Application event log say?

0

精彩评论

暂无评论...
验证码 换一张
取 消