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

RSRP-214168: Invalid unresolved extension method when used with dynamic dispatch

$
0
0
Reporter Ilya Ryzhenkov (orangy) Ilya Ryzhenkov (orangy)
Created Feb 11, 2011 8:14:56 PM
Updated Jun 29, 2011 7:41:54 PM
Priority Critical
Type Bug
Fix versions Mirabile Futurum
State Open
Assignee Olga Lobacheva (olka)
Subsystem No subsystem
Affected versions No Affected versions
Fixed in build No Fixed in build
Compiler shows the following error:

error CS1973: 'Class1' has no applicable method named 'Extension' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

  public class Class1
  {
    private dynamic x;
    void Foo() { new Class1().Extension(x); }
  }

  public static class Class1Ex
  {
    public static void Extension(this Class1 c, string s){}
  }


Obviously, needs QFs to cast or convert to static invocation.
Important in MVC3 because of ViewBag dynamic nature and lots of extension methods for HtmlHelper.

Viewing all articles
Browse latest Browse all 106942

Trending Articles



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