runtime: [area-Tools-ILLink]: NotImplementedException: We currently don't handle function pointer types.
Description
.NET 10 preview 1 linker crashes when using trimming with dotnet publish.
Fatal error in IL Linker
Unhandled exception. System.NotImplementedException: We currently don't handle function pointer types.
at Mono.Linker.TypeReferenceEqualityComparer.GetHashCodeFor(TypeReference obj)
at Mono.Linker.TypeReferenceEqualityComparer.GetHashCodeFor(TypeReference obj)
at ILLink.Shared.TrimAnalysis.FieldValue.GetHashCode()
at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value, Int32& location)
at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other)
at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer)
at ILLink.Shared.DataFlow.ValueSet`1.Union(ValueSet`1 left, ValueSet`1 right)
at Mono.Linker.Dataflow.MethodBodyScanner.StoreMethodLocalValue[KeyType](Dictionary`2 valueCollection, ValueSet`1& valueToStore, KeyType collectionKey, Int32 curBasicBlock, Nullable`1 maxTrackedValues)
at Mono.Linker.Dataflow.MethodBodyScanner.Scan(MethodIL methodIL, InterproceduralState& interproceduralState)
at Mono.Linker.Dataflow.MethodBodyScanner.InterproceduralScan(MethodIL startingMethodIL)
at Mono.Linker.Dataflow.ReflectionMethodBodyScanner.InterproceduralScan(MethodIL methodIL)
at Mono.Linker.Steps.MarkStep.MarkReflectionLikeDependencies(MethodIL methodIL, Boolean requiresReflectionMethodBodyScanner, MessageOrigin origin)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at Mono.Linker.Driver.Run(ILogger customLogger)
at Mono.Linker.Driver.Main(String[] args)
Reproduction Steps
Seems to happen in two mid-sized projects when running dotnet publish -c Release -r win-x64 --self-contained=true
Expected behavior
Publish to succeed.
Actual behavior
Publish crashing due to trimming.
Regression?
Yes, since .NET 10 Preview 1
Known Workarounds
Disable trimming.
Configuration
No response
Other information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 25 (25 by maintainers)
Thanks for reporting, and for the help nailing down a repro!
Thanks for the fix! 😁 I’ll test this once it arrives in next month’s .NET 10 Preview 6 (at least I think that’s when it’ll land)
That method located in
Microsoft.Windows.SDK.NET, Version=10.0.26100.38, Culture=neutral, PublicKeyToken=31bf3856ad364e35Currently that’s failing when scanning following method
Yes – it should work now
Taking a look. If you have a repro that would be helpful!