Skip to content

Testing the IIncrementalGenerator API for C# for caching method return values

Notifications You must be signed in to change notification settings

lukedays/IncrementalGeneratorTest

Repository files navigation

Incremental Source Generator Test

Testing the IIncrementalGenerator source generator API introduced in .NET 6 by generating cached methods.

How to use

Clone the project. Build profiles: ConsoleApp for the target code, and Generator for debugging the source generator (must have .NET Compiler SDK installed as per this guide). Included a PostsharpApp alternative for comparison.

Known bugs

Unfortunately VS 2022 (v. 17.10.0) needs to be restarted for Intellisense to pick up changes in the source generator project. Also, debug breakpoints don't hit on the source generated files, and intellisense doesn't pick up the references. Workarounds:

GenerateCachedMethod attribute

Automatically generates cached versions of methods, to improve performance by caching method results based on specified expiration times.

GenerateDecoratorMethod attribute

Creates actions to run before, after and on exceptions.

About

Testing the IIncrementalGenerator API for C# for caching method return values

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages