Show HN: I've built ORM-ish library using dotnet source generator
I wanted to evaluate C# source generators to see whether "compile time PetaPoco like" project can be built with it.
(
5 comments
| 3 points
| on HN
)
I found the DX with it to be quite tricky (at least in Visual Studio Code) as it was difficult to log or trace through the code what was happening and what was going wrong. Microsoft's documentation is also quite lacking.
Do you have any write up or tips on the DX? It's a pretty impressive project and I'm really interested in how to improve my own workflow with respect to source generators since my experience has been that they are clumsy to work with.
With VSC, I found that I had to do some "hacks" to drop output as comments into a generated file so I could see what was happening.
`QueryGeneratorTestUtil.GenerateCompileAndAssert` internally uses `Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create()` and `Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create()`. I get an interactive, debuggable source generator development environment this way. Same as you, initially I used "comments as debugging" hacks but above way is way more efficient.
[1] https://github.com/manifold-systems/manifold/blob/master/man...