[Android, 9.0 Preview 5] Release configuration build results in a malfunctioning app (Preview 5 debug and Preview 4 release configurations work fine).
janne-hmp opened this issue · 8 comments
Description
In release mode in Preview 5 in Android, the app malfunctions (hangs up on opening almost any page). Debug configuration in Preview 5 works fine, as does Release configuration in Preview 4. Tested with both dotnet CLI and Visual Studio 17.11.0 Preview 2.1.
Steps to Reproduce
Build GnollHackM in Release configuration for Android using .NET MAUI 9.0 Preview 5.
Link to public reproduction project repository
https://github.com/hyvanmielenpelit/GnollHack
Version with bug
Unknown/Other
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
9.0.0-preview.4.10690
Affected platforms
Android
Affected platform versions
Android 14
Did you find any workaround?
No, the build is just somehow weirdly corrupted in Preview 5 Release configuration.
Relevant log output
No response
The app still malfunctions in Preview 6, like in Preview 5. There are most likely some (possibly widget appearance) files missing from the apk, since the outlook of e.g. switches on the main page is different from Debug version of the app. Preview 4 works fine. Does anybody know any workarounds I could try rather than just going back to Preview 4 every time I need to build a release version for Android, since all debug versions and iOS and Windows release version work fine in Preview 5 and 6?
Does setting <AndroidEnableMarshalMethods>false</AndroidEnableMarshalMethods>
in your .csproj
fix the issue?
Yes, it does indeed! Thanks a lot. @jonathanpeppers Seems like AndroidEnableMarshalMethods is not working properly at the moment in .NET MAUI 9.0 Preview 6.
I'm gonna reopen this one for now to let @grendello look at it. We are trying to only enable this feature for scenarios that it works, so we should investigate why it is failing for this case.
Thanks for the report!
@janne-hmp would you mind recording the hang event? Your app is a large project and I'm not sure when I'll have time to devote due attention to investigating the issue. Logcat output might be very helpful, here's how to record it:
- Build and deploy your application as usual, but don't start it yet.
- Issue the following commands from the VS Developer Prompt:
> adb logcat -G 65M
> adb shell setprop debug.mono.log default,assembly,timing=bare,mono_log_level=debug,mono_log_mask=all
> adb logcat -c
rem Start the application here, wait for it to hang/crash, then wait 10s more and:
> adb logcat -d > logcat.txt
Then attach the resulting logcat.txt
file here, thanks!
Here you go:
@janne-hmp thank you!
This seems to be now fixed in Preview 7.