Thursday, July 15, 2004

Note to self about Control.Invoke

"Exceptions that are raised during the call will be propagated back to the caller."

This means that when you're doing a call like

target.Invoke(callbackDelegate, args);

from a background thread and you get a NullReferenceException on that line, the exception may originate from inside the target method specified by the delegate. That is - on the foreground thread.

In my case, the method called by the property called by the method called by the target method of the delegate was the ultimate culprit. I think I may need to start sprinkling in some try...catch statements, at the very least in the target method...


Post a Comment

<< Home