Skip to main content
Post Locked by Bhargav Rao
Notice added Wiki Answer by Bhargav Rao
Cotent Edited
Source Link
Rajan Mishra
  • 1.2k
  • 2
  • 15
  • 31

I have some code and when it executes, it throws a NullReferenceException, saying:

Object reference not set to an instance of an object.

What does this mean, and what can I do about itto fix this error?

I have some code and when it executes, it throws a NullReferenceException, saying:

Object reference not set to an instance of an object.

What does this mean, and what can I do about it?

I have some code and when it executes, it throws a NullReferenceException, saying:

Object reference not set to an instance of an object.

What does this mean, and what can I do to fix this error?

edited title
Link
gurghet
  • 7.7k
  • 5
  • 40
  • 66

What is a NullReferenceException, and how do I fix it?

Rollback to Revision 22
Link
dbc
  • 121.7k
  • 27
  • 275
  • 410
edited tags
Link
user5613751
user5613751
Loading
Rollback to Revision 20
Source Link
CodeCaster
  • 152.9k
  • 24
  • 239
  • 288
Loading
improved readability
Source Link
alamin
  • 2.5k
  • 2
  • 29
  • 31
Loading
Post Made Community Wiki by ChrisF
added 2 characters in body
Source Link
BartoszKP
  • 36k
  • 15
  • 109
  • 135
Loading
edited tags
Link
CodeSmile
  • 64.4k
  • 20
  • 135
  • 219
Loading
edited tags; edited tags
Link
CodeSmile
  • 64.4k
  • 20
  • 135
  • 219
Loading
removing my earlier vandalism
Link
Lasse V. Karlsen
  • 394.4k
  • 108
  • 652
  • 848
Loading
added more information to the title since this seems to be favored in related questions when asking a new one
Link
Lasse V. Karlsen
  • 394.4k
  • 108
  • 652
  • 848
Loading
Rollback to Revision 13
Link
Ant P
  • 25.3k
  • 8
  • 74
  • 109
Loading
edited tags
Link
user2864740
  • 62.6k
  • 15
  • 161
  • 234
Loading
Grammatical pedantry
Source Link
Ant P
  • 25.3k
  • 8
  • 74
  • 109
Loading
Question Protected by ken2k
edited title
Link
Cole Tobin
  • 9.5k
  • 15
  • 54
  • 78
Loading
edited title
Link
Cody Gray
  • 246.3k
  • 53
  • 514
  • 591
Loading
deleted 136 characters in body
Source Link
Servy
  • 203.9k
  • 27
  • 348
  • 471
Loading
Rollback to Revision 7
Source Link
Mark Hurd
  • 11k
  • 10
  • 75
  • 106
Loading
deleted 136 characters in body
Source Link
Servy
  • 203.9k
  • 27
  • 348
  • 471
Loading
deleted 272 characters in body
Source Link
John Saunders
  • 161.9k
  • 26
  • 253
  • 403
Loading
deleted 2 characters in body
Source Link
Peter Olson
  • 143.6k
  • 49
  • 210
  • 250
Loading