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
Tracking issue for remaining AssemblyBuilder.Save work in .NET 9 #92975
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection-emit Issue DetailsSee #62956 for what have done for adding
|
An important part of |
Look the last bullet of the list. |
Oops! Not sure how I missed that. Good to see it got included. |
This comment was marked as off-topic.
This comment was marked as off-topic.
We are making a good progress, planning to finish the main functionality (excluding entry point and PDB) and make related APIs public in preview 1. Now it would be great to test the implementation with a real-life scenario. I would really appreciate if you could:
Thank you in advance! |
Here's my real-life scenario: https://github.com/boo-lang/boo This is not a "simple app" but rather a thorough, comprehensive test of the system: a compiler that uses Last I checked, all the tests pass under .NET Framework. So seeing how many pass under this project is a good benchmark for how correct your implementation is. |
The feature is now available in https://dotnet.microsoft.com/en-us/download/dotnet/9.0, please give it a try and give us a feedback. We also adding bunch of fixes: #97350 and #98393 in preview 2 mostly related to complex generic types/methods Here is related doc: https://learn.microsoft.com/dotnet/fundamentals/runtime-libraries/system-reflection-emit-assemblybuilder#persistable-dynamic-assemblies-in-net-core |
Is there an ETA for I need that otherwise my use case is still not covered (an optimizing compiler that compiles to CIL). |
We decided to add completely different API for setting |
It currently fails when doing the following (very simple and common scenario):
Will add code soon. |
Thank you @leppie that should have been fixed in preview 2, I can double check when you share the code. |
Sorrry, was not aware there was a second preview already. But keep them coming! Edit: I see preview 2 not out yet. You can just grab the code from the PR (IronScheme/IronScheme#160) and follow the steps. |
Sorry @leppie I mistaken, we had similar fixes made in preview 2, but your scenario was not covered, I put up a PR and it will be fixed in preview 3 |
@GGG-KILLER this change now merged and will be available in preview 3 |
Thanks! In the meantime I ended up vendoring System.Reflection.Emit into my project to be able to do that with the suggested API, so I should be able to migrate to it when .NET 9 p3 comes out |
I guess that's general issue with reflection.emit that exists longer that netcore does. This may help https://stackoverflow.com/a/40221032/10339675 |
It has indeed. At least for the 1 specific blocker I have had. Update: Only had a few more blockers, but IronScheme can now compile and bootstrap itself with .NET 9! Thanks for the pointer @jl0pd |
Last item in the list: PDB support is added in preview 4. Closing the issue as completed, if you see any bug/issue please file a new issue |
So when is preview 4 expected to be available? |
Around 21-May |
One bit of API surface that's still noticeably missing is resources. |
The recommended replacement is to pass the resource blobs as |
@jkotas Sure, but where do you get "the resource blobs" from? There doesn't seem to be much information out there on the subject. Googling "c# create resource blobs" gives you a bunch of results about using Azure blob storage, and "c# create resources" gives you results about working with RESX files. |
Creating resource blobs in the context of .NET typically refers to embedding resources directly into your assembly as binary data. This could include images, XML files, localization strings, or any other data that you want to include with your application. |
@buyaa-n Could you please look into creating a sample for this? |
@jkotas Thanks, that's very helpful. And what about the unmanaged resources? It's not at all clear from the API or documentation how |
If you have the raw bytes, you can just write them out. Here is how it is done in Roslyn: https://github.com/dotnet/roslyn/blob/7a96b1530744f6637ad6bb6bf5b8dfa33ea15b81/src/Compilers/Core/Portable/PEWriter/PeWriter.cs#L431-L447 . The two offsets are for cases where the native resources have relocs. |
@jkotas OK, thanks! |
See #62956 for work done in .NET 8 for adding
AssemblyBuilder.Save(string/stream)
support. Remaining work include:ILGenerator
implementationConstructorBuilderImpl
and save it to file/stream (this should includeEmit(OpCode opcode, ConstructorInfo con)
implementation)PropertyBuilderImp
l and save it to file/streamEventBuildterImpl
and save it to file/streamAssemblyBuilder
/ModuleBuilder
(CreateGlobalFuntions
,DefineGlobalMethod
etc)MethodBuilder
/TypeBuilder
/FieldBuilder
(likeSignatureCallingConvention
,*RequiredCustomModifiers
,*OptionalCustomModifiers
)The text was updated successfully, but these errors were encountered: