dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.89k stars 523 forks source link

all maui app crash on a multi-user android system #8998

Open PureWeen opened 3 weeks ago

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @ismlsmile on Wednesday, September 20, 2023 2:10:47 AM

Description

all maui app crash on a multi-user android system, because maui hard coded '/storeage/emulated/0' in the library, but on a multi-user android system, this path maybe '/storeage/emulated/10'

Steps to Reproduce

any maui app will crash

Link to public reproduction project repository

No response

Version with bug

8.0.0-preview.1.7762

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @drasticactions on Wednesday, September 20, 2023 3:49:48 AM

If you try to run a .NET Android app without MAUI (dotnet new android), does it deploy and work under that setup?

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @ghost on Wednesday, September 20, 2023 3:50:13 AM

Hi @ismlsmile. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @ismlsmile on Thursday, September 21, 2023 4:23:15 AM

I am sorry I do not know how to run a .NET Android app without MAUI, I just use VS

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @ismlsmile on Thursday, September 21, 2023 4:24:25 AM

But it is really a bug, because when I use flutter, there is no problem.

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @moljac on Tuesday, September 26, 2023 2:01:07 PM

Pixel 5 multi user (2 users) MAUI app - crash confirmed

Pixel 5 multi user (2 users) Android app - does not crash

Pixel 6 multi user (2 users) MAUI app - does not crash

Pixel 6 multi user (2 users) Android app - does not crash

logcat:

log_2023-09-26T15-53-59.txt

bugreport:

bugreport-redfin-TQ2A.230505.002-2023-09-26-15-49-11.zip

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @jonpryor on Tuesday, September 26, 2023 2:12:52 PM

The crash in log_2023-09-26T15-53-59.txt is due to:

09-26 15:53:54.968 24797 24797 E .reprosamplexxx: * Assertion at /__w/1/s/src/mono/mono/metadata/assembly.c:2718, condition `corlib' not met

which is:

https://github.com/dotnet/runtime/blob/release/8.0-rc1/src/mono/mono/metadata/assembly.c#L2718

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @jonpryor on Tuesday, September 26, 2023 2:20:20 PM

…which is related to this preceding log entry:

I monodroid-assembly: open_from_update_dir: trying to open assembly: /data/user/0/com.companyname.appmaui.reprosamplexxx/files/.__override__/System.Private.CoreLib.dll

The app crashes because System.Private.CoreLib.dll can't be found, presumably because (1) it was never installed, or (2) it was installed into a different directory.

Looking for other /0/ log entries in log_2023-09-26T15-53-59.txt, and we see:

09-26 15:53:54.945 24797 24797 W debug-app-helper: checking directory: `/data/user/0/com.companyname.appmaui.reprosamplexxx/files/.__override__/lib`
09-26 15:53:54.945 24797 24797 W debug-app-helper: directory does not exist: `/data/user/0/com.companyname.appmaui.reprosamplexxx/files/.__override__/lib`

That's concerning; this is a Debug + Fast Deploy install, so the directory it's looking for should exist when the app is being launched, yet it doesn't.

We need the installation logs.

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @moljac on Tuesday, September 26, 2023 3:15:32 PM

uninstalled app and rebooted

adb shell pm list users

output

Users:
    UserInfo{0:Owner:c13} running
    UserInfo{10:Guest:504}

Pixel 5 app does not crash but hangs on Splashscreen (.NET). App appeared after 30+ secs.

build logs:

msbuild.binlog.zip

collecting logcat and bugreports.

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @moljac on Tuesday, September 26, 2023 3:19:23 PM

logcat and bugreport

log_2023-09-26T17-16-03.txt

bugreport-redfin-TQ3A.230605.011-2023-09-26-17-16-18.zip

PureWeen commented 3 weeks ago

Issue moved from dotnet/maui#17501


From @moljac on Wednesday, September 27, 2023 11:55:19 AM

seems like crashes from yesterday were related to adb streaming installation and/or fastdeploy

Todays tests

Pixel 5

adb shell getprop ro.build.version.release

output

13

List users:

adb shell pm list users

output:

Users:
    UserInfo{0:Owner:c13} running
    UserInfo{10:Guest:504}

Running (installing + launching app as default user 0 Owner):

dotnet build AppMAUI.ReproSampleXXX -f:net8.0-android -t:run -v:diagnostic /bl > log-build-diagnostic.log

App does NOT crash, but startup was very long.

Build logs

msbuild.binlog.zip

log-build-diagnostic-20230927-1128.log.zip

adb shell setprop debug.mono.trace all

logcat (compressed):

log_2023-09-27T11-37-03.txt.zip

Pixel 6

adb shell getprop ro.build.version.release

output

13

List users:

adb shell pm list users

output:

Users:
    UserInfo{0:Owner:c13} running
    UserInfo{10:Guest:504}

Running (installing + launching app as default user 0 Owner):

dotnet build AppMAUI.ReproSampleXXX -f:net8.0-android -t:run -v:diagnostic /bl > log-build-diagnostic.log

App does NOT crash, but startup was very long.

Build logs

msbuild 2.binlog.zip

log-build-diagnostic-20230927-1321.log.zip

logcat (compressed):

log_2023-09-27T13-37-11.txt.zip

jonpryor commented 1 week ago

Adding @dellis1972…

dellis1972 commented 1 week ago

My guess is the user is not providing the -p:UserId=xx value when fast deploying. There is nothing hard coded in our system to use /storeage/emulated/0 . We will however default to UserId=0 if one is no provided.

dellis1972 commented 1 week ago

Here is a link to the docs we have on this https://github.com/xamarin/xamarin-android/blob/main/Documentation/docs-mobile/building-apps/build-properties.md#androiddeviceuserid