我有一个在WPF中使用拼写检查的应用程序。在大多数情况下,它运行良好,但是我有一些用户会遇到如下异常:
Retrieving the COM class factory for component with CLSID {7AB36653-1796-484B-BDFA-E74F1DB7C1DC} failed due to the following error: 8007045a A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)...
这是堆栈:
at MS.Internal.ReaderWriterLockSlimWrapper.ExecuteWithinLockInternal(Action lockAcquire, Action lockRelease, Object& result, Delegate criticalAction, Object[] args)
at MS.Internal.ReaderWriterLockSlimWrapper.WithWriteLock[T1,T2,TResult](Func`3 criticalAction, T1 arg1, T2 arg2, TResult& result)
at System.Windows.Documents.MsSpellCheckLib.SpellCheckerFactory.Create(Boolean shouldSuppressCOMExceptions)
at System.Windows.Documents.WinRTSpellerInterop..ctor()
at System.Windows.Documents.SpellerInteropBase.CreateInstance()
at System.Windows.Documents.Speller.EnsureInitialized()
at System.Windows.Documents.Speller.SetCustomDictionaries(CustomDictionarySources dictionaryLocations, Boolean add)
at System.Windows.Documents.TextEditor.SetCustomDictionaries(Boolean add)
at System.Windows.Controls.SpellCheck.OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.Controls.TextBox.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
at RDES.KeynoteManager.KMCore.KeynoteData.UC_KeynoteFile.TextBox_Loaded(Object sender, RoutedEventArgs e)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Interop.HwndTarget.OnResize()
at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
我在注册表中查找了该密钥,该密钥位于Computer \ HKEY_CLASSES_ROOT \ Wow6432Node \ CLSID {7AB36653-1796-484B-BDFA-E74F1DB7C1DC} \ InProcServer32下,默认密钥映射到C:\ Windows \ SysWOW64 \ MsSpellCheckingFacility .dll。
从堆栈上看,当在文本框中将拼写检查设置为启用时,这似乎也失败了。可以在应用程序中启用两种模式的拼写检查,以下是发生这种情况的代码行:
tbSpell.SpellCheck.IsEnabled =
KMApplication.Settings.ForceSpellingMode != SpellChecker.SpellingModes.None;
和
var bnd = new Binding("EnableSpelling");
tb.SetBinding(SpellCheck.IsEnabledProperty, bnd);
我正在运行的操作系统和获得此异常的最新用户的操作系统均为Win 10 x64。是什么原因导致这似乎随机失败了?