Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump to xamarin/xamarin-android-tools/main@fa3711b (#7501)
(It's just NuGet package bumps! How hard could it be? 🙃) Changes: dotnet/android-tools@59cac90...fa3711b * amarin/xamarin-android-tools@fa3711b: [build] Update NuGet package versions (amarin/xamarin-android-tools#196) What *are* the NuGet package version bumps in dotnet/android-tools@fa3711b? > NuGet Package Version Bumps: > > * Microsoft.Build : `16.10.0` -> `17.3.2` > * Microsoft.Build.Framework : `16.10.0` -> `17.3.2` > * Microsoft.Build.Tasks.Core : `16.10.0` -> `17.3.2` > * Microsoft.Build.Utilities.Core : `16.10.0` -> `17.3.2` > * Microsoft.NET.Test.Sdk : `16.5.0` -> `17.5.0-preview-20221003-04` > * nunit : `3.12.0` -> `3.13.2` > * NUnit3TestAdapter : `3.16.1` -> `4.0.0` The `nunit` and `NUnit3TestAdapter` versions differed from what `Xamarin.Android.Tools.Aidl-Tests.csproj` was using, which resulted in some tests failing with: NUnit.Engine.NUnitEngineException : An exception occurred in the driver while loading tests. ----> System.IO.FileLoadException : Could not load file or assembly 'nunit.framework, Version=3.13.2.0, Culture=neutral, PublicKeyToken=2638cd05610744eb' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) --NUnitEngineException An exception occurred in the driver while loading tests. Fix by harmonizing `nunit` and `NUnit3TestAdapter` package versions. Then came a fair bit of time trying to get the `SixColors.ImageSharp` NuGet package working with the updated packages, in particular the new `Microsoft.Build*` packages: System.TypeInitializationException : The type initializer for 'Xamarin.ProjectTools.XamarinAndroidCommonProject' threw an exception. ----> System.TypeInitializationException : The type initializer for 'SixLabors.ImageSharp.Configuration' threw an exception. ----> System.IO.FileLoadException : Could not load file or assembly 'System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Xamarin.ProjectTools.XamarinAndroidCommonProject..ctor(String debugConfigurationName, String releaseConfigurationName) at Xamarin.ProjectTools.XamarinAndroidApplicationProject..ctor(String debugConfigurationName, String releaseConfigurationName, String packageName) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Android\XamarinAndroidApplicationProject.cs:line 41 at Xamarin.Android.Build.Tests.PackagingTest.CheckSignApk(Boolean useApkSigner, Boolean perAbiApk) in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.Android.Build.Tests\PackagingTest.cs:line 381 --TypeInitializationException at SixLabors.ImageSharp.Image.Load(Stream stream, IImageFormat& format) at Xamarin.ProjectTools.XamarinAndroidCommonProject..cctor() in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Android\XamarinAndroidCommonProject.cs:line 40 --FileLoadException at SixLabors.ImageSharp.Configuration..ctor(IConfigurationModule[] configurationModules) at SixLabors.ImageSharp.Configuration.CreateDefaultInstance() at System.Lazy`1.CreateValue() at System.Lazy`1.LazyInitValue() at SixLabors.ImageSharp.Configuration..cctor() I could not figure out a way to make `SixColors.ImageSharp` work with the other newer NuGet package versions. *Remove* use of `SixColors.ImageSharp`, and instead have `Xamarin.ProjectTools.dll` reference the various `.png` resources contained in the `dotnet new android` template, in `src\Microsoft.Android.Templates\android\Resources\**\appicon.png`. In order to ensure sane `%(LogicalName)` values, `%(RecursiveDir)` is used as part of the logical name, resulting in resource names on macOS such as: * `mipmap-hdpi/appicon.png` * `mipmap-mdpi/appicon.png` * `mipmap-xhdpi/appicon.png` * `mipmap-xxhdpi/appicon.png` * `mipmap-xxxhdpi/appicon.png` Xamarin.ProjectTools.dll *also* looks for a resource name with `/` replaced by `\` (`Path.DirectorySeparatorChar`) so that this logic works on Windows as well. Using the same icons as the `dotnet new android` template sounded like a good idea, except those resources caused XA0102 warnings when validating with lint (?!): dotnet new android -n lint-check cd lint-check dotnet build -p:AndroidLintEnabled=True \ "-p:AndroidLintDisabledIssues=StaticFieldLeak%2cObsoleteSdkInt%2cAllowBackup%2cExportedReceiver%2cRedundantLabel" results in: warning XA0102: Launcher icons should not fill every pixel of their square region; see the design guide for details [IconLauncherShape] warning XA0102: Launcher icons should not fill every pixel of their square region; see the design guide for details [IconLauncherShape] warning XA0102: Launcher icons should not fill every pixel of their square region; see the design guide for details [IconLauncherShape] warning XA0102: Launcher icons should not fill every pixel of their square region; see the design guide for details [IconLauncherShape] (Note use of hex-encoded `,` as `%2c` so that `$(AndroidLintDisabledIssues)` can be specified on the command-line.) Update the `appicon.png` resources in `src/Microsoft.Android.Templates/android` so that these lint warnings are no longer generated. This in turn requires updating various `.apkdesc` files, as the new `appicon.png` files are smaller than the images produced by `SixColors.ImageSharp`, resulting in smaller `.apk` files in our unit tests. Then we hit a set of assembly resolution errors around `System.Runtime.CompilerServices.Unsafe`: System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ----> System.IO.FileLoadException : Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at System.MemoryExtensions.AsSpan(String text) at Microsoft.Build.Evaluation.Expander`2.Function`1.ExtractPropertyFunction(String expressionFunction, IElementLocation elementLocation, Object propertyValue, UsedUninitializedProperties usedUnInitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander`2.PropertyExpander`1.ExpandPropertiesLeaveEscaped(String expression, IPropertyProvider`1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties, IFileSystem fileSystem) at Microsoft.Build.Evaluation.Expander`2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation) at Microsoft.Build.Evaluation.ToolsetReader.ExpandPropertyUnescaped(ToolsetPropertyDefinition property, Expander`2 expander) at Microsoft.Build.Evaluation.ToolsetReader.EvaluateAndSetProperty(ToolsetPropertyDefinition property, PropertyDictionary`1 properties, PropertyDictionary`1 globalProperties, PropertyDictionary`1 initialProperties, Boolean accumulateProperties, String& toolsPath, String& binPath, Expander`2& expander) at Microsoft.Build.Evaluation.ToolsetReader.ReadToolset(ToolsetPropertyDefinition toolsVersion, PropertyDictionary`1 globalProperties, PropertyDictionary`1 initialProperties, Boolean accumulateProperties) at Microsoft.Build.Evaluation.ToolsetReader.ReadEachToolset(Dictionary`2 toolsets, PropertyDictionary`1 globalProperties, PropertyDictionary`1 initialProperties, Boolean accumulateProperties) at Microsoft.Build.Evaluation.ToolsetReader.ReadToolsets(Dictionary`2 toolsets, PropertyDictionary`1 globalProperties, PropertyDictionary`1 initialProperties, Boolean accumulateProperties, String& msBuildOverrideTasksPath, String& defaultOverrideToolsVersion) at Microsoft.Build.Evaluation.ToolsetReader.<ReadAllToolsets>g__ReadConfigToolset|12_0(<>c__DisplayClass12_0& ) at Microsoft.Build.Evaluation.ToolsetReader.ReadAllToolsets(Dictionary`2 toolsets, ToolsetRegistryReader registryReader, ToolsetConfigurationReader configurationReader, PropertyDictionary`1 environmentProperties, PropertyDictionary`1 globalProperties, ToolsetDefinitionLocations locations) at Microsoft.Build.Evaluation.ProjectCollection.InitializeToolsetCollection(ToolsetRegistryReader registryReader, ToolsetConfigurationReader configReader) at Microsoft.Build.Evaluation.ProjectCollection..ctor(IDictionary`2 globalProperties, IEnumerable`1 loggers, IEnumerable`1 remoteLoggers, ToolsetDefinitionLocations toolsetDefinitionLocations, Int32 maxNodeCount, Boolean onlyLogCriticalEvents, Boolean loadProjectsReadOnly, Boolean useAsynchronousLogging) at Microsoft.Build.Evaluation.ProjectCollection.get_GlobalProjectCollection() at Xamarin.ProjectTools.DotNetXamarinProject.Construct() in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Common\DotNetXamarinProject.cs:line 101 at Xamarin.ProjectTools.XamarinAndroidCommonProject.Construct() in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Android\XamarinAndroidCommonProject.cs:line 53 at Xamarin.ProjectTools.DotNetXamarinProject.SaveProject() in C:\a\_work\1\s\src\Xamarin.Android.Build.Tasks\Tests\Xamarin.ProjectTools\Common\DotNetXamarinProject.cs:line 141 at Xamarin.ProjectTools.XamarinProject.Save(Boolean saveProject) in C:\a\_work\ Resolve these errors by updating the various `App.config` files so that they use `<bindingRedirect/>` versions which match `MSBuild.exe.config` in Visual Studio, and ensure that the referenced NuGet packages use the same versions as the `<bindingRedirect/>`. NuGet Package Version Bumps: * Microsoft.NET.Test.Sdk : `16.*` -> `17.5.0-preview-20221003-04` * Microsoft.Win32.Registry : `4.7.0` -> `5.0.0` * nunit : `3.12.0` -> `3.13.2` * NUnit.ConsoleRunner : `3.11.1` -> `3.12.0` * NUnit3TestAdapter : `3.16.1` -> `4.0.0` * System.CodeDom : `4.7.0` -> `6.0.0` * System.Configuration.ConfigurationManager : `4.7.0` -> `6.0.1` * System.Reflection.Metdata : `1.8.0` -> `6.0.1` Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
- Loading branch information