-
Notifications
You must be signed in to change notification settings - Fork 531
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
[Microsoft.Android.Sdk.ILLink] fix crash when TZ changes #7956
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ok new test failed as expected:
Let me change it so it isn't an NRE, and then put the fix in. |
jonathanpeppers
force-pushed
the
timezone-crash
branch
from
April 13, 2023 03:08
919fcd2
to
60cad79
Compare
Fixes: dotnet#7953 When a timezone changes in a `Release` app, it can crash with: [monodroid] Unable to find Android.Runtime.AndroidEnvironment.NotifyTimeZoneChanged()! In 11f0e1b, we removed the line: <?xml version="1.0" encoding="utf-8" ?> <linker> <assembly fullname="Mono.Android"> -- <type fullname="Android.Runtime.AndroidEnvironment" /> Unfortunately, this method is called from native code, so we need to *always* preserve it. Added a test for this scenario, we may want to audit all `mono_class_get_method_from_name` calls and add more tests cases. I also cleaned up the tests a bit with a `getResource()` local function.
jonathanpeppers
force-pushed
the
timezone-crash
branch
from
April 13, 2023 13:51
60cad79
to
f1bbe36
Compare
dellis1972
approved these changes
Apr 13, 2023
Looks like the new test is green now, the only test failure is odd, but probably unrelated:
|
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Apr 14, 2023
* main: Bump to xamarin/Java.Interop/main@554d819 (dotnet#7951) [Microsoft.Android.Sdk.ILLink] fix crash when TZ changes (dotnet#7956) [tests] Port 'Xamarin.Android.JcwGen-Tests.JcwGen-Tests' to .NET (dotnet#7949) [Xamarin.Android.Build.Tasks] remove `pdb2mdb` (dotnet#7950) [ci] Add some extra params to configure the test templates (dotnet#7955) Convert `/tools` and `/build-tools` projects from `net472` to `$(DotNetStableTargetFramework)` (dotnet#7943) [Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (dotnet#7947) Bump com.android.tools:r8 from 4.0.52 to 8.0.40 (dotnet#7934) Bump to xamarin/Java.Interop/main@a172402 (dotnet#7944) [Xamarin.Android] Remove OpenTK, sqlite-xamarin, System.EnterpriseServices. (dotnet#7940) [ci] Stop building classic test suites. (dotnet#7938) Bumping to the correct monodroid commit Trying to bump monodroid to run debugger-tests Pass timeout to runtime
grendello
added a commit
to grendello/xamarin-android
that referenced
this pull request
Apr 17, 2023
* main: Bump to xamarin/Java.Interop/main@554d819 (dotnet#7951) [Microsoft.Android.Sdk.ILLink] fix crash when TZ changes (dotnet#7956) [tests] Port 'Xamarin.Android.JcwGen-Tests.JcwGen-Tests' to .NET (dotnet#7949) [Xamarin.Android.Build.Tasks] remove `pdb2mdb` (dotnet#7950) [ci] Add some extra params to configure the test templates (dotnet#7955)
jonathanpeppers
added a commit
that referenced
this pull request
Apr 25, 2023
Fixes: #7953 Context: 11f0e1b When a timezone changes in a `Release` config app, it can crash with: [monodroid] Unable to find Android.Runtime.AndroidEnvironment.NotifyTimeZoneChanged()! In commit 11f0e1b, we removed the line: <?xml version="1.0" encoding="utf-8" ?> <linker> <assembly fullname="Mono.Android"> -- <type fullname="Android.Runtime.AndroidEnvironment" /> Unfortunately, `AndroidEnvironment.NotifyTimeZoneChanged()` is called from non-managed code, via: * The `NotifyTimeZoneChanges` broadcast receiver (in `src/java-runtime/java/mono/android/app/NotifyTimeZoneChanges.java`) which calls- * The `Rutime.notifyTimeZoneChanged()` `native` method (in `src/java-runtime/java/mono/android/Runtime.java`), implemented in- * `Java_mono_android_Runtime_notifyTimeZoneChanged()` (in`src/monodroid/jni/timezones.cc`). The managed linker cannot "see" any of these references, so we need to *always* preserve this method, as it is always callable. Update `src/Microsoft.Android.Sdk.ILLink/PreserveLists/Mono.Android.xml` so that `Android.Runtime.AndroidEnvironment.NotifyTimeZoneChanged()` is always preserved. Added a test for this scenario. TODO: we may want to audit all `mono_class_get_method_from_name()` calls and add more tests cases. I also cleaned up the tests a bit with a `getResource()` local function.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #7953
When a timezone changes in a
Release
app, it can crash with:In 11f0e1b, we removed the line:
Unfortunately, this method is called from native code, so we need to always preserve it.
Added a test for this scenario, we may want to audit all
mono_class_get_method_from_name
calls and add more tests cases.I also cleaned up the tests a bit with a
getResource()
local function.