Events and ThreadOption.UserInterface

Aug 1, 2010 at 6:08 PM
Edited Aug 1, 2010 at 7:45 PM

I had been experiencing issues with InvalidProgramException being thrown if I created the object with the EventSubscription prior to creating the object with the EventPublication and used ThreadOption.UserInterface on the subscription. After checking out the latest revision I see that this no longer happens but looking at the changesets I see in revision 49082 a change was made to ObjectFactory.cs which commented out some of the code dealing with this. I haven't been through this code in detail but it looks like this will result in the events not being run on the UI thread even though ThreadOption.UserInterface was specified, is this correct?

EDIT: After some testing I've confirmed that creating Subscriber then Publisher results in the event being wired directly rather than using an Invoker, creating Publisher then Subscriber correctly wires the event using an Invoker.

I've created an issue on the tracker for this and attached a patch to ObjectFactory which makes both directions work correctly.

Aug 2, 2010 at 6:27 PM
Yeah - see my notes in the bug report - I think I was in a rush and didn't get it implemented right, so I subsequently commented the block back out to at least prevent the InvalidProgramException. I've since applied your patch - thanks.