Priority
Major
Type
Bug 
State
Fixed 
Assignee
Eugene Pasynkov 
Subsystem
Code Analysis 
Affected versions
Fixed in
Fixed in build
Next build 
Build
332
Fixed in build
500
  • Submitted by   Erwin Derksen
    3 years ago (10 Jan 2007 16:16)
  • Updated by Erwin Derksen
    2 years ago (20 Jun 2007 20:42)
  • Jira: RSRP-34258
    (history, comments)

RSRP-34258

Incorrect "Possible System.NullReferenceException"

0
I have the following code:

	int? i1 = null;
	int? i2 = 3;
	string s = i1.ToString();
	Console.Out.WriteLine("s = '" + s + "'");
	Console.Out.WriteLine("i1 = '" + i1 + "'");
	Console.Out.WriteLine("i2 = '" + i2 + "'");


On the 3rd line R# warns me about a "Possible System.NullReferenceException". However, the program runs fine.

Note that Nullable<T> type in itself is a value type and thus can never be null. Only the Value property or a cast can result in an InvalidOperationException.

Issue was closed
Comments (0)
 
History (0)
 
Links
 
Issue has no comments