Application.Run()导致应用程序挂起 [英] Application.Run() leads to application hanging

查看:246
本文介绍了Application.Run()导致应用程序挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我启动没有特定格式的应用程序时,例如

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()导致应用程序挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆