Application.Run()导致应用程序挂起

编程入门 行业动态 更新时间:2024-10-28 12:17:59
本文介绍了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()导致应用程序挂起

本文发布于:2023-06-04 21:18:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/505252.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   挂起   Application   Run

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!