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

RSRP-288266: Wrong possible NULL reference in LINQ query

$
0
0
Reporter Jura Gorohovsky (gorohoroh) Jura Gorohovsky (gorohoroh)
Created Feb 12, 2012 11:31:51 PM
Updated Feb 13, 2012 8:25:34 PM
Priority Normal
Type Bug
Fix versions Mirabile Futurum
State Submitted
Assignee Evgeny Pasynkov (pasynkov)
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
See sample project attached to RSRP-288263
In the OnFunkyButtonClick click event in MainWindow.xaml.cs there is a LINQ-to-XML query:

var tagNodes = from n in tagsXml.Elements("list").Elements("object").Elements("string")
               let tagId = n.Value
               let tagName = tagId
               where n.Attribute("name") != null
               && n.Attribute("name").Value == "id"
               && !String.IsNullOrEmpty(tagName)
               select new KeyValuePair<string, string>(tagId, tagName);


ReSharper says that there is a possible null reference exception in line && n.Attribute("name").Value == "id" - but I check exactly this one line earlier.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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