使用运行时检查进行编译时出现异常。 [英] Exception on Compilation with Runtime Checking.
问题描述
我正在尝试将代码契约应用于我的代码库,但是当我启用运行时契约检查时,我得到以下异常:
AsmMeta因未捕获的异常而失败:字典中没有给定的密钥。
堆栈跟踪:在System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Cci.PeWriter.GetMethodDefIndex(IMethodDefinition method)
at at Microsoft.Cci.PeWriter中的Microsoft.Cci.PeWriter.GetMethodDefOrRefCodedIndex(IMethodReference methodReference)
at Microsoft.Cci.PeWriter.PopulateMethodImplTableRows()
。 Microsoft.Cci.PeWriter.WritePeToStream中的PopulateTableRows()
(IModule模块,IMetadataHost主机,Stream流,ISourceLocationProvider sourceLocationProvider,ILocalScopeProvider localScopeProvider,IPdbWriter pdbWriter)
at AsmMeta.AsmMeta.Run()
at AsmMeta.AsmMeta.RealMain(String [] args)
at AsmMeta.AsmMeta.Main(String [] args)
已用时间:169.0097ms
我试图在别处寻找更多细节,但这条消息看起来很神秘。 关于可能出错的任何想法?
谢谢!
Michael
我启用运行时检查时遇到的另一个例外是参考分辨率异常:
无法解析类型引用:[System] System.Net.CookieContainer。
无法解析类型引用:[系统] System.Net.Cookie。
无法解析成员引用:System.Net.CookieContainer ::。ctor。
无法解析成员引用:System.Net.CookieContainer :: Add。
是否存在我可能缺少的设置以确保正确检查路径?
I'm trying to apply Code Contracts to my codebase, but when I enable Runtime Contract checking, I get the following exception:
AsmMeta failed with uncaught exception: The given key was not present in the dictionary.
Stack trace: at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Cci.PeWriter.GetMethodDefIndex(IMethodDefinition method)
at Microsoft.Cci.PeWriter.GetMethodDefOrRefCodedIndex(IMethodReference methodReference)
at Microsoft.Cci.PeWriter.PopulateMethodImplTableRows()
at Microsoft.Cci.PeWriter.PopulateTableRows()
at Microsoft.Cci.PeWriter.WritePeToStream(IModule module, IMetadataHost host, Stream stream, ISourceLocationProvider sourceLocationProvider, ILocalScopeProvider localScopeProvider, IPdbWriter pdbWriter)
at AsmMeta.AsmMeta.Run()
at AsmMeta.AsmMeta.RealMain(String[] args)
at AsmMeta.AsmMeta.Main(String[] args)
elapsed time: 169.0097ms
I've tried to look elsewhere for further details, but this message seems cryptic. Any ideas on what could be wrong?
Thank you!
Michael
Another exception I'm getting when I enable runtime checking is reference resolution exceptions:
Could not resolve type reference: [System]System.Net.CookieContainer.
Could not resolve type reference: [System]System.Net.Cookie.
Could not resolve member reference: System.Net.CookieContainer::.ctor.
Could not resolve member reference: System.Net.CookieContainer::Add.
Is there a setting that I could be missing to ensure paths are properly checked?
这篇关于使用运行时检查进行编译时出现异常。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!