New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile C# script in DynamicMethod #15557

matjazmav opened this Issue Nov 28, 2016 · 3 comments


None yet
5 participants

matjazmav commented Nov 28, 2016

Is it possible to compile C# script into DynamicMethod? Or load raw assembly into DynamicMetgod.GetILGenerator.

Thanks for any info.


This comment has been minimized.


tmat commented Nov 28, 2016

No, it is not possible.


This comment has been minimized.


tmat commented Nov 28, 2016

What scenario would you use such a feature for?


This comment has been minimized.


filipw commented Nov 29, 2016

@tmat not sure if this is related, but I'd like to take advantage of something like skipRestirctedVisibility on DynamicMethod for scripts. (kind of like the hypothetical #r! feature, where I can access internals/privates from imported assembly)

I can successfully compile the script code with Roslyn that relies on internal/private member access by manipulating MetadataImportOptions to MetadataImportOptions.All and setting BinderFlags.IgnoreAccessibility on the compilation options, but then at runtime I will run into MethodAccessException.

Is there any workaround?

@jinujoseph jinujoseph added this to the Unknown milestone Jul 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment