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

Placing DAM on a Type array crashes illink #104761

Closed
MichalStrehovsky opened this issue Mar 29, 2022 · 1 comment · Fixed by #105642
Closed

Placing DAM on a Type array crashes illink #104761

MichalStrehovsky opened this issue Mar 29, 2022 · 1 comment · Fixed by #105642
Assignees
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@MichalStrehovsky
Copy link
Member

dotnet/BenchmarkDotNet#1960 (comment)

[2022/03/28 17:20:11][INFO]   Unhandled exception. System.InvalidOperationException: Operation is not valid due to the current state of the object.
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.GetValueNodeForCustomAttributeArgument(CustomAttributeArgument argument)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.ProcessAttributeDataflow(MethodDefinition method, IList`1 arguments)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
[2022/03/28 17:20:11][INFO]      at Mono.Linker.Steps.MarkStep.Initialize()

I think the bug is here:

https://github.com/dotnet/linker/blob/da3c743a606b300c245c312c8cd9b3238d110d65/src/linker/Linker.Dataflow/FlowAnnotations.cs#L441-L450

This falls into the Cecil footgun that resolving the type removes any signs of it ever being a constructed/parameterized type.

@MichalStrehovsky MichalStrehovsky changed the title Placing DAM on an array crashes illink Placing DAM on a Type array crashes illink Mar 29, 2022
@sbomer sbomer transferred this issue from dotnet/linker Jul 11, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 11, 2024
@sbomer sbomer added this to the 9.0.0 milestone Jul 11, 2024
@jeffschwMSFT jeffschwMSFT added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Jul 15, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @sbomer, @vitek-karas
See info in area-owners.md if you want to be subscribed.

@am11 am11 removed the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jul 19, 2024
@sbomer sbomer self-assigned this Jul 23, 2024
@sbomer sbomer closed this as completed in ed40e60 Jul 31, 2024
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Jul 31, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Tools-ILLink .NET linker development as well as trimming analyzers in-pr There is an active PR which will close this issue when it is merged
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants