错误HRESULT E_FAIL已从调用COM组件返回。

时间:2017-09-19 11:38:06

标签: c# winforms visual-studio-2017

这不是重复,我没有时间研究这个并尝试了一切,我发现的任何线程和答案都不是VS2017

设计师错误

我正在使用VS2017,我正在使用的项目模板是一个winforms控件库

输出:

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.LookupTypeSymbol()
at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.CodeTypeRef.get_TypeKind()
at EnvDTE.CodeTypeRef.get_TypeKind()
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.GetUrtTypeFromVsType(CodeTypeRef vsType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomParser.OnTypePopulateMembers(Object sender, EventArgs e)
at System.CodeDom.CodeTypeDeclaration.get_Members()
at System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager, CodeTypeDeclaration declaration)
at System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload) 

我尝试过的事情 - 找到项目和项目模板并删除它们 - 找到项目和项目模板缓存并删除它们 - 将所有设置重置为默认值 - 删除对外部库和控件的所有引用 - 更新VS. - 更多我忘记了

错误只出现在我当前的项目中,相当大,只出现错误的是VS设计师,我也注意到当我构建项目时,自定义控件在设计器视图中不会更新,即使我对任何一个进行更改我的课程,在项目运行之前不会发生任何变化

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:0)

我决定创建一个新项目并将我的所有类添加到项目中,在构建时我收到一个之前没有出现的错误,"无法将大小转换为bool",这是通过创建抛出的一个新的位图

Bitmap _bg = new Bitmap(BackgroundImage, new Size(Width, Height));

我不知道为什么它会让我构建以前的项目,但我决定创建一个新的位图(宽度,高度)并使用图形来绘制图像。

似乎这可能是导致错误的原因

相关问题