maui: Accessing string resource throws a false FileNotFoundException in Android

Description

The first time any string resource is accessed in Android, this exception is thrown by the resource manager: System.IO.FileNotFoundException: ‘’

This does not break any functionality and can be ignored, but creates a developer experience problem. Developers who rely on exception trapping to detect runtime issues will find the feed to be polluted and may ignore real issues.

Steps to Reproduce

New MAUI App Enable Break When Thrown (Ctrl+Alt+E) ->All Common Language Runtime Exceptions Project properties->Resources->General->Create or open assembly resources New String resource {“Name”:“AResource”, “Value”:“A resource”} image

Open MainPage.xaml.cs Add this line to OnCounterClicked: System.Diagnostics.Debug.WriteLine(Properties.Resources.AResource);

Build and run on Android. Tap the button, and the exception described above will be thrown.

Version with bug

Release Candidate 3 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 12

Did you find any workaround?

Disable Break When Thrown->[System.Exception, System.IO.FileNotFoundException, System.IO.IOException, System.SystemException].

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 23 (9 by maintainers)

Most upvoted comments

@hlavli I think the workaround is to prevent the debugger from breaking on certain exceptions:

1.) Disabling the exception doesn’t work and 2.) this is a terrible exception to disable.

@jonathanpeppers can this be closed, then?

There is a problem with Fast Deployment, where files like en-US/MyLibrary.resources.dll aren’t deployed properly.

Should be fixed in: