事件未通过 AppDomain 触发

发布于 2024-09-16 08:08:31 字数 521 浏览 2 评论 0原文

我在使用 AppDomains 时遇到了很多麻烦。我目前有一个包含相机控件的应用程序域,并且正在尝试将从该辅助应用程序域引发的事件(例如正在拍摄的照片)返回到主程序。一切似乎都设置正确(事件已注册,函数将跨域边界运行),但是当我尝试调用时,什么也没有发生。我能找到的关于这个主题的所有内容都涉及引发异常,而不是根本没有发生任何事情。

我不知道我能解释得比这更好多少,所以我制作了一个(非常简单的)图表,并且可以发布任何必要的代码。

http://a.imageshack.us/img832/8205/cameradiagram.png

在辅助 AppDomain 内的 OnPictureUpdated.Invoke(pic); 部分中触发断点,但没有任何内容(在 CameraContainer 内或在主应用程序中)被引发。我正在做调用事件时进行空检查,我只是没有将其放入图表中。

I am having a lot of trouble with AppDomains. I currently have an AppDomain containing camera controls, and am trying to have events raised from this secondary AppDomain (like a picture being taken) come back to the main program. Everything seems to be set up correctly (events are registered, functions will run across domain boundry) but when I try to invoke, nothing happens. Everything I can find on the subject involves exceptions being raised rather than just nothing happening at all.

I don't know how much better I can explain it than this, so I made a (very simplistic) diagram, and can post any code that is necessary.

http://a.imageshack.us/img832/8205/cameradiagram.png

A breakpoint fires in the OnPictureUpdated.Invoke(pic); portion, inside the secondary AppDomain, but nothing (either inside CameraContainer or in the main application is raised. I am doing a null check when invoking events, I just didn't put that in the diagram.

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

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

发布评论

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

评论(1

予囚 2024-09-23 08:08:31

+1表示在这个问题上的努力。

我相信这可能只是因为您的 CameraContainer 不是 MarshalByRefObject。由于它附加到事件,因此包含 CameraManagerAppDomain 实际上需要在引发事件时回调到主 AppDomain

+1 for the effort in the question.

I believe this may just be because your CameraContainer isn't a MarshalByRefObject. Because it's attaching to the event, the AppDomain containing the CameraManager effectively needs to call back into the primary AppDomain when the event is raised.

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