Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event not firing through AppDomain

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.

like image 995
Jess Avatar asked Aug 26 '10 21:08

Jess


1 Answers

+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.

like image 185
Kent Boogaart Avatar answered Oct 09 '22 10:10

Kent Boogaart