-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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][Regression] * Assertion at /__w/1/s/src/mono/mono/metadata/object.c:657, condition `lock->done' not met #96804
Comments
Same issue here. Got this issue after updated my visual studio 2022 to 17.8.4. |
It doesn't appeared when I launched app with 'Start without Debugging". Seems it has problems with debugger. |
Hi @mfeingol. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md 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. |
@DosangGu do you have a repro you can attach? |
@mfeingol does 9806 work again if you don't use debugging? This is the diff between the nightlies, 1 commit of test, non-shipping code: dotnet/maui@3944004...61ca414 If you try an older and newer nightly, do you get the same results? |
Hi @mfeingol. 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. |
@mattleibow - I can confirm the issue seems to appear only when the debugger is attached. These are my experiment results from yesterday:
@PureWeen - the only repro I can offer at the moment is access to my app on GitHub. |
Tagging subscribers to 'arch-android': @steveisok, @akoeplinger Issue DetailsDescriptionAfter picking up the latest VS update with what I believe is MAUI 8.0.6 SR1, I started seeing the following crash in my app on startup:
After some binary searching, I tracked it down to a regression in the 8.0.6-nightly.9806 build. 8.0.6-nightly.9804 works fine. Steps to ReproduceUnclear. Possibly do some networking on startup? It's pretty deterministic using my app. Link to public reproduction project repositoryN/A Version with bugNightly / CI build (Please specify exact version) Is this a regression from previous behavior?Yes, this used to work in .NET MAUI Last version that worked well8.0.3 Affected platformsAndroid Affected platform versionsNo response Did you find any workaround?Revert from the SR1 release to the 9804 nightly. Relevant log outputNot super helpful, but...
Time Device Name Type PID Tag Message
pixel_7_pro_-_api_33 Error 30391 DEBUG backtrace:
#00 pc 000000000005f6ff /apex/com.android.runtime/lib64/bionic/libc.so (abort+191) (BuildId: 007cb2313464df63debf8020e631c990)
dotnet/maui#1 pc 00000000000277b5 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonodroid.so (xamarin::android::Helpers::abort_application()+5) (BuildId: d72a40c8a47a810bfa98923a8465b70e81cb7e91)
dotnet/maui#2 pc 00000000000472d9 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonodroid.so (xamarin::android::internal::MonodroidRuntime::mono_log_handler(char const*, char const*, char const*, int, void*)+105) (BuildId: d72a40c8a47a810bfa98923a8465b70e81cb7e91)
dotnet/maui#3 pc 000000000021f85a /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#4 pc 000000000021f9e4 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#5 pc 000000000021fa26 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#6 pc 00000000002a9a93 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (mono_runtime_class_init_full+2483) (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#7 pc 0000000000204c57 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#8 pc 00000000001e773c /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#9 pc 00000000001d9575 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#10 pc 00000000001d6ad1 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#11 pc 00000000000e58ef /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#12 pc 00000000002a8f17 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (mono_runtime_invoke_checked+135) (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#13 pc 00000000002b1834 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#14 pc 000000000026d024 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#15 pc 000000000027693a /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#16 pc 00000000001e93c8 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#17 pc 00000000001e7df6 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#18 pc 00000000001d91a4 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#19 pc 00000000001d6ad1 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#20 pc 00000000000e58ef /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#21 pc 00000000002a8f17 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (mono_runtime_invoke_checked+135) (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#22 pc 00000000002b1834 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#23 pc 000000000026d024 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#24 pc 000000000027693a /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#25 pc 00000000001e93c8 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#26 pc 00000000001e7df6 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#27 pc 00000000001d91a4 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#28 pc 00000000001d6ad1 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#29 pc 00000000000e58ef /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#30 pc 00000000002a8f17 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (mono_runtime_invoke_checked+135) (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
#31 pc 00000000002c0753 /data/app/~~bY6BuUiuB-gII_WXkHTF8Q==/com.Backroads.Android-ytDQ8E3yi_nPsFa8vMS1-Q==/lib/x86_64/libmonosgen-2.0.so (BuildId: 15beacb4f7391331d2f844e5b3ac0cac28355d90)
dotnet/maui#32 pc 00000000000ccd2a /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+58) (BuildId: 007cb2313464df63debf8020e631c990)
#33 pc 0000000000060d37 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+55) (BuildId: 007cb2313464df63debf8020e631c990)
|
@thaystg can you take a look when you have a moment? |
Can you please give me access to your repo? |
@thaystg: I've added you to the Sideroads repo. Clone and checkout the |
I'm facing the same problem.
|
I just helped getting @InquisitorJax's environment working again. He had SDK 8.0.101 installed and android 34.0.52 workload. We rolled back the SDK by uninstalling it and having 8.0.100 installed:
Then once this is done we made sure to install workloads from the 8.0.3 manifest:
|
to be clear - it was 34.0.52 that was the main cause - the 8.0.101 install was a failed attempt at fixing the issue. But to get rollback to 34.0.43 to work, it required uninstalling 8.0.101 |
To confirm - I also had 34.0.52 of microsoft.net.sdk.android. |
@mattleibow: I should add one thing to what I mentioned earlier, which is that I don't think this is only an issue with debug builds in the debugger. I'm seeing the same issue in release builds on physical devices as well - no debugger attached. Debug builds do appear to work. |
Thanks, @lambdageek. Two questions:
|
* mono_runtime_class_init_full: handle spurious wakeups the condition variable may be signaled even if the initialization by the other thread is not done yet. Handle spurious wakeups the same way as timeouts: go around once more from the beginning. Fixes #96872 and #96804 * fix unbalanced handle frames if we goto retry_top, don't set up a new handle frame that lacks a matching HANDLE_FUNCTION_RETURN_VAL. Instead setup the handle frame once upfront
#96905) * mono_runtime_class_init_full: handle spurious wakeups the condition variable may be signaled even if the initialization by the other thread is not done yet. Handle spurious wakeups the same way as timeouts: go around once more from the beginning. Fixes #96872 and #96804 * fix unbalanced handle frames if we goto retry_top, don't set up a new handle frame that lacks a matching HANDLE_FUNCTION_RETURN_VAL. Instead setup the handle frame once upfront --------- Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
The fix will be part of the next servicing release of .NET 8. The servicing releases are usually monthly, so the next one will be in February. Usually Visual Studio updates also include .NET SDK updates.
I'm not sure. Maybe @mattleibow has some ideas? the underlying issue happens when two or more threads attempt to run the static constructors for the same class. it may be possible to mitigate or work around the issue by limiting or delaying parallel execution. Turning on debug logging with |
@lambdageek: thanks! I tracked down my particular race condition and have worked around the issue for now. |
We were also able to reproduce this error with Android SDK 31, 33 and 34. |
Thanks. Yea, I would expect the issue is not dependent on the version of the Android SDK. The regression is in the .NET runtime that is used when .NET programs are deployed on android devices. It depends on the version of the .NET SDK, not the Android SDK |
For anyone experiencing this issue, there are two options to unblock yourselves while we wait for the February .NET 8 servicing release:
Once the 8.0.200 SDK (8.0.2 runtime) is out, the workaround can be removed. |
* mono_runtime_class_init_full: handle spurious wakeups the condition variable may be signaled even if the initialization by the other thread is not done yet. Handle spurious wakeups the same way as timeouts: go around once more from the beginning. Fixes dotnet#96872 and dotnet#96804 * fix unbalanced handle frames if we goto retry_top, don't set up a new handle frame that lacks a matching HANDLE_FUNCTION_RETURN_VAL. Instead setup the handle frame once upfront
@lambdageek Visual Studio 17.9 preview ships If so - then the fix does not cover my case of I have a .NET MAUI app where I have the following code in my custom FormField control - I started getting this bug when I added that propertyChanged handler. Click to expand the code.public static readonly BindableProperty IsValidProperty = BindableProperty.Create(
propertyName: nameof(IsValid),
returnType: typeof(bool),
declaringType: typeof(FormField),
defaultValue: true,
propertyChanged: OnIsValidChanged);
public bool IsValid
{
get => (bool)this.GetValue(IsValidProperty);
set => this.SetValue(IsValidProperty, value);
}
private static void OnIsValidChanged(BindableObject bindable, object oldValue, object newValue)
{
if (bindable is not FormField formField)
{
return;
}
var newStateIsValid = newValue.Equals(true);
TrySetIsValidState(formField, newStateIsValid);
}
private static void TrySetIsValidState(FormField formField, bool newStateIsValid)
{
ArgumentNullException.ThrowIfNull(formField);
if (formField.GetTemplateChild("rootLayout") is VerticalStackLayout rootLayout)
{
VisualStateManager.GoToState(rootLayout, newStateIsValid ? "Valid" : "Invalid");
}
} |
@hansmbakker that's the version of the .NET SDK (and it's a preview version - the released version number will be something like What we want is the 8.0.2 version of the android runtime pack Directory: C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Runtime.Mono.android-arm64
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 1/19/2024 12:06 PM 7.0.15
d---- 1/19/2024 12:06 PM 8.0.1 |
Aah, then I misunderstood - I thought it might be bundled somehow. Thank you for clarifying! |
So when will this be available for MAUI? |
dotnet sdk 8.0.200 is available now, including the 8.0.2 runtime pack. |
Description
After picking up the latest VS update with what I believe is MAUI 8.0.6 SR1, I started seeing the following crash in my app on startup:
After some binary searching, I tracked it down to a regression in the 8.0.6-nightly.9806 build. 8.0.6-nightly.9804 works fine.
Steps to Reproduce
Unclear. Possibly do some networking on startup? It's pretty deterministic using my app.
Link to public reproduction project repository
N/A
Version with bug
Nightly / CI build (Please specify exact version)
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.3
Affected platforms
Android
Affected platform versions
No response
Did you find any workaround?
Revert from the SR1 release to the 9804 nightly.
Relevant log output
The text was updated successfully, but these errors were encountered: