Question: why would a static constructor throw exception when it references to
a const string in another class. 

```
 class MyClass
 {  
      static MyClass() 
      { 
           ExamineLog();   
      }

      static ExamineLog()  
      {
          FilePath = HttpContext.Current.Server.MapPath(Helper.LogConfiguration);                
      }
}

class Helper
{  
      public const string LogConfiguration= "\rootpath\counters.txt";
}

```

The exception thrown is object reference not set to an instance of an object. The stack trace points to the line where attempt is made to read the constant value. Any thoughts?

Answer: 
Thoughts:

* `HttpContext` might be null
* `HttpContext.Current` might be null
* `HttpContext.Current.Server` might be null

Further thoughts:

`Current` is a static property of the `HttpContext` class, so `HttpContext` is not an object reference, and it cannot be null. If you want to simplify your debugging, you can change the code like this (I'm assuming that `ExamineLog` should have been declared as a void method):

```
static void ExamineLog()   
{
    var context = HttpContext.Current;
    var server = context.Server;
    FilePath = server.MapPath(Helper.LogConfiguration);                 
} 

```
my first bet is a bad string...

```
"\rootpath\counters.txt" // => "\r" is carriage return

```

So MapPath fails.