Source Generator Support?

Is this something that could be integrated into LINQPad?

I love the fact that LINQPad allows me to try out new features of the language/framework usually but it looks like this needs build and IDE support. This could allow for making very dynamic LINQPad scripts with specially crafted generators that I would love to play around with.


  • LINQPad could in theory be made to work with source generators. The issue - from what I've seen so far - is in the way they're packaged, which relies on MSBuild, project files and PowerShell scripts.

    If particular source generators become popular, it's likely that I could hard-code support for those generators. Is there anything that you have in mind?

  • I don't have any particular generator in mind. Just wanted to see if this could be supported in general so I could author and use generators that I'd write and eventually share.

    But I'd imagine any generators that would come with the usual core packages ought to be included (asp.net core, ef core, etc.)

  • A possible use case I might try to create a generator for, suppose we had a class that contained a list of optional (nullable) properties. We want it to implement an interface that has a subset of the same corresponding properties, but some or all of its properties are non-nullable. The generator could generate explicit implementations of the accessors, perhaps adds a validation function as well to validate all the required properties.

Sign In or Register to comment.