Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

private static void Method called from outside of class

$
0
0

Hi,

We have a class written as below:

public static class BusyIndicatorService
 {
  
  private static bool _isBusy;
  
  public static void SetBusyState()
  {
   SetBusyState(true);
  }
  
  private static void SetBusyState(bool busy)
  {
   if (busy != _isBusy)
   {
    
    Mouse.OverrideCursor = busy ? Cursors.Wait : null;
    //bla bla bla
   }
  }
}

we are regularly getting below exception from production:

System.NullReferenceException: Object reference not set to an instance of an object. at
BusyIndicatorService.SetBusyState(Boolean busy) at
ApplySchedule(Object input) at
SaveSchedule(Object obj) at

We are callingSetBusyState() from ApplySchedule method but stack trace is showing SetBusyState(Boolean busy) called which is actullyprivate static void so that it cannot be called from out side of class.

Why & how stack trace is showing a private static void Method beingcalled?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>