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

[NET8] Precompilation Error (Exit Code -1073741819) when building on Release #8739

Open
takla21 opened this issue Feb 20, 2024 · 7 comments
Open
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. need-attention A xamarin-android contributor needs to review

Comments

@takla21
Copy link

takla21 commented Feb 20, 2024

Android application type

.NET Android (net7.0-android, net8.0-android, etc.)

Affected platform version

NET 8.0.100, 8.0.200

Description

I am currently migrating a project from net7.0-android to net8.0-android. While the project compiles fine in debug mode, building in release mode fails with the following error:

4>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.79\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Precompiling failed for C:\{pathToProject}\ProjectName.Mobile\obj\Release\net8.0-android\android-x64\linked\ProjectName.Business.dll with exit code -1073741819.
4>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.79\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error :

Here are binlogs as screenshots (confidential stuff redacted)
1
2

Context:
Our project structure is as follows:

  • ProjectName.Mobile (mobile head net8.0-android, net8.0-ios)
  • ProjectName.Windows (windows head)
  • ProjectName.Presentation (library project net8.0 that contains viewmodels)
  • ProjectName.Business (library project net8.0 that contains business rule logic)
  • ProjectName.Access(library project net8.0 that contains API call logic)

Dependencies:
ProjectName.Mobile -> ProjectName.Presentation
ProjectName.Windows -> ProjectName.Presentation

ProjectName.Presentation -> ProjectName.Business -> ProjectName.Access

Steps to Reproduce

  • Build on Release

Did you find any workaround?

N/A

Relevant log output

No response

@takla21 takla21 added Area: App+Library Build Issues when building Library projects or Application projects. needs-triage Issues that need to be assigned. labels Feb 20, 2024
@takla21 takla21 changed the title [NET8] Precompilation Error (Exit Code -1073741819) in Xamarin.Android Release Build. [NET8] Precompilation Error (Exit Code -1073741819) when building on Release Feb 20, 2024
@jonathanpeppers
Copy link
Member

Can you share a .binlog of the failure? https://aka.ms/binlog

Is there anything special about ProjectName.Access.dll? Does it have missing assembly references? Does the AOT compiler log anything else besides the exit code? exit code -1073741819

@takla21
Copy link
Author

takla21 commented Feb 20, 2024

I'll try to reproduce this issue on another project outside of this one first before giving you an actual binlog to avoid sending sensitive data related to the project I'm working on. That's why I've provided you screenshots of those binlog.
image

I'm only seeing errors with the exit code

The ProjectName.Access.dll is generated from this net8 project:

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net8.0</TargetFramework>
		<LangVersion>12.0</LangVersion>
		<RootNamespace>ProjectName.DataAccess</RootNamespace>
		<GenerateDocumentationFile>true</GenerateDocumentationFile>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="DynamicData" Version="7.1.1" />
		<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="3.1.0" />
		<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.0" />
		<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
		<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.0" />
		<PackageReference Include="Reactive.Annex" Version="0.6.0-dev.50" />
		<PackageReference Include="RequestsSignature.HttpClient" Version="2.0.0" />
		<PackageReference Include="Uno.CodeGen" Version="2.0.0-dev.10" />
		<PackageReference Include="Refit" Version="7.0.0" />
		<PackageReference Include="ReviewService.Abstractions" Version="1.0.0" />
		<PackageReference Include="System.Text.Json" Version="7.0.3" />
		<PackageReference Include="MallardMessageHandlers" Version="0.2.0-dev.21" />
		<PackageReference Include="Nventive.Persistence.Reactive" Version="0.4.0-dev.36" />
		<PackageReference Include="Nventive.Persistence" Version="0.4.0-dev.36" />
		<PackageReference Include="System.Reactive" Version="5.0.0" />
		<PackageReference Include="GeneratedSerializers.Json" Version="1.0.0-dev.34" />
                <!-- There are also internal nuget packages (they're all targeting .net6.0) referenced here -->
	</ItemGroup>
</Project>

@jonathanpeppers jonathanpeppers added need-info Issues that need more information from the author. and removed needs-triage Issues that need to be assigned. labels Feb 20, 2024
@jonpryor
Copy link
Member

Exit code -1073741819 is 0xc0000005 which is Access Violation. In all likelihood, mono-aot-cross.exe is crashing.

@takla21: Does it consistently crash on the same assembly?

Is there some way for us to get a copy of the assembly/assemblies which consistently cause the build failure?

/cc @steveisok

@takla21
Copy link
Author

takla21 commented Feb 20, 2024

Ok I'm still working on finding a way to send you bindlog, but I just found out that the bug happens when <AndroidEnableProfiledAot>True</AndroidEnableProfiledAot> is set

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention A xamarin-android contributor needs to review and removed need-info Issues that need more information from the author. labels Feb 20, 2024
@takla21
Copy link
Author

takla21 commented Feb 20, 2024

@jonpryor
yes, it's always the same assembly that causes the failure. It comes from one of the projects mentioned above. Here's its csproj content

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>net8.0</TargetFramework>
		<LangVersion>11.0</LangVersion>
		<GenerateDocumentationFile>true</GenerateDocumentationFile>
	</PropertyGroup>

	<ItemGroup>
		<ProjectReference Include="..\ProjectName.Access\ProjectName.Access.csproj" />
	</ItemGroup>

	<ItemGroup>
		<PackageReference Include="HtmlAgilityPack" Version="1.11.54" />
		<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="6.0.2" />
		<PackageReference Include="Parasol.Environment.Hardware" Version="0.40.5" />
		<PackageReference Include="Parasol.Presentation" Version="0.40.5" />
		<PackageReference Include="Parasol.Storage.Biometry" Version="0.40.5" />
		<PackageReference Include="Uno.CodeGen" Version="2.0.0-dev.10" />
		<PackageReference Include="Parasol.Feeds" Version="0.40.5" />
		<PackageReference Include="MessageDialogService" Version="0.5.0-dev.54" />
	</ItemGroup>
</Project>

@takla21
Copy link
Author

takla21 commented Feb 20, 2024

I also forgot to list all workloads that I'm using locally

Installed Workload Id      Manifest Version       Installation Source
-------------------------------------------------------------------------------------
maui-windows               8.0.6/8.0.100          VS 17.10.34607.79, VS 17.7.34302.85
maccatalyst                17.2.8022/8.0.100      VS 17.10.34607.79, VS 17.7.34302.85
ios                        17.2.8022/8.0.100      VS 17.10.34607.79, VS 17.7.34302.85
android                    34.0.79/8.0.100        VS 17.10.34607.79, VS 17.7.34302.85
maui-android               8.0.6/8.0.100          VS 17.7.34302.85
maui-maccatalyst           8.0.6/8.0.100          VS 17.7.34302.85
maui-ios                   8.0.6/8.0.100          VS 17.7.34302.85

@takla21
Copy link
Author

takla21 commented Feb 21, 2024

@jonpryor @jonathanpeppers I sent you both the assembly + binlog to the email associated on your github account. Hopefully it will help identify the issue here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects. need-attention A xamarin-android contributor needs to review
Projects
None yet
Development

No branches or pull requests

4 participants