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

[Xamarin.Forms][Android] XA3001: Could not AOT the assembly: Microsoft.Graph.dll #1957

Open
mfeingol opened this issue Jun 9, 2023 · 17 comments
Labels
type:bug A broken experience

Comments

@mfeingol
Copy link

mfeingol commented Jun 9, 2023

Describe the bug
After upgrading to Microsoft.Graph 5.x (from 4.x) I'm seeing the following error creating a release Android archive build:

XA3001: Could not AOT the assembly: Microsoft.Graph.dll

To Reproduce
I do not know if this reproduces 100% on all Xamarin.Forms Android projects or not.

Expected behavior
I'd expect to be able to successfully AOT this assembly.

Please let me know if you need additional information for this one. I will likely have to revert to 4.x.

Thanks.

@ghost ghost added the Needs: Triage label Jun 9, 2023
@mfeingol
Copy link
Author

mfeingol commented Jun 9, 2023

I should note this fails with both 5.12.0 and 5.13.0. Haven't tried other versions.

@mfeingol
Copy link
Author

@andrueastman: are you aware of any workarounds for this? Thanks.

@NickDarvey
Copy link

This is fixed in main of dotnet/runtime but there's no backport to net7.0 yet. dotnet/runtime#87061

You can workaround it with this in your project:

<TrimmableAssembly Include="Microsoft.Graph" />

@mfeingol
Copy link
Author

Thanks, @NickDarvey.

My project layout is as follows: Android csproj -> Xamarin.Forms csproj -> .NET Standard 2.0 assembly csproj -> Microsoft.Graph.

I've added this to each of the three csproj files as follows:

<ItemGroup>
  <TrimmableAssembly Include="Microsoft.Graph" />
</ItemGroup>

However, I still see the error archiving the Android project:

XA3001: Could not AOT the assembly: Microsoft.Graph.dll

@NickDarvey
Copy link

Oh, perhaps it's a different issue then. Sorry @mfeingol! I'd suggest capturing a binlog and opening an issue in either xamarin/xamarin-android or dotnet/runtime similar to this one. They're much more responsive.

See also workaround described in dotnet/android#5764

@mfeingol
Copy link
Author

@NickDarvey: thanks for the note. That second workaround doesn't help either. So ... do you know how I can capture a binlog for the Android "archive" function in VS? That's where the error happens.

@NickDarvey
Copy link

So ... do you know how I can capture a binlog for the Android "archive" function in VS? That's where the error happens.

It looks like you can get the binlog by setting an envvar or this extension.

@mfeingol
Copy link
Author

@NickDarvey: unfortunately the extension lists no content when archiving, and the env var results in lots of logs that do not contain the word "Graph" so they do not appear to have useful data either.

Any other suggestions?

@NickDarvey
Copy link

The env var would produce a .binlog, probably in your project directory. The extension will let you save a binlog, as shown here.

In either case, if you open the binlog with a viewer it should mention 'graph' because your error mentions 'graph' (and the error will definitely be in there).

@mfeingol
Copy link
Author

@NickDarvey: please feel free to take a look at the output I did get. And there's no .binlog in my project directory.

Logs.zip

I'm guessing the Xamarin Android archive function doesn't use MSBuild...

@NickDarvey
Copy link

You should open an issue and share your binlog in xamarin/xamarin-android

@mfeingol
Copy link
Author

@NickDarvey: on closer look, this issue is a dup of dotnet/runtime#85917. I'm seeing the following text in diagnostic build logs:

[aot-compiler stdout] * Assertion at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mono/mini/aot-compiler.c:10858, condition `table_size < 65000' not met

@andrueastman: please cf this comment: dotnet/runtime#85917 (comment) - is there a way for Microsoft.Graph.dll to not include this many methods? I'm wondering why that's needed given my very minimal use of Graph in my app (essentially accessing a few OneDrive functions).

@mfeingol
Copy link
Author

I also filed dotnet/android#8274 for this.

@sereoja
Copy link

sereoja commented Aug 31, 2023

<PropertyGroup Condition="'$(Configuration)' == 'Release'"> <RunAOTCompilation>false</RunAOTCompilation> <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot> </PropertyGroup>

@andrueastman
Copy link
Member

This should be resolved via #2182 and release https://www.nuget.org/packages/Microsoft.Graph/5.32.0

@mfeingol
Copy link
Author

@andrueastman: this still isn't working.

<PackageReference Include="Microsoft.Graph" Version="5.32.0" />

[aot-compiler stdout] Running: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Xamarin\\Android\\binutils\\bin\\llvm-mc.exe" --arch=arm --triple=arm-linux-gnu --assemble --filetype=obj --mattr=+armv7-a,+vfp3 -o=obj\Release\130\aot\armeabi-v7a\SQLitePCLRaw.provider.e_sqlite3.dll\temp-llvm.o obj\Release\130\aot\armeabi-v7a\SQLitePCLRaw.provider.e_sqlite3.dll\temp-llvm.s
XA3001: Could not AOT the assembly: Microsoft.Graph.dll

@andrueastman andrueastman reopened this Oct 30, 2023
@andrueastman andrueastman self-assigned this Oct 30, 2023
@mfeingol
Copy link
Author

mfeingol commented Nov 6, 2023

@andrueastman: let me know if you need access to an app that reproduces the problem. Thanks.

@petrhollayms petrhollayms added the type:bug A broken experience label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug A broken experience
Projects
None yet
Development

No branches or pull requests

5 participants