Why is my Catch block only running while Debugging in Visual Studio?

后端 未结 3 1486
长情又很酷
长情又很酷 2020-12-20 15:38

Code in Program.cs

[STAThread]
static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);

    try
         


        
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-20 16:05

    Because in RELEASE mode at the moment the message box have to be shown yuo're appication is going to be "dead" and you can not stop it by showing MessageBox. In DEBUG mode VS cares about that and breaks on the line that throws an exception.

    Regards.

提交回复
热议问题