dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.06k stars 1.73k forks source link

Maui Blazor - MacOs - Interacting with input date tag crashes the app. #22181

Closed 00000vish closed 5 months ago

00000vish commented 5 months ago

Description

Maui Blazor MacOs app is crashing when trying to select a date with the <input typ="date"> tag.

Steps to Reproduce

  1. Clone repo
  2. dotnet build -t:Run -f:net8.0-maccatalyst
  3. Try to select date

Sometimes the date selector will open up, but interacting with it or spamming few click on it will crash the app.

Link to public reproduction project repository

https://github.com/00000vish/maui-bug-report/

Version with bug

8.0.7 SR2

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

Sonoma 14.1.1

Did you find any workaround?

No workarounds

Relevant log output

Could not generate a log file.
github-actions[bot] commented 5 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Eilon commented 5 months ago

Hi @00000vish , I tried this with a plain WebView and it repros as well. So I think this is a bug in the native macOS WebView. That means that this bug should be reported directly to Apple via the Feedback Assistant app because it is outside of the control of .NET MAUI.

As a workaround you could consider using a different type of input control, or use a custom date picker control.

For reference, I tried this in a default .NET MAUI app:

  1. Create a regular .NET MAUI app
  2. Change MainPage.xaml to have only this content: <WebView x:Name="wv" />
  3. Change MainPage.xaml.cs to have this code after InitializeComponent():
        wv.Source = new HtmlWebViewSource(){
            Html = @"<HTML><BODY><H1>.NET MAUI</H1><P>Welcome to WebView <input type=""date"" value=""2024-05-02"" min=""2018-01-01"" max=""2028-01-01"" />.</P></BODY></HTML>"
        };

Run the app and try to use the date input, and it will crash.

00000vish commented 5 months ago

Hey @Eilon, thanks for looking into this! I will go ahead and report it to Apple then.

Rory-Reid commented 5 months ago

Is this a regression from previous behavior?

I can vouch for this as a "Yes", I've been using date type input controls on mac for over a year. Just picked my project back up after a hiatus having updated dotnet, maui, xcode and my OS and it no longer works due to this, I cannot work on my project atm. Not done much digging myself but this issue was the first hit on google for "maui blazor crashes when clicking date picker".

Appreciate the root cause might be in a dependency but that's still a problem for MAUI isn't it?

Edit: ah, wait, is this the culprit? https://github.com/dotnet/maui/issues/21057 Just discovered that's my version.