Question

I understand that Microsoft's Compiler as a Service or Roslyn project was inspired by Mono Cecil.

But what's the relationship between Mono Cecil and NRefactory? Does one use the other? Or are they alternative technologies that do the same thing?

It appears that both of them provide the same slew of code analysis services, just like Roslyn.

Was it helpful?

Solution

You got some misunderstanding.

Roslyn was a private project, when Mono guys were turning their C# compiler to a service (Mono.CSharp assembly). If you read this post by Miguel you can learn more about what happened in 2008.

The two happened to be announced together on the same Microsoft PDC event (Anders's session first, and then Miguel's session). So Roslyn has some relationship with Mono.CSharp, but no relationship with Cecil.

Microsoft does have another project which is similar to Cecil, called CCI

Cecil is a MSIL reader and writer, while NRefactory primarily is C# parser and AST framework. NRefactory depends on Cecil as stated in README, as well as Mono.CSharp.

But we should see that if we do code analysis based on Cecil, we are on MSIL layer, and such analysis applies to in fact all .NET languages (including VB.NET, Oxygene and so on). If the code analysis is based on NRefactory then it more focuses on C# layers.

Comparing Mono bits with Roslyn should be avoided at this moment, as we are not sure how Roslyn looks like when it is finalized and published by Microsoft. To me, Roslyn should be equivalent to a stack of libraries on Mono (including Cecil, NRefactory, Mono.CSharp, and IKVM.Reflection).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top