BitsKit icon indicating copy to clipboard operation
BitsKit copied to clipboard

Fix memory leaks and performance problems in the source generator

Open ZingBallyhoo opened this issue 7 months ago • 0 comments

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 ISymbol in incremental pipelines is not allowed.
  • Storing SyntaxNodes in incremental pipelines is not allowed.
  • Storing List<T> in incremental pipelines is not allowed.
  • Using CompilationProvider causes 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...

ZingBallyhoo avatar Sep 27 '25 15:09 ZingBallyhoo