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

AOT mode Hybrid does not CIL strip the assemblies that end up in the APK #4818

Closed
EDMIStephen opened this issue Jun 15, 2020 · 9 comments · Fixed by #4850
Closed

AOT mode Hybrid does not CIL strip the assemblies that end up in the APK #4818

EDMIStephen opened this issue Jun 15, 2020 · 9 comments · Fixed by #4850
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@EDMIStephen
Copy link

EDMIStephen commented Jun 15, 2020

Steps to Reproduce

  1. Attempt to build/deploy Android app with the following csproj
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'InternalRelease|AnyCPU'">
    <DebugSymbols>false</DebugSymbols> 
    <DebugType>none</DebugType> 
    <Optimize>true</Optimize> 
    <AssemblyName>Projectname.Mobile.Droid.Internal</AssemblyName>
    <OutputPath>bin\InternalRelease\</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
    <EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
    <Debugger>Xamarin</Debugger>
    <RunCodeAnalysis>false</RunCodeAnalysis>
    <AndroidSupportedAbis>armeabi-v7a</AndroidSupportedAbis>
    <AndroidEnableMultiDex>true</AndroidEnableMultiDex>
    <AotAssemblies>true</AotAssemblies>
    <EnableLLVM>true</EnableLLVM>
    <AndroidAotMode>Hybrid</AndroidAotMode>
    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    <AndroidAotAdditionalArguments>no-write-symbols,nodebug</AndroidAotAdditionalArguments> 
    <AndroidDexTool>d8</AndroidDexTool>
    <AndroidLinkTool>r8</AndroidLinkTool>
    <AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
    <AndroidLinkMode>SdkOnly</AndroidLinkMode>
  </PropertyGroup>

Expected Behavior

.dll in the assemblies dir of the apk are stripped. App runs correctly.

Xamarin.Android.common.targets has a block that should do this when AOT and Hybrid is enabled.

   <CilStrip
	Condition=" '$(AndroidAotMode)' == 'Hybrid' And '$(AotAssemblies)' == 'True' "
	AndroidAotMode="$(AndroidAotMode)"
	ToolPath="$(_MonoAndroidToolsDirectory)"
	ApkOutputPath="$(_BuildApkEmbedOutputs)"
	ResolvedAssemblies="@(_ResolvedAssemblies)">
  </CilStrip> 

Actual Behavior

.dll in the assemblies dir of the apk are completely intact. App crashes

obj\InternalRelease\100\android\assets\shrunk has the method bodies stripped out but these don't make it into the final apk.
image

Partial work around

I changed Xamarin.Android.common.targets to use ResolvedAssemblies="@(_ShrunkAssemblies)".

   <CilStrip
	Condition=" '$(AndroidAotMode)' == 'Hybrid' And '$(AotAssemblies)' == 'True' "
	AndroidAotMode="$(AndroidAotMode)"
	ToolPath="$(_MonoAndroidToolsDirectory)"
	ApkOutputPath="$(_BuildApkEmbedOutputs)"
	ResolvedAssemblies="@(_ShrunkAssemblies)">
  </CilStrip> 

The stripped assemblies now end up in the apk but when I connect the debugger the app is crashing on launch due to:

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)

Version Information

Microsoft Visual Studio Enterprise 2019 (2)
Version 16.6.1
VisualStudio.16.Release/16.6.1+30128.74
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Enterprise

Azure App Service Tools v3.0.0 16.6.936.3669
Azure App Service Tools v3.0.0

C# Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

JetBrains ReSharper Ultimate 2020.1.3 Build 201.0.20200515.122017
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2020 JetBrains, Inc.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Mono Debugging for Visual Studio 16.6.17 (9692114)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Visual Basic Tools 3.6.0-4.20251.5+910223b64f108fcf039012e0849befb46ace6e66
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.9.1.0 for F# 4.7 16.6.0-beta.20217.4+1c969cac25e2d38d71872efe6c8226029e42bb59
Microsoft Visual F# Tools 10.9.1.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VisualStudio.DeviceLog 1.0
Information about my package

VisualStudio.Foo 1.0
Information about my package

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.6.000.1061 (d16-6@8e68aa8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.6.0.318 (remotes/origin/d16-6@66afc5421)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.6.40 (1f1466f)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.3.1.4 (d16-6/3a10de9)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: 165f4b0
Java.Interop: xamarin/java.interop/d16-6@2cab35c
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@49232bc
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-6@bfb66f3

Xamarin.iOS and Xamarin.Mac SDK 13.18.2.1 (29c4ea7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Log File

BuildLogTargetsWorkAround.zip
BuildlogOriginalTargets.zip

@EDMIStephen EDMIStephen added the Area: App+Library Build Issues when building Library projects or Application projects. label Jun 15, 2020
@EDMIStephen
Copy link
Author

EDMIStephen commented Jun 15, 2020

obj\InternalRelease\100\android\assets\shrunk
and
obj\InternalRelease\100\android\assets\non-stripped
both have unstripped assemblies. I would have expected the \shrunk dir to have them stripped.

obj\InternalRelease\100\android\assets has the stripped versions.

@EDMIStephen
Copy link
Author

Same issue with Enterprise 16.7.0 Preview 2.0. The shrunk assemblies do not make it into the apk. If we manually unpack the app and put the stripped versions back in we get

E/AndroidRuntime(18806): java.lang.UnsatisfiedLinkError: No implementation found for void mono.android.TypeManager.n_activate

@EDMIStephen
Copy link
Author

EDMIStephen commented Jun 17, 2020

Looks like others are having this issue too. https://forums.xamarin.com/discussion/182826/hybrid-aot
I urgently need a work around. Is there anything I can do to help try solve this. We have devs available. We just need to be given direction.

@EDMIStephen
Copy link
Author

EDMIStephen commented Jun 18, 2020

Visual Studio 16.3.10 and MSBuild 16.3.2+e481bbf88 builds an APK with the correctly shrunk .dll.
So somewhere between Nov 2019 and now Hybrid AOT has been broken.

Microsoft Visual Studio Enterprise 2019 (3)
Version 16.3.10
VisualStudio.16.Release/16.3.10+29519.87
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Enterprise

Azure App Service Tools v3.0.0 16.3.286.43615
Azure App Service Tools v3.0.0

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.3.0.281 (d16-3@859f726)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.256 (remotes/origin/d16-3@8a223bfd7)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.6.2 (d16-3/c407838)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@476d72b9e32
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3fd
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.6.0.12 (e3c2b40)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@EDMIStephen
Copy link
Author

EDMIStephen commented Jun 18, 2020

Maybe this is the culprit???
#3950

jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Jun 22, 2020
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.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this issue Jun 22, 2020
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.
@jonathanpeppers jonathanpeppers self-assigned this Jun 22, 2020
jonpryor pushed a commit that referenced this issue Jun 23, 2020
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` 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:

	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)
	E/AndroidRuntime(18806): 	at mono.android.TypeManager.n_activate(Native Method)
	E/AndroidRuntime(18806): 	at mono.android.TypeManager.Activate(:7)
	E/AndroidRuntime(18806): 	at crc64446c24ccf511bf5f.SplashScreenActivity.<init>(:25)
	E/AndroidRuntime(18806): 	at java.lang.Class.newInstance(Native Method)
	E/AndroidRuntime(18806): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1086)
	E/AndroidRuntime(18806): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2809)
	E/AndroidRuntime(18806): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
	E/AndroidRuntime(18806): 	at android.app.ActivityThread.-wrap14(ActivityThread.java)
	E/AndroidRuntime(18806): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
	E/AndroidRuntime(18806): 	at android.os.Handler.dispatchMessage(Handler.java:102)
	E/AndroidRuntime(18806): 	at android.os.Looper.loop(Looper.java:154)
	E/AndroidRuntime(18806): 	at android.app.ActivityThread.main(ActivityThread.java:6682)
	E/AndroidRuntime(18806): 	at java.lang.reflect.Method.invoke(Native Method)
	E/AndroidRuntime(18806): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
	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 `BuildTest.BuildIncrementalAot()` test that had a
`//TODO` comment, as it works properly now.  I also added a new test
to check that method bodies are stripped.
@taublast
Copy link

taublast commented Jul 6, 2020

When will this fix go live please?

@jonathanpeppers
Copy link
Member

@taublast Currently, it looks like this will be in a future Visual Studio 2019 16.8 version.

@brendanzagaeski
Copy link
Contributor

Release status update

A new Preview version of Xamarin.Android has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix.

Fix included in Xamarin.Android SDK version 11.0.99.9.

Fix included on Windows in Visual Studio 2019 version 16.8 Preview 1. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview.

Fix included on macOS in Visual Studio 2019 for Mac version 8.8 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.

@brendanzagaeski
Copy link
Contributor

Release status update

A new Release version of Xamarin.Android has now been published that includes the fix for this item.

Fix included in Xamarin.Android SDK version 11.1.0.17.

Fix included on Windows in Visual Studio 2019 version 16.8. To get the new version that includes the fix, check for the latest updates or install the most recent release from https://visualstudio.microsoft.com/downloads/.

Fix included on macOS in Visual Studio 2019 for Mac version 8.8. To get the new version that includes the fix, check for the latest updates on the Stable updater channel.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants