WPF Spell Check Causes Exceptions on Some Machines

1

I have an application using spell checking in WPF. For the most part it works great but I have some users that get exceptions like:

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)...

Here is the stack:

   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)

I looked up that key in my registry and it is under Computer\HKEY_CLASSES_ROOT\Wow6432Node\CLSID{7AB36653-1796-484B-BDFA-E74F1DB7C1DC}\InProcServer32 and the default key is mapped to C:\Windows\SysWOW64\MsSpellCheckingFacility.dll.

Also from the stack, it seems to be failing when spell check is set to enabled on the textbox. There are two modes that spell check can be enabled in the application, here are the code lines where that happens:

tbSpell.SpellCheck.IsEnabled =
                    KMApplication.Settings.ForceSpellingMode != SpellChecker.SpellingModes.None;

and

var bnd = new Binding("EnableSpelling");
tb.SetBinding(SpellCheck.IsEnabledProperty, bnd);

The OS that I'm running and the OS of the latest user to get this exception are both Win 10 x64. What could be causing this to fail seemingly at random?

c#
wpf
com
spell-checking
asked on Stack Overflow Jan 15, 2019 by sfaust • edited Jan 15, 2019 by sfaust

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0