Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Limit ConfigureAwait() polyfill for selected types
Browse files Browse the repository at this point in the history
Otherwise we'll get conflicts calling it on types that implement both IDisposable and IAsyncDisposable
  • Loading branch information
JustArchi committed Jun 19, 2022
1 parent a46c8ec commit 020318c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>3.5.2</Version>
<Version>3.6.0</Version>
</PropertyGroup>

<PropertyGroup>
Expand Down
20 changes: 19 additions & 1 deletion JustArchiNET.Madness/StaticExtensions20.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,25 @@ namespace JustArchiNET.Madness;
[PublicAPI]
public static class StaticExtensions20 {
[MadnessType(EMadnessType.Implementation)]
public static IAsyncDisposable ConfigureAwait(this IDisposable source, bool continueOnCapturedContext) {
public static IAsyncDisposable ConfigureAwait(this Stream source, bool continueOnCapturedContext) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}

return new AsyncDisposableWrapper(source, continueOnCapturedContext);
}

[MadnessType(EMadnessType.Implementation)]
public static IAsyncDisposable ConfigureAwait(this TextWriter source, bool continueOnCapturedContext) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}

return new AsyncDisposableWrapper(source, continueOnCapturedContext);
}

[MadnessType(EMadnessType.Implementation)]
public static IAsyncDisposable ConfigureAwait(this Timer source, bool continueOnCapturedContext) {
if (source == null) {
throw new ArgumentNullException(nameof(source));
}
Expand Down

0 comments on commit 020318c

Please sign in to comment.