Skip to content
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

Reflection support somehow limited ? #17

Closed
XenocodeRCE opened this issue Jul 17, 2021 · 1 comment
Closed

Reflection support somehow limited ? #17

XenocodeRCE opened this issue Jul 17, 2021 · 1 comment

Comments

@XenocodeRCE
Copy link

got a warning during compilation on this line (22) :

var assembly = Assembly.Load(memoryBytes);

message says :

D:\Program.cs(22): Trim analysis warning IL2026: Program.Main(String[]): Using method 'System.Reflection.Assembly.Load(Byte[])' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types and members the loaded assembly depends on might be removed.

and at runtime when i run the compiled output i got :

D:\bflat\Program.exe
Unhandled Exception: System.PlatformNotSupportedException: Operation is not supported on this platform.
   at Internal.Reflection.Execution.AssemblyBinderImplementation.Bind(Byte[], Byte[], AssemblyBindResult&, Exception&) + 0x39
   at System.Reflection.Runtime.Assemblies.RuntimeAssembly.GetRuntimeAssemblyFromByteArray(Byte[], Byte[]) + 0x56
   at Program.Main(String[]) + 0x5f
   at Program!<BaseAddress>+0x2d7bbf
@MichalStrehovsky
Copy link
Member

That's expected. With bflat you're getting ahead of time compilation same as Go or Rust. It's not possible to load new code that wasn't compiled ahead of time. Same as in Go or Rust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants