maui
maui copied to clipboard
Integrated Hello World Maui startup project crashes after splashscreen on iOS 16.5.1 and .NET8.0 in release mode.
Description
I delevoped a maui app. When i tried to publish it as realease on my iOS 16.5.1 physical device, the app crashed after the splash screen. After a while, i tried it with a clean empty new Hello World Maui App in VisualStudio 17.8.3, and the same happens in Release mode.
Steps to Reproduce
- Create new .NET Maui App with .NET8.0
- Run Release on a physical iOS 16.5.1 device
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16.5.1
Did you find any workaround?
No
Relevant log output
When i connect the iPhone to a mac mini with xcode, the 2 log directories are empty.
The device log in Visual Studio shows a lot of notices but nothing with the name/id of my app.
@rolfbjarne thoughts?
Can you attach a binlog? https://github.com/xamarin/xamarin-macios/wiki/Diagnosis
Hi @Dryzler. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
MauiApp2_Release_AnyCPU_net8.0-ios_Build_2023-12-21T05_06_21.4028377+01_00.log
Had to rename from .binlog to .log for upload.
@Dryzler Can you try the same thing with an .NET iOS app that doesn't use the MAUI UI Framework?
You can set one up by running dotnet new ios
(you may need to install the ios workload with dotnet workload install ios
if you don't have it.
Hi @Dryzler. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@Dryzler Can you try the same thing with an .NET iOS app that doesn't use the MAUI UI Framework?
Unfortunately i don't see my physical iPhone 16.5.1 in the Run "Tab" when i start the generated project, so i can't test this. The Only things i see is "Remote Device" and "Simulator", no locally connected ios devices.
After a while, i tried it with a clean empty new Hello World Maui App in VisualStudio 17.8.3, and the same happens in Release mode.
Do you get the same behavior if you tap on the app on the device?
After a while, i tried it with a clean empty new Hello World Maui App in VisualStudio 17.8.3, and the same happens in Release mode.
Do you get the same behavior if you tap on the app on the device?
Yes
Are you building and running on a remote Mac, or locally on Windows? Does anything change if you try the other way?
Can you connect your device to a Mac, open Xcode and get any crash reports (explained here: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#crash-reports)?
Are you building and running on a remote Mac, or locally on Windows? Does anything change if you try the other way?
Can you connect your device to a Mac, open Xcode and get any crash reports (explained here: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#crash-reports)?
When i connect the iPhone to a mac mini with xcode, the 2 log directories are empty.
I build for a physical iPhone with iOS 16.5.1 while i am paired with a mac. Don't know if it is build on the mac.
I'm having the same issue, but only when I'm building for Release. KinesiaOne-2023-12-21-105347.zip Here's the IPS crash file from the device. ~~I'll work on getting binlogs shortly.~~
Additional info: This app was working fine in Release build publishing as an Ad-Hoc ipa most recently as of December 13th. Then as of yesterday, Release builds published using the same settings are failing to launch. It doesn't appear to even get as far as executing the code within the MauiProgram class, as no logs from Serilog (the first thing that I initialize) are generated.
Other logs: 2023-12-21_11-55-26.8656.Ide.log Xamarin IDE log MSBuild_Logs.zip MS Build logs
Please let me know if you need any more logs or information, I will happily provide it.
Here's the IPS crash file from the device.
The stack trace is unfortunately not symbolicated, probably because symbols were stripped as part of the build process.
Can you add this to your csproj, try again and get an updated ips file?
<PropertyGroup>
<NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup>
Hi @Dryzler. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
@rolfbjarne after putting that into my .csproj file, it no longer generates a .ips crash report file. I've tried two different iPad models (a Mini 5 and a Mini 6, both using iOS 17). I did generate a sysdiagnose file on my main development iPad, if that would be helpful?
Just another additional bit of info, I tried switching to an older MacBook I use for working on our older Xamarin apps that's running Xcode 14 and has an older version of the Xcode 15 beta, and I still get the same result. I also downgraded Visual Studio to 17.8.2.
I also attempted to build the project directly on the MacBook and had the exact same result, so that eliminates any potential issues with the Pair-to-Mac process.
Even more interestingly, I created a blank Uno Platform project from their templates, gave it the same Bundle ID and set it to use the same distribution profile and certificate as the MAUI project and built and deployed it to a device, and the Uno app was able to launch just fine. So whatever the issue is, it seems to be coming from something in MAUI.
I'm absolutely baffled by this, as nothing has changed since the last beta build that I had work on the 13th (which still works).
Hi @Dryzler. We have added the "s/needs-info" label to this issue,
Hello, i don't know which info i have to supply.
@rolfbjarne after putting that into my .csproj file, it no longer generates a .ips crash report file. I've tried two different iPad models (a Mini 5 and a Mini 6, both using iOS 17). I did generate a sysdiagnose file on my main development iPad, if that would be helpful?
@vouksh I think your issue is a new issue/other issue.
@Dryzler I don't think it is because I get the exact same issue that you described in your original post. An app that works fine in Debug instantly crashes after the splash screen when built in Release.
Hm, does nobody have an iOS 16.5.1 device and can reproduce the crash?
I don't think it's related to a specific iOS version because I have an iPhone running 16.6 that also has the issue.
Please get crash reports and device logs as described here: https://github.com/xamarin/xamarin-macios/wiki/Diagnosis#crash-reports and here: https://support.apple.com/en-in/guide/console/cnsl1012/mac, that will hopefully reveal why the apps are crashing.
You can also try to diagnose by making sure you don't have any different build configuration between Debug and Release, and in addition set the following properties (one by one, to see if any of changes the behavior):
<PropertyGroup>
<UseInterpreter>true</UseInterpreter>
<MtouchUseLlvm>false</MtouchUseLlvm>
</PropertyGroup>
devicelogs.txt KinesiaOne.csproj.txt signpost_reporter-2024-01-03-100931.ips.json MSBuild_Logs.zip
I've tried different variations of those two properties as well as <NoSymbolStrip>true</NoSymbolStrip>
, to no avail.
The app is also not generating crash reports for whatever reason now. I did notice that when the app crashes, a crash report for "signpost_reporter" is generated, so I'm including that as well just in case it has any information that could be useful. I've also included the contents of the .csproj file and I copied the device logs from the console app for one of the crashes. There's not really much info I can see in there, but perhaps you can glean something from it. I included the binlogs as well.
Let me know if there's anything else I can provide you. I'd even be willing to add a device to our provisioning profile and provide the IPA for you to test, if that would help. I'm at the tail end of this project and in the official testing stages.
@vouksh there doesn't seem to be anything from those logs to explain why the app's crashing :/
If you send me the .ipa (to [email protected]), I can probably resign it myself and install it on my device for testing.
Sent. The IPA is too big to attach to an email, so I shared it from OneDrive.
Let me know if there's anything else you need.
@vouksh so your app isn't actually crashing, it's just exiting. At least this explains why there's no crash report.
Unfortunately the native symbols were stripped, so trying to figure out at which point the apps decides to exit instead of continuing the launch got complicated, so could you rebuild your app, and disable symbol stripping and then send me a new .ipa?
To disable symbol stripping just add this to the csproj:
<PropertyGroup>
<NoSymbolStrip>true</NoSymbolStrip>
</PropertyGroup>
@vouksh there's an unhandled managed exception that ends up taking down the process:
Arg_EnumValueNotFound, Center (System.ArgumentException)
at System.Enum.TryParseByName[UInt32](RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, UInt32& result)
at System.Enum.TryParseByValueOrName[Int32,UInt32](RuntimeType enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Int32& result)
at System.Enum.TryParse(Type enumType, ReadOnlySpan`1 value, Boolean ignoreCase, Boolean throwOnFailure, Object& result)
at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase)
at Microsoft.Maui.Controls.Button.ButtonContentTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at System.ComponentModel.TypeConverter.ConvertFromString(ITypeDescriptorContext , CultureInfo , String )
at System.ComponentModel.TypeConverter.ConvertFromInvariantString(String )
at KinesiaOne.Views.LoadStudyPage.InitializeComponent()
at KinesiaOne.Views.LoadStudyPage..ctor(LoadStudyPageViewModel viewModel)
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Constructor(Object obj, IntPtr* args)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object , Span`1 , BindingFlags )
at System.Reflection.MethodBaseInvoker.InvokeWithOneArg(Object , BindingFlags , Binder , Object[] , CultureInfo )
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags , Binder , Object[] , CultureInfo )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite , RuntimeResolverContext )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeServiceProviderEngine.<>c__DisplayClass4_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier , ServiceProviderEngineScope )
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type )
at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType)
at Microsoft.Maui.Controls.ShellContent.<>c__DisplayClass19_0.<Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent>b__0()
at Microsoft.Maui.Controls.ElementTemplate.CreateContent()
at Microsoft.Maui.Controls.Internals.DataTemplateExtensions.CreateContent(DataTemplate self, Object item, BindableObject container)
at Microsoft.Maui.Controls.ShellContent.Microsoft.Maui.Controls.IShellContentController.GetOrCreateContent()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.LoadRenderers()
at Microsoft.Maui.Controls.Platform.Compatibility.ShellSectionRootRenderer.ViewDidLoad()
I would recommend adding event handlers when exceptions are marshaled between managed and Objective-C and print out the exceptions in question, that way you'd get some information about them: https://learn.microsoft.com/en-us/xamarin/ios/platform/exception-marshaling#events
Hello guys, as i said in the title of this issue, also the hello wold maui app from visual studio crashes after splash screen on my iOs 16.5.1 device. Thanks.
@rolfbjarne Well, that's certainly odd. I don't remember adding that ContentLayout property to that button, but apparently that's what was doing it. Odd that it was fine in Debug, without even a XAML error printed, but in Release it brought the whole app down.
I added the marshaled exception handling so that I can at least see these errors now. Thanks.
@Dryzler Try adding the Runtime exception handlers like that article Rolf linked and have it print them to a text file on the device and see if you have a similar exception getting thrown.
Hello, i am not able to do something, thats to difficult for me, sorry.
I now tried the following in Platforms/iOS/Program.cs, but i did not get any output:
public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
Runtime.MarshalManagedException += (object sender, MarshalManagedExceptionEventArgs args) =>
{
Console.WriteLine("Marshaling managed exception");
Console.WriteLine(" Exception: {0}", args.Exception);
Console.WriteLine(" Mode: {0}", args.ExceptionMode);
string[] lines = { "MarshalManagedException", args.Exception.ToString(), "------------------------------------" };
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "WriteLines.txt")))
{
foreach (string line in lines)
outputFile.WriteLine(line);
}
};
Runtime.MarshalObjectiveCException += (object sender, MarshalObjectiveCExceptionEventArgs args) =>
{
Console.WriteLine("Marshaling Objective-C exception");
Console.WriteLine(" Exception: {0}", args.Exception);
Console.WriteLine(" Mode: {0}", args.ExceptionMode);
string[] lines = { "MarshalObjectiveCException", args.Exception.ToString(), "------------------------------------" };
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "WriteLines.txt")))
{
foreach (string line in lines)
outputFile.WriteLine(line);
}
};
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
}