Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AOT failing on a third party nuget we are trying to AOT skip #112192

Open
IainS1986 opened this issue Feb 5, 2025 · 1 comment
Open

AOT failing on a third party nuget we are trying to AOT skip #112192

IainS1986 opened this issue Feb 5, 2025 · 1 comment
Labels
area-Codegen-AOT-mono untriaged New issue has not been triaged by the area owner

Comments

@IainS1986
Copy link

Android framework version

net8.0-android

Affected platform version

SDK 8.0.300, Android 34.0.147/8.0.100

Description

We have a third party nuget that is failing during AOT - we are trying to skip the assembly but the AOT process still seems to hit an assertion exception and fails the build.

The nuget is,
<PackageReference Include="WW.Cad_Net6.0" Version="6.0.2023.11201" />

It requires a license to use at runtime, but building should be fine.

This is the AOT exceptions we are getting,

[68/176] System.Text.Json.dll -> System.Text.Json.dll.so
[WW.dll] Exec (with response file contents expanded) in /.../MyApp.Droid: MONO_PATH=/.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked: MONO_ENV_OPTIONS= /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.android-arm/8.0.12/Sdk/../tools/mono-aot-cross --debug --nollvm "--aot=asmwriter,temp-path=obj/Release/net8.0-android/android-arm/aot/armeabi-v7a/WW,profile-only,profile=/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.147/targets/dotnet.aotprofile,mtriple=armv7-linux-gnueabi,tool-prefix=/Users/iainstanford/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-,outfile=obj/Release/net8.0-android/android-arm/aot/WW.dll.so,temp-path=obj/Release/net8.0-android/android-arm/WW.dll.tmp,ld-name=ld,ld-flags=-s" "obj/Release/net8.0-android/android-arm/linked/WW.dll"

[69/176] SQLite-net.dll -> SQLite-net.dll.so
1>Microsoft.Android.Sdk.Aot.targets(109,5): Error  : Precompiling failed for /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.Pdf.dll with exit code 134.
Mono Ahead of Time compiler - compiling assembly /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.Pdf.dll
AOTID E94E2877-B87E-4DA9-376B-B9104CE840C7
Using profile data file '/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.147/targets/dotnet.aotprofile'
Added 0 methods from profile.
* Assertion at /Users/runner/work/1/s/src/mono/mono/metadata/metadata.c:1326, condition `GINT_TO_UINT32(idx) < table_info_get_rows (t)' not met
1>Microsoft.Android.Sdk.Aot.targets(109,5): Error  : Precompiling failed for /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.dll with exit code 134.
Mono Ahead of Time compiler - compiling assembly /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.dll
AOTID 4B2F46CF-11F6-7444-044F-1FA8DCB045C4
Using profile data file '/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.147/targets/dotnet.aotprofile'
Added 0 methods from profile.
* Assertion at /Users/runner/work/1/s/src/mono/mono/metadata/metadata.c:1326, condition `GINT_TO_UINT32(idx) < table_info_get_rows (t)' not met
[WW.Cad.dll] Exec (with response file contents expanded) in /.../MyApp.Droid: MONO_PATH=/.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked: MONO_ENV_OPTIONS= /usr/local/share/dotnet/packs/Microsoft.NETCore.App.Runtime.AOT.osx-arm64.Cross.android-arm/8.0.12/Sdk/../tools/mono-aot-cross --debug --nollvm "--aot=asmwriter,temp-path=obj/Release/net8.0-android/android-arm/aot/armeabi-v7a/WW.Cad,profile-only,profile=/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.147/targets/dotnet.aotprofile,mtriple=armv7-linux-gnueabi,tool-prefix=/Users/iainstanford/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-,outfile=obj/Release/net8.0-android/android-arm/aot/WW.Cad.dll.so,temp-path=obj/Release/net8.0-android/android-arm/WW.Cad.dll.tmp,ld-name=ld,ld-flags=-s" "obj/Release/net8.0-android/android-arm/linked/WW.Cad.dll"

1>Microsoft.Android.Sdk.Aot.targets(109,5): Error  : Precompiling failed for /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.Cad.dll with exit code 134.
Mono Ahead of Time compiler - compiling assembly /.../MyApp.Droid/obj/Release/net8.0-android/android-arm/linked/WW.Cad.dll
AOTID 1352B6E5-2C41-6B8E-0FEA-E968AD743BCB
Using profile data file '/usr/local/share/dotnet/packs/Microsoft.Android.Sdk.Darwin/34.0.147/targets/dotnet.aotprofile'
Added 0 methods from profile.
* Assertion at /Users/runner/work/1/s/src/mono/mono/metadata/metadata.c:1326, condition `GINT_TO_UINT32(idx) < table_info_get_rows (t)' not met
[70/176] Xamarin.Android.Glide.dll -> Xamarin.Android.Glide.dll.so

We've tried the following to skip the assemblies but neither (and both) don't see to work...

  ...
  <AndroidLinkSkip>WW;WW.Cad;WW.Pdf</AndroidLinkSkip>
  ...

  <ItemGroup>
    <TrimmerRootAssembly Include="WW.Cad" RootMode="library" />
    <TrimmerRootAssembly Include="WW.Pdf" RootMode="library" />
    <TrimmerRootAssembly Include="WW" RootMode="library" />
  </ItemGroup>

This is our full set of properties for release builds with AOT

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <RuntimeIdentifiers>android-arm;android-arm64</RuntimeIdentifiers>
    <DebugSymbols>true</DebugSymbols>
    <MandroidI18n>west</MandroidI18n>
    <AndroidDexTool>d8</AndroidDexTool>
    <AndroidLinkTool>r8</AndroidLinkTool>
    <AndroidKeyStore>True</AndroidKeyStore>
    <AndroidSigningKeyStore>...</AndroidSigningKeyStore>
    <AndroidSigningStorePass>...</AndroidSigningStorePass>
    <AndroidSigningKeyAlias>...</AndroidSigningKeyAlias>
    <AndroidSigningKeyPass>...</AndroidSigningKeyPass>
    <AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
    <DefineConstants>TRACE</DefineConstants>
    <WarningLevel>4</WarningLevel>
    <RunAOTCompilation>true</RunAOTCompilation>
    <EnableLLVM>false</EnableLLVM>
    <AndroidUseDefaultAotProfile>true</AndroidUseDefaultAotProfile>
    <AndroidEnableProfiledAot>true</AndroidEnableProfiledAot>
    <AndroidUseAapt2>true</AndroidUseAapt2>
    <AndroidEnableSGenConcurrent>false</AndroidEnableSGenConcurrent>
    <AndroidLinkSkip>WW;WW.Cad;WW.Pdf</AndroidLinkSkip>
  </PropertyGroup>

Steps to Reproduce

Haven't been able to confirm in a small project,

  1. Add WW.Cad_Net6.0 nuget
  2. Enabled AOT
  3. Run build.

Did you find any workaround?

No response

Relevant log output

@jonathanpeppers
Copy link
Member

It's probably on this line, I just tried release/9.0 branch:

What is special about WW.dll that it breaks? Is there so much code inside this assembly, something overflows?

In either case, we can move this to dotnet/runtime.

@jonathanpeppers jonathanpeppers transferred this issue from dotnet/android Feb 5, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Codegen-AOT-mono untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants