I'm writing a ReSharper 7.1 Generator plugin and need to get a list of all types declared in the current project (classes, interfaces and structs - IDeclaredType-s
) for the GeneratorProviderBase<CSharpGeneratorContext>.Populate
method.
With regular reflection it would be as simple as Assembly.GetTypes()
, but here it's proven to be quite a challenge. Is there a way to do this?
I've searched high and low, the docs and samples didn't help, then looked through every *Extensions
and *Util
class, but couldn't find anything useful...
Here's what I came up with using the cache. It still doesn't seem right, but I expect it to be better than the previous approach. This is still called from a
GeneratorProvider.Populate
:Note: The results won't be the same as in the first answer, cause I've changed some restrictions. Also, in both cases, I'm not concerned with partial classes.