-
Notifications
You must be signed in to change notification settings - Fork 564
Comparing changes
Open a pull request
base repository: dotnet/android
base: d6224ca
head repository: dotnet/android
compare: af4a25d
- 11 commits
- 11 files changed
- 3 contributors
Commits on Sep 7, 2022
-
Bump to dotnet/installer@30a267b 6.0.401-servicing.22451.18 (#7330)
Changes: dotnet/installer@b989289...30a267b Updates: Microsoft.Dotnet.Sdk.Internal: from 6.0.401-servicing.22419.11 to 6.0.401-servicing.22451.18
Configuration menu - View commit details
-
Copy full SHA for 09d789e - Browse repository at this point
Copy the full SHA 09d789eView commit details -
Don't use Dictionary<K,V> to avoid duplicate value exception (#7345)
Fixes: #7302 Context: 7117414 When building .NET6 app on .NET7, sometimes the build fails with: C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\32.0.451\tools\Xamarin.Android.Common.targets(1438,3): error XAGJS7004: System.ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Xamarin.Android.Tasks.TypeMapGenerator.GenerateRelease(Boolean skipJniAddNativeMethodRegistrationAttributeScan, List`1 javaTypes, String outputDirectory, ApplicationConfigTaskState appConfState) at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings(List`1 types, TypeDefinitionCache cache) at Xamarin.Android.Tasks.GenerateJavaStubs.Run(DirectoryAssemblyResolver res) at Xamarin.Android.Tasks.GenerateJavaStubs.RunTask() at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 17 Avoid that by switching the data structure to `List<T>`, since we no longer use the Dictionary key for anything. Co-authored-by: Marek Habersack <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for a220db5 - Browse repository at this point
Copy the full SHA a220db5View commit details -
Bump to dotnet/installer@87b6130 6.0.402-servicing.22457.1 (#7354)
Changes: dotnet/installer@30a267b...87b6130 Updates: Microsoft.Dotnet.Sdk.Internal: from 6.0.401-servicing.22451.18 to 6.0.402-servicing.22457.1
Configuration menu - View commit details
-
Copy full SHA for 04623cd - Browse repository at this point
Copy the full SHA 04623cdView commit details
Commits on Sep 9, 2022
-
[illink] set
$(TrimmerRemoveSymbols)by default (#7365)Fixes: #7302 Context: dotnet/linker#2203 Context: dotnet/runtime#67660 Context: #6598 This partially backports 745214d. Building a `net6.0-android` app in `Release` mode with .NET 7 can fail with many errors like: error XA4215: The Java type `androidx.activity.contextaware.OnContextAvailableListener` is generated by more than one managed type. Please change the [Register] attribute so that the same Java type is not emitted. This happens because we end up with multiple assemblies, such as: obj/Release/net6.0-android/android-arm/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-arm64/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-x64/linked/Xamarin.AndroidX.Activity.dll obj/Release/net6.0-android/android-x86/linked/Xamarin.AndroidX.Activity.dll To fix this, in addition to this backport to dotnet/runtime/release/6.0: dotnet/runtime#75311 In .NET 7 we opt into `$(TrimmerRemoveSymbols)` by default for `Release` builds. This allows the .NET 7 linker to have stable MVIDs for assemblies for each architecture. Somehow when the linker outputs `.pdb` files, it creates different MVIDs per architecture. There may potentially be a dotnet/linker issue here to look into further. However, this seems to be the best fix for getting .NET 6 projects building under .NET 7 at the moment.
Configuration menu - View commit details
-
Copy full SHA for 0bd871e - Browse repository at this point
Copy the full SHA 0bd871eView commit details
Commits on Sep 14, 2022
-
Bump to dotnet/runtime@2789259 6.0.10 (#7355)
Changes: dotnet/runtime@531f715...2789259 Updates: Microsoft.NETCore.App.Ref: from 6.0.9 to 6.0.10
Configuration menu - View commit details
-
Copy full SHA for d468eaf - Browse repository at this point
Copy the full SHA d468eafView commit details -
[tests] update times in MSBuildDeviceIntegration.csv (#7347)
Frequently these three performance tests fail with times such as: * Build_CSharp_Change Exceeded expected time of 3850ms, actual 3912.98ms * Build_AndroidManifest_Change Exceeded expected time of 4250ms, actual 4873.595ms * Install_CSharp_Change Exceeded expected time of 4500ms, actual 4693.08ms Let's increase these times to make our CI runs less noisy. At some point, we could also do some build performance work to get these times lower. Right now these time differences are pretty small, and I believe due to environmental changes in the CI machines, etc.Configuration menu - View commit details
-
Copy full SHA for e25d85d - Browse repository at this point
Copy the full SHA e25d85dView commit details
Commits on Sep 15, 2022
-
Bump to dotnet/runtime@8c6bcad 6.0.10 (#7378)
Changes: dotnet/runtime@2789259...8c6bcad Updates: Microsoft.NETCore.App.Ref: from 6.0.10 to 6.0.10
Configuration menu - View commit details
-
Copy full SHA for 3123bac - Browse repository at this point
Copy the full SHA 3123bacView commit details -
Bump to dotnet/installer@1c38151 6.0.402-servicing.22465.1 (#7371)
Changes: dotnet/installer@87b6130...1c38151 Updates: Microsoft.Dotnet.Sdk.Internal: from 6.0.402-servicing.22457.1 to 6.0.402-servicing.22465.1 Co-authored-by: Jonathan Peppers <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 3cd9a10 - Browse repository at this point
Copy the full SHA 3cd9a10View commit details
Commits on Sep 16, 2022
-
Bump to dotnet/runtime@e02e231 6.0.10 (#7386)
Changes: dotnet/runtime@8c6bcad...e02e231 Updates: Microsoft.NETCore.App.Ref: from 6.0.10 to 6.0.10
Configuration menu - View commit details
-
Copy full SHA for 059f53a - Browse repository at this point
Copy the full SHA 059f53aView commit details
Commits on Sep 19, 2022
-
Bump to dotnet/runtime@cdf48ab 6.0.10 (#7394)
Changes: dotnet/runtime@e02e231...cdf48ab Changes: dotnet/emsdk@3f6c45a...c3fc739 Updates: * Microsoft.NETCore.App.Ref: from 6.0.10 to 6.0.10 * Microsoft.NET.Workload.Emscripten.Manifest-6.0.300: from 6.0.9 to 6.0.10
Configuration menu - View commit details
-
Copy full SHA for 9bf238f - Browse repository at this point
Copy the full SHA 9bf238fView commit details
Commits on Sep 27, 2022
-
[linker] preserve Java interfaces on non-bound Java types (#7204)
Fixes: #7097 Context: xamarin/monodroid@a619cbe Context: http://github.com/xamarin/Java.Interop/commit/4787e0179b349ab5ee0d0dd03d08b694acea4971 Usage of a [`Google.Android.Material.TextField.TextInputEditText`][0]: var filterBox = FindViewById<TextInputEditText>(Resource.Id.filterBox); filterBox.TextChanged += (s, e) => { }; may crash at runtime with: android.runtime.JavaProxyThrowable: System.TypeLoadException: Could not load type '{0}' from assembly '{1}'., Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null at System.RuntimeTypeHandle.GetTypeByName(String , Boolean , Boolean , StackCrawlMark& , Boolean ) at System.RuntimeType.GetType(String , Boolean , Boolean , StackCrawlMark& ) at System.Type.GetType(String , Boolean ) at Android.Runtime.AndroidTypeManager.RegisterNativeMembers(JniType , Type , ReadOnlySpan`1 ) --- End of stack trace from previous location --- at Java.Interop.JniEnvironment.StaticMethods.CallStaticObjectMethod(JniObjectReference , JniMethodInfo , JniArgumentValue* ) at Android.Runtime.JNIEnv.FindClass(String ) at Android.Runtime.JNIEnv.AllocObject(String ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue* ) at Android.Runtime.JNIEnv.StartCreateInstance(String , String , JValue[] ) at Android.Text.TextWatcherImplementor..ctor(Object , EventHandler`1 , EventHandler`1 , EventHandler`1 ) at Android.Widget.TextView.add_TextChanged(EventHandler`1 ) at AndroidApp1.MainActivity.OnCreate(Bundle savedInstanceState) at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_(IntPtr , IntPtr , IntPtr ) at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PPL_V(_JniMarshal_PPL_V , IntPtr , IntPtr , IntPtr ) at crc64a6e0c00971f6cd91.MainActivity.n_onCreate(Native Method) at crc64a6e0c00971f6cd91.MainActivity.onCreate(MainActivity.java:29) The problem is that the .NET 6 linker *completely* removed the `Android.Text.ITextWatcher` interface, which involved updating the post-linked `Android.Text.TextWatcherImplementor` type to no longer implement the `ITextWatcher` interface. [`Android.Text.TextWatcherImplementor`][1] in turn is a hand-written type within `Mono.Android.dll` which we expected (required!) to always implement the `ITextWatcher` interface, so that we could pass instances of it to Java code. The *cause* of the `TypeLoadException` is through the confluence of multiple factors: 1. Java Callable Wrappers for `Mono.Android.dll` are generated at *xamarin-android* build time, *not* App build time. This was originally done to reduce App build times, but also means that the Java Callable Wrapper for `TextWatcherImplementor` mentions the `ITextWatcherInvoker` type, which is only preserved if the `ITextWatcher` interface is preserved. /* partial */ class TextWatcherImplementor { static { __md_methods = "n_afterTextChanged:(Landroid/text/Editable;)V:GetAfterTextChanged_Landroid_text_Editable_Handler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_beforeTextChanged:(Ljava/lang/CharSequence;III)V:GetBeforeTextChanged_Ljava_lang_CharSequence_IIIHandler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + "n_onTextChanged:(Ljava/lang/CharSequence;III)V:GetOnTextChanged_Ljava_lang_CharSequence_IIIHandler:Android.Text.ITextWatcherInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null\n" + ""; mono.android.Runtime.register ("Android.Text.TextWatcherImplementor, Mono.Android", TextWatcherImplementor.class, __md_methods); } } 2. The .NET linker determines that the `ITextWatcher` interface is not actually used, and removes it from `Mono.Android.dll`. Without `ITextWatcher`, the `ITextWatcherInvoker` type is also removed from `Mono.Android.dll`. 3. At runtime when subscribing to the `TextView.TextChanged` event, an instance of `TextWatcherImplementor` is created. This in turn cases the Java peer `TextWatcherImplementor` type to be created, triggering the [Java Type Registration process][2], which includes the `Runtime.register()` invocation mentioning a method which involves the `ITextWatcherInvoker` type, e.g. "n_afterTextChanged:(Landroid/text/Editable;)V:GetAfterTextChanged_Landroid_text_Editable_Handler:Android.Text.ITextWatcherInvoker, Mono.Android\n" 4. `AndroidTypeManager.RegisterNativeMembers()` eventually attempts `Type.GetType("Android.Text.ITextWatcherInvoker, Mono.Android")`. This throws the `TypeLoadException`, as that type doesn't exist. Commits 4d8c28f and d762aa9 fixed a very similar scenario in Classic Xamarin.Android. The difference now is that the .NET 6+ linker is getting *so* good that more types are now eligible for removal by the linker. Oversimplifying, the "real" cause of the crash is that when: 1. We have a "non-bound" type which implements a Java interface, such as `TextWatcherImplementor`, *and* 2. The linker decides that no IL-visible code uses that Java interface, and decides to remove that interface then we're going to be in a world of hurt. The fix is to update `MonoDroid.Tuner.MarkJavaObject` so that if we're preserving a type, we also explicitly preserve all Java interfaces implemented by the type as well, *if the type is not bound*. This allows a linked `TextWatcherImplementor` to continue to implement `ITextWatcher`, which in turn causes `ITextWatcherInvoker` to be preserved, which prevents the `TypeLoadException` from occurring. We determine that a type is "bound" by looking for: * `[Android.Runtime.RegisterAttribute (…, DoNotGenerateAcw=true)]`, or * `[Java.Interop.JniTypeSignatureAttribute (…, GenerateJavaPeer=false)]` A `Java.Lang.Object` subclass which *isn't* "bound" is considered to be "non-bound"). We don't want to preserve all Java interfaces for all types, including bound types, because that isn't necessary and causes app sizes to balloon. [0]: https://developer.android.com/reference/com/google/android/material/textfield/TextInputEditText [1]: https://github.com/xamarin/xamarin-android/blob/619420ae1d77d0ff3ec1b59afd156bfdd63c5c26/src/Mono.Android/Android.Text/ITextWatcher.cs#L52-L93 [2]: https://github.com/xamarin/xamarin-android/wiki/Blueprint#java-type-registration
Configuration menu - View commit details
-
Copy full SHA for af4a25d - Browse repository at this point
Copy the full SHA af4a25dView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff d6224ca...af4a25d