We can't tell you exactly why you get the problem - it's likely that the actual fault is elsewhere in your code and is only showing up here.
But basically, what is happening is that one of the elements to the left of a "." is
null
.
For example:
string s = a.b.c.d.ToString();
if
a
is
null
, you will get the error.
if
a
is a value, but
a.b
is
null
, you will get the error.
if
a.b
is a value, but
a.b.c
is
null
...
You get the idea.
Put a breakpoint on the line above the one giving the error and use the mouse to hover over each part in turn - find which one is
null
and you can start looking for why your code has let it be null.
Sorry, but it's over to you and the debugger, I'm afraid.