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.
I took a crack at writing a source generator to replace the
AsyncOverloads.t4
template. This is a follow up to my PR #1545.Details
The source generator looks for methods annotated with the
[GenerateAsyncOverload]
attribute.It generates a public method with the same signature, return type, generic parameter constraints, etc. that calls the annotated method.
The generator even copies the XML documentation to the public method. 🤓
API Diff
I used Microsoft.DotNet.GenAPI (the tool generates a C# file representing the API of an assembly) to ensure that I didn't accidentally break the API surface.
A pre-generated diff is available in this gist. The only thing that changed is that the
comparer
parameter in the generated methods is now marked as nullable too which is a good change I think?Instructions for verifying the API diff
Here's a .patch file that installs Microsoft.DotNet.GenAPI (can be applied using
git apply <patch-file>
).main
branchdotnet build /p:GenerateReferenceAssemblySource=true /p:GenAPITargetPath=System.Linq.Async-before --framework netcoreapp3.1 --no-incremental Ix.NET/Source/System.Linq.Async
dotnet build /p:GenerateReferenceAssemblySource=true /p:GenAPITargetPath=System.Linq.Async-after --framework netcoreapp3.1 --no-incremental Ix.NET/Source/System.Linq.Async
git diff --no-index -- Ix.NET/Source/System.Linq.Async/System.Linq.Async-before Ix.NET/Source/System.Linq.Async/System.Linq.Async-after
Unrelated changes
I found that having a solution filter that only opens projects needed for System.Linq.Async to be really helpful while working on System.Linq.Async. I can revert the commit ba8ba26 if you don't want the solution filter checked into the repo.