Conversation
fixxes the following error when building in release mode with trimming: >C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net10.0_26.1\26.1.10494\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(387,3): error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink 2> Fatal error in IL Linker 2> Unhandled exception. System.Collections.Generic.KeyNotFoundException: The given key 'Maui.Health.Services.HealthService/<GetHealthDataAsync>d__12`1' was not present in the dictionary. 2> at System.Collections.Generic.Dictionary`2.get_Item(TKey key) 2> at Mono.Linker.Dataflow.CompilerGeneratedState.<GetCompilerGeneratedStateForType>g__MapGeneratedTypeTypeParameters|11_2(TypeDefinition generatedType, Dictionary`2 generatedTypeToTypeArgs, LinkContext context) 2> at Mono.Linker.Dataflow.CompilerGeneratedState.<GetCompilerGeneratedStateForType>g__MapGeneratedTypeTypeParameters|11_2(TypeDefinition generatedType, Dictionary`2 generatedTypeToTypeArgs, LinkContext context) 2> at Mono.Linker.Dataflow.CompilerGeneratedState.GetCompilerGeneratedStateForType(TypeDefinition type) 2> at Mono.Linker.Dataflow.CompilerGeneratedState.TryGetCompilerGeneratedCalleesForUserMethod(MethodDefinition method, List`1& callees) 2> at Mono.Linker.Steps.MarkStep.MarkReflectionLikeDependencies(MethodIL methodIL, Boolean requiresReflectionMethodBodyScanner, MessageOrigin origin) 2> at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body, MessageOrigin origin) 2> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason) 2> at Mono.Linker.Steps.MarkStep.ProcessQueue() 2> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue() 2> at Mono.Linker.Steps.MarkStep.Process() 2> at Mono.Linker.Steps.MarkStep.Process(LinkContext context) 2> at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) 2> at Mono.Linker.Pipeline.Process(LinkContext context) 2> at Mono.Linker.Driver.Run(ILogger customLogger) 2> at Mono.Linker.Driver.Main(String[] args) 2>C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk.net10.0_26.1\26.1.10494\tools\msbuild\iOS\Xamarin.iOS.Common.After.targets(432,3): error MSB3371: The file "obj\Release\net10.0-ios\iossimulator-arm64\linked\Link.semaphore" cannot be created. Could not find a part of the path 'C:\Dev\Maui.Health\demo\DemoApp\DemoApp\obj\Release\net10.0-ios\iossimulator-arm64\linked\Link.semaphore'.
|
Hello Ossy, Please try to do following (to confirm issue) and also provide some Setup of project so this issue is reproducable.
If the problem still persist, please try to provide minimal setup to reproduce this issue so we can try to reproduce it. |
|
Hi @Saurus119, I created a reproduction branch in which I upgraded to .NET 10. It compiled perfectly with the changes from this PR. After that I reverted my changes from this PR and again when compiling I run into: I really don't understand trimming enough to be able to tell you why this fixes the Issue, but it certainly does. Let me know if I can help any further 😊. Oh, also I am compiling with Xcode 26.1 |
|
@osyyyS It is really strange because for example in my other project I use the same approach and everything works as expected. 🤔 I suspect that even though this could potentially fix the problem, the main cause will be somewhere else. This would need some investigation from our side probably. So firstly we will try to finalize and merge #6 and then we will look into this more deeply |
|
@Kebechet Thanks. I will try again with .NET 10 SR2 when it releases and give feedback here. 😊 |
|
@osyyyS Just out of curiosity. Can you test it with .NET9? |
|
@Kebechet sure thing! Will have to reinstall older Version of Xcode first 😅 |
|
@osyyyS please put like on the issue: it can be related because current Android binding package we use is |
@Kebechet
I fixed the ILLinker crash by removing the async state machine on the public generic method.
What changed:
Why:
fixxes the following error when building in release mode with trimming:
Resolved #7 and #3