Issue with 'dynamic' related to System.Runtime

ClodoClodo ITMember ✭✭
edited July 19 in Xamarin.Mac

My OS: macOS Sierra 10.12.5

Identical issue in both
Visual Studio Community 2017 for Mac, 7.0.1 (build 24)
and
Xamarin Studio: 6.3 (build 864)

How to reproduce:

  • New Project -> Mac -> App -> Cocoa App
  • Edit "ViewController.cs", under "// Do any additional setup after loading the view"
    dynamic w = this;
    string x1 = this.Description;
    string x2 = w.Description;

It throw

Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create

  • Adding a reference to Microsoft.CSharp

Now in debug over 'string x2 = w.Description' throw

System.IO.FileNotFoundException
Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

I pick from a Windows machine the file
c:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Runtime.dll (37kb)
and
References -> Edit reference -> .Net Assembly -> Browse ... -> pick the Windows file.
adding reference in my Xamarin.Mac project

And WORKS.

So, the questions:

  • Is an expected behiavour or a bug?
  • I can redistribute Microsoft System.Runtime.dll file within a macOS app bundle?

p.s. if i remove the System.Runtime reference, and do a "Build -> Build All", still works.
Because VS-Mac don't remove the file "x.app/Contents/MonoBundle/System.Runtime.dll" when i removed the reference and do a normal build.
If i do a "Build -> Rebuild All" the issue correctly return because the file are removed during a rebuild.
This is another problem, of course.

Posts

Sign In or Register to comment.