关闭 WPF 应用程序时的 RaceOnRCWCleanup

发布于 2024-09-30 11:22:59 字数 1143 浏览 0 评论 0原文

在过去的几年里,我一直在混合模式应用程序中使用 WPF 来显示各种位和内容。 UI 部分。 C# 程序集使用 WPF 来生成 UI - 它引用包含一些本机代码的 C++/CLI 构建的程序集。除了几个 printf 之外,本机代码不会进行任何操作系统调用;这纯粹是计算性的。

当连接调试器运行时,我看到托管调试助手“RaceOnRCWCleanup”在我关闭应用程序后触发 - 这表明存在一些存在多线程清理问题的 COM 组件。

我没有以任何方式直接使用 COM,但也许 C++/CLI 或 WPF 可以。有关应用程序关闭的警告并不是特别可怕 - 毕竟应用程序无论如何都会退出 - 但我很想了解出了什么问题。我可以做些什么来避免这个警告吗?是否有隐藏的错误正在等待咬我,或者这是一个虚假的警告?

这是一个示例堆栈跟踪:

mscorlib.dll!System.Runtime.InteropServices.Marshal.ReleaseComObject(object o) Line 1826 + 0xc bytes    C#
PresentationFramework.dll!System.Windows.Documents.TextServicesHost.DeactivateThreadManager() Line 465 + 0xd bytes  C#
PresentationFramework.dll!System.Windows.Documents.TextServicesHost.OnUnregisterTextStore(object arg) Line 331  C#
PresentationFramework.dll!System.Windows.Documents.TextEditor.DetachTextStore(bool finalizer) Line 249 + 0x6b bytes C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.ShutdownImplInSecurityContext(object state) Line 1363 + 0xfffffffc bytes    C#
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) Line 484 + 0xce bytes    C#

有人遇到过同样的问题吗?有人知道发生了什么事吗?

For the past few years, I've been using WPF in a mixed-mode app to display various bits & pieces of UI. WPF is used by a C# assembly to generate the UI - it references a C++/CLI-built assembly that contains some native code. The native code makes no OS calls beyond a few printf's; it's purely computational.

When running with a debugger attached, I see the managed debug assistent "RaceOnRCWCleanup" fire after I close the app - suggesting there's some COM component with multithreading cleanup issues.

I'm not using COM in any fashion directly, but perhaps C++/CLI or WPF is. Warnings about application shutdown aren't particularly scary - after all, the app is exiting anyway - but I'd love to understand what's going wrong. Can I do anything to avoid this warning? Is there a hidden bug somewhere that's just waiting to bite me, or is it a spurious warning?

This is an example stacktrace:

mscorlib.dll!System.Runtime.InteropServices.Marshal.ReleaseComObject(object o) Line 1826 + 0xc bytes    C#
PresentationFramework.dll!System.Windows.Documents.TextServicesHost.DeactivateThreadManager() Line 465 + 0xd bytes  C#
PresentationFramework.dll!System.Windows.Documents.TextServicesHost.OnUnregisterTextStore(object arg) Line 331  C#
PresentationFramework.dll!System.Windows.Documents.TextEditor.DetachTextStore(bool finalizer) Line 249 + 0x6b bytes C#
WindowsBase.dll!System.Windows.Threading.Dispatcher.ShutdownImplInSecurityContext(object state) Line 1363 + 0xfffffffc bytes    C#
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) Line 484 + 0xce bytes    C#

Has anyone experienced the same issue? Does anybody know what's going on?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

东风软 2024-10-07 11:22:59

从什么时候开始你得到这个异常?今天我也在我们的 wpf 业务应用程序上第一次得到它。每次我关闭应用程序时,它都会连续发生,而无需进行重大更改。也许某些Windows更新是万恶之源?我们还不知道它从哪里来,也不知道如何预防它。一旦我们设法解决异常问题,我将立即发布解决方案。我认为这与您的 C++/CLI 程序集无关。我们不使用 C++/CLI 程序集。

Since when do you get this exception? I also got it today for the first time on our wpf business application. It occurs continous everytime I close the application, without having made major changes. Maybe some Windows Update is the source of evil? We also did not figure out where it comes from, nor how to prevent it, yet. I will post a solution as soon as we managed to get the exception solved. I dont think that it has something to do with your C++/CLI assembly. We dont use C++/CLI assemblies.

Jan

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文