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

Entry / Editor Crashes When Focussed #108

Closed
Axemasta opened this issue Apr 9, 2024 · 4 comments
Closed

Entry / Editor Crashes When Focussed #108

Axemasta opened this issue Apr 9, 2024 · 4 comments

Comments

@Axemasta
Copy link

Axemasta commented Apr 9, 2024

If you add an Entry / Editor to a BottomSheet on iOS, shortly after focussing the control there is a crash:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.AdjustPosition()
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.AdjustPositionDebounce()
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.DidUITextBeginEditing(NSNotification notification)
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at KeyboardAutoScrollRepro.Program.Main(String[] args) in /Users/axemasta/Documents/Dev/Projects/Maui/KeyboardAutoScrollRepro/KeyboardAutoScrollRepro/Platforms/iOS/Program.cs:line 13
2024-04-09 14:25:19.623589+0100 KeyboardAutoScrollRepro[88641:22091147] Unhandled managed exception: Object reference not set to an instance of an object. (System.NullReferenceException)
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.AdjustPosition()
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.AdjustPositionDebounce()
   at Microsoft.Maui.Platform.KeyboardAutoManagerScroll.DidUITextBeginEditing(NSNotification notification)
   at ObjCRuntime.Runtime.ThrowException(IntPtr gchandle) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:line 2594
   at UIKit.UIApplication.UIApplicationMain(Int32 argc, String[] argv, IntPtr principalClassName, IntPtr delegateClassName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 60
   at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:line 94
   at KeyboardAutoScrollRepro.Program.Main(String[] args) in /Users/axemasta/Documents/Dev/Projects/Maui/KeyboardAutoScrollRepro/KeyboardAutoScrollRepro/Platforms/iOS/Program.cs:line 13

This is a crash from within Maui however I thought I would document on this project, since the issue only happens when using a bottom sheet.

The crash only happens when the page invoking the bottom sheet is a modal.

I have a public reproduction here and have raised the issue with maui so hopefully they can help get a fix.

@SimonBrettschneider
Copy link

I am facing the same issue. @Axemasta Did you find a solution or a workaround?

@Axemasta
Copy link
Author

Did you find a solution or a workaround?

The only workaround I found is to not use modal pages, which doesn't really work for the apps I'm building!

I raised a PR on maui and i believe its going to be merged & included as part of .NET 8 SR5 since it was a bug in the Maui SDK causing this crash.

@SimonBrettschneider
Copy link

Did you find a solution or a workaround?

The only workaround I found is to not use modal pages, which doesn't really work for the apps I'm building!

I raised a PR on maui and i believe its going to be merged & included as part of .NET 8 SR5 since it was a bug in the Maui SDK causing this crash.

Thank you - I am looking forward to the fix :-)

@Axemasta
Copy link
Author

This is fixed with Maui 8.0.40 SR5, I've tested with my app and the crash no longer happens 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants