xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] [iOS] AppCrash with Hot Restart and MaterialFrameRenderer when showing Frame #13067

Open thisismyself opened 3 years ago

thisismyself commented 3 years ago

[iOS] AppCrash with Hot Restart and MaterialFrameRenderer when showing Frame

Steps to Reproduce

  1. Create an iOS App using Xamarin.Forms, Xamarin.Forms.Visual.Material and Xamarin.iOS.MaterialComponents
  2. Compile in Visual Studio on Windows, deploy to iPhone using Xamarin Hot Restart
  3. Start App from Debugger

Expected Behavior

App starts on the iPhone and uses Material Design.

Actual Behavior

App crashes when Frame should be shown for the first time.

Debug Output:

2020-12-07 10:27:43.906 Xamarin.PreBuilt.iOS[378:13019] NSForwarding: warning: object 0x281e89d70 of class 'Xamarin_Forms_Material_iOS_MaterialFrameRenderer' does not implement methodSignatureForSelector: -- trouble ahead 2020-12-07 10:27:43.907 Xamarin.PreBuilt.iOS[378:13019] NSForwarding: warning: object 0x281e89d70 of class 'Xamarin_Forms_Material_iOS_MaterialFrameRenderer' does not implement doesNotRecognizeSelector: -- abort

Obviously, class MaterialFrameRenderer does not implement the NSObject of iOS.

Basic Information

Environment

Visual Studio: Visual Studio 2019 (16.8.2)

Reproduction Link

Just take the offical sample on Visuals. Compile and deploy using Xamarin Hot Restart. Start the App and Navigate to Cards. App crashes. When you set Visual="Default" on all Frames in CardPage.xaml, Rendering is done in Default Visual and does not crash. https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/userinterface-visualdemos/

Workaround

Do not use Material Renderer on Frame element (removed Visual="Material" from Frame or change to Default).

PureWeen commented 3 years ago

Hot Restart doesn't work if you are using the Material libraries . I forget the specifics but I've assigned to that team to see if they have additional work towards making that work

@mauroa ?

michaldivis commented 3 years ago

I've also been having this issue since I've started using Hot Restart. It still doesn't work in Xamarin.Forms 5.0.0.1874.

omiimo commented 3 years ago

Having same issue. Can't use material with iOS hot restart. App crashes. :(

qz2rg4 commented 2 years ago

I am having the same issue vS 2019 and VS 2022

Xamarin.Forms 5.0.0.224 and Xamarin.Forms.Visual.Material 5.0.0.224

qz2rg4 commented 2 years ago

@PureWeen @thisismyself Did you find a solution to this problem?