xamarin / Xamarin.Legacy.Sdk

Starting from a .NET 6 project, adds the ability to target legacy Xamarin target frameworks such as monoandroid11.0 or xamarin.ios10. *Not fully supported*
MIT License
35 stars 6 forks source link

Error opening .csproj when monodroid5.0 is included with the target frameworks #55

Closed anotherlab closed 1 year ago

anotherlab commented 1 year ago

Steps to Reproduce

  1. Clone/check out/fork the code from UsbSerialForAndroid
  2. Open the solution for the UsbSerialForAndroid library
  3. Right-click on the project name and select properties

The solution file looks like this

<Project Sdk="Xamarin.Legacy.Sdk/0.2.0-alpha4">
  <PropertyGroup>
    <TargetFrameworks>net6.0-android;net7.0-android;monoandroid5.0</TargetFrameworks>
    <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
    <Nullable>disable</Nullable>
    <ImplicitUsings>disable</ImplicitUsings>
    <AssemblyName>Android.UsbSerial</AssemblyName>
    <RootNamespace>Hoho.Android.UsbSerial</RootNamespace>
  </PropertyGroup>
</Project>

Expected behavior

Project file editor opens up

Actual behavior

An error page is displayed

An error occured while loading the project properties editor
System.ArgumentException: Expected 4 values for property AndroidRule::AndroidPackageFormat, but got 2.
Parameter name: values
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.Property.Update(ImmutableArray`1 values)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.Property..ctor(PropertyMetadata metadata, ImmutableArray`1 values, PropertyContext context, ImmutableHashSet`1 varyByDimensions)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.PropertyContextFactoryBase.ToProperty(IUIPropertySnapshot property, Page page, Category category, Int32 order, PropertyContext propertyContext, IPropertyEditorRegistry propertyEditorRegistry)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<HandleDataAsync>g__CreateProperties|14_5(<>c__DisplayClass14_0& )
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.ProjectPropertyDataAccess.Observer.<HandleDataAsync>g__ProcessInitialData|14_1(<>c__DisplayClass14_0& )

If you remove monodroid5.0 from the target framework list, the file opens normally.

Enviroment

Version Information ``` Microsoft Visual Studio Enterprise 2022 Version 17.7.0 Preview 1.0 VisualStudio.17.Preview/17.7.0-pre.1.0+33711.374 Microsoft .NET Framework Version 4.8.09032 Installed Version: Enterprise Visual C++ 2022 00476-80000-00000-AA705 Microsoft Visual C++ 2022 ASP.NET and Web Tools 17.7.82.47043 ASP.NET and Web Tools Azure App Service Tools v3.0.0 17.7.82.47043 Azure App Service Tools v3.0.0 Azure Functions and Web Jobs Tools 17.7.82.47043 Azure Functions and Web Jobs Tools C# Tools 4.7.0-1.23226.11+6544980c8335ce25d8959afd4b6ee308686fed53 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.4.22 (main@fc8e91f) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration. Microsoft Azure Tools for Visual Studio 2.9 Support for Azure Cloud Services projects Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines Mono Debugging for Visual Studio 17.7.5 (97aad5d) Support for debugging Mono processes with Visual Studio. Multilingual App Toolkit 4.0 Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://aka.ms/matinstall NuGet Package Manager 6.7.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/ Razor (ASP.NET Core) 17.6.0.2326103+839fdd5e019d9e52a1f1985b54937a084f086b8b Provides languages services for ASP.NET Core Razor. ResX Resource Manager ResXManager Manage localization of all ResX-based resources in one place. Shows all resources of a solution and lets you edit the strings and their localizations in a well-arranged data grid. SQL Server Data Tools 17.6.13.0 Microsoft SQL Server Data Tools SQL Server Reporting Services 16.0.20243.0 Microsoft SQL Server Reporting Services Designers Version 16.0.20243.0 StylerPackage Extension 1.0 StylerPackage Visual Stuido Extension Detailed Info Tweaks 2022 1.1.143 A collection of minor fixes and tweaks for Visual Studio to reduce the paper cuts and make you a happier developer TypeScript Tools 17.0.20426.2001 TypeScript Tools for Microsoft Visual Studio Visual Basic Tools 4.7.0-1.23226.11+6544980c8335ce25d8959afd4b6ee308686fed53 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 17.7.0-beta.23221.1+858e2df9631a385cbddef62eeb424f9b3071b031 Microsoft Visual F# Tools Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio. VisualStudio.DeviceLog 1.0 Information about my package VisualStudio.Mac 1.0 Mac Extension for Visual Studio Web Compiler 1.14.10 Compiler for LESS, Sass and CoffeeScript files Windows Subsystem for Android Barista 1.1.0 Adds a command to the tools menu to start and connect to the Windows Subsystem for Android so you can develop and debug with it from within Visual Studio. Word Highlight With Margin Extension 1.0 Highlight all occurrences of a selected word and display carets on the enhanced vertical scrollbar at the right margin. Xamarin 17.7.0.37 (main@5d96488) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin Designer 17.7.1.10 (remotes/origin/main@4bc119239d) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Templates 17.6.32 (98c12a2) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin.Android SDK 13.2.0.11 (d17-5/b372b80) Xamarin.Android Reference Assemblies and MSBuild support. Mono: 6dd9def Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@ca1552d Xamarin.iOS and Xamarin.Mac SDK 16.4.0.5 (191fe02ea) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. ```
jonathanpeppers commented 1 year ago

Microsoft.VisualStudio.ProjectSystem.VS.Implementation.PropertyPages.Designer.Property is part of Visual Studio and not this GitHub repo, unfortunately.

To get someone to help with this issue, I think you'll have to do Help > Send Feedback inside Visual Studio to get someone that works on the IDE to help with this one. Sorry! Thanks!