本文介绍了SEHException未处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个vs2010 C#解决方案,昨天运行良好.

I have a vs2010 c# solution that was working fine yesterday.

今天,当我尝试运行调试实例时,始终收到未处理的 SEHException .

When I try and run a debug instance today I keep getting an SEHException was unhandled.

启动表单的 InitializeComponent 方法中引发了此错误.

This error is being thrown in the InitializeComponent method of the startup form.

有什么想法吗?

这是堆栈跟踪:

System.Runtime.InteropServices.SEHException was unhandled
  Message=External component has thrown an exception.
  Source=System.Drawing
  ErrorCode=-2147467259
  StackTrace:
       at System.Drawing.SafeNativeMethods.Gdip.GdipCreateFontFromLogfontW(HandleRef hdc, Object lf, IntPtr& font)
       at System.Drawing.Font.FromLogFont(Object lf, IntPtr hdc)
       at System.Drawing.Font.FromHfont(IntPtr hfont)
       at System.Drawing.SystemFonts.get_DefaultFont()
       at System.Windows.Forms.Control.get_DefaultFont()
       at System.Windows.Forms.Control.GetDefaultFontHandleWrapper()
       at System.Windows.Forms.Control.get_FontHandle()
       at System.Windows.Forms.ContainerControl.GetFontAutoScaleDimensions()
       at System.Windows.Forms.ContainerControl.get_CurrentAutoScaleDimensions()
       at System.Windows.Forms.ContainerControl.get_AutoScaleFactor()
       at System.Windows.Forms.ContainerControl.PerformAutoScale(Boolean includedBounds, Boolean excludedBounds)
       at System.Windows.Forms.ContainerControl.PerformNeededAutoScaleOnLayout()
       at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
       at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
       at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
       at System.Windows.Forms.ContainerControl.LayoutScalingNeeded()
       at System.Windows.Forms.ContainerControl.set_AutoScaleMode(AutoScaleMode value)
       at FirstWindow.Form1.InitializeComponent() in C:\Users\Ash\Documents\Visual Studio 2010\Projects\FrameworkClientV2 - No Security\FirstWindow\Form1.designer.cs:line 32
       at FirstWindow.Form1..ctor() in C:\Users\Ash\Documents\Visual Studio 2010\Projects\FrameworkClientV2 - No Security\FirstWindow\Form1.cs:line 27
       at FirstWindow.Program.Main() in C:\Users\Ash\Documents\Visual Studio 2010\Projects\FrameworkClientV2 - No Security\FirstWindow\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

昨晚我的女友突然打破了笔记本电脑的屏幕,所以我在外部显示器上运行...这可能与它有什么关系吗?

On a random note my gf broke my laptop screen last night so Im running on an external monitor... could this have anything to do with it?

这是代码和错误的行.

private void InitializeComponent()
{
    this.components = new System.ComponentModel.Container();
    ///////////////////The line below throws the exception
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    /////////////////////////////// 
    this.Text = "Form1";
}

推荐答案

这可能与昨天开始广泛报道的问题相同.见

This might be the same as the widely reported issue that started occurring yesterday. See

http://forums.asp.net/t/1704958.aspx/9/10?Re+SEHException+throw+when+I+run+the+application

http://social.msdn.microsoft.com/Forums/zh-CN/csharpgeneral/thread/0f78401b-77b2-4052-a26a-e98d2ec0afa9

如果您的计算机上装有"Trusteer Rapport",请尝试将其卸载

Try uninstalling "Trusteer Rapport" if you have it on your machine

这篇关于SEHException未处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 03:49