visual studio 随机崩溃 devenv KERNELBASE.dll

visual studio crashes randomly devenv KERNELBASE.dll

我的 Visual Studio 随机崩溃。事件查看器显示以下错误

Faulting application name: devenv.exe, version: 12.0.40629.0, time stamp: 0x5590c8a4

Faulting module name: KERNELBASE.dll, version: 10.0.15063.674, time stamp: 0x6d16dd24

Exception code: 0xe0434352

Fault offset: 0x000eb872

Faulting process id: 0x3b00

Faulting application start time: 0x01d34ecf7a049150

Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.exe

Faulting module path: C:\Windows\System32\KERNELBASE.dll

Report Id: xxxxxxxx-867c-4c54-b259-c28a7b9d8151

Faulting package full name: Faulting package-relative application ID:

我已经在 (C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE)

尝试了 运行 devenv /SAFEMODE 命令

但它仍然不断发生,有时还会出现一个对话框“可用存储空间不足

Application: devenv.exe

Framework Version: v4.0.30319

Description: The process was terminated due to an unhandled exception.

Exception Info: System.ComponentModel.Win32Exception at MS.Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D)

Activity日志

(0x80004005): 没有足够的存储空间来处理这个命令

女士Win32.UnsafeNativeMethods.RegisterClassEx(WNDCLASSEX_D wc_d)

at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)

在System.Windows.Interop.HwndSource.Initialize(HwndSourceParameters 参数)

在System.Windows.Interop.HwndSource..ctor(HwndSourceParameters参数)

at System.Windows.Controls.Primitives.Popup.PopupSecurityHelper.BuildWindow(Int32 x, Int32 y, Visual placementTarget, Boolean transparent, HwndSourceHook hook, AutoResizedEventHandler handler)

at System.Windows.Controls.Primitives.Popup.BuildWindow(Visual targetVisual)

在System.Windows.Controls.Primitives.Popup.CreateWindow(布尔异步调用)

在System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs 参数)

在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex、DependencyProperty dp、PropertyMetadata 元数据、EffectiveValueEntry oldEntry、EffectiveValueEntry& newEntry、布尔 coerceWithDeferredReference、布尔 coerceWithCurrentValue、OperationType operationType)

在 System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp、对象值、PropertyMetadata 元数据、布尔 coerceWithDeferredReference、布尔 coerceWithCurrentValue、OperationType operationType、布尔 isInternal)

在System.Windows.DependencyObject.SetValue(DependencyProperty dp,对象值)

在 Microsoft.VisualStudio.Language.Intellisense.Implementation.MouseTrackingQuickInfoPresenter.Render()

在Microsoft.VisualStudio.Language.Intellisense.Implementation.IntellisenseSessionStack.OnSessionPresenterChanged(对象发送者,EventArgs e)

在 Microsoft.VisualStudio.Language.Intellisense.Implementation.IntellisenseSession.RaisePresenterChanged()

在 Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Recalculate()

在 Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoSession.Start()

at Microsoft.VisualStudio.Language.Intellisense.Implementation.QuickInfoBroker.TriggerQuickInfo(ITextView 文本视图、ITrackingPoint triggerPoint、布尔 trackMouse)

at Microsoft.Html.Editor.HtmlQuickInfoController.OnMouseHover(对象发送者,MouseHoverEventArgs e)

在 Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.RaiseHoverEvents()

更新

我的应用程序在 安全模式 中运行一次或两次,然后甚至退出。尝试重新启动 visual studio 时失败。然后事件查看器或 cmd 提示不起作用,我必须重新启动我的机器才能工作。

更新 2

看来 this and 是我的问题。现在如何在我的代码中使用 Dispatcher?

public string ConvertRtfToHtml(string rtfText)
    {

        try
        {
            var thread = new Thread(ConvertRtfInSTAThread);                
            var threadData = new ConvertRtfThreadData { RtfText = rtfText };
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start(threadData);

            try
            {
                thread.Join();
            }
            catch(ThreadStateException e){
                logger.Error("ThreadStateException " + e.Message);
            }
            catch (ThreadInterruptedException e) {
                logger.Error("ThreadInterruptedException " + e.Message);
            }                


            return threadData.HtmlText;

        }
        catch (Exception e){
            logger.Error("ConvertRtfToHtml: " + e.InnerException.Message);
            return "Error";
        }

    }

正在循环中调用 ConvertRtfToHtml ConvertRtfInSTAThread 使用 RichTextBox 控件

经过大量试验和错误后,我发现根本原因是 this. 是我的实现。