xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.49k stars 515 forks source link

Unhelpful message after upgrading 8.0 app to 9.0 #21204

Open vitek-karas opened 2 months ago

vitek-karas commented 2 months ago

Apple platform

Mac Catalyst

Framework version

net9.0-*

Affected platform version

9.0.100-preview.7.24407.12

Description

Upgrading an 8.0 MAUI app to 9.0 by changing TFMs to net9.0 and then trying to run it as maccatalyst produces a confusing error and suggest a fix which is at best misleading.

(The repro steps will produce the below error)

    ILLink : unknown error IL7000: An error occured while executing the custom linker steps. Please review the build log for more information.
    ILLINK : error MT0073: Microsoft.MacCatalyst 17.5.9231 does not support a deployment target of 13.1 for MacCatalyst (the minimum is 15.0). Please select a newer deployment target in your project's Info.plist.
    ILLINK : error MT2301: The linker step 'Setup' failed during processing: Microsoft.MacCatalyst 17.5.9231 does not support a deployment target of 13.1 for MacCatalyst (the minimum is 15.0). Please select a newer deployment target in your project's Info.plist.

Several problems with this:

Steps to Reproduce

On .NET 8 SDK - dotnet new maui Open the .csproj and update all TFMs to net9.0. Using .NET 9 SDK - dotnet build /t:Run -f net9.0-maccatalyst

Did you find any workaround?

No response

Relevant log output

No response

rolfbjarne commented 2 months ago

ILLink - normal users should not need to know what this is and it's just confusing. Additionally this doesn't feel like the right place to report this kind of problem. Ideally this should be done by the SDK earlier on, the linker custom step doesn't necessarily have enough context to produce a helpful error message.

Agreed we can report this particular error sooner.

This should be fixed once https://github.com/xamarin/xamarin-macios/issues/17693 is done.

  • The errors are not documented - or at least not findable. Searching bing for MT0073 doesn't produce anything useful.

The documentation got more or less scrubbed from the internet when Xamarin docs were scrubbed :(

Here's the relevant documentation: https://learn.microsoft.com/vi-vn/previous-versions/xamarin/ios/troubleshooting/mtouch-errors#mt0073-xamarinios--does-not-support-a-deployment-target-of--the-minimum-is--please-select-a-newer-deployment-target-in-your-projects-infoplist

We're working on getting docs updated and published again for .NET, but this will take a while.

  • Ideally we should include a URL which points to more details about the problem.

Agreed, I've filed #21218 to keep track of this.

The suggested fix is to update Info.plist - this file does exist in a MAUI template app, but it doesn't contain the version number - just variable references. Changing it is very likely not the correct fix. The correct place to fix in this case seems to be to modify the .csproj which defines SupportedOSPlatformVersion. It is possible that this correct fix depends on the project type (MAUI versus just iOS and so on), but at least MAUI is probably the majority of users and thus should be included.

I've opened #21211 to improve the error message.

  • Nit occured word in the IL7000 message is misspelled - should be occurred.

Thanks, will be fixed in #21208.