Version Used: Microsoft.CodeAnalysis package version: 4.0.0-2.21362.3
Steps to Reproduce:
Given the following test code:
[Fact]
public void AssemblyIsRetargetable()
{
string syntax = @"
using System.Reflection;
[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]
";
CSharpCompilationOptions options = new(OutputKind.DynamicallyLinkedLibrary);
IEnumerable<MetadataReference> defaultReferences = new[]
{
MetadataReference.CreateFromFile(typeof(object).Assembly.Location),
};
CSharpCompilation compilation = CSharpCompilation.Create(
"foo",
new[] { CSharpSyntaxTree.ParseText(syntax) },
defaultReferences,
options);
Assert.Empty(compilation.GetDiagnostics());
IAssemblySymbol assembly = compilation.Assembly;
Assert.True(assembly.Identity.IsRetargetable);
}
Expected Behavior:
The test passes.
Actual Behavior:
Test fails at line Assert.True(assembly.Identity.IsRetargetable).
Message:
Assert.True() Failure
Expected: True
Actual: False
Note that if I get the assembly custom attributes the attribute is present. Also if I emit the assembly and then load it from it's file path, it sets the flag to true as expected.
cc: @jmarolf
Version Used:
Microsoft.CodeAnalysispackage version:4.0.0-2.21362.3Steps to Reproduce:
Given the following test code:
Expected Behavior:
The test passes.
Actual Behavior:
Test fails at line
Assert.True(assembly.Identity.IsRetargetable).Note that if I get the assembly custom attributes the attribute is present. Also if I emit the assembly and then load it from it's file path, it sets the flag to true as expected.
cc: @jmarolf