Questions tagged [mono.cecil]

Mono.Cecil is a library to generate and inspect programs and libraries in the ECMA CIL form.

Mono.Cecil is a cross platform library, working equally well on .net and Mono, used to analyze, modify and write .net assemblies.

It is used in a variety of open source projects and commercial products.

Links

390 questions
0
votes
0 answers

Maintaining context of type arguments with Mono.Cecil

After learning how to properly access the fields and properties of a List with Mono.Cecil, it was pointed out that you need to make sure that the context of the type arguments is maintained on the List object that you're working with (which makes…
JesseBuesking
  • 6,496
  • 4
  • 44
  • 89
0
votes
0 answers

How to convert CustomAttribute Constructor to il codes

I'm trying to implement my own aop-framework (like PostSharp). And stuck with one problem. Say there is an attribute: [AttributeUsage(AttributeTargets.Method)] public class LogAttribute : Attribute { public LogAttribute(int level, Type type) …
O.K
  • 43
  • 3
0
votes
1 answer

CECIL IsGenericInstance not returns correct value for out put parameter

I have below method with nullable parameters in which 2nd one is out too public static void MyMethod(Nullable i_ReportID, out Nullable i_MenuID) { i_MenuID = 0; } I tried to identify the…
Jaish Mathews
  • 766
  • 1
  • 9
  • 25
0
votes
0 answers

Mono linker error linking framework assemblies in Hello World

I have the same problem as described in [Mono-dev] monolinker failing on "hello, world"--any ideas?. C:\monotest>type test.cs public class Test { public static void Main() { System.Console.WriteLine("BOO"); …
0
votes
1 answer

Get mem address of a Method's body whose assembly is loaded through Assembly.load

I have loaded an assembly B into the appdomain of assembly A using Assembly.load(). B has a method named "X" which i need to retrieve its memory address/pointer. I understand that B is mapped into memory as a single contiguous memory data after…
Ron
  • 67
  • 1
  • 6
0
votes
1 answer

Mono.Cecil Modifying the RVA of a method

I would like to modify the RVA of a method using Mono.Cecil. I noticed a similar question asked back in 2007 but is this doable in 0.95? For eg: methodA.RVA = 0x1234; I understand Mono.Cecil compute and write RVA during compilation but are there…
Ron
  • 67
  • 1
  • 6
0
votes
1 answer

Mono.Cecil get/resolve RVA of method after method insertion

How do i resolve the RVA of the method i have injected without reloading the entire module? I am always getting 0 as the RVA of the added method. Is there anyway to retrieve the RVA without writing and reloading the assembly?…
Ron
  • 67
  • 1
  • 6
0
votes
1 answer

Resolving whether assemblies are Silverlight or .NET using Mono.Cecil in a MSBuild task

I'm using Mono.Cecil from an MSBuild task, and I've encountered a problem with the way it resolves assemblies. It is picking up the .NET version of Prism instead of the Silverlight one. The .NET version of Prism does not contain…
Dave Hillier
  • 18,105
  • 9
  • 43
  • 87
0
votes
1 answer

How do I emit a call to String.op_Equality in Mono.Cecil

I'm trying to inject code into an assembly using Mono.Cecil. So far it's all been great but now I'm trying to implement this bit of IL: call bool [mscorlib]System.String::op_Equality(string, string) How do I do this in Cecil? I know it's something…
Earlz
  • 62,085
  • 98
  • 303
  • 499
0
votes
0 answers

Decompile method from assembly (ICSharpCode)

I'm trying to decompile a method programmatically using ICSharpCode. I'm able to decompile the entire type, but whenever I try to decompile a single method, I get a null reference exception. The approach is much like this question…
jaspernygaard
  • 3,098
  • 5
  • 35
  • 52
-1
votes
1 answer

how to modify enum type by mono cecil

I want to modify enum type by mono cecil before modify public enum TestType : byte { TestType1, TestType2, TestType3, TestType4, } after modify public enum TestType : byte { TestType1, TestType2, TestType3, …
-1
votes
1 answer

Mono.Cecil - How to know a method has variable-arguments?

In C# we have __arglist keyword which makes method variable-argument like this: public static void PrintFormat(string format, __arglist) { .... } It compiles to : .method public hidebysig static vararg void PrintFormat ( string format ) cil…
moien
  • 999
  • 11
  • 26
-1
votes
1 answer

Invalid IL code in XXX(): IL_0023: brfalse IL_00ba

I am trying to understand why this is invalid IL code and/or what would cause this fault. The exception thrown is: System.InvalidProgramException: Invalid IL code in away3d.containers.View3D:updateBackBuffer (): IL_0023: brfalse IL_00ba I…
SushiHangover
  • 73,120
  • 10
  • 106
  • 165
-1
votes
1 answer

How to remove baml from WPF assembly?

Using the merged resource dictionaries degrade application performance. In my assembly I often need to use merged resource dictionaries. I want to combine resources in one dictionary, and delete the original baml. I can't set Build Action to None…
Aleksandr Vishnyakov
  • 1,872
  • 5
  • 23
  • 39
-2
votes
1 answer

C#/.Net CIL - ldarga.s how to get index/argument (ldarga.s vs ldarga vs ldarga.0 opcode)?

I'm trying to interpret a CIL instruction by instruction. I'm using Mono.Reflection to get a list of instructions and I don't know how to interpret 'ldarga.s'. I know "ldarga" - Load the argument address to the evaluation stack." but what is the…
Mike Dev
  • 315
  • 1
  • 10
1 2 3
25
26