vb.net 应用程序处于中断模式 - 无法确定原因

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46102963/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 21:14:21  来源:igfitidea点击:

The application is in break mode - Unable to determine cause

vb.netdebuggingidevisual-studio-2017

提问by tmighty

I'm experiencing that the IDE breaks sometimes when my application terminates.

当我的应用程序终止时,我遇到 IDE 有时会中断。

When this occurs, the call stack is empty, and the thread list shows some threads which don't reveal any information to me.

发生这种情况时,调用堆栈是空的,线程列表显示了一些不会向我透露任何信息的线程。

When I choose "Debugger"-"Step into", the IDE quits / terminally seemingly normally, so I don't see how I could further investigate what causes the breaking.

当我选择“调试器”-“步入”时,IDE 似乎正常退出/最终,所以我不知道如何进一步调查导致中断的原因。

Clicking "Check for running Tasks" doesn't display any tasks. Clicking "Continue executing" quits debugging seemingly normally. Clicking "Show diagnostic tools" shows the event "Stop at Execution: Stopped at Execution", which doesn't tell me any more.

单击“检查正在运行的任务”不会显示任何任务。单击“继续执行”似乎可以正常退出调试。单击“显示诊断工具”显示事件“执行时停止:执行时停止”,它不再告诉我。

A screenshot is attached.

附上截图。

How can I investigate what's causing this break?

我如何调查导致此中断的原因?

enter image description here

在此处输入图片说明

Edit: I've tried what one forum member suggested, but that wouldn't result in anything that would help me, I think. This is a screenshot:

编辑:我已经尝试过一位论坛成员的建议,但我认为这不会产生任何对我有帮助的东西。这是一个截图:

enter image description here

在此处输入图片说明

采纳答案by tmighty

I didn't find any way to actually debug the problem. I solved the problem the bruteforce way:

我没有找到任何实际调试问题的方法。我用蛮力的方式解决了这个问题:

I removed all assemblies and COM objects one by one until the error was gone.

我一一删除了所有程序集和 COM 对象,直到错误消失。

In my case, I had a public control with a WithEvents in a module. It seems that VB.NET didn't like that at all. From now on, I will put the control and its withevent in a form.

就我而言,我在模块中有一个带有 WithEvents 的公共控件。似乎 VB.NET 根本不喜欢那样。从现在开始,我会把控件和它的事件放在一个表单中。

The main problem however remains: Visual Studio doesn't offer any help to isolate the problem easily.

然而,主要问题仍然存在:Visual Studio 不提供任何帮助来轻松隔离问题。

回答by Alternatex

You may not be able to see the code where the exception happens if it's a part of a library or something else not written by you. The following might help:

如果它是库的一部分或不是由您编写的其他内容,则您可能无法看到发生异常的代码。以下可能有帮助:

Debug > Options > General > Uncheck "Enable Just My Code"

调试 > 选项 > 常规 > 取消选中“仅启用我的代码”

回答by Alan Warden

In one of my web applications I had the same issue, to find out what was wrong,after searching for similar issues, most suggested changing my debugging options. So in the debugging options, under general, I marked the second option "Break all processes when one process breaks" and nearly at the bottom, "Enable native Edit and Continue"; "Apply changes and Continue".

在我的一个 Web 应用程序中,我遇到了同样的问题,为了找出问题所在,在搜索类似问题后,大多数人建议更改我的调试选项。所以在调试选项中,在一般情况下,我标记了第二个选项“当一个进程中断时中断所有进程”,几乎在底部,“启用本机编辑并继续”;“应用更改并继续”。

With this, my app finally stopped where I had the issue (Illegal characters in a string which ajax did not like) and was able to evaluate the values and find out what was wrong, edit the code on the go till it worked. Here's a screenshot of my debugger options. Hope you catch your bug:)

有了这个,我的应用程序终于在我遇到问题的地方停止了(ajax 不喜欢的字符串中的非法字符),并且能够评估这些值并找出问题所在,随时随地编辑代码直到它工作。这是我的调试器选项的屏幕截图。希望你能抓住你的错误:)

Debugger options

调试器选项

回答by Pawe? ?ukasik

When you are in the debugger you can navigate to watch window and use pseudovariables to display some information about the root cause. One particularly useful is $exception.

当您在调试器中时,您可以导航到监视窗口并使用伪变量来显示有关根本原因的一些信息。一个特别有用的是$exception.

enter image description here

在此处输入图片说明

Check document about pseudovariables.

检查有关伪变量的文档。

回答by user3578181

Go to exception settings and uncheck "Magaged Debugging Assistants" enter image description here

转到异常设置并取消选中“Magaged Debugging Assistants” 在此处输入图片说明

回答by Goodies

This can also occur when a single threaded Winforms application takes more than 60 seconds to complete an action in the main thread.

当单线程 Winforms 应用程序需要超过 60 秒才能完成主线程中的操作时,也会发生这种情况。

I solved it in the dirty way, by calling Application.DoEvents()on regular intervals from the main thread, during too long processing. Exceptions that occur between Application.DoEvents calls are handled properly in the IDE.

我以肮脏的方式解决了它,方法是在过长的处理过程中从主线程定期调用Application.DoEvents()。Application.DoEvents 调用之间发生的异常在 IDE 中得到了正确处理。

回答by impactro

This can occur because some method or constructor is inaccessible (private or internal), put the as public.

这可能是因为某些方法或构造函数不可访问(私有或内部),将其设为公共。

The XAML need call the methods to start application

XAML 需要调用方法来启动应用程序

回答by Kritthanit

This is only a warning message when you run program in debug mode. If you change to the "Release" mode, you will not see this message again.

这只是在调试模式下运行程序时的警告消息。如果您更改为“发布”模式,您将不会再看到此消息。