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
3
votes
1 answer

How to get the parameters of the method with value using mono.cecil?

Is it possible to get the values of method parameters using mono.cecil. I am doing interception of the method calls let me know whether it is feasible?
3
votes
1 answer

"Error 'System.Void Mono.Cecil.AssemblyDefinition::.ctor()' is declared in another module and needs to be imported"

I am using latest version of Mono.cecil What I am trying to do is I am having Custom Attributes in a seperate dll and I want to add the attributes to every method in the sample.exe using mono.cecil but i am getting the error "Error 'System.Void…
3
votes
1 answer

How do I replace an ILAsm throw with a rethrow with Mono.Cecil?

I have a C# dll with a member similar to the following: public void DoStuff(int i) { try { something.InnerDoStuff(i); } catch (Exception ex) { throw ex; } } I figured out how to get the throw opcode: Add-Type -Path…
Justin Dearing
  • 14,270
  • 22
  • 88
  • 161
3
votes
1 answer

Can I get MethodInfo from MethodDefinition (Cecil)?

I want to work with MethodInfo, is there a way to cast Cecil's MethodDefinition to MethodInfo?
blez
  • 4,939
  • 5
  • 50
  • 82
2
votes
1 answer

Find argument values of method call in IL

I have several special methods, and I want analyze they calls in compiled assembly. Example: public static class SrcHelper { [MySpecialMethod] [Conditional( "DEBUG" )] public static void ToDo( params object[] info ) { /* do…
TcKs
  • 25,849
  • 11
  • 66
  • 104
2
votes
1 answer

Can Mono.Cecil rewrite debugging symbols as VB.NET?

After rewriting a VB.NET assembly with Mono.Cecil the 'Call Stack' debugging window in Visual Studio 2010 shows the language as C# and not VB.NET. Is it possible configure Mono.Cecil to rewrite an assembly so the debugger recognises the rewritten…
Tim Murphy
  • 4,892
  • 4
  • 40
  • 48
2
votes
1 answer

How to change a type's accessor with Mono.Cecil

Is this possible? I want to make a public class internal. Thanks
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
2
votes
2 answers

In IMetadataImport or MonoCecil, how can I find out out if a method in an internal class is accessible from other assembiles?

One of the cases where a public method of an internal class might be accessible from outside the assembly is if the method implements interface methods or overrides virtual methods that are defined in a public base class. Using IMetadataImport, how…
Omer Raviv
  • 11,409
  • 5
  • 43
  • 82
2
votes
2 answers

Change application type with Mono.Cecil?

How can I modify an application from Console Application Type to Windows Application Type and vice versa with Mono.Cecil?
user917615
2
votes
1 answer

Using Mono.Cecil to add an Indexer to a TypeDefinition

I'm using JB Evain's Mono.Cecil to perform some byte-code manipulation on compiled DLL's. Part of this project is to inject properties into TypeDefinitions, effectively turning compiled getters/setters into the C# Properties pattern using…
Beccy
  • 145
  • 1
  • 1
  • 4
2
votes
1 answer

Dotpeek ISSUE: unable to decompile the method

Why can't dotpeek decompile the method in the dll?(unable to decompile the method )? // ISSUE: unable to decompile the method. public ChildModel ChildModel { get => this.\u003CChildModel\u003Ek__BackingField; set { // ISSUE: unable to…
2
votes
0 answers

NullableAttribute is declared in another module and needs to be imported - ILRepack

So I'm using ILRepack, which as far as I understand, uses Mono.Cecil behind the scenes, to do ILWeaving. I'm running into a problem in my project, which ends up resulting in the following error as soon as I import, for example, Newtonsoft.Json…
Capsup
  • 87
  • 11
2
votes
2 answers

How can I create a new Windows Phone 7 assembly from scratch using CCI or Mono.Cecil

I am working on a tool to generate assemblies for WP7. I am doing this from the full framework. Since Reflection.Emit doesn't work with WP7 but either CCI or Mono.Cecil do I am wondering if there is a way to create new assemblies from scratch. I…
cloudraven
  • 2,484
  • 1
  • 24
  • 49
2
votes
2 answers

How to match type symbol names as returned by Roslyn semantic model to those returned by Mono.Cecil?

I have the following piece of code: var paramDeclType = m_semanticModel.GetTypeInfo(paramDecl.Type).Type; Where paramDeclType.ToString() returns System.Collections.Generic.Dictionary> I also have the…
mark
  • 59,016
  • 79
  • 296
  • 580
2
votes
1 answer

How do you invoke a method within the same class in IL

If I was writing code this would be very simple. I have code that looks like: public class SomeClass { public void SomeMethod(ISomeService someService) { } private void AnotherMethod(ISomeService someService) { } } I can…
Dan Siegel
  • 5,724
  • 2
  • 14
  • 28