【发布时间】:2013-03-13 10:44:36
【问题描述】:
使用 MsgPack 序列化某些 F# 类型时遇到 VerificationException“操作可能破坏运行时”错误。编译器还建议可能会加载冲突的类库,但这似乎是一个红鲱鱼。
目前尚不清楚错误是由什么引起的,因此为了社区利益,请在下面发布解决方案。
回应以下评论:
....Sammo\bin\Debug>peverify /verbose Sammo.exe
Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.17929
Copyright (c) Microsoft Corporation. All rights reserved.
All Classes and Methods in Sammo.exe Verified.
....Sammo\bin\Debug>Sammo.exe
Unhandled Exception: System.Security.VerificationException: Operation could destabilize the runtime.
at _4(MsgPackReader )
at _3(MsgPackReader )
at MsgPack.CompiledPacker.Unpack[T](Stream strm)
at MsgPack.CompiledPacker.Unpack[T](Byte[] buf, Int32 offset, Int32 size)
at MsgPack.CompiledPacker.Unpack[T](Byte[] buf)
at <StartupCode$Sammo>.$Program.main@() in ....\Sammo\Pro
gram.fs:line 67
....\Sammo\bin\Debug>
【问题讨论】:
-
您可以在您编译的程序集上运行
peverify --verbose并在此处发布结果(如果有任何错误)? (如果您之前没有使用过peverify,则需要从 Visual Studio 命令提示符而不是普通命令提示符运行它。