4 instantiations of ValidateOptionsResult
Microsoft.Extensions.Options (4)
ValidateOptionsResult.cs (4)
18
public static readonly ValidateOptionsResult Skip = new
ValidateOptionsResult
() { Skipped = true };
23
public static readonly ValidateOptionsResult Success = new
ValidateOptionsResult
() { Succeeded = true };
64
=> new
ValidateOptionsResult
{ Failed = true, FailureMessage = failureMessage, Failures = new string[] { failureMessage } };
72
=> new
ValidateOptionsResult
{ Failed = true, FailureMessage = string.Join("; ", failures), Failures = failures };
151 references to ValidateOptionsResult
Aspire.Dashboard (4)
Configuration\ValidateDashboardOptions.cs (3)
23
public
ValidateOptionsResult
Validate(string? name, DashboardOptions options)
148
?
ValidateOptionsResult
.Fail(errorMessages)
149
:
ValidateOptionsResult
.Success;
DashboardWebApplication.cs (1)
487
var
result = new ValidateDashboardOptions().Validate(name: string.Empty, dashboardOptions);
Aspire.Dashboard.Tests (18)
DashboardOptionsTests.cs (18)
33
var
result = new ValidateDashboardOptions().Validate(null, GetValidOptions());
47
var
result = new ValidateDashboardOptions().Validate(null, options);
59
var
result = new ValidateDashboardOptions().Validate(null, options);
71
var
result = new ValidateDashboardOptions().Validate(null, options);
85
var
result = new ValidateDashboardOptions().Validate(null, options);
101
var
result = new ValidateDashboardOptions().Validate(null, options);
115
var
result = new ValidateDashboardOptions().Validate(null, options);
130
var
result = new ValidateDashboardOptions().Validate(null, options);
145
var
result = new ValidateDashboardOptions().Validate(null, options);
159
var
result = new ValidateDashboardOptions().Validate(null, options);
173
var
result = new ValidateDashboardOptions().Validate(null, options);
186
var
result = new ValidateDashboardOptions().Validate(null, options);
199
var
result = new ValidateDashboardOptions().Validate(null, options);
216
var
result = new ValidateDashboardOptions().Validate(null, options);
230
var
result = new ValidateDashboardOptions().Validate(null, options);
242
var
result = new ValidateDashboardOptions().Validate(null, options);
259
var
result = new ValidateDashboardOptions().Validate(null, options);
272
var
result = new ValidateDashboardOptions().Validate(null, options);
Aspire.Hosting (20)
Dashboard\DashboardOptions.cs (1)
39
public
ValidateOptionsResult
Validate(string? name, DashboardOptions options)
Dashboard\ResourceServiceOptions.cs (3)
44
public
ValidateOptionsResult
Validate(string? name, ResourceServiceOptions options)
57
?
ValidateOptionsResult
.Fail(errorMessages)
58
:
ValidateOptionsResult
.Success;
Dashboard\TransportOptionsValidator.cs (15)
12
public
ValidateOptionsResult
Validate(string? name, TransportOptions transportOptions)
18
return
ValidateOptionsResult
.Success;
25
return
ValidateOptionsResult
.Fail($"AppHost does not have applicationUrl in launch profile, or {KnownConfigNames.AspNetCoreUrls} environment variable set.");
32
return
ValidateOptionsResult
.Fail($"The 'applicationUrl' setting of the launch profile has value '{firstApplicationUrl}' which could not be parsed as a URI.");
37
return
ValidateOptionsResult
.Fail($"The 'applicationUrl' setting must be an https address unless the '{KnownConfigNames.AllowUnsecuredTransport}' environment variable is set to true. This configuration is commonly set in the launch profile. See https://aka.ms/dotnet/aspire/allowunsecuredtransport for more details.");
45
return
ValidateOptionsResult
.Fail($"AppHost does not have the {KnownConfigNames.DashboardOtlpGrpcEndpointUrl} or {KnownConfigNames.DashboardOtlpHttpEndpointUrl} settings defined. At least one OTLP endpoint must be provided.");
48
if (!TryValidateGrpcEndpointUrl(KnownConfigNames.DashboardOtlpGrpcEndpointUrl, dashboardOtlpGrpcEndpointUrl, out
var
resultGrpc))
52
if (!TryValidateGrpcEndpointUrl(KnownConfigNames.DashboardOtlpHttpEndpointUrl, dashboardOtlpHttpEndpointUrl, out
var
resultHttp))
61
return
ValidateOptionsResult
.Fail($"AppHost does not have the {KnownConfigNames.ResourceServiceEndpointUrl} setting defined.");
66
return
ValidateOptionsResult
.Fail($"The {KnownConfigNames.ResourceServiceEndpointUrl} setting with a value of '{resourceServiceEndpointUrl}' could not be parsed as a URI.");
71
return
ValidateOptionsResult
.Fail($"The '{KnownConfigNames.ResourceServiceEndpointUrl}' setting must be an https address unless the '{KnownConfigNames.AllowUnsecuredTransport}' environment variable is set to true. This configuration is commonly set in the launch profile. See https://aka.ms/dotnet/aspire/allowunsecuredtransport for more details.");
74
return
ValidateOptionsResult
.Success;
76
static bool TryValidateGrpcEndpointUrl(string configName, string? value, [NotNullWhen(false)] out
ValidateOptionsResult
? result)
82
result =
ValidateOptionsResult
.Fail($"The {configName} setting with a value of '{value}' could not be parsed as a URI.");
88
result =
ValidateOptionsResult
.Fail($"The '{configName}' setting must be an https address unless the '{KnownConfigNames.AllowUnsecuredTransport}' environment variable is set to true. This configuration is commonly set in the launch profile. See https://aka.ms/dotnet/aspire/allowunsecuredtransport for more details.");
Dcp\DcpOptions.cs (1)
82
public
ValidateOptionsResult
Validate(string? name, DcpOptions options)
Aspire.Hosting.Tests (16)
Dashboard\TransportOptionsValidatorTests.cs (16)
24
var
result = validator.Validate(null, options);
44
var
result = validator.Validate(null, options);
62
var
result = validator.Validate(null, options);
80
var
result = validator.Validate(null, options);
97
var
result = validator.Validate(null, options);
116
var
result = validator.Validate(null, options);
136
var
result = validator.Validate(null, options);
158
var
result = validator.Validate(null, options);
180
var
result = validator.Validate(null, options);
203
var
result = validator.Validate(null, options);
228
var
result = validator.Validate(null, options);
252
var
result = validator.Validate(null, options);
274
var
result = validator.Validate(null, options);
294
var
result = validator.Validate(null, options);
310
var
result = validator.Validate(null, options);
328
var
result = validator.Validate(null, options);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (1)
Latency\RequestLatencyTelemetryOptionsValidatorTests.cs (1)
25
var
validationResult = validator.Validate(nameof(RequestLatencyTelemetryOptions), options);
Microsoft.AspNetCore.HeaderParsing (1)
HeaderParsingOptionsManualValidator.cs (1)
10
public
ValidateOptionsResult
Validate(string? name, HeaderParsingOptions options)
Microsoft.Extensions.AmbientMetadata.Application.Tests (1)
ApplicationMetadataValidatorTests.cs (1)
23
var
result = validator.Validate(
Microsoft.Extensions.Compliance.Testing (2)
FakeRedactor.cs (1)
44
var
r = validator.Validate(nameof(options), opt.Value);
FakeRedactorOptionsCustomValidator.cs (1)
14
public
ValidateOptionsResult
Validate(string? name, FakeRedactorOptions options)
Microsoft.Extensions.Compliance.Testing.Tests (2)
FakeRedactorOptionsValidatorTests.cs (2)
19
var
validationResult = validator.Validate(string.Empty, options);
40
var
validationResult = validator.Validate(string.Empty, options);
Microsoft.Extensions.Diagnostics.Probes (1)
KubernetesProbesOptionsValidator.cs (1)
10
public
ValidateOptionsResult
Validate(string? name, KubernetesProbesOptions options)
Microsoft.Extensions.Diagnostics.Probes.Tests (3)
KubernetesProbesOptionsValidatorTests.cs (3)
19
ValidateOptionsResult
result = new KubernetesProbesOptionsValidator().Validate(nameof(options), options);
32
ValidateOptionsResult
result = new KubernetesProbesOptionsValidator().Validate(nameof(options), options);
46
ValidateOptionsResult
result = validator.Validate(nameof(options), options);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (1)
ResourceMonitoringOptionsCustomValidator.cs (1)
12
public
ValidateOptionsResult
Validate(string? name, ResourceMonitoringOptions options)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (3)
ResourceMonitoringOptionsCustomValidatorTests.cs (3)
25
var
result = validator.Validate("", options);
38
var
result = validator.Validate("", options);
69
var
validationResult = validator.Validate(nameof(options), options);
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Logging\LoggingOptionsValidatorTest.cs (1)
25
var
result = validator.Validate("model", new LoggingOptions());
Microsoft.Extensions.Http.Resilience (2)
Hedging\Internals\Validators\HttpStandardHedgingResilienceOptionsCustomValidator.cs (1)
13
public
ValidateOptionsResult
Validate(string? name, HttpStandardHedgingResilienceOptions options)
Resilience\Internal\Validators\HttpStandardResilienceOptionsCustomValidator.cs (1)
13
public
ValidateOptionsResult
Validate(string? name, HttpStandardResilienceOptions options)
Microsoft.Extensions.Http.Resilience.Tests (8)
Hedging\HttpStandardHedgingResilienceOptionsCustomValidatorTests.cs (4)
22
var
validationResult = CreateValidator().Validate("dummy", options);
36
var
validationResult = CreateValidator().Validate("dummy", options);
72
var
validationResult = CreateValidator().Validate("dummy", options);
101
var
validationResult = CreateValidator().Validate("dummy", options);
Resilience\HttpStandardResilienceOptionsCustomValidatorTests.cs (4)
28
var
validationResult = new HttpStandardResilienceOptionsCustomValidator().Validate(string.Empty, options);
42
var
validationResult = new HttpStandardResilienceOptionsCustomValidator().Validate(string.Empty, options);
73
var
validationResult = new HttpStandardResilienceOptionsCustomValidator().Validate(string.Empty, options);
102
var
validationResult = new HttpStandardResilienceOptionsCustomValidator().Validate(string.Empty, options);
Microsoft.Extensions.Options (50)
IStartupValidator.cs (1)
17
/// <exception cref="OptionsValidationException">One or more <see cref="IValidateOptions{TOptions}"/> return failed <see cref="
ValidateOptionsResult
"/> when validating.</exception>
IValidateOptions.cs (2)
17
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
18
ValidateOptionsResult
Validate(string? name, TOptions options);
OptionsFactory.cs (2)
53
/// <exception cref="OptionsValidationException">One or more <see cref="IValidateOptions{TOptions}"/> return failed <see cref="
ValidateOptionsResult
"/> when validating the <typeparamref name="TOptions"/> instance created.</exception>
79
ValidateOptionsResult
result = validate.Validate(name, options);
OptionsManager.cs (1)
40
/// <exception cref="OptionsValidationException">One or more <see cref="IValidateOptions{TOptions}"/> return failed <see cref="
ValidateOptionsResult
"/> when validating the <typeparamref name="TOptions"/> instance created.</exception>
OptionsMonitor.cs (2)
75
/// <exception cref="OptionsValidationException">One or more <see cref="IValidateOptions{TOptions}"/> return failed <see cref="
ValidateOptionsResult
"/> when validating the <typeparamref name="TOptions"/> instance created.</exception>
87
/// <exception cref="OptionsValidationException">One or more <see cref="IValidateOptions{TOptions}"/> return failed <see cref="
ValidateOptionsResult
"/> when validating the <typeparamref name="TOptions"/> instance created.</exception>
ValidateOptions.cs (30)
49
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
50
public
ValidateOptionsResult
Validate(string? name, TOptions options)
57
return
ValidateOptionsResult
.Success;
59
return
ValidateOptionsResult
.Fail(FailureMessage);
63
return
ValidateOptionsResult
.Skip;
116
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
117
public
ValidateOptionsResult
Validate(string? name, TOptions options)
124
return
ValidateOptionsResult
.Success;
126
return
ValidateOptionsResult
.Fail(FailureMessage);
130
return
ValidateOptionsResult
.Skip;
191
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
192
public
ValidateOptionsResult
Validate(string? name, TOptions options)
199
return
ValidateOptionsResult
.Success;
201
return
ValidateOptionsResult
.Fail(FailureMessage);
205
return
ValidateOptionsResult
.Skip;
274
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
275
public
ValidateOptionsResult
Validate(string? name, TOptions options)
282
return
ValidateOptionsResult
.Success;
284
return
ValidateOptionsResult
.Fail(FailureMessage);
288
return
ValidateOptionsResult
.Skip;
365
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
366
public
ValidateOptionsResult
Validate(string? name, TOptions options)
373
return
ValidateOptionsResult
.Success;
375
return
ValidateOptionsResult
.Fail(FailureMessage);
379
return
ValidateOptionsResult
.Skip;
464
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
465
public
ValidateOptionsResult
Validate(string? name, TOptions options)
472
return
ValidateOptionsResult
.Success;
474
return
ValidateOptionsResult
.Fail(FailureMessage);
478
return
ValidateOptionsResult
.Skip;
ValidateOptionsResult.cs (4)
18
public static readonly
ValidateOptionsResult
Skip = new ValidateOptionsResult() { Skipped = true };
23
public static readonly
ValidateOptionsResult
Success = new ValidateOptionsResult() { Succeeded = true };
63
public static
ValidateOptionsResult
Fail(string failureMessage)
71
public static
ValidateOptionsResult
Fail(IEnumerable<string> failures)
ValidateOptionsResultBuilder.cs (8)
13
/// Builds <see cref="
ValidateOptionsResult
"/> with support for multiple error messages.
69
/// Adds any validation errors carried by the <see cref="
ValidateOptionsResult
"/> instance to this instance.
72
public void AddResult(
ValidateOptionsResult
result)
98
/// Builds <see cref="
ValidateOptionsResult
"/> based on provided data.
100
/// <returns>A new instance of <see cref="
ValidateOptionsResult
"/>.</returns>
101
public
ValidateOptionsResult
Build()
105
return
ValidateOptionsResult
.Fail(_errors);
108
return
ValidateOptionsResult
.Success;
Microsoft.Extensions.Options.Contextual (1)
Internal\ContextualOptionsFactory.cs (1)
137
ValidateOptionsResult
result = validate.Validate(name, options);
Microsoft.Extensions.Options.DataAnnotations (5)
DataAnnotationValidateOptions.cs (5)
43
/// <returns>The <see cref="
ValidateOptionsResult
"/> result.</returns>
46
public
ValidateOptionsResult
Validate(string? name, TOptions options)
52
return
ValidateOptionsResult
.Skip;
64
return
ValidateOptionsResult
.Success;
69
return
ValidateOptionsResult
.Fail(errors);
Microsoft.Extensions.ServiceDiscovery (7)
Configuration\ConfigurationServiceEndpointProviderOptionsValidator.cs (4)
10
public
ValidateOptionsResult
Validate(string? name, ConfigurationServiceEndpointProviderOptions options)
14
return
ValidateOptionsResult
.Fail($"{nameof(options.SectionName)} must not be null or empty.");
19
return
ValidateOptionsResult
.Fail($"{nameof(options.ShouldApplyHostNameMetadata)} must not be null.");
22
return
ValidateOptionsResult
.Success;
Internal\ServiceDiscoveryOptionsValidator.cs (3)
10
public
ValidateOptionsResult
Validate(string? name, ServiceDiscoveryOptions options)
14
return
ValidateOptionsResult
.Fail("At least one allowed scheme must be specified.");
17
return
ValidateOptionsResult
.Success;
Microsoft.Extensions.Telemetry.Tests (4)
Logging\LoggerEnrichmentOptionsTests.cs (4)
36
Assert.Equal(
ValidateOptionsResult
.Success, v.Validate(null, o));
39
Assert.Equal(
ValidateOptionsResult
.Success, v.Validate(null, o));
42
Assert.NotEqual(
ValidateOptionsResult
.Success, v.Validate(null, o));
45
Assert.NotEqual(
ValidateOptionsResult
.Success, v.Validate(null, o));