Open mcocaroUX opened 4 months ago
Thanks for the report. In general, the main difference in behavior is caused by the linker. Try disabling the linker and see if the behavior is different. You will also see a lot of information in the app's logs.
Ive experimented with disabling linking and it made no difference to the error
I used the following config in .csproj to do that
<ItemGroup>
<TrimmerRootAssembly Include="Guidl_CMS.Mobile" />
<TrimmerRootAssembly Include="Guidl_CMS" />
</ItemGroup>
Using the console app on mac I got this error being logged when the app fails to display its data
cannot add handler to 3 from 3 - dropping
For extra information we are creating the release pkg using the following command line (running on azure devops macos agent) and notarising the pkg file using notarytool
dotnet publish -f:.net8.0-maccatalayst -c:Release /p:ApplicationIdentifier=com.acme.app -p:CreatePackage=true -p:EnableCodeSigning=true /p:CodesignKey="Developer ID Application: Acme Ltd (xxxxxxx)" /p:CodesignProvision=$(provisioningProfile.provisioningProfileUuid) -p:EnablePackageSigning=true -p:PackageSigningKey="Developer ID Installer: Acme Ltd (xxxxxxx)" /p:ArchiveOnBuild=true
The mobile.csproj file looks like this
<When Condition="$(IsMacCatalyst)">
<PropertyGroup>
<CodesignEntitlements>MacCatalyst/Entitlements.plist</CodesignEntitlements>
<!-- Configure the GC -->
<MtouchExtraArgs>$(MtouchExtraArgs) --setenv=MONO_GC_PARAMS=soft-heap-limit=512m,nursery-size=64m,evacuation-threshold=66,major=marksweep,concurrent-sweep</MtouchExtraArgs>
<!-- Required for unknown crash as of .NET 6 Mobile Preview 13 -->
<MtouchExtraArgs>$(MtouchExtraArgs) --registrar:static</MtouchExtraArgs>
<!-- Full globalization is required for Uno -->
<InvariantGlobalization>false</InvariantGlobalization>
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)'==''">maccatalyst-x64</RuntimeIdentifier>
</PropertyGroup>
<Choose>
<When Condition="'$(Configuration)'=='Debug'">
<PropertyGroup>
<!-- APPLICATION WILL CRASH/MALFUNCTION IF SIGNING IS NOT CONFIGURED -->
<!-- See https://github.com/unoplatform/uno.extensions/issues/2126 for more details -->
<CodesignKey>Apple Development: Paul Jones (xxxxxxxxxx)</CodesignKey>
<CodesignProvision>Mac Team Provisioning Profile: *</CodesignProvision>
</PropertyGroup>
</When>
<When Condition="'$(Configuration)'=='Release'">
<PropertyGroup>
<!-- https://github.com/xamarin/xamarin-macios/issues/14812 -->
<MtouchExtraArgs>$(MtouchExtraArgs) --marshal-objectivec-exceptions:disable</MtouchExtraArgs>
<UseHardenedRuntime>true</UseHardenedRuntime>
<!-- https://github.com/xamarin/xamarin-macios/issues/14686 -->
<EnableAssemblyILStripping>false</EnableAssemblyILStripping>
<_LibMonoLinkMode>Static</_LibMonoLinkMode>
<_LibXamarinLinkMode>Static</_LibXamarinLinkMode>
</PropertyGroup>
<ItemGroup>
<TrimmerRootAssembly Include="Guidl_CMS.Mobile" />
<TrimmerRootAssembly Include="Guidl_CMS" />
</ItemGroup>
</When>
</Choose>
</When>
Thanks for the update. This is still likely to be a trimmer issue, Try adding most of the assemblies from the project to see if it helps.
those are all the projects, its just a 2 project solution.
It previously crashed on startup on some macs (not all) with an error about loading harflib dlls . we added the following to work around that
<!-- https://github.com/xamarin/xamarin-macios/issues/14686 -->
<EnableAssemblyILStripping>false</EnableAssemblyILStripping>
<_LibMonoLinkMode>Static</_LibMonoLinkMode>
<_LibXamarinLinkMode>Static</_LibXamarinLinkMode>
We are going to try moving to uno.sdk to see if that changes anything
@jeromelaban After migrating to Uno.sdk we are facing this errors when building mac catalyst:
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_fIcons_fguidllogo.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_fIcons_fheadphones.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_flogo.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_fsplashlogo.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_floading.gif' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_frecording.gif' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier 'monotouch_content_Assets_floginimage.jpg' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_Assets_fsplash.jpg' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
Binlog: net8.0-maccatalyst-Debug-maccatalyst-x64.zip
I've compared the .csproj and solution items with a newly created app using Uno template wizard and I see no difference or anything that could be causing that errors
Thanks.
You have duplicate resw
content. it's mentioned in the migration docs, but you should remove this:
<!-- Include all images by default - matches the __WindowsAppSdkDefaultImageIncludes property in the WindowsAppSDK -->
<Content Include="Assets\**;**/*.png;**/*.bmp;**/*.jpg;**/*.dds;**/*.tif;**/*.tga;**/*.gif" Exclude="bin\**;obj\**;**\*.svg" />
<Page Include="**\*.xaml" Exclude="bin\**\*.xaml;obj\**\*.xaml" />
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>
</Compile>
<PRIResource Include="**\*.resw" />
@jeromelaban We followed the steps on the docs, we removed that code from the .csproj
Even by removing all files references, app doesnt build. It builds if you directly remove the files from the project.
Here is our csproj: csproj file.zip
Thanks.
You'll notice that in your csproj, you have a very large number of AdditionalFiles
, None
, UpToDateCheckInput
and Content
entries. Those should be removed as they will duplicate what the Uno.Sdk
is automatically adding.
@jeromelaban Thanks for your answer. I cleaned my .csproj file, but it's still not building. Upon comparing it with a .csproj from an new solution created using https://new.platform.uno/, there are no differences except for a few packages. These packages are:
Just in case these is our Directory.Packages.props
:
<Project ToolsVersion="15.0">
<ItemGroup>
<PackageVersion Include="CommunityToolkit.WinUI.UI.Controls" Version="7.1.2" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageVersion Include="Geolocation" Version="1.2.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231219000" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Extensions.Core.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Authentication" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Authentication.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Configuration" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Hosting" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Http" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Http.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Http.Refit" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Localization" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Localization.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
<PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Navigation" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Navigation.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Navigation.Toolkit.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Reactive" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Reactive.WinUI" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Serialization" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Serialization.Http" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Serialization.Refit" Version="4.0.0" />
<PackageVersion Include="Uno.Extensions.Reactive.Messaging" Version="4.0.0" />
<PackageVersion Include="Uno.Material.WinUI" Version="4.1.1" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.1.5" />
<PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.1.5" />
<PackageVersion Include="Uno.Resizetizer" Version="1.3.0" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
<PackageVersion Include="Uno.WinUI" Version="$(UnoVersion)" />
<PackageVersion Include="Uno.WinUI.Lottie" Version="$(UnoVersion)"/>
<PackageVersion Include="Uno.WinUI.DevServer" Version="$(UnoVersion)" />
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.2" />
<PackageVersion Include="Mapsui.Uno.WinUI" Version="4.1.2" />
</ItemGroup>
</Project>
Any ideas?
Thanks. Looking at the binlog again, it seems that we have an issue when using the Uno.SDK with duplicated items.
As a workaround, can you try adding the following to your .Mobile.csproj
, at the very end:
<Target Name="Uno15411Workaround" BeforeTargets="BeforeBuild">
<ItemGroup>
<Content Remove="Assets\**" />
<Content Add="Assets\**" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);**\*.svg">
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
</Content>
</ItemGroup>
</Target>
We'll publish an update soon to correct this behavior.
@jeromelaban Thank you, workaround didn't worked. I'm getting the same error
Thanks, can you provide the binlog of that build?
Sure, here: net8.0-maccatalyst-Debug-maccatalyst-x64 (1).zip
Thanks. I made a typo telling you to add the target, can you add it to your Guidl_CMS.csproj
project instead?
Still same issue, here is the binlog: net8.0-maccatalyst-Debug-maccatalyst-x64.zip
Thanks, the build ordering is a bit different in your build than on my system, can you try with:
<Target Name="Uno15411Workaround" BeforeTargets="_CollectBundleResources">
<ItemGroup>
<Content Remove="Assets\**" />
<Content Add="Assets\**" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);**\*.svg">
<Link>$([MSBuild]::MakeRelative ('$(MSBuildProjectDirectory)', '%(Identity)'))</Link>
</Content>
</ItemGroup>
</Target>
@jeromelaban Thank you, I'm getting the same error but the message changed:
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-100.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-125.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-150.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-200.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-300.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
CSC : error CS1508: Resource identifier '__monotouch_content_obj_fDebug_fnet8.0-maccatalyst_funoresizetizer_fr_fAssets_fIcons_fback.scale-400.png' has already been used in this assembly [/Users/maurococaro/GuidlAppCreator/Guidl_CMS/Guidl_CMS/Guidl_CMS/Guidl_CMS.csproj]
Thanks. Apologies for the back and forth, I was able to reproduce parts of your scenario, we'll see if it helps.
Can you try with:
<Target Name="Uno15411Workaround" BeforeTargets="_CollectBundleResources">
<ItemGroup>
<Content Remove="Assets\**" />
<Content Include="Assets\**" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder);**\*.svg" />
</ItemGroup>
</Target>
That last one worked! Thanks
thankyou @jeromelaban and @mcocaroUX. To update here. Following the back and forth I successfully have the mac build working using uno.sdk. (The windows build now fails, we will investigate that and raise a separate issue if needed - its probably best to wait for an official fix for these build issues)
To get back to the main topic of this issue. After migrating the mac catalyst app to uno.sdk the issue with the app is still present.
To summarise where we are with this.
@jeromelaban - i think this got closed automatically by mistake
The uno.sdk upgrade issue is resolved but that didnt resolve to main problem that this issue addresses - the mac application still doesnt work when installed with an installer
can we reopen this please
@hamada-applicita Thanks. We still do not have enough information to help here, and it still feels like it is related to the linker. Have you added all the assemblies to the linker configuration?
I appreciate its a difficult one to diagnose
I have added all the dlls to the linker exclusion - there are only 2, the mobile project and the base project
I have an idea to try and publish to app to testflight and see if that makes a difference, its a different signing process (uses a different type of cert) at least. This will take me some time to setup
Thanks. Make sure to add all the other assemblies from the output package.
@jeromelaban @johnkattenhorn
Rooting all the assemblies fixed the app ;) It seems to be running correctly now. I Rooted a total of 340 assemblies.
Should we investigate further to determine which assembly is the issue or is it fine to leave it with everything rooted.
Other than size what are the disadvantages of not trimming?
Thanks for the update.
It's generally best to narrow down which assembly is causing the issue, as when you'll enable AOT to improve the performance of the app, it will become very large.
Current behavior
We have encountered an issue with our Uno Platform application targeting Mac Catalyst, where the application behaves differently in the Release package compared to Debug Which makes the app unusable.
Primary Issue: Data Display Failure in FeedView Issue happens after a simple login (works as expected), when navigating to the Home page where we have a FeedView containing an ItemsRepeater but none is displayed
Secondary Issue: XAML Navigation Failure on Button Press On the same Home page, attempt to use XAML-based navigation by pressing a button designed for this purpose. In the Release build, pressing the navigation button results in no action, contrary to the expected navigation behavior.
This functionalities works as intended in the Debug build.
Currently targeting to .net8
Expected behavior
The ItemsRepeater should dynamically load and display the data, with appropriate handling for None, Progress, or Error states through their respective templates and Button should navigte to the correct page.
How to reproduce it (as minimally and precisely as possible)
We wont be able to provide a repro project on this case as the issue is only ocurring on the app installed by the release package
Workaround
No response
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
Affected platforms
Mac Catalyst
IDE
No response
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
Please let me know if I can provide any other info I missed