Reporter | 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. }