gpt4 book ai didi

c# - 调用 COM 组件返回错误 HRESULT E_FAIL

转载 作者:行者123 更新时间:2023-11-28 08:08:56 29 4
gpt4 key购买 nike

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

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

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

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetFileDocData(String fileName, FileAccess access, String createTemplate, Boolean addToHostList, Boolean nestedItem) at Microsoft.VisualStudio.Shell.Design.Serialization.DesignerDocDataService.GetChildDocData(String name, FileAccess access, String createTemplate) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.GetResourceDocData(CultureInfo info, FileAccess access) at Microsoft.VisualStudio.Design.Serialization.CodeDom.VSCodeDomDesignerLoader.System.ComponentModel.Design.IResourceService.GetResourceReader(CultureInfo info) at System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadata() at System.ComponentModel.Design.Serialization.ResourceCodeDomSerializer.SerializationResourceManager.GetMetadataEnumerator() at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertiesFromResources(IDesignerSerializationManager manager, Object value, Attribute[] filter) 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)

最佳答案

要在 VS2013 ultimate 中解决这个问题,我必须关注帖子 http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

其中讨论了简单地清除 Visual Studio 的 ItemTemplateCache 并使用/setup 标志运行 vs 一次。

如果链接断开或不可用,这里是旧 VS 的缓存所在的位置:

You can delete the project cache at "Program Files\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplatesCache", then run "devenv /setup" to build the cache again to see if it helps.

关于c# - 调用 COM 组件返回错误 HRESULT E_FAIL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9570018/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com