Grace icon indicating copy to clipboard operation
Grace copied to clipboard

Make use of Source Generators

Open silkfire opened this issue 4 years ago • 2 comments

A new feature called Source Generators is being developed by Microsoft, to be part of .NET 5 some time in the future. This is a way to implement reflection but during compilation of the assembly instead of during runtime. This should in theory have great performance and usability gains. Source Generators are implemented very similarly to Roslyn Analyzers.

Please have a look if this could be a candidate for Grace: https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/

silkfire avatar May 06 '20 07:05 silkfire

Hi @silkfire

I've actually seen that and it looks very interesting but it's really only going to have performance benefits at startup time. Actual locate times aren't going to improve.

The big reason I find this interesting is the use case for mobile where you have concerns about compiling code, this would completely alleviate those concerns.

I'm keeping an eye on it but I'm hesitant to say this is a complete game changer for DI containers. I am however looking to use it in another project where I do IL emit.

ipjohnson avatar May 06 '20 11:05 ipjohnson

Hi @ipjohnson Native AOT doesn't work with reflection, I think source generator for Grace would be awesome, and may be it will be the first DI that provide this feature

7amou3 avatar Aug 14 '23 15:08 7amou3