RobotStudio event

PCSDK 5.61 issue when setting signal value in event handler

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.

Appreciate any help,
Dan


Comments

  • 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?
  • Did you ever find a solution to this problem? I have been having a similar issue.

    Do you remember the type of error/exception was being thrown? I am seeing an error stating the controller has 'no authenticated user'.