-
Notifications
You must be signed in to change notification settings - Fork 533
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
Revert "[One .NET] $(AndroidEnablePreloadAssemblies)=False by default" #5811
Revert "[One .NET] $(AndroidEnablePreloadAssemblies)=False by default" #5811
Conversation
9b76adf
to
bebd441
Compare
https://discord.com/channels/732297728826277939/732297837953679412/827199058279923712
|
bebd441
to
1b3f797
Compare
@jonpryor yes, I think the actual problem here was quite different. I updated the PR description. |
1b3f797
to
597916c
Compare
@grendello: don't be too quick to mark this as "good". Between this PR, d13d0f9, and decfbcc, I think this bears additional thought. For starters, in decfbcc, why does
Thus, I think the actual fix should instead be: diff --git a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets
index 7eee40439..f47d8e9d9 100644
--- a/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets
+++ b/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets
@@ -137,7 +137,7 @@ Copyright (C) 2016 Xamarin. All rights reserved.
IsBundledApplication="$(BundleAssemblies)"
SupportedAbis="$(_BuildTargetAbis)"
AndroidPackageName="$(_AndroidPackage)"
- EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)"
+ EnablePreloadAssembliesDefault="$(AndroidEnablePreloadAssemblies)"
InstantRunEnabled="$(_InstantRunEnabled)">
<Output TaskParameter="BuildId" PropertyName="_XamarinBuildId" />
</GeneratePackageManagerJava>
diff --git a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
index a9fcc31f1..6ed26ed22 100644
--- a/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
+++ b/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets
@@ -1562,7 +1562,7 @@ because xbuild doesn't support framework reference assemblies.
IsBundledApplication="$(BundleAssemblies)"
SupportedAbis="@(_BuildTargetAbis)"
AndroidPackageName="$(_AndroidPackage)"
- EnablePreloadAssembliesDefault="$(_AndroidEnablePreloadAssembliesDefault)"
+ EnablePreloadAssembliesDefault="$(AndroidEnablePreloadAssemblies)"
PackageNamingPolicy="$(AndroidPackageNamingPolicy)"
BoundExceptionType="$(AndroidBoundExceptionType)"
InstantRunEnabled="$(_InstantRunEnabled)" @grendello: does ^^ seem better/more consistent? |
It seems like this is the target that actually turns the setting on or off:
Is that correct @grendello? |
Yes, that is correct. We need to know both the default and the actual setting. That's why we pass |
On a related point, I think there's a bug here: https://github.com/xamarin/xamarin-android/blob/b595e11bf4d4dff99ca09866a79f609645d889b9/src/Xamarin.Android.Build.Tasks/Tasks/GeneratePackageManagerJava.cs#L209-L210 shouldn't line 210 use Thus, as-is, ¯_(ツ)_/¯ |
I'm not sure I understand this? As-is, this implies that we have "two sources of knowledge":
This doesn't make sense to me, particularly given that the As far as I know/can easily find, |
In a pre-d13d0f972a4eb663251b2a6b5a934c59a6789db1 world, how it looks like it worked was:
From a documented customer perspective, it worked. (Yay.) "However", if you knew the internals, the other issue arises: What should happen if you add an
The result is that However, this is internal; we never documented |
In a post- d13d0f9 world, with .NET 6:
|
I still don't understand how
|
After fixing So when |
Either way, we can fix this after my vacation next week -- d13d0f9 isn't on our .NET 6 Preview 3 release branch. |
Shouldn't 9e6ce03 fix that, and likewise avoid the call to If so, should we consider some form of 9e6ce03 on every build? |
597916c
to
5675a08
Compare
This reverts commit d13d0f9. I also updated a test that was triggering an issue with `$(AndroidEnablePreloadAssemblies)`. It was originally crashing with: Java.Lang.RuntimeException: Unable to start activity ComponentInfo{com.xamarin.classlibrarymainlauncherruns/com.xamarin.classlibrarymainlauncherruns.MainActivity}: android.view.InflateException: Binary XML file line #1 in com.xamarin.classlibrarymainlauncherruns:layout/foo: Binary XML file line #1: You must supply a layout_width attribute. ---> Android.Views.InflateException: Binary XML file line #1 in com.xamarin.classlibrarymainlauncherruns:layout/foo: Binary XML file line #1: You must supply a layout_width attribute. ---> Java.Lang.UnsupportedOperationException: Binary XML file line #1: You must supply a layout_width attribute. --- End of managed Java.Lang.UnsupportedOperationException stack trace --- java.lang.UnsupportedOperationException: Binary XML file line #1: You must supply a layout_width attribute. I fixed the invalid XML in `foo.xml`, so the test will get a *better* crash going forward: Process: com.xamarin.classlibrarymainlauncherruns, PID: 2993 android.runtime.JavaProxyThrowable: System.NullReferenceException: Object reference not set to an instance of an object at MyLibrary.MainActivity.OnCreate(Bundle bundle) at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_(IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) at com.xamarin.classlibrarymainlauncherruns.MainActivity.n_onCreate(Native Method) at com.xamarin.classlibrarymainlauncherruns.MainActivity.onCreate(MainActivity.java:29) at android.app.Activity.performCreate(Activity.java:8000) at android.app.Activity.performCreate(Activity.java:7984) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) This way we won't be chasing invalid XML going forward.
5675a08
to
157cd57
Compare
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This reverts commit d13d0f9.
I also updated a test that was triggering an issue with
$(AndroidEnablePreloadAssemblies)
. It was originally crashing with:I fixed the invalid XML in
foo.xml
, so the test will get a bettercrash going forward:
This way we won't be chasing invalid XML going forward.