268 instantiations of TimeSpan
BinaryFormatTests (2)
dotnet-svcutil-lib (25)
FrameworkFork\Microsoft.Xml\Xml\schema\XsdDateTime.cs (9)
374return new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
377return new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc);
431ticks = result.Ticks - new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
444ticks = result.Ticks + new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
486result = new DateTimeOffset(dt, new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0));
489result = new DateTimeOffset(dt, new TimeSpan(-xdt.ZoneHour, -xdt.ZoneMinute, 0));
492result = new DateTimeOffset(dt, new TimeSpan(0));
697return _dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0));
699return _dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0));
FilesWebSite (2)
Controllers\DownloadFilesController.cs (2)
30var lastModified = new DateTimeOffset(year: 1999, month: 11, day: 04, hour: 3, minute: 0, second: 0, offset: new TimeSpan(0));
44var lastModified = new DateTimeOffset(year: 1999, month: 11, day: 04, hour: 3, minute: 0, second: 0, offset: new TimeSpan(0));
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Binding\FormDataMapperTests.cs (2)
2127{ "02:01:03", typeof(TimeSpan?), new TimeSpan?(new TimeSpan(02, 01, 03))},
2212{ "02:01:03", typeof(TimeSpan), new TimeSpan(02, 01, 03) },
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (6)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.Build.Framework (2)
Microsoft.Extensions.AI.Abstractions.Tests (1)
Microsoft.Extensions.Caching.Memory (1)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
Microsoft.Extensions.Http (1)
Microsoft.Extensions.Http.Polly (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.Maui.Controls (1)
Microsoft.ML.Data (2)
Microsoft.ML.Tests (16)
Scenarios\Api\TestApi.cs (16)
423DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(1, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 0)
427DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(2, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 10)
431DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(1, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 10)
435DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(2, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 0)
439DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(3, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 20)
443DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(4, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 30)
447DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(3, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 30)
451DateTimeOffsetStrat = new DateTimeOffset(2002, 2, 23, 3, 30, 0, new TimeSpan(4, 0, 0)), TimeSpanStrat = new TimeSpan(2, 0, 20)
Microsoft.Net.Http.Headers (1)
Microsoft.Net.Http.Headers.Tests (26)
PresentationCore (4)
PresentationCore.Tests (4)
System\Windows\DurationConverter.Tests.cs (4)
60yield return new object?[] { "17.22:10:15.4571230", CultureInfo.InvariantCulture, new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), true };
61yield return new object?[] { "17.22:10:15.4571230", new CultureInfo("ru-RU"), new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), true };
73Assert.Throws<ArgumentNullException>(() => converter.ConvertTo(new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), destinationType: null!));
88Assert.Throws<NotSupportedException>(() => converter.ConvertTo(null, null, new Duration(new TimeSpan(17, 22, 10, 15, 457, 123)), destinationType));
PresentationFramework (12)
Shared.Tests (1)
System.Data.Common (8)
System.Data.Odbc (2)
System.Diagnostics.DiagnosticSource (1)
System.DirectoryServices.Protocols (5)
System.Formats.Asn1 (5)
System.Formats.Nrbf (6)
System.Net.Http (5)
System.Net.Mail (10)
System\Net\Mime\SmtpDateTime.cs (10)
67{ "EDT", new TimeSpan(-4, 0, 0) }, // -0400
68{ "EST", new TimeSpan(-5, 0, 0) }, // -0500
69{ "CDT", new TimeSpan(-5, 0, 0) }, // -0500
70{ "CST", new TimeSpan(-6, 0, 0) }, // -0600
71{ "MDT", new TimeSpan(-6, 0, 0) }, // -0600
72{ "MST", new TimeSpan(-7, 0, 0) }, // -0700
73{ "PDT", new TimeSpan(-7, 0, 0) }, // -0700
74{ "PST", new TimeSpan(-8, 0, 0) }, // -0800
324timeZone = new TimeSpan(hours, minutes, 0);
340TimeSpan sanitizedTimeSpan = new TimeSpan(span.Days, span.Hours, span.Minutes, 0, 0);
System.Private.CoreLib (68)
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\RuntimeEventSource.cs (8)
90_gen0GCCounter ??= new IncrementingPollingCounter("gen-0-gc-count", this, () => GC.CollectionCount(0)) { DisplayName = "Gen 0 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
91_gen1GCCounter ??= new IncrementingPollingCounter("gen-1-gc-count", this, () => GC.CollectionCount(1)) { DisplayName = "Gen 1 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
92_gen2GCCounter ??= new IncrementingPollingCounter("gen-2-gc-count", this, () => GC.CollectionCount(2)) { DisplayName = "Gen 2 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
95_monitorContentionCounter ??= new IncrementingPollingCounter("monitor-lock-contention-count", this, () => Monitor.LockContentionCount) { DisplayName = "Monitor Lock Contention Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
97_completedItemsCounter ??= new IncrementingPollingCounter("threadpool-completed-items-count", this, () => ThreadPool.CompletedWorkItemCount) { DisplayName = "ThreadPool Completed Work Item Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
98_allocRateCounter ??= new IncrementingPollingCounter("alloc-rate", this, () => GC.GetTotalAllocatedBytes()) { DisplayName = "Allocation Rate", DisplayUnits = "B", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
106_exceptionCounter ??= new IncrementingPollingCounter("exception-count", this, () => Exception.GetExceptionCount()) { DisplayName = "Exception Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
118_jitTimeCounter ??= new IncrementingPollingCounter("time-in-jit", this, () => Runtime.JitInfo.GetCompilationTime().TotalMilliseconds) { DisplayName = "Time spent in JIT", DisplayUnits = "ms", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (6)
118_baseUtcOffset = new TimeSpan(_baseUtcOffset.Hours, _baseUtcOffset.Minutes, 0);
658result = new TimeSpan(result.Hours, result.Minutes, 0);
727daylightSavingsTimeSpan = new TimeSpan(1, 0, 0);
789result = new TimeSpan(hours, 0, 0);
819timeOffset = new TimeSpan(timeOffset.GetValueOrDefault().Hours, timeOffset.GetValueOrDefault().Minutes, timeOffset.GetValueOrDefault().Seconds);
1306UtcOffset = new TimeSpan(0, 0, TZif_ToInt32(data, index + 00));
System.Private.DataContractSerialization (4)
System.Private.Windows.Core (2)
System.Private.Xml (12)
System\Xml\Schema\XsdDateTime.cs (7)
358XsdDateTimeKind.LocalEastOfZulu => new DateTime(_dt.Subtract(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
359XsdDateTimeKind.LocalWestOfZulu => new DateTime(_dt.Add(new TimeSpan(ZoneHour, ZoneMinute, 0)).Ticks, DateTimeKind.Utc),
412ticks = result.Ticks - new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
425ticks = result.Ticks + new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0).Ticks;
467result = new DateTimeOffset(dt, new TimeSpan(xdt.ZoneHour, xdt.ZoneMinute, 0));
470result = new DateTimeOffset(dt, new TimeSpan(-xdt.ZoneHour, -xdt.ZoneMinute, 0));
473result = new DateTimeOffset(dt, new TimeSpan(0));
System.Resources.Extensions (2)
System.Runtime.Caching (9)
System.ServiceModel.Http (5)
System.ServiceModel.Primitives (3)
System.Text.Json (1)
System.Text.RegularExpressions (1)
System.Threading.RateLimiting (1)
System.Transactions.Local (2)
System.Windows.Controls.Ribbon (2)
12334 references to TimeSpan
AnalyzerRunner (3)
aspire (9)
Aspire.Azure.AI.OpenAI.Tests (2)
Aspire.Cli.Tests (20)
Aspire.Components.Common.TestUtilities (1)
Aspire.Confluent.Kafka (19)
Aspire.Confluent.Kafka.Tests (2)
Aspire.Dashboard (75)
Components\Pages\Metrics.razor.cs (13)
22private List<SelectViewModel<TimeSpan>> _durations = null!;
23private static readonly TimeSpan s_defaultDuration = TimeSpan.FromMinutes(5);
84_durations = new List<SelectViewModel<TimeSpan>>
86new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastOneMinute)], Id = TimeSpan.FromMinutes(1) },
87new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastFiveMinutes)], Id = TimeSpan.FromMinutes(5) },
88new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastFifteenMinutes)], Id = TimeSpan.FromMinutes(15) },
89new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastThirtyMinutes)], Id = TimeSpan.FromMinutes(30) },
90new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastHour)], Id = TimeSpan.FromHours(1) },
91new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastThreeHours)], Id = TimeSpan.FromHours(3) },
92new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastSixHours)], Id = TimeSpan.FromHours(6) },
93new() { Name = Loc[nameof(Dashboard.Resources.Metrics.MetricsLastTwelveHours)], Id = TimeSpan.FromHours(12) },
261public SelectViewModel<TimeSpan> SelectedDuration { get; set; } = null!;
Otlp\Model\DurationFormatter.cs (14)
21new UnitStep { Unit = "d", Ticks = TimeSpan.TicksPerDay, Threshold = TimeSpan.TicksPerDay },
22new UnitStep { Unit = "h", Ticks = TimeSpan.TicksPerHour, Threshold = TimeSpan.TicksPerHour },
23new UnitStep { Unit = "m", Ticks = TimeSpan.TicksPerMinute, Threshold = TimeSpan.TicksPerMinute },
24new UnitStep { Unit = "s", Ticks = TimeSpan.TicksPerSecond, Threshold = TimeSpan.TicksPerSecond / 10, IsDecimal = true },
25new UnitStep { Unit = "ms", Ticks = TimeSpan.TicksPerMillisecond, Threshold = TimeSpan.TicksPerMillisecond / 100, IsDecimal = true },
26new UnitStep { Unit = "μs", Ticks = TimeSpan.TicksPerMicrosecond, Threshold = TimeSpan.TicksPerMicrosecond, IsDecimal = true },
29public static string FormatDuration(TimeSpan duration)
49public static string GetUnit(TimeSpan duration)
ServiceClient\DashboardClient.cs (9)
122KeepAlivePingDelay = TimeSpan.FromSeconds(20),
123KeepAlivePingTimeout = TimeSpan.FromSeconds(10),
155InitialBackoff = TimeSpan.FromSeconds(1),
156MaxBackoff = TimeSpan.FromSeconds(5),
314var delay = ExponentialBackOff(retryContext.ErrorCount, maxSeconds: 15);
340static TimeSpan ExponentialBackOff(int errorCount, double maxSeconds)
342return TimeSpan.FromSeconds(Math.Min(Math.Pow(2, errorCount - 1), maxSeconds));
591await foreach (var batch in channel.GetBatchesAsync(minReadInterval: TimeSpan.FromMilliseconds(100), cancellationToken: enumeratorCancellationToken).ConfigureAwait(false))
685await foreach (var batch in channel.GetBatchesAsync(TimeSpan.FromMilliseconds(100), combinedTokens.Token).ConfigureAwait(false))
Aspire.Dashboard.Components.Tests (28)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Dashboard.Tests (66)
DurationFormatterTests.cs (30)
26Assert.Equal(unit, DurationFormatter.GetUnit(TimeSpan.FromTicks(ticks)));
32Assert.Equal("1μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(1 * TimeSpan.TicksPerMicrosecond)));
38var input = 10 * TimeSpan.TicksPerDay + 13 * TimeSpan.TicksPerHour + 30 * TimeSpan.TicksPerMinute;
39Assert.Equal("10d 14h", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
45var input = 2 * TimeSpan.TicksPerDay + 5 * TimeSpan.TicksPerMinute;
46Assert.Equal("2d", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
52var input = 2 * TimeSpan.TicksPerMillisecond + 357 * TimeSpan.TicksPerMicrosecond;
53Assert.Equal(2.36m.ToString("0.##ms", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
59var input = 2 * TimeSpan.TicksPerSecond + 357 * TimeSpan.TicksPerMillisecond;
60Assert.Equal(2.36m.ToString("0.##s", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
66var input = 2 * TimeSpan.TicksPerMinute + 30 * TimeSpan.TicksPerSecond + 555 * TimeSpan.TicksPerMillisecond;
67Assert.Equal("2m 31s", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
73var input = 2 * TimeSpan.TicksPerHour + 30 * TimeSpan.TicksPerMinute + 30 * TimeSpan.TicksPerSecond;
74Assert.Equal("2h 31m", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
81Assert.Equal(0.92m.ToString("0.##ms", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
87var input = 915 * TimeSpan.TicksPerMillisecond;
88Assert.Equal(0.92m.ToString("0.##s", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
94var input = (double)TimeSpan.TicksPerMicrosecond / 10;
95Assert.Equal(0.1m.ToString("0.##μs", CultureInfo.CurrentCulture), DurationFormatter.FormatDuration(TimeSpan.FromTicks((long)input)));
102Assert.Equal("0μs", DurationFormatter.FormatDuration(TimeSpan.FromTicks(input)));
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.EndToEnd.Tests (15)
Aspire.Hosting (50)
Aspire.Hosting.Azure (5)
Aspire.Hosting.Azure.ServiceBus (7)
Aspire.Hosting.Azure.Sql (1)
Aspire.Hosting.Azure.Tests (51)
Aspire.Hosting.Containers.Tests (3)
Aspire.Hosting.Docker.Tests (1)
Aspire.Hosting.Garnet (7)
Aspire.Hosting.Garnet.Tests (8)
Aspire.Hosting.GitHub.Models.Tests (18)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Kafka.Tests (23)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.MongoDB.Tests (9)
Aspire.Hosting.MySql.Tests (29)
MySqlFunctionalTests.cs (11)
70.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
124.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
303.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
390.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
474.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(1), ShouldHandle = new PredicateBuilder().Handle<MySqlException>() })
616var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
618.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
690var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
692.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
765var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
815var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Nats.Tests (3)
Aspire.Hosting.NodeJs.Tests (19)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.OpenAI (5)
Aspire.Hosting.OpenAI.Tests (18)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Oracle.Tests (8)
Aspire.Hosting.PostgreSQL.Tests (33)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Python.Tests (3)
Aspire.Hosting.Qdrant.Tests (5)
Aspire.Hosting.RabbitMQ.Tests (19)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Redis (6)
Aspire.Hosting.Redis.Tests (8)
Aspire.Hosting.SqlServer.Tests (12)
SqlServerFunctionalTests.cs (12)
24var cts = new CancellationTokenSource(TimeSpan.FromMinutes(3));
64var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
66.AddRetry(new() { MaxRetryAttempts = int.MaxValue, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
129var cts = new CancellationTokenSource(TimeSpan.FromMinutes(10));
131.AddRetry(new() { MaxRetryAttempts = int.MaxValue, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
339var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
341.AddRetry(new() { MaxRetryAttempts = 10, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
405var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
407.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
458var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
460.AddRetry(new() { MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Linear, Delay = TimeSpan.FromSeconds(2) })
534var cts = new CancellationTokenSource(TimeSpan.FromMinutes(5));
Aspire.Hosting.Testing (5)
Aspire.Hosting.Testing.Tests (23)
Aspire.Hosting.Tests (81)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Utils\PeriodicRestartAsyncEnumerableTests.cs (10)
15cts.CancelAfter(TimeSpan.FromSeconds(1));
20var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(CountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(50), cancellationToken));
22await foreach (var _ in PeriodicRestartAsyncEnumerable.CreateAsync(innerFactory, restartInterval: TimeSpan.FromSeconds(2), cancellationToken: cts.Token).ConfigureAwait(false))
24if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2))
39cts.CancelAfter(TimeSpan.FromSeconds(1));
43var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(RefCountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(10), cancellationToken));
45await foreach (var _ in PeriodicRestartAsyncEnumerable.CreateAsync(innerFactory, restartInterval: TimeSpan.FromMilliseconds(100), cancellationToken: cts.Token).ConfigureAwait(false))
47if (DateTime.UtcNow - start > TimeSpan.FromSeconds(2))
58static async IAsyncEnumerable<int> CountingAsyncEnumerable(int start, TimeSpan delay, [EnumeratorCancellation] CancellationToken cancellationToken)
70static async IAsyncEnumerable<int> RefCountingAsyncEnumerable(int start, TimeSpan delay, [EnumeratorCancellation] CancellationToken cancellationToken)
VersionChecking\VersionCheckServiceTests.cs (4)
70var currentDate = new DateTimeOffset(2000, 12, 29, 20, 59, 59, TimeSpan.Zero);
105var currentDate = new DateTimeOffset(2000, 12, 29, 20, 59, 59, TimeSpan.Zero);
145var currentDate = new DateTimeOffset(2000, 12, 29, 20, 59, 59, TimeSpan.Zero);
269public DateTimeOffset UtcNow { get; set; } = new DateTimeOffset(2000, 12, 29, 20, 59, 59, TimeSpan.Zero);
Aspire.Hosting.Valkey (6)
Aspire.Hosting.Valkey.Tests (21)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Hosting.Yarp.Tests (8)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (1)
Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests (13)
Aspire.MongoDB.Driver (1)
Aspire.NATS.Net.Tests (1)
Aspire.Playground.Tests (27)
tests\Shared\AsyncTestHelpers.cs (18)
27public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
28public static TimeSpan LongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(LongTimeoutDuration);
29public static TimeSpan ExtraLongTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(ExtraLongTimeoutDuration);
46cts.CancelAfter(TimeSpan.FromMilliseconds(milliseconds));
73return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
76public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
88return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
91public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
103return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
106public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
118return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
121public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string? filePath = null, [CallerLineNumber] int lineNumber = default)
126public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
159public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
193private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Aspire.Pomelo.EntityFrameworkCore.MySql (2)
Aspire.Qdrant.Client (1)
Aspire.RabbitMQ.Client (1)
Aspire.RabbitMQ.Client.Tests (2)
Aspire.RabbitMQ.Client.v7.Tests (2)
Aspire.StackExchange.Redis (3)
Aspire.StackExchange.Redis.DistributedCaching.Tests (2)
Aspire.StackExchange.Redis.OutputCaching.Tests (2)
Aspire.StackExchange.Redis.Tests (3)
Aspire.Templates.Tests (19)
AuthSamples.FunctionalTests (4)
CustomPolicyProviderTests.cs (4)
51var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
67var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 5)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
82var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 55)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
98var signIn = await SignIn(Client, "Dude", DateTime.Now.Subtract(TimeSpan.FromDays(365 * 20)).ToString(DateTimeFormatInfo.InvariantInfo.ShortDatePattern, CultureInfo.InvariantCulture));
AzureAppConfiguration.Web (1)
AzureSearch.ApiService (1)
BasicWebSite (2)
BinaryFormatTests (7)
Binding.Http.IntegrationTests (2)
Binding.ReliableSession.IntegrationTests (4)
Binding.Tcp.IntegrationTests (5)
CdkSample.AppHost (2)
Client.ChannelLayer.IntegrationTests (3)
Client.ClientBase.IntegrationTests (2)
Client.ExpectedExceptions.IntegrationTests (15)
Client.TypedClient.IntegrationTests (3)
ConfigurationSchemaGenerator (1)
ConfigurationSchemaGenerator.Tests (7)
Consumer (1)
Contract.Service.IntegrationTests (8)
CookieSample (1)
CookieSessionSample (1)
CosmosEndToEnd.ApiService (1)
CustomResources.AppHost (1)
dotnet-dev-certs (4)
dotnet-getdocument (1)
dotnet-openapi (1)
dotnet-svcutil-lib (1310)
FrameworkFork\Microsoft.Xml\Xml\schema\FacetChecker.cs (17)
830internal virtual Exception CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1212TimeSpan timeSpanValue = (TimeSpan)datatype.ValueConverter.ChangeType(value, typeof(TimeSpan));
1216internal override Exception CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1223if (TimeSpan.Compare(value, (TimeSpan)restriction.MaxInclusive) > 0)
1231if (TimeSpan.Compare(value, (TimeSpan)restriction.MaxExclusive) >= 0)
1239if (TimeSpan.Compare(value, (TimeSpan)restriction.MinInclusive) < 0)
1247if (TimeSpan.Compare(value, (TimeSpan)restriction.MinExclusive) <= 0)
1263return MatchEnumeration((TimeSpan)value, enumeration);
1266private bool MatchEnumeration(TimeSpan value, ArrayList enumeration)
1270if (TimeSpan.Compare(value, (TimeSpan)enumeration[i]) == 0)
FrameworkFork\System.Runtime.Serialization\System\Xml\ArrayHelper.cs (6)
368internal class TimeSpanArrayHelperWithString : ArrayHelper<string, TimeSpan>
372protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
377protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
383internal class TimeSpanArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, TimeSpan>
387protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
392protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (6)
238public override TimeSpan ReadElementContentAsTimeSpan()
245TimeSpan value = BufferReader.ReadTimeSpan();
1173type = typeof(TimeSpan);
1498private int ReadArray(TimeSpan[] array, int offset, int count)
1510public override int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1517public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryWriter.cs (5)
897public override void WriteTimeSpanText(TimeSpan value)
972public void WriteTimeSpanArray(TimeSpan[] array, int offset, int count)
1214else if (type == typeof(TimeSpan))
1609public override void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1622public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryAsyncCheckWriter.cs (3)
375public override void WriteValue(TimeSpan value)
516public override void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
522public override void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryReader.cs (7)
561public virtual TimeSpan ReadContentAsTimeSpan()
813public virtual TimeSpan ReadElementContentAsTimeSpan()
816TimeSpan value;
1173public virtual TimeSpan[] ReadTimeSpanArray(string localName, string namespaceUri)
1178public virtual TimeSpan[] ReadTimeSpanArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1183public virtual int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1195public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlDictionaryWriter.cs (5)
184public virtual void WriteValue(TimeSpan value)
276else if (type == typeof(TimeSpan))
305else if (type == typeof(TimeSpan))
571public virtual void WriteArray(string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
582public virtual void WriteArray(string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\InputQueue.cs (17)
75public IAsyncResult BeginDequeue(TimeSpan timeout, AsyncCallback callback, object state)
113public IAsyncResult BeginWaitForItem(TimeSpan timeout, AsyncCallback callback, object state)
146public T Dequeue(TimeSpan timeout)
159public bool Dequeue(TimeSpan timeout, out T value)
392public bool WaitForItem(TimeSpan timeout)
804public AsyncQueueReader(InputQueue<T> inputQueue, TimeSpan timeout, AsyncCallback callback, object state)
812if (timeout != TimeSpan.MaxValue)
814_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
840_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
867public AsyncQueueWaiter(TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
869if (timeout != TimeSpan.MaxValue)
871_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
896timely = (_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
1031public bool Wait(TimeSpan timeout, out T value)
1093public bool Wait(TimeSpan timeout)
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (47)
14public static readonly TimeSpan MaxWait = TimeSpan.FromMilliseconds(Int32.MaxValue);
22private TimeSpan _originalTimeout;
24public TimeoutHelper(TimeSpan timeout)
26Contract.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative");
31_deadlineSet = (timeout == TimeSpan.MaxValue);
43var timeout = RemainingTime();
48else if (timeout > TimeSpan.Zero)
63public TimeSpan OriginalTimeout
68public static bool IsTooLarge(TimeSpan timeout)
70return (timeout > TimeoutHelper.MaxWait) && (timeout != TimeSpan.MaxValue);
73public static TimeSpan FromMilliseconds(int milliseconds)
77return TimeSpan.MaxValue;
81return TimeSpan.FromMilliseconds(milliseconds);
85public static int ToMilliseconds(TimeSpan timeout)
87if (timeout == TimeSpan.MaxValue)
94if (ticks / TimeSpan.TicksPerMillisecond > int.MaxValue)
102public static TimeSpan Min(TimeSpan val1, TimeSpan val2)
114public static TimeSpan Add(TimeSpan timeout1, TimeSpan timeout2)
119public static DateTime Add(DateTime time, TimeSpan timeout)
121if (timeout >= TimeSpan.Zero && DateTime.MaxValue - time <= timeout)
125if (timeout <= TimeSpan.Zero && DateTime.MinValue - time >= timeout)
132public static DateTime Subtract(DateTime time, TimeSpan timeout)
134return Add(time, TimeSpan.Zero - timeout);
137public static TimeSpan Divide(TimeSpan timeout, int factor)
139if (timeout == TimeSpan.MaxValue)
141return TimeSpan.MaxValue;
147public TimeSpan RemainingTime()
156return TimeSpan.MaxValue;
160TimeSpan remaining = _deadline - DateTime.UtcNow;
161if (remaining <= TimeSpan.Zero)
163return TimeSpan.Zero;
172public TimeSpan ElapsedTime()
184public static void ThrowIfNegativeArgument(TimeSpan timeout)
189public static void ThrowIfNegativeArgument(TimeSpan timeout, string argumentName)
191if (timeout < TimeSpan.Zero)
197public static void ThrowIfNonPositiveArgument(TimeSpan timeout)
202public static void ThrowIfNonPositiveArgument(TimeSpan timeout, string argumentName)
204if (timeout <= TimeSpan.Zero)
210public static bool WaitOne(WaitHandle waitHandle, TimeSpan timeout)
213if (timeout == TimeSpan.MaxValue)
226internal static TimeoutException CreateEnterTimedOutException(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\BufferedConnection.cs (26)
19private TimeSpan _flushTimeout;
20private TimeSpan _pendingTimeout;
23public BufferedConnection(IConnection connection, TimeSpan flushTimeout, int writeBufferSize)
35public override void Close(TimeSpan timeout, bool asyncAndLinger)
46_flushTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
47_pendingTimeout = TimeSpan.Zero;
51private void Flush(TimeSpan timeout)
61private void FlushCore(TimeSpan timeout)
77_pendingTimeout = TimeSpan.Zero;
96_flushTimer = new Timer(new TimerCallback(new Action<object>(OnFlushTimer)), null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
99_flushTimer.Change(_flushTimeout, TimeSpan.FromMilliseconds(-1));
102public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
111if (immediate || _flushTimeout == TimeSpan.Zero)
122public override void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
131if (immediate || _flushTimeout == TimeSpan.Zero)
141private void WriteNow(byte[] buffer, int offset, int size, TimeSpan timeout)
146private void WriteNow(byte[] buffer, int offset, int size, TimeSpan timeout, BufferManager bufferManager)
184private void WriteLater(byte[] buffer, int offset, int size, TimeSpan timeout)
238public override AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, Action<object> callback, object state)
270private TimeSpan _flushTimeout;
273public BufferedConnectionInitiator(IConnectionInitiator connectionInitiator, TimeSpan flushTimeout, int writeBufferSize)
280protected TimeSpan FlushTimeout
296public IConnection Connect(Uri uri, TimeSpan timeout)
301public async Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ChainedAsyncResult.cs (9)
10internal delegate IAsyncResult ChainedBeginHandler(TimeSpan timeout, AsyncCallback asyncCallback, object state);
22protected ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state)
28public ChainedAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, ChainedBeginHandler begin2, ChainedEndHandler end2)
132public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
140public ChainedCloseAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
152private IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
167public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, IList<ICommunicationObject> collection)
175public ChainedOpenAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, ChainedBeginHandler begin1, ChainedEndHandler end1, params ICommunicationObject[] objs)
187private IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CommunicationObject.cs (28)
67protected abstract TimeSpan DefaultCloseTimeout { get; }
68protected abstract TimeSpan DefaultOpenTimeout { get; }
70internal TimeSpan InternalCloseTimeout
75internal TimeSpan InternalOpenTimeout
121public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
131public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
141public void Close(TimeSpan timeout)
146private async Task CloseAsyncInternal(TimeSpan timeout)
152async Task IAsyncCommunicationObject.CloseAsync(TimeSpan timeout)
154if (timeout < TimeSpan.Zero)
316public void Open(TimeSpan timeout)
321private async Task OpenAsyncInternal(TimeSpan timeout)
327async Task IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
329if (timeout < TimeSpan.Zero)
348TimeSpan remainingTime = actualTimeout.RemainingTime();
746protected abstract void OnClose(TimeSpan timeout);
748protected abstract IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);
752protected abstract void OnOpen(TimeSpan timeout);
754protected abstract IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state);
758internal protected virtual Task OnCloseAsync(TimeSpan timeout)
764internal protected virtual Task OnOpenAsync(TimeSpan timeout)
798public static TimeSpan GetInternalCloseTimeout(this CommunicationObject communicationObject)
803public static void OnClose(CommunicationObject communicationObject, TimeSpan timeout)
808public static IAsyncResult OnBeginClose(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
818public static void OnOpen(CommunicationObject communicationObject, TimeSpan timeout)
823public static IAsyncResult OnBeginOpen(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
828public static async Task OnCloseAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
834public static async Task OnOpenAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\Connection.cs (31)
22void Close(TimeSpan timeout, bool asyncAndLinger);
24AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
27void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout);
28void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager);
30int Read(byte[] buffer, int offset, int size, TimeSpan timeout);
31AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state);
38IConnection Connect(Uri uri, TimeSpan timeout);
39Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout);
72public virtual void Close(TimeSpan timeout, bool asyncAndLinger)
77public virtual AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
88public virtual void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
93public virtual void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
98public virtual int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
103public virtual AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout,
154public override int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
170public override AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state)
202private TimeSpan _closeTimeout;
244public TimeSpan CloseTimeout
426protected int Read(byte[] buffer, int offset, int count, TimeSpan timeout)
536public void Close(TimeSpan timeout, bool asyncAndLinger)
549public AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
614public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
628public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
634private void SetReadTimeout(TimeSpan timeout)
644private void SetWriteTimeout(TimeSpan timeout)
654public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
667public AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout, Action<object> callback, object state)
744internal static void CloseNoThrow(IConnection connection, TimeSpan timeout)
814internal static async Task WriteAsync(this IConnection connection, byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
828internal static async Task<int> ReadAsync(this IConnection connection, int offset, int size, TimeSpan timeout)
846internal static async Task<int> ReadAsync(this IConnection connection, byte[] buffer, int offset, int size, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionPool.cs (19)
47protected abstract void CloseItem(TItem item, TimeSpan timeout);
48protected abstract void CloseItemAsync(TItem item, TimeSpan timeout);
57public bool Close(TimeSpan timeout)
120private EndpointConnectionPool GetEndpointPool(TKey key, TimeSpan timeout)
169private void OnClose(TimeSpan timeout)
193public void AddConnection(TKey key, TItem connection, TimeSpan timeout)
200public TItem TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, out TKey key)
208public void ReturnConnection(TKey key, TItem connection, bool connectionIsStillGood, TimeSpan timeout)
295protected virtual void CloseItem(TItem item, TimeSpan timeout)
300protected virtual void CloseItemAsync(TItem item, TimeSpan timeout)
325public void Close(TimeSpan timeout)
384public void AddConnection(TItem connection, TimeSpan timeout)
417public TItem TakeConnection(TimeSpan timeout)
471public void ReturnConnection(TItem connection, bool connectionIsStillGood, TimeSpan timeout)
509public void CloseIdleConnection(TItem connection, TimeSpan timeout)
602private TimeSpan _maxOutputDelay;
605protected ConnectionPool(IConnectionOrientedTransportChannelFactorySettings settings, TimeSpan leaseTimeout)
623protected override void CloseItem(IConnection item, TimeSpan timeout)
628protected override void CloseItemAsync(IConnection item, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ConnectionPoolHelper.cs (12)
46protected abstract TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException);
48private IConnection TakeConnection(TimeSpan timeout)
53public async Task<IConnection> EstablishConnectionAsync(TimeSpan timeout)
90_connectionPool.ReturnConnection(_connectionKey, localRawConnection, false, TimeSpan.Zero);
100TimeSpan connectTimeout = timeoutHelper.RemainingTime();
135public IConnection EstablishConnection(TimeSpan timeout)
172_connectionPool.ReturnConnection(_connectionKey, localRawConnection, false, TimeSpan.Zero);
182TimeSpan connectTimeout = timeoutHelper.RemainingTime();
228_connectionPool.ReturnConnection(_connectionKey, rawConnection, false, TimeSpan.Zero);
246ReleaseConnection(true, TimeSpan.Zero);
249public void Close(TimeSpan timeout)
254private void ReleaseConnection(bool abort, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrSocketConnection.cs (31)
30private TimeSpan _readFinTimeout;
51_sendTimeout = _receiveTimeout = TimeSpan.MaxValue;
65_sendTimer = new Timer(s_onSendTimeout, this, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
83_receiveTimer = new Timer(s_onReceiveTimeout, this, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
221_receiveTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
229_sendTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
311private void ContinueClose(TimeSpan timeout)
341protected override void ShutdownCore(TimeSpan timeout)
351ConvertSendException(socketException, TimeSpan.MaxValue));
367protected override AsyncCompletionResult BeginWriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
403ConvertSendException(socketException, TimeSpan.MaxValue));
464_asyncWriteException = ConvertSendException(socketException, TimeSpan.MaxValue);
519protected override void WriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
577protected override int ReadCore(byte[] buffer, int offset, int size, TimeSpan timeout, bool closing)
626protected override AsyncCompletionResult BeginReadCore(int offset, int size, TimeSpan timeout,
664throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(ConvertReceiveException(socketException, TimeSpan.MaxValue));
704_asyncReadException = ConvertReceiveException(socketException, TimeSpan.MaxValue);
793private void SetReadTimeout(TimeSpan timeout, bool synchronous, bool closing)
800if (timeout <= TimeSpan.Zero)
822if (timeout == TimeSpan.MaxValue)
828ReceiveTimer.Change(timeout, TimeSpan.FromMilliseconds(-1));
833private void SetWriteTimeout(TimeSpan timeout, bool synchronous)
840if (timeout <= TimeSpan.Zero)
859if (timeout == TimeSpan.MaxValue)
865SendTimer.Change(timeout, TimeSpan.FromMilliseconds(-1));
870private bool UpdateTimeout(TimeSpan oldTimeout, TimeSpan newTimeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\FramingChannels.cs (15)
52protected override void CloseOutputSessionCore(TimeSpan timeout)
57protected override Task CloseOutputSessionCoreAsync(TimeSpan timeout)
62protected override void CompleteClose(TimeSpan timeout)
76protected override void OnSendCore(Message message, TimeSpan timeout)
88protected override AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state)
99protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state)
105protected override AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state)
219protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
241private async Task<IConnection> SendPreambleAsync(IConnection connection, ArraySegment<byte> preamble, TimeSpan timeout)
315protected internal override async Task OnOpenAsync(TimeSpan timeout)
343protected override void OnOpen(TimeSpan timeout)
371protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
425protected override TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException)
447Uri via, string contentType, TimeSpan timeout)
560ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelFactory.cs (15)
362private SecurityTokenProviderContainer CreateAndOpenTokenProvider(TimeSpan timeout, AuthenticationSchemes authenticationScheme,
480protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
490protected override void OnOpen(TimeSpan timeout)
504internal protected override Task OnOpenAsync(TimeSpan timeout)
510protected internal override Task OnCloseAsync(TimeSpan timeout)
646private void CreateAndOpenTokenProvidersCore(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout, out SecurityTokenProviderContainer tokenProvider)
652internal void CreateAndOpenTokenProviders(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout, out SecurityTokenProviderContainer tokenProvider)
729private void CreateAndOpenTokenProviders(TimeSpan timeout)
738private void CloseTokenProviders(TimeSpan timeout)
755protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
765protected override void OnOpen(TimeSpan timeout)
770internal protected override Task OnOpenAsync(TimeSpan timeout)
788protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
798protected override void OnClose(TimeSpan timeout)
803protected internal override async Task OnCloseAsync(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\IdlingCommunicationPool.cs (18)
18private TimeSpan _idleTimeout;
19private TimeSpan _leaseTimeout;
21protected IdlingCommunicationPool(int maxCount, TimeSpan idleTimeout, TimeSpan leaseTimeout)
28public TimeSpan IdleTimeout
33protected TimeSpan LeaseTimeout
38protected override void CloseItemAsync(TItem item, TimeSpan timeout)
46if (_idleTimeout != TimeSpan.MaxValue || _leaseTimeout != TimeSpan.MaxValue)
77protected override void CloseItemAsync(TItem item, TimeSpan timeout)
83protected override void CloseItem(TItem item, TimeSpan timeout)
104private TimeSpan _idleTimeout;
105private TimeSpan _leaseTimeout;
185_idleTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
200_idleTimer = new Timer(new TimerCallback(new Action<object>(s_onIdle)), this, _idleTimeout, TimeSpan.FromMilliseconds(-1));
204_idleTimer.Change(_idleTimeout, TimeSpan.FromMilliseconds(-1));
285_idleTimer.Change(_idleTimeout, TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\LayeredChannelFactory.cs (16)
40protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
50protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
60protected override void OnClose(TimeSpan timeout)
67protected override void OnOpen(TimeSpan timeout)
110public Message Receive(TimeSpan timeout)
122public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
134public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
146public bool TryReceive(TimeSpan timeout, out Message message)
153public bool WaitForMessage(TimeSpan timeout)
158public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
211protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
221protected override void OnClose(TimeSpan timeout)
228protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
238protected override void OnOpen(TimeSpan timeout)
250public void Send(Message message, TimeSpan timeout)
260public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\LifetimeManager.cs (19)
69public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
80public void Close(TimeSpan timeout)
92private CommunicationWaitResult CloseCore(TimeSpan timeout, bool aborting)
189CloseCore(TimeSpan.FromSeconds(1), true);
192protected virtual IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
225protected virtual void OnClose(TimeSpan timeout)
267CommunicationWaitResult Wait(TimeSpan timeout, bool aborting);
276private TimeSpan _timeout;
278public CloseCommunicationAsyncResult(TimeSpan timeout, AsyncCallback callback, object state, object mutex)
285if (timeout < TimeSpan.Zero)
288_timer = new Timer(new TimerCallback(new Action<object>(TimeoutCallback)), this, timeout, TimeSpan.FromMilliseconds(-1));
313_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
334public CommunicationWaitResult Wait(TimeSpan timeout, bool aborting)
336if (timeout < TimeSpan.Zero)
352_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
400public CommunicationWaitResult Wait(TimeSpan timeout, bool aborting)
406if (timeout < TimeSpan.Zero)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\RequestContextBase.cs (13)
15private TimeSpan _defaultSendTimeout;
16private TimeSpan _defaultCloseTimeout;
25protected RequestContextBase(Message requestMessage, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
88public TimeSpan DefaultCloseTimeout
93public TimeSpan DefaultSendTimeout
125public override void Close(TimeSpan timeout)
127if (timeout < TimeSpan.Zero)
185protected abstract void OnClose(TimeSpan timeout);
186protected abstract void OnReply(Message message, TimeSpan timeout);
187protected abstract IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state);
229public override IAsyncResult BeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
252public override void Reply(Message message, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannel.cs (55)
47private TimeSpan _operationTimeout;
175protected override TimeSpan DefaultCloseTimeout
180protected override TimeSpan DefaultOpenTimeout
211internal TimeSpan CloseTimeout
302internal TimeSpan OpenTimeout
317public TimeSpan OperationTimeout
322if (value < TimeSpan.Zero)
465manager.CallOnce(TimeSpan.MaxValue, null);
475return manager.BeginCallOnce(TimeSpan.MaxValue, null, callback, state);
497private void EnsureOpened(TimeSpan timeout)
509private IAsyncResult BeginEnsureOpened(TimeSpan timeout, AsyncCallback callback, object state)
683internal IAsyncResult BeginCall(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, TimeSpan timeout, AsyncCallback callback, object asyncState)
725internal object Call(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, object[] outs, TimeSpan timeout)
877private TimeoutException GetOpenTimeoutException(TimeSpan timeout)
1191public void Send(Message message, TimeSpan timeout)
1202public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1218public Message Request(Message message, TimeSpan timeout)
1229public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1261protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1271protected override void OnClose(TimeSpan timeout)
1276protected internal override async Task OnCloseAsync(TimeSpan timeout)
1319protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1329protected override void OnOpen(TimeSpan timeout)
1334protected internal override async Task OnOpenAsync(TimeSpan timeout)
1415IAsyncResult IDuplexContextChannel.BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
1425void IDuplexContextChannel.CloseOutputSession(TimeSpan timeout)
1659string action, object[] inputParameters, bool isOneWay, TimeSpan timeout,
1732TimeSpan timeout = Rpc.TimeoutHelper.RemainingTime();
1798TimeSpan timeout = Rpc.TimeoutHelper.RemainingTime();
1910void Call(ServiceChannel channel, TimeSpan timeout);
1911IAsyncResult BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state);
1932private void ValidateTimeoutIsMaxValue(TimeSpan timeout)
1934if (timeout != TimeSpan.MaxValue)
1940void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
1946IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
1974void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
1979IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
2011internal void CallOnce(TimeSpan timeout, CallOnceManager cascade)
2060internal IAsyncResult BeginCallOnce(TimeSpan timeout, CallOnceManager cascade,
2226internal bool Wait(TimeSpan timeout)
2266private TimeSpan _timeout;
2269internal AsyncWaiter(CallOnceManager manager, TimeSpan timeout,
2276if (timeout != TimeSpan.MaxValue)
2278_timer = new Timer(new TimerCallback(s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
2289if ((_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)))
2302if ((_timer == null) || _timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)))
2342private SessionIdleManager(IChannelBinder binder, TimeSpan idle)
2345_timer = new Timer(new TimerCallback(GetTimerCallback()), this, idle, TimeSpan.FromMilliseconds(-1));
2350internal static SessionIdleManager CreateIfNeeded(IChannelBinder binder, TimeSpan idle)
2352if (binder.HasSession && (idle != TimeSpan.MaxValue))
2378_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
2447_timer.Change(Ticks.ToTimeSpan(abortTime - ticksNow), TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannelProxy.cs (11)
573void ICommunicationObject.Close(TimeSpan timeout)
583IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
598void ICommunicationObject.Open(TimeSpan timeout)
608IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
688TimeSpan IContextChannel.OperationTimeout
735IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
750void IOutputChannel.Send(Message message, TimeSpan timeout)
760Message IRequestChannel.Request(Message message, TimeSpan timeout)
770IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
780public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
790public void CloseOutputSession(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\SocketConnection.cs (30)
17protected TimeSpan _sendTimeout;
18protected TimeSpan _receiveTimeout;
53_sendTimeout = _receiveTimeout = TimeSpan.MaxValue;
112public void Close(TimeSpan timeout, bool asyncAndLinger)
133private void Shutdown(TimeSpan timeout)
148protected abstract void ShutdownCore(TimeSpan timeout);
170protected Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime)
176protected Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime)
182internal static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException)
185TransferOperation.Undefined, false, null, TransferOperation.Undefined, null, TimeSpan.MaxValue);
204private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException,
206SocketConnection socketConnection, TimeSpan remainingTime)
220remainingTime <= TimeSpan.Zero)
274public AsyncCompletionResult BeginWrite(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
287protected abstract AsyncCompletionResult BeginWriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout,
308public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
313protected abstract void WriteCore(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout);
315public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
327public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
340protected abstract int ReadCore(byte[] buffer, int offset, int size, TimeSpan timeout, bool closing);
342public virtual AsyncCompletionResult BeginRead(int offset, int size, TimeSpan timeout,
358protected abstract AsyncCompletionResult BeginReadCore(int offset, int size, TimeSpan timeout,
435public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException)
450if (timeSpent == TimeSpan.MaxValue)
471if (timeSpent == TimeSpan.MaxValue)
512private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, IPAddress[] addresses, int invalidAddressCount,
535public IConnection Connect(Uri uri, TimeSpan timeout)
551if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
587public async Task<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
603if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TransportDefaults.cs (10)
193public static TimeSpan IdleTimeout { get { return TimeSpanHelper.FromMinutes(2, IdleTimeoutString); } }
195public static TimeSpan ChannelInitializationTimeout { get { return TimeSpanHelper.FromSeconds(30, ChannelInitializationTimeoutString); } }
200public static TimeSpan MaxOutputDelay { get { return TimeSpanHelper.FromMilliseconds(200, MaxOutputDelayString); } }
226public static TimeSpan ConnectionLeaseTimeout { get { return TimeSpanHelper.FromMinutes(5, TcpTransportDefaults.ConnectionLeaseTimeoutString); } }
271public static TimeSpan RequestInitializationTimeout { get { return TimeSpanHelper.FromMilliseconds(0, RequestInitializationTimeoutString); } }
308public static TimeSpan IdleTimeout { get { return TimeSpanHelper.FromMinutes(2, IdleTimeoutString); } }
311public static TimeSpan LeaseTimeout { get { return TimeSpanHelper.FromMinutes(10, LeaseTimeoutString); } }
320internal static TimeSpan AcknowledgementInterval { get { return TimeSpanHelper.FromMilliseconds(200, AcknowledgementIntervalString); } }
324internal static TimeSpan InactivityTimeout { get { return TimeSpanHelper.FromMinutes(10, InactivityTimeoutString); } }
354public static readonly TimeSpan DefaultKeepAliveInterval = TimeSpanHelper.FromSeconds(0, DefaultKeepAliveIntervalString);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (29)
89public Message Receive(TimeSpan timeout)
120public async Task<Message> ReceiveAsync(TimeSpan timeout)
156public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
166public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
191public bool TryReceive(TimeSpan timeout, out Message message)
209public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
232public bool WaitForMessage(TimeSpan timeout)
255public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
270protected abstract Task CloseOutputSessionCoreAsync(TimeSpan timeout);
272protected abstract void CloseOutputSessionCore(TimeSpan timeout);
274protected async Task CloseOutputSessionAsync(TimeSpan timeout)
329protected void CloseOutputSession(TimeSpan timeout)
385protected abstract void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout);
389this.ReturnConnectionIfNecessary(true, TimeSpan.Zero);
395this.ReturnConnectionIfNecessary(true, TimeSpan.Zero);
398protected internal override async Task OnCloseAsync(TimeSpan timeout)
413protected override void OnClose(TimeSpan timeout)
428protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
488protected abstract AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state);
490protected abstract AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state);
498protected abstract void OnSendCore(Message message, TimeSpan timeout);
500protected abstract AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state);
502protected override async Task OnSendAsync(Message message, TimeSpan timeout)
607protected override void OnSend(Message message, TimeSpan timeout)
658protected abstract void CompleteClose(TimeSpan timeout);
669private async Task EnsureInputClosedAsync(TimeSpan timeout)
682private void EnsureInputClosed(TimeSpan timeout)
780public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
795public void CloseOutputSession(TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\UdpRetransmissionSettings.cs (24)
16private TimeSpan _delayLowerBound;
17private TimeSpan _delayUpperBound;
18private TimeSpan _maxDelayPerRetransmission;
35public UdpRetransmissionSettings(int maxUnicastRetransmitCount, int maxMulticastRetransmitCount, TimeSpan delayLowerBound, TimeSpan delayUpperBound, TimeSpan maxDelayPerRetransmission)
50if (delayLowerBound < TimeSpan.Zero)
52throw FxTrace.Exception.ArgumentOutOfRange("delayLowerBound", delayLowerBound, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
55if (delayUpperBound < TimeSpan.Zero)
57throw FxTrace.Exception.ArgumentOutOfRange("delayUpperBound", delayUpperBound, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
60if (maxDelayPerRetransmission < TimeSpan.Zero)
63string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
120public TimeSpan DelayLowerBound
128if (value < TimeSpan.Zero)
130throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
138public TimeSpan DelayUpperBound
146if (value < TimeSpan.Zero)
148throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
156public TimeSpan MaxDelayPerRetransmission
164if (value < TimeSpan.Zero)
166throw FxTrace.Exception.ArgumentOutOfRange("value", value, string.Format(SRServiceModel.ArgumentOutOfMinRange, TimeSpan.Zero));
265private bool TimeSpansEqual(TimeSpan ts1, TimeSpan ts2)
269return diff < TimeSpan.FromMilliseconds(1).Ticks || (max > 0 && diff / (double)max < 1e-3);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketHelper.cs (6)
120internal static void ThrowCorrectException(Exception ex, TimeSpan timeout, string operation)
129TimeSpan.MinValue, // this is a dummy since operation type is null, so the timespan value won't be used
135internal static Exception ConvertAndTraceException(Exception ex, TimeSpan timeout, string operation)
189internal static void ThrowExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
202internal static Exception CreateExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
215internal static TimeoutException GetTimeoutException(Exception innerException, TimeSpan timeout, string operation)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (22)
93protected override void CompleteClose(TimeSpan timeout)
112protected override void CloseOutputSessionCore(TimeSpan timeout)
126protected override async Task CloseOutputSessionCoreAsync(TimeSpan timeout)
158protected override void OnClose(TimeSpan timeout)
170protected internal override async Task OnCloseAsync(TimeSpan timeout)
182protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
186protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state)
226protected override AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state)
248protected override AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state)
266protected override void OnSendCore(Message message, TimeSpan timeout)
396private async void HandleCloseOutputAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
412private async void HandleSendAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
474private TimeSpan _asyncReceiveTimeout;
516public async Task<Message> ReceiveAsync(TimeSpan timeout)
539public Message Receive(TimeSpan timeout)
614WebSocketHelper.ThrowCorrectException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
644_pendingException = WebSocketHelper.ConvertAndTraceException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
655public bool WaitForMessage(TimeSpan timeout)
674public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
890private readonly TimeSpan _closeTimeout;
910TimeSpan closeTimeout)
926TimeSpan closeTimeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\ClientBase.cs (17)
193void ICommunicationObject.Open(TimeSpan timeout)
200void ICommunicationObject.Close(TimeSpan timeout)
284IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
299IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
311internal IAsyncResult BeginFactoryOpen(TimeSpan timeout, AsyncCallback callback, object state)
321internal IAsyncResult BeginChannelOpen(TimeSpan timeout, AsyncCallback callback, object state)
331internal IAsyncResult BeginFactoryClose(TimeSpan timeout, AsyncCallback callback, object state)
348internal IAsyncResult BeginChannelClose(TimeSpan timeout, AsyncCallback callback, object state)
635TimeSpan IContextChannel.OperationTimeout
706void ICommunicationObject.Close(TimeSpan timeout)
716IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
731void ICommunicationObject.Open(TimeSpan timeout)
741IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
776void IOutputChannel.Send(Message message, TimeSpan timeout)
786IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
811Message IRequestChannel.Request(Message message, TimeSpan timeout)
821IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\BufferedReceiveBinder.cs (10)
62public void CloseAfterFault(TimeSpan timeout)
73public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
95public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
130public void Send(Message message, TimeSpan timeout)
135public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
145public Message Request(Message message, TimeSpan timeout)
150public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
160public bool WaitForMessage(TimeSpan timeout)
165public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
193if (binder._channelBinder.TryReceive(TimeSpan.MaxValue, out requestContext))
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DuplexChannelBinder.cs (43)
20private TimeSpan _defaultCloseTimeout;
21private TimeSpan _defaultSendTimeout;
63public TimeSpan DefaultCloseTimeout
89public TimeSpan DefaultSendTimeout
198public void CloseAfterFault(TimeSpan timeout)
245private TimeoutException GetReceiveTimeoutException(TimeSpan timeout)
304public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
348public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
358public void Send(Message message, TimeSpan timeout)
363public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
414public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
444public Message Request(Message message, TimeSpan timeout)
482TimeSpan remaining = timeoutHelper.RemainingTime();
613public bool WaitForMessage(TimeSpan timeout)
618public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
644protected override void OnClose(TimeSpan timeout)
648protected override void OnReply(Message message, TimeSpan timeout)
656protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
671public ReplyAsyncResult(DuplexRequestContext context, Message message, TimeSpan timeout, AsyncCallback callback, object state)
762internal Message WaitForReply(TimeSpan timeout)
811private TimeSpan _timeout;
816internal AsyncDuplexRequest(Message message, DuplexChannelBinder parent, TimeSpan timeout, AsyncCallback callback, object state)
822if (timeout != TimeSpan.MaxValue)
824_timer = new Timer(new TimerCallback(AsyncDuplexRequest.s_timerCallback), this, timeout, TimeSpan.FromMilliseconds(-1));
885_timer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
1113private TimeSpan DefaultCloseTimeout
1130private TimeSpan DefaultReceiveTimeout
1159result = _innerChannel.BeginReceive(TimeSpan.MaxValue, s_receiveAsyncCallback, this);
1328public Message Receive(TimeSpan timeout)
1338public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
1348public bool TryReceive(TimeSpan timeout, out Message message)
1353public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
1363public bool WaitForMessage(TimeSpan timeout)
1368public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
1394public void Close(TimeSpan timeout)
1417public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1460public void Open(TimeSpan timeout)
1471public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1487public void Send(Message message, TimeSpan timeout)
1497public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1549public void WaitForBackgroundClose(TimeSpan timeout)
1556public IAsyncResult BeginWaitForBackgroundClose(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\IChannelBinder.cs (9)
18void CloseAfterFault(TimeSpan timeout);
20bool TryReceive(TimeSpan timeout, out RequestContext requestContext);
21IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state);
24void Send(Message message, TimeSpan timeout);
25IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state);
28Message Request(Message message, TimeSpan timeout);
29IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state);
32bool WaitForMessage(TimeSpan timeout);
33IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\InputChannelBinder.cs (14)
62public void CloseAfterFault(TimeSpan timeout)
67public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
92public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
102public void Send(Message message, TimeSpan timeout)
107public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
122public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
132public Message Request(Message message, TimeSpan timeout)
137public bool WaitForMessage(TimeSpan timeout)
142public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
169: base(request, TimeSpan.Zero, TimeSpan.Zero)
178protected override void OnClose(TimeSpan timeout)
182protected override void OnReply(Message message, TimeSpan timeout)
186protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ListenerBinder.cs (12)
67public IChannelBinder Accept(TimeSpan timeout)
76public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
114public IChannelBinder Accept(TimeSpan timeout)
123public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
159public IChannelBinder Accept(TimeSpan timeout)
168public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
204public IChannelBinder Accept(TimeSpan timeout)
213public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
249public IChannelBinder Accept(TimeSpan timeout)
258public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
294public IChannelBinder Accept(TimeSpan timeout)
303public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\OutputChannelBinder.cs (9)
60public void CloseAfterFault(TimeSpan timeout)
65public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
80public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
90public void Send(Message message, TimeSpan timeout)
95public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
105public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
110public Message Request(Message message, TimeSpan timeout)
115public bool WaitForMessage(TimeSpan timeout)
120public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ReplyChannelBinder.cs (9)
62public void CloseAfterFault(TimeSpan timeout)
67public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
82public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
92public void Send(Message message, TimeSpan timeout)
97public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
107public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
112public Message Request(Message message, TimeSpan timeout)
117public bool WaitForMessage(TimeSpan timeout)
122public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\RequestChannelBinder.cs (9)
54public void CloseAfterFault(TimeSpan timeout)
59public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
74public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
84public void Send(Message message, TimeSpan timeout)
89public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
99public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
104public Message Request(Message message, TimeSpan timeout)
118public bool WaitForMessage(TimeSpan timeout)
123public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityProtocolFactory.cs (32)
69internal static readonly TimeSpan defaultMaxClockSkew = TimeSpan.Parse(defaultMaxClockSkewString, CultureInfo.InvariantCulture);
70internal static readonly TimeSpan defaultReplayWindow = TimeSpan.Parse(defaultReplayWindowString, CultureInfo.InvariantCulture);
73internal static readonly TimeSpan defaultTimestampValidityDuration = TimeSpan.Parse(defaultTimestampValidityDurationString, CultureInfo.InvariantCulture);
93private TimeSpan _maxClockSkew = defaultMaxClockSkew;
96private TimeSpan _replayWindow = defaultReplayWindow;
102private TimeSpan _timestampValidityDuration = defaultTimestampValidityDuration;
408public TimeSpan MaxClockSkew
417if (value < TimeSpan.Zero)
455public TimeSpan ReplayWindow
464if (value <= TimeSpan.Zero)
566public TimeSpan TimestampValidityDuration
575if (value <= TimeSpan.Zero)
599public TimeSpan DefaultOpenTimeout
604public TimeSpan DefaultCloseTimeout
609public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
614public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
668public virtual void OnClose(TimeSpan timeout)
693public SecurityProtocol CreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, bool isReturnLegSecurityRequired, TimeSpan timeout)
733protected abstract SecurityProtocol OnCreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, TimeSpan timeout);
790private void MergeSupportingTokenAuthenticators(TimeSpan timeout)
953public virtual void OnOpen(TimeSpan timeout)
1021if (this.MaxClockSkew == TimeSpan.MaxValue || this.ReplayWindow == TimeSpan.MaxValue)
1037public void Open(bool actAsInitiator, TimeSpan timeout)
1043public IAsyncResult BeginOpen(bool actAsInitiator, TimeSpan timeout, AsyncCallback callback, object state)
1054public void Close(bool aborted, TimeSpan timeout)
1066public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1076internal void Open(string propertyName, bool requiredForForwardDirection, SecurityTokenAuthenticator authenticator, TimeSpan timeout)
1088internal void Open(string propertyName, bool requiredForForwardDirection, SecurityTokenProvider provider, TimeSpan timeout)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SecurityUtils.cs (14)
258return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc);
267return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
665internal static void OpenTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
670internal static void CloseTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
677CloseCommunicationObject(tokenProvider, true, TimeSpan.Zero);
680internal static void OpenTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
685internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
690internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, bool aborted, TimeSpan timeout)
697CloseCommunicationObject(tokenAuthenticator, true, TimeSpan.Zero);
700private static void OpenCommunicationObject(ICommunicationObject obj, TimeSpan timeout)
706private static void CloseCommunicationObject(Object obj, bool aborted, TimeSpan timeout)
1060private Action<TimeSpan> _operationWithTimeout;
1062public OperationWithTimeoutAsyncResult(Action<TimeSpan> operationWithTimeout, TimeSpan timeout, AsyncCallback callback, object state)
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\TimeBoundedCache.cs (6)
22private TimeSpan _purgeInterval;
27protected TimeBoundedCache(int lowWaterMark, int maxCacheItems, IEqualityComparer keyComparer, PurgingMode purgingMode, TimeSpan purgeInterval, bool doRemoveNotification)
92_purgingTimer.Change(TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1));
106_purgingTimer = new Timer(new TimerCallback(PurgeCallback), this, _purgeInterval, TimeSpan.FromMilliseconds(-1));
436self._purgingTimer.Change(self._purgeInterval, TimeSpan.FromMilliseconds(-1));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WrapperSecurityCommunicationObject.cs (28)
32protected override TimeSpan DefaultCloseTimeout
37protected override TimeSpan DefaultOpenTimeout
47protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
52protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
57protected override void OnClose(TimeSpan timeout)
90protected override void OnOpen(TimeSpan timeout)
112protected internal override async Task OnCloseAsync(TimeSpan timeout)
125protected internal override async Task OnOpenAsync(TimeSpan timeout)
201public virtual TimeSpan DefaultOpenTimeout
206public virtual TimeSpan DefaultCloseTimeout
222public void Close(TimeSpan timeout)
232public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
247public void Open(TimeSpan timeout)
257public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
277public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
282public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
287public virtual void OnClose(TimeSpan timeout)
314public virtual void OnOpen(TimeSpan timeout)
376public virtual TimeSpan DefaultOpenTimeout
381public virtual TimeSpan DefaultCloseTimeout
397public void Close(TimeSpan timeout)
407public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
422public void Open(TimeSpan timeout)
432public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
452public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
457public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
462public virtual void OnClose(TimeSpan timeout)
489public virtual void OnOpen(TimeSpan timeout)
dotnet-user-jwts (2)
EntityFrameworkCoreSample (1)
Extensibility.WebSockets.IntegrationTests (13)
GenerateDocumentationAndConfigFiles (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
GetDocument.Insider (9)
HealthChecksSandbox.AppHost (1)
HelixTestRunner (11)
HttpAbstractions.SampleApp (1)
HttpsPolicySample (1)
HttpStress (1)
IdeCoreBenchmarks (11)
SyntacticChangeRangeBenchmark.cs (6)
91SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
98SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
104SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, _rootWithSimpleEdit, TimeSpan.MaxValue, CancellationToken.None);
110SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, _rootWithComplexEdit, TimeSpan.MaxValue, CancellationToken.None);
117SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
124SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(_root, newRoot, TimeSpan.MaxValue, CancellationToken.None);
IIS.Common.TestLib (4)
IIS.FunctionalTests (21)
IIS.LongTests (11)
IIS.Microbenchmarks (1)
IIS.NewHandler.FunctionalTests (11)
IIS.NewShim.FunctionalTests (11)
IIS.ShadowCopy.Tests (10)
IIS.Tests (1)
IISExpress.FunctionalTests (19)
Infrastructure.Common (6)
InMemory.FunctionalTests (218)
Http2\Http2TimeoutTests.cs (63)
29AdvanceTime(TimeSpan.FromTicks(1));
49AdvanceTime(TimeSpan.FromTicks(1));
68_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
74_mockTimeoutControl.Setup(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive)).Callback<TimeSpan, TimeoutReason>((t, r) =>
84_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.RequestHeaders), Times.Once);
97AdvanceTime(TimeSpan.FromTicks(1));
117_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
118_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
127_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
140_mockTimeoutControl.Verify(c => c.SetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Once);
141_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
157_mockTimeoutControl.Verify(c => c.ResetTimeout(It.IsAny<TimeSpan>(), TimeoutReason.KeepAlive), Times.Never);
188AdvanceTime(TimeSpan.FromTicks(1));
218AdvanceTime(TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
219limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
224AdvanceTime(TimeSpan.FromSeconds(1));
274timeProvider.Advance(Constants.RequestBodyDrainTimeout + TimeSpan.FromTicks(1));
353limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
375AdvanceTime(TimeSpan.FromSeconds((_bytesReceived + _helloWorldBytes.Length) / limits.MinResponseDataRate.BytesPerSecond) +
376limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
380AdvanceTime(TimeSpan.FromSeconds(1));
406limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
427var timeToWriteMaxData = TimeSpan.FromSeconds((_bytesReceived + _maxData.Length) / limits.MinResponseDataRate.BytesPerSecond) +
428limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
435AdvanceTime(TimeSpan.FromSeconds(1));
461limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
484AdvanceTime(TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
485limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5));
489AdvanceTime(TimeSpan.FromSeconds(1));
513limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
535var timeToWriteMaxData = TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
536limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
543AdvanceTime(TimeSpan.FromSeconds(1));
567limits.MinResponseDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
601var timeToWriteMaxData = TimeSpan.FromSeconds(_bytesReceived / limits.MinResponseDataRate.BytesPerSecond) +
602limits.MinResponseDataRate.GracePeriod + Heartbeat.Interval - TimeSpan.FromSeconds(.5);
609AdvanceTime(TimeSpan.FromSeconds(1));
633limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
656AdvanceTime(TimeSpan.FromTicks(1));
680limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
700var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
707AdvanceTime(TimeSpan.FromSeconds(1));
731limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
761var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond);
767timeToReadMaxData -= TimeSpan.FromSeconds(.5);
774AdvanceTime(TimeSpan.FromSeconds(1));
798limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
835var timeToReadMaxData = TimeSpan.FromSeconds(_maxData.Length / limits.MinRequestBodyDataRate.BytesPerSecond) - TimeSpan.FromSeconds(.5);
842AdvanceTime(TimeSpan.FromSeconds(1));
866limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
894AdvanceTime(TimeSpan.FromTicks(1));
923limits.MinRequestBodyDataRate = new MinDataRate(480, TimeSpan.FromSeconds(2.5));
959AdvanceTime(TimeSpan.FromDays(1));
983AdvanceTime(TimeSpan.FromTicks(1));
InProcessWebSite (4)
InteractiveHost.UnitTests (1)
Interop.FunctionalTests (22)
InteropTests (16)
KeyManagementSimulator (6)
Metrics (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Metrics.Legacy (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.Arcade.Common (2)
Microsoft.AspNetCore.Authentication (6)
Microsoft.AspNetCore.Authentication.BearerToken (4)
Microsoft.AspNetCore.Authentication.Certificate (3)
Microsoft.AspNetCore.Authentication.Cookies (9)
Microsoft.AspNetCore.Authentication.Core (1)
Microsoft.AspNetCore.Authentication.Core.Test (4)
AuthenticationPropertiesTests.cs (4)
311ExpiresUtc = new DateTimeOffset(2021, 03, 28, 13, 47, 00, TimeSpan.Zero),
312IssuedUtc = new DateTimeOffset(2021, 03, 28, 12, 47, 00, TimeSpan.Zero),
367ExpiresUtc = new DateTimeOffset(2021, 03, 28, 13, 47, 00, TimeSpan.Zero),
368IssuedUtc = new DateTimeOffset(2021, 03, 28, 12, 47, 00, TimeSpan.Zero),
Microsoft.AspNetCore.Authentication.JwtBearer (6)
Microsoft.AspNetCore.Authentication.Negotiate (5)
Microsoft.AspNetCore.Authentication.OAuth (3)
Microsoft.AspNetCore.Authentication.OpenIdConnect (14)
Microsoft.AspNetCore.Authentication.Test (81)
OpenIdConnect\OpenIdConnectTests.cs (14)
410Assert.Equal(DateTime.MaxValue, GetNonceExpirationTime(noncePrefix + DateTime.MaxValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
412Assert.Equal(DateTime.MinValue + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + DateTime.MinValue.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
414Assert.Equal(utcNow + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
416Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix, TimeSpan.FromHours(1)));
418Assert.Equal(DateTime.MinValue, GetNonceExpirationTime("", TimeSpan.FromHours(1)));
420Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(noncePrefix + noncePrefix, TimeSpan.FromHours(1)));
422Assert.Equal(utcNow + TimeSpan.FromHours(1), GetNonceExpirationTime(noncePrefix + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
424Assert.Equal(DateTime.MinValue, GetNonceExpirationTime(utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter + utcNow.Ticks.ToString(CultureInfo.InvariantCulture) + nonceDelimiter, TimeSpan.FromHours(1)));
452Assert.Equal(options.BackchannelTimeout, TimeSpan.FromMinutes(5));
495Assert.Equal(TimeSpan.FromMinutes(1), options.BackchannelTimeout);
573private static DateTime GetNonceExpirationTime(string keyname, TimeSpan nonceLifetime)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authorization.Test (2)
AuthorizationMiddlewareTests.cs (2)
823var firstExpiration = new DateTimeOffset(2021, 5, 12, 2, 3, 4, TimeSpan.Zero);
824var secondExpiration = new DateTimeOffset(2021, 5, 11, 2, 3, 4, TimeSpan.Zero);
Microsoft.AspNetCore.Components (8)
Microsoft.AspNetCore.Components.Authorization.Tests (2)
Microsoft.AspNetCore.Components.Endpoints (15)
Microsoft.AspNetCore.Components.Endpoints.Tests (11)
Binding\FormDataMapperTests.cs (6)
2126{ "4/20/2023 12:56:34 PM +02:00", typeof(DateTimeOffset?), new DateTimeOffset?(new DateTimeOffset(2023, 04, 20, 12, 56, 34, TimeSpan.FromHours(2)))},
2127{ "02:01:03", typeof(TimeSpan?), new TimeSpan?(new TimeSpan(02, 01, 03))},
2169{ typeof(TimeSpan?) },
2211{ "4/20/2023 12:56:34 PM +02:00", typeof(DateTimeOffset), new DateTimeOffset(2023, 04, 20, 12, 56, 34, TimeSpan.FromHours(2)) },
2212{ "02:01:03", typeof(TimeSpan), new TimeSpan(02, 01, 03) },
Microsoft.AspNetCore.Components.Server (29)
Microsoft.AspNetCore.Components.Server.Tests (43)
Circuits\RemoteJSDataStreamTest.cs (6)
24var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(_jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None).DefaultTimeout();
162var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
182var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
218jsInteropDefaultCallTimeout: TimeSpan.FromSeconds(2),
259jsInteropDefaultCallTimeout: TimeSpan.FromSeconds(3),
348var remoteJSDataStream = await RemoteJSDataStream.CreateRemoteJSDataStreamAsync(jsRuntime ?? _jsRuntime, jsStreamReference, totalLength: 100, signalRMaximumIncomingBytes: 10_000, jsInteropDefaultCallTimeout: TimeSpan.FromMinutes(1), cancellationToken: CancellationToken.None);
Microsoft.AspNetCore.Components.Tests (15)
PersistentStateValueProviderKeyResolverTests.cs (2)
33{ new DateTimeOffset(2023, 1, 1, 0, 0, 0, TimeSpan.FromSeconds(0)), new DateTimeOffset(2023, 12, 31, 0, 0, 0, TimeSpan.FromSeconds(0)) },
Microsoft.AspNetCore.Components.Web (2)
Microsoft.AspNetCore.Components.WebAssembly.Server (6)
Microsoft.AspNetCore.Components.WebAssembly.Tests (3)
Microsoft.AspNetCore.Components.WebViewE2E.Test (1)
Microsoft.AspNetCore.ConcurrencyLimiter (2)
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (2)
Microsoft.AspNetCore.CookiePolicy (1)
Microsoft.AspNetCore.CookiePolicy.Test (2)
Microsoft.AspNetCore.Cors (10)
Microsoft.AspNetCore.Cors.Test (13)
Microsoft.AspNetCore.DataProtection (28)
Microsoft.AspNetCore.DataProtection.Extensions (3)
Microsoft.AspNetCore.DataProtection.Extensions.Tests (2)
Microsoft.AspNetCore.DataProtection.Tests (55)
KeyManagement\KeyRingProviderTests.cs (26)
118Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
166Tuple.Create(now, now + TimeSpan.FromDays(90), newKey)
207Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), newlyCreatedKey)
251Tuple.Create((DateTimeOffset)now, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
291Tuple.Create(key1.ExpirationDate, (DateTimeOffset)now + TimeSpan.FromDays(90), CreateKey())
432DateTimeOffset activation1 = now - TimeSpan.FromHours(1);
433DateTimeOffset activation2 = now + TimeSpan.FromHours(1);
435DateTimeOffset expiration1 = now + TimeSpan.FromHours(hoursToExpiration1);
436DateTimeOffset expiration2 = now + TimeSpan.FromHours(hoursToExpiration2);
449var generatedKey = CreateKey(expiration1, now + TimeSpan.FromDays(90));
504Tuple.Create(expiration1, now + TimeSpan.FromDays(90), CreateKey())
525DateTimeOffset activation = now - TimeSpan.FromDays(30);
526DateTimeOffset expiration = now + TimeSpan.FromDays(30);
529var generatedKey = CreateKey(expiration, now + TimeSpan.FromDays(90));
539Tuple.Create(expiration, now + TimeSpan.FromDays(90), generatedKey)
590var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromHours(1));
613.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromMinutes(1)))
619.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromMinutes(2)))
629var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromMinutes(1));
630var retVal3 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromMinutes(2), forceRefresh: true);
654.Setup(o => o.GetCacheableKeyRing(now + TimeSpan.FromHours(1)))
664var retVal2 = keyRingProvider.GetCurrentKeyRingCore(now + TimeSpan.FromHours(1), forceRefresh: true);
686TimeSpan testTimeout = TimeSpan.FromSeconds(10);
912Assert.InRange(actual, now + TimeSpan.FromHours(24 * 0.8), now + TimeSpan.FromHours(24));
KeyManagement\XmlKeyManagerTests.cs (8)
78var creationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
79var activationDate = new DateTimeOffset(2014, 02, 01, 0, 0, 0, TimeSpan.Zero);
80var expirationDate = new DateTimeOffset(2014, 03, 01, 0, 0, 0, TimeSpan.Zero);
165var creationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
166var activationDate = new DateTimeOffset(2014, 02, 01, 0, 0, 0, TimeSpan.Zero);
167var expirationDate = new DateTimeOffset(2014, 03, 01, 0, 0, 0, TimeSpan.Zero);
295DateTimeOffset activationDate = minCreationDate + TimeSpan.FromDays(7);
685var revocationDate = new DateTimeOffset(2014, 01, 01, 0, 0, 0, TimeSpan.Zero);
Microsoft.AspNetCore.DeveloperCertificates.XPlat (2)
Microsoft.AspNetCore.Diagnostics.Middleware (3)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (24)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (6)
ConverterTests\JsonConverterWriteTests.cs (4)
305TimestampValue = Timestamp.FromDateTimeOffset(new DateTimeOffset(2020, 12, 1, 12, 30, 0, TimeSpan.FromHours(12)))
314var ts = Timestamp.FromDateTimeOffset(new DateTimeOffset(2020, 12, 1, 12, 30, 0, TimeSpan.FromHours(12)));
324DurationValue = Duration.FromTimeSpan(TimeSpan.FromHours(12))
333var duration = Duration.FromTimeSpan(TimeSpan.FromHours(12));
Microsoft.AspNetCore.HeaderParsing.Tests (1)
Microsoft.AspNetCore.Hosting (10)
Microsoft.AspNetCore.Hosting.Abstractions (1)
Microsoft.AspNetCore.Hosting.FunctionalTests (4)
Microsoft.AspNetCore.Hosting.Tests (10)
Microsoft.AspNetCore.Hosting.WindowsServices.Tests (2)
Microsoft.AspNetCore.Http (8)
Microsoft.AspNetCore.Http.Abstractions (2)
Microsoft.AspNetCore.Http.Abstractions.Tests (3)
Microsoft.AspNetCore.Http.Connections (30)
Microsoft.AspNetCore.Http.Connections.Client (5)
Microsoft.AspNetCore.Http.Connections.Tests (38)
Microsoft.AspNetCore.Http.Extensions (6)
Microsoft.AspNetCore.Http.Extensions.Tests (10)
Microsoft.AspNetCore.Http.Features (8)
Microsoft.AspNetCore.Http.Microbenchmarks (4)
Microsoft.AspNetCore.Http.Results (2)
Microsoft.AspNetCore.Http.Results.Tests (14)
ResultsTests.cs (5)
285new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
287new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
333new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
335new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
337new object[] { 2, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
TypedResultsTests.cs (7)
263new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
265new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
309new object[] { "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
311new object[] { "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
417new object[] { 0, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
419new object[] { 1, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
421new object[] { 2, "text/plain", "testfile", true, new DateTimeOffset(2022, 1, 1, 0, 0, 1, TimeSpan.FromHours(-8)), EntityTagHeaderValue.Any },
Microsoft.AspNetCore.Http.Tests (24)
Timeouts\RequestTimeoutsMiddlewareTests.cs (10)
49var endpoint = CreateEndpoint(new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) });
144var endpoint = CreateEndpoint(new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) }, new RequestTimeoutAttribute("policy1"));
164new RequestTimeoutPolicy { Timeout = TimeSpan.FromSeconds(47) },
284var ctsLinker = new MockCancellationTokenSourceProvider(expectedTimeSpan.HasValue ? TimeSpan.FromSeconds(expectedTimeSpan.Value) : null, cancelledCts);
289Timeout = TimeSpan.FromSeconds(defaultTimeout.Value),
300Timeout = TimeSpan.FromSeconds(1),
310Timeout = TimeSpan.FromSeconds(2),
348private readonly TimeSpan? _expectedTimeSpan;
356public MockCancellationTokenSourceProvider(TimeSpan? expectedTimeSpan, bool cancelledCts)
362public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan)
Microsoft.AspNetCore.HttpLogging (7)
Microsoft.AspNetCore.HttpLogging.Tests (1)
Microsoft.AspNetCore.HttpsPolicy (2)
Microsoft.AspNetCore.HttpsPolicy.Tests (3)
Microsoft.AspNetCore.Identity (19)
Microsoft.AspNetCore.Identity.FunctionalTests (11)
Microsoft.AspNetCore.Identity.InMemory.Test (10)
Microsoft.AspNetCore.Identity.Specification.Tests (4)
Microsoft.AspNetCore.Identity.Test (14)
Microsoft.AspNetCore.InternalTesting (14)
src\Shared\TaskExtensions.cs (13)
32public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
36return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
46return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
56return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
59public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
66return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
69public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
75public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
143private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Microsoft.AspNetCore.InternalTesting.Tests (6)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (35)
EndpointMetadataApiDescriptionProviderTest.cs (35)
188[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created)]
205Assert.Equal(typeof(TimeSpan), annotatedResponseType.Type);
206Assert.Equal(typeof(TimeSpan), annotatedResponseType.ModelMetadata?.ModelType);
215[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created)]
233Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
234Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
310[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)]
319Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
320Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
339var apiDescription = GetApiDescription([ProducesResponseType<GenericClass<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
340() => new GenericClass<TimeSpan> { Value = new TimeSpan() });
345Assert.Equal(typeof(GenericClass<TimeSpan>), okResponseType.Type);
346Assert.Equal(typeof(GenericClass<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
358var apiDescription = GetApiDescription([ProducesResponseType<GenericClass<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
359() => TypedResults.Ok(new GenericClass<TimeSpan> { Value = new TimeSpan() }));
364Assert.Equal(typeof(GenericClass<TimeSpan>), okResponseType.Type);
365Assert.Equal(typeof(GenericClass<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
377var apiDescription = GetApiDescription([ProducesResponseType<IEnumerable<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
378() => new List<TimeSpan> { new() });
383Assert.Equal(typeof(List<TimeSpan>), okResponseType.Type); // We use List as the inferred type has higher priority than those set by metadata (attributes)
384Assert.Equal(typeof(List<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
396var apiDescription = GetApiDescription([ProducesResponseType<IEnumerable<TimeSpan>>(StatusCodes.Status200OK, Description = expectedOkDescription)]
397() => TypedResults.Ok(new List<TimeSpan> { new() }));
402Assert.Equal(typeof(List<TimeSpan>), okResponseType.Type); // We use List as the inferred type has higher priority than those set by metadata (attributes)
403Assert.Equal(typeof(List<TimeSpan>), okResponseType.ModelMetadata?.ModelType);
443[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)]
462Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
463Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
493[ProducesResponseType(typeof(TimeSpan), StatusCodes.Status201Created, Description = expectedCreatedDescription)] // This is the last item, which should match
503Assert.Equal(typeof(TimeSpan), createdResponseType.Type);
504Assert.Equal(typeof(TimeSpan), createdResponseType.ModelMetadata?.ModelType);
715AssertPathParameter(GetApiDescription((TimeSpan foo) => { }, "/{foo}"), typeof(TimeSpan));
736AssertPathParameter(GetApiDescription((TimeSpan? foo) => { }, "/{foo}"), typeof(TimeSpan?));
Microsoft.AspNetCore.Mvc.Core (6)
Microsoft.AspNetCore.Mvc.Core.Test (31)
FileResultHelperTest.cs (15)
251lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
329lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
365lastModified = new DateTimeOffset(lastModified.Year, lastModified.Month, lastModified.Day, lastModified.Hour, lastModified.Minute, lastModified.Second, TimeSpan.FromSeconds(0));
388{ new DateTimeOffset(2018, 4, 9, 11, 23, 22, TimeSpan.Zero), 200 },
389{ new DateTimeOffset(2018, 4, 9, 11, 24, 21, TimeSpan.Zero), 200 },
390{ new DateTimeOffset(2018, 4, 9, 11, 24, 22, TimeSpan.Zero), 304 },
391{ new DateTimeOffset(2018, 4, 9, 11, 24, 23, TimeSpan.Zero), 304 },
392{ new DateTimeOffset(2018, 4, 9, 11, 25, 22, TimeSpan.Zero), 304 },
412LastModified = new DateTimeOffset(ticks, TimeSpan.Zero)
428{ new DateTimeOffset(2018, 4, 9, 11, 23, 22, TimeSpan.Zero), 412 },
429{ new DateTimeOffset(2018, 4, 9, 11, 24, 21, TimeSpan.Zero), 412 },
430{ new DateTimeOffset(2018, 4, 9, 11, 24, 22, TimeSpan.Zero), 200 },
431{ new DateTimeOffset(2018, 4, 9, 11, 24, 23, TimeSpan.Zero), 200 },
432{ new DateTimeOffset(2018, 4, 9, 11, 25, 22, TimeSpan.Zero), 200 },
450LastModified = new DateTimeOffset(ticks, TimeSpan.Zero)
Infrastructure\ActionSelectionTableTest.cs (2)
83new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)));
123new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)));
ModelBinding\RouteValueProviderTests.cs (2)
53{ "test-key", new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)) },
70{ "test-key", new DateTimeOffset(2018, 10, 31, 7, 37, 38, TimeSpan.FromHours(-7)) },
Microsoft.AspNetCore.Mvc.Cors.Test (1)
Microsoft.AspNetCore.Mvc.FunctionalTests (5)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (2)
Microsoft.AspNetCore.Mvc.Razor (2)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (4)
Microsoft.AspNetCore.Mvc.Razor.Test (1)
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Microsoft.AspNetCore.Mvc.TagHelpers (6)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (43)
CacheTagHelperTest.cs (22)
257var slidingExpiresIn = TimeSpan.FromSeconds(30);
272var expiresAfter = TimeSpan.FromSeconds(42);
290var expiresSliding = TimeSpan.FromSeconds(37);
326var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
340ExpiresAfter = TimeSpan.FromMinutes(10)
361ExpiresAfter = TimeSpan.FromMinutes(10)
379var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
432var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
446ExpiresSliding = TimeSpan.FromSeconds(30)
468ExpiresSliding = TimeSpan.FromSeconds(30)
571await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
594await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
601await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
654await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
677await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
684await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
746ExpiresAfter = TimeSpan.FromHours(1.0)
973public TimeSpan? AbsoluteExpirationRelativeToNow { get; set; }
974public TimeSpan? SlidingExpiration { get; set; }
DistributedCacheTagHelperTest.cs (19)
274var slidingExpiresIn = TimeSpan.FromSeconds(30);
297var expiresAfter = TimeSpan.FromSeconds(42);
323var expiresSliding = TimeSpan.FromSeconds(37);
349var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
370ExpiresAfter = TimeSpan.FromMinutes(10)
393ExpiresAfter = TimeSpan.FromMinutes(10)
411var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
473var currentTime = new DateTimeOffset(2010, 1, 1, 0, 0, 0, TimeSpan.Zero);
494ExpiresSliding = TimeSpan.FromSeconds(30)
518ExpiresSliding = TimeSpan.FromSeconds(30)
570await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
597await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
604await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
662await event3.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
689await event1.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
696await event2.Task.TimeoutAfter(TimeSpan.FromSeconds(5));
Microsoft.AspNetCore.Mvc.Testing (8)
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (11)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.OpenApi.Build.Tests (2)
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (8)
Microsoft.AspNetCore.OpenApi.Tests (4)
Microsoft.AspNetCore.OutputCaching (20)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (1)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (15)
RedisOutputCacheStore.cs (15)
43private readonly TimeSpan ReconnectMinInterval = TimeSpan.FromSeconds(60);
46private readonly TimeSpan ReconnectErrorThreshold = TimeSpan.FromSeconds(30);
100await Task.Delay(TimeSpan.FromSeconds(secondsWithJitter)).ConfigureAwait(false);
105await ExecuteGarbageCollectionAsync(GetExpirationTimestamp(TimeSpan.Zero), _disposalCancellation.Token).ConfigureAwait(false);
131var gcLifetime = TimeSpan.FromMinutes(5);
237ValueTask IOutputCacheStore.SetAsync(string key, byte[] value, string[]? tags, TimeSpan validFor, CancellationToken cancellationToken)
243async ValueTask IOutputCacheBufferStore.SetAsync(string key, ReadOnlySequence<byte> value, ReadOnlyMemory<string> tags, TimeSpan validFor, CancellationToken cancellationToken)
309private static long GetExpirationTimestamp(TimeSpan timeout) =>
372TimeSpan elapsedSinceLastReconnect = utcNow - previousConnectTime;
389TimeSpan elapsedSinceFirstError = utcNow - firstErrorTime;
390TimeSpan elapsedSinceMostRecentError = utcNow - ReadTimeTicks(ref _previousErrorTimeTicks);
482return ticks == 0 ? DateTimeOffset.MinValue : new DateTimeOffset(ticks, TimeSpan.Zero);
Microsoft.AspNetCore.OutputCaching.Tests (74)
MemoryOutputCacheStoreTests.cs (25)
18await store.SetAsync(key, value, null, TimeSpan.FromMinutes(1), default);
33await store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default);
34testClock.Advance(TimeSpan.FromMilliseconds(10));
48_ = await Assert.ThrowsAsync<ArgumentNullException>("key", () => store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default).AsTask());
58_ = await Assert.ThrowsAsync<ArgumentNullException>("value", () => store.SetAsync(key, value, null, TimeSpan.FromMilliseconds(5), default).AsTask());
70await store.SetAsync(key, value, tags, TimeSpan.FromDays(1), default);
78using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
99await store.SetAsync(key1, value, tags, TimeSpan.FromDays(1), default);
100await store.SetAsync(key2, value, tags, TimeSpan.FromDays(1), default);
118await store.SetAsync(key, value, tags, TimeSpan.FromDays(1), default);
136await store.SetAsync(key1, value, tags1, TimeSpan.FromDays(1), default);
137await store.SetAsync(key2, value, tags2, TimeSpan.FromDays(1), default);
159var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = 1000, Clock = testClock, ExpirationScanFrequency = TimeSpan.FromMilliseconds(1) });
163await store.SetAsync("a", value, new[] { "tag1" }, TimeSpan.FromMilliseconds(5), default);
164await store.SetAsync("b", value, new[] { "tag1", "tag2" }, TimeSpan.FromMilliseconds(5), default);
165await store.SetAsync("c", value, new[] { "tag2" }, TimeSpan.FromMilliseconds(20), default);
167testClock.Advance(TimeSpan.FromMilliseconds(10));
184using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
204var cache = new MemoryCache(new MemoryCacheOptions { SizeLimit = 1000, Clock = testClock, ExpirationScanFrequency = TimeSpan.FromMilliseconds(1) });
208await store.SetAsync("a", value, new[] { "tag1", "tag2" }, TimeSpan.FromMilliseconds(5), default);
209await store.SetAsync("a", value, new[] { "tag1" }, TimeSpan.FromMilliseconds(20), default);
211testClock.Advance(TimeSpan.FromMilliseconds(10));
224using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
245await Assert.ThrowsAsync<ArgumentException>(async () => await store.SetAsync(key, value, new string[] { tag }, TimeSpan.FromMinutes(1), default));
251public void Advance(TimeSpan duration)
OutputCacheEntryFormatterTests.cs (3)
35await OutputCacheEntryFormatter.StoreAsync(key, entry, null, TimeSpan.Zero, store, NullLogger.Instance, default);
54await OutputCacheEntryFormatter.StoreAsync(key, entry, new HashSet<string>() { "tag", "タグ" }, TimeSpan.Zero, store, NullLogger.Instance, default);
72await OutputCacheEntryFormatter.StoreAsync(key, entry, null, TimeSpan.Zero, store, NullLogger.Instance, default);
OutputCacheMiddlewareTests.cs (27)
83TimeSpan.Zero,
113TimeSpan.Zero,
141TimeSpan.Zero,
187SetDateHeader(context.CachedResponse, utcNow - TimeSpan.FromSeconds(10));
197SetDateHeader(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10));
229SetDateHeaders(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10), utcNow - TimeSpan.FromSeconds(10));
234SetDateHeaders(context.CachedResponse, utcNow + TimeSpan.FromSeconds(10), utcNow);
239SetDateHeaders(context.CachedResponse, utcNow - TimeSpan.FromSeconds(10), utcNow + TimeSpan.FromSeconds(10));
261entry.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow + TimeSpan.FromSeconds(10)) });
282context.CachedResponse.CopyHeadersFrom(new HeaderDictionary { [HeaderNames.LastModified] = HeaderUtilities.FormatDate(utcNow - TimeSpan.FromSeconds(10)) });
398timeProvider.Advance(TimeSpan.FromSeconds(10));
414Assert.Equal(TimeSpan.FromSeconds(60), context.CachedResponseValidFor);
433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
458MaxAge = TimeSpan.FromSeconds(12)
461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
484MaxAge = TimeSpan.FromSeconds(12),
485SharedMaxAge = TimeSpan.FromSeconds(13)
487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
557var responseTime = utcNow + TimeSpan.FromSeconds(10);
618context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
647context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
680context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
705context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
777context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
981context.CachedResponseValidFor = TimeSpan.FromSeconds(10);
Microsoft.AspNetCore.RateLimiting (4)
Microsoft.AspNetCore.RateLimiting.Tests (2)
Microsoft.AspNetCore.ResponseCaching (32)
LoggerExtensions.cs (12)
32internal static partial void ExpirationMinFreshAdded(this ILogger logger, TimeSpan duration);
36internal static partial void ExpirationSharedMaxAgeExceeded(this ILogger logger, TimeSpan age, TimeSpan sharedMaxAge);
41internal static partial void ExpirationMustRevalidate(this ILogger logger, TimeSpan age, TimeSpan maxAge);
46internal static partial void ExpirationMaxStaleSatisfied(this ILogger logger, TimeSpan age, TimeSpan maxAge, TimeSpan maxStale);
49internal static partial void ExpirationMaxAgeExceeded(this ILogger logger, TimeSpan age, TimeSpan maxAge);
122internal static partial void ExpirationInfiniteMaxStaleSatisfied(this ILogger logger, TimeSpan age, TimeSpan maxAge);
Microsoft.AspNetCore.ResponseCaching.Tests (87)
ResponseCachingPolicyProviderTests.cs (49)
411MaxAge = TimeSpan.FromSeconds(10)
415context.ResponseTime = utcNow + TimeSpan.FromSeconds(9);
431MaxAge = TimeSpan.FromSeconds(10)
435context.ResponseTime = utcNow + TimeSpan.FromSeconds(10);
453MaxAge = TimeSpan.FromSeconds(10),
454SharedMaxAge = TimeSpan.FromSeconds(15)
457context.ResponseTime = utcNow + TimeSpan.FromSeconds(11);
473MaxAge = TimeSpan.FromSeconds(10),
474SharedMaxAge = TimeSpan.FromSeconds(5)
477context.ResponseTime = utcNow + TimeSpan.FromSeconds(5);
492context.CachedEntryAge = TimeSpan.MaxValue;
506context.CachedEntryAge = TimeSpan.MaxValue;
524context.CachedEntryAge = TimeSpan.Zero;
544context.CachedEntryAge = TimeSpan.FromSeconds(9);
550MaxAge = TimeSpan.FromSeconds(10)
564context.CachedEntryAge = TimeSpan.FromSeconds(10);
570MaxAge = TimeSpan.FromSeconds(10)
586context.CachedEntryAge = TimeSpan.FromSeconds(11);
592MaxAge = TimeSpan.FromSeconds(10),
593SharedMaxAge = TimeSpan.FromSeconds(15)
607context.CachedEntryAge = TimeSpan.FromSeconds(5);
613MaxAge = TimeSpan.FromSeconds(10),
614SharedMaxAge = TimeSpan.FromSeconds(5)
631MinFresh = TimeSpan.FromSeconds(2)
636MaxAge = TimeSpan.FromSeconds(10),
637SharedMaxAge = TimeSpan.FromSeconds(5)
639context.CachedEntryAge = TimeSpan.FromSeconds(3);
655MaxAge = TimeSpan.FromSeconds(5)
660MaxAge = TimeSpan.FromSeconds(10),
662context.CachedEntryAge = TimeSpan.FromSeconds(5);
677MaxAge = TimeSpan.FromSeconds(5),
679MaxStaleLimit = TimeSpan.FromSeconds(2)
684MaxAge = TimeSpan.FromSeconds(5),
686context.CachedEntryAge = TimeSpan.FromSeconds(6);
701MaxAge = TimeSpan.FromSeconds(5),
707MaxAge = TimeSpan.FromSeconds(5),
709context.CachedEntryAge = TimeSpan.FromSeconds(6);
724MaxAge = TimeSpan.FromSeconds(5),
726MaxStaleLimit = TimeSpan.FromSeconds(1)
731MaxAge = TimeSpan.FromSeconds(5),
733context.CachedEntryAge = TimeSpan.FromSeconds(6);
748MaxAge = TimeSpan.FromSeconds(5),
750MaxStaleLimit = TimeSpan.FromSeconds(2)
755MaxAge = TimeSpan.FromSeconds(5),
758context.CachedEntryAge = TimeSpan.FromSeconds(6);
773MaxAge = TimeSpan.FromSeconds(5),
775MaxStaleLimit = TimeSpan.FromSeconds(2)
780MaxAge = TimeSpan.FromSeconds(5),
783context.CachedEntryAge = TimeSpan.FromSeconds(6);
Microsoft.AspNetCore.ResponseCompression.Tests (8)
Microsoft.AspNetCore.Rewrite (13)
Microsoft.AspNetCore.Rewrite.Tests (3)
Microsoft.AspNetCore.Routing (2)
Microsoft.AspNetCore.Server.HttpSys (20)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (70)
ServerTests.cs (29)
157await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
158await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token);
173await stopped.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
179await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
194await shutdown.Task.TimeoutAfter(TimeSpan.FromSeconds(15));
200await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
201await server.StopAsync(new CancellationTokenSource(TimeSpan.FromSeconds(5)).Token);
270Assert.True(Task.WaitAll(requestTasks.ToArray(), TimeSpan.FromSeconds(60)), "Timed out");
277var interval = TimeSpan.FromSeconds(10);
311var interval = TimeSpan.FromSeconds(10);
423await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
429await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
431var cts = new CancellationTokenSource(TimeSpan.FromSeconds(10));
442await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
457await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
463await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
476await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
494await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
500await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
513await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
531await run.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
537await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
550await Task.WhenAll(stopTask1, stopTask2, stopTask3).TimeoutAfter(TimeSpan.FromSeconds(10));
570await run.Task.TimeoutAfter(TimeSpan.FromSeconds(15));
576await received.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
585await Task.WhenAll(stopTask1, stopTask2).TimeoutAfter(TimeSpan.FromSeconds(10));
594await server.StopAsync(default(CancellationToken)).TimeoutAfter(TimeSpan.FromSeconds(10));
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (2)
Microsoft.AspNetCore.Server.IIS (4)
Microsoft.AspNetCore.Server.IISIntegration.Tests (4)
Microsoft.AspNetCore.Server.IntegrationTesting (21)
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (12)
Microsoft.AspNetCore.Server.Kestrel.Core (88)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (131)
KestrelServerLimitsTests.cs (19)
153Assert.Equal(TimeSpan.FromSeconds(130), new KestrelServerLimits().KeepAliveTimeout);
158public void KeepAliveTimeoutValid(TimeSpan value)
166Assert.Equal(TimeSpan.MaxValue, new KestrelServerLimits { KeepAliveTimeout = Timeout.InfiniteTimeSpan }.KeepAliveTimeout);
171public void KeepAliveTimeoutInvalid(TimeSpan value)
182Assert.Equal(TimeSpan.FromSeconds(30), new KestrelServerLimits().RequestHeadersTimeout);
187public void RequestHeadersTimeoutValid(TimeSpan value)
195Assert.Equal(TimeSpan.MaxValue, new KestrelServerLimits { RequestHeadersTimeout = Timeout.InfiniteTimeSpan }.RequestHeadersTimeout);
200public void RequestHeadersTimeoutInvalid(TimeSpan value)
299Assert.Equal(TimeSpan.FromSeconds(5), new KestrelServerLimits().MinRequestBodyDataRate.GracePeriod);
307Assert.Equal(TimeSpan.FromSeconds(5), new KestrelServerLimits().MinResponseDataRate.GracePeriod);
357public static TheoryData<TimeSpan> TimeoutValidData => new TheoryData<TimeSpan>
359TimeSpan.FromTicks(1),
360TimeSpan.MaxValue,
363public static TheoryData<TimeSpan> TimeoutInvalidData => new TheoryData<TimeSpan>
365TimeSpan.MinValue,
366TimeSpan.FromTicks(-1),
367TimeSpan.Zero
TimeoutControlTests.cs (53)
33_timeoutControl.SetTimeout(TimeSpan.FromTicks(1), TimeoutReason.RequestHeaders);
63var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
94var gracePeriod = TimeSpan.FromSeconds(2);
155var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
164_timeProvider.Advance(TimeSpan.FromSeconds(1));
166_timeProvider.Advance(TimeSpan.FromSeconds(1));
168_timeProvider.Advance(TimeSpan.FromSeconds(1));
173_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
177_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
181_timeProvider.Advance(TimeSpan.FromSeconds(2));
188_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
192_timeProvider.Advance(TimeSpan.FromSeconds(1.0));
194_timeProvider.Advance(TimeSpan.FromSeconds(.5));
201_timeProvider.Advance(TimeSpan.FromSeconds(1));
211var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
220_timeProvider.Advance(TimeSpan.FromSeconds(1));
222_timeProvider.Advance(TimeSpan.FromSeconds(1));
230_timeProvider.Advance(TimeSpan.FromSeconds(0.25));
234_timeProvider.Advance(TimeSpan.FromSeconds(0.25));
238_timeProvider.Advance(TimeSpan.FromSeconds(0.5));
246_timeProvider.Advance(TimeSpan.FromSeconds(1));
256var timeout = TimeSpan.FromSeconds(5);
257var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
268_timeProvider.Advance(TimeSpan.FromSeconds(3));
276_timeProvider.Advance(TimeSpan.FromSeconds(2) + Heartbeat.Interval + TimeSpan.FromTicks(1));
286var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
334var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
373var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
383AdvanceClock(TimeSpan.FromSeconds(4) + Heartbeat.Interval + TimeSpan.FromTicks(1));
391var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(5));
401AdvanceClock(TimeSpan.FromSeconds(1) + Heartbeat.Interval + TimeSpan.FromTicks(1));
407AdvanceClock(minRate.GracePeriod - TimeSpan.FromSeconds(1));
415var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
429AdvanceClock(TimeSpan.FromSeconds(5) + Heartbeat.Interval + TimeSpan.FromTicks(1));
438AdvanceClock(TimeSpan.FromSeconds(3));
446var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(5));
465AdvanceClock(Heartbeat.Interval + minRate.GracePeriod + TimeSpan.FromSeconds((numWrites - 1) * writeSize / minRate.BytesPerSecond));
470_timeProvider.Advance(TimeSpan.FromTicks(1));
479var minRate = new MinDataRate(bytesPerSecond: 100, gracePeriod: TimeSpan.FromSeconds(2));
489_timeProvider.Advance(TimeSpan.FromSeconds(4) + Heartbeat.Interval + TimeSpan.FromTicks(1));
495AdvanceClock(TimeSpan.FromSeconds(4) + TimeSpan.FromTicks(1));
502var gracePeriod = TimeSpan.FromSeconds(5);
515_timeProvider.Advance(TimeSpan.FromSeconds(1));
520private void AdvanceClock(TimeSpan timeSpan)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (4)
Microsoft.AspNetCore.Server.Kestrel.Tests (15)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (3)
Microsoft.AspNetCore.Session (13)
Microsoft.AspNetCore.Session.Tests (10)
Microsoft.AspNetCore.Shared.Tests (6)
Microsoft.AspNetCore.SignalR (1)
Microsoft.AspNetCore.SignalR.Client.Core (46)
Microsoft.AspNetCore.SignalR.Client.Tests (48)
Microsoft.AspNetCore.SignalR.Common.Tests (1)
Microsoft.AspNetCore.SignalR.Core (21)
Microsoft.AspNetCore.SignalR.Microbenchmarks (6)
Microsoft.AspNetCore.SignalR.Specification.Tests (19)
src\Shared\TaskExtensions.cs (13)
32public static TimeSpan DefaultTimeoutTimeSpan { get; } = TimeSpan.FromMilliseconds(DefaultTimeoutDuration);
36return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
39public static Task DefaultTimeout(this Task task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
46return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
49public static Task DefaultTimeout(this ValueTask task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
56return task.TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
59public static Task<T> DefaultTimeout<T>(this Task<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
66return task.AsTask().TimeoutAfter(TimeSpan.FromMilliseconds(milliseconds), filePath, lineNumber);
69public static Task<T> DefaultTimeout<T>(this ValueTask<T> task, TimeSpan timeout, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = default)
75public static async Task<T> TimeoutAfter<T>(this Task<T> task, TimeSpan timeout,
109public static async Task TimeoutAfter(this Task task, TimeSpan timeout,
143private static string CreateMessage(TimeSpan timeout, string filePath, int lineNumber)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (5)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (16)
Docker.cs (14)
87RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
92var wait = TimeSpan.FromSeconds(30);
97RunProcessAndWait(_path, $"logs {_dockerContainerName}", "docker logs", logger, TimeSpan.FromSeconds(5), out var logOutput);
116RunProcessAndThrowIfFailed(_path, $"run --rm -p 6379:6379 --name {_dockerContainerName} -d {_redisImageName}", "redis", logger, TimeSpan.FromMinutes(1));
125RunProcessAndWait(_path, $"stop {_dockerMonitorContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
126RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var output);
132RunProcessAndWait(_path, "inspect --format=\"{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}\" " + _dockerContainerName, "docker ipaddress", logger, TimeSpan.FromSeconds(5), out output);
146RunProcessAndThrowIfFailed(_path, $"logs {_dockerContainerName}", "docker logs", logger, TimeSpan.FromSeconds(5));
149RunProcessAndWait(_path, $"stop {_dockerMonitorContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
150RunProcessAndWait(_path, $"stop {_dockerContainerName}", "docker stop", logger, TimeSpan.FromSeconds(15), out var _);
158return RunProcessAndWait(_path, commandAndArguments, prefix, logger, TimeSpan.FromSeconds(30), out output);
161private static void RunProcessAndThrowIfFailed(string fileName, string arguments, string prefix, ILogger logger, TimeSpan timeout)
171private static int RunProcessAndWait(string fileName, string arguments, string prefix, ILogger logger, TimeSpan timeout, out string output)
Microsoft.AspNetCore.SignalR.Tests (22)
Microsoft.AspNetCore.SignalR.Tests.Utils (6)
Microsoft.AspNetCore.SpaProxy (4)
Microsoft.AspNetCore.SpaServices.Extensions (15)
Microsoft.AspNetCore.StaticAssets.Tests (3)
StaticAssetsIntegrationTests.cs (3)
585new("Last-Modified", new DateTimeOffset(2023,03,03,0,0,0,TimeSpan.Zero).ToString("ddd, dd MMM yyyy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture))
765Assert.Equal(response.Content.Headers.LastModified.Value.Offset, TimeSpan.Zero);
1086public DateTimeOffset LastModified => new(2023, 03, 03, 0, 0, 0, TimeSpan.Zero);
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
Microsoft.AspNetCore.StaticFiles.Tests (7)
StaticFileContextTest.cs (4)
43LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
69LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
98LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
125LastModified = new DateTimeOffset(2014, 1, 2, 3, 4, 5, TimeSpan.Zero)
Microsoft.AspNetCore.TestHost (9)
Microsoft.AspNetCore.TestHost.Tests (5)
Microsoft.AspNetCore.Testing.Tests (2)
Microsoft.AspNetCore.Tests (2)
Microsoft.AspNetCore.WebSockets (11)
Microsoft.AspNetCore.WebSockets.ConformanceTests (4)
Microsoft.AspNetCore.WebSockets.Tests (10)
Microsoft.Bcl.TimeProvider (7)
System\Threading\Tasks\TimeProviderTaskExtensions.cs (7)
44/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
49public static Task Delay(this TimeProvider timeProvider, TimeSpan delay, CancellationToken cancellationToken = default)
130public static Task WaitAsync(this Task task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
221public static Task<TResult> WaitAsync<TResult>(this Task<TResult> task, TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken = default)
231/// <summary>Initializes a new instance of the <see cref="CancellationTokenSource"/> class that will be canceled after the specified <see cref="TimeSpan"/>. </summary>
243/// If running on .NET versions earlier than .NET 8.0, there is a constraint when invoking <see cref="CancellationTokenSource.CancelAfter(TimeSpan)"/> on the resultant object.
247public static CancellationTokenSource CreateCancellationTokenSource(this TimeProvider timeProvider, TimeSpan delay)
Microsoft.Build.Framework (32)
Microsoft.CodeAnalysis (93)
SourceGeneration\GeneratorDriver.cs (4)
40_state = new GeneratorDriverState(parseOptions, optionsProvider, generators, incrementalGenerators, additionalTexts, ImmutableArray.Create(new GeneratorState[generators.Length]), DriverStateTable.Empty, SyntaxStore.Empty, driverOptions, runtime: TimeSpan.Zero);
218return _state.With(stateTable: DriverStateTable.Empty, runTime: TimeSpan.Zero);
381private static GeneratorState SetGeneratorException(Compilation compilation, CommonMessageProvider provider, GeneratorState generatorState, ISourceGenerator generator, Exception e, DiagnosticBag? diagnosticBag, CancellationToken cancellationToken, TimeSpan? runTime = null, bool isInit = false)
394return generatorState.WithError(e, filtered, runTime ?? TimeSpan.Zero);
SourceGeneration\Nodes\NodeStateTable.cs (11)
194bool usedCachedEntry = builder.TryUseCachedEntries(TimeSpan.Zero, inputs);
269public bool TryRemoveEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs)
285public bool TryRemoveEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, out OneOrMany<T> entries)
297public bool TryUseCachedEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs)
312internal bool TryUseCachedEntries(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, out TableEntry entry)
324public bool TryModifyEntry(T value, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
345public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
437public bool TryModifyEntries(ImmutableArray<T> outputs, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState, out TableEntry entry)
449public void AddEntry(T value, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
456public TableEntry AddEntries(ImmutableArray<T> values, EntryState state, TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
476private void RecordStepInfoForLastEntry(TimeSpan elapsedTime, ImmutableArray<(IncrementalGeneratorRunStep InputStep, int OutputIndex)> stepInputs, EntryState overallInputState)
Microsoft.CodeAnalysis.Analyzers (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.AnalyzerUtilities (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.BannedApiAnalyzers (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.CodeStyle (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.CSharp (2)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (18)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (2)
Microsoft.CodeAnalysis.CSharp.EndToEnd.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (70)
SourceGeneration\GeneratorDriverTests.cs (12)
571Assert.Equal(TimeSpan.Zero, result.ElapsedTime);
3531Assert.Equal(TimeSpan.Zero, timing.ElapsedTime);
3535Assert.Equal(TimeSpan.Zero, generatorTiming.ElapsedTime);
3561Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3565Assert.NotEqual(TimeSpan.Zero, generatorTiming.ElapsedTime);
3601Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3606Assert.NotEqual(TimeSpan.Zero, timing1.ElapsedTime);
3611Assert.NotEqual(TimeSpan.Zero, timing2.ElapsedTime);
3641Assert.NotEqual(TimeSpan.Zero, timing.ElapsedTime);
3645Assert.NotEqual(TimeSpan.Zero, generatorTiming.ElapsedTime);
3652Assert.NotEqual(TimeSpan.Zero, timing2.ElapsedTime);
3657Assert.NotEqual(TimeSpan.Zero, generatorTiming2.ElapsedTime);
SourceGeneration\StateTableTests.cs (54)
25builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
26builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
27builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
38builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
39builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
40builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
53builder.AddEntries(ImmutableArray.Create(o, o, o), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
66builder.AddEntry(o, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
67builder.AddEntry(null, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
68builder.AddEntry(o, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
79builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
80builder.AddEntries(ImmutableArray.Create(2, 3), EntryState.Cached, TimeSpan.Zero, default, EntryState.Cached);
81builder.AddEntries(ImmutableArray.Create(4, 5), EntryState.Modified, TimeSpan.Zero, default, EntryState.Modified);
82builder.AddEntries(ImmutableArray.Create(6), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
86builder.TryModifyEntries(ImmutableArray.Create(10, 11), TimeSpan.Zero, default, EntryState.Modified);
87builder.TryUseCachedEntries(TimeSpan.Zero, default, out var cachedEntries); // ((2, EntryState.Cached), (3, EntryState.Cached))
88builder.TryModifyEntries(ImmutableArray.Create(20, 21, 22), TimeSpan.Zero, default, EntryState.Modified);
89bool didRemoveEntries = builder.TryRemoveEntries(TimeSpan.Zero, default, out var removedEntries); //((6, EntryState.Removed))
110builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
111builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Removed, TimeSpan.Zero, default, EntryState.Removed);
112builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
127builder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
128builder.AddEntries(ImmutableArray.Create(4, 5, 6), EntryState.Removed, TimeSpan.Zero, default, EntryState.Removed);
129builder.AddEntries(ImmutableArray.Create(7, 8, 9), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
148builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
158builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
166bool didRemoveEntries = builder.TryRemoveEntries(TimeSpan.Zero, default);
169builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
180builder.AddEntries(ImmutableArray.Create(1, 2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
181builder.AddEntries(ImmutableArray<int>.Empty, EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
182builder.AddEntries(ImmutableArray.Create(3, 4), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
189Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 2), TimeSpan.Zero, default, EntryState.Modified));
190Assert.True(builder.TryModifyEntries(ImmutableArray<int>.Empty, TimeSpan.Zero, default, EntryState.Modified));
191Assert.True(builder.TryModifyEntries(ImmutableArray.Create(3, 5), TimeSpan.Zero, default, EntryState.Modified));
203builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
204builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
205builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
206builder.AddEntries(ImmutableArray.Create(4), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
213Assert.True(builder.TryModifyEntry(1, TimeSpan.Zero, default, EntryState.Modified));
214Assert.True(builder.TryModifyEntry(2, TimeSpan.Zero, default, EntryState.Modified));
215Assert.True(builder.TryModifyEntry(5, TimeSpan.Zero, default, EntryState.Modified));
216Assert.True(builder.TryModifyEntry(4, TimeSpan.Zero, default, EntryState.Modified));
228builder.AddEntries(ImmutableArray.Create(1), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
229builder.AddEntries(ImmutableArray.Create(2), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
230builder.AddEntries(ImmutableArray.Create(3), EntryState.Added, TimeSpan.Zero, default, EntryState.Added);
237Assert.True(builder.TryModifyEntry(1, TimeSpan.Zero, default, EntryState.Modified)); // ((1, EntryState.Cached))
238Assert.True(builder.TryModifyEntry(4, TimeSpan.Zero, default, EntryState.Modified)); // ((4, EntryState.Modified))
239Assert.True(builder.TryModifyEntry(5, TimeSpan.Zero, default, EntryState.Modified)); // ((3, EntryState.Cached))
282nodeBuilder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Cached, TimeSpan.Zero, default, EntryState.Cached);
311nodeBuilder.AddEntries(ImmutableArray.Create(1, 2, 3), EntryState.Added, TimeSpan.Zero, emptyInputSteps, EntryState.Added);
312nodeBuilder.AddEntries(ImmutableArray.Create(4), EntryState.Removed, TimeSpan.Zero, emptyInputSteps, EntryState.Removed);
313nodeBuilder.AddEntries(ImmutableArray.Create(5, 6), EntryState.Modified, TimeSpan.Zero, emptyInputSteps, EntryState.Modified);
600builder.AddEntry(value, state, TimeSpan.Zero, default, state);
1357runtime: TimeSpan.Zero);
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
Microsoft.CodeAnalysis.EditorFeatures (24)
src\Workspaces\Remote\ServiceHub\Services\EditAndContinue\EditAndContinueLogReporter.cs (1)
33delay: TimeSpan.Zero,
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (17)
Microsoft.CodeAnalysis.Extensions.Package (1)
Microsoft.CodeAnalysis.ExternalAccess.Apex (2)
Microsoft.CodeAnalysis.ExternalAccess.Copilot (2)
Microsoft.CodeAnalysis.ExternalAccess.FSharp (2)
Microsoft.CodeAnalysis.Features (116)
Copilot\CopilotChangeAnalysis.cs (8)
24[property: DataMember(Order = 7)] TimeSpan TotalAnalysisTime,
25[property: DataMember(Order = 8)] TimeSpan ForkingTime,
26[property: DataMember(Order = 9)] TimeSpan TotalDiagnosticComputationTime,
38[property: DataMember(Order = 1)] TimeSpan ComputationTime,
52[property: DataMember(Order = 0)] TimeSpan TotalComputationTime,
53[property: DataMember(Order = 1)] TimeSpan TotalApplicationTime,
55[property: DataMember(Order = 3)] Dictionary<string, TimeSpan> DiagnosticIdToApplicationTime,
57[property: DataMember(Order = 5)] Dictionary<string, TimeSpan> ProviderNameToApplicationTime,
ExternalAccess\UnitTesting\Notification\AbstractGlobalOperationNotificationService.cs (1)
33TimeSpan.Zero,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.AbstractUnitTestingPriorityProcessor.cs (1)
33TimeSpan backOffTimeSpan,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingLowPriorityProcessor.cs (1)
32TimeSpan backOffTimeSpan,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs (1)
48TimeSpan backOffTimeSpan,
Microsoft.CodeAnalysis.InteractiveHost (7)
Microsoft.CodeAnalysis.LanguageServer (5)
Microsoft.CodeAnalysis.LanguageServer.Protocol (7)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (7)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (11)
Microsoft.CodeAnalysis.PublicApiAnalyzers (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.Remote.ServiceHub (19)
Services\DiagnosticAnalyzer\PerformanceQueue.cs (8)
38public void Add(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData, int unitCount)
134public Snapshot(IEnumerable<(string analyzerId, TimeSpan timeSpan)> snapshot, int unitCount)
139public Snapshot(IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> rawData, int unitCount)
146public void Update(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData, int unitCount)
163Dictionary<int, double> map, IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> rawData, int fileCount)
166var minSpan = rawData.Select(kv => kv.timeSpan).Min();
180private static IEnumerable<(int assignedAnalyzerNumber, TimeSpan timeSpan)> Convert(IEnumerable<(string analyzerId, TimeSpan timeSpan)> rawData)
Microsoft.CodeAnalysis.ResxSourceGenerator (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (1)
Microsoft.CodeAnalysis.Test.Utilities (3)
Microsoft.CodeAnalysis.Threading.Package (7)
Microsoft.CodeAnalysis.Workspaces (42)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Workspace\Solution\VersionSource\RecoverableTextAndVersion.RecoverableText.cs (1)
29new(TimeSpan.Zero,
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (3)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Microsoft.DotNet.Arcade.Sdk (1)
Microsoft.DotNet.ArcadeAzureIntegration (2)
Microsoft.DotNet.Baselines.Tasks (1)
Microsoft.DotNet.Build.Tasks.Feed (11)
Microsoft.DotNet.Build.Tasks.Feed.Tests (8)
Microsoft.DotNet.Build.Tasks.Installers (3)
Microsoft.DotNet.Helix.Client (1)
Microsoft.DotNet.Helix.JobSender (8)
Microsoft.DotNet.Helix.Sdk (31)
Microsoft.DotNet.Internal.SymbolHelper (5)
Microsoft.DotNet.Open.Api.Tools.Tests (9)
Microsoft.DotNet.SignCheckLibrary (1)
Microsoft.DotNet.SignCheckTask (2)
Microsoft.DotNet.SignTool (1)
Microsoft.DotNet.XliffTasks (3)
Microsoft.DotNet.XUnitAssert.Tests (39)
EqualityAssertsTests.cs (34)
1762 var precision = TimeSpan.FromMinutes(1);
1777 var precision = TimeSpan.FromMinutes(1);
1778 var difference = TimeSpan.FromMinutes(2);
1812 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1813 var actual = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1826 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1827 var actual = new DateTimeOffset(2023, 2, 11, 15, 5, 0, TimeSpan.Zero);
1846 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1847 var actual = new DateTimeOffset(2023, 2, 11, 16, 4, 0, TimeSpan.FromHours(1));
1859 var expected = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1860 var actual = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.FromHours(1));
1879 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1880 var date2 = new DateTimeOffset(2023, 2, 11, 15, 5, 0, TimeSpan.Zero);
1881 var precision = TimeSpan.FromMinutes(1);
1894 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1895 var date2 = new DateTimeOffset(2023, 2, 11, 15, 6, 0, TimeSpan.Zero);
1896 var precision = TimeSpan.FromMinutes(1);
1897 var difference = TimeSpan.FromMinutes(2);
1928 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1929 var date2 = new DateTimeOffset(2023, 2, 11, 16, 5, 0, TimeSpan.FromHours(1));
1930 var precision = TimeSpan.FromMinutes(1);
1943 var date1 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.Zero);
1944 var date2 = new DateTimeOffset(2023, 2, 11, 15, 4, 0, TimeSpan.FromHours(1));
1945 var precision = TimeSpan.FromMinutes(1);
1946 var difference = TimeSpan.FromHours(1);
EquivalenceAssertsTests.cs (4)
1503 var expected = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1504 var actual = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1512 var expected = new DateTimeOffset(2022, 12, 1, 1, 3, 1, TimeSpan.Zero);
1513 var actual = new DateTimeOffset(2011, 9, 13, 18, 22, 0, TimeSpan.Zero);
Microsoft.Extensions.AI (4)
Microsoft.Extensions.AI.Abstractions (6)
Microsoft.Extensions.AI.Abstractions.Tests (66)
ChatCompletion\ChatResponseTests.cs (11)
61response.CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero);
62Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), response.CreatedAt);
91CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero),
108Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), result.CreatedAt);
135CreatedAt = new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero),
148Assert.Equal(new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero), update0.CreatedAt);
164CreatedAt = new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero),
169CreatedAt = new DateTimeOffset(2025, 1, 1, 10, 30, 0, TimeSpan.Zero),
177CreatedAt = new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero),
190Assert.Equal(new DateTimeOffset(2024, 11, 10, 9, 20, 0, TimeSpan.Zero), update0.CreatedAt);
199Assert.Equal(new DateTimeOffset(2025, 1, 1, 10, 30, 0, TimeSpan.Zero), update1.CreatedAt);
ChatCompletion\ChatResponseUpdateExtensionsTests.cs (13)
31new(ChatRole.Assistant, "Hello") { ResponseId = "someResponse", MessageId = "12345", CreatedAt = new DateTimeOffset(1, 2, 3, 4, 5, 6, TimeSpan.Zero), ModelId = "model123" },
33new(null, "world!") { CreatedAt = new DateTimeOffset(2, 2, 3, 4, 5, 6, TimeSpan.Zero), ConversationId = "123", AdditionalProperties = new() { ["c"] = "d" } },
49Assert.Equal(new DateTimeOffset(2, 2, 3, 4, 5, 6, TimeSpan.Zero), response.CreatedAt);
77new(null, "Hi! ") { CreatedAt = new DateTimeOffset(2023, 1, 1, 10, 0, 0, TimeSpan.Zero), AuthorName = "Assistant" },
78new(ChatRole.Assistant, "Hello") { MessageId = "msg1", CreatedAt = new DateTimeOffset(2024, 1, 1, 10, 0, 0, TimeSpan.Zero), AuthorName = "Assistant" },
79new(null, " from") { MessageId = "msg1", CreatedAt = new DateTimeOffset(2024, 1, 1, 10, 1, 0, TimeSpan.Zero) }, // Later CreatedAt should win
83new(ChatRole.User, "How") { MessageId = "msg2", CreatedAt = new DateTimeOffset(2024, 1, 1, 11, 0, 0, TimeSpan.Zero), AuthorName = "User" },
84new(null, " are") { MessageId = "msg2", CreatedAt = new DateTimeOffset(2024, 1, 1, 11, 1, 0, TimeSpan.Zero) },
88new(ChatRole.Assistant, "I'm doing well,") { MessageId = "msg3", CreatedAt = new DateTimeOffset(2024, 1, 1, 12, 0, 0, TimeSpan.Zero) },
89new(null, " thank you!") { MessageId = "msg3", CreatedAt = new DateTimeOffset(2024, 1, 1, 12, 2, 0, TimeSpan.Zero) }, // Later CreatedAt should win
107Assert.Equal(new DateTimeOffset(2024, 1, 1, 10, 1, 0, TimeSpan.Zero), message1.CreatedAt); // Last value should win
115Assert.Equal(new DateTimeOffset(2024, 1, 1, 11, 1, 0, TimeSpan.Zero), message2.CreatedAt); // Last value should win
123Assert.Equal(new DateTimeOffset(2024, 1, 1, 12, 2, 0, TimeSpan.Zero), message3.CreatedAt); // Last value should win
ChatCompletion\ChatResponseUpdateTests.cs (4)
76update.CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero);
77Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), update.CreatedAt);
130CreatedAt = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero),
161Assert.Equal(new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero), result.CreatedAt);
SpeechToText\SpeechToTextResponseUpdateExtensionsTests.cs (12)
49new("human, ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(10), EndTime = TimeSpan.FromSeconds(20) },
50new("How ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(22), EndTime = TimeSpan.FromSeconds(23) },
51new("are ") { ModelId = "model123", StartTime = TimeSpan.FromSeconds(23), EndTime = TimeSpan.FromSeconds(24) },
52new([new TextContent("You?")]) { ModelId = "model123", StartTime = TimeSpan.FromSeconds(24), EndTime = TimeSpan.FromSeconds(25), AdditionalProperties = new() { ["c"] = "d" } },
53new() { ResponseId = "someResponse", ModelId = "model123", StartTime = TimeSpan.FromSeconds(25), EndTime = TimeSpan.FromSeconds(35) },
63Assert.Equal(TimeSpan.FromSeconds(10), response.StartTime);
64Assert.Equal(TimeSpan.FromSeconds(35), response.EndTime);
Microsoft.Extensions.AI.Evaluation (8)
Microsoft.Extensions.AI.Evaluation.Console (6)
Microsoft.Extensions.AI.Evaluation.NLP (9)
Microsoft.Extensions.AI.Evaluation.Quality (21)
Microsoft.Extensions.AI.Evaluation.Reporting (17)
Microsoft.Extensions.AI.Evaluation.Reporting.Azure (11)
Microsoft.Extensions.AI.Evaluation.Reporting.Tests (17)
Microsoft.Extensions.AI.Evaluation.Safety (8)
Microsoft.Extensions.AI.Integration.Tests (1)
Microsoft.Extensions.AI.OpenAI (12)
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIConversionTests.cs (12)
212ChatMessageRole.User, null, null, null, new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero),
222Assert.Equal(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero), response.CreatedAt);
253Assert.Equal(new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero), response.CreatedAt);
278null, null, null, OpenAI.Chat.ChatFinishReason.ToolCalls, new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero),
407CreatedAt = new DateTimeOffset(2025, 1, 3, 14, 30, 0, TimeSpan.Zero),
422Assert.Equal(new DateTimeOffset(2025, 1, 3, 14, 30, 0, TimeSpan.Zero), completion.CreatedAt);
569createdAt: new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero),
596CreatedAt = new DateTimeOffset(2025, 1, 1, 12, 0, 0, TimeSpan.Zero)
611Assert.Equal(new DateTimeOffset(2025, 1, 1, 12, 0, 0, TimeSpan.Zero), streamingUpdate.CreatedAt);
861new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero),
890CreatedAt = new DateTimeOffset(2025, 1, 15, 10, 30, 0, TimeSpan.Zero),
899Assert.Equal(new DateTimeOffset(2025, 1, 15, 10, 30, 0, TimeSpan.Zero), openAIResponse.CreatedAt);
Microsoft.Extensions.AI.Templates.Tests (4)
Microsoft.Extensions.AI.Tests (1)
Microsoft.Extensions.ApiDescription.Client.Tests (13)
Microsoft.Extensions.Caching.Abstractions (25)
Microsoft.Extensions.Caching.Hybrid (19)
Internal\HybridCachePayload.cs (3)
104string key, long creationTime, TimeSpan duration, PayloadFlags flags, TagSet tags, ReadOnlySequence<byte> payload)
179out ArraySegment<byte> payload, out TimeSpan remainingTime, out PayloadFlags flags, out ushort entropy, out TagSet pendingTags, out Exception? fault)
187remainingTime = TimeSpan.Zero;
Microsoft.Extensions.Caching.Hybrid.Tests (50)
BufferReleaseTests.cs (2)
133var bytes = HybridCachePayload.Write(arr, key, cache.CurrentTimestamp(), TimeSpan.FromHours(1), 0, TagSet.Empty, writer.AsSequence());
196var bytes = HybridCachePayload.Write(arr, key, cache.CurrentTimestamp(), TimeSpan.FromHours(1), 0, TagSet.Empty, writer.AsSequence());
PayloadTests.cs (21)
50int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
55clock.Add(TimeSpan.FromSeconds(10));
56var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
80int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
84clock.Add(TimeSpan.FromSeconds(58));
85var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
90clock.Add(TimeSpan.FromSeconds(4));
114int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
118clock.Add(TimeSpan.FromSeconds(2));
121var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
144int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
148clock.Add(TimeSpan.FromSeconds(2));
151var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
181int actualLength = HybridCachePayload.Write(oversized, key, creation, TimeSpan.FromMinutes(1), 0, tags, new(bytes));
185clock.Add(TimeSpan.FromSeconds(2));
189var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
211var result = HybridCachePayload.TryParse(new(bytes), "whatever", TagSet.Empty, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
234int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
238var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength - 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
261int actualLength = HybridCachePayload.Write(oversized, key, cache.CurrentTimestamp(), TimeSpan.FromMinutes(1), 0, tags, new(bytes));
265var result = HybridCachePayload.TryParse(new(oversized, 0, actualLength + 1), key, tags, cache, out var payload, out var remaining, out var flags, out var entropy, out var pendingTags, out _);
Microsoft.Extensions.Caching.Memory (9)
Microsoft.Extensions.Caching.MicroBenchmarks (2)
Microsoft.Extensions.Caching.SqlServer (12)
Microsoft.Extensions.Caching.SqlServer.Tests (46)
Microsoft.Extensions.Caching.StackExchangeRedis (23)
RedisCache.cs (23)
63private readonly TimeSpan ReconnectMinInterval = TimeSpan.FromSeconds(60);
66private readonly TimeSpan ReconnectErrorThreshold = TimeSpan.FromSeconds(30);
71return ticks == 0 ? DateTimeOffset.MinValue : new DateTimeOffset(ticks, TimeSpan.Zero);
188var setTtl = batch.KeyExpireAsync(prefixedKey, TimeSpan.FromSeconds(ttl.GetValueOrDefault()));
237cache.KeyExpireAsync(prefixedKey, TimeSpan.FromSeconds(ttl.GetValueOrDefault()))
249private static HashEntry[] GetHashFields(RedisValue value, DateTimeOffset? absoluteExpiration, TimeSpan? slidingExpiration)
413MapMetadata(results, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
452MapMetadata(results, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
503private static void MapMetadata(RedisValue[] results, out DateTimeOffset? absoluteExpiration, out TimeSpan? slidingExpiration)
510absoluteExpiration = new DateTimeOffset(absoluteExpirationTicks.Value, TimeSpan.Zero);
519private void Refresh(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr)
524TimeSpan? expr;
527var relExpr = absExpr.Value - DateTimeOffset.Now;
545private async Task RefreshAsync(IDatabase cache, string key, DateTimeOffset? absExpr, TimeSpan sldExpr, CancellationToken token)
552TimeSpan? expr;
555var relExpr = absExpr.Value - DateTimeOffset.Now;
639TimeSpan elapsedSinceLastReconnect = utcNow - previousConnectTime;
656TimeSpan elapsedSinceFirstError = utcNow - firstErrorTime;
657TimeSpan elapsedSinceMostRecentError = utcNow - ReadTimeTicks(ref _previousErrorTimeTicks);
731MapMetadata(metadata, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
778MapMetadata(metadata, out DateTimeOffset? absExpr, out TimeSpan? sldExpr);
Microsoft.Extensions.Caching.StackExchangeRedis.Tests (50)
TimeExpirationAsyncTests.cs (25)
44var expected = DateTimeOffset.Now - TimeSpan.FromMinutes(1);
62await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
69await Task.Delay(TimeSpan.FromSeconds(0.5));
83await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
98await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(-1)));
102TimeSpan.FromMinutes(-1));
114await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.Zero));
118TimeSpan.Zero);
128await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
135await Task.Delay(TimeSpan.FromSeconds(0.5));
148await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
163await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(-1)));
164}, nameof(DistributedCacheEntryOptions.SlidingExpiration), "The sliding expiration value must be positive.", TimeSpan.FromMinutes(-1));
176await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.Zero));
180TimeSpan.Zero);
190await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
195await Task.Delay(TimeSpan.FromSeconds(3.5));
208await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(0.25)));
221await cache.SetAsync(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
228await Task.Delay(TimeSpan.FromSeconds(0.5));
234await Task.Delay(TimeSpan.FromSeconds(3));
247.SetSlidingExpiration(TimeSpan.FromSeconds(1))
248.SetAbsoluteExpiration(TimeSpan.FromSeconds(3)));
256await Task.Delay(TimeSpan.FromSeconds(0.5));
265await Task.Delay(TimeSpan.FromSeconds(0.5));
TimeExpirationTests.cs (25)
27var expected = DateTimeOffset.Now - TimeSpan.FromMinutes(1);
45cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
52Thread.Sleep(TimeSpan.FromSeconds(0.5));
66cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
81cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMinutes(-1)));
85TimeSpan.FromMinutes(-1));
98cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.Zero));
102TimeSpan.Zero);
112cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(1)));
119Thread.Sleep(TimeSpan.FromSeconds(0.5));
132cache.Set(key, value, new DistributedCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromSeconds(0.25)));
147cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(-1)));
148}, nameof(DistributedCacheEntryOptions.SlidingExpiration), "The sliding expiration value must be positive.", TimeSpan.FromMinutes(-1));
161cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.Zero));
165TimeSpan.Zero);
175cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
180Thread.Sleep(TimeSpan.FromSeconds(3.5));
193cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(0.25)));
206cache.Set(key, value, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(1)));
213Thread.Sleep(TimeSpan.FromSeconds(0.5));
219Thread.Sleep(TimeSpan.FromSeconds(3));
232.SetSlidingExpiration(TimeSpan.FromSeconds(1))
233.SetAbsoluteExpiration(TimeSpan.FromSeconds(3)));
241Thread.Sleep(TimeSpan.FromSeconds(0.5));
250Thread.Sleep(TimeSpan.FromSeconds(0.5));
Microsoft.Extensions.Compliance.Redaction (10)
Microsoft.Extensions.Compliance.Testing (1)
Microsoft.Extensions.Configuration.KeyPerFile.Tests (1)
Microsoft.Extensions.Diagnostics (2)
Microsoft.Extensions.Diagnostics.HealthChecks (50)
HealthCheckPublisherHostedService.cs (15)
53private (TimeSpan Delay, TimeSpan Period) GetTimerOptions(HealthCheckRegistration registration)
107var delayPeriodGroups = new HashSet<(TimeSpan Delay, TimeSpan Period)>();
124private Timer CreateTimer((TimeSpan Delay, TimeSpan Period) timerOptions)
144internal async Task RunAsync((TimeSpan Delay, TimeSpan Period) timerOptions)
152var timeout = _healthCheckPublisherOptions.Value.Timeout;
178private async Task RunAsyncCore((TimeSpan Delay, TimeSpan Period) timerOptions, CancellationToken cancellationToken)
255public static void HealthCheckPublisherProcessingEnd(ILogger logger, TimeSpan duration, Exception? exception = null) =>
264public static void HealthCheckPublisherEnd(ILogger logger, IHealthCheckPublisher HealthCheckPublisher, TimeSpan duration) =>
270public static void HealthCheckPublisherError(ILogger logger, IHealthCheckPublisher publisher, TimeSpan duration, Exception exception) =>
277public static void HealthCheckPublisherTimeout(ILogger logger, IHealthCheckPublisher publisher, TimeSpan duration) =>
Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (17)
HealthReportEntry.cs (3)
26public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data)
41public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary<string, object>? data, IEnumerable<string>? tags = null)
64public TimeSpan Duration { get; }
Microsoft.Extensions.Diagnostics.HealthChecks.Common.Tests (2)
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (72)
HealthCheckPublisherHostedServiceTest.cs (59)
112options.Delay = TimeSpan.FromMilliseconds(0);
120await publishers[0].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
121await publishers[1].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
122await publishers[2].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
158await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
171await running.TimeoutAfter(TimeSpan.FromSeconds(10));
200await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
204await running.TimeoutAfter(TimeSpan.FromSeconds(10));
263Delay = TimeSpan.FromSeconds(1),
264Period = TimeSpan.FromSeconds(9)
275Delay = TimeSpan.FromSeconds(1),
276Period = TimeSpan.FromSeconds(9)
287Delay = TimeSpan.FromSeconds(1),
288Period = TimeSpan.FromSeconds(18)
303Delay = TimeSpan.FromSeconds(2),
304Period = TimeSpan.FromSeconds(18)
315Delay = TimeSpan.FromSeconds(7),
316Period = TimeSpan.FromSeconds(11)
327Delay = TimeSpan.FromSeconds(9),
328Period = TimeSpan.FromSeconds(5)
339Delay = TimeSpan.FromSeconds(10),
340Period = TimeSpan.FromSeconds(8)
351Delay = TimeSpan.FromSeconds(10),
352Period = TimeSpan.FromSeconds(9)
360await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
367await running.TimeoutAfter(TimeSpan.FromSeconds(10));
373await unblockDelayedCheck.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
418await publishers[0].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
419await publishers[1].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
420await publishers[2].Started.TimeoutAfter(TimeSpan.FromSeconds(10));
426await running.TimeoutAfter(TimeSpan.FromSeconds(10));
464await publisher.Started.TimeoutAfter(TimeSpan.FromSeconds(10));
472await running.TimeoutAfter(TimeSpan.FromSeconds(10));
519options.Delay = TimeSpan.Zero;
538Delay = TimeSpan.FromSeconds(1),
539Period = TimeSpan.FromSeconds(9)
550Delay = TimeSpan.FromSeconds(1),
551Period = TimeSpan.FromSeconds(9)
562Delay = TimeSpan.FromSeconds(1),
563Period = TimeSpan.FromSeconds(9)
578Delay = TimeSpan.FromSeconds(2),
579Period = TimeSpan.FromSeconds(18)
590Delay = TimeSpan.FromSeconds(7),
591Period = TimeSpan.FromSeconds(11)
602Delay = TimeSpan.FromSeconds(9),
603Period = TimeSpan.FromSeconds(5)
614Delay = TimeSpan.FromSeconds(10),
615Period = TimeSpan.FromSeconds(8)
626Delay = TimeSpan.FromSeconds(10),
627Period = TimeSpan.FromSeconds(9)
636await unblockDelayedCheck.Task.TimeoutAfter(TimeSpan.FromSeconds(10));
681await RunServiceAsync(service).TimeoutAfter(TimeSpan.FromSeconds(10));
725await RunServiceAsync(service).TimeoutAfter(TimeSpan.FromSeconds(10));
761options.Delay = TimeSpan.FromMinutes(5);
762options.Period = TimeSpan.FromMinutes(5);
763options.Timeout = TimeSpan.FromMinutes(5);
788private Task RunServiceAsync(HealthCheckPublisherHostedService service) => service.RunAsync((TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)));
792await Assert.ThrowsAsync<TaskCanceledException>(() => Task.Delay(TimeSpan.FromSeconds(10), cancellationToken));
HealthReportTest.cs (10)
22{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) },
23{"Bar", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue,null, null) },
24{"Baz", new HealthReportEntry(status, exception: null, description: null,duration:TimeSpan.MinValue, data: null) },
25{"Quick", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
26{"Quack", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
27{"Quock", new HealthReportEntry(HealthStatus.Healthy, null, TimeSpan.MinValue, null, null) },
28}, totalDuration: TimeSpan.MinValue);
41{"Foo", new HealthReportEntry(HealthStatus.Healthy, null,TimeSpan.MinValue, null, null) }
42}, totalDuration: TimeSpan.FromMilliseconds(milliseconds));
44Assert.Equal(TimeSpan.FromMilliseconds(milliseconds), result.TotalDuration);
Microsoft.Extensions.Diagnostics.Probes (11)
Microsoft.Extensions.Diagnostics.Probes.Tests (8)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (50)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (253)
CalculatorTests.cs (26)
19totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
20kernelTimeSinceStart: TimeSpan.FromTicks(0),
21userTimeSinceStart: TimeSpan.FromTicks(0),
31TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
40kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
43userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
66TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
75kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
78userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 4),
95totalTimeSinceStart: _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5)),
122totalTimeSinceStart: TimeSpan.FromTicks(new FakeTimeProvider().GetUtcNow().Ticks),
123kernelTimeSinceStart: TimeSpan.FromTicks(1000),
124userTimeSinceStart: TimeSpan.FromTicks(1000),
127totalTimeSinceStart: firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5)),
129kernelTimeSinceStart: TimeSpan.FromTicks(firstSnapshot.KernelTimeSinceStart.Ticks - 1),
130userTimeSinceStart: TimeSpan.FromTicks(firstSnapshot.UserTimeSinceStart.Ticks - 1));
144TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
151kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 2),
152userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks / 2),
175TimeSpan secondSnapshotTimeSpan = _firstSnapshot.TotalTimeSinceStart.Add(TimeSpan.FromSeconds(5));
185kernelTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks),
186userTimeSinceStart: TimeSpan.FromTicks(totalAvailableTicks),
ResourceMonitoringOptionsValidatorTests.cs (15)
17CollectionWindow = TimeSpan.FromMilliseconds(100),
18SamplingInterval = TimeSpan.FromMilliseconds(10),
19PublishingWindow = TimeSpan.FromSeconds(200)
34CollectionWindow = TimeSpan.FromTicks(1),
35SamplingInterval = TimeSpan.FromSeconds(1),
36PublishingWindow = TimeSpan.FromSeconds(200)
49CollectionWindow = TimeSpan.FromMilliseconds(100),
50SamplingInterval = TimeSpan.FromMilliseconds(0),
51PublishingWindow = TimeSpan.FromSeconds(200)
64CollectionWindow = TimeSpan.FromMilliseconds(100),
65SamplingInterval = TimeSpan.FromMilliseconds(1),
66PublishingWindow = TimeSpan.FromSeconds(-5)
109CollectionWindow = TimeSpan.FromMilliseconds(samplingWindow),
110SamplingInterval = TimeSpan.FromMilliseconds(samplingPeriod),
111PublishingWindow = TimeSpan.FromMilliseconds(calculationPeriod)
ResourceMonitoringServiceTests.cs (80)
112CollectionWindow = TimeSpan.FromMilliseconds(int.MaxValue),
113SamplingInterval = TimeSpan.FromMilliseconds(int.MaxValue)
170CollectionWindow = TimeSpan.FromSeconds(1),
171PublishingWindow = TimeSpan.FromSeconds(1)
202CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
203SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod),
204PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod)
217await Task.Delay(TimeSpan.FromMilliseconds(TimerPeriod * 3));
243CollectionWindow = TimeSpan.FromMilliseconds(100),
244PublishingWindow = TimeSpan.FromMilliseconds(100),
245SamplingInterval = TimeSpan.FromMilliseconds(1)
258clock.Advance(TimeSpan.FromMilliseconds(1));
259clock.Advance(TimeSpan.FromMilliseconds(1));
276CollectionWindow = TimeSpan.FromMilliseconds(100),
277PublishingWindow = TimeSpan.FromMilliseconds(100)
317CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
318PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod),
319SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
338clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
360CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod),
361PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod),
362SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
370clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
388TimeSpan.FromTicks(clock.GetUtcNow().Ticks),
389TimeSpan.Zero,
390TimeSpan.Zero,
402TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks),
403TimeSpan.FromMilliseconds(250),
404TimeSpan.FromMilliseconds(250),
407TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks),
408TimeSpan.FromMilliseconds(250),
409TimeSpan.FromMilliseconds(250),
412TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks),
413TimeSpan.FromMilliseconds(250),
414TimeSpan.FromMilliseconds(250),
417TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks),
418TimeSpan.FromMilliseconds(250),
419TimeSpan.FromMilliseconds(250),
422TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks),
423TimeSpan.FromMilliseconds(250),
424TimeSpan.FromMilliseconds(250),
437CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
438PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
439SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
465clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
471clock.Advance(TimeSpan.FromTicks(1));
495TimeSpan.FromTicks(clock.GetUtcNow().Ticks),
496TimeSpan.FromMilliseconds(250),
497TimeSpan.FromMilliseconds(250),
508TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod).Ticks),
509TimeSpan.FromMilliseconds(250),
510TimeSpan.FromMilliseconds(250),
513TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 2).Ticks),
514TimeSpan.FromMilliseconds(250),
515TimeSpan.FromMilliseconds(250),
518TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 3).Ticks),
519TimeSpan.FromMilliseconds(250),
520TimeSpan.FromMilliseconds(250),
523TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 4).Ticks),
524TimeSpan.FromMilliseconds(250),
525TimeSpan.FromMilliseconds(250),
528TimeSpan.FromTicks(clock.GetUtcNow().AddMilliseconds(TimerPeriod * 5).Ticks),
529TimeSpan.FromMilliseconds(250),
530TimeSpan.FromMilliseconds(250),
546CollectionWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
547PublishingWindow = TimeSpan.FromMilliseconds(TimerPeriod * 2),
548SamplingInterval = TimeSpan.FromMilliseconds(TimerPeriod)
574clock.Advance(TimeSpan.FromMilliseconds(TimerPeriod));
643TimeSpan.FromTicks(_clock.GetUtcNow().Ticks),
644TimeSpan.FromSeconds(1),
645TimeSpan.FromSeconds(1),
653CollectionWindow = TimeSpan.FromSeconds(1),
654SamplingInterval = TimeSpan.FromMilliseconds(100),
655PublishingWindow = TimeSpan.FromSeconds(1)
663var exception = Record.Exception(() => _ = tracker.GetUtilization(TimeSpan.FromSeconds(1)));
678CollectionWindow = TimeSpan.FromSeconds(6),
679PublishingWindow = TimeSpan.FromSeconds(5)
687var exception = Record.Exception(() => tracker.GetUtilization(TimeSpan.FromSeconds(6)));
702CollectionWindow = TimeSpan.FromSeconds(5)
710var exception = Record.Exception(() => tracker.GetUtilization(TimeSpan.FromSeconds(6)));
SnapshotTests.cs (9)
18var snapshot = new Snapshot(TimeSpan.FromTicks(time.GetUtcNow().Ticks), TimeSpan.Zero, TimeSpan.FromSeconds(1), 10);
22snapshot = new Snapshot(time, TimeSpan.Zero, TimeSpan.FromSeconds(1), 10);
30=> new Snapshot(new FakeTimeProvider(), TimeSpan.MinValue, TimeSpan.FromSeconds(1), 1000));
37=> new Snapshot(new FakeTimeProvider(), TimeSpan.Zero, TimeSpan.MinValue, 1000));
Microsoft.Extensions.Diagnostics.Testing (1)
Microsoft.Extensions.Diagnostics.Testing.Tests (15)
Microsoft.Extensions.FileProviders.Physical (7)
Microsoft.Extensions.Hosting (5)
Microsoft.Extensions.Hosting.Abstractions (1)
Microsoft.Extensions.Hosting.Testing (7)
Microsoft.Extensions.Hosting.Testing.Tests (10)
Microsoft.Extensions.Http (37)
Logging\LogHelper.cs (4)
87public static void LogRequestEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
102public static void LogRequestFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
126public static void LogRequestPipelineEnd(this ILogger logger, HttpResponseMessage response, TimeSpan duration, Func<string, bool> shouldRedactHeaderValue)
141public static void LogRequestPipelineFailed(this ILogger logger, TimeSpan duration, HttpRequestException exception) =>
Microsoft.Extensions.Http.Diagnostics (13)
Logging\Internal\HttpClientLogger.cs (6)
116TimeSpan elapsed,
125TimeSpan elapsed,
132public void LogRequestStop(object? context, HttpRequestMessage request, HttpResponseMessage response, TimeSpan elapsed)
135public void LogRequestFailed(object? context, HttpRequestMessage request, HttpResponseMessage? response, Exception exception, TimeSpan elapsed)
158TimeSpan elapsed,
223LogRecord logRecord, LoggerMessageState loggerMessageState, in TimeSpan elapsed,
Microsoft.Extensions.Http.Diagnostics.Tests (49)
Logging\HttpClientLoggerTest.cs (11)
59BodyReadTimeout = TimeSpan.FromMinutes(5)
209BodyReadTimeout = TimeSpan.FromMinutes(5),
302BodyReadTimeout = TimeSpan.FromMinutes(5),
411BodyReadTimeout = TimeSpan.FromMinutes(5),
508BodyReadTimeout = TimeSpan.FromMinutes(5),
623BodyReadTimeout = TimeSpan.FromMinutes(5),
894BodyReadTimeout = TimeSpan.FromMinutes(5),
919fakeTimeProvider.Advance(TimeSpan.FromMilliseconds(1000));
992await logger.LogRequestStopAsync(new LogRecord(), httpRequestMessage, httpResponseMessage, TimeSpan.Zero);
1013Assert.Throws<NotSupportedException>(() => logger.LogRequestStop(null, httpRequestMessage, httpResponseMessage, TimeSpan.Zero));
1014Assert.Throws<NotSupportedException>(() => logger.LogRequestFailed(null, httpRequestMessage, null, new InvalidOperationException(), TimeSpan.Zero));
Microsoft.Extensions.Http.Polly (3)
Microsoft.Extensions.Http.Polly.Tests (7)
Microsoft.Extensions.Http.Resilience (22)
Microsoft.Extensions.Http.Resilience.PerformanceTests (5)
Microsoft.Extensions.Http.Resilience.Tests (58)
Microsoft.Extensions.Identity.Core (13)
Microsoft.Extensions.Logging.AzureAppServices (9)
Microsoft.Extensions.ML (11)
Builder\BuilderExtensions.cs (4)
69return builder.FromUri(modelName, uri, TimeSpan.FromMinutes(5));
84this PredictionEnginePoolBuilder<TData, TPrediction> builder, string uri, TimeSpan period)
107this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, string uri, TimeSpan period)
131this PredictionEnginePoolBuilder<TData, TPrediction> builder, string modelName, Uri uri, TimeSpan period)
Microsoft.Extensions.ML.Tests (2)
Microsoft.Extensions.ServiceDiscovery (8)
Microsoft.Extensions.ServiceDiscovery.Dns (47)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (12)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Microsoft.Extensions.Telemetry (9)
Microsoft.Extensions.Telemetry.Abstractions (1)
Microsoft.Extensions.TimeProvider.Testing (16)
FakeTimeProvider.cs (13)
19private DateTimeOffset _now = new(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
22private TimeSpan _autoAdvanceAmount;
60/// This defaults to <see cref="TimeSpan.Zero"/>.
62/// <exception cref="ArgumentOutOfRangeException">The time value is less than <see cref="TimeSpan.Zero"/>.</exception>
63public TimeSpan AutoAdvanceAmount
124/// <exception cref="ArgumentOutOfRangeException">The time value is less than <see cref="TimeSpan.Zero"/>.</exception>
125public void Advance(TimeSpan delta)
150var delta = value - _now;
173Debug.Assert(TimestampFrequency == TimeSpan.TicksPerSecond, "Assuming frequency equals ticks per second");
192/// This is fixed to the value of <see cref="TimeSpan.TicksPerSecond"/>.
194public override long TimestampFrequency => TimeSpan.TicksPerSecond;
203public override ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
Microsoft.Extensions.TimeProvider.Testing.Tests (170)
FakeTimeProviderTests.cs (82)
30Assert.Equal(TimeSpan.Zero, now.Offset);
32Assert.Equal(TimeSpan.Zero, timeProvider.AutoAdvanceAmount);
46var nowOffset = new DateTimeOffset(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
52Assert.Equal(nowOffset, new DateTimeOffset(timestamp1, TimeSpan.Zero));
53Assert.Equal(nowOffset, new DateTimeOffset(timestamp2, TimeSpan.Zero));
60var nowOffset = new DateTimeOffset(2000, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
63AutoAdvanceAmount = TimeSpan.FromMilliseconds(msToElapse)
69Assert.Equal(nowOffset, new DateTimeOffset(timestamp1, TimeSpan.Zero));
70Assert.Equal(nowOffset.AddMilliseconds(msToElapse), new DateTimeOffset(timestamp2, TimeSpan.Zero));
78timeProvider.Advance(TimeSpan.FromSeconds(1));
79var t = timeProvider.GetElapsedTime(st);
81Assert.Equal(TimeSpan.FromSeconds(1), t);
89AutoAdvanceAmount = TimeSpan.FromSeconds(1)
93var elapsedTime = timeProvider.GetElapsedTime(st);
94var elapsedTime2 = timeProvider.GetElapsedTime(st);
96Assert.Equal(TimeSpan.FromSeconds(1), elapsedTime);
97Assert.Equal(TimeSpan.FromSeconds(2), elapsedTime2);
103var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
105timeProvider.Advance(TimeSpan.FromMilliseconds(8));
116Assert.Equal(TimeSpan.Zero, now.Offset);
119Assert.Equal(TimeSpan.Zero, timeProvider.AutoAdvanceAmount);
121timeProvider.Advance(TimeSpan.FromMilliseconds(8));
154var tz = TimeZoneInfo.CreateCustomTimeZone("DUMMY", TimeSpan.FromHours(2), null, null);
162var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
172var utcDelta = finalTimeUtcNow - initialTimeUtcNow;
174var elapsedTime = timeProvider.GetElapsedTime(initialTimestamp, finalTimeTimestamp);
186var timeProvider = new FakeTimeProvider(new DateTimeOffset(2001, 2, 3, 4, 5, 6, TimeSpan.Zero));
191timeProvider.Advance(TimeSpan.FromMilliseconds(1234));
196var utcDelta = finalTimeUtcNow - initialTimeUtcNow;
198var elapsedTime = timeProvider.GetElapsedTime(initialTimestamp, finalTimeTimestamp);
212Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.Advance(TimeSpan.FromTicks(-1)));
220Assert.Throws<ArgumentOutOfRangeException>(() => timeProvider.SetUtcNow(timeProvider.GetUtcNow() - TimeSpan.FromTicks(1)));
232}, null, TimeSpan.FromSeconds(1), TimeSpan.Zero);
234tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(999));
237tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromMilliseconds(1));
240tp.AdjustTime(tp.GetUtcNow() + TimeSpan.FromSeconds(10));
243tp.Advance(TimeSpan.FromMilliseconds(999));
246tp.Advance(TimeSpan.FromMilliseconds(1));
259}, null, TimeSpan.FromSeconds(1), TimeSpan.Zero);
261tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(999));
264tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromMilliseconds(1));
267tp.AdjustTime(tp.GetUtcNow() - TimeSpan.FromSeconds(10));
270tp.Advance(TimeSpan.FromMilliseconds(999));
273tp.Advance(TimeSpan.FromMilliseconds(1));
280var dto = new DateTimeOffset(new DateTime(2022, 1, 2, 3, 4, 5, 6), TimeSpan.Zero);
286private readonly TimeSpan _infiniteTimeout = TimeSpan.FromMilliseconds(-1);
292var t = timeProvider.Delay(TimeSpan.Zero, CancellationToken.None);
303var delay = timeProvider.Delay(TimeSpan.FromMilliseconds(1), CancellationToken.None);
304timeProvider.Advance(TimeSpan.FromMilliseconds(1));
332using var cancellationTokenSource = new CancellationTokenSource(TimeSpan.FromMilliseconds(1000));
334var task = fakeTimeProvider.Delay(TimeSpan.FromMilliseconds(10000), cancellationTokenSource.Token);
336fakeTimeProvider.Advance(TimeSpan.FromMilliseconds(10000));
348using var cts = timeProvider.CreateCancellationTokenSource(TimeSpan.FromMilliseconds(1));
349timeProvider.Advance(TimeSpan.FromMilliseconds(1));
351await Assert.ThrowsAsync<TaskCanceledException>(() => timeProvider.Delay(TimeSpan.FromTicks(1), cts.Token));
364await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => source.Task.WaitAsync(TimeSpan.FromTicks(-1), timeProvider, CancellationToken.None));
366await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() => source.Task.WaitAsync(TimeSpan.FromMilliseconds(-2), timeProvider, CancellationToken.None));
375var t = source.Task.WaitAsync(TimeSpan.FromSeconds(100000), timeProvider, CancellationToken.None);
378timeProvider.Advance(TimeSpan.FromMilliseconds(1));
395var t = source.Task.WaitAsync(TimeSpan.FromMilliseconds(-1), timeProvider, CancellationToken.None);
398timeProvider.Advance(TimeSpan.FromMilliseconds(1));
414var t = source.Task.WaitAsync(TimeSpan.FromMilliseconds(1), timeProvider, CancellationToken.None);
417timeProvider.Advance(TimeSpan.FromMilliseconds(1));
446AutoAdvanceAmount = TimeSpan.FromSeconds(1)
454Assert.Equal(timeProvider.Start + TimeSpan.FromSeconds(1), second);
455Assert.Equal(timeProvider.Start + TimeSpan.FromSeconds(2), third);
473AutoAdvanceAmount = TimeSpan.FromSeconds(1)
478timeProvider.AutoAdvanceAmount = TimeSpan.Zero;
485var oneSecond = TimeSpan.FromSeconds(1);
494}, null, TimeSpan.Zero, oneSecond);
503var provider = new FakeTimeProvider { AutoAdvanceAmount = TimeSpan.FromSeconds(2) };
505using var timer = provider.CreateTimer(calls.Add, "timer-1", TimeSpan.FromSeconds(3), TimeSpan.Zero);
515th.Join(TimeSpan.FromMilliseconds(200));
544await provider.Delay(TimeSpan.FromSeconds(taskDelay));
558await provider.Delay(TimeSpan.FromSeconds(delay)).ConfigureAwait(false);
569provider.Advance(TimeSpan.FromSeconds(taskDelay));
572provider.Advance(TimeSpan.FromSeconds(delay));
TimerTests.cs (88)
25using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.FromMilliseconds(10), TimeSpan.Zero);
29timeProvider.Advance(TimeSpan.FromMilliseconds(20));
33timeProvider.Advance(TimeSpan.FromMilliseconds(1000));
47using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.FromMilliseconds(10), Timeout.InfiniteTimeSpan);
51timeProvider.Advance(TimeSpan.FromMilliseconds(20));
55timeProvider.Advance(TimeSpan.FromMilliseconds(1000));
69using var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.Zero, Timeout.InfiniteTimeSpan);
73timeProvider.Advance(TimeSpan.FromMilliseconds(100));
77timeProvider.Advance(TimeSpan.FromMilliseconds(100));
91var timer = timeProvider.CreateTimer(_ => { counter++; }, null, Timeout.InfiniteTimeSpan, TimeSpan.FromMilliseconds(10));
95timeProvider.Advance(TimeSpan.FromMilliseconds(1));
99timeProvider.Advance(TimeSpan.FromMilliseconds(50));
113var timer = timeProvider.CreateTimer(_ => { counter++; }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10));
117timeProvider.Advance(TimeSpan.FromMilliseconds(1));
121timeProvider.Advance(TimeSpan.FromMilliseconds(10));
125timeProvider.Advance(TimeSpan.FromMilliseconds(10));
139_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
141Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromMilliseconds(1)));
142Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(-2), TimeSpan.FromSeconds(1)));
143Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromMilliseconds(1)));
144Assert.Throws<ArgumentOutOfRangeException>("dueTime", () => t.Change(TimeSpan.FromMilliseconds(0xFFFFFFFFL), TimeSpan.FromSeconds(1)));
151_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
153Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(-2)));
154Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(-2)));
155Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL)));
156Assert.Throws<ArgumentOutOfRangeException>("period", () => t.Change(TimeSpan.FromSeconds(1), TimeSpan.FromMilliseconds(0xFFFFFFFFL)));
163_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
165Assert.True(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
167Assert.False(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
174_ = t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
176Assert.True(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
178Assert.False(t.Change(TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1)));
190var timer1 = timeProvider.CreateTimer(_ => timer1Counter++, null, TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
191var timer2 = timeProvider.CreateTimer(_ => timer2Counter++, null, TimeSpan.FromMilliseconds(1), TimeSpan.FromMilliseconds(1));
195timeProvider.Advance(TimeSpan.FromMilliseconds(1));
201timeProvider.Advance(TimeSpan.FromMilliseconds(1));
253using var timer = timeProvider.CreateTimer(_ => { callbackTime = timeProvider.GetUtcNow(); }, null, TimeSpan.Zero, TimeSpan.FromMilliseconds(10));
257timeProvider.SetUtcNow(timeProvider.Start + TimeSpan.FromMilliseconds(20));
261timeProvider.SetUtcNow(timeProvider.Start + TimeSpan.FromMilliseconds(1000));
266Assert.Equal(timeProvider.Start + TimeSpan.FromMilliseconds(20), value2);
267Assert.Equal(timeProvider.Start + TimeSpan.FromMilliseconds(1000), value3);
275var period = TimeSpan.FromMilliseconds(10);
276var timer = timeProvider.CreateTimer(_ => { callbackTimes.Add(timeProvider.GetUtcNow()); }, null, TimeSpan.Zero, period);
298var callbacks = new List<(int timerId, TimeSpan callbackTime)>();
301using var timer1 = timeProvider.CreateTimer(_ => callbacks.Add((1, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3));
302using var timer2 = timeProvider.CreateTimer(_ => callbacks.Add((2, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(3), TimeSpan.FromMilliseconds(3));
303using var timer3 = timeProvider.CreateTimer(_ => callbacks.Add((3, timeProvider.GetElapsedTime(startTime))), null, TimeSpan.FromMilliseconds(6), TimeSpan.FromMilliseconds(5));
305timeProvider.Advance(TimeSpan.FromMilliseconds(3));
306timeProvider.Advance(TimeSpan.FromMilliseconds(3));
307timeProvider.Advance(TimeSpan.FromMilliseconds(3));
308timeProvider.Advance(TimeSpan.FromMilliseconds(2));
312(1, TimeSpan.FromMilliseconds(3)),
313(2, TimeSpan.FromMilliseconds(3)),
314(3, TimeSpan.FromMilliseconds(6)),
315(1, TimeSpan.FromMilliseconds(6)),
316(2, TimeSpan.FromMilliseconds(6)),
317(1, TimeSpan.FromMilliseconds(9)),
318(2, TimeSpan.FromMilliseconds(9)),
319(3, TimeSpan.FromMilliseconds(11)),
339timers.Add(timeProvider.CreateTimer(index => triggers[(int)index!] = true, i, TimeSpan.FromSeconds(dueTimes[i]), TimeSpan.Zero));
340timeProvider.Advance(TimeSpan.FromTicks(1));
357timeProvider.Advance(TimeSpan.FromSeconds(2));
Microsoft.Extensions.Validation (1)
Microsoft.Extensions.Validation.GeneratorTests (8)
Microsoft.Extensions.Validation.Tests (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.JSInterop (11)
JSObjectReferenceExtensions.cs (5)
93public static async ValueTask<TValue> InvokeAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, params object?[]? args)
111public static async ValueTask InvokeVoidAsync(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, params object?[]? args)
161public static ValueTask<IJSObjectReference> InvokeConstructorAsync(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout, object?[]? args)
179public static ValueTask<TValue> GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TimeSpan timeout)
198public static ValueTask SetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSObjectReference jsObjectReference, string identifier, TValue value, TimeSpan timeout)
JSRuntimeExtensions.cs (5)
93public static async ValueTask<TValue> InvokeAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, params object?[]? args)
111public static async ValueTask InvokeVoidAsync(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, params object?[]? args)
161public static ValueTask<IJSObjectReference> InvokeConstructorAsync(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout, object?[]? args)
179public static ValueTask<TValue> GetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSRuntime jsRuntime, string identifier, TimeSpan timeout)
198public static ValueTask SetValueAsync<[DynamicallyAccessedMembers(JsonSerialized)] TValue>(this IJSRuntime jsRuntime, string identifier, TValue value, TimeSpan timeout)
Microsoft.JSInterop.Tests (5)
Microsoft.Maui (10)
Microsoft.Maui.Controls (23)
Microsoft.Maui.Controls.Build.Tasks (5)
Microsoft.Maui.Controls.Xaml (3)
Microsoft.Maui.Essentials (19)
Microsoft.Maui.Resizetizer (1)
Microsoft.ML.AutoML (5)
Microsoft.ML.AutoML.Interactive (3)
Microsoft.ML.AutoML.Tests (3)
Microsoft.ML.Core (5)
Microsoft.ML.Core.Tests (2)
Microsoft.ML.Data (35)
Data\Conversion.cs (19)
27using TS = TimeSpan;
236AddStd<TX, TS>(Convert);
250AddStd<TS, I8>(Convert);
251AddStd<TS, R4>(Convert);
252AddStd<TS, R8>(Convert);
253AddAux<TS, SB>(Convert);
254AddStd<TS, TX>(Convert);
291AddIsDef<TS>(IsDefault);
313AddTryParse<TS>(TryParse);
789private bool IsDefault(in TS src) => src.Equals(default(TS));
833public void Convert(in TS src, ref I8 dst) => dst = (I8)src.Ticks;
891public void Convert(in TS src, ref R4 dst) => dst = (R4)src.Ticks;
909public void Convert(in TS src, ref R8 dst) => dst = (R8)src.Ticks;
934public void Convert(in TS src, ref SB dst) { ClearDst(ref dst); dst.AppendFormat("{0:c}", src); }
952public void Convert(in TS src, ref TX dst) => dst = string.Format("{0:c}", src).AsMemory();
1401public bool TryParse(in TX src, out TS dst)
1409if (TimeSpan.TryParse(src.ToString(), CultureInfo.InvariantCulture, out dst))
1715public void Convert(in TX span, ref TS value) => TryParse(in span, out value);
Microsoft.ML.DataView (2)
Microsoft.ML.IntegrationTests (2)
Microsoft.ML.Maml (2)
Microsoft.ML.Parquet (4)
Microsoft.ML.PerformanceTests (1)
Microsoft.ML.Samples (1)
Microsoft.ML.TestFramework (4)
Microsoft.ML.TestFrameworkCommon (3)
Microsoft.ML.Tests (1)
Microsoft.ML.Tokenizers (6)
Microsoft.ML.Tokenizers.Data.Tests (1)
Microsoft.ML.Tokenizers.Tests (3)
Microsoft.Net.Http.Headers (16)
Microsoft.Net.Http.Headers.Tests (37)
Microsoft.VisualBasic.Core (5)
Microsoft.VisualStudio.LanguageServices (16)
Microsoft.VisualStudio.LanguageServices.CodeLens (1)
Microsoft.VisualStudio.LanguageServices.CSharp (4)
Mongo.AppHost (1)
mscorlib (1)
Mvc.RoutingWebSite (1)
MvcFormSample (1)
Nats.ApiService (1)
netstandard (1)
OpenIdConnectSample (1)
OutputCachingSample (2)
PortableTask (1)
PresentationBuildTasks (3)
PresentationCore (811)
System\Windows\Media\Animation\Clock.cs (146)
120_nextTickNeededTime = TimeSpan.Zero;
263public TimeSpan? CurrentTime
484protected virtual TimeSpan GetCurrentTimeCore()
488return _currentTime ?? TimeSpan.Zero;
519protected TimeSpan CurrentGlobalTime
525return TimeSpan.Zero;
606if (!_resolvedDuration.HasTimeSpan || _resolvedDuration.TimeSpan > TimeSpan.Zero)
682TimeSpan beginTime, TimeSpan? endTime,
691TimeSpan beginTime, TimeSpan endTime, Duration period,
704TimeSpan? lastCurrentTime = _currentTime;
757InternalSeek(TimeSpan.Zero);
852internal void InternalSeek(TimeSpan destination)
875internal void InternalSeekAlignedToLastTick(TimeSpan destination)
961TimeSpan? effectiveDuration;
1232TimeSpan? expirationTime;
1351internal TimeSpan? InternalNextTickNeededTime
1862TimeSpan previewParentTime = CurrentGlobalTime;
1919TimeSpan nextDesiredTick = InternalNextTickNeededTime == TimeSpan.Zero ? _rootData.CurrentAdjustedGlobalTime
1932private bool ComputeCurrentIteration(TimeSpan parentTime, double parentSpeed,
1933TimeSpan? expirationTime,
1934out TimeSpan localProgress)
1948TimeSpan beginTimeForOffsetComputation = _currentIterationBeginTime ?? _beginTime.Value;
1949TimeSpan offsetFromBegin = MultiplyTimeSpan(parentTime - beginTimeForOffsetComputation, _appliedSpeedRatio);
1956if (_currentDuration.TimeSpan == TimeSpan.Zero) // We must be post-filling if we have gotten here
1961localProgress = TimeSpan.Zero;
1964_currentTime = TimeSpan.Zero;
2063TimeSpan optimizedOffsetFromBegin;
2086localProgress = TimeSpan.FromTicks(offsetFromBegin.Ticks % _currentDuration.TimeSpan.Ticks);
2091if ((localProgress == TimeSpan.Zero)
2115if (localProgress == TimeSpan.Zero)
2122InternalNextTickNeededTime = TimeSpan.Zero;
2138TimeSpan timeUntilNextBoundary;
2140if (localProgress == TimeSpan.Zero) // We are currently exactly at a boundary
2146TimeSpan decelBegin = MultiplyTimeSpan(_currentDuration.TimeSpan, 1.0 - _timeline.DecelerationRatio);
2151TimeSpan accelEnd = MultiplyTimeSpan(_currentDuration.TimeSpan, _timeline.AccelerationRatio);
2155TimeSpan proposedNextTickTime = CurrentGlobalTime + timeUntilNextBoundary;
2182private void ComputeCurrentIterationWithGrow(TimeSpan parentTime, TimeSpan? expirationTime,
2183out TimeSpan localProgress, out int newIteration)
2191TimeSpan offsetFromBegin = MultiplyTimeSpan(parentTime - _currentIterationBeginTime.Value, _appliedSpeedRatio);
2204localProgress = TimeSpan.FromTicks(offsetOnLaterIterations % _resolvedDuration.TimeSpan.Ticks);
2248private bool ComputeCurrentState(TimeSpan? expirationTime, ref TimeSpan parentTime, double parentSpeed, bool isInTick)
2292InternalNextTickNeededTime = TimeSpan.Zero; // We need ticks immediately
2330private bool ComputeCurrentTime(TimeSpan localProgress, out double localSpeed)
2340Debug.Assert(_currentDuration.TimeSpan > TimeSpan.Zero, "ComputeCurrentTime was entered with _currentDuration <= 0");
2376InternalNextTickNeededTime = TimeSpan.Zero;
2400InternalNextTickNeededTime = TimeSpan.Zero;
2404_currentTime = TimeSpan.FromTicks((long)((t * durationInTicks) + 0.5));
2465private TimeSpan? ComputeEffectiveDuration()
2475TimeSpan? effectiveDuration;
2478if (_currentDuration.HasTimeSpan && _currentDuration.TimeSpan == TimeSpan.Zero)
2481effectiveDuration = TimeSpan.Zero;
2487effectiveDuration = TimeSpan.Zero;
2511TimeSpan previousIterationDuration = TimeSpan.Zero;
2538effectiveDuration = TimeSpan.FromTicks((long)(presentAndFutureDuration / _appliedSpeedRatio + 0.5)) + previousIterationDuration;
2557private void ComputeEvents(TimeSpan? expirationTime,
2579postFillDuration = TimeSpan.Zero; // There is no reachable postfill zone because the active period is infinite
2615else if (postFillDuration != TimeSpan.Zero && // Our active period is finite and we have fill behavior
2639private bool ComputeExpirationTime(out TimeSpan? expirationTime)
2644TimeSpan? effectiveDuration;
2665expirationTime += TimeSpan.FromMilliseconds(50); // This compensation is roughly one frame of video
2796TimeSpan? endOfActivePeriod)
2804TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;
2827TimeSpan? endOfActivePeriod,
2831TimeSpan relativeBeginTime = _currentIterationBeginTime ?? _beginTime.Value;
2875TimeSpan? parentTime; // Computed parent-local time
2876TimeSpan? expirationTime; // Computed expiration time with respect to repeat behavior and resolved duration;
2877TimeSpan localProgress; // Computed time inside simple duration
2879TimeSpan parentTimeValue;
2989private bool ComputeNextTickNeededTime(TimeSpan? expirationTime,
2990TimeSpan parentTime, double parentSpeed)
3000InternalNextTickNeededTime = IsInteractivelyPaused ? TimeSpan.Zero : (TimeSpan?)null;
3005TimeSpan? timeUntilNextBoundary = null;
3017TimeSpan timeUntilBegin = MultiplyTimeSpan(_beginTime.Value - parentTime, invertedParentSpeed);
3026if (timeUntilBegin >= TimeSpan.Zero)
3033TimeSpan timeUntilExpiration = MultiplyTimeSpan(expirationTime.Value - parentTime, invertedParentSpeed);
3035if (timeUntilExpiration >= TimeSpan.Zero &&
3063private bool ComputeParentParameters(out TimeSpan? parentTime, out double? parentSpeed,
3081InternalNextTickNeededTime = TimeSpan.Zero; // When TimeManager wakes up, we will need an update
3148TimeSpan currentParentTimePT)
3173TimeSpan relativeBeginTimePT = _currentIterationBeginTime ?? _beginTime.Value;
3174TimeSpan previewCurrentOffsetPT = currentParentTimePT - relativeBeginTimePT; // This is our time offset (not yet scaled by speed)
3175TimeSpan previewCurrentTimeLT = MultiplyTimeSpan(previewCurrentOffsetPT, _appliedSpeedRatio); // This is what our time would be
3185TimeSpan? expirationTimePT;
3191TimeSpan ourSyncTimeST = (_syncData.SyncClock == this) ?
3196TimeSpan? syncClockEffectiveDurationST = _syncData.SyncClockEffectiveDuration;
3205_syncData.PreviousSyncClockTime = TimeSpan.FromTicks(ourSyncTimeST.Ticks % syncClockDuration.TimeSpan.Ticks);
3211_syncData.PreviousRepeatTime = TimeSpan.Zero;
3228TimeSpan? previousSyncParentTimeSPT = (_syncData.SyncClock == this) ?
3241TimeSpan timeIntoSyncPeriodPT = previewCurrentOffsetPT;
3263_syncData.PreviousSyncClockTime = TimeSpan.Zero;
3264_syncData.PreviousRepeatTime = TimeSpan.Zero;
3281TimeSpan currentParentTimePT, double currentParentSpeed)
3301TimeSpan previousParentTimePT = parentIntervalCollection.IsEmptyOfRealPoints ? currentParentTimePT
3303TimeSpan parentElapsedTimePT = currentParentTimePT - previousParentTimePT;
3306TimeSpan ourProjectedElapsedTimeLT = MultiplyTimeSpan(parentElapsedTimePT, _appliedSpeedRatio);
3308TimeSpan syncTimeST = _syncData.SyncClock.GetCurrentTimeCore();
3309TimeSpan syncElapsedTimeST = syncTimeST - _syncData.PreviousSyncClockTime; // Elapsed from last tick
3311if (syncElapsedTimeST > TimeSpan.Zero) // Only store the last value if it is greater than
3315TimeSpan? effectiveDurationST = _syncData.SyncClockEffectiveDuration;
3322_syncData.PreviousRepeatTime = TimeSpan.Zero;
3334_syncData.PreviousSyncClockTime = TimeSpan.Zero;
3344syncElapsedTimeST = TimeSpan.Zero;
3348TimeSpan syncElapsedTimeLT = (_syncData.SyncClock == this)
3353TimeSpan parentTimeSlipPT = parentElapsedTimePT - DivideTimeSpan(syncElapsedTimeLT, _appliedSpeedRatio);
3501private TimeSpan GetCurrentDesiredFrameTime(TimeSpan time)
3507private TimeSpan GetDesiredFrameTime(TimeSpan time, int frameOffset)
3516return TimeSpan.FromTicks(desiredFrameTick);
3520private TimeSpan GetNextDesiredFrameTime(TimeSpan time)
3651private TimeSpan DivideTimeSpan(TimeSpan timeSpan, double factor)
3654return TimeSpan.FromTicks((long)(((double)timeSpan.Ticks) / factor + 0.5));
3670private static TimeSpan MultiplyTimeSpan(TimeSpan timeSpan, double factor)
3672return TimeSpan.FromTicks((long)(factor * (double)timeSpan.Ticks + 0.5));
3682subtree.Current.InternalNextTickNeededTime = TimeSpan.Zero;
3686while (current != null && current.InternalNextTickNeededTime != TimeSpan.Zero)
3688current.InternalNextTickNeededTime = TimeSpan.Zero;
4023internal TimeSpan? SyncClockEffectiveDuration
4045internal TimeSpan PreviousSyncClockTime
4051internal TimeSpan PreviousRepeatTime
4057internal TimeSpan SyncClockBeginTime
4072private TimeSpan? _syncClockEffectiveDuration; // This reflects RepeatBehavior (local coordinates)
4074private TimeSpan? _syncClockBeginTime;
4075private TimeSpan _previousSyncClockTime;
4076private TimeSpan _previousRepeatTime; // How many complete iterations we already have done
4088internal TimeSpan CurrentAdjustedGlobalTime
4106internal TimeSpan LastAdjustedGlobalTime
4115internal TimeSpan? PendingSeekDestination
4130private TimeSpan _currentAdjustedGlobalTime;
4131private TimeSpan _lastAdjustedGlobalTime;
4132private TimeSpan? _pendingSeekDestination;
4398private TimeSpan? _currentTime; // Precalculated current global time
4413internal TimeSpan? _beginTime;
4419private TimeSpan? _currentIterationBeginTime;
4422internal TimeSpan? _nextTickNeededTime = null;
4470private static Int64 s_TimeSpanTicksPerSecond = TimeSpan.FromSeconds(1).Ticks;
System\Windows\Media\Animation\TimeIntervalCollection.cs (85)
121private TimeIntervalCollection(TimeSpan point)
130private void InitializePoint(TimeSpan point)
147private TimeIntervalCollection(TimeSpan point, bool includePoint)
172private TimeIntervalCollection(TimeSpan from, bool includeFrom, TimeSpan to, bool includeTo)
246internal TimeSpan FirstNodeTime
264internal TimeIntervalCollection SlipBeginningOfConnectedInterval(TimeSpan slipTime)
266if (slipTime == TimeSpan.Zero) // The no-op case
293internal TimeIntervalCollection SetBeginningOfConnectedInterval(TimeSpan beginTime)
316internal static TimeIntervalCollection CreatePoint(TimeSpan time)
324internal static TimeIntervalCollection CreateClosedOpenInterval(TimeSpan from, TimeSpan to)
332internal static TimeIntervalCollection CreateOpenClosedInterval(TimeSpan from, TimeSpan to)
340internal static TimeIntervalCollection CreateInfiniteClosedInterval(TimeSpan from)
397internal bool Contains(TimeSpan time)
527internal bool Intersects(TimeSpan from, TimeSpan to)
535TimeSpan temp = from;
852internal bool IntersectsPeriodicCollection(TimeSpan beginTime, Duration period, double appliedSpeedRatio,
859|| (period == TimeSpan.Zero) // The PTIC has no nonzero period, we define such intersections nonexistent
981internal bool IntersectsMultiplePeriods(TimeSpan beginTime, Duration period, double appliedSpeedRatio)
986|| (period == TimeSpan.Zero) // The PTIC has no nonzero period, we define such intersections nonexistent
1004TimeSpan lastNodeTime = _nodeTime[_count - 1];
1027TimeSpan beginTime, TimeSpan endTime, Duration period,
1036Debug.Assert(!period.HasTimeSpan || period.TimeSpan > TimeSpan.Zero || beginTime == endTime); // Check the consistency of degenerate case where simple duration is zero; expiration time should equal beginTime
1101projection.InitializePoint(TimeSpan.FromTicks(outputInTicks));
1149TimeSpan beginTime, Nullable<TimeSpan> endTime,
1161Debug.Assert(endTime.HasValue || fillDuration == TimeSpan.Zero); // Either endTime is finite, or it's infinite hence we cannot have any fill zone
1162Debug.Assert(!period.HasTimeSpan || period.TimeSpan > TimeSpan.Zero || (endTime.HasValue && beginTime == endTime)); // Check the consistency of degenerate case where simple duration is zero; expiration time should equal beginTime
1175&& _nodeIsPoint[_count - 1] && (endTime > beginTime || fillDuration.TimeSpan > TimeSpan.Zero)))); // ...we may have a point intersection with the stopped zone
1181projection.InitializePoint(TimeSpan.Zero);
1185bool includeFillPeriod = !fillDuration.HasTimeSpan || fillDuration.TimeSpan > TimeSpan.Zero; // This variable represents whether we have a non-zero fill zone
1194Nullable<TimeSpan> activeDuration;
1235TimeSpan beginTime, Nullable<TimeSpan> endTime, bool includeFillPeriod, double speedRatio)
1256projection.CurrentNodeTime = TimeSpan.Zero;
1269projection.CurrentNodeTime = TimeSpan.FromTicks((long)(speedRatio * timeOffset));
1287projection.CurrentNodeTime = TimeSpan.FromTicks((long)(speedRatio * timeOffset));
1304private void ProjectionFold(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1312Debug.Assert(CurrentNodeTime >= TimeSpan.Zero); // Verify that we are already clipped
1346private void ProjectionFoldPoint(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1375projection.MergePoint(TimeSpan.FromTicks(currentProjection));
1389private bool ProjectionFoldInterval(ref TimeIntervalCollection projection, Nullable<TimeSpan> activeDuration,
1440projection.MergeInterval(TimeSpan.Zero, true,
1441TimeSpan.FromTicks(currentProjection), includeTime);
1446projection.MergeInterval(TimeSpan.FromTicks(currentProjection), includeTime,
1447TimeSpan.FromTicks(periodInTicks), true);
1457projection.MergeInterval(TimeSpan.Zero, true,
1458TimeSpan.FromTicks(clippedTime), NextNodeIsPoint);
1465projection.MergeInterval(TimeSpan.FromTicks(clippedTime), NextNodeIsPoint,
1466TimeSpan.FromTicks(periodInTicks), true);
1477projection.MergeInterval(TimeSpan.FromTicks(currentProjection - intervalLength), NextNodeIsPoint,
1478TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint);
1482projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1483TimeSpan.FromTicks(currentProjection + intervalLength), NextNodeIsPoint);
1499projection._nodeTime[0] = TimeSpan.Zero;
1503projection._nodeTime[1] = TimeSpan.FromTicks(periodInTicks);
1513projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1514TimeSpan.FromTicks(periodInTicks), false);
1517projection.MergeInterval(TimeSpan.Zero, true,
1518TimeSpan.FromTicks(intervalLength - timeBeforeNextPeriod), NextNodeIsPoint);
1524projection.MergePoint(TimeSpan.FromTicks(periodInTicks));
1528projection.MergePoint(TimeSpan.Zero);
1536projection.MergeInterval(TimeSpan.FromTicks(currentProjection), CurrentNodeIsPoint,
1537TimeSpan.FromTicks(currentProjection + intervalLength), NextNodeIsPoint);
1550private void MergePoint(TimeSpan point)
1605private void MergeInterval(TimeSpan from, bool includeFrom,
1606TimeSpan to, bool includeTo)
1776_nodeTime = new TimeSpan[requiredCapacity];
1787TimeSpan[] newNodeTime = new TimeSpan[newCapacity];
1821TimeSpan accelEnd = TimeSpan.FromTicks((long)(dpPeriod * accelRatio));
1822TimeSpan decelStart = TimeSpan.FromTicks(periodInTicks - (long)(dpPeriod * decelRatio));
1832_nodeTime[_current] = TimeSpan.FromTicks((long)(halfMaxRate * inversePeriod * t * t / accelRatio));
1840_nodeTime[_current] = TimeSpan.FromTicks((long)(halfMaxRate * (2 * t - (accelRatio * dpPeriod))));
1848_nodeTime[_current] = TimeSpan.FromTicks(periodInTicks - (long)(halfMaxRate * inversePeriod * t * t / decelRatio));
2121private int Locate(TimeSpan time)
2196private TimeSpan CurrentNodeTime
2238private TimeSpan NextNodeTime
2283private TimeSpan[] _nodeTime; // An interval's begin time
PresentationCore.Tests (36)
System\Windows\DurationConverter.Tests.cs (8)
16[InlineData(false, typeof(TimeSpan))]
31[InlineData(false, typeof(TimeSpan))]
48Assert.Equal(expected, TimeSpan.Parse(expected).ToString());
78[InlineData(typeof(TimeSpan))]
106yield return new object?[] { new Duration(TimeSpan.FromTicks(6488853448000)), CultureInfo.InvariantCulture, "07:12:14:45.3448 " };
107yield return new object?[] { new Duration(TimeSpan.FromTicks(5624853448000)), new CultureInfo("ru-RU"), " 6:12:14:45,3448 " };
109yield return new object?[] { new Duration(TimeSpan.FromTicks(5184000000000)), CultureInfo.InvariantCulture, " 6 " };
111yield return new object?[] { new Duration(TimeSpan.FromTicks(223200000000)), CultureInfo.InvariantCulture, " 6:12 " };
System\Windows\Media\Animation\RepeatBehavior.Tests.cs (25)
53public void Constructor_NegativeDuration_ThrowsArgumentOutOfRangeException(TimeSpan duration)
62yield return new object[] { TimeSpan.MinValue };
63yield return new object[] { TimeSpan.FromTicks(-1) };
69public void Kind_Duration_ReturnsExpected_Value(TimeSpan duration)
80yield return new object[] { TimeSpan.Zero };
81yield return new object[] { TimeSpan.MaxValue };
82yield return new object[] { TimeSpan.FromSeconds(1) };
89RepeatBehavior behavior = new RepeatBehavior(TimeSpan.FromSeconds(1));
98RepeatBehavior behavior = new RepeatBehavior(TimeSpan.FromSeconds(1));
161yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1)), new RepeatBehavior(TimeSpan.FromSeconds(1)), true };
162yield return new object[] { new RepeatBehavior(TimeSpan.FromDays(3)), new RepeatBehavior(TimeSpan.FromDays(3)), true };
163yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1111)), new RepeatBehavior(TimeSpan.FromSeconds(1111)), true };
166yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(1111)), new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
167yield return new object[] { new RepeatBehavior(TimeSpan.FromSeconds(0)), new RepeatBehavior(TimeSpan.FromSeconds(8888)), false };
168yield return new object[] { new RepeatBehavior(TimeSpan.FromDays(5)), new RepeatBehavior(TimeSpan.FromDays(7)), false };
171yield return new object[] { new RepeatBehavior(1), new RepeatBehavior(TimeSpan.FromSeconds(1)), false };
172yield return new object[] { new RepeatBehavior(1111), new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
178yield return new object[] { RepeatBehavior.Forever, new RepeatBehavior(TimeSpan.FromSeconds(1112)), false };
182yield return new object[] { RepeatBehavior.Forever, new RepeatBehavior(TimeSpan.Zero), false };
PresentationFramework (78)
System\Windows\Media\Animation\Storyboard.cs (16)
1472public Nullable<TimeSpan> GetCurrentTime( FrameworkElement containingObject )
1482public Nullable<TimeSpan> GetCurrentTime( FrameworkContentElement containingObject )
1491public TimeSpan GetCurrentTime()
1493Nullable<TimeSpan> currentTime = GetCurrentTimeImpl(this);
1501return default(TimeSpan);
1505private Nullable<TimeSpan> GetCurrentTimeImpl( DependencyObject containingObject )
1694public void Seek( FrameworkElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1704public void Seek( FrameworkContentElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1714public void Seek( TimeSpan offset, TimeSeekOrigin origin )
1724public void Seek( TimeSpan offset )
1729private void SeekImpl( DependencyObject containingObject, TimeSpan offset, TimeSeekOrigin origin )
1742public void SeekAlignedToLastTick( FrameworkElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1752public void SeekAlignedToLastTick( FrameworkContentElement containingObject, TimeSpan offset, TimeSeekOrigin origin )
1762public void SeekAlignedToLastTick( TimeSpan offset, TimeSeekOrigin origin )
1772public void SeekAlignedToLastTick( TimeSpan offset )
1777private void SeekAlignedToLastTickImpl( DependencyObject containingObject, TimeSpan offset, TimeSeekOrigin origin )
PresentationFramework.Aero (31)
PresentationFramework.Aero2 (31)
PresentationFramework.AeroLite (1)
PresentationFramework.Classic (1)
PresentationFramework.Luna (1)
PresentationFramework.Royale (1)
PresentationFramework.Tests (4)
Producer (2)
RateLimitingSample (2)
RazorWebSite (2)
ReachFramework (1)
ResponseCachingSample (1)
ResponseCompressionSample (1)
Roslyn.Diagnostics.Analyzers (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
Roslyn.VisualStudio.DiagnosticsWindow (3)
Roslyn.VisualStudio.Next.UnitTests (5)
RoutingSandbox (3)
RoutingWebSite (2)
RunTests (30)
SampleStartups (1)
ScenarioTests.Common.Tests (15)
Security.TransportSecurity.IntegrationTests (3)
ServiceBusWorker (1)
SessionSample (1)
Shared (21)
Shared.Tests (37)
SignalRSamples (3)
SocialSample (2)
Sockets.BindTests (6)
Sockets.FunctionalTests (32)
StartRequestDelegateUrlApp (1)
StartRouteBuilderUrlApp (1)
StartWithIApplicationBuilderUrlApp (1)
Stress.ApiService (2)
Stress.AppHost (1)
Stress.TelemetryService (2)
System.Collections.Concurrent (13)
System\Collections\Concurrent\BlockingCollection.cs (13)
311/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
312/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
325public bool TryAdd(T item, TimeSpan timeout)
564/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
565/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
577public bool TryTake([MaybeNullWhen(false)] out T item, TimeSpan timeout)
844/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
845/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
862public static int TryAddToAny(BlockingCollection<T>[] collections, T item, TimeSpan timeout)
1204/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds
1205/// to wait, or a <see cref="System.TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
1224public static int TryTakeFromAny(BlockingCollection<T>[] collections, out T? item, TimeSpan timeout)
1696private static void ValidateTimeout(TimeSpan timeout)
System.Collections.Immutable (1)
System.ComponentModel.Annotations (3)
System.ComponentModel.TypeConverter (11)
System.Configuration.ConfigurationManager (46)
System.Data.Common (70)
System.Data.Odbc (13)
System.Data.OleDb (1)
System.Diagnostics.DiagnosticSource (13)
System.Diagnostics.EventLog (1)
System.Diagnostics.Process (13)
System.DirectoryServices (4)
System.DirectoryServices.Protocols (28)
System\DirectoryServices\Protocols\ldap\LdapConnection.cs (8)
17internal delegate DirectoryResponse GetLdapResponseCallback(int messageId, LdapOperation operation, ResultAll resultType, TimeSpan requestTimeout, bool exceptionOnTimeOut);
102public override TimeSpan Timeout
107if (value < TimeSpan.Zero)
196public DirectoryResponse SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
266public IAsyncResult BeginSendRequest(DirectoryRequest request, TimeSpan requestTimeout, PartialResultProcessing partialMode, AsyncCallback callback, object state)
730int searchTimeLimit = (int)(searchRequest.TimeLimit.Ticks / TimeSpan.TicksPerSecond);
1350internal async ValueTask<DirectoryResponse> ConstructResponseAsync(int messageId, LdapOperation operation, ResultAll resultType, TimeSpan requestTimeOut, bool exceptionOnTimeOut, bool sync)
1354tv_sec = (int)(requestTimeOut.Ticks / TimeSpan.TicksPerSecond)
System.Formats.Asn1 (11)
System.Formats.Cbor (2)
System.Formats.Nrbf (13)
System.Formats.Tar (5)
System.IO.FileSystem.Watcher (2)
System.IO.IsolatedStorage (3)
System\IO\IsolatedStorage\IsolatedStorageFile.cs (3)
247return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
263return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
279return new DateTimeOffset(1601, 1, 1, 0, 0, 0, TimeSpan.Zero).ToLocalTime();
System.IO.Pipes (3)
System.Linq.Expressions (2)
System.Management (20)
artifacts\obj\System.Management\Debug\net10.0\System.Management.notsupported.cs (20)
69public ConnectionOptions(string locale, string username, System.Security.SecureString password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
70public ConnectionOptions(string locale, string username, string password, string authority, System.Management.ImpersonationLevel impersonation, System.Management.AuthenticationLevel authentication, bool enablePrivileges, System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
84public DeleteOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
90public EnumerationOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize, bool rewindable, bool returnImmediatley, bool useAmendedQualifiers, bool ensureLocatable, bool prototypeOnly, bool directRead, bool enumerateDeep) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
117public EventWatcherOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, int blockSize) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
132public InvokeMethodOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
214public static string ToDmtfTimeInterval(System.TimeSpan timespan) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
215public static System.TimeSpan ToTimeSpan(string dmtfTimespan) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
384public static readonly System.TimeSpan InfiniteTimeout;
386public System.TimeSpan Timeout { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
582public ObjectGetOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
652public PutOptions(System.Management.ManagementNamedValueCollection context, System.TimeSpan timeout, bool useAmendedQualifiers, System.Management.PutType putType) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
768public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
769public WqlEventQuery(string eventClassName, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
770public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
771public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
772public WqlEventQuery(string eventClassName, System.TimeSpan withinInterval, string condition, System.TimeSpan groupWithinInterval, string[] groupByPropertyList, string havingCondition) { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); }
776public System.TimeSpan GroupWithinInterval { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
780public System.TimeSpan WithinInterval { get { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } set { throw new System.PlatformNotSupportedException(System.SR.PlatformNotSupported_SystemManagement); } }
System.Net.Http (118)
System.Net.Http.Json (1)
System.Net.Http.WinHttpHandler (5)
System.Net.HttpListener (18)
System.Net.Mail (15)
System\Net\Mime\SmtpDateTime.cs (15)
62internal static readonly Dictionary<string, TimeSpan> s_timeZoneOffsetLookup = new Dictionary<string, TimeSpan>()
65{ "UT", TimeSpan.Zero }, // +0000
66{ "GMT", TimeSpan.Zero }, // +0000
79internal const long TimeSpanMaxTicks = TimeSpan.TicksPerHour * 99 + TimeSpan.TicksPerMinute * 59;
89private readonly TimeSpan _timeZone;
107TimeSpan localTimeZone = TimeZoneInfo.Local.GetUtcOffset(value);
116_timeZone = TimeSpan.Zero;
162TimeSpan timeZone = _timeZone;
294internal static bool TryParseTimeZoneString(string timeZoneString, out TimeSpan timeZone)
300timeZone = TimeSpan.Zero;
337internal static TimeSpan ValidateAndGetSanitizedTimeSpan(TimeSpan span)
340TimeSpan sanitizedTimeSpan = new TimeSpan(span.Days, span.Hours, span.Minutes, 0, 0);
System.Net.NameResolution (3)
System.Net.Ping (5)
System\Net\NetworkInformation\Ping.cs (5)
447public PingReply Send(IPAddress address, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null) =>
479public PingReply Send(string hostNameOrAddress, TimeSpan timeout, byte[]? buffer = null,
583public Task<PingReply> SendPingAsync(IPAddress address, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null, CancellationToken cancellationToken = default)
626public Task<PingReply> SendPingAsync(string hostNameOrAddress, TimeSpan timeout, byte[]? buffer = null, PingOptions? options = null, CancellationToken cancellationToken = default)
655private static int ToTimeoutMilliseconds(TimeSpan timeout)
System.Net.Quic (22)
System.Net.Requests (35)
System.Net.Security (15)
System.Net.ServerSentEvents (12)
System.Net.Sockets (6)
System.Net.WebSockets (34)
System.Net.WebSockets.Client (15)
System.Private.CoreLib (798)
src\libraries\Common\src\System\TimeProvider.cs (14)
59TimeSpan offset = zoneInfo.GetUtcOffset(utcDateTime);
104/// <returns>A <see cref="TimeSpan"/> for the elapsed time between the starting and ending timestamps.</returns>
105public TimeSpan GetElapsedTime(long startingTimestamp, long endingTimestamp)
117return new TimeSpan((long)((endingTimestamp - startingTimestamp) * ((double)TimeSpan.TicksPerSecond / timestampFrequency)));
124/// <returns>A <see cref="TimeSpan"/> for the elapsed time between the starting timestamp and the time of this call.</returns>
125public TimeSpan GetElapsedTime(long startingTimestamp) => GetElapsedTime(startingTimestamp, GetTimestamp());
127/// <summary>Creates a new <see cref="ITimer"/> instance, using <see cref="TimeSpan"/> values to measure time intervals.</summary>
133/// <param name="dueTime">The amount of time to delay before <paramref name="callback"/> is invoked. Specify <see cref="Timeout.InfiniteTimeSpan"/> to prevent the timer from starting. Specify <see cref="TimeSpan.Zero"/> to start the timer immediately.</param>
160public virtual ITimer CreateTimer(TimerCallback callback, object? state, TimeSpan dueTime, TimeSpan period)
185public SystemTimeProviderTimer(TimeSpan dueTime, TimeSpan period, TimerCallback callback, object? state)
211public bool Change(TimeSpan dueTime, TimeSpan period)
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (77)
78internal const long MaxTicks = DaysTo10000 * TimeSpan.TicksPerDay - 1;
79private const long MaxMicroseconds = MaxTicks / TimeSpan.TicksPerMicrosecond;
80private const long MaxMillis = MaxTicks / TimeSpan.TicksPerMillisecond;
81private const long MaxSeconds = MaxTicks / TimeSpan.TicksPerSecond;
82private const long MaxMinutes = MaxTicks / TimeSpan.TicksPerMinute;
83private const long MaxHours = MaxTicks / TimeSpan.TicksPerHour;
86internal const long UnixEpochTicks = DaysTo1970 * TimeSpan.TicksPerDay;
87private const long FileTimeOffset = DaysTo1601 * TimeSpan.TicksPerDay;
88private const long DoubleDateOffset = DaysTo1899 * TimeSpan.TicksPerDay;
91private const long OADateMinAsTicks = (DaysPer100Years - DaysPerYear) * TimeSpan.TicksPerDay;
105private const ulong TicksPer6Hours = TimeSpan.TicksPerHour * 6;
176_dateData = (ulong)(date.DayNumber * TimeSpan.TicksPerDay + time.Ticks);
195_dateData = (ulong)(date.DayNumber * TimeSpan.TicksPerDay + time.Ticks) | ((ulong)(uint)kind << KindShift);
207internal static void ThrowMillisecondOutOfRange() => throw new ArgumentOutOfRangeException("millisecond", SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MillisecondsPerSecond - 1));
208internal static void ThrowMicrosecondOutOfRange() => throw new ArgumentOutOfRangeException("microsecond", SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MicrosecondsPerMillisecond - 1));
290if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
425if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
426_dateData += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
485if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
486_dateData += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
679if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
680_dateData += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
808if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
809_dateData += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
860public DateTime Add(TimeSpan value)
888public DateTime AddDays(double value) => AddUnits(value, MaxDays, TimeSpan.TicksPerDay);
897public DateTime AddHours(double value) => AddUnits(value, MaxHours, TimeSpan.TicksPerHour);
906public DateTime AddMilliseconds(double value) => AddUnits(value, MaxMillis, TimeSpan.TicksPerMillisecond);
932public DateTime AddMicroseconds(double value) => AddUnits(value, MaxMicroseconds, TimeSpan.TicksPerMicrosecond);
941public DateTime AddMinutes(double value) => AddUnits(value, MaxMinutes, TimeSpan.TicksPerMinute);
976return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
986public DateTime AddSeconds(double value) => AddUnits(value, MaxSeconds, TimeSpan.TicksPerSecond);
1043return new DateTime(n * (ulong)TimeSpan.TicksPerDay + date.UTicks % TimeSpan.TicksPerDay | date.InternalKind);
1097return n * (ulong)TimeSpan.TicksPerDay;
1119return (uint)totalSeconds * (ulong)TimeSpan.TicksPerSecond;
1126if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) ThrowMillisecondOutOfRange();
1128ticks += (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
1139if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) ThrowMicrosecondOutOfRange();
1141ticks += (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond;
1167long millis = (long)(value * TimeSpan.MillisecondsPerDay + (value >= 0 ? 0.5 : -0.5));
1173millis -= (millis % TimeSpan.MillisecondsPerDay) * 2;
1176millis += DoubleDateOffset / TimeSpan.TicksPerMillisecond;
1179return millis * TimeSpan.TicksPerMillisecond;
1216if (ticks > TicksCeiling - TimeSpan.TicksPerDay)
1240ticks += TimeSpan.TicksPerDay;
1327TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(this, TimeZoneInfoOptions.NoThrowOnInvalidTime);
1346public DateTime Date => new((UTicks / TimeSpan.TicksPerDay * TimeSpan.TicksPerDay) | InternalKind);
1379ulong seconds = UTicks / TimeSpan.TicksPerSecond;
1390ulong milliseconds = UTicks / TimeSpan.TicksPerMillisecond;
1404ulong seconds = ticks / TimeSpan.TicksPerSecond;
1405tick = (int)(ticks - (seconds * TimeSpan.TicksPerSecond));
1435public DayOfWeek DayOfWeek => (DayOfWeek)(((uint)(UTicks / TimeSpan.TicksPerDay) + 1) % 7);
1454public int Hour => (int)((uint)(UTicks / TimeSpan.TicksPerHour) % 24);
1472public int Millisecond => (int)((UTicks / TimeSpan.TicksPerMillisecond) % 1000);
1477public int Microsecond => (int)((UTicks / TimeSpan.TicksPerMicrosecond) % 1000);
1482public int Nanosecond => (int)(UTicks % TimeSpan.TicksPerMicrosecond) * 100;
1487public int Minute => (int)((UTicks / TimeSpan.TicksPerMinute) % 60);
1529public int Second => (int)((UTicks / TimeSpan.TicksPerSecond) % 60);
1540public TimeSpan TimeOfDay => new TimeSpan((long)(UTicks % TimeSpan.TicksPerDay));
1650public TimeSpan Subtract(DateTime value)
1655public DateTime Subtract(TimeSpan value)
1667if (value < TimeSpan.TicksPerDay) // This is a fix for VB. They want the default day to be 1/1/0001 rather than 12/30/1899.
1673long millis = (value - DoubleDateOffset) / TimeSpan.TicksPerMillisecond;
1676long frac = millis % TimeSpan.MillisecondsPerDay;
1677if (frac != 0) millis -= (TimeSpan.MillisecondsPerDay + frac) * 2;
1679return (double)millis / TimeSpan.MillisecondsPerDay;
1855public static DateTime operator +(DateTime d, TimeSpan t)
1862public static DateTime operator -(DateTime d, TimeSpan t)
1869public static TimeSpan operator -(DateTime d1, DateTime d2) => new TimeSpan(d1.Ticks - d2.Ticks);
1989if ((uint)hour >= 24 || (uint)minute >= 60 || (uint)millisecond >= TimeSpan.MillisecondsPerSecond)
1999ulong ticks = (DaysToYear((uint)year) + days[month - 1] + (uint)day - 1) * (ulong)TimeSpan.TicksPerDay;
2003ticks += TimeToTicks(hour, minute, second) + (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond;
2012ticks += TimeToTicks(hour, minute, 59) + 999 * TimeSpan.TicksPerMillisecond;
src\libraries\System.Private.CoreLib\src\System\DateTimeOffset.cs (65)
51internal const long MaxOffset = MaxOffsetMinutes * TimeSpan.TicksPerMinute;
54private const long UnixEpochSeconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerSecond; // 62,135,596,800
55private const long UnixEpochMilliseconds = DateTime.UnixEpochTicks / TimeSpan.TicksPerMillisecond; // 62,135,596,800,000
57internal const long UnixMinSeconds = DateTime.MinTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
58internal const long UnixMaxSeconds = DateTime.MaxTicks / TimeSpan.TicksPerSecond - UnixEpochSeconds;
75Debug.Assert((ulong)(validDateTime.Ticks + validOffsetMinutes * TimeSpan.TicksPerMinute) <= DateTime.MaxTicks);
81public DateTimeOffset(long ticks, TimeSpan offset) : this(ValidateOffset(offset), ValidateDate(new DateTime(ticks), offset))
85private static DateTimeOffset CreateValidateOffset(DateTime dateTime, TimeSpan offset) => new DateTimeOffset(ValidateOffset(offset), ValidateDate(dateTime, offset));
94TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
108public DateTimeOffset(DateTime dateTime, TimeSpan offset)
134public DateTimeOffset(DateOnly date, TimeOnly time, TimeSpan offset)
141public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, TimeSpan offset)
156private static DateTime WithLeapSecond(int year, int month, int day, int hour, int minute, TimeSpan offset)
166public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, TimeSpan offset)
169if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond) DateTime.ThrowMillisecondOutOfRange();
170_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)millisecond * (uint)TimeSpan.TicksPerMillisecond);
175public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, Calendar calendar, TimeSpan offset)
191private static DateTime WithLeapSecond(Calendar calendar, int year, int month, int day, int hour, int minute, int millisecond, TimeSpan offset)
219/// the <see cref="DateTimeOffset(int, int, int, int, int, int, int, int, Calendar, TimeSpan)"/> constructor.
251public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, TimeSpan offset)
254if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
255_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
276/// the <see cref="DateTimeOffset(int, int, int, int, int, int, int, int, Calendar, TimeSpan)"/> constructor.
325public DateTimeOffset(int year, int month, int day, int hour, int minute, int second, int millisecond, int microsecond, Calendar calendar, TimeSpan offset)
328if ((uint)microsecond >= TimeSpan.MicrosecondsPerMillisecond) DateTime.ThrowMicrosecondOutOfRange();
329_dateTime = DateTime.CreateUnchecked(UtcTicks + (uint)microsecond * (uint)TimeSpan.TicksPerMicrosecond);
342public DateTimeOffset ToOffset(TimeSpan offset) => CreateValidateOffset(_dateTime + offset, offset);
349private DateTime ClockDateTime => DateTime.CreateUnchecked(UtcTicks + _offsetMinutes * TimeSpan.TicksPerMinute);
414public TimeSpan Offset => new TimeSpan(_offsetMinutes * TimeSpan.TicksPerMinute);
437public TimeSpan TimeOfDay => ClockDateTime.TimeOfDay;
447public DateTimeOffset Add(TimeSpan timeSpan) => Add(ClockDateTime.Add(timeSpan));
593long ticks = seconds * TimeSpan.TicksPerSecond + DateTime.UnixEpochTicks;
599const long MinMilliseconds = DateTime.MinTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
600const long MaxMilliseconds = DateTime.MaxTicks / TimeSpan.TicksPerMillisecond - UnixEpochMilliseconds;
607long ticks = milliseconds * TimeSpan.TicksPerMillisecond + DateTime.UnixEpochTicks;
657out TimeSpan offset);
676out TimeSpan offset);
683DateTime dateResult = DateTimeParse.Parse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
708out TimeSpan offset);
715DateTime dateResult = DateTimeParse.ParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
728out TimeSpan offset);
735DateTime dateResult = DateTimeParse.ParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out TimeSpan offset);
739public TimeSpan Subtract(DateTimeOffset value) => new TimeSpan(UtcTicks - value.UtcTicks);
741public DateTimeOffset Subtract(TimeSpan value) => Add(ClockDateTime.Subtract(value));
763long seconds = (long)((ulong)UtcTicks / TimeSpan.TicksPerSecond);
771long milliseconds = (long)((ulong)UtcTicks / TimeSpan.TicksPerMillisecond);
779TimeSpan offset = TimeZoneInfo.GetLocalUtcOffset(utcDateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
819out TimeSpan offset);
826bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.CurrentInfo, DateTimeStyles.None, out DateTime dateResult, out TimeSpan offset);
844out TimeSpan offset);
852bool parsed = DateTimeParse.TryParse(input, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
872out TimeSpan offset);
881bool parsed = DateTimeParse.TryParseExact(input, format, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
901out TimeSpan offset);
910bool parsed = DateTimeParse.TryParseExactMultiple(input, formats, DateTimeFormatInfo.GetInstance(formatProvider), styles, out DateTime dateResult, out TimeSpan offset);
916private static int ValidateOffset(TimeSpan offset)
918long minutes = offset.Ticks / TimeSpan.TicksPerMinute;
919if (offset.Ticks != minutes * TimeSpan.TicksPerMinute)
933private static DateTime ValidateDate(DateTime dateTime, TimeSpan offset)
979public static DateTimeOffset operator +(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
982public static DateTimeOffset operator -(DateTimeOffset dateTimeOffset, TimeSpan timeSpan) =>
985public static TimeSpan operator -(DateTimeOffset left, DateTimeOffset right) =>
1011/// Deconstructs <see cref="DateTimeOffset"/> into <see cref="DateOnly"/>, <see cref="TimeOnly"/> and <see cref="TimeSpan"/>.
1023public void Deconstruct(out DateOnly date, out TimeOnly time, out TimeSpan offset)
src\libraries\System.Private.CoreLib\src\System\Globalization\Calendar.cs (10)
31internal const long MaxMillis = (long)DateTime.DaysTo10000 * TimeSpan.MillisecondsPerDay;
134long ticks = time.Ticks + millis * TimeSpan.TicksPerMillisecond;
160return Add(time, days, (int)TimeSpan.MillisecondsPerDay);
172return Add(time, hours, (int)TimeSpan.MillisecondsPerHour);
184return Add(time, minutes, (int)TimeSpan.MillisecondsPerMinute);
216return Add(time, seconds, (int)TimeSpan.MillisecondsPerSecond);
673if ((uint)millisecond >= TimeSpan.MillisecondsPerSecond)
678SR.Format(SR.ArgumentOutOfRange_Range, 0, TimeSpan.MillisecondsPerSecond - 1));
682return totalSeconds * TimeSpan.TicksPerSecond + millisecond * TimeSpan.TicksPerMillisecond;
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (15)
429DateTime dateTime, scoped ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
487int fraction = (int)(dateTime.Ticks % TimeSpan.TicksPerSecond);
787private static unsafe void FormatCustomizedTimeZone<TChar>(DateTime dateTime, TimeSpan offset, int tokenLen, bool timeOnly, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
795if (timeOnly && dateTime.Ticks < TimeSpan.TicksPerDay)
852private static unsafe void FormatCustomizedRoundripTimeZone<TChar>(DateTime dateTime, TimeSpan offset, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
920internal static string Format(DateTime dateTime, string? format, IFormatProvider? provider, TimeSpan offset)
1032internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider, TimeSpan offset) where TChar : unmanaged, IUtfChar<TChar>
1147dateTime.Ticks < TimeSpan.TicksPerDay &&
1158private static void PrepareFormatU(ref DateTime dateTime, ref DateTimeFormatInfo dtfi, TimeSpan offset)
1442internal static unsafe bool TryFormatO<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1493int offsetTotalMinutes = (int)(offset.Ticks / TimeSpan.TicksPerMinute);
1557internal static unsafe bool TryFormatu<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1598internal static unsafe bool TryFormatR<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1663internal static unsafe bool TryFormatInvariantG<TChar>(DateTime value, TimeSpan offset, Span<TChar> destination, out int bytesWritten) where TChar : unmanaged, IUtfChar<TChar>
1699int offsetMinutes = (int)(offset.Ticks / TimeSpan.TicksPerMinute);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeParse.cs (30)
34internal static DateTime ParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
65internal static bool TryParseExact(ReadOnlySpan<char> s, ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
79offset = TimeSpan.Zero;
118DateTimeFormatInfo dtfi, DateTimeStyles style, out TimeSpan offset)
135DateTimeFormatInfo dtfi, DateTimeStyles style, out DateTime result, out TimeSpan offset)
149offset = TimeSpan.Zero;
495private static bool ParseTimeZone(ref __DTString str, scoped ref TimeSpan result)
2437internal static DateTime Parse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out TimeSpan offset)
2468internal static bool TryParse(ReadOnlySpan<char> s, DateTimeFormatInfo dtfi, DateTimeStyles styles, out DateTime result, out TimeSpan offset)
2482offset = TimeSpan.Zero;
2697if (!time.TryAddTicks((long)Math.Round(raw.fraction * TimeSpan.TicksPerSecond), out time))
2787result.timeZoneOffset = TimeSpan.Zero;
2821result.timeZoneOffset = TimeSpan.Zero;
2859result.timeZoneOffset = TimeSpan.Zero;
2866result.timeZoneOffset = TimeSpan.Zero;
2884resultTicks += TimeSpan.TicksPerDay;
2909if (resultTicks < TimeSpan.TicksPerDay)
2922resultTicks += TimeSpan.TicksPerDay;
3017result.timeZoneOffset = TimeSpan.Zero;
3058if (!time.TryAddTicks((long)Math.Round(partSecond * TimeSpan.TicksPerSecond), out time))
3229private static bool ParseTimeZoneOffset(ref __DTString str, int len, scoped ref TimeSpan result)
4287TimeSpan tempTimeZoneOffset = new TimeSpan(0);
4303if ((result.flags & ParseFlags.TimeZoneUsed) != 0 && result.timeZoneOffset != TimeSpan.Zero)
4329if ((result.flags & ParseFlags.TimeZoneUsed) != 0 && result.timeZoneOffset != TimeSpan.Zero)
4342TimeSpan tempTimeZoneOffset = new TimeSpan(0);
4422result.timeZoneOffset = TimeSpan.Zero;
4486result.timeZoneOffset = TimeSpan.Zero;
4761if (!result.parsedDate.TryAddTicks((long)Math.Round(result.fraction * TimeSpan.TicksPerSecond), out result.parsedDate))
5106if (!dateTime.TryAddTicks((long)Math.Round(fraction * TimeSpan.TicksPerSecond), out result.parsedDate))
6104internal TimeSpan timeZoneOffset;
src\libraries\System.Private.CoreLib\src\System\Globalization\HebrewCalendar.cs (4)
569return new DateTime(ToDateTime(y, i, d, 0, 0, 0, 0).Ticks + (time.Ticks % TimeSpan.TicksPerDay));
600long ticks = ToDateTime(y, m, d, 0, 0, 0, 0).Ticks + (time.Ticks % TimeSpan.TicksPerDay);
650return (int)((time.Ticks - beginOfYearDate.Ticks) / TimeSpan.TicksPerDay) + 1;
828return new DateTime(gregorianNewYear.Ticks + days * TimeSpan.TicksPerDay + TimeToTicks(hour, minute, second, millisecond));
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (13)
19internal static string Format(TimeSpan value, string? format, IFormatProvider? formatProvider)
51internal static bool TryFormat<TChar>(TimeSpan value, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? formatProvider) where TChar : unmanaged, IUtfChar<TChar>
84internal static string FormatC(TimeSpan value)
91private static string FormatG(TimeSpan value, DateTimeFormatInfo dtfi, StandardFormat format)
109internal static unsafe bool TryFormatStandard<TChar>(TimeSpan value, StandardFormat format, ReadOnlySpan<TChar> decimalSeparator, Span<TChar> destination, out int written) where TChar : unmanaged, IUtfChar<TChar>
137(totalSecondsRemaining, fraction64) = Math.DivRem((ulong)ticks, TimeSpan.TicksPerSecond);
297private static void FormatCustomized<TChar>(TimeSpan value, scoped ReadOnlySpan<char> format, DateTimeFormatInfo dtfi, ref ValueListBuilder<TChar> result) where TChar : unmanaged, IUtfChar<TChar>
301int day = (int)(value.Ticks / TimeSpan.TicksPerDay);
302long time = value.Ticks % TimeSpan.TicksPerDay;
309int hours = (int)(time / TimeSpan.TicksPerHour % 24);
310int minutes = (int)(time / TimeSpan.TicksPerMinute % 60);
311int seconds = (int)(time / TimeSpan.TicksPerSecond % 60);
312int fraction = (int)(time % TimeSpan.TicksPerSecond);
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanParse.cs (16)
495internal TimeSpan parsedTimeSpan;
607const long MaxMilliSeconds = long.MaxValue / TimeSpan.TicksPerMillisecond;
608const long MinMilliSeconds = long.MinValue / TimeSpan.TicksPerMillisecond;
617result = ticks * TimeSpan.TicksPerMillisecond + fraction._num;
627internal static TimeSpan Parse(ReadOnlySpan<char> input, IFormatProvider? formatProvider)
635internal static bool TryParse(ReadOnlySpan<char> input, IFormatProvider? formatProvider, out TimeSpan result)
649internal static TimeSpan ParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles)
657internal static bool TryParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
671internal static TimeSpan ParseExactMultiple(ReadOnlySpan<char> input, string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
679internal static bool TryParseExactMultiple(ReadOnlySpan<char> input, string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
1522if (!ParseInt((int)(0x7FFFFFFFFFFFFFFFL / TimeSpan.TicksPerDay), out int days, ref result))
1527time = days * TimeSpan.TicksPerDay;
1610time = unit * TimeSpan.TicksPerHour;
1623time += unit * TimeSpan.TicksPerMinute;
1636time += unit * TimeSpan.TicksPerSecond;
1642int f = (int)TimeSpan.TicksPerSecond;
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (25)
2639/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
2640/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
2654public bool Wait(TimeSpan timeout) => Wait(timeout, default);
2678public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
2800public Task WaitAsync(TimeSpan timeout) => WaitAsync(ValidateTimeout(timeout, ExceptionArgument.timeout), TimeProvider.System, default);
2807public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider)
2817public Task WaitAsync(TimeSpan timeout, CancellationToken cancellationToken) =>
2826public Task WaitAsync(TimeSpan timeout, TimeProvider timeProvider, CancellationToken cancellationToken)
2891_timer = timeProvider.CreateTimer(callback, this, TimeSpan.FromMilliseconds(millisecondsDelay), Timeout.InfiniteTimeSpan);
4751/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
4752/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
4771public static bool WaitAll(Task[] tasks, TimeSpan timeout)
5196/// A <see cref="TimeSpan"/> that represents the number of milliseconds to wait, or a <see
5197/// cref="TimeSpan"/> that represents -1 milliseconds to wait indefinitely.
5215public static int WaitAny(Task[] tasks, TimeSpan timeout)
5685public static Task Delay(TimeSpan delay) => Delay(delay, TimeProvider.System, default);
5688/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
5692/// <exception cref="ArgumentOutOfRangeException"><paramref name="delay"/>'s <see cref="TimeSpan.TotalMilliseconds"/> property is greater than 4294967294.</exception>
5694public static Task Delay(TimeSpan delay, TimeProvider timeProvider) => Delay(delay, timeProvider, default);
5714public static Task Delay(TimeSpan delay, CancellationToken cancellationToken) =>
5718/// <param name="delay">The <see cref="TimeSpan"/> to wait before completing the returned task, or <see cref="Timeout.InfiniteTimeSpan"/> to wait indefinitely.</param>
5723/// <exception cref="ArgumentOutOfRangeException"><paramref name="delay"/>'s <see cref="TimeSpan.TotalMilliseconds"/> property is greater than 4294967294.</exception>
5725public static Task Delay(TimeSpan delay, TimeProvider timeProvider, CancellationToken cancellationToken)
5779internal static uint ValidateTimeout(TimeSpan timeout, ExceptionArgument argument)
5816_timer = timeProvider.CreateTimer(s_timerCallback, this, TimeSpan.FromMilliseconds(millisecondsDelay), Timeout.InfiniteTimeSpan);
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (16)
491internal TimerQueueTimer(TimerCallback timerCallback, object? state, TimeSpan dueTime, TimeSpan period, bool flowExecutionContext) :
496private static uint GetMilliseconds(TimeSpan time, [CallerArgumentExpression(nameof(time))] string? parameter = null)
533"DueTime = " + (_dueTime == Timeout.UnsignedInfinite ? "(not set)" : TimeSpan.FromMilliseconds(_dueTime)) + ", " +
534"Period = " + (_period == Timeout.UnsignedInfinite ? "(not set)" : TimeSpan.FromMilliseconds(_period)) + ", " +
539public bool Change(TimeSpan dueTime, TimeSpan period) =>
763return (TimerQueue.s_tickCountToTimeMap.Time + TimeSpan.FromMilliseconds(msOffset));
770public TimeSpan? DueTime => _timer._dueTime == Timeout.UnsignedInfinite ? null : TimeSpan.FromMilliseconds(_timer._dueTime);
772public TimeSpan? Period => _timer._period == Timeout.UnsignedInfinite ? null : TimeSpan.FromMilliseconds(_timer._period);
853TimeSpan dueTime,
854TimeSpan period)
919public bool Change(TimeSpan dueTime, TimeSpan period) =>
src\libraries\System.Private.CoreLib\src\System\Threading\WaitHandle.cs (8)
79internal static int ToTimeoutMilliseconds(TimeSpan timeout)
502public virtual bool WaitOne(TimeSpan timeout) => WaitOneNoCheck(ToTimeoutMilliseconds(timeout));
505public virtual bool WaitOne(TimeSpan timeout, bool exitContext) => WaitOneNoCheck(ToTimeoutMilliseconds(timeout));
509public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout) =>
515public static bool WaitAll(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext) =>
524public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout) =>
530public static int WaitAny(WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext) =>
535public static bool SignalAndWait(WaitHandle toSignal, WaitHandle toWaitOn, TimeSpan timeout, bool exitContext) =>
src\libraries\System.Private.CoreLib\src\System\TimeSpan.cs (140)
25IComparable<TimeSpan>,
26IEquatable<TimeSpan>,
28ISpanParsable<TimeSpan>,
230public static readonly TimeSpan Zero = new TimeSpan(0);
232public static readonly TimeSpan MaxValue = new TimeSpan(MaxTicks);
233public static readonly TimeSpan MinValue = new TimeSpan(MinTicks);
255/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
268/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
276/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
290/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
317/// Gets the microseconds component of the time interval represented by the current <see cref="TimeSpan"/> structure.
326/// Gets the nanoseconds component of the time interval represented by the current <see cref="TimeSpan"/> structure.
362/// Gets the value of the current <see cref="TimeSpan"/> structure expressed in whole and fractional microseconds.
374/// Gets the value of the current <see cref="TimeSpan"/> structure expressed in whole and fractional nanoseconds.
389public TimeSpan Add(TimeSpan ts) => this + ts;
394public static int Compare(TimeSpan t1, TimeSpan t2) => t1._ticks.CompareTo(t2._ticks);
404if (value is TimeSpan other)
412public int CompareTo(TimeSpan value) => Compare(this, value);
414public static TimeSpan FromDays(double value) => Interval(value, TicksPerDay);
416public TimeSpan Duration()
425public override bool Equals([NotNullWhen(true)] object? value) => (value is TimeSpan other) && Equals(other);
427public bool Equals(TimeSpan obj) => Equals(this, obj);
429public static bool Equals(TimeSpan t1, TimeSpan t2) => t1 == t2;
434private static TimeSpan FromUnits(long units, long ticksPerUnit, long minUnits, long maxUnits)
443return TimeSpan.FromTicks(units * ticksPerUnit);
447/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
451/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of days.</returns>
453/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
455public static TimeSpan FromDays(int days) => FromUnits(days, TicksPerDay, MinDays, MaxDays);
458/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
467/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of days, hours, minutes, seconds, milliseconds, and microseconds.</returns>
469/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
471public static TimeSpan FromDays(int days, int hours = 0, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0)
484/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
488/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of hours.</returns>
490/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
492public static TimeSpan FromHours(int hours) => FromUnits(hours, TicksPerHour, MinHours, MaxHours);
495/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
503/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of hours, minutes, seconds, milliseconds, and microseconds.</returns>
505/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
507public static TimeSpan FromHours(int hours, long minutes = 0, long seconds = 0, long milliseconds = 0, long microseconds = 0)
519/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
523/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of minutes.</returns>
525/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
527public static TimeSpan FromMinutes(long minutes) => FromUnits(minutes, TicksPerMinute, MinMinutes, MaxMinutes);
530/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
537/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of minutes, seconds, milliseconds, and microseconds.</returns>
539/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
541public static TimeSpan FromMinutes(long minutes, long seconds = 0, long milliseconds = 0, long microseconds = 0)
552/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
556/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of seconds.</returns>
558/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
560public static TimeSpan FromSeconds(long seconds) => FromUnits(seconds, TicksPerSecond, MinSeconds, MaxSeconds);
563/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
569/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of seconds, milliseconds, and microseconds.</returns>
571/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
573public static TimeSpan FromSeconds(long seconds, long milliseconds = 0, long microseconds = 0)
583/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
587/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of milliseconds.</returns>
589/// The parameter specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
591public static TimeSpan FromMilliseconds(long milliseconds)
595/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
600/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of milliseconds, and microseconds.</returns>
602/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
604public static TimeSpan FromMilliseconds(long milliseconds, long microseconds)
613private static TimeSpan FromMicroseconds(Int128 microseconds)
620return TimeSpan.FromTicks(ticks);
624/// Initializes a new instance of the <see cref="TimeSpan"/> structure to a specified number of
628/// <returns>Returns a <see cref="TimeSpan"/> that represents a specified number of microseconds.</returns>
630/// The parameters specify a <see cref="TimeSpan"/> value less than <see cref="MinValue"/> or greater than <see cref="MaxValue"/>
632public static TimeSpan FromMicroseconds(long microseconds) => FromUnits(microseconds, TicksPerMicrosecond, MinMicroseconds, MaxMicroseconds);
634public static TimeSpan FromHours(double value) => Interval(value, TicksPerHour);
636private static TimeSpan Interval(double value, double scale)
645private static TimeSpan IntervalFromDoubleTicks(double ticks)
658public static TimeSpan FromMilliseconds(double value) => Interval(value, TicksPerMillisecond);
661/// Returns a <see cref="TimeSpan"/> that represents a specified number of microseconds.
679public static TimeSpan FromMicroseconds(double value) => Interval(value, TicksPerMicrosecond);
681public static TimeSpan FromMinutes(double value) => Interval(value, TicksPerMinute);
683public TimeSpan Negate() => -this;
685public static TimeSpan FromSeconds(double value) => Interval(value, TicksPerSecond);
687public TimeSpan Subtract(TimeSpan ts) => this - ts;
689public TimeSpan Multiply(double factor) => this * factor;
691public TimeSpan Divide(double divisor) => this / divisor;
693public double Divide(TimeSpan ts) => this / ts;
695public static TimeSpan FromTicks(long value) => new TimeSpan(value);
722public static TimeSpan Parse(string s)
728public static TimeSpan Parse(string input, IFormatProvider? formatProvider)
736public static TimeSpan Parse(ReadOnlySpan<char> input, IFormatProvider? formatProvider = null) => TimeSpanParse.Parse(input, formatProvider);
737public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string format, IFormatProvider? formatProvider)
743public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider)
751public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string format, IFormatProvider? formatProvider, TimeSpanStyles styles)
759public static TimeSpan ParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles = TimeSpanStyles.None)
764public static TimeSpan ParseExact(string input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles)
770public static TimeSpan ParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string[] formats, IFormatProvider? formatProvider, TimeSpanStyles styles = TimeSpanStyles.None)
775public static bool TryParse([NotNullWhen(true)] string? s, out TimeSpan result)
784public static bool TryParse(ReadOnlySpan<char> s, out TimeSpan result) => TimeSpanParse.TryParse(s, null, out result);
786public static bool TryParse([NotNullWhen(true)] string? input, IFormatProvider? formatProvider, out TimeSpan result)
795public static bool TryParse(ReadOnlySpan<char> input, IFormatProvider? formatProvider, out TimeSpan result) => TimeSpanParse.TryParse(input, formatProvider, out result);
796public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string? format, IFormatProvider? formatProvider, out TimeSpan result)
806public static bool TryParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, out TimeSpan result)
809public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
818public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, out TimeSpan result)
821public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string? format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
833public static bool TryParseExact(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] ReadOnlySpan<char> format, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
838public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
850public static bool TryParseExact(ReadOnlySpan<char> input, [NotNullWhen(true), StringSyntax(StringSyntaxAttribute.TimeSpanFormat)] string?[]? formats, IFormatProvider? formatProvider, TimeSpanStyles styles, out TimeSpan result)
868public static TimeSpan operator -(TimeSpan t)
877public static TimeSpan operator -(TimeSpan t1, TimeSpan t2)
891public static TimeSpan operator +(TimeSpan t) => t;
893public static TimeSpan operator +(TimeSpan t1, TimeSpan t2)
908public static TimeSpan operator *(TimeSpan timeSpan, double factor)
922public static TimeSpan operator *(double factor, TimeSpan timeSpan) => timeSpan * factor;
925public static TimeSpan operator /(TimeSpan timeSpan, double divisor)
941public static double operator /(TimeSpan t1, TimeSpan t2) => t1.Ticks / (double)t2.Ticks;
944public static bool operator ==(TimeSpan t1, TimeSpan t2) => t1._ticks == t2._ticks;
947public static bool operator !=(TimeSpan t1, TimeSpan t2) => t1._ticks != t2._ticks;
950public static bool operator <(TimeSpan t1, TimeSpan t2) => t1._ticks < t2._ticks;
953public static bool operator <=(TimeSpan t1, TimeSpan t2) => t1._ticks <= t2._ticks;
956public static bool operator >(TimeSpan t1, TimeSpan t2) => t1._ticks > t2._ticks;
959public static bool operator >=(TimeSpan t1, TimeSpan t2) => t1._ticks >= t2._ticks;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.AdjustmentRule.cs (29)
14private static readonly TimeSpan DaylightDeltaAdjustment = TimeSpan.FromHours(24.0);
15private static readonly TimeSpan MaxDaylightDelta = TimeSpan.FromHours(12.0);
18private readonly TimeSpan _daylightDelta;
21private readonly TimeSpan _baseUtcOffsetDelta; // delta from the default Utc offset (utcOffset = defaultUtcOffset + _baseUtcOffsetDelta)
28public TimeSpan DaylightDelta => _daylightDelta;
37public TimeSpan BaseUtcOffsetDelta => _baseUtcOffsetDelta;
46DaylightDelta != TimeSpan.Zero ||
70TimeSpan daylightDelta,
73TimeSpan baseUtcOffsetDelta,
101TimeSpan daylightDelta,
104TimeSpan baseUtcOffsetDelta)
119TimeSpan daylightDelta,
129baseUtcOffsetDelta: TimeSpan.Zero,
136TimeSpan daylightDelta,
139TimeSpan baseUtcOffsetDelta,
160DaylightTransitionStart.TimeOfDay.TimeOfDay.Ticks < TimeSpan.TicksPerSecond; // < 12:00:01 AM
169DaylightTransitionEnd.TimeOfDay.TimeOfDay.Ticks < TimeSpan.TicksPerSecond; // < 12:00:01 AM
177TimeSpan daylightDelta,
211if (daylightDelta.Ticks % TimeSpan.TicksPerMinute != 0)
216if (dateStart != DateTime.MinValue && dateStart.Kind == DateTimeKind.Unspecified && dateStart.TimeOfDay != TimeSpan.Zero)
221if (dateEnd != DateTime.MaxValue && dateEnd.Kind == DateTimeKind.Unspecified && dateEnd.TimeOfDay != TimeSpan.Zero)
230private static void AdjustDaylightDeltaToExpectedRange(ref TimeSpan daylightDelta, ref TimeSpan baseUtcOffsetDelta)
282_daylightDelta = (TimeSpan)info.GetValue("DaylightDelta", typeof(TimeSpan))!; // Do not rename (binary serialization)
286object? o = info.GetValueNoThrow("BaseUtcOffsetDelta", typeof(TimeSpan)); // Do not rename (binary serialization)
289_baseUtcOffsetDelta = (TimeSpan)o;
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.cs (73)
50private readonly TimeSpan _baseUtcOffset;
186public TimeSpan BaseUtcOffset => _baseUtcOffset;
194public TimeSpan[] GetAmbiguousTimeOffsets(DateTimeOffset dateTimeOffset)
217TimeSpan[] timeSpans = new TimeSpan[2];
219TimeSpan actualUtcOffset = _baseUtcOffset + rule!.BaseUtcOffsetDelta;
222if (rule.DaylightDelta > TimeSpan.Zero)
239public TimeSpan[] GetAmbiguousTimeOffsets(DateTime dateTime)
276TimeSpan[] timeSpans = new TimeSpan[2];
277TimeSpan actualUtcOffset = _baseUtcOffset + rule!.BaseUtcOffsetDelta;
280if (rule.DaylightDelta > TimeSpan.Zero)
342public TimeSpan GetUtcOffset(DateTimeOffset dateTimeOffset) =>
348public TimeSpan GetUtcOffset(DateTime dateTime) =>
352internal static TimeSpan GetLocalUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags)
361internal TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags) =>
364private TimeSpan GetUtcOffset(DateTime dateTime, TimeZoneInfoOptions flags, CachedData cachedData)
711TimeSpan destinationOffset = GetUtcOffsetFromUtc(utcDateTime, destinationTimeZone);
771TimeSpan sourceOffset = sourceTimeZone.BaseUtcOffset;
789sourceOffset += (sourceIsDaylightSavings ? sourceRule.DaylightDelta : TimeSpan.Zero /*FUTURE: sourceRule.StandardDelta*/);
1002TimeSpan baseUtcOffset,
1028TimeSpan baseUtcOffset,
1052TimeSpan baseUtcOffset,
1073TimeSpan baseUtcOffset,
1165_baseUtcOffset = (TimeSpan)info.GetValue("BaseUtcOffset", typeof(TimeSpan))!; // Do not rename (binary serialization)
1278private DateTime ConvertToUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1284private DateTime ConvertFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta) =>
1290private DateTime ConvertToFromUtc(DateTime dateTime, TimeSpan daylightDelta, TimeSpan baseUtcOffsetDelta, bool convertToUtc)
1292TimeSpan offset = BaseUtcOffset + daylightDelta + baseUtcOffsetDelta;
1320TimeSpan offset = GetUtcOffsetFromUtc(utcConverted, destinationTimeZone, out isAmbiguousLocalDst);
1334TimeSpan delta = rule.DaylightDelta;
1402bool invalidAtStart = rule.DaylightDelta > TimeSpan.Zero;
1406daylightTime.Start + (invalidAtStart ? rule.DaylightDelta : TimeSpan.Zero); /* FUTURE: - rule.StandardDelta; */
1410daylightTime.End + (invalidAtStart ? -rule.DaylightDelta : TimeSpan.Zero);
1434private TimeSpan GetDaylightSavingsStartOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule, int? ruleIndex)
1451private static TimeSpan GetDaylightSavingsEndOffsetFromUtc(TimeSpan baseUtcOffset, AdjustmentRule rule)
1461private static bool GetIsDaylightSavingsFromUtc(DateTime time, int year, TimeSpan utc, AdjustmentRule rule, int? ruleIndex, out bool isAmbiguousLocalDst, TimeZoneInfo zone)
1485TimeSpan dstStartOffset = zone.GetDaylightSavingsStartOffsetFromUtc(utc, rule, ruleIndex);
1503TimeSpan dstEndOffset = GetDaylightSavingsEndOffsetFromUtc(utc, rule);
1575private static bool TryGetEndOfDstIfYearStartWithDst(int nextYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstEnd)
1625private static bool TryGetStartOfDstIfYearEndWithDst(int previousYear, TimeSpan utc, TimeZoneInfo zone, out DateTime dstStart)
1703if (rule == null || rule.DaylightDelta == TimeSpan.Zero)
1712if (rule.DaylightDelta > TimeSpan.Zero)
1773if (rule == null || rule.DaylightDelta == TimeSpan.Zero)
1782if (rule.DaylightDelta < TimeSpan.Zero)
1836private static TimeSpan GetUtcOffset(DateTime time, TimeZoneInfo zone)
1838TimeSpan baseOffset = zone.BaseUtcOffset;
1848baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
1859private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone) =>
1866private static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings) =>
1873internal static TimeSpan GetUtcOffsetFromUtc(DateTime time, TimeZoneInfo zone, out bool isDaylightSavings, out bool isAmbiguousLocalDst)
1877TimeSpan baseOffset = zone.BaseUtcOffset;
1912baseOffset += (isDaylightSavings ? rule.DaylightDelta : TimeSpan.Zero /* FUTURE: rule.StandardDelta */);
1925TimeSpan timeOfDay = transitionTime.TimeOfDay.TimeOfDay;
2157private static void ValidateTimeZoneInfo(string id, TimeSpan baseUtcOffset, AdjustmentRule[]? adjustmentRules, out bool adjustmentRulesSupportDst)
2166if (baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0)
2207private static TimeSpan MaxOffset => TimeSpan.FromHours(14);
2208private static TimeSpan MinOffset => TimeSpan.FromHours(-14);
2213internal static bool UtcOffsetOutOfRange(TimeSpan offset) =>
2216private static TimeSpan GetUtcOffset(TimeSpan baseUtcOffset, AdjustmentRule adjustmentRule)
2220+ (adjustmentRule.HasDaylightSaving ? adjustmentRule.DaylightDelta : TimeSpan.Zero);
2226private static bool IsValidAdjustmentRuleOffset(TimeSpan baseUtcOffset, AdjustmentRule adjustmentRule)
2228TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
2237return CreateCustomTimeZone(UtcId, TimeSpan.Zero, displayName, standardDisplayName);
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.cs (48)
64_baseUtcOffset = TimeSpan.Zero;
116if (_baseUtcOffset.Ticks % TimeSpan.TicksPerMinute != 0)
139private static DateTime GetTimeOnlyInMillisecondsPrecision(DateTime input) => new DateTime((input.TimeOfDay.Ticks / TimeSpan.TicksPerMillisecond) * TimeSpan.TicksPerMillisecond);
163rule.DaylightDelta == TimeSpan.Zero && rule.BaseUtcOffsetDelta == TimeSpan.Zero)
238string? displayName = string.Create(null, stackalloc char[256], $"(UTC{(_baseUtcOffset >= TimeSpan.Zero ? '+' : '-')}{_baseUtcOffset:hh\\:mm}) {_id}");
358internal static TimeSpan GetDateTimeNowUtcOffsetFromUtc(DateTime time, out bool isAmbiguousLocalDst)
493private static void TZif_GenerateAdjustmentRules(out AdjustmentRule[]? rules, TimeSpan baseUtcOffset, DateTime[] dts, byte[] typeOfLocalTime,
516private static void TZif_GenerateAdjustmentRule(ref int index, TimeSpan timeZoneBaseUtcOffset, List<AdjustmentRule> rulesList, DateTime[] dts,
546TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(transitionType.UtcOffset, timeZoneBaseUtcOffset);
547TimeSpan daylightDelta = transitionType.IsDst ? transitionOffset : TimeSpan.Zero;
548TimeSpan baseUtcDelta = transitionType.IsDst ? TimeSpan.Zero : transitionOffset;
573TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(startTransitionType.UtcOffset, timeZoneBaseUtcOffset);
574TimeSpan daylightDelta = startTransitionType.IsDst ? transitionOffset : TimeSpan.Zero;
575TimeSpan baseUtcDelta = startTransitionType.IsDst ? TimeSpan.Zero : transitionOffset;
625TimeSpan transitionOffset = TZif_CalculateTransitionOffsetFromBase(transitionType.UtcOffset, timeZoneBaseUtcOffset);
626TimeSpan daylightDelta = transitionType.IsDst ? transitionOffset : TimeSpan.Zero;
627TimeSpan baseUtcDelta = transitionType.IsDst ? TimeSpan.Zero : transitionOffset;
650private static TimeSpan TZif_CalculateTransitionOffsetFromBase(TimeSpan transitionOffset, TimeSpan timeZoneBaseUtcOffset)
652TimeSpan result = transitionOffset - timeZoneBaseUtcOffset;
656if (result.Ticks % TimeSpan.TicksPerMinute != 0)
699private static AdjustmentRule? TZif_CreateAdjustmentRuleForPosixFormat(string posixFormat, DateTime startTransitionDate, TimeSpan timeZoneBaseUtcOffset)
713TimeSpan? parsedBaseOffset = TZif_ParseOffsetString(standardOffset);
716TimeSpan baseOffset = parsedBaseOffset.GetValueOrDefault().Negate(); // offsets are backwards in POSIX notation
722TimeSpan? parsedDaylightSavings = TZif_ParseOffsetString(daylightSavingsOffset);
723TimeSpan daylightSavingsTimeSpan;
759TimeSpan.Zero,
771private static TimeSpan? TZif_ParseOffsetString(ReadOnlySpan<char> offset)
773TimeSpan? result = null;
793TimeSpan parsedTimeSpan;
794if (TimeSpan.TryParseExact(offset, "g", CultureInfo.InvariantCulture, out parsedTimeSpan))
812TimeSpan? timeOffset = TZif_ParseOffsetString(time);
820if (timeOffset.GetValueOrDefault() < TimeSpan.Zero)
1245private static void NormalizeAdjustmentRuleOffset(TimeSpan baseUtcOffset, [NotNull] ref AdjustmentRule adjustmentRule)
1265TimeSpan utcOffset = GetUtcOffset(baseUtcOffset, adjustmentRule);
1268TimeSpan adjustment = TimeSpan.Zero;
1279if (adjustment != TimeSpan.Zero)
1296public readonly TimeSpan UtcOffset;
System.Private.DataContractSerialization (78)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (5)
301public override void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
351public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
1013public override void WriteValue(TimeSpan value)
1426else if (value is TimeSpan)
1428WriteValue((TimeSpan)value);
System\Xml\ArrayHelper.cs (6)
371internal sealed class TimeSpanArrayHelperWithString : ArrayHelper<string, TimeSpan>
375protected override int ReadArray(XmlDictionaryReader reader, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
380protected override void WriteArray(XmlDictionaryWriter writer, string prefix, string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
386internal sealed class TimeSpanArrayHelperWithDictionaryString : ArrayHelper<XmlDictionaryString, TimeSpan>
390protected override int ReadArray(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
395protected override void WriteArray(XmlDictionaryWriter writer, string prefix, XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlBinaryReader.cs (7)
250public override TimeSpan ReadElementContentAsTimeSpan()
257TimeSpan value = BufferReader.ReadTimeSpan();
1193type = typeof(TimeSpan);
1464private int ReadArray(TimeSpan[] array, int offset, int count)
1470foreach (ref TimeSpan item in array.AsSpan(offset, actual))
1478public override int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1485public override int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryAsyncCheckWriter.cs (3)
535public override void WriteValue(TimeSpan value)
676public override void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
682public override void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryReader.cs (7)
669public virtual TimeSpan ReadContentAsTimeSpan()
921public virtual TimeSpan ReadElementContentAsTimeSpan()
924TimeSpan value;
1285public virtual TimeSpan[] ReadTimeSpanArray(string localName, string namespaceUri)
1290public virtual TimeSpan[] ReadTimeSpanArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri)
1295public virtual int ReadArray(string localName, string namespaceUri, TimeSpan[] array, int offset, int count)
1307public virtual int ReadArray(XmlDictionaryString localName, XmlDictionaryString namespaceUri, TimeSpan[] array, int offset, int count)
System\Xml\XmlDictionaryWriter.cs (5)
186public virtual void WriteValue(TimeSpan value)
310else if (type == typeof(TimeSpan))
339else if (type == typeof(TimeSpan))
602public virtual void WriteArray(string? prefix, string localName, string? namespaceUri, TimeSpan[] array, int offset, int count)
613public virtual void WriteArray(string? prefix, XmlDictionaryString localName, XmlDictionaryString? namespaceUri, TimeSpan[] array, int offset, int count)
System.Private.Windows.Core (32)
System.Private.Windows.Core.Tests (15)
System\Private\Windows\Ole\BinaryFormatUtilitiesTests.cs (15)
48TimeSpan.FromHours(1),
81new List<TimeSpan> { TimeSpan.MinValue, TimeSpan.MaxValue },
101new TimeSpan[] { TimeSpan.MinValue, TimeSpan.MaxValue },
123(ArrayList)([TimeSpan.MinValue, TimeSpan.MaxValue]),
143new Hashtable { { "TimeSpan", TimeSpan.FromHours(1) } },
749("System.Collections.Generic.List`1[[System.TimeSpan, System.Private.CoreLib, Version=10.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", typeof(List<TimeSpan>))
999public TimeSpan[] TimeSpanArray = [TimeSpan.FromHours(1)];
1025public List<TimeSpan> TimeSpans = [TimeSpan.FromHours(1)];
System.Private.Xml (102)
System\Xml\Schema\FacetChecker.cs (17)
822internal virtual Exception? CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1200TimeSpan timeSpanValue = (TimeSpan)datatype.ValueConverter.ChangeType(value, typeof(TimeSpan));
1204internal override Exception? CheckValueFacets(TimeSpan value, XmlSchemaDatatype datatype)
1211if (TimeSpan.Compare(value, (TimeSpan)restriction!.MaxInclusive!) > 0)
1219if (TimeSpan.Compare(value, (TimeSpan)restriction!.MaxExclusive!) >= 0)
1227if (TimeSpan.Compare(value, (TimeSpan)restriction!.MinInclusive!) < 0)
1235if (TimeSpan.Compare(value, (TimeSpan)restriction!.MinExclusive!) <= 0)
1251return MatchEnumeration((TimeSpan)value, enumeration);
1254private static bool MatchEnumeration(TimeSpan value, ArrayList enumeration)
1258if (TimeSpan.Compare(value, (TimeSpan)enumeration[i]!) == 0)
System.Private.Xml.Linq (19)
System.Resources.Extensions (7)
System.Resources.Writer (2)
System.Runtime (1)
System.Runtime.Caching (36)
System.Runtime.Serialization.Formatters (1)
System.Security.Cryptography (43)
System.ServiceModel.Federation (83)
System\IdentityModel\Security\WrapperSecurityCommunicationObject.cs (28)
35protected override TimeSpan DefaultCloseTimeout
40protected override TimeSpan DefaultOpenTimeout
50protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
55protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
60protected override void OnClose(TimeSpan timeout)
93protected override void OnOpen(TimeSpan timeout)
110internal Task OnCloseAsync(TimeSpan timeout)
115internal Task OnOpenAsync(TimeSpan timeout)
208public virtual TimeSpan DefaultOpenTimeout
213public virtual TimeSpan DefaultCloseTimeout
229public void Close(TimeSpan timeout)
239public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
254public void Open(TimeSpan timeout)
264public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
284public virtual Task OnCloseAsync(TimeSpan timeout)
302public virtual Task OnOpenAsync(TimeSpan timeout)
360public virtual TimeSpan DefaultOpenTimeout
365public virtual TimeSpan DefaultCloseTimeout
381public void Close(TimeSpan timeout)
391public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
406public void Open(TimeSpan timeout)
416public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
436public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
441public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
446public virtual void OnClose(TimeSpan timeout)
450public Task OnCloseAsync(TimeSpan timeout)
478public virtual void OnOpen(TimeSpan timeout)
482public Task OnOpenAsync(TimeSpan timeout)
System.ServiceModel.Http (101)
System\ServiceModel\Channels\HttpChannelFactory.cs (17)
247SecurityTokenContainer clientCertificateToken, TimeSpan timeout)
444private async Task<SecurityTokenProviderContainer> CreateAndOpenTokenProviderAsync(TimeSpan timeout, AuthenticationSchemes authenticationScheme,
574protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
584protected override void OnOpen(TimeSpan timeout)
598internal protected override Task OnOpenAsync(TimeSpan timeout)
604protected internal override Task OnCloseAsync(TimeSpan timeout)
742private async Task<(SecurityTokenProviderContainer tokenProvider, SecurityTokenProviderContainer proxyTokenProvider)> CreateAndOpenTokenProvidersCoreAsync(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout)
759internal Task<(SecurityTokenProviderContainer tokenProvider, SecurityTokenProviderContainer proxyTokenProvider)> CreateAndOpenTokenProvidersAsync(EndpointAddress to, Uri via, ChannelParameterCollection channelParameters, TimeSpan timeout)
827private async Task CreateAndOpenTokenProvidersAsync(TimeSpan timeout)
836private void CloseTokenProviders(TimeSpan timeout)
853protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
863protected override void OnOpen(TimeSpan timeout)
868internal protected override Task OnOpenAsync(TimeSpan timeout)
885protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
895protected override void OnClose(TimeSpan timeout)
900protected internal override async Task OnCloseAsync(TimeSpan timeout)
1383public async Task<IWebProxy> CreateWebProxyAsync(AuthenticationLevel requestAuthenticationLevel, TokenImpersonationLevel requestImpersonationLevel, SecurityTokenProviderContainer tokenProvider, TimeSpan timeout)
System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (30)
62public Message Receive(TimeSpan timeout)
72public async Task<Message> ReceiveAsync(TimeSpan timeout)
108public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
118public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
143public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
161public bool TryReceive(TimeSpan timeout, out Message message)
179public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
203public bool WaitForMessage(TimeSpan timeout)
208public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
223protected abstract Task CloseOutputSessionCoreAsync(TimeSpan timeout);
225protected abstract void CloseOutputSessionCore(TimeSpan timeout);
227protected async Task CloseOutputSessionAsync(TimeSpan timeout)
282protected void CloseOutputSession(TimeSpan timeout)
338protected abstract void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout);
342ReturnConnectionIfNecessary(true, TimeSpan.Zero);
348ReturnConnectionIfNecessary(true, TimeSpan.Zero);
351protected internal override async Task OnCloseAsync(TimeSpan timeout)
366protected override void OnClose(TimeSpan timeout)
371protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
431protected abstract AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state);
433protected abstract AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state);
441protected abstract void OnSendCore(Message message, TimeSpan timeout);
443protected abstract AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state);
445protected override async Task OnSendAsync(Message message, TimeSpan timeout)
550protected override void OnSend(Message message, TimeSpan timeout)
601protected abstract void CompleteClose(TimeSpan timeout);
612private async Task EnsureInputClosedAsync(TimeSpan timeout)
706public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
721public void CloseOutputSession(TimeSpan timeout)
731public Task CloseOutputSessionAsync(TimeSpan timeout)
System\ServiceModel\Channels\WebSocketHelper.cs (6)
119internal static void ThrowCorrectException(Exception ex, TimeSpan timeout, string operation)
128TimeSpan.MinValue, // this is a dummy since operation type is null, so the timespan value won't be used
134internal static Exception ConvertAndTraceException(Exception ex, TimeSpan timeout, string operation)
188internal static void ThrowExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
201internal static Exception CreateExceptionOnTaskFailure(Task task, TimeSpan timeout, string operation)
214internal static TimeoutException GetTimeoutException(Exception innerException, TimeSpan timeout, string operation)
System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (23)
72protected override void CompleteClose(TimeSpan timeout)
91protected override void CloseOutputSessionCore(TimeSpan timeout)
105protected override async Task CloseOutputSessionCoreAsync(TimeSpan timeout)
137protected override void OnClose(TimeSpan timeout)
149protected internal override async Task OnCloseAsync(TimeSpan timeout)
161protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
165protected override AsyncCompletionResult StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout, Action<object> callback, object state)
205protected override AsyncCompletionResult StartWritingStreamedMessage(Message message, TimeSpan timeout, Action<object> callback, object state)
227protected override AsyncCompletionResult BeginCloseOutput(TimeSpan timeout, Action<object> callback, object state)
245protected override void OnSendCore(Message message, TimeSpan timeout)
380private async void HandleCloseOutputAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
396private async void HandleSendAsyncCompletion(Task task, TimeSpan timeout, Action<object> callback, object state)
458private TimeSpan _asyncReceiveTimeout;
500public async Task<Message> ReceiveAsync(TimeSpan timeout)
522public Message Receive(TimeSpan timeout)
527private async Task<Message> ReceiveAsyncInternal(TimeSpan timeout)
586WebSocketHelper.ThrowCorrectException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
616_pendingException = WebSocketHelper.ConvertAndTraceException(ex, TimeSpan.MaxValue, WebSocketHelper.ReceiveOperation);
627public bool WaitForMessage(TimeSpan timeout)
646public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
862private readonly TimeSpan _closeTimeout;
882TimeSpan closeTimeout)
898TimeSpan closeTimeout)
System.ServiceModel.Http.Tests (64)
ServiceModel\BasicHttpBindingTest.cs (36)
29Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
30Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
31Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
32Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
54Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
55Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
56Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
57Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
78Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
79Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
80Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
81Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
222public static void CloseTimeout_Property_Sets(TimeSpan timeSpan)
226Assert.Equal<TimeSpan>(timeSpan, binding.CloseTimeout);
231public static void CloseTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
239public static void OpenTimeout_Property_Sets(TimeSpan timeSpan)
243Assert.Equal<TimeSpan>(timeSpan, binding.OpenTimeout);
248public static void OpenTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
256public static void SendTimeout_Property_Sets(TimeSpan timeSpan)
260Assert.Equal<TimeSpan>(timeSpan, binding.SendTimeout);
265public static void SendTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
273public static void ReceiveTimeout_Property_Sets(TimeSpan timeSpan)
277Assert.Equal<TimeSpan>(timeSpan, binding.ReceiveTimeout);
282public static void ReceiveTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
ServiceModel\BasicHttpsBindingTest.cs (28)
27Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
28Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
29Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
30Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
52Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.CloseTimeout);
53Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.OpenTimeout);
54Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(10), binding.ReceiveTimeout);
55Assert.Equal<TimeSpan>(TimeSpan.FromMinutes(1), binding.SendTimeout);
212public static void CloseTimeout_Property_Sets(TimeSpan timeSpan)
216Assert.Equal<TimeSpan>(timeSpan, binding.CloseTimeout);
221public static void CloseTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
229public static void OpenTimeout_Property_Sets(TimeSpan timeSpan)
233Assert.Equal<TimeSpan>(timeSpan, binding.OpenTimeout);
238public static void OpenTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
246public static void SendTimeout_Property_Sets(TimeSpan timeSpan)
250Assert.Equal<TimeSpan>(timeSpan, binding.SendTimeout);
255public static void SendTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
263public static void ReceiveTimeout_Property_Sets(TimeSpan timeSpan)
267Assert.Equal<TimeSpan>(timeSpan, binding.ReceiveTimeout);
272public static void ReceiveTimeout_Property_Set_Invalid_Value_Throws(TimeSpan timeSpan)
System.ServiceModel.NetFramingBase (211)
System\ServiceModel\Channels\Connection.cs (18)
17ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout);
18ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout);
20ValueTask CloseAsync(TimeSpan timeout);
25ValueTask<IConnection> ConnectAsync(Uri uri, TimeSpan timeout);
38public virtual ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout) => Connection.ReadAsync(buffer, timeout);
39public virtual ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout) => Connection.WriteAsync(buffer, immediate, timeout);
40public virtual ValueTask CloseAsync(TimeSpan timeout) => Connection.CloseAsync(timeout);
68public override ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
118public TimeSpan CloseTimeout { get; set; }
263protected int Read(byte[] buffer, int offset, int count, TimeSpan timeout)
292public async ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
305public async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout)
320public async ValueTask CloseAsync(TimeSpan timeout)
364public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout)
378public void Write(byte[] buffer, int offset, int size, bool immediate, TimeSpan timeout, BufferManager bufferManager)
384private void SetReadTimeout(TimeSpan timeout)
394private void SetWriteTimeout(TimeSpan timeout)
404public int Read(byte[] buffer, int offset, int size, TimeSpan timeout)
System\ServiceModel\Channels\ConnectionPool.cs (16)
43protected abstract ValueTask CloseItemAsync(TItem item, TimeSpan timeout);
52public async ValueTask<bool> CloseAsync(TimeSpan timeout)
117private EndpointConnectionPool GetEndpointPool(TKey key, TimeSpan timeout)
170private async ValueTask OnCloseAsync(TimeSpan timeout)
194public void AddConnection(TKey key, TItem connection, TimeSpan timeout)
201public TItem TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, out TKey key)
209public void ReturnConnection(TKey key, TItem connection, bool connectionIsStillGood, TimeSpan timeout)
288protected virtual ValueTask CloseItemAsync(TItem item, TimeSpan timeout)
315public async ValueTask CloseAsync(TimeSpan timeout)
389public void AddConnection(TItem connection, TimeSpan timeout)
422public TItem TakeConnection(TimeSpan timeout)
478public void ReturnConnection(TItem connection, bool connectionIsStillGood, TimeSpan timeout)
516public void CloseIdleConnection(TItem connection, TimeSpan timeout)
609private readonly TimeSpan _maxOutputDelay;
614public ConnectionPool(IConnectionOrientedTransportChannelFactorySettings settings, TimeSpan leaseTimeout)
635protected override async ValueTask CloseItemAsync(IConnection item, TimeSpan timeout)
System\ServiceModel\Channels\FramingChannels.cs (14)
42protected override ValueTask CloseOutputSessionCoreAsync(TimeSpan timeout)
47protected override void CompleteClose(TimeSpan timeout)
52protected override async ValueTask OnSendCoreAsync(Message message, TimeSpan timeout)
65protected override ValueTask CloseOutputAsync(TimeSpan timeout)
70protected override ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout)
75protected override ValueTask StartWritingStreamedMessage(Message message, TimeSpan timeout)
187protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
209private async Task<IConnection> SendPreambleAsync(IConnection connection, Memory<byte> preamble, TimeSpan timeout)
268internal protected override async Task OnOpenAsync(TimeSpan timeout)
299protected override void OnOpen(TimeSpan timeout)
304protected override void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout)
358protected override TimeoutException CreateNewConnectionTimeoutException(TimeSpan timeout, TimeoutException innerException)
375Uri via, string contentType, TimeSpan timeout)
419ClientFramingDecoder decoder, IDefaultCommunicationTimeouts defaultTimeouts, TimeSpan timeout)
System\ServiceModel\Channels\TransportDuplexSessionChannel.cs (28)
65public Message Receive(TimeSpan timeout)
75public async Task<Message> ReceiveAsync(TimeSpan timeout)
111public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
121public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
145public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
163public bool TryReceive(TimeSpan timeout, out Message message)
181public async Task<bool> WaitForMessageAsync(TimeSpan timeout)
205public bool WaitForMessage(TimeSpan timeout)
210public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
231protected abstract ValueTask CloseOutputSessionCoreAsync(TimeSpan timeout);
233protected async Task CloseOutputSessionAsync(TimeSpan timeout)
289protected abstract void ReturnConnectionIfNecessary(bool abort, TimeSpan timeout);
293ReturnConnectionIfNecessary(true, TimeSpan.Zero);
299ReturnConnectionIfNecessary(true, TimeSpan.Zero);
302protected internal override async Task OnCloseAsync(TimeSpan timeout)
317protected override void OnClose(TimeSpan timeout)
322protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
382protected abstract ValueTask StartWritingBufferedMessage(Message message, ArraySegment<byte> messageData, bool allowOutputBatching, TimeSpan timeout);
384protected abstract ValueTask CloseOutputAsync(TimeSpan timeout);
388protected abstract ValueTask OnSendCoreAsync(Message message, TimeSpan timeout);
390protected abstract ValueTask StartWritingStreamedMessage(Message message, TimeSpan timeout);
392protected override async Task OnSendAsync(Message message, TimeSpan timeout)
468protected override void OnSend(Message message, TimeSpan timeout)
519protected abstract void CompleteClose(TimeSpan timeout);
530private async Task EnsureInputClosedAsync(TimeSpan timeout)
624public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
639public void CloseOutputSession(TimeSpan timeout)
649public Task CloseOutputSessionAsync(TimeSpan timeout)
System.ServiceModel.NetNamedPipe (56)
System.ServiceModel.NetTcp (65)
System\ServiceModel\Channels\SocketConnection.cs (31)
22private TimeSpan _asyncSendTimeout;
23private TimeSpan _readFinTimeout;
24private TimeSpan _asyncReceiveTimeout;
174public ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
185private async ValueTask<int> ReadCoreAsync(Memory<byte> buffer, TimeSpan timeout, bool closing)
257public async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout)
333public async ValueTask CloseAsync(TimeSpan timeout)
394private void Shutdown(TimeSpan timeout)
413ConvertSendException(socketException, TimeSpan.MaxValue, _asyncSendTimeout));
529private void SetReadTimeout(TimeSpan timeout, bool closing)
531if (timeout <= TimeSpan.Zero)
538if (timeout == TimeSpan.MaxValue)
580private void SetWriteTimeout(TimeSpan timeout)
582if (timeout <= TimeSpan.Zero)
589if (timeout == TimeSpan.MaxValue)
623private bool ShouldUpdateTimeout(DateTime oldTimeoutDeadline, TimeSpan newTimeout)
625var oldTimeout = oldTimeoutDeadline - DateTime.UtcNow;
626if (oldTimeout < TimeSpan.Zero) // Expired already
669private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
675private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
681private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException,
683SocketConnection socketConnection, TimeSpan remainingTime)
697remainingTime <= TimeSpan.Zero)
825public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException)
840if (timeSpent == TimeSpan.MaxValue)
861if (timeSpent == TimeSpan.MaxValue)
914private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, IPAddress[] addresses, int invalidAddressCount,
937public async ValueTask<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
953if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
System.ServiceModel.NetTcp.Tests (6)
System.ServiceModel.Primitives (1143)
Internals\System\Runtime\InputQueue.cs (16)
71public IAsyncResult BeginDequeue(TimeSpan timeout, AsyncCallback callback, object state)
109public IAsyncResult BeginWaitForItem(TimeSpan timeout, AsyncCallback callback, object state)
141public T Dequeue(TimeSpan timeout)
153public async Task<T> DequeueAsync(TimeSpan timeout)
165public async Task<(bool, T)> TryDequeueAsync(TimeSpan timeout)
217public bool Dequeue(TimeSpan timeout, out T value)
446public bool WaitForItem(TimeSpan timeout)
497public Task<bool> WaitForItemAsync(TimeSpan timeout)
900public AsyncQueueReader(InputQueue<T> inputQueue, TimeSpan timeout, AsyncCallback callback, object state)
908if (timeout != TimeSpan.MaxValue)
957public AsyncQueueWaiter(TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state)
959if (timeout != TimeSpan.MaxValue)
1105public bool Wait(TimeSpan timeout, out T value)
1166public async Task<(bool, T)> WaitAsync(TimeSpan timeout)
1204public bool Wait(TimeSpan timeout)
1232public async Task<bool> WaitAsync(TimeSpan timeout)
Internals\System\Runtime\TimeoutHelper.cs (48)
15public static readonly TimeSpan MaxWait = TimeSpan.FromMilliseconds(int.MaxValue);
24public TimeoutHelper(TimeSpan timeout)
26Contract.Assert(timeout >= TimeSpan.Zero, "timeout must be non-negative");
32_deadlineSet = (timeout == TimeSpan.MaxValue);
44var timeout = RemainingTime();
49else if (timeout > TimeSpan.Zero)
63public TimeSpan OriginalTimeout { get; }
65public static bool IsTooLarge(TimeSpan timeout)
67return (timeout > MaxWait) && (timeout != TimeSpan.MaxValue);
70public static TimeSpan FromMilliseconds(int milliseconds)
74return TimeSpan.MaxValue;
78return TimeSpan.FromMilliseconds(milliseconds);
82public static int ToMilliseconds(TimeSpan timeout)
84if (timeout == TimeSpan.MaxValue)
91if (ticks / TimeSpan.TicksPerMillisecond > int.MaxValue)
99public static TimeSpan Min(TimeSpan val1, TimeSpan val2)
111public static TimeSpan Add(TimeSpan timeout1, TimeSpan timeout2)
116public static DateTime Add(DateTime time, TimeSpan timeout)
118if (timeout >= TimeSpan.Zero && DateTime.MaxValue - time <= timeout)
122if (timeout <= TimeSpan.Zero && DateTime.MinValue - time >= timeout)
129public static DateTime Subtract(DateTime time, TimeSpan timeout)
131return Add(time, TimeSpan.Zero - timeout);
134public static TimeSpan Divide(TimeSpan timeout, int factor)
136if (timeout == TimeSpan.MaxValue)
138return TimeSpan.MaxValue;
144public TimeSpan RemainingTime()
153return TimeSpan.MaxValue;
157TimeSpan remaining = _deadline - DateTime.UtcNow;
158if (remaining <= TimeSpan.Zero)
160return TimeSpan.Zero;
169public TimeSpan ElapsedTime()
181public static void ThrowIfNegativeArgument(TimeSpan timeout)
186public static void ThrowIfNegativeArgument(TimeSpan timeout, string argumentName)
188if (timeout < TimeSpan.Zero)
194public static void ThrowIfNonPositiveArgument(TimeSpan timeout)
199public static void ThrowIfNonPositiveArgument(TimeSpan timeout, string argumentName)
201if (timeout <= TimeSpan.Zero)
207public static bool WaitOne(WaitHandle waitHandle, TimeSpan timeout)
210if (timeout == TimeSpan.MaxValue)
223public static bool Wait(ManualResetEventSlim mres, TimeSpan timeout)
226if (timeout == TimeSpan.MaxValue)
237internal static TimeoutException CreateEnterTimedOutException(TimeSpan timeout)
System\IdentityModel\Selectors\SecurityTokenProvider.cs (21)
28public SecurityToken GetToken(TimeSpan timeout)
39public IAsyncResult BeginGetToken(TimeSpan timeout, AsyncCallback callback, object state)
60public async Task<SecurityToken> GetTokenAsync(TimeSpan timeout)
71protected abstract SecurityToken GetTokenCore(TimeSpan timeout);
73protected virtual IAsyncResult BeginGetTokenCore(TimeSpan timeout, AsyncCallback callback, object state)
84protected virtual Task<SecurityToken> GetTokenCoreAsync(TimeSpan timeout)
91internal virtual Task<SecurityToken> GetTokenCoreInternalAsync(TimeSpan timeout)
98public SecurityToken RenewToken(TimeSpan timeout, SecurityToken tokenToBeRenewed)
114public IAsyncResult BeginRenewToken(TimeSpan timeout, SecurityToken tokenToBeRenewed, AsyncCallback callback, object state)
140public async Task<SecurityToken> RenewTokenAsync(TimeSpan timeout, SecurityToken tokenToBeRenewed)
156protected virtual SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
161protected virtual IAsyncResult BeginRenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed, AsyncCallback callback, object state)
171protected virtual Task<SecurityToken> RenewTokenCoreAsync(TimeSpan timeout, SecurityToken tokenToBeRenewed)
176internal virtual Task<SecurityToken> RenewTokenCoreInternalAsync(TimeSpan timeout, SecurityToken tokenToBeRenewed)
183public void CancelToken(TimeSpan timeout, SecurityToken token)
193public IAsyncResult BeginCancelToken(TimeSpan timeout, SecurityToken token, AsyncCallback callback, object state)
213public async Task CancelTokenAsync(TimeSpan timeout, SecurityToken token)
223protected virtual void CancelTokenCore(TimeSpan timeout, SecurityToken token)
228protected virtual IAsyncResult BeginCancelTokenCore(TimeSpan timeout, SecurityToken token, AsyncCallback callback, object state)
238protected virtual Task CancelTokenCoreAsync(TimeSpan timeout, SecurityToken token)
243internal virtual Task CancelTokenCoreInternalAsync(TimeSpan timeout, SecurityToken token)
System\ServiceModel\Channels\ClientReliableChannelBinder.cs (29)
22TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
81TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
120protected override Task OnCloseAsync(TimeSpan timeout)
125protected override Task OnOpenAsync(TimeSpan timeout)
130protected virtual Task<Message> OnRequestAsync(TChannel channel, Message message, TimeSpan timeout,
136public Task<Message> RequestAsync(Message message, TimeSpan timeout)
141public async Task<Message> RequestAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
200protected override Task<bool> TryGetChannelAsync(TimeSpan timeout)
230TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
273TimeSpan timeout)
285protected override async Task<(bool, RequestContext)> OnTryReceiveAsync(TDuplexChannel channel, TimeSpan timeout)
295(success, message) = await TaskHelpers.FromAsync<TimeSpan, bool, Message>(channel.BeginTryReceive, channel.EndTryReceive, timeout, null);
314TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
345TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
364protected override Task CloseChannelAsync(IDuplexSessionChannel channel, TimeSpan timeout)
389TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
450TimeSpan timeout, MaskingMode maskingMode)
463TimeSpan timeout)
477public override async Task<(bool, RequestContext)> TryReceiveAsync(TimeSpan timeout)
491TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
522TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
System\ServiceModel\Channels\ClientReliableDuplexSessionChannel.cs (21)
82private Task CloseSequenceAsync(TimeSpan timeout)
192private async Task InternalCloseOutputSessionAsync(TimeSpan timeout)
676protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
715protected internal override async Task OnCloseAsync(TimeSpan timeout)
745protected override void OnClose(TimeSpan timeout)
750protected async Task OnCloseOutputSessionAsync(TimeSpan timeout)
824protected override async Task OnSendAsync(Message message, TimeSpan timeout)
830private async Task OnSendAsyncHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException)
876private async Task OnSendAckRequestedAsyncHandler(TimeSpan timeout)
935(bool success, RequestContext context) = await Binder.TryReceiveAsync(TimeSpan.MaxValue);
981private async Task TerminateSequenceAsync(TimeSpan timeout)
1104protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1109protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1114protected internal override Task OnCloseAsync(TimeSpan timeout)
1121protected override void OnClose(TimeSpan timeout)
1149protected internal override async Task OnOpenAsync(TimeSpan timeout)
1169protected override void OnOpen(TimeSpan timeout)
1231TimeSpan timeout = _closing ? _closeTimeoutHelper.RemainingTime() : DefaultCloseTimeout;
1260TimeSpan timeout;
1287public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
1302public void CloseOutputSession(TimeSpan timeout)
System\ServiceModel\Channels\CommunicationObject.cs (31)
136protected abstract TimeSpan DefaultCloseTimeout { get; }
137protected abstract TimeSpan DefaultOpenTimeout { get; }
139internal TimeSpan InternalCloseTimeout
144internal TimeSpan InternalOpenTimeout
197public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
207public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
217public void Close(TimeSpan timeout)
223private async Task CloseAsyncInternal(TimeSpan timeout)
229async Task IAsyncCommunicationObject.CloseAsync(TimeSpan timeout)
231if (timeout < TimeSpan.Zero)
306private async Task OnCloseAsyncInternal(TimeSpan timeout)
495public void Open(TimeSpan timeout)
501private Task OpenAsyncInternal(TimeSpan timeout)
506async Task IAsyncCommunicationObject.OpenAsync(TimeSpan timeout)
508if (timeout < TimeSpan.Zero)
556private async Task OnOpenAsyncInternal(TimeSpan timeout)
985protected abstract void OnClose(TimeSpan timeout);
987protected abstract IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);
991protected abstract void OnOpen(TimeSpan timeout);
993protected abstract IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state);
997internal protected virtual Task OnCloseAsync(TimeSpan timeout)
1006internal protected virtual Task OnOpenAsync(TimeSpan timeout)
1017internal Task OpenOtherAsync(ICommunicationObject other, TimeSpan timeout)
1047internal Task CloseOtherAsync(ICommunicationObject other, TimeSpan timeout)
1141public static TimeSpan GetInternalCloseTimeout(this CommunicationObject communicationObject)
1146public static void OnClose(CommunicationObject communicationObject, TimeSpan timeout)
1151public static IAsyncResult OnBeginClose(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
1161public static void OnOpen(CommunicationObject communicationObject, TimeSpan timeout)
1166public static IAsyncResult OnBeginOpen(CommunicationObject communicationObject, TimeSpan timeout, AsyncCallback callback, object state)
1171public static async Task OnCloseAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
1177public static async Task OnOpenAsyncInternal(CommunicationObject communicationObject, TimeSpan timeout)
System\ServiceModel\Channels\DuplexChannel.cs (17)
26public Task SendAsync(Message message, TimeSpan timeout)
31if (timeout < TimeSpan.Zero)
46public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
72protected abstract Task OnSendAsync(Message message, TimeSpan timeout);
79public void Send(Message message, TimeSpan timeout)
93public Task<Message> ReceiveAsync(TimeSpan timeout)
95if (timeout < TimeSpan.Zero)
108public Message Receive(TimeSpan timeout)
118public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
128public Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
130if (timeout < TimeSpan.Zero)
138public bool TryReceive(TimeSpan timeout, out Message message)
145public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
157public Task<bool> WaitForMessageAsync(TimeSpan timeout)
159if (timeout < TimeSpan.Zero)
167public bool WaitForMessage(TimeSpan timeout)
172public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Channels\IReliableChannelBinder.cs (10)
15TimeSpan DefaultSendTimeout { get; }
26Task CloseAsync(TimeSpan timeout);
27Task CloseAsync(TimeSpan timeout, MaskingMode maskingMode);
28Task OpenAsync(TimeSpan timeout);
29Task SendAsync(Message message, TimeSpan timeout);
30Task SendAsync(Message message, TimeSpan timeout, MaskingMode maskingMode);
32Task<(bool success, RequestContext requestContext)> TryReceiveAsync(TimeSpan timeout);
33Task<(bool success, RequestContext requestContext)> TryReceiveAsync(TimeSpan timeout, MaskingMode maskingMode);
49Task<Message> RequestAsync(Message message, TimeSpan timeout);
50Task<Message> RequestAsync(Message message, TimeSpan timeout, MaskingMode maskingMode);
System\ServiceModel\Channels\LayeredChannelFactory.cs (25)
37protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
47protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
57protected internal override async Task OnCloseAsync(TimeSpan timeout)
64protected override void OnClose(TimeSpan timeout)
71protected internal override Task OnOpenAsync(TimeSpan timeout)
76protected override void OnOpen(TimeSpan timeout)
120public async Task<Message> ReceiveAsync(TimeSpan timeout)
152public Message Receive(TimeSpan timeout)
162public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
172public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
184public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
194(retVal, message) = await TaskHelpers.FromAsync<TimeSpan, bool, Message>(InnerChannel.BeginTryReceive, InnerChannel.EndTryReceive, timeout, null);
201public bool TryReceive(TimeSpan timeout, out Message message)
208public Task<bool> WaitForMessageAsync(TimeSpan timeout)
220public bool WaitForMessage(TimeSpan timeout)
225public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
278protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state) => throw ExceptionHelper.PlatformNotSupported();
282protected internal override async Task OnCloseAsync(TimeSpan timeout)
289protected override void OnClose(TimeSpan timeout) => throw ExceptionHelper.PlatformNotSupported();
291protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state) => throw ExceptionHelper.PlatformNotSupported();
295protected internal override async Task OnOpenAsync(TimeSpan timeout)
302protected override void OnOpen(TimeSpan timeout)
314public Task SendAsync(Message message, TimeSpan timeout)
331public void Send(Message message, TimeSpan timeout)
341public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Channels\ReliableChannelBinder.cs (48)
31private TimeSpan _defaultCloseTimeout;
36TolerateFaultsMode faultMode, TimeSpan defaultCloseTimeout,
37TimeSpan defaultSendTimeout)
84public TimeSpan DefaultSendTimeout { get; }
236public Task CloseAsync(TimeSpan timeout)
241public async Task CloseAsync(TimeSpan timeout, MaskingMode maskingMode)
314protected virtual Task CloseChannelAsync(TChannel channel, TimeSpan timeout)
453protected abstract Task OnCloseAsync(TimeSpan timeout);
489protected abstract Task OnOpenAsync(TimeSpan timeout);
544protected virtual Task OnSendAsync(TChannel channel, Message message, TimeSpan timeout)
549protected virtual Task<(bool success, RequestContext requestContext)> OnTryReceiveAsync(TChannel channel, TimeSpan timeout)
554public async Task OpenAsync(TimeSpan timeout)
601public Task SendAsync(Message message, TimeSpan timeout)
606public async Task SendAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
703private void ThrowIfTimeoutNegative(TimeSpan timeout)
705if (timeout < TimeSpan.Zero)
728protected abstract Task<bool> TryGetChannelAsync(TimeSpan timeout);
730public virtual Task<(bool, RequestContext)> TryReceiveAsync(TimeSpan timeout)
735public virtual async Task<(bool, RequestContext)> TryReceiveAsync(TimeSpan timeout, MaskingMode maskingMode)
796protected bool ValidateInputOperation(TimeSpan timeout)
798if (timeout < TimeSpan.Zero)
807protected bool ValidateOutputOperation(Message message, TimeSpan timeout, MaskingMode maskingMode)
814if (timeout < TimeSpan.Zero)
823internal Task WaitForPendingOperationsAsync(TimeSpan timeout)
1029if (await _binder.TryGetChannelAsync(TimeSpan.Zero))
1469if (!await _binder.TryGetChannelAsync(TimeSpan.Zero))
1535public Task<(bool success, TChannel channel)> TryGetChannelForInputAsync(bool canGetChannel, TimeSpan timeout)
1540public Task<(bool success, TChannel channel)> TryGetChannelForOutputAsync(TimeSpan timeout, MaskingMode maskingMode)
1545private async Task<(bool success, TChannel channel)> TryGetChannelAsync(bool canGetChannel, bool canCauseFault, TimeSpan timeout,
1665public async Task WaitForPendingOperationsAsync(TimeSpan timeout)
1718TChannel channel, TimeSpan timeout, MaskingMode maskingMode,
1885protected override void OnClose(TimeSpan timeout)
1889protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1903protected override void OnReply(Message message, TimeSpan timeout)
1933protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout,
1939protected override void OnClose(TimeSpan timeout)
1967private async Task OnReplyAsync(Message message, TimeSpan timeout)
1995protected override void OnReply(Message message, TimeSpan timeout)
2005ReliableChannelBinder<IDuplexSessionChannel> binder, IDuplexSessionChannel channel, TimeSpan timeout)
2012TimeSpan iterationTimeout = timeoutHelper.RemainingTime();
2013bool lastIteration = (iterationTimeout == TimeSpan.Zero);
2029(success, message) = await TaskHelpers.FromAsync<TimeSpan, bool, Message>(channel.BeginTryReceive, channel.EndTryReceive, timeout, null);
2079lastIteration = (iterationTimeout == TimeSpan.Zero);
2087TimeSpan timeout)
2093TimeSpan iterationTimeout = timeoutHelper.RemainingTime();
2094bool lastIteration = (iterationTimeout == TimeSpan.Zero);
2104(success, context) = await TaskHelpers.FromAsync<TimeSpan, bool, RequestContext>(channel.BeginTryReceiveRequest, channel.EndTryReceiveRequest, iterationTimeout, null);
2154lastIteration = (iterationTimeout == TimeSpan.Zero);
System\ServiceModel\Channels\ReliableMessagingHelpers.cs (46)
16internal delegate Task OperationWithTimeoutAsyncCallback(TimeSpan timeout);
38public async Task CloseAsync(TimeSpan timeout)
113private TimeSpan _defaultInterval;
121public InterruptibleTimer(TimeSpan defaultInterval, WaitCallback callback, object state) : this(defaultInterval, callback, null, state)
131public InterruptibleTimer(TimeSpan defaultInterval, AsyncWaitCallback callback, object state) : this(defaultInterval, null, callback, state)
141private InterruptibleTimer(TimeSpan defaultInterval, WaitCallback callback, AsyncWaitCallback asyncCallback, object state)
231public void Set(TimeSpan interval)
241private void InternalSet(TimeSpan interval, bool ifNotSet)
370public Task<bool> WaitAsync(TimeSpan timeout)
375public async Task<bool> WaitAsync(TimeSpan timeout, bool throwTimeoutException)
471public abstract Task CloseAsync(TimeSpan timeout);
478private TimeSpan _defaultCloseTimeout;
479private TimeSpan _defaultSendTimeout;
482protected TypedFaultHelper(TimeSpan defaultSendTimeout, TimeSpan defaultCloseTimeout)
573public override async Task CloseAsync(TimeSpan timeout)
582protected abstract Task SendFaultAsync(IReliableChannelBinder binder, TState state, TimeSpan timeout);
678public ReplyFaultHelper(TimeSpan defaultSendTimeout, TimeSpan defaultCloseTimeout)
694protected override async Task SendFaultAsync(IReliableChannelBinder binder, FaultState faultState, TimeSpan timeout)
710public SendFaultHelper(TimeSpan defaultSendTimeout, TimeSpan defaultCloseTimeout)
724protected override async Task SendFaultAsync(IReliableChannelBinder binder, Message message, TimeSpan timeout)
738static public TimeSpan UnknownInitiationTime = TimeSpan.FromSeconds(2);
739static public TimeSpan RequestorIterationTime = TimeSpan.FromSeconds(10);
740static public TimeSpan RequestorReceiveTime = TimeSpan.FromSeconds(10);
758private TimeSpan originalTimeout;
868private TimeSpan GetNextRequestTimeout(TimeSpan remainingTimeout, out TimeoutHelper iterationTimeout, out bool lastIteration)
912protected abstract Task<Message> OnRequestAsync(Message request, TimeSpan timeout, bool last);
914public async Task<Message> RequestAsync(TimeSpan timeout)
926TimeSpan requestTimeout = GetNextRequestTimeout(timeoutHelper.RemainingTime(),
1042protected override async Task<Message> OnRequestAsync(Message request, TimeSpan timeout, bool last)
1073private TimeSpan GetReceiveTimeout(TimeSpan timeoutRemaining)
1085protected override async Task<Message> OnRequestAsync(Message request, TimeSpan timeout, bool last)
1090TimeSpan receiveTimeout = GetReceiveTimeout(timeoutHelper.RemainingTime());
1145private TimeSpan GetWaitTimeout(TimeSpan timeoutRemaining)
1157protected override async Task<Message> OnRequestAsync(Message request, TimeSpan timeout, bool last)
1161TimeSpan waitTimeout = GetWaitTimeout(timeoutHelper.RemainingTime());
1662public static TimeSpan CalculateKeepAliveInterval(TimeSpan inactivityTimeout, int maxRetryCount)
System\ServiceModel\Channels\ReliableOutputSessionChannel.cs (19)
97private async Task CloseSequenceAsync(TimeSpan timeout)
199protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
204protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
239protected override void OnClose(TimeSpan timeout)
244protected internal override async Task OnCloseAsync(TimeSpan timeout)
265protected abstract Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException);
267private async Task OnConnectionSendAckRequestedAsyncHandler(TimeSpan timeout)
277private async Task OnConnectionSendAsyncHandler(MessageAttemptInfo attemptInfo, TimeSpan timeout, bool maskUnhandledException)
299protected abstract Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode);
328protected override void OnOpen(TimeSpan timeout)
333protected internal override async Task OnOpenAsync(TimeSpan timeout)
353protected override async Task OnSendAsync(Message message, TimeSpan timeout)
359protected override void OnSend(Message message, TimeSpan timeout)
574private async Task TerminateSequenceAsync(TimeSpan timeout)
655protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout,
694protected override async Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
734protected override async Task OnConnectionSendAsync(Message message, TimeSpan timeout, bool saveHandledException, bool maskUnhandledException)
766protected override Task OnConnectionSendMessageAsync(Message message, TimeSpan timeout, MaskingMode maskingMode)
816(bool success, RequestContext context) = await Binder.TryReceiveAsync(TimeSpan.MaxValue);
System\ServiceModel\Channels\RequestContextBase.cs (12)
12private TimeSpan _defaultCloseTimeout;
19protected RequestContextBase(Message requestMessage, TimeSpan defaultCloseTimeout, TimeSpan defaultSendTimeout)
73public TimeSpan DefaultCloseTimeout
78public TimeSpan DefaultSendTimeout { get; }
109public override void Close(TimeSpan timeout)
111if (timeout < TimeSpan.Zero)
175protected abstract void OnClose(TimeSpan timeout);
176protected abstract void OnReply(Message message, TimeSpan timeout);
177protected abstract IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state);
225public override IAsyncResult BeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
248public override void Reply(Message message, TimeSpan timeout)
System\ServiceModel\Channels\SecurityChannelFactory.cs (29)
78private Task CloseProtocolFactoryAsync(bool aborted, TimeSpan timeout)
107CloseProtocolFactoryAsync(true, TimeSpan.Zero);
114protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
124protected internal override async Task OnCloseAsync(TimeSpan timeout)
135protected override void OnClose(TimeSpan timeout)
173protected internal override async Task OnOpenAsync(TimeSpan timeout)
181protected override void OnOpen(TimeSpan timeout)
213protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
223private Task OnOpenCoreAsync(TimeSpan timeout)
279protected internal override async Task OnOpenAsync(TimeSpan timeout)
347public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
362public async Task SendAsync(Message message, TimeSpan timeout)
383public void Send(Message message, TimeSpan timeout)
417public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
432internal Message ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
464public async Task<Message> RequestAsync(Message message, TimeSpan timeout)
476private async Task<Message> RequestAsyncInternal(Message message, TimeSpan timeout)
482public Message Request(Message message, TimeSpan timeout)
534public Task<Message> ReceiveAsync(TimeSpan timeout)
544public Message Receive(TimeSpan timeout)
554public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
564public virtual IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
576internal Message ProcessMessage(Message message, TimeSpan timeout)
607public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
623(success, message) = await TaskHelpers.FromAsync<TimeSpan, bool, Message>(InnerDuplexChannel.BeginTryReceive, InnerDuplexChannel.EndTryReceive, timeout, null);
634public bool TryReceive(TimeSpan timeout, out Message message)
641public Task<bool> WaitForMessageAsync(TimeSpan timeout)
653public bool WaitForMessage(TimeSpan timeout)
658public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Channels\ServiceChannel.cs (46)
41private TimeSpan _operationTimeout;
158protected override TimeSpan DefaultCloseTimeout
163protected override TimeSpan DefaultOpenTimeout
188internal TimeSpan CloseTimeout
266internal TimeSpan OpenTimeout
281public TimeSpan OperationTimeout
286if (value < TimeSpan.Zero)
442manager.CallOnce(TimeSpan.MaxValue, null);
452return manager.BeginCallOnce(TimeSpan.MaxValue, null, callback, state);
474private void EnsureOpened(TimeSpan timeout)
486private IAsyncResult BeginEnsureOpened(TimeSpan timeout, AsyncCallback callback, object state)
678internal IAsyncResult BeginCall(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, TimeSpan timeout, AsyncCallback callback, object asyncState)
720internal object Call(string action, bool oneway, ProxyOperationRuntime operation, object[] ins, object[] outs, TimeSpan timeout)
880private TimeoutException GetOpenTimeoutException(TimeSpan timeout)
1206public void Send(Message message, TimeSpan timeout)
1217public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1233public Message Request(Message message, TimeSpan timeout)
1244public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1280protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1290protected override void OnClose(TimeSpan timeout)
1295protected internal override async Task OnCloseAsync(TimeSpan timeout)
1322protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1332protected override void OnOpen(TimeSpan timeout)
1337protected internal override async Task OnOpenAsync(TimeSpan timeout)
1410IAsyncResult IDuplexContextChannel.BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
1420void IDuplexContextChannel.CloseOutputSession(TimeSpan timeout)
1696string action, object[] inputParameters, bool isOneWay, TimeSpan timeout,
1769TimeSpan timeout = _rpc.TimeoutHelper.RemainingTime();
1835TimeSpan timeout = _rpc.TimeoutHelper.RemainingTime();
1947void Call(ServiceChannel channel, TimeSpan timeout);
1948IAsyncResult BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state);
1969private void ValidateTimeoutIsMaxValue(TimeSpan timeout)
1971if (timeout != TimeSpan.MaxValue)
1977void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
1983IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
2011void ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
2016IAsyncResult ICallOnce.BeginCall(ServiceChannel channel, TimeSpan timeout, AsyncCallback callback, object state)
2072internal void CallOnce(TimeSpan timeout, CallOnceManager cascade)
2121internal IAsyncResult BeginCallOnce(TimeSpan timeout, CallOnceManager cascade,
2287internal bool Wait(TimeSpan timeout)
2330private TimeSpan _timeout;
2333internal AsyncWaiter(CallOnceManager manager, TimeSpan timeout,
2340if (timeout != TimeSpan.MaxValue)
2406private SessionIdleManager(IChannelBinder binder, TimeSpan idle)
2414internal static SessionIdleManager CreateIfNeeded(IChannelBinder binder, TimeSpan idle)
2416if (binder.HasSession && (idle != TimeSpan.MaxValue))
System\ServiceModel\Channels\ServiceChannelProxy.cs (11)
583void ICommunicationObject.Close(TimeSpan timeout)
593IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
608void ICommunicationObject.Open(TimeSpan timeout)
618IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
703TimeSpan IContextChannel.OperationTimeout
750IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
765void IOutputChannel.Send(Message message, TimeSpan timeout)
775Message IRequestChannel.Request(Message message, TimeSpan timeout)
785IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
795public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state)
805public void CloseOutputSession(TimeSpan timeout)
System\ServiceModel\Channels\TransmissionStrategy.cs (7)
68public TransmissionStrategy(ReliableMessagingVersion reliableMessagingVersion, TimeSpan initRtt,
71if (initRtt < TimeSpan.Zero)
123return (Ticks.Now / TimeSpan.TicksPerMillisecond) << Constants.TimeMultiplier;
176public Task<(MessageAttemptInfo attemptInfo, bool success)> AddAsync(Message message, TimeSpan timeout, object state)
181public async Task<MessageAttemptInfo> AddLastAsync(Message message, TimeSpan timeout, object state)
411private async Task<(MessageAttemptInfo attemptInfo, bool success)> InternalAddAsync(Message message, bool isLast, TimeSpan timeout, object state)
777public async Task<MessageAttemptInfo> WaitAsync(TimeSpan timeout)
System\ServiceModel\ClientBase.cs (16)
313private async Task OpenAsync(TimeSpan timeout)
363var timeout = GetChannelFactory().InternalCloseTimeout;
367private async Task CloseAsync(TimeSpan timeout)
497void ICommunicationObject.Open(TimeSpan timeout)
508void ICommunicationObject.Close(TimeSpan timeout)
619IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
634IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1032TimeSpan IContextChannel.OperationTimeout
1103void ICommunicationObject.Close(TimeSpan timeout)
1113IAsyncResult ICommunicationObject.BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1128void ICommunicationObject.Open(TimeSpan timeout)
1138IAsyncResult ICommunicationObject.BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1173void IOutputChannel.Send(Message message, TimeSpan timeout)
1183IAsyncResult IOutputChannel.BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1208Message IRequestChannel.Request(Message message, TimeSpan timeout)
1218IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\BufferedReceiveBinder.cs (10)
58public void CloseAfterFault(TimeSpan timeout)
69public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
91public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
126public void Send(Message message, TimeSpan timeout)
131public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
141public Message Request(Message message, TimeSpan timeout)
146public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
156public bool WaitForMessage(TimeSpan timeout)
161public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
189if (binder._channelBinder.TryReceive(TimeSpan.MaxValue, out requestContext))
System\ServiceModel\Dispatcher\DuplexChannelBinder.cs (39)
21private TimeSpan _defaultSendTimeout;
61public TimeSpan DefaultCloseTimeout { get; set; }
83public TimeSpan DefaultSendTimeout
188public void CloseAfterFault(TimeSpan timeout)
235private TimeoutException GetReceiveTimeoutException(TimeSpan timeout)
294public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
340public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
350public void Send(Message message, TimeSpan timeout)
355public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
410public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
440public Message Request(Message message, TimeSpan timeout)
480TimeSpan remaining = timeoutHelper.RemainingTime();
615public bool WaitForMessage(TimeSpan timeout)
620public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
646protected override void OnClose(TimeSpan timeout)
650protected override void OnReply(Message message, TimeSpan timeout)
658protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
673public ReplyAsyncResult(DuplexRequestContext context, Message message, TimeSpan timeout, AsyncCallback callback, object state)
763internal Message WaitForReply(TimeSpan timeout)
812private TimeSpan _timeout;
817internal AsyncDuplexRequest(Message message, DuplexChannelBinder parent, TimeSpan timeout, AsyncCallback callback, object state)
823if (timeout != TimeSpan.MaxValue)
1132private TimeSpan DefaultCloseTimeout
1149private TimeSpan DefaultReceiveTimeout
1178result = _innerChannel.BeginReceive(TimeSpan.MaxValue, s_receiveAsyncCallback, this);
1347public Message Receive(TimeSpan timeout)
1357public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state)
1367public bool TryReceive(TimeSpan timeout, out Message message)
1372public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
1382public bool WaitForMessage(TimeSpan timeout)
1387public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
1413public void Close(TimeSpan timeout)
1436public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1479public void Open(TimeSpan timeout)
1490public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
1506public void Send(Message message, TimeSpan timeout)
1516public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
1568public void WaitForBackgroundClose(TimeSpan timeout)
1575public IAsyncResult BeginWaitForBackgroundClose(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\IChannelBinder.cs (9)
19void CloseAfterFault(TimeSpan timeout);
21bool TryReceive(TimeSpan timeout, out RequestContext requestContext);
22IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state);
25void Send(Message message, TimeSpan timeout);
26IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state);
29Message Request(Message message, TimeSpan timeout);
30IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state);
33bool WaitForMessage(TimeSpan timeout);
34IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state);
System\ServiceModel\Dispatcher\InputChannelBinder.cs (14)
57public void CloseAfterFault(TimeSpan timeout)
62public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
87public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
97public void Send(Message message, TimeSpan timeout)
102public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
117public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
127public Message Request(Message message, TimeSpan timeout)
132public bool WaitForMessage(TimeSpan timeout)
137public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
164: base(request, TimeSpan.Zero, TimeSpan.Zero)
173protected override void OnClose(TimeSpan timeout)
177protected override void OnReply(Message message, TimeSpan timeout)
181protected override IAsyncResult OnBeginReply(Message message, TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\ListenerBinder.cs (12)
75public IChannelBinder Accept(TimeSpan timeout)
86public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
122public IChannelBinder Accept(TimeSpan timeout)
133public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
167public IChannelBinder Accept(TimeSpan timeout)
178public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
212public IChannelBinder Accept(TimeSpan timeout)
223public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
257public IChannelBinder Accept(TimeSpan timeout)
268public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
302public IChannelBinder Accept(TimeSpan timeout)
313public IAsyncResult BeginAccept(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\OutputChannelBinder.cs (9)
59public void CloseAfterFault(TimeSpan timeout)
64public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
79public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
89public void Send(Message message, TimeSpan timeout)
94public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
104public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
109public Message Request(Message message, TimeSpan timeout)
114public bool WaitForMessage(TimeSpan timeout)
119public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\ReplyChannelBinder.cs (9)
57public void CloseAfterFault(TimeSpan timeout)
62public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
77public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
87public void Send(Message message, TimeSpan timeout)
92public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
102public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
107public Message Request(Message message, TimeSpan timeout)
112public bool WaitForMessage(TimeSpan timeout)
117public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Dispatcher\RequestChannelBinder.cs (9)
55public void CloseAfterFault(TimeSpan timeout)
60public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state)
75public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state)
85public void Send(Message message, TimeSpan timeout)
90public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
100public bool TryReceive(TimeSpan timeout, out RequestContext requestContext)
105public Message Request(Message message, TimeSpan timeout)
119public bool WaitForMessage(TimeSpan timeout)
124public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Security\SecurityProtocol.cs (13)
80public TimeSpan DefaultOpenTimeout
85public TimeSpan DefaultCloseTimeout
250private async Task MergeSupportingTokenProvidersAsync(TimeSpan timeout)
290public Task OpenAsync(TimeSpan timeout)
295public virtual async Task OnOpenAsync(TimeSpan timeout)
358public Task CloseAsync(bool aborted, TimeSpan timeout)
390public virtual async Task OnCloseAsync(TimeSpan timeout)
492internal async Task<IList<SupportingTokenSpecification>> TryGetSupportingTokensAsync(SecurityProtocolFactory factory, EndpointAddress target, Uri via, Message message, TimeSpan timeout)
587internal static async Task<SecurityToken> GetTokenAsync(SecurityTokenProvider provider, EndpointAddress target, TimeSpan timeout)
612public abstract Task<Message> SecureOutgoingMessageAsync(Message message, TimeSpan timeout);
615public virtual async Task<(SecurityProtocolCorrelationState, Message)> SecureOutgoingMessageAsync(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
628public abstract void VerifyIncomingMessage(ref Message message, TimeSpan timeout);
631public virtual SecurityProtocolCorrelationState VerifyIncomingMessage(ref Message message, TimeSpan timeout, params SecurityProtocolCorrelationState[] correlationStates)
System\ServiceModel\Security\SecurityProtocolFactory.cs (25)
61internal static readonly TimeSpan defaultMaxClockSkew = TimeSpan.Parse(defaultMaxClockSkewString, CultureInfo.InvariantCulture);
62internal static readonly TimeSpan defaultReplayWindow = TimeSpan.Parse(defaultReplayWindowString, CultureInfo.InvariantCulture);
65internal static readonly TimeSpan defaultTimestampValidityDuration = TimeSpan.Parse(defaultTimestampValidityDurationString, CultureInfo.InvariantCulture);
79private TimeSpan _maxClockSkew = defaultMaxClockSkew;
82private TimeSpan _replayWindow = defaultReplayWindow;
87private TimeSpan _timestampValidityDuration = defaultTimestampValidityDuration;
226public TimeSpan MaxClockSkew
235if (value < TimeSpan.Zero)
269public TimeSpan ReplayWindow
278if (value <= TimeSpan.Zero)
360public TimeSpan TimestampValidityDuration
369if (value <= TimeSpan.Zero)
380public TimeSpan DefaultOpenTimeout => ServiceDefaults.OpenTimeout;
382public TimeSpan DefaultCloseTimeout => ServiceDefaults.CloseTimeout;
412public virtual Task OnCloseAsync(TimeSpan timeout)
421public SecurityProtocol CreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, bool isReturnLegSecurityRequired, TimeSpan timeout)
456protected abstract SecurityProtocol OnCreateSecurityProtocol(EndpointAddress target, Uri via, object listenerSecurityState, TimeSpan timeout);
467public virtual Task OnOpenAsync(TimeSpan timeout)
494if (MaxClockSkew == TimeSpan.MaxValue || ReplayWindow == TimeSpan.MaxValue)
511public Task OpenAsync(bool actAsInitiator, TimeSpan timeout)
517public Task CloseAsync(bool aborted, TimeSpan timeout)
System\ServiceModel\Security\SecuritySessionClientSettings.cs (59)
29internal static readonly TimeSpan s_defaultKeyRenewalInterval = TimeSpan.Parse(DefaultKeyRenewalIntervalString, CultureInfo.InvariantCulture);
30internal static readonly TimeSpan s_defaultKeyRolloverInterval = TimeSpan.Parse(DefaultKeyRolloverIntervalString, CultureInfo.InvariantCulture);
37private TimeSpan _keyRenewalInterval;
38private TimeSpan _keyRolloverInterval;
73public TimeSpan KeyRenewalInterval
81if (value <= TimeSpan.Zero)
90public TimeSpan KeyRolloverInterval
98if (value <= TimeSpan.Zero)
149public TimeSpan DefaultOpenTimeout
154public TimeSpan DefaultCloseTimeout
199public Task OnCloseAsync(TimeSpan timeout)
213_sessionProtocolFactory.CloseAsync(true, TimeSpan.Zero).Wait();
217public Task OnOpenAsync(TimeSpan timeout)
241internal Task CloseAsync(TimeSpan timeout)
252IChannelFactory innerChannelFactory, ChannelBuilder channelBuilder, TimeSpan timeout)
440private async Task OpenCoreAsync(SecurityToken sessionToken, TimeSpan timeout)
463protected override void OnOpen(TimeSpan timeout)
468protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
478protected internal override async Task OnOpenAsync(TimeSpan timeout)
617protected async Task<SecurityProtocolCorrelationState> SendCloseMessageAsync(TimeSpan timeout)
635protected async Task SendCloseResponseMessageAsync(TimeSpan timeout)
831protected Message ProcessIncomingMessage(Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState, out MessageFault protocolFault)
891protected Message ProcessRequestContext(RequestContext requestContext, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
958TimeSpan tokenValidityInterval = TimeSpan.FromTicks((long)(((token.ValidTo.Ticks - token.ValidFrom.Ticks) * Settings._issuedTokenRenewalThreshold) / 100));
1000private async Task RenewKeyAsync(TimeSpan timeout)
1066protected async Task<(SecurityProtocolCorrelationState, Message)> SecureOutgoingMessageAsync(Message message, TimeSpan timeout)
1077protected void VerifyIncomingMessage(ref Message message, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
1094protected virtual async Task CloseCoreAsync(TimeSpan timeout)
1120protected async Task<Message> ReceiveInternalAsync(TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
1141if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
1151protected async Task<(bool, bool)> CloseSessionAsync(TimeSpan timeout)
1205protected virtual async Task<SecurityProtocolCorrelationState> CloseOutputSessionAsync(TimeSpan timeout)
1261protected internal override async Task OnCloseAsync(TimeSpan timeout)
1302protected override void OnClose(TimeSpan timeout)
1307protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
1443protected override async Task<SecurityProtocolCorrelationState> CloseOutputSessionAsync(TimeSpan timeout)
1469Message IRequestChannel.Request(Message message, TimeSpan timeout) => RequestAsync(message, timeout).WaitForCompletionNoSpin();
1473IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state) => RequestAsync(message, timeout).ToApm(callback, state);
1477private Message ProcessReply(Message reply, TimeSpan timeout, SecurityProtocolCorrelationState correlationState)
1518public async Task<Message> RequestAsync(Message message, TimeSpan timeout)
1581public Message Receive(TimeSpan timeout) => ReceiveAsync(timeout).GetAwaiter().GetResult();
1583public Task<Message> ReceiveAsync(TimeSpan timeout) => InputChannel.HelpReceiveAsync(this, timeout);
1587public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state) => ReceiveAsync(timeout).ToApm(callback, state);
1591public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state) => TryReceiveAsync(timeout).ToApm(callback, state);
1606public bool TryReceive(TimeSpan timeout, out Message message)
1613public async Task<(bool, Message)> TryReceiveAsync(TimeSpan timeout)
1630public void Send(Message message, TimeSpan timeout) => SendAsync(message, timeout).WaitForCompletionNoSpin();
1632public async Task SendAsync(Message message, TimeSpan timeout)
1645public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) => SendAsync(message, timeout).ToApm(callback, state);
1665Message message = await ReceiveInternalAsync(TimeSpan.MaxValue, null);
1710public bool WaitForMessage(TimeSpan timeout) => WaitForMessageAsync(timeout).GetAwaiter().GetResult();
1712public Task<bool> WaitForMessageAsync(TimeSpan timeout)
1717public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state) => WaitForMessageAsync(timeout).ToApm(callback, state);
1785public void CloseOutputSession(TimeSpan timeout) => CloseOutputSessionAsync(timeout).GetAwaiter().GetResult();
1787public async Task CloseOutputSessionAsync(TimeSpan timeout)
1822public IAsyncResult BeginCloseOutputSession(TimeSpan timeout, AsyncCallback callback, object state) => CloseOutputSessionAsync(timeout).ToApm(callback, state);
System\ServiceModel\Security\SecurityUtils.cs (15)
298return new DateTime(DateTime.MaxValue.Ticks - TimeSpan.TicksPerDay, DateTimeKind.Utc);
307return new DateTime(DateTime.MinValue.Ticks + TimeSpan.TicksPerDay, DateTimeKind.Utc);
506internal static Task OpenTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
522internal static void CloseTokenProviderIfRequired(SecurityTokenProvider tokenProvider, TimeSpan timeout)
527internal static Task CloseTokenProviderIfRequiredAsync(SecurityTokenProvider tokenProvider, TimeSpan timeout)
545CloseCommunicationObject(tokenProvider, true, TimeSpan.Zero);
548internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, TimeSpan timeout)
553internal static void CloseTokenAuthenticatorIfRequired(SecurityTokenAuthenticator tokenAuthenticator, bool aborted, TimeSpan timeout)
560CloseCommunicationObject(tokenAuthenticator, true, TimeSpan.Zero);
563private static Task OpenCommunicationObjectAsync(IAsyncCommunicationObject obj, TimeSpan timeout)
573private static Task CloseCommunicationObjectAsync(IAsyncCommunicationObject obj, bool aborted, TimeSpan timeout)
596private static void CloseCommunicationObject(Object obj, bool aborted, TimeSpan timeout)
1093private Action<TimeSpan> _operationWithTimeout;
1095public OperationWithTimeoutAsyncResult(Action<TimeSpan> operationWithTimeout, TimeSpan timeout, AsyncCallback callback, object state)
System\ServiceModel\Security\WrapperSecurityCommunicationObject.cs (30)
30protected override TimeSpan DefaultCloseTimeout
35protected override TimeSpan DefaultOpenTimeout
45protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
50protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
55protected override void OnClose(TimeSpan timeout)
88protected override void OnOpen(TimeSpan timeout)
110protected internal override Task OnCloseAsync(TimeSpan timeout)
115protected internal override Task OnOpenAsync(TimeSpan timeout)
179public virtual TimeSpan DefaultOpenTimeout
184public virtual TimeSpan DefaultCloseTimeout
200public Task CloseAsync(TimeSpan timeout)
205public void Close(TimeSpan timeout)
215public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
230public Task OpenAsync(TimeSpan timeout)
235public void Open(TimeSpan timeout)
245public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
265public virtual Task OnCloseAsync(TimeSpan timeout)
283public virtual Task OnOpenAsync(TimeSpan timeout)
341public virtual TimeSpan DefaultOpenTimeout
346public virtual TimeSpan DefaultCloseTimeout
362public void Close(TimeSpan timeout)
372public IAsyncResult BeginClose(TimeSpan timeout, AsyncCallback callback, object state)
387public void Open(TimeSpan timeout)
397public IAsyncResult BeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
417public IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
422public IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
427public virtual void OnClose(TimeSpan timeout)
431public Task OnCloseAsync(TimeSpan timeout)
459public virtual void OnOpen(TimeSpan timeout)
463public Task OnOpenAsync(TimeSpan timeout)
System.ServiceModel.Primitives.Tests (88)
IdentityModel\SecurityTokenProviderTest.cs (42)
23var token = provider.GetToken(TimeSpan.Zero);
26token = provider.RenewToken(TimeSpan.Zero, token);
29provider.CancelToken(TimeSpan.Zero, token);
32var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
36iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
40iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
44token = provider.GetTokenAsync(TimeSpan.Zero).Result;
47token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
50provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
59var token = provider.GetToken(TimeSpan.Zero);
62token = provider.RenewToken(TimeSpan.Zero, token);
65provider.CancelToken(TimeSpan.Zero, token);
68var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
72iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
76iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
80token = provider.GetTokenAsync(TimeSpan.Zero).Result;
83token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
86provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
97var token = provider.GetToken(TimeSpan.Zero);
100token = provider.RenewToken(TimeSpan.Zero, token);
103provider.CancelToken(TimeSpan.Zero, token);
106var iar = provider.BeginGetToken(TimeSpan.Zero, null, null);
110iar = provider.BeginRenewToken(TimeSpan.Zero, token, null, null);
114iar = provider.BeginCancelToken(TimeSpan.Zero, token, null, null);
118token = provider.GetTokenAsync(TimeSpan.Zero).Result;
121token = provider.RenewTokenAsync(TimeSpan.Zero, token).Result;
124provider.CancelTokenAsync(TimeSpan.Zero, token).Wait();
133protected override SecurityToken GetTokenCore(TimeSpan timeout)
138protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
144protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
155protected override SecurityToken GetTokenCore(TimeSpan timeout)
160protected override IAsyncResult BeginGetTokenCore(TimeSpan timeout, AsyncCallback callback, object state)
172protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
178protected override IAsyncResult BeginRenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed, AsyncCallback callback, object state)
191protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
197protected override IAsyncResult BeginCancelTokenCore(TimeSpan timeout, SecurityToken token, AsyncCallback callback, object state)
216protected override SecurityToken GetTokenCore(TimeSpan timeout)
221protected override Task<SecurityToken> GetTokenCoreAsync(TimeSpan timeout)
226protected override SecurityToken RenewTokenCore(TimeSpan timeout, SecurityToken tokenToBeRenewed)
232protected override Task<SecurityToken> RenewTokenCoreAsync(TimeSpan timeout, SecurityToken tokenToBeRenewed)
238protected override void CancelTokenCore(TimeSpan timeout, SecurityToken token)
244protected override Task CancelTokenCoreAsync(TimeSpan timeout, SecurityToken token)
ServiceModel\ThrowingOnCloseBindingElement.cs (17)
72protected override void OnOpen(TimeSpan timeout)
77protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
93protected override void OnClose(TimeSpan timeout)
104protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
114private async Task OnCloseAsyncImpl(TimeSpan timeout)
195public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginSend(message, timeout, callback, state);
198public void Send(Message message, TimeSpan timeout) => InnerChannel.Send(message, timeout);
212public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginRequest(message, timeout, callback, state);
215public Message Request(Message message, TimeSpan timeout) => InnerChannel.Request(message, timeout);
254public Message Receive(TimeSpan timeout) => InnerChannel.Receive(timeout);
256public IAsyncResult BeginReceive(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginReceive(timeout, callback, state);
258public bool TryReceive(TimeSpan timeout, out Message message) => InnerChannel.TryReceive(timeout, out message);
259public IAsyncResult BeginTryReceive(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginTryReceive(timeout, callback, state);
261public bool WaitForMessage(TimeSpan timeout) => InnerChannel.WaitForMessage(timeout);
262public IAsyncResult BeginWaitForMessage(TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginWaitForMessage(timeout, callback, state);
276public void Send(Message message, TimeSpan timeout) => InnerChannel.Send(message, timeout);
278public IAsyncResult BeginSend(Message message, TimeSpan timeout, AsyncCallback callback, object state) => InnerChannel.BeginSend(message, callback, state);
System.ServiceModel.Syndication (4)
System.ServiceModel.UnixDomainSocket (69)
System\ServiceModel\Channels\SocketConnection.cs (31)
20private TimeSpan _asyncSendTimeout;
21private TimeSpan _readFinTimeout;
22private TimeSpan _asyncReceiveTimeout;
156public ValueTask<int> ReadAsync(Memory<byte> buffer, TimeSpan timeout)
167private async ValueTask<int> ReadCoreAsync(Memory<byte> buffer, TimeSpan timeout, bool closing)
239public async ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, bool immediate, TimeSpan timeout)
312public async ValueTask CloseAsync(TimeSpan timeout)
373private void Shutdown(TimeSpan timeout)
392ConvertSendException(socketException, TimeSpan.MaxValue, _asyncSendTimeout));
493private void SetReadTimeout(TimeSpan timeout, bool closing)
495if (timeout <= TimeSpan.Zero)
502if (timeout == TimeSpan.MaxValue)
544private void SetWriteTimeout(TimeSpan timeout)
546if (timeout <= TimeSpan.Zero)
553if (timeout == TimeSpan.MaxValue)
587private bool ShouldUpdateTimeout(DateTime oldTimeoutDeadline, TimeSpan newTimeout)
589var oldTimeout = oldTimeoutDeadline - DateTime.UtcNow;
590if (oldTimeout < TimeSpan.Zero) // Expired already
633private Exception ConvertSendException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
639private Exception ConvertReceiveException(SocketException socketException, TimeSpan remainingTime, TimeSpan timeout)
645private static Exception ConvertTransferException(SocketException socketException, TimeSpan timeout, Exception originalException,
647SocketConnection socketConnection, TimeSpan remainingTime)
661remainingTime <= TimeSpan.Zero)
790public static Exception ConvertConnectException(SocketException socketException, Uri remoteUri, TimeSpan timeSpent, Exception innerException)
805if (timeSpent == TimeSpan.MaxValue)
826if (timeSpent == TimeSpan.MaxValue)
837private static TimeoutException CreateTimeoutException(Uri uri, TimeSpan timeout, SocketException innerException)
842public async ValueTask<IConnection> ConnectAsync(Uri uri, TimeSpan timeout)
848if (timeoutHelper.RemainingTime() == TimeSpan.Zero)
System.ServiceProcess.ServiceController (2)
System.Speech (29)
System.Text.Json (19)
System\Text\Json\Serialization\Converters\Value\TimeSpanConverter.cs (7)
11internal sealed class TimeSpanConverter : JsonPrimitiveConverter<TimeSpan>
17public override TimeSpan Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
27internal override TimeSpan ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
33private static TimeSpan ReadCore(ref Utf8JsonReader reader)
62bool result = Utf8Parser.TryParse(source, out TimeSpan tmpValue, out int bytesConsumed, 'c');
77public override void Write(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options)
87internal override void WriteAsPropertyNameCore(Utf8JsonWriter writer, TimeSpan value, JsonSerializerOptions options, bool isWritingExtensionDataProperty)
System.Text.Json.SourceGeneration (1)
System.Text.RegularExpressions (49)
System\Text\RegularExpressions\Regex.EnumerateSplits.cs (7)
70/// The behavior of <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> is similar to the behavior of <see cref="Split(string, string, RegexOptions, TimeSpan)"/>, producing the splits
72/// <see cref="Split(string, string, RegexOptions, TimeSpan)"/> will include the contents of capture groups in the resulting splits, while <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> will not.
73/// And if <see cref="RegexOptions.RightToLeft"/> is specified, <see cref="Split(string, string, RegexOptions, TimeSpan)"/> will reverse the order of the resulting splits to be left-to-right, whereas
74/// <see cref="EnumerateSplits(ReadOnlySpan{char}, string, RegexOptions, TimeSpan)"/> will yield the splits in the order they're found right-to-left.
90public static ValueSplitEnumerator EnumerateSplits(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
System\Text\RegularExpressions\Regex.Match.cs (4)
50public static bool IsMatch(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
66public static bool IsMatch(ReadOnlySpan<char> input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
131public static Match Match(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
187public static MatchCollection Matches(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, RegexOptions options, TimeSpan matchTimeout) =>
System\Text\RegularExpressions\Regex.Replace.cs (2)
30public static string Replace(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, string replacement, RegexOptions options, TimeSpan matchTimeout) =>
100public static string Replace(string input, [StringSyntax(StringSyntaxAttribute.Regex, nameof(options))] string pattern, MatchEvaluator evaluator, RegexOptions options, TimeSpan matchTimeout) =>
System.Threading (20)
System.Threading.RateLimiting (47)
System.Threading.Tasks.Dataflow (12)
Base\DataflowBlock.cs (10)
811/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
822this ISourceBlock<TOutput> source, TimeSpan timeout)
831/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
843this ISourceBlock<TOutput> source, TimeSpan timeout, CancellationToken cancellationToken)
890/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
902this ISourceBlock<TOutput> source, TimeSpan timeout)
911/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
925this ISourceBlock<TOutput> source, TimeSpan timeout, CancellationToken cancellationToken)
968/// <param name="timeout">A <see cref="System.TimeSpan"/> that represents the number of milliseconds to wait, or a TimeSpan that represents -1 milliseconds to wait indefinitely.</param>
972this ISourceBlock<TOutput> source, bool attemptTryReceive, TimeSpan timeout, CancellationToken cancellationToken)
System.Transactions.Local (48)
System\Transactions\TransactionScope.cs (20)
106public TransactionScope(TransactionScopeOption scopeOption, TimeSpan scopeTimeout)
113TimeSpan scopeTimeout,
124TimeSpan txTimeout = TransactionManager.ValidateTimeout(scopeTimeout);
134if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
141TimeSpan.Zero);
196TimeSpan scopeTimeout = transactionOptions.Timeout;
220if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
227TimeSpan.Zero);
276TimeSpan scopeTimeout = transactionOptions.Timeout;
302if ((null != _expectedCurrent) && (null == _committableTransaction) && (TimeSpan.Zero != scopeTimeout))
309TimeSpan.Zero);
366TimeSpan.Zero,
375public TransactionScope(Transaction transactionToUse, TimeSpan scopeTimeout)
382TimeSpan scopeTimeout,
406TimeSpan scopeTimeout,
466TimeSpan scopeTimeout,
475if (TimeSpan.Zero != scopeTimeout)
481TimeSpan.Zero
1123private static void ValidateScopeTimeout(string? paramName, TimeSpan scopeTimeout)
1125ArgumentOutOfRangeException.ThrowIfLessThan(scopeTimeout, TimeSpan.Zero, paramName);
System.Windows.Controls.Ribbon (7)
System.Windows.Forms.Tests (4)
System.Windows.Forms.UI.IntegrationTests (19)
System.Windows.Presentation (4)
System.Xaml (6)
System.Xaml.Tests (9)
System\Xaml\Replacements\DateTimeOffsetConverter2Tests.cs (5)
31DateTimeOffset dateTimeOffset = new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10));
71yield return new object?[] { new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10)), new CultureInfo("en-US") };
86var dateTimeOffset = new DateTimeOffset(2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10));
91Assert.Equal(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(TimeSpan) }, parameters.Select(p => p.ParameterType));
92Assert.Equal(new object[] { 2018, 12, 9, 1, 2, 3, 4, TimeSpan.FromMinutes(10) }, descriptor.Arguments);
Templates.Blazor.Tests (18)
Templates.Blazor.WebAssembly.Auth.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Blazor.WebAssembly.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Mvc.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Templates.Tests (34)
src\Shared\E2ETesting\WaitAssert.cs (11)
23public static TimeSpan DefaultTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultWaitTimeoutInSeconds);
24public static TimeSpan FailureTimeout = TimeSpan.FromSeconds(E2ETestOptions.Instance.DefaultAfterFailureWaitTimeoutInSeconds);
35public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout)
38public static void True(this IWebDriver driver, Func<bool> actual, TimeSpan timeout, string message)
64public static TElement Exists<TElement>(this IWebDriver driver, Func<TElement> actual, TimeSpan timeout)
67public static void DoesNotExist(this IWebDriver driver, By finder, TimeSpan timeout = default)
74public static IWebElement Exists(this IWebDriver driver, By finder, TimeSpan timeout)
89private static void WaitAssertCore(IWebDriver driver, Action assertion, TimeSpan timeout = default)
94private static TResult WaitAssertCore<TResult>(IWebDriver driver, Func<TResult> assertion, TimeSpan timeout = default)
Test.Utilities (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
TestProject.IntegrationServiceA (2)
Text.Analyzers (11)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Extensions\Symbols\ITypeSymbolExtensions.cs (1)
745or nameof(TimeSpan))
UnitTests.Common (101)
IMockCommunicationObject.cs (10)
15Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
16Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
18Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
19Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
20Action<TimeSpan> OnOpenOverride { get; set; }
21Action<TimeSpan> OnCloseOverride { get; set; }
34void DefaultOnOpen(TimeSpan timeout);
37void DefaultOnClose(TimeSpan timeout);
40IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state);
43IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state);
MockChannelBase.cs (20)
55public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
56public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
58public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
59public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
60public Action<TimeSpan> OnOpenOverride { get; set; }
61public Action<TimeSpan> OnCloseOverride { get; set; }
82protected override TimeSpan DefaultCloseTimeout
90public TimeSpan DefaultDefaultCloseTimeout()
92return TimeSpan.FromSeconds(30);
95protected override TimeSpan DefaultOpenTimeout
103public TimeSpan DefaultDefaultOpenTimeout()
105return TimeSpan.FromSeconds(30);
118protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
123public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
138protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
143public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
158protected override void OnClose(TimeSpan timeout)
163public void DefaultOnClose(TimeSpan timeout)
190protected override void OnOpen(TimeSpan timeout)
195public void DefaultOnOpen(TimeSpan timeout)
MockChannelFactory.cs (20)
54public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
55public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
57public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
58public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
59public Action<TimeSpan> OnOpenOverride { get; set; }
60public Action<TimeSpan> OnCloseOverride { get; set; }
84protected override TimeSpan DefaultCloseTimeout
92public TimeSpan DefaultDefaultCloseTimeout()
94return TimeSpan.FromSeconds(30);
97protected override TimeSpan DefaultOpenTimeout
105public TimeSpan DefaultDefaultOpenTimeout()
107return TimeSpan.FromSeconds(30);
120protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
125public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
139protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
144public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
158protected override void OnClose(TimeSpan timeout)
163public void DefaultOnClose(TimeSpan timeout)
188protected override void OnOpen(TimeSpan timeout)
193public void DefaultOnOpen(TimeSpan timeout)
MockCommunicationObject.cs (28)
50public Func<TimeSpan> DefaultCloseTimeoutOverride { get; set; }
51public Func<TimeSpan> DefaultOpenTimeoutOverride { get; set; }
53public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginCloseOverride { get; set; }
54public Func<TimeSpan, AsyncCallback, object, IAsyncResult> OnBeginOpenOverride { get; set; }
55public Action<TimeSpan> OnOpenOverride { get; set; }
56public Action<TimeSpan> OnCloseOverride { get; set; }
67protected override TimeSpan DefaultCloseTimeout
75public TimeSpan DefaultDefaultCloseTimeout()
77return TimeSpan.FromSeconds(30);
80protected override TimeSpan DefaultOpenTimeout
88public TimeSpan DefaultDefaultOpenTimeout()
90return TimeSpan.FromSeconds(30);
103protected override IAsyncResult OnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
108public IAsyncResult DefaultOnBeginClose(TimeSpan timeout, AsyncCallback callback, object state)
123protected override IAsyncResult OnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
129public IAsyncResult DefaultOnBeginOpen(TimeSpan timeout, AsyncCallback callback, object state)
144protected override void OnClose(TimeSpan timeout)
149public void DefaultOnClose(TimeSpan timeout)
176protected override void OnOpen(TimeSpan timeout)
181public void DefaultOnOpen(TimeSpan timeout)
247mco.OnOpenOverride = (TimeSpan t) =>
253mco.OnBeginOpenOverride = (TimeSpan t, AsyncCallback c, object s) =>
276mco.OnCloseOverride = (TimeSpan t) =>
282mco.OnBeginCloseOverride = (TimeSpan t, AsyncCallback c, object s) =>
330mco.OnOpenOverride = (TimeSpan t) =>
337mco.OnBeginOpenOverride = (TimeSpan t, AsyncCallback c, object s) =>
359mco.OnCloseOverride = (TimeSpan t) =>
366mco.OnBeginCloseOverride = (TimeSpan t, AsyncCallback c, object s) =>
MockRequestChannel.cs (6)
18public Func<Message, TimeSpan, Message> RequestOverride { get; set; }
19public Func<Message,TimeSpan,AsyncCallback,object, IAsyncResult> BeginRequestOverride { get; set; }
32public Message Request(Message message, TimeSpan timeout)
37public Message DefaultRequest(Message message, TimeSpan timeout)
49public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
59public IAsyncResult DefaultBeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
VBCSCompiler (19)
VBCSCompiler.UnitTests (17)
Wasm.Performance.ConsoleHost (1)
Wasm.Performance.Driver (5)
WindowsBase.Tests (30)
System\Windows\Threading\DispatcherTimerTests.cs (29)
15Assert.Equal(TimeSpan.Zero, timer.Interval);
35Assert.Equal(TimeSpan.Zero, timer.Interval);
55Assert.Equal(TimeSpan.Zero, timer.Interval);
62yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.ApplicationIdle };
63yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.Background };
64yield return new object?[] { TimeSpan.FromMilliseconds(int.MaxValue), DispatcherPriority.ContextIdle };
65yield return new object?[] { TimeSpan.FromMilliseconds(0), DispatcherPriority.DataBind };
66yield return new object?[] { TimeSpan.FromMilliseconds(1), DispatcherPriority.Input };
67yield return new object?[] { TimeSpan.FromMilliseconds(2), DispatcherPriority.Loaded };
68yield return new object?[] { TimeSpan.FromMilliseconds(3), DispatcherPriority.Normal };
69yield return new object?[] { TimeSpan.FromMilliseconds(4), DispatcherPriority.Render };
70yield return new object?[] { TimeSpan.FromMilliseconds(5), DispatcherPriority.Send };
71yield return new object?[] { TimeSpan.FromMilliseconds(6), DispatcherPriority.SystemIdle };
76public void Ctor_TimeSpan_DispatcherPriority_EventHandler_Dispatcher(TimeSpan interval, DispatcherPriority priority)
94Assert.Throws<InvalidEnumArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, priority, (s, e) => {}, Dispatcher.CurrentDispatcher));
102Assert.Throws<ArgumentException>("priority", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Inactive, (s, e) => {}, Dispatcher.CurrentDispatcher));
109Assert.Throws<ArgumentNullException>("dispatcher", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, (s, e) => {}, null));
114yield return new object[] { TimeSpan.FromTicks(-1) };
115yield return new object[] { TimeSpan.FromMilliseconds((double)int.MaxValue + 1) };
116yield return new object[] { TimeSpan.MinValue };
117yield return new object[] { TimeSpan.MaxValue };
122public void Ctor_InvalidInterval_ThrowsArgumentOutOfRangeException(TimeSpan interval)
130Assert.Throws<ArgumentNullException>("callback", () => new DispatcherTimer(TimeSpan.Zero, DispatcherPriority.Normal, null, Dispatcher.CurrentDispatcher));
155yield return new object[] { TimeSpan.Zero };
156yield return new object[] { TimeSpan.FromMilliseconds(1) };
157yield return new object[] { TimeSpan.FromMilliseconds(int.MaxValue) };
162public void Interval_Set_GetReturnsExpected(TimeSpan value)
177public void Interval_SetEnabled_GetReturnsExpected(TimeSpan value)
195public void Interval_SetInvalid_ThrowsArgumentOutOfRangeException(TimeSpan value)
xunit.assert (8)
EqualityAsserts.cs (8)
508 Equal(expected, actual, TimeSpan.Zero);
520 TimeSpan precision)
522 var difference = (expected - actual).Duration();
528 (precision == TimeSpan.Zero ? "" : string.Format(CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", difference, precision));
542 Equal(expected, actual, TimeSpan.Zero);
554 TimeSpan precision)
556 var difference = (expected - actual).Duration();
562 (precision == TimeSpan.Zero ? "" : string.Format(CultureInfo.CurrentCulture, " (difference {0} is larger than {1})", difference, precision));
xunit.console (1)