Description
Description
I've moved my code from original Xamarin.iOS app to a new iOS .NET 8 application and it runs as expected if I choose "Don't link" in the iOS/Build/Linker behavior.
When this property is set to its default, "Link Framework SDKs Only", I get "1>Fatal error in IL Linker".
I use QuickGraph PCL version 3.6.61114.2 in my app and it seems as the linker has an issue with this during trimming.
--- Log Excerpt ---
1>--skip-unresolved true --notrimwarn --custom-data "LinkerOptionsFile=obj/Debug/net8.0-ios/ios-arm64/custom-linker-options.txt" --verbose -b --disable-opt unusedtypechecks --enable-serialization-discovery
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_18.0\18.0.8303\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(364,3): error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink
1>Fatal error in IL Linker
1>Unhandled exception. System.Collections.Generic.KeyNotFoundException: The given key 'QuickGraph.Collections.FibonacciHeap`2/<GetEnumerator>d__8' was not present in the dictionary.
1> at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
1> at Mono.Linker.Dataflow.CompilerGeneratedState.<GetCompilerGeneratedStateForType>g__MapGeneratedTypeTypeParameters|11_1(TypeDefinition generatedType, Dictionary`2 generatedTypeToTypeArgs, LinkContext context)
1> at Mono.Linker.Dataflow.CompilerGeneratedState.<GetCompilerGeneratedStateForType>g__MapGeneratedTypeTypeParameters|11_1(TypeDefinition generatedType, Dictionary`2 generatedTypeToTypeArgs, LinkContext context)
1> at Mono.Linker.Dataflow.CompilerGeneratedState.GetCompilerGeneratedStateForType(TypeDefinition type)
1> at Mono.Linker.Dataflow.CompilerGeneratedState.GetGeneratedTypeAttributes(TypeDefinition generatedType)
1> at ILLink.Shared.TrimAnalysis.FlowAnnotations.GetGeneratedTypeAttributes(TypeDefinition typeDef)
1> at ILLink.Shared.TrimAnalysis.FlowAnnotations.BuildTypeAnnotations(TypeDefinition type)
1> at ILLink.Shared.TrimAnalysis.FlowAnnotations.GetAnnotations(TypeDefinition type)
1> at ILLink.Shared.TrimAnalysis.FlowAnnotations.GetTypeAnnotation(TypeDefinition type)
1> at Mono.Linker.Dataflow.DynamicallyAccessedMembersTypeHierarchy.ProcessMarkedTypeForDynamicallyAccessedMembersHierarchy(TypeDefinition type)
1> at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
1> at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
1> at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
1> at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
1> at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
1> at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
1> at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
1> at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
1> at Mono.Linker.Steps.MarkStep.MarkGenericArguments(IGenericInstance instance)
1> at Mono.Linker.Steps.MarkStep.GetOriginalType(TypeReference type, DependencyInfo reason)
1> at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
1> at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
1> at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
1> at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
1> at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
1> at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
1> at Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
1> at Mono.Linker.Steps.MarkStep.Initialize()
1> at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
1> at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
1> at Mono.Linker.Pipeline.Process(LinkContext context)
1> at Mono.Linker.Driver.Run(ILogger customLogger)
1> at Mono.Linker.Driver.Main(String[] args)
1>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net8.0_18.0\18.0.8303\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(406,3): error MSB3371: The file "obj\Debug\net8.0-ios\ios-arm64\linked\Link.semaphore" cannot be created. Could not find a part of the path 'C:\Users\Karl-Otto\Documents\src\KWENDA\MAUI\KWENDA-NET8\Kwenda.iOS\obj\Debug\net8.0-ios\ios-arm64\linked\Link.semaphore'.
Reproduction Steps
https://github.com/towebo/ILTrimmingError-iOS.git
Expected behavior
The app should build, link and deploy regardless of value set in property "iOS/Build/Linker behavior".
Actual behavior
When property "iOS/Build/Linker Behavior" is set to "Link Framework SDKs Only" the IL Trimmer encounters an unexpected error and the build fails.
Regression?
No response
Known Workarounds
Set the property "iOS/Build/Linker behavior" to "Don't link".
I don't know what side effects this might have aside from app size perhaps?
Configuration
Building iOS app with .NET 8.0.
Windows 10, x64, Version 22H2 (OS-version 19045.5131)
Microsoft Visual Studio Community 2022
Version 17.12.0 Preview 5.0
VisualStudio.17.Preview/17.12.0-pre.5.0+35424.110
Microsoft .NET Framework
Version 4.8.09037
Installed Version: Community
Visual C++ 2022 00482-90000-00000-AA057
Microsoft Visual C++ 2022
ASP.NET and Web Tools 17.12.174.40113
ASP.NET and Web Tools
Azure App Service Tools v3.0.0 17.12.174.40113
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.12.174.40113
Azure Functions and Web Jobs Tools
C# Tools 4.12.0-3.24510.2+3fd39c8f6c8db918e3184050599c2046997160f1
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.4.42 (main@840f8b3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
GitHub Copilot 17.12.27.11192
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 17.12.5 (918dbb1)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 6.12.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.12.3.2451803+13fe97052e82683ec4c9fc916531eba5c751037f
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.12.78.0
Microsoft SQL Server Data Tools
Test Adapter for Boost.Test 1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.
Test Adapter for Google Test 1.0
Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.
TypeScript Tools 17.0.30918.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.12.0-3.24510.2+3fd39c8f6c8db918e3184050599c2046997160f1
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.12.0-beta.24501.1+19610c0b654766eec49d044cb97ca6eaa2a63d16
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
VisualStudio.DeviceLog 1.0
Information about my package
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
VSPackage Extension 1.0
VSPackage Visual Studio Extension Detailed Info
Xamarin 17.12.0.152 (d17-12@c9ed1ee)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 17.12.3.17 (remotes/origin/main@0912a005b9)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 17.9.0 (38e87ba)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 13.2.2.0 (d17-5/45b0e14)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: d9a6e87
Java.Interop: xamarin/java.interop/d17-5@149d70fe
SQLite: xamarin/sqlite@68c69d8
Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d
Xamarin.iOS and Xamarin.Mac SDK 16.4.0.23 (9defd91b3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Other information
No response
Metadata
Metadata
Assignees
Type
Projects
Status