Forum C# Object reference not set to an instance of an object.

Object reference not set to an instance of an object.

Postby azuanagames » October 10th, 2010, 12:11 am

I get that error in the errorLog. Any clues as to where I should look? Once that happens the server kicks everyone. (Probably restarts the server.)

I tried uploading a Debug version to see if I would get a stack trace, but no go.

Thanks
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm

Re: Object reference not set to an instance of an object.

Postby Oliver » October 11th, 2010, 11:25 am

Heya,

Currently the live servers don't support reading PDB files to get accurate stacktraces, but it's a feature that's been requested more than once, so i'm pretty sure it'll get added in the future.

In the meanwhile, you have 3 options:

a) try to reproduce the nullexception locally w/ the development serve

b) try to read the code and figure out what was null by analyzing the codeflow.

c) Add some null checks into the code for the objects you think could be null, and write an entry to the errorlog when the objects are null.. Compile, deploy, wait for error to appear in errorlog telling you which object was null.

I hope that helps,

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Object reference not set to an instance of an object.

Postby azuanagames » October 11th, 2010, 9:53 pm

Ok so, basically I'm using a null object somewhere. I'll add some checks.

Thanks
azuanagames
 
Posts: 157
Joined: April 29th, 2010, 10:59 pm


Return to C#



cron