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
21.87k stars 1.68k forks source link

Annoying exceptions when debugging (but which are swallowed at runtime) #19758

Open hansmbakker opened 6 months ago

hansmbakker commented 6 months ago

Description

System.IO.FileNotFoundException: File name: 'System.Private.Xml.resources'

is thrown always and

System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'

are thrown when using <Frame>. Even though they are normally caught at runtime, this is very annoying

Potentially related issues that were closed without being solved: #7566 and #8197

Steps to Reproduce

  1. Create a new Maui app for Android
  2. Add a <Frame> element, e.g. on the MainPage (for the System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer')
  3. Add a handler for FirstChangeExceptions
  4. Set a breakpoint in the FirstChangeException handler

The FirstChangeException handler is triggered by

System.IO.FileNotFoundException: File name: 'System.Private.Xml.resources'

and

System.MissingMethodException: No parameterless constructor defined for type 'Microsoft.Maui.Controls.Handlers.Compatibility.FrameRenderer'

Link to public reproduction project repository

https://github.com/hansmbakker/framerenderer-bugrepro

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

Android

Affected platform versions

No response

Did you find any workaround?

No. The issue is that I want to setup global error handling which Microsoft has no clear documentation for that in the context of MAUI. See https://github.com/dotnet/maui/discussions/653. I created https://github.com/dotnet/maui/issues/19761 for that.

Relevant log output

No response

XamlTest commented 5 months ago

Verified this on Visual Studio Enterprise 17.9.0 Preview 5(8.0.3). Repro on Android 14.0-API34, not repro on Windows 11, iOS 17.2 and MacCatalyst with below Project: framerenderer-bugrepro.zip