KEMBAR78
[area-Tools-ILLink]: NotImplementedException: We currently don't handle function pointer types. · Issue #113031 · dotnet/runtime · GitHub
Skip to content

[area-Tools-ILLink]: NotImplementedException: We currently don't handle function pointer types. #113031

@adirh3

Description

@adirh3

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

Metadata

Metadata

Assignees

Labels

area-Tools-ILLink.NET linker development as well as trimming analyzers

Type

No type

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions