Skip to content

Commit

Permalink
fix: generated docs could not reference types only available in .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Sep 25, 2023
1 parent 7e509f2 commit 55dc0fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions docs/TimeProviderExtensions.AutoAdvanceBehavior.md
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
10 changes: 4 additions & 6 deletions src/TimeProviderExtensions/AutoAdvanceBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public sealed record class AutoAdvanceBehavior
/// <exception cref="ArgumentOutOfRangeException">Thrown when set to a value less than <see cref="TimeSpan.Zero"/>.</exception>
public TimeSpan TimestampAdvanceAmount { get => timestampAdvanceAmount; set { ThrowIfLessThanZero(value); timestampAdvanceAmount = value; } }

#pragma warning disable CS1574 // XML comment has cref attribute that could not be resolved
/// <summary>
/// <para>
/// Gets or sets the amount of times timer callbacks will automatically be triggered.
Expand All @@ -43,21 +42,20 @@ public sealed record class AutoAdvanceBehavior
/// or <see cref="ManualTimeProvider.SetUtcNow(DateTimeOffset)"/> was manually called.
/// </para>
/// <para>
/// Setting this to <c>1</c> can be used to ensure all timers, e.g. those used by <see cref="Task.Delay(TimeSpan, TimeProvider)"/>,
/// <see cref="Task.WaitAsync(TimeSpan, TimeProvider)"/>, <see cref="CancellationTokenSource.CancelAfter(TimeSpan)"/> and others
/// Setting this to <c>1</c> can be used to ensure all timers, e.g. those used by <c>Task.Delay(TimeSpan, TimeProvider)</c>,
/// <c>Task.WaitAsync(TimeSpan, TimeProvider)</c>, <c>CancellationTokenSource.CancelAfter(TimeSpan)</c> and others
/// are completed immediately.
/// </para>
/// <para>
/// Setting this to a number larger than <c>1</c>, e.g. <c>10</c>, can be used to automatically cause a <see cref="PeriodicTimer(TimeSpan, TimeProvider)"/>
/// to automatically have its <see cref="PeriodicTimer.WaitForNextTickAsync(CancellationToken)"/> async enumerable return <c>10</c> times.
/// Setting this to a number larger than <c>1</c>, e.g. <c>10</c>, can be used to automatically cause a <c>PeriodicTimer(TimeSpan, TimeProvider)</c>
/// to automatically have its <c>PeriodicTimer.WaitForNextTickAsync(CancellationToken)</c> async enumerable return <c>10</c> times.
/// </para>
/// </summary>
/// <remarks>
/// Set to <c>0</c> to disable auto timer callback invocation. The default value is zero <c>0</c>.
/// </remarks>
/// <exception cref="ArgumentOutOfRangeException">Thrown when set to a value less than zero <c>0</c>.</exception>
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)
{
Expand Down

0 comments on commit 55dc0fe

Please sign in to comment.