CCI vs. Mono.Cecil — advantages and disadvantages

2019-02-04 05:36发布

问题:

I have seen articles discussing these two similar frameworks, but most of them are two years old or so. I assume both projects are much more mature now than they were two years ago, and the situation is a more complex one.

So given the current states of each of the libraries, I was hoping someone could provide a detailed explanation of the advantages and disadvantages of each, and which should be preferred at present time.

回答1:

CCI

Pros:

  • Can give you finer-grained control on your performance
  • The latest version is a bit more mature

Cons:

  • The object model is more complicated (and confusing if you're new to IL/low-level reflections, like I am)

Cecil (referring to the newer git-hub version)

Pros:

  • Has a simpler object model so will be easier to get started on

Cons:

  • The latest version is less mature, so has fewer code samples available
  • The API is a work-in-progress
  • You won't have as much control over name-caching (for perf)

Which I'd choose

Couting up the pros/cons, it sure looks like I'd pick CCI over Cecil. But I wouldn't.

Cecil is up-and-coming, has an easy API design, has an active authorship (well, did 7.5 months ago, and still seems to now), and was painless to debug through on any issue I encountered.

CCI was quite painful to code against - the interface-based design is taken too far. The code is hard to debug through. Some things seem complete at first glance, but aren't, or don't handle more than a single use case. The NameTable stuff made my head spin (more than it already was).



回答2:

Cecil - because for me, community support for it is better than the CCI. I have always found answers on mailing lists / sites quicker for cecil.