CreateAndInject

Results 61 comments of CreateAndInject

> typeof(GTYPE).MakeGenericType(typeof(int)).GetMethod("GMETHOD") is imported as MemberRef. @wwh1004 As you said, the imported result here can't be an operand, so how can we use the result? Where can this imported result...

> I still don't know why does dnlib should create a MethodSpec when there are no generic method arguments. > > Assume that GTYPE is a type containing gp and...

I viewed [AsmResolver](https://github.com/Washi1337/AsmResolver), it uses `MethodSpec` in this case also as old dnlib. ![image](https://github.com/0xd4d/dnlib/assets/2529999/f84a6d69-071d-483b-bc05-21f095eaa77c) ![image](https://github.com/0xd4d/dnlib/assets/2529999/c3ea2433-f288-4349-b16f-751174f388f0)

> If it has no side effects, remove those two lines of code. @wwh1004 This issue isn't the only issue, seems these 2 PR #452 #466 have serious bugs. Another...

A System.Type: `My` B TypeRef: ```My`1``` C TypeSpec: `My` `GetHashCode(A) == GetHashCode(B) != GetHashCode(C)` So: var methodInfo = typeof(My).GetMethod("Test"); var methodTypeSpec = Import(methodInfo); `GetHashCode(methodInfo) != GetHashCode(methodTypeSpec)` Solution: 1. Don't care...

[test.zip](https://github.com/0xd4d/dnlib/files/14205651/test.zip) ```c# var module = ModuleDefMD.Load(@"test.exe"); module.NativeWrite("output.exe"); // InvalidOperationException ```

No idea if alignment is requirement and how the alignment should be.

How strange code, `type` is "System.Console", but `declaringType` is "My`2" ![image](https://github.com/0xd4d/dnlib/assets/2529999/aed728db-bda7-4788-bf71-40ee149b341d)

1. Why extra parameter `originalDeclaringType` is requirement when DynamicMethodBodyReady already know how to generate instructions exactly (except ldtoken)? `originalDeclaringType` doesn't support any information which DynamicMethodBodyReady doesn't know. 2. Currently, Equals/GetHashCode(Import(xxx))...