-
Notifications
You must be signed in to change notification settings - Fork 538
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
[Xamarin.Android.Build.Tasks] fix <CilStrip/> for Hybrid AOT #4850
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
Fixes: dotnet#4818 Use of Hybrid AOT currently results in assemblies that have not been CIL-stripped. In 77ab240, a change was made to fix how `Mono.Android.dll` was treated during AOT. `Mono.Android.dll` used to be the only assembly copied to the `shrunk` directory, and we had two copies of the this assembly passed to the AOT compiler. This change unintentionally made `<CilStrip/>` strip the wrong set of assemblies... The initial fix would be: <CilStrip ... - ResolvedAssemblies="@(_ResolvedAssemblies)"> + ResolvedAssemblies="@(_ShrunkAssemblies)"> Unfortunately, this causes a crash: 06-11 16:19:08.557 E/AndroidRuntime(18806): java.lang.UnsatisfiedLinkError: No implementation found for void mono.android.TypeManager.n_activate(java.lang.String, java.lang.String, java.lang.Object, java.lang.Object[]) (tried Java_mono_android_TypeManager_n_1activate and Java_mono_android_TypeManager_n_1activate__Ljava_lang_String_2Ljava_lang_String_2Ljava_lang_Object_2_3Ljava_lang_Object_2) 06-11 16:19:08.557 E/AndroidRuntime(18806): at mono.android.TypeManager.n_activate(Native Method) 06-11 16:19:08.557 E/AndroidRuntime(18806): at mono.android.TypeManager.Activate(:7) 06-11 16:19:08.557 E/AndroidRuntime(18806): at crc64446c24ccf511bf5f.SplashScreenActivity.<init>(:25) 06-11 16:19:08.557 E/AndroidRuntime(18806): at java.lang.Class.newInstance(Native Method) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.Instrumentation.newActivity(Instrumentation.java:1086) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2809) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.ActivityThread.-wrap14(ActivityThread.java) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.os.Handler.dispatchMessage(Handler.java:102) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.os.Looper.loop(Looper.java:154) 06-11 16:19:08.557 E/AndroidRuntime(18806): at android.app.ActivityThread.main(ActivityThread.java:6682) 06-11 16:19:08.557 E/AndroidRuntime(18806): at java.lang.reflect.Method.invoke(Native Method) 06-11 16:19:08.557 E/AndroidRuntime(18806): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 06-11 16:19:08.557 E/AndroidRuntime(18806): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) Thinking about how things "used to work", we weren't stripping the *correct* `Mono.Android.dll`. So we could run `<CilStrip/>` on every assembly *besides* `Mono.Android.dll`? I think this could be improved further if we could strip `Mono.Android.dll`, but this at least gets things back to working the way they used to. I updated the `BuildIncrementalAot` test that had a `//TODO` comment, which works properly now. I also added a new test to check that method bodies are stripped.
radekdoulik
approved these changes
Jun 23, 2020
There is new test failure though:
|
This looks similar to some of the file locking issues we see on the bots, since it passes for me locally, let me do a retry. |
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: #4818
Use of Hybrid AOT currently results in assemblies that have not been
CIL-stripped.
In 77ab240, a change was made to fix how
Mono.Android.dll
wastreated during AOT.
Mono.Android.dll
used to be the only assemblycopied to the
shrunk
directory, and we had two copies of the thisassembly passed to the AOT compiler. This change unintentionally made
<CilStrip/>
strip the wrong set of assemblies...The initial fix would be:
Unfortunately, this causes a crash:
Thinking about how things "used to work", we weren't stripping the
correct
Mono.Android.dll
. So we could run<CilStrip/>
on everyassembly besides
Mono.Android.dll
?I think this could be improved further if we could strip
Mono.Android.dll
, but this at least gets things back to working theway they used to.
I updated the
BuildIncrementalAot
test that had a//TODO
comment,which works properly now. I also added a new test to check that method
bodies are stripped.