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.45k stars 511 forks source link

Maui Blazor template with Native AOT fails to display main page #19117

Open kotlarmilos opened 1 year ago

kotlarmilos commented 1 year ago

Description

When attempting to use Native AOT with the Maui Blazor template targeting iOS with dotnet version 8.0.100-rtm.23479.1, the app fails to display the main page. No errors were retrieved from the app log. The app functions correctly with the Mono runtime.

Steps to Reproduce

  1. Download the dotnet 8.0.100-rtm.23479.1 version
  2. Create a template app: dotnet new maui-blazor -n "MyMauiAppTemplate"
  3. Publish the app using Native AOT: cd MyMauiAppTemplate && dotnet publish -f net8.0-ios /p:PublishAot=true /p:PublishAotUsingRuntimePack=true -r ios-arm64
  4. Run the app using xharness: dotnet xharness apple run --app=bin/Release/net8.0-ios/ios-arm64/publish/Payload/MyMauiAppTemplate.app --targets=ios-device --output-directory=/tmp/out

Expected Behavior

The app should display the main page.

Actual Behavior

The app displays the error page.

IMG_5215D072FD03-1

Environment

Installed Workload Id Manifest Version Installation Source
maui 8.0.0-nightly.9345/8.0.100-rc.2 SDK 8.0.100-rtm.23479
kotlarmilos commented 11 months ago

@dalexsoto Should we move this issue to the Maui repository?

rolfbjarne commented 11 months ago

@kotlarmilos my guess would be that this is because something was trimmed away, but do you know for sure?

kotlarmilos commented 11 months ago

Could be. Should we try to root some assemblies? Here is the compilation log:

/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.iOS.dll : warning IL3053: Assembly 'Microsoft.iOS' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.Maui.Controls.Xaml.dll : warning IL2104: Assembly 'Microsoft.Maui.Controls.Xaml' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.Maui.Controls.Xaml.dll : warning IL3053: Assembly 'Microsoft.Maui.Controls.Xaml' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.Maui.Controls.dll : warning IL2104: Assembly 'Microsoft.Maui.Controls' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.Maui.dll : warning IL2104: Assembly 'Microsoft.Maui' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.Maui.dll : warning IL3053: Assembly 'Microsoft.Maui' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
ILC : warning IL3000: Microsoft.AspNetCore.Components.WebView.WebViewManager.StaticWebAssetsLoader.ResolveRelativeToAssembly(): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
ILC : warning IL3000: Microsoft.AspNetCore.Components.WebView.WebViewManager.StaticWebAssetsLoader.ResolveRelativeToAssembly(): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
ILC : warning IL3000: Microsoft.AspNetCore.Components.WebView.WebViewManager.StaticWebAssetsLoader.ResolveRelativeToAssembly(): 'System.Reflection.Assembly.Location.get' always returns an empty string for assemblies embedded in a single-file app. If the path to the app directory is needed, consider calling 'System.AppContext.BaseDirectory'. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.AspNetCore.Components.WebView.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components.WebView' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.AspNetCore.Components.Web.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Components.Web' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.AspNetCore.Components.dll : warning IL2104: Assembly 'Microsoft.AspNetCore.Components' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.AspNetCore.Components.WebView.dll : warning IL3053: Assembly 'Microsoft.AspNetCore.Components.WebView' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.JSInterop.dll : warning IL3053: Assembly 'Microsoft.JSInterop' produced AOT analysis warnings. [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]
/Users/miloskotlar/playground/MyMauiAppTemplate/obj/Release/net8.0-ios/ios-arm64/linked/Microsoft.JSInterop.dll : warning IL2104: Assembly 'Microsoft.JSInterop' produced trim warnings. For more information see https://aka.ms/dotnet-illink/libraries [/Users/miloskotlar/playground/MyMauiAppTemplate/MyMauiAppTemplate.csproj::TargetFramework=net8.0-ios]