The new code generator adds everything to feature.AddKnownType (original) (raw)
This was a problem with the old code generator already as documented in #4437, but with the new code generator it's a lot worse.
For example I have a functional tests project that has a single grain interface with a few simple calls, it references various other projects. Both code generators write about 200 lines of code for the grain method invoker, but then they generate endless feature.AddKnownType lines - the old one about 700 lines, the new one about 26000 lines! The generated assembly grows from 300KB to 6MB and is really slow to start up.
What's the purpose of feature.AddKnownType? It looks like it adds every type that is visible to Roslyn during codegen or something similar. And the added information doesn't look useful at all - it's just a list of type names.