当我启动没有特定格式的应用程序时,例如
When I start application without specific form e.g.
Application.Run();然后我创建表单,在用户关闭表单后,该过程就会挂起.
And then I create form, after user closes it, the process just hangs.
这发生在Visual Studio之外.
This happens outside of Visual Studio.
我试图将Application.Exit()和/或Application.ExitThread()放入窗体的Form_Closing事件中,但仍然挂起.
I tried to put Application.Exit() and/or Application.ExitThread() in form's Form_Closing event, but it still hangs.
不幸的是,使用自定义ApplicationContext无效.
Using custom ApplicationContext unfortunately doesn't work.
仅供参考,我没有使用任何线程,也没有使用BackgroundWorkers.
FYI, I'm not using any threads nor BackgroundWorkers.
推荐答案使用工具+附加到进程将调试器附加到挂起的进程.调试+全部破坏.在调试+ Windows +线程"中,双击主线程",然后查看其调用堆栈以查看其作用.如果您的问题无济于事,请发布堆栈跟踪信息.
Use Tools + Attach to Process to attach the debugger to the hung process. Debug + Break All. Debug + Windows + Threads, double-click the Main thread and look at its call stack to see what it is doing. Post the stack trace in your question if that doesn't help.
更多推荐
Application.Run()导致应用程序挂起
发布评论