From 55dc0fe41b69c42b0c84f02c4b6be01c7ea0467d Mon Sep 17 00:00:00 2001 From: Egil Hansen Date: Mon, 25 Sep 2023 13:48:01 +0000 Subject: [PATCH] fix: generated docs could not reference types only available in .NET 8 --- docs/TimeProviderExtensions.AutoAdvanceBehavior.md | 8 ++++---- src/TimeProviderExtensions/AutoAdvanceBehavior.cs | 10 ++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/TimeProviderExtensions.AutoAdvanceBehavior.md b/docs/TimeProviderExtensions.AutoAdvanceBehavior.md index e744d6a..a6882cc 100644 --- a/docs/TimeProviderExtensions.AutoAdvanceBehavior.md +++ b/docs/TimeProviderExtensions.AutoAdvanceBehavior.md @@ -27,12 +27,12 @@ specified by [TimerAutoTriggerCount](TimeProviderExtensions.AutoAdvanceBehavior. the time the callback was scheduled to be invoked, just as it is if [Advance(TimeSpan)](TimeProviderExtensions.ManualTimeProvider.md#TimeProviderExtensions.ManualTimeProvider.Advance(System.TimeSpan) 'TimeProviderExtensions.ManualTimeProvider.Advance(System.TimeSpan)') or [SetUtcNow(DateTimeOffset)](TimeProviderExtensions.ManualTimeProvider.md#TimeProviderExtensions.ManualTimeProvider.SetUtcNow(System.DateTimeOffset) 'TimeProviderExtensions.ManualTimeProvider.SetUtcNow(System.DateTimeOffset)') was manually called. -Setting this to `1` can be used to ensure all timers, e.g. those used by [Task.Delay(TimeSpan, TimeProvider)](https://docs.microsoft.com/en-us/dotnet/api/Task.Delay#Task_Delay_TimeSpan, TimeProvider_ 'Task.Delay(TimeSpan, TimeProvider)'), -[Task.WaitAsync(TimeSpan, TimeProvider)](https://docs.microsoft.com/en-us/dotnet/api/Task.WaitAsync#Task_WaitAsync_TimeSpan, TimeProvider_ 'Task.WaitAsync(TimeSpan, TimeProvider)'), [System.Threading.CancellationTokenSource.CancelAfter(System.TimeSpan)](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.CancellationTokenSource.CancelAfter#System_Threading_CancellationTokenSource_CancelAfter_System_TimeSpan_ 'System.Threading.CancellationTokenSource.CancelAfter(System.TimeSpan)') and others +Setting this to `1` can be used to ensure all timers, e.g. those used by `Task.Delay(TimeSpan, TimeProvider)`, +`Task.WaitAsync(TimeSpan, TimeProvider)`, `CancellationTokenSource.CancelAfter(TimeSpan)` and others are completed immediately. -Setting this to a number larger than `1`, e.g. `10`, can be used to automatically cause a [PeriodicTimer(TimeSpan, TimeProvider)](https://docs.microsoft.com/en-us/dotnet/api/PeriodicTimer#PeriodicTimer_TimeSpan, TimeProvider_ 'PeriodicTimer(TimeSpan, TimeProvider)') -to automatically have its [System.Threading.PeriodicTimer.WaitForNextTickAsync(System.Threading.CancellationToken)](https://docs.microsoft.com/en-us/dotnet/api/System.Threading.PeriodicTimer.WaitForNextTickAsync#System_Threading_PeriodicTimer_WaitForNextTickAsync_System_Threading_CancellationToken_ 'System.Threading.PeriodicTimer.WaitForNextTickAsync(System.Threading.CancellationToken)') async enumerable return `10` times. +Setting this to a number larger than `1`, e.g. `10`, can be used to automatically cause a `PeriodicTimer(TimeSpan, TimeProvider)` +to automatically have its `PeriodicTimer.WaitForNextTickAsync(CancellationToken)` async enumerable return `10` times. ```csharp public int TimerAutoTriggerCount { get; set; } diff --git a/src/TimeProviderExtensions/AutoAdvanceBehavior.cs b/src/TimeProviderExtensions/AutoAdvanceBehavior.cs index 09a4961..e316054 100644 --- a/src/TimeProviderExtensions/AutoAdvanceBehavior.cs +++ b/src/TimeProviderExtensions/AutoAdvanceBehavior.cs @@ -31,7 +31,6 @@ public sealed record class AutoAdvanceBehavior /// Thrown when set to a value less than . public TimeSpan TimestampAdvanceAmount { get => timestampAdvanceAmount; set { ThrowIfLessThanZero(value); timestampAdvanceAmount = value; } } -#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved /// /// /// Gets or sets the amount of times timer callbacks will automatically be triggered. @@ -43,13 +42,13 @@ public sealed record class AutoAdvanceBehavior /// or was manually called. /// /// - /// Setting this to 1 can be used to ensure all timers, e.g. those used by , - /// , and others + /// Setting this to 1 can be used to ensure all timers, e.g. those used by Task.Delay(TimeSpan, TimeProvider), + /// Task.WaitAsync(TimeSpan, TimeProvider), CancellationTokenSource.CancelAfter(TimeSpan) and others /// are completed immediately. /// /// - /// Setting this to a number larger than 1, e.g. 10, can be used to automatically cause a - /// to automatically have its async enumerable return 10 times. + /// Setting this to a number larger than 1, e.g. 10, can be used to automatically cause a PeriodicTimer(TimeSpan, TimeProvider) + /// to automatically have its PeriodicTimer.WaitForNextTickAsync(CancellationToken) async enumerable return 10 times. /// /// /// @@ -57,7 +56,6 @@ public sealed record class AutoAdvanceBehavior /// /// Thrown when set to a value less than zero 0. public int TimerAutoTriggerCount { get => timerAutoInvokeCount; set { ThrowIfLessThanZero(value); timerAutoInvokeCount = value; } } -#pragma warning restore CS1574 // XML comment has cref attribute that could not be resolved private static void ThrowIfLessThanZero(TimeSpan value, [CallerMemberName] string? parameterName = null) {