且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

奇怪的行为

更新时间:2022-04-30 22:35:31


在Windows窗体应用程序中(C#.NET 4.0 VS 2013)

in a Windows Forms application (C# .NET 4.0 VS 2013)

我有一个静态课程,如果在此表单中有未处理的异常,则表示使用  .ShowDialog()

I've a static class that in a method shows a little Form using .ShowDialog()

的方法   异常是通过静态类方法的try catch块捕获的。

if there is an unhandled exception inside this form then this exception is caught by try catch block of the static class method.

这只能在Visual Studio(Release& Debug)中运行。

This works fine but only inside Visual Studio (Release & Debug).

当我在VS外面运行.exe时,这种异常仍未处理。

When i Run the .exe outside VS this kind of exceptions remains unhandled.

为什么? :)

你好,

为了澄清这个问题,我建议你分享一个简单的样本,它可以重现这个问题。

To clarify this issue, I would recommend you share a simple sample which could reproduce this issue with us.

我们我们会测试它以帮助你。

We will test it on ourside to help you.

此外,如果在catch块中放置一行显示消息框,当您使用Visual Studio进行调试时,该消息框是否会出现?那么如果执行exe文件会得到同样的结果吗?

In addition, if you place a line shows messagebox inside the catch block, when you debugging with Visual Studio, will that messagebox appear? Then same result if you execute the exe file?

如果它抛出异常并且没有显示该消息框,你介意分享我们的截图吗?

If it throws the exception and didn't show that messagebox, would you mind sharing us the screenshot?

问候,

Carl