Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-288488: ReSharper thinks a value cannot be null when it can be

$
0
0
Reporter Bojan Rajkovic (bojan.rajkovic1) Bojan Rajkovic (bojan.rajkovic1)
Created Feb 22, 2012 8:58:33 PM
Updated Feb 22, 2012 8:58:33 PM
Priority Normal
Type Bug
Fix versions No Fix versions
State Submitted
Assignee Unassigned
Subsystem Code Analysis
Affected versions 6.1.1
Fixed in build No Fixed in build
I'm working with some GMime# code, and I have the following construct:

var message = p.ConstructMessage ()

where p is an instance of GMime.Parser, and GMime.Parser.ConstructMessage consists of the following code:

return GLib.Object.GetObject(Parser.g_mime_parser_construct_message(this.Handle), true) as Message;

ReSharper insists on believing that message cannot be null, when in fact it's rather clear that it can be. In this case, GLib.Object.GetObject returns a GLib.Object. Message does inherit from GLib.Object, but not all GLib.Object instances are Message instances, and GetObject is fully capable of returning null.

ReSharper should realize that this method call chain is capable of returning null, and not insist on message never being null.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>