创建了几个多级窗体,对所有的wpf窗体进行一些简单的操作,然后手动关闭,visual studio调试状态还没有结束,这是怎么回事,没有释放资源吗?
我在窗体关闭事件中调用GC.Collect();,visual studio依旧调试状态。另外我没有使用与多线程相关Dispatcher,task,thread的代码。
能通过c#代码强制结束吗,或者是怎么知道还有哪个对象还在占用着?
Hi Trian555,
你可以尝试使用Environment.Exit(0)强制退出。
Environment.Exit(0);// 强制退出,即使有其他的线程没有结束
或者使用
Application.Current.ShutdownMode
模式来退出程序。
WPF关闭应用程序,释放Window窗口资源方法
如果还不行,我建议你可以再
Developer Community 的Visual Studio 模块中提出你的问题。
Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,
Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you
completely understand the risk before retrieving any software from the Internet.
Best regards
Yong Lu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.