![](/img/trans.png)
[英]1-click application validation failed MonoCecil.dll c#
我在運行一鍵式應用程序時遇到問題。 它停止工作,錯誤代碼為“應用程序驗證未成功”。 該問題與Mono.Cecil.dll和相關的簽名驗證有關。 如果我將 Mono.Cecil.dll 的發布狀態更改為在 VisualStudio/Properties/Publish/Application 文件中 ...
[英]1-click application validation failed MonoCecil.dll c#
我在運行一鍵式應用程序時遇到問題。 它停止工作,錯誤代碼為“應用程序驗證未成功”。 該問題與Mono.Cecil.dll和相關的簽名驗證有關。 如果我將 Mono.Cecil.dll 的發布狀態更改為在 VisualStudio/Properties/Publish/Application 文件中 ...
[英]Mono.Cecil: Getting Method Reference from delegate passed as Generic Parameter
我試圖了解哪些具體類型在 IOC(依賴注入)容器中提供接口的實現。 當沒有代表參與時,我的實現工作正常。 但是,當委托方法作為類型工廠傳遞時,我遇到了麻煩,因為我無法獲得 Mono.Cecil 返回具體類型或對工廠的方法引用。 在這種情況下,我特別嘗試構建一個組件,該組件可以與 IServiceCo ...
[英]BaseType.Resolve() yielding null for base types in different assembly
我有一個方法可以使用 mono.cecil 獲取類型的所有成員,一直到類型層次結構,但我發現以下語句通常返回 null: 在此聲明之前,我已經檢查過 asmType.BaseType 不是 null(而且我知道基類型存在)。 我認為當基類型和派生類型在不同的程序集中時,它往往會返回 null。 ...
[英]Is there a way to make debugger work with modified assembly
我正在嘗試在使用它之前修改程序集。 主文件: IlGenTestUtils: 當我在 Method1 上設置斷點時,一切正常,但程序並未暫停。 當我直接調用 Method1 而不創建新程序集時,程序按預期在斷點處暫停。 有沒有辦法讓斷點與動態匯編一起工作? ...
[英]How to replace method parameter with a variable with Mono.Cecil
我正在為我的應用程序制作代碼生成實用程序,但我遇到了一個問題 - 我不知道如何將方法的參數替換為在其中創建的變量。 例子: a) 代碼生成前的代碼:public void SomeMethod(Foo foo) { DoSomethingWithFoo(foo); int some ...
[英]Injecting a an assembly reference /w Mono Cecil does not work
我目前正在使用 Mono.Cecil 將程序集引用添加到已編譯的程序集中。 我正在使用此代碼添加參考: Tracer是來自另一個項目的 class。 完成對加載程序集的修改后,我將像這樣保存它: 一旦我嘗試運行新的 dll,我就會看到: 即使有問題的 dll, introspect.types與i ...
[英]Dotpeek ISSUE: unable to decompile the method
為什么dotpeek不能反編譯dll中的方法?( unable to decompile the method )? // ISSUE: 無法反編譯該方法。 其他反編譯器(例如decompiler.com )反編譯它沒有任何問題 二傳手 {.custom instance void .netst ...
[英]How can I run assemblies generated by Mono.Cecil on a Windows Machine?
我最近一直在玩 Mono.Cecil,主要是為了我打算編寫的編譯器。 我首先嘗試了這個答案中的代碼。 這是代碼: 請注意,我將module.Import更改為module.ImportReference ,因為前者顯然已過時。 我將它放入 .NET 5 項目中,這創建了一個HelloWorld.e ...
[英]Add Static Instance Field to Class and Set To Self in Constructor
使用 Mono.Cecil 我試圖修補一個類以添加一個靜態字段“Instance”並將其設置在構造函數中。 它本質上相當於添加以下內容: 但是,我不知道引用存在於何處,並且在查看 OpCodes 后,我找不到如何將引用推送到堆棧上以將字段 (OpCodes.Stfld) 存儲到我的字段定義中。 ...
[英]Is it possible in Mono.Cecil to determine the actual type of an object on which a method is called?
例如,考慮以下 C# 代碼: 我知道如何獲取與SomeFunction對應的MethodDefinition對象。 然后我可以循環遍歷MethodDefinition.Instructions : 這樣我就可以發現SomeFunction方法調用了函數IBase.f 現在我想知道調用函數f ...
[英]How can i mock a return type of a factory method of a 3rd party library?
我正在開發一個使用 Mono.Cecil 加載程序集的工具。 我有以下工廠,它返回一個名為二進制的 object 並依賴於負責使用AssemblyDefinintion.ReadAssembly方法加載程序集的接口。 我對單元測試完全陌生,我需要對GetBinary方法進行單元測試。interna ...
[英]How can I change field value with Mono Cecil?
我有一個 C# 程序,它有一個 class: 如何使用 Mono Cecil 更改它們的初始值,使其看起來像這樣: 現在我只有以下骨架代碼,我不知道如何修改字段。 ...
[英]CIL instruction “isinst [System.Runtime]System.Int32” for value 0 (int32) - what will return?
我有一個簡單的 C# function 正如預期的那樣Isinst_intSimple(0)返回true 反編譯后,function 看起來像: IL_0002 isinst [System.Runtime]System.Int32指令在執行后會向評估堆棧推送什么(輸入將為 0(int32))? ...
[英]How to return Task.FromResult<bool>(true) using mono cecil?
我需要使用 mono cecil 來實現以下邏輯。 我只知道如何調用非泛型方法,因為cecil項目中有對應的demo代碼。 我不知道如何調用泛型方法。 誰能告訴我該怎么做? 對應的 IL 代碼應如下所示: ldc.i4.1 調用 class [mscorlib]System.Threading. ...
[英]Unity script won't update after first successful weaving with Mono.Cecil
我正在使用 Mono.Cecil 在 Unity 中修改編譯后的程序集(我正在使用 Mono.Cecil 的這個實現)。 出於某種原因,如果我將字段添加到程序集中的類型,並且該字段的類型是我定義的委托類型,則程序集中的腳本在第一次成功修改/編織后似乎不會更新。 每次重新編譯時,以下代碼都會正確運行, ...
[英]How to match type symbol names as returned by Roslyn semantic model to those returned by Mono.Cecil?
我有以下代碼:var paramDeclType = m_semanticModel.GetTypeInfo(paramDecl.Type).Type; paramDeclType.ToString()返回的地方System.Collections.Generic.Dictionary< ...
[英]I want to use Mono. Cecil to create a delegate, but I don't know how to get its constructor
我希望能夠為代碼生成 il 我在反編譯中看到了這段代碼,我不知道如何得到它的構造, ...
[英]C# Mono.Cecil injected IL Code does not get executed
我想用 Mono.Cecil 制作一些示例代碼,目的是操縱 IL。 方法 X 確實在控制台上打印了一些東西。 為了測試 IL 代碼的操作,我從該方法中刪除了所有指令。 但是,當我運行 External2.dll 時,控制台 Output 仍會打印出來(但執行控制台 output 的說明已從 Exte ...
[英]How in CIL (MSIL) “call instance void valuetype [..type]” return or save value? (Common Intermediate Language)
我正在創建一個在指令后執行 CIL 指令的.Net 中間代碼模擬器。 我無法更精確地模擬call instance void valuetype並保存其結果我有 C# 代碼: DateTime? startDate = DateTime.Now; DateTime? startDate = Dat ...
[英]Get .NET type from Mono.Cecil
我正在開發一個 .NET 應用程序。 在我的應用程序中,我必須檢查程序集中的類型是否實現了特定的接口。 My assembly has a package from NuGet package (dependency) so i am using Mono.Cecil for getting al ...