1
我正在編寫我自己的編譯器,爲它的樂趣xD。它使用Mono.Cecil編譯爲CIL,當我反編譯它或查看CIL時,它看起來沒問題,但是,當我運行它時,出現崩潰(異常),指出「Method was not found:'?'」。錯誤在CIL中。未找到方法:'?'
尋找在(堆棧跟蹤顯示哪些方法),這是對於給定的方法中,CIL產生崩潰的方法:
.method public hidebysig virtual
instance class [Totem.Library]Totem.Library.TotemValue Execute() cil managed
{
IL_0000: callvirt class [Totem.Library]Totem.Library.TotemUndefined [Totem.Library]Totem.Library.TotemUndefined::get_Value()
IL_0005: ret
}
Totem.Library是C#編寫的(一個外部DLL不編譯我的編譯器,因此應該工作)。被訪問的屬性(TotemUndefined.Value,靜態屬性)無法引發異常(它只是返回在TotemUndefined的靜態構造函數中創建的單例)。
我想知道,這個CIL有什麼問題嗎?或者是找到問題所需的更多信息(可以上傳完整源代碼,截至目前只有幾百行)。
謝謝你,工作出色:) – Alxandr 2012-01-16 20:57:16