简体   繁体   English

意外的 IConnectionPointImpl::Unadvise 调用 Windows Embedded Compact 7

[英]Unexpected IConnectionPointImpl::Unadvise call on Windows Embedded Compact 7

We have a bigger software running on Win CE6 without problems.我们有一个更大的软件在 Win CE6 上运行,没有问题。 The core functionality is implemented in a COM server DLL that provides connection points.核心功能在提供连接点的 COM 服务器 DLL 中实现。 The COM client program registers event handlers for the connection points on program startup to get status notifications etc. On program exit it unregisters the handlers by calling the corresponding IConnectionPointImpl::Unadvise methods. COM 客户端程序在程序启动时为连接点注册事件处理程序以获取状态通知等。在程序退出时,它通过调用相应的IConnectionPointImpl::Unadvise方法取消注册处理程序。

Now, we are porting the program to run on Win EC 7. The new Board Support Package (BSP) for Win EC 7 works well.现在,我们正在移植程序以在 Win EC 7 上运行。Win EC 7 的新板支持 Package (BSP) 运行良好。 There are also different versions with different options, created at different times with different sources from Microsoft, but our software always show the same issue.还有具有不同选项的不同版本,在不同时间使用来自 Microsoft 的不同来源创建,但我们的软件总是显示相同的问题。

On program startup, ~10s after launch, IConnectionPointImpl::Unadvise is called unexpectedly on all registered event handlers.在程序启动时,启动后约 10 秒, IConnectionPointImpl::Unadvise在所有已注册的事件处理程序上被意外调用。 We only have one method in our source code that calls IConnectionPointImpl::Unadvise and this is definitely not executed.我们的源代码中只有一个调用IConnectionPointImpl::Unadvise的方法,这绝对不会被执行。

The issue appears ~95%, but sometimes the program starts and runs without problems.问题出现〜95%,但有时程序启动并运行没有问题。 We cannot use the Debugger because of the size of the program, the performance is very poor.由于程序的大小,我们不能使用调试器,性能很差。

We guess, that the COM runtime calls the IConnectionPointImpl::Unadvise methods for some reasons.我们猜测,COM 运行时会出于某些原因调用IConnectionPointImpl::Unadvise方法。 But we have no idea, how to prevent this.但我们不知道如何防止这种情况。

Has anybody observed the same issue?有没有人观察到同样的问题? Is there a solution/workaround available?是否有可用的解决方案/解决方法? Thanks.谢谢。

So we finally found how solve this problem.所以我们终于找到了解决这个问题的方法。

We remove our dependency on MarshalByReObject and replace it by a proper implementation of ISerializable .我们删除了对MarshalByReObject的依赖,并将其替换为ISerializable的正确实现。

That allow us to load properly inside custom AppDomain our assembly and events are not loose anymore.这允许我们在自定义 AppDomain 中正确加载,我们的程序集和事件不再松散。

But this has a side effect on path where assembly a configuration file are loaded.但这对加载程序集和配置文件的路径有副作用。 To solve this we also implement an AppDomain.AssemblyResolve event which allow us to redirect the loading in a proper place.为了解决这个问题,我们还实现了一个AppDomain.AssemblyResolve事件,它允许我们将加载重定向到适当的位置。

I hope this can help you;)我希望这可以帮助你;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有必要在销毁IConnectionPointImpl之前取消建议吗? - Is it necessary to unadvise an IConnectionPointImpl before it gets destroyed? QueryPerformanceCounter()测试Windows Embedded Compact 7 - QueryPerformanceCounter() Test for Windows Embedded Compact 7 Windows Embedded Compact 2013-初始应用重点 - Windows Embedded Compact 2013 - Initial Application Focus 如何将Windows Embedded Compact 7 DLL移植到Windows CE 5.0 / 6.0? - How to Port Windows Embedded Compact 7 DLL to Windows CE 5.0 / 6.0? 如何在“ Windows Embedded的XAML(Compact 2013)”中切换图像 - How do I switch an image in “XAML for Windows Embedded (Compact 2013)” 哪个文件配置Windows Embedded Compact 7.0上的缓存? - Which file configures caching on Windows Embedded Compact 7.0? 在“适用于Windows Embedded的XAML(Compact 2013)”项目中获取图像的可靠源URI。 - Get robust source URIs for Images in “XAML for Windows Embedded (Compact 2013)” projects CryptUnProtectData() 在 Windows 7 嵌入式 COMPACT 上返回 ERROR_INSUFFICIENT_BUFFER(122) 错误 - CryptUnProtectData() returns ERROR_INSUFFICIENT_BUFFER(122) error on Windows 7 EMBEDDED COMPACT 用于 Windows 上的 OpenCV 应用的紧凑型构建 - Compact build for OpenCV applications on Windows 用于Windows的Silverlight嵌入式 - Silverlight for windows embedded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM