diff --git a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
index 8be8d278db..9a93a6f80b 100644
--- a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
+++ b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
@@ -3,6 +3,7 @@
netstandard2.0;$(DefaultNetCoreTargetFramework)
$(DefaultNetCoreTargetFramework)
+ annotations
diff --git a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netcoreapp.cs b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netcoreapp.cs
index 6166362745..3a8e37aca1 100644
--- a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netcoreapp.cs
+++ b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netcoreapp.cs
@@ -10,10 +10,10 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
}
public sealed partial class HealthCheckRegistration
{
- public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { }
- public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan? timeout) { }
- public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { }
- public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan? timeout) { }
+ public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags) { }
+ public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, System.TimeSpan? timeout) { }
+ public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags) { }
+ public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, System.TimeSpan? timeout) { }
public System.Func Factory { get { throw null; } set { } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus FailureStatus { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string Name { get { throw null; } set { } }
@@ -25,14 +25,14 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
{
private object _dummy;
private int _dummyPrimitive;
- public HealthCheckResult(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
+ public HealthCheckResult(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
public System.Collections.Generic.IReadOnlyDictionary Data { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public System.Exception Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string? Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Exception? Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus Status { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Degraded(string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Healthy(string description = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Unhealthy(string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Degraded(string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Healthy(string? description = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Unhealthy(string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
}
public sealed partial class HealthReport
{
@@ -46,12 +46,12 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
{
private object _dummy;
private int _dummyPrimitive;
- public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description, System.TimeSpan duration, System.Exception exception, System.Collections.Generic.IReadOnlyDictionary data) { throw null; }
- public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description, System.TimeSpan duration, System.Exception exception, System.Collections.Generic.IReadOnlyDictionary data, System.Collections.Generic.IEnumerable tags = null) { throw null; }
+ public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description, System.TimeSpan duration, System.Exception? exception, System.Collections.Generic.IReadOnlyDictionary? data) { throw null; }
+ public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description, System.TimeSpan duration, System.Exception? exception, System.Collections.Generic.IReadOnlyDictionary? data, System.Collections.Generic.IEnumerable? tags = null) { throw null; }
public System.Collections.Generic.IReadOnlyDictionary Data { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string? Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.TimeSpan Duration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public System.Exception Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Exception? Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus Status { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Collections.Generic.IEnumerable Tags { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
diff --git a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netstandard2.0.cs b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netstandard2.0.cs
index 6166362745..3a8e37aca1 100644
--- a/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netstandard2.0.cs
+++ b/src/HealthChecks/Abstractions/ref/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.netstandard2.0.cs
@@ -10,10 +10,10 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
}
public sealed partial class HealthCheckRegistration
{
- public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { }
- public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan? timeout) { }
- public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { }
- public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan? timeout) { }
+ public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags) { }
+ public HealthCheckRegistration(string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, System.TimeSpan? timeout) { }
+ public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags) { }
+ public HealthCheckRegistration(string name, System.Func factory, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, System.TimeSpan? timeout) { }
public System.Func Factory { get { throw null; } set { } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus FailureStatus { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string Name { get { throw null; } set { } }
@@ -25,14 +25,14 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
{
private object _dummy;
private int _dummyPrimitive;
- public HealthCheckResult(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
+ public HealthCheckResult(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
public System.Collections.Generic.IReadOnlyDictionary Data { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public System.Exception Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string? Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Exception? Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus Status { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Degraded(string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Healthy(string description = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
- public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Unhealthy(string description = null, System.Exception exception = null, System.Collections.Generic.IReadOnlyDictionary data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Degraded(string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Healthy(string? description = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
+ public static Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckResult Unhealthy(string? description = null, System.Exception? exception = null, System.Collections.Generic.IReadOnlyDictionary? data = null) { throw null; }
}
public sealed partial class HealthReport
{
@@ -46,12 +46,12 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
{
private object _dummy;
private int _dummyPrimitive;
- public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description, System.TimeSpan duration, System.Exception exception, System.Collections.Generic.IReadOnlyDictionary data) { throw null; }
- public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string description, System.TimeSpan duration, System.Exception exception, System.Collections.Generic.IReadOnlyDictionary data, System.Collections.Generic.IEnumerable tags = null) { throw null; }
+ public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description, System.TimeSpan duration, System.Exception? exception, System.Collections.Generic.IReadOnlyDictionary? data) { throw null; }
+ public HealthReportEntry(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus status, string? description, System.TimeSpan duration, System.Exception? exception, System.Collections.Generic.IReadOnlyDictionary? data, System.Collections.Generic.IEnumerable? tags = null) { throw null; }
public System.Collections.Generic.IReadOnlyDictionary Data { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public string Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public string? Description { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.TimeSpan Duration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
- public System.Exception Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public System.Exception? Exception { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus Status { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public System.Collections.Generic.IEnumerable Tags { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
diff --git a/src/HealthChecks/Abstractions/src/HealthCheckContext.cs b/src/HealthChecks/Abstractions/src/HealthCheckContext.cs
index 027451c0d2..afb0e282a0 100644
--- a/src/HealthChecks/Abstractions/src/HealthCheckContext.cs
+++ b/src/HealthChecks/Abstractions/src/HealthCheckContext.cs
@@ -1,4 +1,4 @@
-// Copyright (c) .NET Foundation. All rights reserved.
+// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
namespace Microsoft.Extensions.Diagnostics.HealthChecks
@@ -8,6 +8,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
///
/// Gets or sets the of the currently executing .
///
- public HealthCheckRegistration Registration { get; set; }
+ // This allows null values for convenience during unit testing. This is expected to be non-null when within application code.
+ public HealthCheckRegistration Registration { get; set; } = default!;
}
}
diff --git a/src/HealthChecks/Abstractions/src/HealthCheckRegistration.cs b/src/HealthChecks/Abstractions/src/HealthCheckRegistration.cs
index 8ee11e3195..b7f662645d 100644
--- a/src/HealthChecks/Abstractions/src/HealthCheckRegistration.cs
+++ b/src/HealthChecks/Abstractions/src/HealthCheckRegistration.cs
@@ -36,7 +36,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// is null, then will be reported.
///
/// A list of tags that can be used for filtering health checks.
- public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable tags)
+ public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable? tags)
: this(name, instance, failureStatus, tags, default)
{
}
@@ -52,7 +52,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
///
/// A list of tags that can be used for filtering health checks.
/// An optional representing the timeout of the check.
- public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable tags, TimeSpan? timeout)
+ public HealthCheckRegistration(string name, IHealthCheck instance, HealthStatus? failureStatus, IEnumerable? tags, TimeSpan? timeout)
{
if (name == null)
{
@@ -69,10 +69,10 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
throw new ArgumentOutOfRangeException(nameof(timeout));
}
- Name = name;
+ _name = name;
FailureStatus = failureStatus ?? HealthStatus.Unhealthy;
Tags = new HashSet(tags ?? Array.Empty(), StringComparer.OrdinalIgnoreCase);
- Factory = (_) => instance;
+ _factory = (_) => instance;
Timeout = timeout ?? System.Threading.Timeout.InfiniteTimeSpan;
}
@@ -90,7 +90,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
string name,
Func factory,
HealthStatus? failureStatus,
- IEnumerable tags)
+ IEnumerable? tags)
: this(name, factory, failureStatus, tags, default)
{
}
@@ -110,7 +110,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
string name,
Func factory,
HealthStatus? failureStatus,
- IEnumerable tags,
+ IEnumerable? tags,
TimeSpan? timeout)
{
if (name == null)
@@ -128,10 +128,10 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
throw new ArgumentOutOfRangeException(nameof(timeout));
}
- Name = name;
+ _name = name;
FailureStatus = failureStatus ?? HealthStatus.Unhealthy;
Tags = new HashSet(tags ?? Array.Empty(), StringComparer.OrdinalIgnoreCase);
- Factory = factory;
+ _factory = factory;
Timeout = timeout ?? System.Threading.Timeout.InfiniteTimeSpan;
}
diff --git a/src/HealthChecks/Abstractions/src/HealthCheckResult.cs b/src/HealthChecks/Abstractions/src/HealthCheckResult.cs
index 7f4522da19..16aca75586 100644
--- a/src/HealthChecks/Abstractions/src/HealthCheckResult.cs
+++ b/src/HealthChecks/Abstractions/src/HealthCheckResult.cs
@@ -14,14 +14,14 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
private static readonly IReadOnlyDictionary _emptyReadOnlyDictionary = new Dictionary();
///
- /// Creates a new with the specified values for ,
+ /// Creates a new with the specified values for ,
/// , , and .
///
/// A value indicating the status of the component that was checked.
/// A human-readable description of the status of the component that was checked.
/// An representing the exception that was thrown when checking for status (if any).
/// Additional key-value pairs describing the health of the component.
- public HealthCheckResult(HealthStatus status, string description = null, Exception exception = null, IReadOnlyDictionary data = null)
+ public HealthCheckResult(HealthStatus status, string? description = null, Exception? exception = null, IReadOnlyDictionary? data = null)
{
Status = status;
Description = description;
@@ -37,12 +37,12 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
///
/// Gets a human-readable description of the status of the component that was checked.
///
- public string Description { get; }
+ public string? Description { get; }
///
/// Gets an representing the exception that was thrown when checking for status (if any).
///
- public Exception Exception { get; }
+ public Exception? Exception { get; }
///
/// Gets a value indicating the status of the component that was checked.
@@ -55,7 +55,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// A human-readable description of the status of the component that was checked. Optional.
/// Additional key-value pairs describing the health of the component. Optional.
/// A representing a healthy component.
- public static HealthCheckResult Healthy(string description = null, IReadOnlyDictionary data = null)
+ public static HealthCheckResult Healthy(string? description = null, IReadOnlyDictionary? data = null)
{
return new HealthCheckResult(status: HealthStatus.Healthy, description, exception: null, data);
}
@@ -68,7 +68,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// An representing the exception that was thrown when checking for status. Optional.
/// Additional key-value pairs describing the health of the component. Optional.
/// A representing a degraged component.
- public static HealthCheckResult Degraded(string description = null, Exception exception = null, IReadOnlyDictionary data = null)
+ public static HealthCheckResult Degraded(string? description = null, Exception? exception = null, IReadOnlyDictionary? data = null)
{
return new HealthCheckResult(status: HealthStatus.Degraded, description, exception: exception, data);
}
@@ -80,7 +80,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// An representing the exception that was thrown when checking for status. Optional.
/// Additional key-value pairs describing the health of the component. Optional.
/// A representing an unhealthy component.
- public static HealthCheckResult Unhealthy(string description = null, Exception exception = null, IReadOnlyDictionary data = null)
+ public static HealthCheckResult Unhealthy(string? description = null, Exception? exception = null, IReadOnlyDictionary? data = null)
{
return new HealthCheckResult(status: HealthStatus.Unhealthy, description, exception, data);
}
diff --git a/src/HealthChecks/Abstractions/src/HealthReportEntry.cs b/src/HealthChecks/Abstractions/src/HealthReportEntry.cs
index 043c1414a4..0622fd1b47 100644
--- a/src/HealthChecks/Abstractions/src/HealthReportEntry.cs
+++ b/src/HealthChecks/Abstractions/src/HealthReportEntry.cs
@@ -23,7 +23,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// A value indicating the health execution duration.
/// An representing the exception that was thrown when checking for status (if any).
/// Additional key-value pairs describing the health of the component.
- public HealthReportEntry(HealthStatus status, string description, TimeSpan duration, Exception exception, IReadOnlyDictionary data)
+ public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary? data)
: this(status, description, duration, exception, data, null)
{
}
@@ -38,7 +38,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
/// An representing the exception that was thrown when checking for status (if any).
/// Additional key-value pairs describing the health of the component.
/// Tags associated with the health check that generated the report entry.
- public HealthReportEntry(HealthStatus status, string description, TimeSpan duration, Exception exception, IReadOnlyDictionary data, IEnumerable tags = null)
+ public HealthReportEntry(HealthStatus status, string? description, TimeSpan duration, Exception? exception, IReadOnlyDictionary? data, IEnumerable? tags = null)
{
Status = status;
Description = description;
@@ -57,7 +57,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
///
/// Gets a human-readable description of the status of the component that was checked.
///
- public string Description { get; }
+ public string? Description { get; }
///
/// Gets the health check execution duration.
@@ -67,7 +67,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
///
/// Gets an representing the exception that was thrown when checking for status (if any).
///
- public Exception Exception { get; }
+ public Exception? Exception { get; }
///
/// Gets the health status of the component that was checked.
diff --git a/src/HealthChecks/Abstractions/src/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj b/src/HealthChecks/Abstractions/src/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
index 659c39adc1..9575431a56 100644
--- a/src/HealthChecks/Abstractions/src/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
+++ b/src/HealthChecks/Abstractions/src/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions.csproj
@@ -1,4 +1,4 @@
-
+
Abstractions for defining health checks in .NET applications
@@ -14,6 +14,7 @@ Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck
diagnostics;healthchecks
true
true
+ enable
diff --git a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.csproj b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.csproj
index 4f83bbda83..076213fc3b 100644
--- a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.csproj
+++ b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.csproj
@@ -3,6 +3,7 @@
netstandard2.0;$(DefaultNetCoreTargetFramework)
$(DefaultNetCoreTargetFramework)
+ annotations
diff --git a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netcoreapp.cs b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netcoreapp.cs
index cee2d1420e..4a2f8dc0c8 100644
--- a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netcoreapp.cs
+++ b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netcoreapp.cs
@@ -6,10 +6,10 @@ namespace Microsoft.Extensions.DependencyInjection
public static partial class HealthChecksBuilderAddCheckExtensions
{
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan timeout, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
@@ -17,13 +17,13 @@ namespace Microsoft.Extensions.DependencyInjection
public static partial class HealthChecksBuilderDelegateExtensions
{
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
}
public static partial class HealthCheckServiceCollectionExtensions
{
@@ -42,13 +42,13 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
public HealthCheckPublisherOptions() { }
public System.TimeSpan Delay { get { throw null; } set { } }
public System.TimeSpan Period { get { throw null; } set { } }
- public System.Func Predicate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Func? Predicate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public System.TimeSpan Timeout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public abstract partial class HealthCheckService
{
protected HealthCheckService() { }
- public abstract System.Threading.Tasks.Task CheckHealthAsync(System.Func predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ public abstract System.Threading.Tasks.Task CheckHealthAsync(System.Func? predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public System.Threading.Tasks.Task CheckHealthAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public sealed partial class HealthCheckServiceOptions
diff --git a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netstandard2.0.cs b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netstandard2.0.cs
index cee2d1420e..4a2f8dc0c8 100644
--- a/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netstandard2.0.cs
+++ b/src/HealthChecks/HealthChecks/ref/Microsoft.Extensions.Diagnostics.HealthChecks.netstandard2.0.cs
@@ -6,10 +6,10 @@ namespace Microsoft.Extensions.DependencyInjection
public static partial class HealthChecksBuilderAddCheckExtensions
{
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck instance, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default(Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus?), System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable? tags, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, System.Collections.Generic.IEnumerable tags, System.TimeSpan timeout, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTypeActivatedCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, params object[] args) where T : class, Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { throw null; }
@@ -17,13 +17,13 @@ namespace Microsoft.Extensions.DependencyInjection
public static partial class HealthChecksBuilderDelegateExtensions
{
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddAsyncCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func> check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags) { throw null; }
- public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags) { throw null; }
+ public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddCheck(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Func check, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default(System.TimeSpan?)) { throw null; }
}
public static partial class HealthCheckServiceCollectionExtensions
{
@@ -42,13 +42,13 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
public HealthCheckPublisherOptions() { }
public System.TimeSpan Delay { get { throw null; } set { } }
public System.TimeSpan Period { get { throw null; } set { } }
- public System.Func Predicate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
+ public System.Func? Predicate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public System.TimeSpan Timeout { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
}
public abstract partial class HealthCheckService
{
protected HealthCheckService() { }
- public abstract System.Threading.Tasks.Task CheckHealthAsync(System.Func predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ public abstract System.Threading.Tasks.Task CheckHealthAsync(System.Func? predicate, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
public System.Threading.Tasks.Task CheckHealthAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
}
public sealed partial class HealthCheckServiceOptions
diff --git a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs
index f2dcc4f5b7..87461ce3c0 100644
--- a/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs
+++ b/src/HealthChecks/HealthChecks/src/DefaultHealthCheckService.cs
@@ -36,7 +36,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
ValidateRegistrations(_options.Value.Registrations);
}
public override async Task CheckHealthAsync(
- Func predicate,
+ Func? predicate,
CancellationToken cancellationToken = default)
{
var registrations = _options.Value.Registrations;
@@ -89,7 +89,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
Log.HealthCheckBegin(_logger, registration);
HealthReportEntry entry;
- CancellationTokenSource timeoutCancellationTokenSource = null;
+ CancellationTokenSource? timeoutCancellationTokenSource = null;
try
{
HealthCheckResult result;
@@ -183,17 +183,17 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
private static class Log
{
- private static readonly Action _healthCheckProcessingBegin = LoggerMessage.Define(
+ private static readonly Action _healthCheckProcessingBegin = LoggerMessage.Define(
LogLevel.Debug,
EventIds.HealthCheckProcessingBegin,
"Running health checks");
- private static readonly Action _healthCheckProcessingEnd = LoggerMessage.Define(
+ private static readonly Action _healthCheckProcessingEnd = LoggerMessage.Define(
LogLevel.Debug,
EventIds.HealthCheckProcessingEnd,
"Health check processing completed after {ElapsedMilliseconds}ms with combined status {HealthStatus}");
- private static readonly Action _healthCheckBegin = LoggerMessage.Define(
+ private static readonly Action _healthCheckBegin = LoggerMessage.Define(
LogLevel.Debug,
EventIds.HealthCheckBegin,
"Running health check {HealthCheckName}");
@@ -201,27 +201,27 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
// These are separate so they can have different log levels
private static readonly string HealthCheckEndText = "Health check {HealthCheckName} completed after {ElapsedMilliseconds}ms with status {HealthStatus} and description '{HealthCheckDescription}'";
- private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define(
+ private static readonly Action _healthCheckEndHealthy = LoggerMessage.Define(
LogLevel.Debug,
EventIds.HealthCheckEnd,
HealthCheckEndText);
- private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define(
+ private static readonly Action _healthCheckEndDegraded = LoggerMessage.Define(
LogLevel.Warning,
EventIds.HealthCheckEnd,
HealthCheckEndText);
- private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define(
+ private static readonly Action _healthCheckEndUnhealthy = LoggerMessage.Define(
LogLevel.Error,
EventIds.HealthCheckEnd,
HealthCheckEndText);
- private static readonly Action _healthCheckEndFailed = LoggerMessage.Define(
+ private static readonly Action _healthCheckEndFailed = LoggerMessage.Define(
LogLevel.Error,
EventIds.HealthCheckEnd,
HealthCheckEndText);
- private static readonly Action _healthCheckError = LoggerMessage.Define(
+ private static readonly Action _healthCheckError = LoggerMessage.Define(
LogLevel.Error,
EventIds.HealthCheckError,
"Health check {HealthCheckName} threw an unhandled exception after {ElapsedMilliseconds}ms");
@@ -283,7 +283,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
private readonly string _name;
private readonly List> _values;
- private string _formatted;
+ private string? _formatted;
public HealthCheckDataLogValue(string name, IReadOnlyDictionary values)
{
diff --git a/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderAddCheckExtensions.cs b/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderAddCheckExtensions.cs
index 51b7815438..0f280d9b68 100644
--- a/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderAddCheckExtensions.cs
+++ b/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderAddCheckExtensions.cs
@@ -53,7 +53,7 @@ namespace Microsoft.Extensions.DependencyInjection
string name,
IHealthCheck instance,
HealthStatus? failureStatus = null,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = null)
{
if (builder == null)
@@ -125,7 +125,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
HealthStatus? failureStatus = null,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = null) where T : class, IHealthCheck
{
if (builder == null)
@@ -227,7 +227,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
HealthStatus? failureStatus,
- IEnumerable tags,
+ IEnumerable? tags,
params object[] args) where T : class, IHealthCheck
{
if (builder == null)
diff --git a/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderDelegateExtensions.cs b/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderDelegateExtensions.cs
index ba27ab5554..0419d0c3b2 100644
--- a/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderDelegateExtensions.cs
+++ b/src/HealthChecks/HealthChecks/src/DependencyInjection/HealthChecksBuilderDelegateExtensions.cs
@@ -45,7 +45,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
Func check,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = default)
{
if (builder == null)
@@ -80,7 +80,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
Func check,
- IEnumerable tags)
+ IEnumerable? tags)
{
return AddCheck(builder, name, check, tags, default);
}
@@ -98,7 +98,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
Func check,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = default)
{
if (builder == null)
@@ -151,7 +151,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
Func> check,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = default)
{
if (builder == null)
@@ -204,7 +204,7 @@ namespace Microsoft.Extensions.DependencyInjection
this IHealthChecksBuilder builder,
string name,
Func> check,
- IEnumerable tags = null,
+ IEnumerable? tags = null,
TimeSpan? timeout = default)
{
if (builder == null)
diff --git a/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs b/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs
index 6a24d4c4a3..4da7a52bee 100644
--- a/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs
+++ b/src/HealthChecks/HealthChecks/src/HealthCheckPublisherHostedService.cs
@@ -21,8 +21,8 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
private readonly IHealthCheckPublisher[] _publishers;
private CancellationTokenSource _stopping;
- private Timer _timer;
- private CancellationTokenSource _runTokenSource;
+ private Timer? _timer;
+ private CancellationTokenSource? _runTokenSource;
public HealthCheckPublisherHostedService(
HealthCheckService healthCheckService,
@@ -100,7 +100,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
}
// Yes, async void. We need to be async. We need to be void. We handle the exceptions in RunAsync
- private async void Timer_Tick(object state)
+ private async void Timer_Tick(object? state)
{
await RunAsync();
}
@@ -108,7 +108,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
// Internal for testing
internal void CancelToken()
{
- _runTokenSource.Cancel();
+ _runTokenSource!.Cancel();
}
// Internal for testing
@@ -117,7 +117,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
var duration = ValueStopwatch.StartNew();
Logger.HealthCheckPublisherProcessingBegin(_logger);
- CancellationTokenSource cancellation = null;
+ CancellationTokenSource? cancellation = null;
try
{
var timeout = _options.Value.Timeout;
@@ -142,7 +142,7 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
}
finally
{
- cancellation.Dispose();
+ cancellation?.Dispose();
}
}
@@ -206,32 +206,32 @@ namespace Microsoft.Extensions.Diagnostics.HealthChecks
private static class Logger
{
- private static readonly Action _healthCheckPublisherProcessingBegin = LoggerMessage.Define(
+ private static readonly Action _healthCheckPublisherProcessingBegin = LoggerMessage.Define(
LogLevel.Debug,
EventIds.HealthCheckPublisherProcessingBegin,
"Running health check publishers");
- private static readonly Action