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

Android app doesn't build in Release mode (Mono Ahead of Time compiler) #107202

Open
munkii opened this issue Aug 22, 2024 · 3 comments
Open

Android app doesn't build in Release mode (Mono Ahead of Time compiler) #107202

munkii opened this issue Aug 22, 2024 · 3 comments
Labels
area-Codegen-AOT-mono untriaged New issue has not been triaged by the area owner

Comments

@munkii
Copy link

munkii commented Aug 22, 2024

Description

When building in Release mode the app would not build.

Precompiling failed for C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-arm64\linked\ProjectBreatheApp.Maui.dll with exit code -1073740791.
Unable to compile method 'void ProjectBreatheApp.Maui.Views.Settings.PushNotifications:InitializeComponent ()' due to: 'Method with open type while not compiling gshared'.
Mono Ahead of Time compiler - compiling assembly C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-arm64\linked\ProjectBreatheApp.Maui.dll
AOTID FE3741B1-52EE-CE48-B1DF-9E41B11C9BC4

  • Assertion at D:\a_work\1\s\src\mono\mono\mini\method-to-ir.c:6460, condition `!sig->has_type_parameters' not met ProjectBreatheApp.Maui (net8.0-android34.0) C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets 109

The issue is our XAML. Note the syntax in the XAML that is using an array index!


Grid x:DataType="settingsViewModels:PushNotificationsItemViewModel" BindingContext="{Binding Categories[1]}">
        <Grid.ColumnDefinitions>
                <ColumnDefinition Width="6*" />
                <ColumnDefinition Width="1*" />
        </Grid.ColumnDefinitions>
        <Label
            Grid.Column="0"
            VerticalOptions="Center"
            Margin="12,0,0,0"
            Text="{Binding Name}" />

        <Switch
            Grid.Column="1"
                IsToggled="{Binding Enabled}"
                VerticalOptions="Center" />         
</Grid>

Steps to Reproduce

App works fine in Debug mode but switching to Release and trying to Build will fail. I have a workaround and to be fair the workaround" is better than the nastiness I was doing previously. I only raise this issue as it is a bug even if what I am doing is wrong

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android

Did you find any workaround?

Switch from using an array index in the BindingContext

BindingContext="{Binding Categories[1]}"

To

BindingContext="{Binding NewsCategory}"

Relevant log output

> 12>[ProjectBreatheApp.Maui.dll] Exec (with response file contents expanded) in C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui: MONO_PATH=C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-x86\linked; MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-x86\8.0.8\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\net8.0-android34.0\android-x86\aot\x86\ProjectBreatheApp.Maui,mtriple=i686-linux-android,tool-prefix=C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\binutils\bin\i686-linux-android-,outfile=obj\Release\net8.0-android34.0\android-x86\aot\ProjectBreatheApp.Maui.dll.so,temp-path=obj\Release\net8.0-android34.0\android-x86\ProjectBreatheApp.Maui.dll.tmp,ld-name=ld,ld-flags=--no-relax -s" "obj\Release\net8.0-android34.0\android-x86\linked\ProjectBreatheApp.Maui.dll"
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Precompiling failed for C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-x86\linked\ProjectBreatheApp.Maui.dll with exit code -1073740791.
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Unable to compile method 'void ProjectBreatheApp.Maui.Views.Settings.PushNotifications:InitializeComponent ()' due to: 'Method with open type while not compiling gshared'.
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Mono Ahead of Time compiler - compiling assembly C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-x86\linked\ProjectBreatheApp.Maui.dll
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : AOTID B673A320-D2EE-E14E-37E5-7A5196D1E4D1
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : * Assertion at D:\a\_work\1\s\src\mono\mono\mini\method-to-ir.c:6460, condition `!sig->has_type_parameters' not met
> 12>[ProjectBreatheApp.Maui.dll] Exec (with response file contents expanded) in C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui: MONO_PATH=C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-arm64\linked; MONO_ENV_OPTIONS= C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-arm64\8.0.8\Sdk\..\tools\mono-aot-cross.exe --debug --nollvm "--aot=asmwriter,temp-path=obj\Release\net8.0-android34.0\android-arm64\aot\arm64-v8a\ProjectBreatheApp.Maui,mtriple=aarch64-linux-android,tool-prefix=C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\tools\binutils\bin\aarch64-linux-android-,outfile=obj\Release\net8.0-android34.0\android-arm64\aot\ProjectBreatheApp.Maui.dll.so,temp-path=obj\Release\net8.0-android34.0\android-arm64\ProjectBreatheApp.Maui.dll.tmp,ld-name=ld,ld-flags=--no-relax -s" "obj\Release\net8.0-android34.0\android-arm64\linked\ProjectBreatheApp.Maui.dll"
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Precompiling failed for C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-arm64\linked\ProjectBreatheApp.Maui.dll with exit code -1073740791.
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Unable to compile method 'void ProjectBreatheApp.Maui.Views.Settings.PushNotifications:InitializeComponent ()' due to: 'Method with open type while not compiling gshared'.
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : Mono Ahead of Time compiler - compiling assembly C:\Projects\MB\breathe.breatherm-app\ProjectBreatheApp.Maui\obj\Release\net8.0-android34.0\android-arm64\linked\ProjectBreatheApp.Maui.dll
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : AOTID FE3741B1-52EE-CE48-B1DF-9E41B11C9BC4
> 12>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\34.0.113\targets\Microsoft.Android.Sdk.Aot.targets(109,5): error : * Assertion at D:\a\_work\1\s\src\mono\mono\mini\method-to-ir.c:6460, condition `!sig->has_type_parameters' not met
>
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen transferred this issue from dotnet/maui Aug 29, 2024
@jpobst
Copy link
Contributor

jpobst commented Aug 29, 2024

@grendello @jonathanpeppers This may be dotnet/runtime but I'll let you decide.

@grendello
Copy link
Contributor

Yep, it's MonoVM. @jonathanpeppers could you transfer it to the runtime? Thanks :)

@jpobst jpobst transferred this issue from dotnet/android Aug 30, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Aug 30, 2024
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

4 participants