StatusCode.IsGood() during network outage

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
siyadahmed
Jr. Member
Jr. Member
Posts: 1
Joined: 06 Sep 2021, 14:52

StatusCode.IsGood() during network outage

Post by siyadahmed »

Hello,
A portion of code is dependent on the following logic in ConnectionStatusUpdate event handler. I am making use of
e.Error.IsGood() to check the status code. But strangely in the event of network disconnection, .IsGood() on the Error object which is an instance of StatusCode class return true, though expected is a false. Below is the portion of event handler logic.

Code: Select all

internal void OnConnectionStatusUpdate(Session sender, ServerConnectionStatusUpdateEventArgs e)
    {          

     
      if(e.Error.IsGood())
      {
        //Assumes connection is good.
      }
      else
      {
        //Assumes connection is not right. Updates connection status.
       }
   }
Is this a known issue or I shouldn't make use of IsGood() in this scenario?

Post Reply