I’ve noticed that my program will hang on the signal.Value get when it is called within an event handler. Something like this:
static void signal_Changed(object sender, SignalChangedEventArgs e)
{
if (e.NewSignalState.Value == 1)
{
//This will hang
(sender as Signal).Value = 0;
}
}
Has anyone else encountered this? Are there workarounds? I seem to recall something about thread apartment being important years ago, but I’ve forgotten and unsure if this even applies to eventhandlers.
I guess I should add that the above code seemed to work in PC SDK 5.15, but is now broken in 5.61. If I spin off an MTAThread from the event handler it seems to work. Is there a way to have an application run all event in an MTAThread?