Consider adding source-compatible polyfills for ConfigureAwaitOptions.
Possible implementation:
#if !NET8_0_OR_GREATER
/// <summary>Options to control behavior when awaiting.</summary>
internal static class ConfigureAwaitOptions
{
/// <summary>No options specified.</summary>
/// <remarks>
/// <see cref="Task.ConfigureAwait(ConfigureAwaitOptions)"/> with a <see cref="None"/> argument behaves
/// identically to using <see cref="Task.ConfigureAwait(bool)"/> with a <see langword="false"/> argument.
/// </remarks>
public const bool None = false;
/// <summary>
/// Attempt to marshal the continuation back to the original <see cref="SynchronizationContext"/> or
/// <see cref="TaskScheduler"/> present on the originating thread at the time of the await.
/// </summary>
/// <remarks>
/// If there is no such context/scheduler, or if this option is not specified, the thread on
/// which the continuation is invoked is unspecified and left up to the determination of the system.
/// <see cref="Task.ConfigureAwait(ConfigureAwaitOptions)"/> with a <see cref="ContinueOnCapturedContext"/> argument
/// behaves identically to using <see cref="Task.ConfigureAwait(bool)"/> with a <see langword="true"/> argument.
/// </remarks>
public const bool ContinueOnCapturedContext = true;
}
#endif
The other members are not safe to assume to have equivalents before .NET 8.0.
Ther's the possibility that user could use this for ValueTask.ConfigureAwait(bool) and ValueTask<T>.ConfigureAwait(bool), and that would not compile above .NET 8.0.
Consider adding source-compatible polyfills for
ConfigureAwaitOptions.Possible implementation:
The other members are not safe to assume to have equivalents before .NET 8.0.
Ther's the possibility that user could use this for
ValueTask.ConfigureAwait(bool)andValueTask<T>.ConfigureAwait(bool), and that would not compile above .NET 8.0.