Exception:调用线程无法访问此对象,因为另一个线程拥有该对象。

报错信息 1
InvalidOperationException: 调用线程无法访问此对象,因为另一个线程拥有该对象。
StackTrace:
   在 System.Windows.Threading.Dispatcher.VerifyAccess()
   在 System.Windows.Freezable.CloneCoreCommon(Freezable sourceFreezable, Boolean useCurrentValue, Boolean cloneFrozenValues)
   在 System.Windows.Media.Animation.Timeline.GetCurrentValueAsFrozenCore(Freezable sourceFreezable)
   在 System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames.GetCurrentValueAsFrozenCore(Freezable source)
   在 System.Windows.Freezable.GetCurrentValueAsFrozen()
   在 System.Windows.Media.Animation.Clock..ctor(Timeline timeline)
   在 System.Windows.Media.Animation.AnimationTimeline.AllocateClock()
   在 System.Windows.Media.Animation.Clock.AllocateClock(Timeline timeline, Boolean hasControllableRoot)
   在 System.Windows.Media.Animation.Clock.BuildClockTreeFromTimeline(Timeline rootTimeline, Boolean hasControllableRoot)
   在 System.Windows.Documents.CaretElement.SetBlinkAnimation(Boolean visible, Boolean positionChanged)
   在 System.Windows.Documents.CaretElement.Update(Boolean visible, Rect caretRectangle, Brush caretBrush, Double opacity, Boolean italic, CaretScrollMethod scrollMethod, Double scrollToOriginPosition)
   在 System.Windows.Documents.TextSelection.UpdateCaretStateWorker(Object o)
   在 System.Windows.Documents.TextSelection.EnsureCaret(Boolean isBlinkEnabled, Boolean isSelectionActive, CaretScrollMethod scrollMethod)
   在 System.Windows.Documents.TextSelection.System.Windows.Documents.ITextSelection.UpdateCaretAndHighlight()
   在 System.Windows.Controls.Primitives.TextBoxBase.OnLostFocus(RoutedEventArgs e)
   在 System.Windows.UIElement.IsFocused_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.Controls.TextBox.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   在 System.Windows.DependencyObject.ClearValueCommon(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata)
   在 System.Windows.DependencyObject.ClearValue(DependencyPropertyKey key)
   在 System.Windows.Input.FocusManager.OnFocusedElementChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   在 System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   在 System.Windows.Input.FocusManager.SetFocusedElement(DependencyObject element, IInputElement value)
   在 System.Windows.FrameworkElement.OnPresentationSourceChanged(Boolean attached)
   在 System.Windows.PresentationSource.RootChanged(Visual oldRoot, Visual newRoot)
   在 System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
   在 System.Windows.Window.SourceWindowHelper.ClearRootVisual()
   在 System.Windows.Window.CloseWindowFromWmClose()
   在 System.Windows.Window.WmClose()
   在 System.Windows.Window.WindowFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   在 MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

版本:1.43.43 2024-11-10 21:50 Microsoft Windows NT 10.0.19045.0
报错信息 2
InvalidOperationException: 调用线程无法访问此对象,因为另一个线程拥有该对象。
StackTrace:
   在 System.Windows.Threading.Dispatcher.VerifyAccess()
   在 MS.Internal.Media.VisualTreeUtils.AsVisual(DependencyObject element, Visual& visual, Visual3D& visual3D)
   在 System.Windows.Media.VisualTreeHelper.GetParent(DependencyObject reference)
   在 System.Windows.UIElement.GetUIParentWithinLayoutIsland()
   在 System.Windows.ContextLayoutManager.LayoutQueue.Add(UIElement e)
   在 System.Windows.UIElement.InvalidateArrange()
   在 System.Windows.Controls.ScrollViewer.EnqueueCommand(Commands code, Double param, MakeVisibleParams mvp)
   在 System.Windows.Controls.ScrollViewer.ScrollToEnd()
   在 DynamicClass.<Chat>d__92.MoveNext()
--- 引发异常的上一位置中堆栈跟踪的末尾 ---
   在 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   在 System.Threading.ThreadPoolWorkQueue.Dispatch()

版本:1.43.29 2024-10-18 14:16 Microsoft Windows NT 10.0.19044.0