3

在过去的几年里,我有很多使用 C++/CLI 的经验,如果我知道一件事,那就是混合模式 DLL 不利于设计。

我有一个 CSPROJECT 项目,它依赖于 CPPPROJECT(使用项目参考,copylocal=true,versionspecific=false,copylocalsattelitedpeendances=false)。

每当我尝试从 CSPROJECT 打开表单或用户控件时,我都会得到:system.exception被抛出。

我试过 fuslogvw,它不会将任何故障绑定到磁盘。我尝试打开第二个 devenv 进行调试,但它只是在设计器在其调用堆栈中显示的同一位置中断。这是我的 CPPPROJECT 参考的 csproj 片段:

<ProjectReference Include="..\dfResultsStructures\dfResultsStructures.csproj">
  <Project>{D93C5625-0EB1-4645-95C8-F389758521EE}</Project>
  <Name>dfResultsStructures</Name>
  <Private>False</Private>
  <SpecificVersion>False</SpecificVersion>
</ProjectReference>

下面是调用堆栈

   Exception of type 'System.Exception' was thrown.    

Instances of this error (1)  

1.   Hide Call Stack 

at VSLangProj.Reference.get_Path()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AddProjectDependencies(Project project)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.get_Assembly()
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Boolean allowPrivate, Assembly& assembly, String description)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.AssemblyEntry.Search(String fullName, String typeName, Boolean ignoreTypeCase, Assembly& assembly, String description)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchProjectEntries(AssemblyName assemblyName, String typeName, Boolean ignoreTypeCase, Assembly& assembly)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.SearchEntries(AssemblyName assemblyName, String typeName, Boolean ignoreCase, Assembly& assembly, ReferenceType refType)
at Microsoft.VisualStudio.Design.VSTypeResolutionService.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, ReferenceType refType)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetRuntimeType(String typeName)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.GetType(IDesignerSerializationManager manager, String name, Dictionary`2 names)
at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.FillStatementTable(IDesignerSerializationManager manager, IDictionary table, Dictionary`2 names, CodeStatementCollection statements, String className)
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)  

有什么我想念的吗?此时我可以使用哪些调试策略?

我的 CSPROJECT 需要这个 CPPProject 项目。如果我删除 CPPProject,我的应用程序会设计,但不会编译。我不想每次修改表单时都必须删除引用。

4

1 回答 1

0

我猜这是堆栈跟踪中的 c++/cli 和/或 c# 参考问题:

VSLangProj.Reference.get_Path()

尝试删除 c++/cli 和/或 c# 项目中的任何无效引用。(无效引用在项目属性中标有感叹号图标)

于 2013-06-26T07:48:32.053 回答