dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
6.84k stars 1.13k forks source link

WPF TextBox输入时崩溃了 #9056

Closed yeqilve closed 3 weeks ago

yeqilve commented 3 weeks ago

Description

报错堆栈 ---- Assert Short Message ---- Invariant failure: ---- Assert Long Message ----

at MS.Internal.Invariant.FailFast(String message, String detailMessage) at MS.Internal.Invariant.Assert(Boolean condition) at System.Windows.Documents.TextStore.UpdateCompositionText(FrameworkTextComposition composition) at System.Windows.Documents.TextStore.RaiseCompositionEvents(Int32& appSelectionAnchorOffset, Int32& appSelectionMovingOffset) at System.Windows.Documents.TextStore.HandleCompositionEvents(Int32 previousUndoCount) at System.Windows.Documents.TextStore.GrantLockWorker(LockFlags flags) at System.Windows.Documents.TextStore.RequestLock(LockFlags flags, Int32& hrSession) at MS.Win32.UnsafeNativeMethods.ITfMessagePump.GetMessageW(MSG& msg, IntPtr hwnd, Int32 msgFilterMin, Int32 msgFilterMax, Int32& result) at MS.Win32.UnsafeNativeMethods.ITfMessagePump.GetMessageW(MSG& msg, IntPtr hwnd, Int32 msgFilterMin, Int32 msgFilterMax, Int32& result) at System.Windows.Threading.Dispatcher.GetMessage(MSG& msg, IntPtr hwnd, Int32 minMessage, Int32 maxMessage) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at WpfApp1.App.Main()

Reproduction Steps

重现方式 window.xaml

window.cs public MainWindow() { InitializeComponent(); test.Text = "1234\n123441"; test.SelectAll(); test.Focus(); }

mainwindow 展示的时候 输入任意字符 就crash了

去掉selectAll 就正常了

Expected behavior

Actual behavior

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response

miloush commented 3 weeks ago

Possibly duplicate of #7304?

yeqilve commented 3 weeks ago

Possibly duplicate of #7304?

yes