unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.95k stars 726 forks source link

[Mac Catalyst] Error when adding Mac project to existing solution #14462

Closed mcocaroUX closed 10 months ago

mcocaroUX commented 12 months ago

Current behavior

When trying to run the App on Mac it shows this error: image

Expected behavior

App should run after adding the project and added missing packages

How to reproduce it (as minimally and precisely as possible)

TestMac.zip

Packages Version(s):

<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
    <PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.0" />
    <PackageVersion Include="Geolocation" Version="1.2.1" />
    <PackageVersion Include="Mapsui.Uno.WinUI" Version="4.1.1" />
    <PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
    <PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
    <PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.3.230502000" />
    <PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.1" />
    <PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
    <PackageVersion Include="Uno.Extensions.Authentication" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Authentication.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Configuration" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Hosting" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Http" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Http.Refit" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Localization" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Localization.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Navigation.Toolkit.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Reactive" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Reactive.Messaging" Version="2.5.11" />
    <PackageVersion Include="Uno.Extensions.Reactive.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization.Http" Version="3.0.11" />
    <PackageVersion Include="Uno.Extensions.Serialization.Refit" Version="3.0.11" />
    <PackageVersion Include="Uno.Material.WinUI" Version="4.0.4" />
    <PackageVersion Include="Uno.Dsp.Tasks" Version="1.1.0" />
    <PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.15" />
    <PackageVersion Include="Uno.Extensions.Toolkit.WinUI" Version="3.0.11" />
    <PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.0.15" />
    <PackageVersion Include="Uno.Resizetizer" Version="1.1.2" />
    <PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
    <PackageVersion Include="Uno.WinUI" Version="5.0.48" />
    <PackageVersion Include="Uno.WinUI.RemoteControl" Version="5.0.48" />
    <PackageVersion Include="Uno.UITest.Helpers" Version="1.1.0-dev.70" />
    <PackageVersion Include="Xamarin.UITest" Version="4.1.3" />
    <PackageVersion Include="coverlet.collector" Version="6.0.0" />
    <PackageVersion Include="FluentAssertions" Version="6.11.0" />
    <PackageVersion Include="NUnit" Version="3.13.3" />
    <PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
These are the packages I have installed on my project not on the sample

Affected platform(s):

IDE:

Relevant plugins:

Anything else we need to know?

I have a Uno app were the only platform is windows, I'm trying to add a mac project but when I run it app crashes

kazo0 commented 12 months ago

This is related to Uno.UI.Toolkit within Uno itself, not the Uno.Tookit.UI library.

Transferring issue to Uno repo

jeromelaban commented 11 months ago

Thanks for the report! This is likely caused by Mapsui.Uno.WinUI, which may not be compatible with Uno 5.0 or later. We're tracking this in https://github.com/Mapsui/Mapsui/issues/2238, and while the main repo has been updated to uno 5, there's no available package yet.

mcocaroUX commented 11 months ago

@jeromelaban @kazo0 Do you guys have an idea when this is going to be fixed? We are currently working on a project using Mapsui and adding the Mac platform is on the roadmap for the next weeks

jeromelaban commented 11 months ago

@mcocaroUX we're not managing MapsUI, so we do not know when packages will be released.

pauldendulk commented 11 months ago

We expect to release a Mapsui 4.1.2-preview.2 with this fix next Friday or next week.

jeromelaban commented 11 months ago

Thanks for the update @pauldendulk!

mcocaroUX commented 11 months ago

Hello @kazo0 @jeromelaban, I just updated my packages and added the mac project. But still getting the same error I reported previously

jeromelaban commented 11 months ago

@mcocaroUX thanks. Can you provide a binlog?

mcocaroUX commented 11 months ago

@jeromelaban Not sure how to do it on VS for mac. Would that be useful event when the app builds correctly? The exception is being on the Init

Here is what the output throws if it is of any help: mac exception output.txt

jeromelaban commented 11 months ago

Thanks. It really seem that you are referencing an incorrect binary, Uno.UI.Maps is not supposed to be used at all. You can create a binlog using the terminal (dotnet build).

mcocaroUX commented 11 months ago

I followed all the steps described here on the doc: https://platform.uno/docs/articles/guides/how-to-add-platforms-existing-project.html

After updating the packages and some small tweaks I made the app build on mac but what I get is just a blank screen. The app initialization and navigation to the first screen seems to be executed as expected.

Here is a zip with the issue isolated: TestAddProject.zip

jeromelaban commented 10 months ago

@nickrandolph I can repro the issue, would you know what happens here?

Logs show this:

[0:] Uno.Extensions.Storage.FileStorage: Warning: ReadPackageFileAsync - File 'appsettings.keyvaluestorageconfiguration.json' does not exist in package
[0:] Uno.Extensions.Storage.FileStorage: Warning: ReadPackageFileAsync - File 'appsettings.appconfig.json' does not exist in package
[0:] Uno.Extensions.Storage.FileStorage: Warning: ReadPackageFileAsync - File 'appsettings.localizationconfiguration.json' does not exist in package
[0:] Uno.Extensions.Storage.FileStorage: Warning: ReadPackageFileAsync - File 'appsettings.localizationsettings.json' does not exist in package
[0:] Uno.Extensions.Navigation.Navigators.ContentControlNavigator: Warning: Show - Missing view for navigation path ''
[0:] Microsoft.UI.Xaml.Controls.TextBox: Warning: IsTextPredictionEnabled isn't supported on iOS. Use IsSpellCheckeEnabled instead.

The app works on the WinAppSDK head.

nickrandolph commented 10 months ago

I think the missing step is to add the maccatalyst tfm (eg net7.0-maccatalyst) to the class library project

mobynet1 commented 2 months ago

@jeromelaban Out of curiosity, I am getting all of the uno.extensions.storage.filestorage warnings listed above on app startup and am only using a multi-platform solution that I created using the app config tool for v5.3.18. It does not seem to affect anything except that I disdain seeing errors in any startup up log. Is there any additional configuration that I need to do? I cannot find anything in the online documentation. Thanks!

jeromelaban commented 2 months ago

@mobynet1 we've been tracking this in https://github.com/unoplatform/uno.extensions/issues/2423, it will be published in the next release.