Uh oh!
There was an error while loading. Please reload this page.
Add public APIs for persisted AssemblyBulder - #97177
Conversation
ghost
commented
Jan 18, 2024
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
ghost
commented
Jan 18, 2024
Tagging subscribers to this area: @dotnet/area-system-reflection-emit Issue Details
namespaceSystem.Reflection.Emit;publicpartialclassAssemblyBuilder{// New API - note that it does not have RequiresDynamicCode annotationpublicstaticAssemblyBuilderDefinePersistedAssembly(AssemblyNamename,AssemblycoreAssembly,IEnumerable<CustomAttributeBuilder>?assemblyAttributes=null);publicvoidSave(Streamstream);publicvoidSave(stringassemblyFileName);protectedabstractvoidSaveCore(Streamstream);}
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| /// When implemented in derived type serializer the assembly to stream. | ||
| /// </summary> | ||
| /// <param name="stream">The stream to which the assembly serialized.</param> | ||
| protected abstract void SaveCore(Stream stream); |
There was a problem hiding this comment.
Was it not possible for someone externally to derive from AssemblyBuilder in .NET 8 and earlier? Adding a new abstract method will break anyone who did.
There was a problem hiding this comment.
We made the AssemblyBuilder abstract in .NET 8, before it was sealed. So only .NET 8 can be considered, and I think it's unlikely somebody would have derived from AssemblyBuilder and build their own implementation.
There was a problem hiding this comment.
If it was possible to derive from AssemblyBuilder in .NET 8, then this is a binary breaking change. I think we need to make it virtual with the base implementation throwing.
cc: @terrajobst
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
steveharter
left a comment
There was a problem hiding this comment.
LGTM; some misc comments. Thanks for this important feature!
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| <!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids --> | ||
| <Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
| </Suppressions> | ||
| </Suppressions> No newline at end of file |
There was a problem hiding this comment.
it is reverted, could not revert the line ending
Uh oh!
There was an error while loading. Please reload this page.
buyaa-n
commented
Jan 21, 2024
Failures unrelated and known |
* Add public APIs for persisted AssemblyBuilder * Update tests to use public API, refactor tests so that the temp files deleted * Make AB.SaveCore(Stream) virtual and add meaningful message for excepiton thrown Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com> * Remove unneeded message * Update newer tests to use new public APIs --------- Co-authored-by: Stephen Toub <stoub@microsoft.com> Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Contributes to #92975