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

时间:2012-03-05 16:14:28

标签: c# c++ com

我有一个C ++调用C#表单。它似乎工作正常。 但是,当我打开C#项目表单设计器时,会弹出以下错误消息。 可能有什么不对。构建的解决方案运行良好。

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

Instances of this error (1)  
  1. 隐藏调用堆栈
  2.   

    at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode,IntPtr errorInfo)   在System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)   在Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName,FileAccess access,String createTemplate,Boolean addToHostList,Boolean nestedItem)   在Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetChildDocData(String name,FileAccess access,String createTemplate)   在Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.GetResourceDocData(CultureInfo info,FileAccess访问)   在Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.System.ComponentModel.Design.IResourceService.GetResourceReader(CultureInfo info)   在System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadata()   在System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadataEnumerator()   在System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources(IDesignerSerializationManager manager,Object value,Attribute [] filter)   在System.ComponentModel.Design.Serialization.TypeCodeDomSerializer.Deserialize(IDesignerSerializationManager manager,CodeTypeDeclaration declaration)   在System.ComponentModel.Design.Serialization.CodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager manager)   在Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.PerformLoad(IDesignerSerializationManager serializationManager)   在Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.DeferredLoadHandler.Microsoft.VisualStudio.TextManager.Interop.IVsTextBufferDataEvents.OnLoadCompleted(Int32 fReload)

1 个答案:

答案 0 :(得分:1)

要在VS2013终极版中修复此问题,我必须关注帖子http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

其中只讨论清理Visual Studio的ItemTemplateCache并使用/ setup标志运行vs。

如果链接断开或者在此处不可用,那么缓存曾用于较旧的VS:

  

您可以在“Program Files \ Microsoft Visual”中删除项目缓存   Studio 10.0 \ Common7 \ IDE \ ProjectTemplatesCache“,然后运行”devenv   / setup“再次构建缓存以查看它是否有帮助。