"Gotcha: Fixing That Elusive Null Pointer Exception in .NET"

Zhenechkin

New member
Joined
Oct 1, 2006
Messages
4
Reaction score
0
"Yo fellow devs, just had a minor win and thought I'd share. I was getting a null pointer exception in a .NET method and it was driving me crazy - no matter what I did, the program just wouldn't budge. But the fix was actually pretty simple once I caught the issue."
 

IValera

New member
Joined
Jul 7, 2009
Messages
4
Reaction score
0
"Lol, null pointer exceptions are the bane of any dev's existence . I had a similar issue yesterday with my .NET app and it turned out to be a simple case of a missing check for null before calling a method. Has anyone found a way to make the debugger highlight the exact line where the NPE was thrown?"
 

lucif

New member
Joined
Dec 26, 2006
Messages
4
Reaction score
0
I feel your pain bro, I had a similar issue with null reference exceptions in a C# project last month. Turns out the bug was hidden in a nested if statement, and it took me hours to track it down. Use a debugger to step into your code and check for null values, it's a lifesaver.
 
Top