8 Replies Latest reply on Apr 11, 2014 1:07 PM by Leonardo78

    Problem with RemoveSignUp

    Leonardo78

      Hello everyone,

       

      I'm experimenting a tough bug with the EventPipe (PISDK.IEventPipe2) and with RemoveSignUp() method in particular.

       

      In a nutshell, when I try to remove PIPoints from the PointList, sometimes the system crashes with an uncatchable exception. It simply closes itself after the code line RemoveSignUp().

       

      After lots of tests, I can assert the crash is pretty related to the EventPipe changing values and the interval rates (poll interval). Probably, I'm not able to remove a PIPoint which, concurrently, has triggered a new event in the pipe.

       

      In fact, I don't have any issue when there's no listener to the OnNewValue event (RemoveSignUp works greatly in this case) and, furthermore, the system crashes about 20 times less when I'm monitoring PIPoints with changing rate around 30 seconds (that means less triggers for the OnNewValue event). Unluckly, my requirements force me to monitor PIPoints with changing rate even around 1 second so, you can understand how solving this bug is essential to me.

       

      Notes:

      • I'm on a WPF application and I'm pretty sure the application is running in a Single Threading Apartment.
      • This bug is pretty similar to this, even with little differences. 
      Thanks for any help you can provide.
        • Re: Problem with RemoveSignUp
          mhamel

          @Leonardo: This looks like this thread. The problem was that an access violation was thrown because the PointList object being passed to RemoveSignup was not marked as STA. In other words, the RemoveSignup method cannot read the list of PI Points.

            • Re: Problem with RemoveSignUp
              Leonardo78

              Hi Mathieu, thank you for the fast answer.

               

              As I said, i'm on a WPF application which runs, by definition, in a STA. I also tried to create a custom static Main() access method, marking it up with a [STAThread] attribute, but it didn't work.

               

              The post you linked is, indeed, pretty similar to our conditions but I see no solutions there (for me, at least). My AddSignUp() method is working very well, i think that if we were experiencing a STA/MTA problem that method would have crashed as fast as RemoveSignUp() does.

               

              I'm pretty concerned by this.

               

              One day we'll have to run the PISDK method on a Windows Service (MTA environment) and if we're finding so many troubles with a "safe" environment like STA i don't know what will happen when things will become even more complicated.