MAUI app crashes on Android in debug mode and has errors in release mode
Description
I am attempting to run the demo app created by Visual Studio when creating a new MAUI .NET 8 project on Android, but I am encountering problems in both debug and release mode. When I run the app in debug mode, it crashes at startup with no useful errors. When I try to compile the app in release mode, I get different errors. I have tried different physical devices and emulators with the same results and have already attempted to reinstall Visual Studio. Can someone suggest additional tests or solutions to help me understand and resolve this problem?
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.3 GA
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
7.0.101
Affected platforms
Android, I was not able test on other platforms
Affected platform versions
No response
Did you find any workaround?
No response
Relevant log output
When I try to run the app in debug it crashes at startup with no useful errors:
Timestamp: 2024-03-28 14:58:29.913314700+0000
Process uptime: 4s
Cmdline: com.companyname.testnet8
pid: 11257, tid: 11257, name: nyname.testnet8 >>> com.companyname.testnet8 <<<
uid: 10173
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
Instead when I try to compile it in release mode I receive these errors:
without any changes:
Severity Code Description Project File Line Suppression State
Error IL1012 IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink TestNet8 C:\Users\Sviluppo2\Desktop\Test\TestNet8\ILLink 1
Severity Code Description Project File Line Suppression State
Error NETSDK1144 Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. TestNet8 C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets 87
Build started at 09:11...
1>------ Build started: Project: TestNet8, Configuration: Release Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>TestNet8 -> C:\Users\Sviluppo2\Desktop\Test\TestNet8\bin\Release\net8.0-android\TestNet8.dll
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
1>Optimizing assemblies for size. This process might take a while.
1>ILLink : 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.IndexOutOfRangeException: Index was outside the bounds of the array.
1> at Mono.Cecil.Cil.CodeReader.ReadSequencePoints()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
1> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet]
1> at Mono.Cecil.MethodDefinition.get_Body()
1> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.ProcessQueue()
1> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1> at Mono.Linker.Steps.MarkStep.Process()
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>ILLink : 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.IndexOutOfRangeException: Index was outside the bounds of the array.
1> at Mono.Cecil.Cil.CodeReader.GetInstruction(Collection`1 instructions, Int32 offset)
1> at Mono.Cecil.Cil.CodeReader.ReadSequencePoints()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
1> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet]
1> at Mono.Cecil.MethodDefinition.get_Body()
1> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.ProcessQueue()
1> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1> at Mono.Linker.Steps.MarkStep.Process()
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>ILLink : 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.IndexOutOfRangeException: Index was outside the bounds of the array.
1> at Mono.Cecil.Cil.CodeReader.GetInstruction(Collection`1 instructions, Int32 offset)
1> at Mono.Cecil.Cil.CodeReader.ReadSequencePoints()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
1> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet]
1> at Mono.Cecil.MethodDefinition.get_Body()
1> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.ProcessQueue()
1> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1> at Mono.Linker.Steps.MarkStep.Process()
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>ILLink : 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.IndexOutOfRangeException: Index was outside the bounds of the array.
1> at Mono.Cecil.Cil.CodeReader.GetInstruction(Collection`1 instructions, Int32 offset)
1> at Mono.Cecil.Cil.CodeReader.ReadSequencePoints()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
1> at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
1> at Mono.Cecil.ModuleDefinition.Read[TItem,TRet]
1> at Mono.Cecil.MethodDefinition.get_Body()
1> at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method, DependencyInfo& reason, MessageOrigin& origin)
1> at Mono.Linker.Steps.MarkStep.ProcessQueue()
1> at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1> at Mono.Linker.Steps.MarkStep.Process()
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:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "TestNet8.csproj" -- FAILED.
1>C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "TestNet8.csproj" -- FAILED.
1>C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "TestNet8.csproj" -- FAILED.
1>C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
1>Done building project "TestNet8.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 09:12 and took 43,740 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 09:12 and took 43,742 seconds ==========
set PublishTrimmed as false:
Severity Code Description Project File Line Suppression State
Error XA1030 The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration. TestNet8 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets 552
Build started at 09:14...
1>------ Build started: Project: TestNet8, Configuration: Release Any CPU ------
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(552,3): error XA1030: The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration.
1>Done building project "TestNet8.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 09:14 and took 00,531 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 09:14 and took 00,531 seconds ==========
set PublishTrimmed and RunAOTCompilation as false:
Severity Code Description Project File Line Suppression State
Error XALNS7009 System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Last[TSource]
at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(TypeDefinition type)
at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(AssemblyDefinition assembly)
at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 TestNet8 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets 1482
Build started at 09:15...
1>------ Build started: Project: TestNet8, Configuration: Release Any CPU ------
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>TestNet8 -> C:\Users\Sviluppo2\Desktop\Test\TestNet8\bin\Release\net8.0-android\TestNet8.dll
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: System.InvalidOperationException: Sequence contains no elements
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at System.Linq.Enumerable.Last[TSource]
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(TypeDefinition type)
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(AssemblyDefinition assembly)
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask()
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25
1>Done building project "TestNet8.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 09:15 and took 10,250 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 09:15 and took 10,250 seconds ==========
@paro-ricc
Thanks for the feedback, but we'll need some info:
Did you try with PublishTrimmed=false??
Error NETSDK1144 Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. TestNet8 C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets 87
Based on
Cmdline: com.companyname.testnet8andC:\Users\Sviluppo2\Desktop\Test\TestNet8\bin\Release\net8.0-android\TestNet8.dll
seems like you have small repro/test project. Would you be so kind and publish it as a public repo or upload it here. Our gurus need to take a look into it.
Thanks.
I already tried with PublishTrimmed=false and with RunAOTCompilation=false and these are the results
set PublishTrimmed as false:
Severity Code Description Project File Line Suppression State Error XA1030 The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration. TestNet8 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets 552 Build started at 09:14... 1>------ Build started: Project: TestNet8, Configuration: Release Any CPU ------ 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(552,3): error XA1030: The 'RunAOTCompilation' MSBuild property is only supported when trimming is enabled. Edit the project file in a text editor to set 'PublishTrimmed' to 'true' for this build configuration. 1>Done building project "TestNet8.csproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ========== Build completed at 09:14 and took 00,531 seconds ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ========== ========== Deploy completed at 09:14 and took 00,531 seconds ==========set PublishTrimmed and RunAOTCompilation as false:
Severity Code Description Project File Line Suppression State Error XALNS7009 System.InvalidOperationException: Sequence contains no elements at System.Linq.Enumerable.Last[TSource] at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(TypeDefinition type) at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(AssemblyDefinition assembly) at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 TestNet8 C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets 1482 Build started at 09:15... 1>------ Build started: Project: TestNet8, Configuration: Release Any CPU ------ 1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers. 1>TestNet8 -> C:\Users\Sviluppo2\Desktop\Test\TestNet8\bin\Release\net8.0-android\TestNet8.dll 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: System.InvalidOperationException: Sequence contains no elements 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at System.Linq.Enumerable.Last[TSource] 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(TypeDefinition type) 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at MonoDroid.Tuner.AddKeepAlivesStep.AddKeepAlives(AssemblyDefinition assembly) 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask() 1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.85\tools\Xamarin.Android.Common.targets(1482,3): error XALNS7009: at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 1>Done building project "TestNet8.csproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ========== Build completed at 09:15 and took 10,250 seconds ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ========== ========== Deploy completed at 09:15 and took 10,250 seconds ==========
I put here my project but it's only the new project created by visual studio without ayn change, if you need bin or obj folder I can try to upload them but they are too large for this file. TestNet8.zip
@paro-ricc
Thanks for the feedback.
Few things:
- please try setting
RunAOTCompilationto false. Just to see. binandobjfolders are rarely needed for analysis.- I will check your submitted sample, shortly. Just to finish some daily tasks.
thanks
- setting only
RunAOTCompilation=falseI have the same errors I have in the first try
Error IL1012 IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink TestNet8 C:\Users\Sviluppo2\Desktop\Test\TestNet8\ILLink 1
Severity Code Description Project File Line Suppression State
Error NETSDK1144 Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. TestNet8 C:\Nuget\microsoft.net.illink.tasks\8.0.3\build\Microsoft.NET.ILLink.targets 87
- the folders are about 300 MB each, how could I upload them ?
- setting only
RunAOTCompilation=falseI have the same errors I have the same errors I have in the first try
I have slightly different errors, but AOT related.
- the folders are about 300 MB each, how could I upload them ?
No. You do NOT need to upload them. You did everything right.
Thank you for helping me, I'll remain available to do any tests you need
Try using <TrimMode>partial</TrimMode> please
I have the same errors I had in the first try, like this morning
This is csproj I tested and is OK.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-android</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<!-- Note for MacCatalyst:
The default runtime is maccatalyst-x64, except in Release config, in which case the default is maccatalyst-x64;maccatalyst-arm64.
When specifying both architectures, use the plural <RuntimeIdentifiers> instead of the singular <RuntimeIdentifier>.
The Mac App Store will NOT accept apps with ONLY maccatalyst-arm64 indicated;
either BOTH runtimes must be indicated or ONLY macatalyst-x64. -->
<!-- For example: <RuntimeIdentifiers>maccatalyst-x64;maccatalyst-arm64</RuntimeIdentifiers> -->
<OutputType>Exe</OutputType>
<RootNamespace>TestNet8</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<!-- Display name -->
<ApplicationTitle>TestNet8</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.testnet8</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">11.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">13.1</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
<AndroidPackageFormat>apk</AndroidPackageFormat>
<EnableLLVM>True</EnableLLVM>
<TrimMode>partial</TrimMode>
<!--
<TrimMode>copyused</TrimMode>
-->
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net8.0-android|AnyCPU'">
<EnableLLVM>True</EnableLLVM>
<TrimMode>partial</TrimMode>
<!--
<TrimMode>copyused</TrimMode>
-->
</PropertyGroup>
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\dotnet_bot.png" Resize="True" BaseSize="300,185" />
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Raw Assets (also remove the "Resources\Raw" prefix) -->
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<!--
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.14" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.14" />
-->
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVresion)" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVresion)" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>
</Project>
I copied your csproj but I continue to have the same errors. Could it be a problem in my PC?
I copied your csproj but I continue to have the same errors. Could it be a problem in my PC?
Most likely. Something might be messed up. Do you have previews installed?
please, for starters:
- post
dotnet --list-sdks - post
dotnet --list-runtimes - post
dotnet --info
then we'll see
I've never installed any previews, here are the information you requested
C:\Users\Sviluppo2>dotnet --list-sdks
8.0.202 [C:\Program Files\dotnet\sdk]
8.0.203 [C:\Program Files\dotnet\sdk]
C:\Users\Sviluppo2>dotnet --list-runtimes
Microsoft.AspNetCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
C:\Users\Sviluppo2>dotnet --info
.NET SDK:
Version: 8.0.203
Commit: 5e1ceea679
Workload version: 8.0.200-manifests.a7f084b6
Ambiente di runtime:
OS Name: Windows
OS Version: 10.0.22631
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.203\
Carichi di lavoro .NET installati:
[android]
Origine dell'installazione: SDK 8.0.200, VS 17.9.34723.18
Versioni del manifesto: 34.0.85/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\34.0.85\WorkloadManifest.json
Tipo di installazione: FileBased
[ios]
Origine dell'installazione: SDK 8.0.200, VS 17.9.34723.18
Versioni del manifesto: 17.2.8043/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.ios\17.2.8043\WorkloadManifest.json
Tipo di installazione: FileBased
[maccatalyst]
Origine dell'installazione: SDK 8.0.200, VS 17.9.34723.18
Versioni del manifesto: 17.2.8043/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maccatalyst\17.2.8043\WorkloadManifest.json
Tipo di installazione: FileBased
[wasm-tools-net6]
Origine dell'installazione: VS 17.9.34723.18
Versioni del manifesto: 8.0.3/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.net6\8.0.3\WorkloadManifest.json
Tipo di installazione: FileBased
[maui-windows]
Origine dell'installazione: VS 17.9.34723.18
Versioni del manifesto: 8.0.7/8.0.100
Percorso del manifesto: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.maui\8.0.7\WorkloadManifest.json
Tipo di installazione: FileBased
Host:
Version: 8.0.3
Architecture: x64
Commit: 9f4b1f5d66
.NET SDKs installed:
8.0.202 [C:\Program Files\dotnet\sdk]
8.0.203 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.28 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Can you upload binlog, please?
dotnet build TestNet8/TestNet8.csproj -f:net8.0-android /bl
If you are not comfortable with CLI this could help:
https://learn.microsoft.com/en-us/visualstudio/ide/msbuild-logs?view=vs-2022#capture-binary-logs-through-visual-studio
I get this with your command following the instructions in the link MSBuildReproLogs.zip
and this using the Project System Tools extension binlog.zip
I just noticed that with your command I don't have any error
PS C:\Users\Sviluppo2\Desktop\Test\TestNet8> dotnet build TestNet8.csproj -f:net8.0-android /bl
MSBuild version 17.9.6+a4ecab324 for .NET
MSBuild logs and debug information will be at "C:\MSBuildReproLogs"
Determining projects to restore...
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.
All projects are up-to-date for restore.
MSBuild logs and debug information will be at "C:\MSBuildReproLogs"
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [TargetFramework=net8
.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [Target
Framework=net8.0-android]
TestNet8 -> C:\Users\Sviluppo2\Desktop\Test\TestNet8\bin\Debug\net8.0-android\TestNet8.dll
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [TargetFramework=net8
.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [Target
Framework=net8.0-android]
Build succeeded.
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [TargetFramework=net8
.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [Target mework=net8.0-android]
Framework=net8.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [Target
Framework=net8.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [TargetFramework=net8
.0-android]
C:\Users\Sviluppo2\Desktop\Test\TestNet8\TestNet8.csproj : warning NU1604: Project dependency Microsoft.Maui.Controls.Compatibility does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [Target
Framework=net8.0-android]
4 Warning(s)
0 Error(s)
Time Elapsed 00:00:02.66
I just noticed that with your command I don't have any error
My bad. Sorry. That command did not build Release and thus not done any optimizations. Too much work in parallel and then I make mistakes.
Run target will trigger everything:
dotnet build TestNet8/TestNet8.csproj -f:net8.0-android -c:Release -t:run -bl
Another tip - delete bin and obj folders before.
My bad. Sorry. That command did not build Release and thus not done any optimizations. Too much work in parallel and then I make mistakes.
Don't worry, here are the updated files, I deleted bin and obj folders as requested. MSBuildReproLogs.zip
@paro-ricc
Seems like installation issue on your box.
While I go through the logs, can you please try:
dotnet workload repair
If that does not help I usually would do uninstall then install...
dotnet uninstall <LIST>
dotnet install <LIST>
You can get the <LIST> with
dotnet workload list
and yes please report if that helped.
I tried dotnet workload repair but didn't work, now i'm trying to uninstall then install, but those commands don't exist; did you mean dotnet workload uninstall and dotnet workload install?
@moljac I tried to uninstall and then reinstall these workloads
workload ID Manifest version Installation origin
---------------------------------------------------------------------------------------------
android 34.0.85/8.0.100 SDK 8.0.200, VS 17.9.34723.18
ios 17.2.8043/8.0.100 SDK 8.0.200, VS 17.9.34723.18
maccatalyst 17.2.8043/8.0.100 SDK 8.0.200, VS 17.9.34723.18
maui 8.0.7/8.0.100 SDK 8.0.200
wasm-tools-net6 8.0.4/8.0.100 VS 17.9.34723.18
maui-windows 8.0.7/8.0.100 VS 17.9.34723.18
but I can only change the ones installed by the SDK, the ones installed by VS give me this error message: Workload uninstallation failed: Workload IDs could not be found: maui-windows.
After reinstalling all the SDK workloads the problem was not solved yet
I've seen similar behavior with obfuscated assemblies, but I don't see anything in the binlog that would point to something which looks like obfuscated assembly. (I could be missing something).
The piece of information to diagnose this is the exact method for which the exception happens. You can get it by running the trimmer under a debugger. The simplest way is:
- Open the binlog with the failure in the MSbuil Binlog viewer
- FInd the error (it should point to it on open)
- Copy the value of the CommandLineArguments
- Paste it into a new file called
linker.rspand put that file into the root of your app (where you run thedotnet runfrom) - Cut the
dotnet.exe ...illink.dllfrom the begining of the file and paste it into command line (current directory the root of your app) - Append @linker.rsp to the command line and run it
- It should fail again - the exact same way
- Now run this command under a managed debugger (VS should work just fine) and let it stop on the exception. Once there go to the frame
ReadMethodBody(MethodDefinition)and take a look at the value ofMethodDefinitionit should point you to the method which is having the problem.
Alternatively, you could use https://github.com/vitek-karas/illinkrepro which will package all of the input files for the trimmer into a directory (see the description in the repo). You can then zip it and send it to use to repro here - for this I would advice you use the VS Feedback tool since that will give you the option to share this file "privately with just MS" and then just share the link to the feedback item here.
/cc @agocke @sbomer - linker/cecil crash
It should fail again - the exact same way
I managed to reach this point and I can confirm it failed the same exact way
"C:\Program Files\dotnet\dotnet.exe" "C:\Nuget\microsoft.net.illink.tasks\8.0.4\tools\net8.0\illink.dll" @linker.rsp
ILLink: error IL1012: IL Trimmer has encountered an unexpected error. Please report the issue at https://aka.ms/report-illink
Fatal error in IL Linker
Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Mono.Cecil.Cil.CodeReader.GetInstruction(Collection`1 instructions, Int32 offset)
at Mono.Cecil.Cil.CodeReader.GetInstruction(Int32 offset)
at Mono.Cecil.Cil.CodeReader.ReadSequencePoints()
at Mono.Cecil.Cil.CodeReader.ReadDebugInfo()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
at Mono.Cecil.MetadataReader.ReadMethodBody(MethodDefinition method)
at Mono.Cecil.MethodDefinition.<>c.<get_Body>b__41_0(MethodDefinition method, MetadataReader reader)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
at Mono.Cecil.MethodDefinition.get_Body()
at Mono.Linker.LinkContext.GetMethodIL(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.IsNonEmptyStaticConstructor(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.MarkMethodIf(Collection`1 methods, Func`2 predicate, DependencyInfo& reason, MessageOrigin& origin)
at Mono.Linker.Steps.MarkStep.MarkStaticConstructor(TypeDefinition type, DependencyInfo& reason, MessageOrigin& origin)
at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin)
at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkField(FieldDefinition field, DependencyInfo& reason, MessageOrigin& origin)
at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireType(TypeDefinition type, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkInterfaceImplementation(InterfaceImplementation iface, Nullable`1 origin, Nullable`1 reason)
at Mono.Linker.Steps.MarkStep.MarkInterfaceImplementations(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.MarkRequirementsForInstantiatedTypes(TypeDefinition type)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArgument(CustomAttributeArgument argument, ICustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference, DependencyInfo reason, Nullable`1 origin)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArgument(CustomAttributeArgument argument, ICustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(CustomAttribute ca)
at Mono.Linker.Steps.MarkStep.MarkCustomAttribute(CustomAttribute ca, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkCustomAttributes(ICustomAttributeProvider provider, DependencyInfo& reason)
at Mono.Linker.Steps.MarkStep.MarkEntireAssembly(AssemblyDefinition assembly)
at Mono.Linker.Steps.MarkStep.MarkAssembly(AssemblyDefinition assembly, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.MarkModule(ModuleDefinition module, DependencyInfo reason)
at Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
at Mono.Linker.Steps.MarkStep.Initialize()
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)
but i don't know how to run a command under a managed debugger as you requested in the last point
Now run this command under a managed debugger (VS should work just fine) and let it stop on the exception. Once there go to the frame ReadMethodBody(MethodDefinition) and take a look at the value of MethodDefinition it should point you to the method which is having the problem.
Could you explain me how to do it?
Meanwhile I'll try your last suggestion; the project is an empty maui app, do you think there might be privacy issues if I put my .zip here?
Alternatively, you could use https://github.com/vitek-karas/illinkrepro which will package all of the input files for the trimmer into a directory (see the description in the repo). You can then zip it and send it to use to repro here - for this I would advice you use the VS Feedback tool since that will give you the option to share this file "privately with just MS" and then just share the link to the feedback item here.
How to debug it with VS: https://devblogs.microsoft.com/visualstudio/how-to-debug-and-profile-any-exe-with-visual-studio/
Open the dotnet.exe path from the command line as a Project in VS. Right click on it in Solution Explorer and select Properties. As arguments specify path/to/illink.dll @linker.rsp and then set the Working Directory to point to the main app directory.
You can also set the Debugger Type to Managed (.NET Core, .NET 5+).
Run the app with F5 - it should stop on the exception. If it doesn't open exception settings (Debug-> Windows -> Exception Settings) and make sure the Common Language Runtime Exception checkmark is checked, not just semi-checked (uncheck and check it again). Run again - now it might stop on some more exception, so if it does and it's not the one you're looking for just F5 over it and keep on running until it hits the problem in question)
thanks, the method GetInstruction(Collection<Instruction> instructions, int offset) in class Mono.Cecil.Cil.CodeReader, got instructions.size with 0. so throw the IndexOfRangeException.
downgrade Microsoft.Maui to 8.0.7 maybe can fix this issue.
@vitek-karas here's the exception where the debugger stopped.
Unhandled exception at 0x00007FFC8B7153AC (KernelBase.dll) in dotnet.exe: 0xE0434352 (parameters: 0xFFFFFFFF80131508, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x00007FFC28930000).
@fuxuejun - can you please share the callstack or the GetInstruction call?
@paro-ricc - that looks like a native debugger exception - can you please make sure that you set the debugger type to Managed? In either case, could you share the callstack (that should not contain any confidential data as it will be callstack in the illink tool alone).
@vitek-karas
sorry, I use dnspy to debug the nuget illink dll, callstatck is byte[] arrary, the callstatck is in downstair.
that looks like a native debugger exception - can you please make sure that you set the debugger type to Managed? In either case, could you share the callstack (that should not contain any confidential data as it will be callstack in the illink tool alone).
Sorry, i missed that part, here's the exception
and here's the call stack
> [Exception] Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.GetInstruction(Mono.Collections.Generic.Collection<Mono.Cecil.Cil.Instruction> instructions, int offset) Line 296
[Exception] Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadSequencePoints() Line 440
[Exception] Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadDebugInfo() Line 370
[Exception] Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadMethodBody() Line 96
[Exception] Mono.Cecil.dll!Mono.Cecil.Cil.CodeReader.ReadMethodBody(Mono.Cecil.MethodDefinition method) Line 44
[Exception] Mono.Cecil.dll!Mono.Cecil.MetadataReader.ReadMethodBody(Mono.Cecil.MethodDefinition method) Line 1633
[Exception] Mono.Cecil.dll!Mono.Cecil.MethodDefinition.get_Body.AnonymousMethod__41_0(Mono.Cecil.MethodDefinition method, Mono.Cecil.MetadataReader reader) Line 174
[Exception] Mono.Cecil.dll!Mono.Cecil.ModuleDefinition.Read<TItem, TRet>(ref TRet variable, TItem item, System.Func<TItem, Mono.Cecil.MetadataReader, TRet> read) Line 952
[Exception] Mono.Cecil.dll!Mono.Cecil.MethodDefinition.Body.get() Line 176
[Exception] illink.dll!Mono.Linker.LinkContext.GetMethodIL(Mono.Cecil.MethodDefinition method)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.IsNonEmptyStaticConstructor(Mono.Cecil.MethodDefinition method)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkMethodIf(Mono.Collections.Generic.Collection<Mono.Cecil.MethodDefinition> methods, System.Func<Mono.Cecil.MethodDefinition, bool> predicate, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkStaticConstructor(Mono.Cecil.TypeDefinition type, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkField(Mono.Cecil.FieldDefinition field, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireType(Mono.Cecil.TypeDefinition type, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireAssembly(Mono.Cecil.AssemblyDefinition assembly)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkAssembly(Mono.Cecil.AssemblyDefinition assembly, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkModule(Mono.Cecil.ModuleDefinition module, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkField(Mono.Cecil.FieldDefinition field, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireType(Mono.Cecil.TypeDefinition type, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireType(Mono.Cecil.TypeDefinition type, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireAssembly(Mono.Cecil.AssemblyDefinition assembly)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkAssembly(Mono.Cecil.AssemblyDefinition assembly, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkModule(Mono.Cecil.ModuleDefinition module, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkInterfaceImplementation(Mono.Cecil.InterfaceImplementation iface, Mono.Linker.MessageOrigin? origin, Mono.Linker.DependencyInfo? reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkInterfaceImplementations(Mono.Cecil.TypeDefinition type)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkRequirementsForInstantiatedTypes(Mono.Cecil.TypeDefinition type)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributeArgument(Mono.Cecil.CustomAttributeArgument argument, Mono.Cecil.ICustomAttribute ca)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(Mono.Cecil.CustomAttribute ca)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttribute(Mono.Cecil.CustomAttribute ca, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributes(Mono.Cecil.ICustomAttributeProvider provider, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireAssembly(Mono.Cecil.AssemblyDefinition assembly)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkAssembly(Mono.Cecil.AssemblyDefinition assembly, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkModule(Mono.Cecil.ModuleDefinition module, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkType(Mono.Cecil.TypeReference reference, Mono.Linker.DependencyInfo reason, Mono.Linker.MessageOrigin? origin)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributeArgument(Mono.Cecil.CustomAttributeArgument argument, Mono.Cecil.ICustomAttribute ca)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributeArguments(Mono.Cecil.CustomAttribute ca)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttribute(Mono.Cecil.CustomAttribute ca, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkCustomAttributes(Mono.Cecil.ICustomAttributeProvider provider, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkEntireAssembly(Mono.Cecil.AssemblyDefinition assembly)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkAssembly(Mono.Cecil.AssemblyDefinition assembly, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.MarkModule(Mono.Cecil.ModuleDefinition module, Mono.Linker.DependencyInfo reason)
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.ProcessMarkedPending()
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.Initialize()
[Exception] illink.dll!Mono.Linker.Steps.MarkStep.Process(Mono.Linker.LinkContext context)
[Exception] illink.dll!Mono.Linker.Pipeline.ProcessStep(Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step)
[Exception] illink.dll!Mono.Linker.Pipeline.Process(Mono.Linker.LinkContext context)
[Exception] illink.dll!Mono.Linker.Driver.Run(Mono.Linker.ILogger customLogger)
[Exception] illink.dll!Mono.Linker.Driver.Main(string[] args)
illink.dll!Mono.Linker.Driver.Main(string[] args)
repro.zip I'll also put the repro here; there are no private files
the illink.dll 8.0.2 and 8.0.4 in nuget with maui 8.0.20 will throw this exception. the 8.0.7 version works well.
I tried but I have the same error with all the versions
sorry, i found the real reason is nuget cache file was modified by other program, just clean the nuget cache folder, then restore the nuget, then it works ok.