Feb 22, 2019

Making it easier to getting started with Mono.Cecil

Leia este post em Português

A long time ago I was working with byte code manipulation in the black side of the force, i.e, in Java ;) using a library called ASM. In order to learn how to use this library (and also help raising developer productivity) one could use a tool called asmifier (and the related Bytecode Outline Eclipse plugin) which is able to take Java code snippets and generate calls to the ASM library to produce the equivalent byte code of the compiled code snippet.

Later, when I focused on dotnet development and started using Mono.Cecil to implement various tools to manipulate .Net assemblies (around 2010 ~ 2011) it did not took me too long to realize that something similar to asmifier in the .Net world could be of great value; add to that the implicit complexity of the problem domain, the sparse documentation available for Mono.Cecil and my interest in learning how to use a cool, emerging technology (at that time) called MS Roslyn and Cecilifier was born.

Due to reasons that are not important I've put the project aside a couple of times but never gave up or fully abandoned it.. instead it progressed very, very, very slowly with some stall periods in its development (check timeline bellow if you are curious):


The good news is that last year I resumed the work, added some missing features and fixed some bugs. I was planning to wait the code to reach some level of maturity before open sourcing it but I came to the conclusion that even in its current state it may be useful so I've finally opened its git repo and deployed a site.

As of today this web site is hosted in gcp, running of free credits; in order to keep it running (not necessarily in gcp) I've started a campaign in Patreon; in case this endeavor proves unsuccessful (i.e, it does not rise enough money) I'll shutdown the gcp server but development of the project is only tied to interest of both the community and my own. So if you think the web site is useful, please, consider donating. Another way you you can contribute is by sending bitcoins to 34e55WVni9nMFCiugo8d1bfwu9pLNzPH6n :)

Depending on the amount of money I raise monthly, I'll consider getting a custom domain; the excess will be used to cover hardware & beer costs as well as an incentive to put more effort in the development of the project.

[EDIT]

I removed the patreon option (didn't get any :) but you can still support me if you want to, through github sponsor

[/EDIT]


Of course you can also contribute by reporting issues, sending merge requests, engaging in discussions, helping users, etc.

The website is the part of the project to which I have dedicate the least amount of time/energy (it was one the last additions also) so it certainly could use some love :). If you are a web developer and would like to help, drop me a line.

If you use it, please drop me a message in twitter and tell me what you think, what improvements you would like to see, etc.

Finally, you can find more details (including features, limitations and more) in the README file in the git repo.

Have fun.

Adriano

4 comments:

Qwertie said...

Hmm... I don't really understand how your tests work. I see the test code files such as...

class Ternary
{
private static void Foo(int i, bool b)
{
System.Console.WriteLine( i > 10 ? ">" : "<=");
System.Console.WriteLine( b ? "true" : "false");
}
}

but I don't see how you check if you're getting the correct output.

programing-fun said...

Hey really sorry, did not get a notitifcation about your comment and I missed it :(.

Not sure if you are still interested in it, but anyway...
basically the tests run as:

1. Take some piece of C#
2. Run through Cecilifier
3. Compile the code from 1
4. Compile cecilified code from 2
5. Run application build in previous step (4)
6. Compare the assembly generated by steps 3 & 5

Adriano

Amit said...

'TypeHelpers.ResolveMethod' does not exist in current context.
In which namespace I can find this??

Amit said...

'TypeHelpers.ResolveMethod' does not found in current context.
In which namespace I can this?