Generate non-generic write logic with source generators #3513
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removes a lot of ugly runtime code generation with expression trees.
I'm not completely sure if the complexity really is worth it - maybe just doing this manually everywhere makes more sense and is more maintainable (e.g. as in #3507 (review)). But this is just an opt-in mechanism which can be used where it makes sense, or the relevant code can be written manually.
Note that this doesn't cover all cases - some type handlers would have required more work to get their logic source-generated, and it didn't seem worth the effort.
Part of #2940
Part of #3300
/cc @Brar