Find the bugWhy do I get a Null Reference Exception?
time to read 1 min | 178 words
Originally posted at 4/12/2011
Can you spot the NRE hiding in the code?
if (parentObject!= null) { lock (parentObject) { if (parentObject != null) { properties = properties.Clone(); parentObject[parentKey] = this; parentObject = null; } } }
More posts in "Find the bug" series:
- (29 Feb 2016) When you can't rely on your own identity
- (05 Jan 2016) The case of the degrading system–Answer
- (04 Jan 2016) The case of the degrading system
- (11 Sep 2015) The concurrent memory buster
- (20 Apr 2011) Why do I get a Null Reference Exception?
- (25 Nov 2010) A broken tree
- (13 Aug 2010) RavenDB HiLo implementation
- (25 Jul 2010) Accidental code reviews

Comments
Comment preview