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

[feature request] AddReference overload for loading an assembly from a bytes object or a discussion of this in docs #2198

Open
vadimkantorov opened this issue Jul 20, 2023 · 1 comment

Comments

@vadimkantorov
Copy link

vadimkantorov commented Jul 20, 2023

This exists in regular .NET https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.load?view=net-7.0#system-reflection-assembly-load(system-byte())

Having it as an overload AddReference (or as example or a discussion of doing this in documentation) would be quite nice. Is it possible to delete the assembly in a temp dir after calling AddReference on it?

Kind of continuation to #2196 where I manage to compile some .cs files by calling Roslyn from Python using pythonnet, but still have to store the assembly on disk.

Somewhat related on complete pipeline of using Roslyn + Assembly.Load: https://weblog.west-wind.com/posts/2022/Jun/07/Runtime-CSharp-Code-Compilation-Revisited-for-Roslyn - might be useful for other people looking to do this.

Also, the docs looking empty. I"m maybe looking in a wrong place?
image

@vadimkantorov vadimkantorov changed the title [feature request] AddReference overload for loading an assembly from a bytes object [feature request] AddReference overload for loading an assembly from a bytes object or a discussion of this in docs Jul 20, 2023
@vadimkantorov
Copy link
Author

vadimkantorov commented Jul 20, 2023

It appears that one can delete the assembly after AddReference'ing it and still execute methods from this assembly. It would be cleaner to have AddReference from bytes, but this is cool too. Would be nice to have it mentioned in docs.

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

1 participant