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