Can code execute dynamically in a single point?

In C # .net, we can dynamically run code using System.Codedom.Provider . Similarly, is it possible to dynamically execute code in Monotouch (iPhone / iPad).

Thanks in advance,

+4
source share
2 answers

Impossible. Firstly, because the Xamarin.iOS restriction actually works (it doesn’t work like regular .NET applications, but instead compiles into a regular iOS application), as well as security in the Apple Appstore. In the end, you cannot declare the application safe or regulatory if the behavior can change at any time.

+6
source

Since the version of Xamarin.iOS 7.2 has basic support for the dynamic C # function. From the release note :

Experimental: Dynamic C # support. We allowed the use of C # dynamics with Xamarin.iOS, but this function is very complicated, and we need early adopters, let us know what dynamic code they run on other platforms or would like to run on Xamarin.iOS.

I successfully compiled and performed dynamic access of anonymous types:

  dynamic d = new { name = "x" }; tmp = d.name; 

Currently, you need to add the Microsoft.CSharp.dll file as a dependency, otherwise you will get an exception similar to this:

 Error CS0518: The predefined type `Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported (CS0518) (DynamicSupportOniOS) Error CS1969: Dynamic operation cannot be compiled without `Microsoft.CSharp.dll' assembly reference (CS1969) (DynamicSupportOniOS) 

Unfortunately, neither ExpandoObject nor Json.Net JObject are working right now:

 dynamic x = new ExpandoObject(); x.NewProp = "demo"; // this still works Console.WriteLine(x.NewProp); // fails with Xamarin.iOS 7.2 dynamic d = JObject.Parse("{number:1000, str:'string', array: [1,2,3,4,5,6]}"); Console.WriteLine(d.number); // fails with Xamarin.iOS 7.2 

I created two error reports: https://bugzilla.xamarin.com/show_bug.cgi?id=20081 and https://bugzilla.xamarin.com/show_bug.cgi?id=20082 .

+6
source

All Articles