Correctly set IsRetargetable for source assemblies#55066
Conversation
Source assemblies weren't checking assembly flags and setting IsRetargetable, despite having already decoded all well-known attributes to find the other bits of the assembly identity. We now check and correctly set the IsRetargetable bit. Fixes dotnet#54836.
|
@dotnet/roslyn-compiler for review. |
| [assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]"; | ||
|
|
||
| var comp = CreateCompilation(code); | ||
| Assert.True(comp.Assembly.Identity.IsRetargetable); |
There was a problem hiding this comment.
If I understand correctly, the main purpose of AssemblyNameFlags.Retargetable is to cause a flag to be emitted in metadata.
FWIW, it looks like that was working correctly despite this bug in AssemblyIdentity (see test AssemblyFlagsAttribute which checks the emitted metadata).
There was a problem hiding this comment.
AssemblyFlags is just written out directly, it doesn't read from Identity at all when doing so: https://sourceroslyn.io/#Microsoft.CodeAnalysis/PEWriter/MetadataWriter.cs,1969.
|
Looks like there is a legitimate test failure: |
Yeah, it's calling the wrong constructor now. I'll need to modify the test in the morning. |
|
@dotnet/roslyn-compiler for a second review. |
Source assemblies weren't checking assembly flags and setting IsRetargetable, despite having already decoded all well-known attributes to find the other bits of the assembly identity. We now check and correctly set the IsRetargetable bit. Fixes #54836.