BitsKit
BitsKit copied to clipboard
Fix memory leaks and performance problems in the source generator
Thanks for this library, its a great help when working with bitfields. However, the current source generator has major issues and is not functioning incrementally.
- Storing
ISymbolin incremental pipelines is not allowed. - Storing
SyntaxNodes in incremental pipelines is not allowed. - Storing
List<T>in incremental pipelines is not allowed. - Using
CompilationProvidercauses the generator to re-run for every keystroke in the IDE. - Diagnostics should be reported from analysers (because its almost impossible to get it working incrementally in a generator)
See all the linked discussion from https://github.com/dotnet/roslyn/issues/71629, and the incremental generators cookboook. I have added a test that validates that the generator keeps working incrementally from this point forwards.
The one thing I haven't kept working is the FieldTypeNotDefined/Cannot infer FieldType/"'{0}.{1}' FieldType cannot be inferred" diagnostic. I am happy to fix it but I couldn't figure out in what situation it's supposed to be reported...