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

RSRP-124310: Should not suggest 'Convert to LINQ' if it will result in warning (unverifiable code)

$
0
0
Reporter Vladimir Reshetnikov (nikov) Vladimir Reshetnikov (nikov)
Created Oct 7, 2009 8:46:14 PM
Updated Apr 30, 2012 12:53:47 AM
Priority Normal
Type Bug
Fix versions Mirabile Futurum
State Open
Assignee Valentin Kipiatkov (valentin)
Subsystem Code Analysis - Linq Tools
Affected versions No Affected versions
Fixed in build No Fixed in build
using System.Collections.Generic;

class A
{
	public virtual bool Foo(string s, int y)
	{
		return false;
	}
}

class B : A
{
	public override bool Foo(string s, int y)
	{
		return true;
	}

	bool Bar(IEnumerable<string> x)
	{
		foreach (var s in x)
		{
			if (base.Foo(s, 0))
				return true;
		}

		return false;
	}
}


Actual result:

	bool Bar(IEnumerable<string> x)
	{
		return x.Any(s => base.Foo(s, 0)); // error CS1911: Warning as Error: Access to member 'A.Foo(string, int)' through a 'base' keyword from an anonymous method, lambda expression, query expression, or iterator results in unverifiable code. Consider moving the access into a helper method on the containing type.
	}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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