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.95k stars 1.7k forks source link

[Critical] Command + V and more crashes the application (macOS 13) #10842

Closed 1thenikita closed 1 year ago

1thenikita commented 1 year ago

Description

When developing my own application, I noticed a very serious bug: when I tried to copy and paste certain text, the application stalled and then crashed. I can note that when testing on Windows (version 11) everything worked fine.

Steps to Reproduce

  1. Create a File > New .NET MAUI App
  2. Add a Entry like so: <Entry Text="this is a bug" />
  3. Click the added entry, press in keyboard Command + V, Command + C, Keyboard arrows left or right (macOS system) and observe the bug 🐞

Expected result: The text insertion will be successful. Actual result: the application is slowing down/crashing.

There were no errors when trying to run this bug on Windows.

Link to public reproduction project repository

none

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

macOS

Affected platform versions

macOS 13.0 Ventura Beta (22A5373b)

Did you find any workaround?

Sadly, no.

Relevant log output

2022-10-22 22:39:46.959 BugMauiApp[29575:379247] Warning: observer object was not disposed manually with Dispose()
2022-10-22 22:39:46.959 BugMauiApp[29575:379247] Warning: observer object was not disposed manually with Dispose()
2022-10-22 22:39:51.040 BugMauiApp[29575:379239] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[<_UIObscurableTextContentStorage: 0x600001445950> offsetFromLocation:toLocation:] received invalid locations 0 (null)'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007ff80bb31cd3 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff80b68210a objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff80bb31b38 +[NSException raise:format:] + 206
    3   UIFoundation                        0x00007ff80fb8fbc0 -[NSTextContentStorage offsetFromLocation:toLocation:] + 290
    4   UIKitCore                           0x00007ff919906647 -[_UITextKit2LayoutController offsetFromPosition:toPosition:] + 234
    5   UIKitCore                           0x00007ff91a0f6430 -[UITextInputController offsetFromPosition:toPosition:] + 85
    6   UIKitCore                           0x00007ff91a104fea __91-[_UITextInputControllerTokenizer _closestTokenSubrangeForPosition:granularity:downstream:]_block_invoke + 175
    7   UIFoundation                        0x00007ff80fb67b5c -[NSTextStorage coordinateReading:] + 42
    8   UIKitCore                           0x00007ff91a104cf0 -[_UITextInputControllerTokenizer _closestTokenSubrangeForPosition:granularity:downstream:] + 412
    9   UIKitCore                           0x00007ff919d2864b -[UITextInputStringTokenizer positionFromPosition:toBoundary:inDirection:] + 100
    10  UIKitCore                           0x00007ff919c984c6 -[UIKBRTIPartner _queryUIKitDocumentRequest:completion:] + 1329
    11  UIKitCore                           0x00007ff919c96aee -[UIKBRTIPartner _queryDocumentRequest:completion:] + 159
    12  UIKitCore                           0x00007ff919c90f13 -[UIKBRTIPartner _updateRTIStateWithCompletion:] + 559
    13  UIKitCore                           0x00007ff919c8f912 -[UIKBRTIPartner updateStateWithCompletion:] + 65
    14  UIKitCore                           0x00007ff919c8ba37 -[UIKBRTIPartner documentStateChanged:] + 126
    15  UIKitCore                           0x00007ff919be8200 -[UIKeyboardImpl setDocumentState:] + 263
    16  UIKitCore                           0x00007ff919c03cbf -[UIKeyboardImpl updateKeyboardStateForDeletion] + 337
    17  UIKitCore                           0x00007ff9198c31b3 -[UIKBInputDelegateManager _deleteBackwardAndNotify:reinsertText:] + 651
    18  UIKitCore                           0x00007ff919c03b5d -[UIKeyboardImpl deleteBackwardAndNotify:reinsertText:] + 64
    19  UIKitCore                           0x00007ff919be7865 -[UIKeyboardImpl performTextOperationActionSelector:] + 1272
    20  UIKitCore                           0x00007ff919c95477 -[UIKBRTIPartner _queued_performTextOperations:resultHandler:] + 1408
    21  libdispatch.dylib                   0x00007ff80b85e7fb _dispatch_call_block_and_release + 12
    22  libdispatch.dylib                   0x00007ff80b85fa44 _dispatch_client_callout + 8
    23  libdispatch.dylib                   0x00007ff80b86c7b9 _dispatch_main_queue_drain + 952
    24  libdispatch.dylib                   0x00007ff80b86c3f3 _dispatch_main_queue_callback_4CF + 31
    25  CoreFoundation                      0x00007ff80baf844d __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    26  CoreFoundation                      0x00007ff80bab8edb __CFRunLoopRun + 2498
    27  CoreFoundation                      0x00007ff80bab7e9f CFRunLoopRunSpecific + 560
    28  HIToolbox                           0x00007ff8158eabd6 RunCurrentEventLoopInMode + 292
    29  HIToolbox                           0x00007ff8158ea806 ReceiveNextEventCommon + 199
    30  HIToolbox                           0x00007ff8158ea723 _BlockUntilNextEventMatchingListInModeWithFilter + 70
    31  AppKit                              0x00007ff80eb19b87 _DPSNextEvent + 909
    32  AppKit                              0x00007ff80eb18a08 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1219
    33  AppKit                              0x00007ff80eb0b043 -[NSApplication run] + 586
    34  AppKit                              0x00007ff80eadf0a8 NSApplicationMain + 817
    35  AppKit                              0x00007ff80ed9f6d7 _NSApplicationMainWithInfoDictionary + 16
    36  UIKitMacHelper                      0x00007ff82300ce97 UINSApplicationMain + 1413
    37  UIKitCore                           0x00007ff918f615b9 UIApplicationMain + 144
    38  libmonosgen-2.0.dylib               0x000000010e6d43b0 do_icall + 288
    39  libmonosgen-2.0.dylib               0x000000010e6d3388 do_icall_wrapper + 248
    40  libmonosgen-2.0.dylib               0x000000010e6c54d1 interp_exec_method + 3393
    41  libmonosgen-2.0.dylib               0x000000010e6c35ff interp_runtime_invoke + 239
    42  libmonosgen-2.0.dylib               0x000000010e5c20c4 mono_jit_runtime_invoke + 1220
    43  libmonosgen-2.0.dylib               0x000000010e4de2b8 mono_runtime_invoke_checked + 136
    44  libmonosgen-2.0.dylib               0x000000010e4e620c do_exec_main_checked + 92
    45  libmonosgen-2.0.dylib               0x000000010e61ea92 mono_jit_exec + 354
    46  libxamarin-dotnet-debug.dylib       0x000000010dea4b99 xamarin_main + 809
    47  BugMauiApp                          0x0000000104d99ba4 main + 52
    48  dyld                                0x00000002054fa310 start + 2432
)
libc++abi: terminating with uncaught exception of type NSException

=================================================================
    Native Crash Reporting
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

=================================================================
    Native stacktrace:
=================================================================
    0x10e6c1e85 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : mono_dump_native_crash_info
    0x10e663d6e - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : mono_handle_native_crash
    0x10e6c1782 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : sigabrt_signal_handler
    0x7ff80ba09c1d - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    0x0 - Unknown
    0x7ff80b928ca5 - /usr/lib/system/libsystem_c.dylib : abort
    0x7ff80b999082 - /usr/lib/libc++abi.dylib : abort_message
    0x7ff80b98a23d - /usr/lib/libc++abi.dylib : _ZL29demangling_unexpected_handlerv
    0x7ff80b689250 - /usr/lib/libobjc.A.dylib : _ZL15_objc_terminatev
    0x7ff80b9984a5 - /usr/lib/libc++abi.dylib : _ZSt11__terminatePFvvE
    0x7ff80b998456 - /usr/lib/libc++abi.dylib : _ZSt9terminatev
    0x7ff80b85fa58 - /usr/lib/system/libdispatch.dylib : _dispatch_client_callout
    0x7ff80b86c7b9 - /usr/lib/system/libdispatch.dylib : _dispatch_main_queue_drain
    0x7ff80b86c3f3 - /usr/lib/system/libdispatch.dylib : _dispatch_main_queue_callback_4CF
    0x7ff80baf844d - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
    0x7ff80bab8edb - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : __CFRunLoopRun
    0x7ff80bab7e9f - /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation : CFRunLoopRunSpecific
    0x7ff8158eabd6 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : RunCurrentEventLoopInMode
    0x7ff8158ea806 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : ReceiveNextEventCommon
    0x7ff8158ea723 - /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox : _BlockUntilNextEventMatchingListInModeWithFilter
    0x7ff80eb19b87 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : _DPSNextEvent
    0x7ff80eb18a08 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]
    0x7ff80eb0b043 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : -[NSApplication run]
    0x7ff80eadf0a8 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : NSApplicationMain
    0x7ff80ed9f6d7 - /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit : _NSApplicationMainWithInfoDictionary
    0x7ff82300ce97 - /System/Library/PrivateFrameworks/UIKitMacHelper.framework/Versions/A/UIKitMacHelper : UINSApplicationMain
    0x7ff918f615b9 - /System/iOSSupport/System/Library/PrivateFrameworks/UIKitCore.framework/Versions/A/UIKitCore : UIApplicationMain
    0x10e6d43b0 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : do_icall
    0x10e6d3388 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : do_icall_wrapper
    0x10e6c54d1 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : interp_exec_method
    0x10e6c35ff - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : interp_runtime_invoke
    0x10e5c20c4 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : mono_jit_runtime_invoke
    0x10e4de2b8 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : mono_runtime_invoke_checked
    0x10e4e620c - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : do_exec_main_checked
    0x10e61ea92 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libmonosgen-2.0.dylib : mono_jit_exec
    0x10dea4b99 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MonoBundle/libxamarin-dotnet-debug.dylib : xamarin_main
    0x104d99ba4 - /Users/nik-801/Developer/Rider/BugMauiApp/BugMauiApp/bin/Debug/net6.0-maccatalyst/maccatalyst-x64/BugMauiApp.app/Contents/MacOS/BugMauiApp : main
    0x2054fa310 - Unknown

=================================================================
    Telemetry Dumper:
=================================================================
Pkilling 0x13128519680x from 0x8679686848x
Pkilling 0x13126410240x from 0x8679686848x
Could not exec mono-hang-watchdog, expected on path '/Users/runner/work/1/s/artifacts/obj/mono/MacCatalyst.x64.Release/out/etc/../bin/mono-hang-watchdog' (errno 2)
Entering thread summarizer pause from 0x8679686848x
Finished thread summarizer pause from 0x8679686848x.
Failed to create breadcrumb file (null)/crash_hash_0x29e26bbc7a

Waiting for dumping threads to resume

=================================================================
    Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x7ff80b9a730e):0x7ff80b9a72fe  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
0x7ff80b9a730e  73 08 48 89 c7 e9 aa 9a ff ff c3 90 90 90 b8 53  s.H............S
0x7ff80b9a731e  00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 92 9a  ...I....s.H.....
0x7ff80b9a732e  ff ff c3 90 90 90 b8 83 01 00 02 49 89 ca 0f 05  ...........I....

=================================================================
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at UIKit.UIApplication:UIApplicationMain <0x0019e>
      at UIKit.UIApplication:Main <0x00106>
      at BugMauiApp.Program:Main <0x00016>
      at <Module>:runtime_invoke_direct_void_string[] <0x00074>
      at <unknown> <0x00000>
=================================================================
drasticactions commented 1 year ago

I think you're running an older workload / runtime build, that issue should be fixed https://github.com/dotnet/maui/issues/10194

Did you try updating to the newest release of net6 / net7?

(It also isn't a MAUI issue, but a Mac/iOS one)

1thenikita commented 1 year ago

Did you try updating to the newest release of net6 / net7?

I installed all the environments, including .NET, about a week ago. I currently have .NET 6 installed.

1thenikita commented 1 year ago

(It also isn't a MAUI issue, but a Mac/iOS one)

What I mean to say is that this is a problem on the side of the macOS library for MAUI.

drasticactions commented 1 year ago

(It also isn't a MAUI issue, but a Mac/iOS one)

What I mean to say is that this is a problem on the side of the macOS library for MAUI.

It's not. As far as I know, this is specifically an issue with the .NET for macOS SDK, not MAUI (The UI Framework, or what's in this repo). That's why I linked to the Xamarin/MaciOS repo. Those should be the underlying issues.

Did you try updating to the newest release of net6 / net7?

I installed all the environments, including .NET, about a week ago. I currently have .NET 6 installed.

When you run dotnet workload list from the command line, what is listed?

ghost commented 1 year ago

Hi @1thenikita. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost commented 1 year ago

Hi @1thenikita. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

ghost commented 1 year ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

rmarinho commented 1 year ago

Please test with the latest 7.0.100-rc2 to see if this is still a issue.

Thanks

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

1thenikita commented 1 year ago

When you run dotnet workload list from the command line, what is listed?

Снимок экрана 2022-10-29 в 15 30 00
1thenikita commented 1 year ago

Has that been fixed?

MSicc commented 1 year ago

Has that been fixed?

@1thenikita just tested with both .NET6 MAUI and .NET7 MAUI. .NET6 still crashes, .NET7 works.

With .NET6 being LTS, this should be fixed in there as well.

I ran a dotnet workload update just before testing.

ghost commented 1 year ago

Hello lovely human, thank you for your comment on this issue. Because this issue has been closed for a period of time, please strongly consider opening a new issue linking to this issue instead to ensure better visibility of your comment. Thank you!