Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Null reference exception on iOS when using TryGetWellKnownFolderAsync #14617

Closed
dfernandezramos opened this issue Feb 15, 2024 · 0 comments · Fixed by #14677
Closed

Null reference exception on iOS when using TryGetWellKnownFolderAsync #14617

dfernandezramos opened this issue Feb 15, 2024 · 0 comments · Fixed by #14677

Comments

@dfernandezramos
Copy link

dfernandezramos commented Feb 15, 2024

Describe the bug

Obtaining the application storage provider and then calling TryGetWellKnownFolderAsync method leads to an unhandled exception when running on iOS.

To Reproduce

Steps to reproduce the behavior:

  1. Clone the example repository [email protected]:LongoMatch/AvaloniaiOSGetFolderError.git
  2. Run the iOS application
  3. Click on the button that appears in the center of the screen
  4. See the error

Expected behavior

The method should return the well known directory or null in case it does not exist. Without crashing.

Environment

  • OS: iOS 17.2
  • Avalonia-Version: 11.0.9

Additional context

System.ArgumentNullException: Value cannot be null. (Parameter 'url')
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at AvaloniaApplication1.iOS.Application.Main(String[] args) in /Users/dfernandez/Development/AvaloniaApplication1/AvaloniaApplication1/AvaloniaApplication1.iOS/Main.cs:line 12
2024-02-15 12:22:59.319744+0100 AvaloniaApplication1.iOS[45672:357451] Unhandled managed exception: Value cannot be null. (Parameter 'url') (System.ArgumentNullException)
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle)
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName)
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass)
   at AvaloniaApplication1.iOS.Application.Main(String[] args) in /Users/dfernandez/Development/AvaloniaApplication1/AvaloniaApplication1/AvaloniaApplication1.iOS/Main.cs:line 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants