Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top