Stepping through the Roslyn C# compiler

Viewed 806

I've built the Roslyn source as described here.

I'd like to add a breakpoint in the C# compiler and step through the compliation of this simple program:

using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = 1 + 2;

            Console.WriteLine(result);
        }
    }
}

Where should I set a breakpoint? It should be early in the compilation process as I'd like to step through parsing and even lexing.

If I set CompilerExtension as the startup project and hit F5 (Start Debugging), a copy of Visual Studio is launched running the newly built compiler. I'd like to avoid having to launch a new instance of Visual Studio each time I'd like to step through the compiler. What's a good way to setup a small program which invokes the compiler code on the above source directly?

2 Answers
Related