Open jdarwood007 opened 1 month ago
Additional testing
If I comment out the call to SetProperty and have it just set a null, I still get a error.
set
{
noteIcon = null;
//SetProperty(ref noteIcon, value);
}
2024-10-28 07:54:47.897878-0700 MauiApp6[9679:3285691] [MauiApp6] IIOImageSource:439: *** ERROR: can't open '/Users/jeremy/Library/Developer/CoreSimulator/Devices/B0940D78-2ADE-4E0D-9F93-4FE2A0A65412/data/Containers/Bundle/Application/8FE0AA34-83FD-4C3F-88B8-69B4BFDEFADB/MauiApp6.app/button_empty' (fileExists == false)
2024-10-28 07:54:50.982529-0700 MauiApp6[9679:3285691] [MauiApp6] IIOImageSource:439: *** ERROR: can't open '/Users/jeremy/Library/Developer/CoreSimulator/Devices/B0940D78-2ADE-4E0D-9F93-4FE2A0A65412/data/Containers/Bundle/Application/8FE0AA34-83FD-4C3F-88B8-69B4BFDEFADB/MauiApp6.app/button_empty' (fileExists == false)
The Fallbackvalue from the .xaml would be calling this
<ToolbarItem Text="Notes" IconImageSource="{Binding NoteIcon, FallbackValue=button_empty}" />
I've tried to specify a file extension, no change.
I've installed the latest visual studio preview and upgraded to the latest (at the time) .NET 9. It does not crash, but produces the error:
2024-10-28 08:44:41.209437-0700 MauiApp6[17199:3339626] [MauiApp6] IIOImageSource:439: *** ERROR: can't open '/Users/jeremy/Library/Developer/CoreSimulator/Devices/B0940D78-2ADE-4E0D-9F93-4FE2A0A65412/data/Containers/Bundle/Application/0CA9C5C4-75ED-4638-8E41-F981404DCFF4/MauiApp6.app/button_note' (fileExists == false)
Reverted back to .NET 8 and the crash occurs. This seems to specifically target .NET 8.
In my testing the icon still appears to be updated correctly and changes as expected on the interface if I use a try catch to ignore the null reference.
I am still trying to find a workaround here. This is holding up my app development as I can't reliably get the icon to change as app logic determines it should update.
I thought about adding some logic with a Task.Delay
on the OnAppearing
call using MainThread.InvokeOnMainThreadAsync
. I would then remove the toolbar item and readd it. This resulted in a crash. I did some more testing and found just calling for removing the toolbar item is able to crash the app with similar errors as above
private void CrashBtn_Clicked(object sender, EventArgs e)
{
ToolbarItem? noteBtn = ToolbarItems.FirstOrDefault(x => x.Text == "Notes");
ToolbarItems.Remove(noteBtn);
}
I tried to mess with linker settings and no workaround yet.
If I suppress the call with a try/catch, no crash but the icon does not update as expected either.
This issue has been verified using Visual Studio 17.13.0 Preview 1.0 (9.0.0 & 8.0.93 & 8.0.71). Can repro on iOS platform.
Description
My app sets a icon for a tool. The icon binding is inside a view model. The crash only happens with a specific setup and steps. I've linked to a test app that I can reliably cause it to crash.
I compiled the iOS code on XCode 16 on Mac OS Sonoma (14.5) on a M1 Mac. This does not crash Android
At first I thought this was related to the Mvvm tool kit, but I can get it to crash using just the native INotifyPropertyChanged I've included both in my rest repo.
The error I get with this is:
Which seems to indicate that the button_note file is not found. However this works to set it the first time around.
Checking the directory, the file exists, with the appropriate extension:
I'm unsure if related, but at one point, I did get a sigsegv crash testing this
Steps to Reproduce
From my test repo
Link to public reproduction project repository
https://github.com/jdarwood007/MauiAppIconCrash
Version with bug
8.0.92 SR9.2
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 17.5 (Simulator iPhone 14), iOS 15.8.3 (iPhone 6), iOS 18 (Simulator iPhone 16)
Did you find any workaround?
No response
Relevant log output
No response