AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

How to debug and log #51

Closed M-Pixel closed 6 years ago

M-Pixel commented 6 years ago

How does one

  1. Attach a debugger to step through a generator?
  2. Log from the generator, and view those logs?
LokiMidgard commented 6 years ago

I normally use System.Diagnostics.Debugger.Break()

AArnott commented 6 years ago

Yes, there's that or Debugger.Launch(). Also during development I usually have a stub console project added to my solution that is configured to execute msbuild /m:1 mysolution.sln on F5, and I can just debug that to "build" and then debug into my code generator.