0

I have a winforms application that uses pjsua2 (a SIP protocol) The winforms is a 64 bit application with framework 4.7. The pjsua2 is a x86 assembly. When i destroy the PJSUA2 instance, it raises an exception. Oddly, it is not caught by the try/catch in which the code is placed. I don't get why?

Is there a way to suppress this exception?

     /// <summary>
    /// brief UserAgent::UserAgentStop
    /// </summary>
    public void UserAgentStop()
    {
        Console.Write("Stopping endpoint");
        ///this code destroys the SIP connection and clears the relevant objects
        try
        {
            ep.mediaRemove(play_med);
            ep.mediaRemove(cap_med);
            //dispose all sip objects, so they can be garbage collected

            ep.libStopWorkerThreads();
            ep.libDestroy();
            ep.Dispose();
            //// Send new state
            forwardNewRegState(-2);

            //force garbage collection of all disposed objects
            GC.Collect();
        }
        catch (Exception ex)
        {
            Logging.LogAppender.AppendToLog("Error UN-registering SIP connection: " + ex.Message);


         }
    }

Exception raised

Fildor
  • 14,510
  • 4
  • 35
  • 67
real_yggdrasil
  • 1,213
  • 4
  • 14
  • 27

0 Answers0