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

Compile to (Memory)Stream #42

Open
h3x4d3c1m4l opened this issue Oct 13, 2019 · 1 comment
Open

Compile to (Memory)Stream #42

h3x4d3c1m4l opened this issue Oct 13, 2019 · 1 comment

Comments

@h3x4d3c1m4l
Copy link

h3x4d3c1m4l commented Oct 13, 2019

Hi,

As a developer that writes dynamic code, I need to compile code which I have to use at runtime immediately. Saving it to first to file and then load the assembly file could be a solution, but this will not work on Blazor (.NET running on WebAssembly in the webbrowser).

I would like to be able to write the assembly to a MemoryStream which I can then load using the Assembly.Load(byte[] rawAssembly) overload.

Currently adding save to Stream functionality to Compiler.cs. If you think this might be useful too I can submit a PR so you can take a look at the code.

@h3x4d3c1m4l h3x4d3c1m4l changed the title Being able to compile to (Memory)Stream Compile to (Memory)Stream Oct 13, 2019
@MilleBo
Copy link
Contributor

MilleBo commented Oct 13, 2019

Sounds like a good idea. We have CompileSourceInMemoryAsync in Compiler.cs but it will only return success or failure (with errors). Maybe you can create a new method or improve on that one so you get the actual assembly too?

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