只有通过远程桌面使用时,WPF应用程序才会不定期崩溃 [英] A WPF App irregularly crashes only when used via Remote Desktop

查看:106
本文介绍了只有通过远程桌面使用时,WPF应用程序才会不定期崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个WPF(使用C#作为业务逻辑)App加载图像,显示它们并执行图像处理分析。 (Windows 10)



只有当我通过远程使用它时,应用程序才会崩溃(无响应)桌面,而RD会话中的其他应用程序正常工作。 



我看到资源监视器显示崩溃后一段时间内使用1080+线程的应用程序。但是,通过密切监控,线程数在碰撞时刻直接增加到87。正常的线程数约为80.




我注意到的另一件事是我的自定义鼠标光标图标工作正常没有RD没有出现在App通过RD。我想知道这两者是否相关。




任何人有建议或有类似的经历?

解决方案






应用程序似乎崩溃(否)响应)仅当我通过远程桌面使用它时,RD会话中的其他应用程序正常工作。 


您好wangren0720,


您是否从崩溃中获得了任何事件日志条目? 您是否订阅了未处理的异常事件? 



您可以在不同级别捕获未处理的异常:





  1. AppDomain.CurrentDomain.UnhandledException
    来自AppDomain中的所有线程。

  2. Dispatcher.UnhandledException
    来自单个特定的UI调度程序线程。

  3. Application.Current.DispatcherUnhandledException
    来自
    main
    UI调度程序线程。

  4. TaskScheduler.UnobservedTaskException




您应该考虑在未处理的异常处理所需的级别。




#2和#3之间的决定取决于你是否使用了多个WPF线程。这是一个非常奇特的情况,如果你不确定你是不是,那么你最有可能不是。


最好的问候,


Cherry



I created an WPF (with C# as business logic) App which loads image, display them and perform image processing analysis. (Windows 10)

The App appears to crash (No Response) only when I use it through remote desktop, while other Apps in the RD session worked normally. 

I saw Resource Monitor showing the App with 1080+ threads some time after crashing. However, by monitoring closely, the thread number increased very little to 87 directly at the crash moment. The normal number of thread is around 80.

Another thing I noticed is that my custom mouse cursor icon worked fine without RD does not appear in the App through RD. I wonder if the two may be related.

Anyone has suggestion or has similar experience?

解决方案


The App appears to crash (No Response) only when I use it through remote desktop, while other Apps in the RD session worked normally. 

Hi wangren0720,

Are you getting any event log entries from the crash? Have you subscribed to the Unhandled exception event? 

You can trap unhandled exceptions at different levels:

  1. AppDomain.CurrentDomain.UnhandledException From all threads in the AppDomain.
  2. Dispatcher.UnhandledException From a single specific UI dispatcher thread.
  3. Application.Current.DispatcherUnhandledException From the main UI dispatcher thread in your WPF application.
  4. TaskScheduler.UnobservedTaskException from within each AppDomain that uses a task scheduler for asynchronous operations.

You should consider what level you need to trap unhandled exceptions at.

Deciding between #2 and #3 depends upon whether you're using more than one WPF thread. This is quite an exotic situation and if you're unsure whether you are or not, then it's most likely that you're not.

Best Regards,

Cherry


这篇关于只有通过远程桌面使用时,WPF应用程序才会不定期崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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