Category: roslyn
-
AOP with Roslyn–part 2
I want to transform code by injecting some simple code,like “Console.WriteLine(“method”) So this code: should be modified to this code: How I do the code: I derive from CSharpSyntaxRewriter and override the VisitMethodDeclaration . I will construct a new node with the Console.WriteLine statement inserted As test,I have created…
-
AOP with Roslyn
What I am interested in is to make a tool that logs in when the program comes in and out of a method. It’s good for identifying problems in code and for logging. What already exists on the market: PostSharp – one of the best – see https://www.postsharp.net/alternatives Cecil http://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/ Fody https://github.com/Fody NConcern: https://github.com/Virtuoze/NConcern What…