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

Fatal signal 6 (SIGABRT) crash on android release when forcing screen orientation #1864

Closed
PureWeen opened this issue May 7, 2024 · 22 comments
Labels
needs reproduction stale The author has not responded in over 30 days

Comments

@PureWeen
Copy link
Contributor

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @H-A-Hristov on Sunday, April 28, 2024 12:39:38 PM

Description

Fatal signal 6 (SIGABRT) crash in logcat, when running release build on android 12 device, using forced orientation and activated concurrent GC.

Debug version works.
Not specifying orientation works.
Disabling concurrent GC works.

Steps to Reproduce

  1. Android release build.
  2. Concurrent GC turned on.
  3. ScreenOrientation = ScreenOrientation.Portrait set as annotation to the Main activity.

Link to public reproduction project repository

No response

Version with bug

8.0.7/8.0.100

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 12

Did you find any workaround?

Debug version works.
Not specifying orientation works.
Disabling concurrent GC works.

Relevant log output

No response

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @PureWeen on Sunday, April 28, 2024 6:27:18 PM

Can you attach a logcat file with your crash?
https://learn.microsoft.com/en-us/xamarin/android/deploy-test/debugging/android-debug-log?tabs=windows

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @MAUIoxo on Sunday, April 28, 2024 7:34:32 PM

I have a similar issue when changing Orientation, but in combination with the Community Toolkit Popup:

IMG_0426

This results in the following Exception:

IMG_0427

This came since a couple of Nightly builds and used to work previously, but strangely enough also in combination with changed Orientation. I don’t change it in Code-Behind, but normally in Simulator or on a real Device, both crash.

Was there a change having an impact on changed orientation, lately?

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @PureWeen on Sunday, April 28, 2024 7:48:59 PM

@MAUIoxo that might be different
Can you log that with MCT?

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @MAUIoxo on Monday, April 29, 2024 7:10:40 AM

I can't, but in Debug Mode, at least for my issue, I got the following Stacktrace info:

Object reference not set to an instance of an object.
   at CommunityToolkit.Maui.Core.Views.MauiPopup.SetShadowView(UIView& target)
   at CommunityToolkit.Maui.Core.Views.MauiPopup.ViewDidLayoutSubviews()
   at UIKit.UIApplication.UIApplicationMain(Int32 , String[] , IntPtr , IntPtr ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 58
   at UIKit.UIApplication.Main(String[] , Type , Type ) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at MacroOptimizerApp.Program.Main(String[] args) in D:\Development\C#\OptimizerApp\OptimizerApp\Platforms\iOS\Program.cs:line 13

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @H-A-Hristov on Monday, April 29, 2024 10:12:25 AM

Update on the matter:
I got a suggestion to disable trimming (and AOT compilations respectively) and test again.
And so I did, combined with re-enabling the concurrent GC.

This solved the issue.
The more interesting part - even enabling trimming and AOT, I cannot reproduce the problem again.
I was able to reproduce it at will, by adding either screen orientation, or the concurrent GC option.

This is the log you requested:
log.txt

Anyway, I plan to accept my miracle and move on.

@PureWeen
Copy link
Contributor Author

PureWeen commented May 7, 2024


Issue moved from dotnet/maui#22106


From @MAUIoxo on Monday, April 29, 2024 4:18:24 PM

Disabling AOT did not work for me. I finally created my own Popup now which works in any Orientation

@VladislavAntonyuk
Copy link
Collaborator

The issue describes a problem on Android but the call stack and exception is on iOS. Please clarify

@H-A-Hristov
Copy link

@VladislavAntonyuk
The issue is the first post.
This is the stack overflow question, that lead to changes: https://stackoverflow.com/questions/78389970/fatal-signal-6-sigabrt-maui-app-crash-in-release-android-net-8-using-forced
And my comment contains logcat copy related to the crash, and how I modified the project to get it working.

Anyway, I must admit that VS warned me, more than once, to test my release build.
And I should have applied Jessie Zhang's solution at first place.
Then again, I have seen more than one issue with crash at startup containing libmonosgen-2.0.so, that advised disabling concurrent GC to resolve it, and indeed it was changing the behavior of the app. So I decided to open issue here.

And while I am very curious to know what was the connection between forcing screen orientation and concurrent GC in android, the Jessie Zhang's solution did get me going.

@cat0363
Copy link
Contributor

cat0363 commented May 8, 2024

I think the issue on the iOS side is related to Issue #1844.
It seems that the problem occurring on the Android side is related to this title.

@MAUIoxo
Copy link

MAUIoxo commented May 8, 2024

I did not use any special View or something that could be null by my Code. It was a simple Popup like the following:

<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
               x:Class="MyApp.SpecialPopup"
               CanBeDismissedByTappingOutsideOfPopup="False">
    <VerticalStackLayout Padding="20"
                         HorizontalOptions="Center"
                         VerticalOptions="Center">
        <Label Text="Welcome to the Fullscreen Popup!"
               HorizontalOptions="Center" />
        <Button Text="Close"
                Clicked="OnCloseButtonClicked"/>
    </VerticalStackLayout>
</toolkit:Popup>

And in Code-behind I created a new instance of it and displayed it via:

var myPopup = new SpecialPopup();
…
Application.Current?.MainPage?.ShowPopup(myPopup);

This used to work as expected and I am pretty sure I also changed orientation before with it.

Now, something is different and leading to the crash when Orientation is changed.

@cat0363
Copy link
Contributor

cat0363 commented May 8, 2024

@MAUIoxo , Isn't the Issue you discovered similar to the post below?
#1844 (comment)
If so, the problem you are experiencing on iOS is not related to the problem you are experiencing on Android.

@H-A-Hristov
Copy link

@cat0363 , @PureWeen
I do not know, how do you see GitHub on your devices, but on my screen, I can clearly see who is the one commenting, and who created the issue.

I made this issue, about android 12 device, that was crashing with the exception above, under the condition of release build, android platform and activated concurrent garbage collection.

I did NOT write anything about IOS, about Community Toolkit, about Popups, or about Null Pointer Exceptions.

Another person claimed that he is having the SAME issue, and for god know what reason, this issue got moved to CommunityToolkit repo.

@cat0363
Copy link
Contributor

cat0363 commented May 8, 2024

@H-A-Hristov , You do not claim that the issue occurred using Community Toolkit, so it appears that the issue was tied to Community Toolkit due to another issue related to device orientation.

I did NOT write anything about IOS, about Community Toolkit, about Popups, or about Null Pointer Exceptions.

Since you haven't mentioned the relationship with the Community Toolkit, it would be better to ask for a clear reason why it is associated. At least, based on the information we currently have, it seems that only the issues occurring on the iOS side are related to the Community Toolkit, and the issues occurring on the Android side are unrelated. This is the reason why no further judgment can be made without the reproduction code.

If you can reproduce this problem without the Community Toolkit, it's not related to the Community Toolkit.

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 3 days. It will be closed if no further activity occurs within 2 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@dotnet-policy-service dotnet-policy-service bot added the stale The author has not responded in over 30 days label May 13, 2024
@MAUIoxo
Copy link

MAUIoxo commented May 13, 2024

Here the required information asked above:
My scenario explicitly came into play with Popups using the Community Toolkit Popup. The Code sample is already posted above! It used to work before in .NET MAUI and always caused this NullReferenceException leading to the error above. So, there is also a good chance the root cause is in .NET MAUI providing non valid information. But, this I can’t decide.

@cat0363
Copy link
Contributor

cat0363 commented May 13, 2024

@MAUIoxo , In your code, you specify "FullScreen" for the value of the Size property. What is this?

Size="FullScreen"

Were you able to specify "FullScreen" in the Size property of Community Toolkit's Popup?
As far as I know, such a designation was not possible before. Does that mean that you have recently become able to do it?

@bijington
Copy link
Contributor

@PureWeen it does appear that we have 2 separate issues within this issue. The OP was Android based but then the bug appears to have been diverted into an iOS Popup bug. Is there a way to copy this issue back into the MAUI repo and we keep the iOS bits here?

@MAUIoxo
Copy link

MAUIoxo commented May 13, 2024

@cat0363 - I must apologize for writing the Code having "FullScreen" in it. What I posted was shortened from my mind. I looked it up in my Git history as I changed to my own implementation of a Popup. From my history it had a CanBeDismissedByTappingOutsideOfPopup="False" line in it, no "FullScreen" there.

@cat0363
Copy link
Contributor

cat0363 commented May 13, 2024

@MAUIoxo , Thank you for your reply.
I think it would be better to discuss issues occurring on iOS in Issue #1844, what do you think?
That's because the problem is occurring in the SetShadowView method call.

At least for #1844, no concrete reproduction code is provided.
Can you post the code you wrote to reproduce the problem along with a link to the github repository?
Also, could you also mention which iOS version it occurred on?
What we currently know in Issue #1844 is that if the target device is iPhone 11 or lower, there will be an issue when rotating the device.

@MAUIoxo
Copy link

MAUIoxo commented May 13, 2024

I commented in #1844 and wrote some Code so you can create a project and test

@cat0363
Copy link
Contributor

cat0363 commented May 13, 2024

@MAUIoxo , Thank you for posting Issue #1844.

Copy link
Contributor

We haven't received a reproduction sample from you. The issue is closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction stale The author has not responded in over 30 days
Projects
None yet
Development

No branches or pull requests

6 participants