2778 references to FromResult
ApiExplorerWebSite (7)
Controllers\ApiExplorerResponseTypeWithAttributeController.cs (1)
41return Task.FromResult(true);
Controllers\ApiExplorerResponseTypeWithoutAttributeController.cs (6)
52return Task.FromResult(true); 58return Task.FromResult<object>(null); 64return Task.FromResult<IActionResult>(new EmptyResult()); 70return Task.FromResult(new ObjectResult(null)); 76return Task.FromResult<Product>(null); 82return Task.FromResult<int>(0);
aspire (9)
Backchannel\ExtensionRpcTarget.cs (2)
38return Task.FromResult(VersionHelper.GetDefaultTemplateVersion()); 48return Task.FromResult(ValidationFunction?.Invoke(input));
Commands\AddCommand.cs (1)
321Action: ct => Task.FromResult(captured)
Commands\ConfigCommand.cs (1)
52return Task.FromResult(ExitCodeConstants.InvalidCommand);
Commands\ExtensionInternalCommand.cs (1)
26return Task.FromResult(ExitCodeConstants.Success);
Commands\NewCommand.cs (1)
213Action: ct => Task.FromResult((captured.Package, captured.Channel))
Configuration\ConfigurationService.cs (1)
251return Task.FromResult(configuration[configKey]);
Packaging\PackagingService.cs (1)
55return Task.FromResult<IEnumerable<PackageChannel>>(channels);
Templating\DotNetTemplateFactory.cs (1)
214return await ApplyTemplateAsync(template, parseResult, (_, _) => Task.FromResult(Array.Empty<string>()), cancellationToken);
Aspire.Azure.AI.OpenAI.Tests (2)
AspireAzureOpenAIClientBuilderChatClientExtensionsTests.cs (1)
221=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
AspireAzureOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
224return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(inputs.Select(i => new Embedding<float>(floats))));
Aspire.Cli.Tests (82)
Commands\AddCommandTests.cs (4)
551{ } callback => Task.FromResult(callback(packages)), 552_ => Task.FromResult(packages.First()) // If no callback is provided just accept the first package. 560{ } callback => Task.FromResult(callback(packages)), 561_ => Task.FromResult(packages.First()) // If no callback is provided just accept the first package.
Commands\DeployCommandTests.cs (2)
269{ } callback => Task.FromResult(callback(publishers)), 270_ => Task.FromResult(publishers.First()) // Default to the first publisher if no callback is provided.
Commands\ExecCommandTests.cs (2)
154return Task.FromResult(0); 189return Task.FromResult(new List<FileInfo>
Commands\NewCommandTests.cs (8)
517{ } callback => Task.FromResult(callback(validTemplates)), 518_ => Task.FromResult(validTemplates[0]) // If no callback is provided just accept the first template. 526{ } callback => Task.FromResult(callback(defaultName)), 527_ => Task.FromResult(defaultName) // If no callback is provided just accept the default. 535{ } callback => Task.FromResult(callback(path)), 536_ => Task.FromResult(path) // If no callback is provided just accept the default. 544{ } callback => Task.FromResult(callback(candidatePackages)), 545_ => Task.FromResult(candidatePackages.First()) // If no callback is provided just accept the first package.
Commands\PublishCommandPromptingIntegrationTests.cs (8)
673Task.FromResult(new DashboardUrlsState 691public Task<string[]> GetCapabilitiesAsync(CancellationToken cancellationToken) => Task.FromResult(new[] { "baseline.v2" }); 746return Task.FromResult(response.response); 749return Task.FromResult(defaultValue ?? string.Empty); 765return Task.FromResult(matchingChoice); 769return Task.FromResult(choices.First()); 783return Task.FromResult(bool.Parse(response.response)); 786return Task.FromResult(defaultValue);
Commands\PublishCommandTests.cs (2)
243{ } callback => Task.FromResult(callback(publishers)), 244_ => Task.FromResult(publishers.First()) // Default to the first publisher if no callback is provided.
Commands\RunCommandTests.cs (4)
161return Task.FromResult(new List<FileInfo> 322return Task.FromResult(new DashboardUrlsState 419extensionBackchannel.GetCapabilitiesAsyncCallback = ct => Task.FromResult(new[] { "devkit" }); 422appHostBackchannel.GetDashboardUrlsAsyncCallback = (ct) => Task.FromResult(new DashboardUrlsState
Commands\UpdateCommandTests.cs (3)
22return Task.FromResult<IEnumerable<PackageChannel>>([]); 31=> Task.FromResult<FileInfo?>(_projectFile); 44return Task.FromResult<List<FileInfo>>([_projectFile]);
DotNet\DotNetCliRunnerTests.cs (2)
369HasCapabilityAsyncCallback = (c, _) => Task.FromResult(c is "devkit" or "project"), 419return Task.FromResult(exitCode);
Interaction\ConsoleInteractionServiceTests.cs (1)
176var actualResult = await interactionService.ShowStatusAsync(statusText, () => Task.FromResult(result));
NuGet\NuGetPackagePrefetcherTests.cs (2)
111return Task.FromResult(0); 126return Task.FromResult(0);
Packaging\NuGetConfigMergerTests.cs (4)
31_ = workingDirectory; _ = prerelease; _ = nugetConfigFile; _ = cancellationToken; return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>([]); 35_ = workingDirectory; _ = prerelease; _ = nugetConfigFile; _ = cancellationToken; return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>([]); 39_ = workingDirectory; _ = prerelease; _ = nugetConfigFile; _ = cancellationToken; return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>([]); 43_ = workingDirectory; _ = packageId; _ = filter; _ = prerelease; _ = nugetConfigFile; _ = cancellationToken; return Task.FromResult<IEnumerable<Aspire.Shared.NuGetPackageCli>>([]);
Projects\ProjectLocatorTests.cs (3)
344return Task.FromResult(false); 349return Task.FromResult(new Dictionary<string, string>()); 355return Task.FromResult<string?>(null);
TestServices\TestAppHostBackchannel.cs (1)
54: Task.FromResult(
TestServices\TestConsoleInteractionService.cs (3)
31return Task.FromResult(defaultValue ?? string.Empty); 41return Task.FromResult(choices.First()); 72return Task.FromResult(ConfirmCallback != null? ConfirmCallback(promptText, defaultValue) : defaultValue);
TestServices\TestDotNetCliRunner.cs (15)
29? Task.FromResult(AddPackageAsyncCallback(projectFilePath, packageName, packageVersion, nugetSource, options, cancellationToken)) 36? Task.FromResult(BuildAsyncCallback(projectFilePath, options, cancellationToken)) 43? Task.FromResult(CheckHttpCertificateAsyncCallback(options, cancellationToken)) 44: Task.FromResult(0); // Return success if not overridden. 52? Task.FromResult(GetAppHostInformationAsyncCallback(projectFile, options, cancellationToken)) 53: Task.FromResult<(int, bool, string?)>((0, true, informationalVersion)); 59? Task.FromResult(GetNuGetConfigPathsAsyncCallback(workingDirectory, options, cancellationToken)) 60: Task.FromResult((0, GetGlobalNuGetPaths())); // If not overridden, return success with no config paths which will blow up. 75? Task.FromResult(GetProjectItemsAndPropertiesAsyncCallback(projectFile, items, properties, options, cancellationToken)) 82? Task.FromResult(InstallTemplateAsyncCallback(packageName, version, nugetSource, force, options, cancellationToken)) 83: Task.FromResult<(int, string?)>((0, version)); // If not overridden, just return success for the version specified. 89? Task.FromResult(NewProjectAsyncCallback(templateName, name, outputPath, options, cancellationToken)) 90: Task.FromResult(0); // If not overridden, just return success. 103? Task.FromResult(SearchPackagesAsyncCallback(workingDirectory, query, prerelease, take, skip, nugetConfigFile, options, cancellationToken)) 110? Task.FromResult(TrustHttpCertificateAsyncCallback(options, cancellationToken))
TestServices\TestDotNetSdkInstaller.cs (4)
17? Task.FromResult(CheckAsyncCallback(cancellationToken)) 18: Task.FromResult(true); // Default to SDK available 24? Task.FromResult(CheckAsyncWithVersionCallback(minimumVersion, cancellationToken)) 25: Task.FromResult(true); // Default to SDK available
TestServices\TestExtensionBackchannel.cs (5)
146return Task.FromResult(choices.First()); 154: Task.FromResult(true); 162: Task.FromResult(defaultValue ?? string.Empty); 186: Task.FromResult(Array.Empty<string>()); 194: Task.FromResult(false);
TestServices\TestExtensionInteractionService.cs (3)
35return Task.FromResult(defaultValue ?? string.Empty); 45return Task.FromResult(choices.First()); 86return Task.FromResult(true);
TestServices\TestProjectLocator.cs (1)
40return Task.FromResult(new List<FileInfo> { new FileInfo(fakeProjectFilePath) });
Utils\CliUpdateNotificationServiceTests.cs (4)
297return Task.FromResult(Enumerable.Empty<NuGetPackage>()); 302return Task.FromResult(Enumerable.Empty<NuGetPackage>()); 307return Task.FromResult(_cliPackages); 312return Task.FromResult(Enumerable.Empty<NuGetPackage>());
Utils\EmptyAsyncEnumerable.cs (1)
30public ValueTask<bool> MoveNextAsync() => new ValueTask<bool>(Task.FromResult(false));
Aspire.Dashboard (12)
Authentication\Connection\ConnectionTypeAuthenticationHandler.cs (3)
22return Task.FromResult(AuthenticateResult.Fail("No type specified on this connection.")); 27return Task.FromResult(AuthenticateResult.Fail($"Connection type {Options.RequiredConnectionType} is not enabled on this connection.")); 30return Task.FromResult(AuthenticateResult.NoResult());
Authentication\OtlpApiKey\OtlpApiKeyAuthenticationHandler.cs (4)
31return Task.FromResult(AuthenticateResult.Fail($"Multiple '{ApiKeyHeaderName}' headers in request.")); 38return Task.FromResult(AuthenticateResult.Fail($"Incoming API key from '{ApiKeyHeaderName}' header doesn't match configured API key.")); 44return Task.FromResult(AuthenticateResult.Fail($"API key from '{ApiKeyHeaderName}' header is missing.")); 47return Task.FromResult(AuthenticateResult.NoResult());
Authentication\UnsecuredAuthenticationHandler.cs (1)
23return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(id), Scheme.Name)));
Model\TraceLinkHelpers.cs (1)
27(ct) => Task.FromResult(getSpan(traceId, spanId) != null),
Otlp\Grpc\OtlpGrpcLogsService.cs (1)
25return Task.FromResult(_logsService.Export(request));
Otlp\Grpc\OtlpGrpcMetricsService.cs (1)
25return Task.FromResult(_metricsService.Export(request));
Otlp\Grpc\OtlpGrpcTraceService.cs (1)
25return Task.FromResult(_traceService.Export(request));
Aspire.Dashboard.Components.Tests (16)
Interactions\InteractionsProviderTests.cs (7)
84var dialogService = new TestDialogService(onShowDialog: (data, parameters) => Task.FromResult<IDialogReference>(dialogReference)); 128var dialogService = new TestDialogService(onShowDialog: (data, parameters) => Task.FromResult<IDialogReference>(dialogReference)); 183return Task.FromResult<IDialogReference>(dialogReference); 241return Task.FromResult<IDialogReference>(dialogReference); 297return Task.FromResult(message); 367return Task.FromResult<IDialogReference>(dialogReference); 444return Task.FromResult<IDialogReference>(dialogReference);
Shared\TestDashboardClient.cs (1)
89return Task.FromResult(new ResourceViewModelSubscription(_initialResources?.ToImmutableArray() ?? [], BuildSubscription(channel, cancellationToken)));
Shared\TestLocalStorage.cs (3)
15return Task.FromResult(new StorageResult<T>(success: false, value: default)); 23return Task.FromResult(new StorageResult<T>(success: success, value: (T)(value ?? default(T))!)); 25return Task.FromResult(new StorageResult<T>(success: false, value: default));
Shared\TestSessionStorage.cs (2)
18return Task.FromResult(new StorageResult<T>(success: success, value: (T)(value ?? default(T))!)); 21return Task.FromResult<StorageResult<T>>(new StorageResult<T>(success: false, value: default));
Shared\TestThemeResolver.cs (1)
14return Task.FromResult(new ThemeSettings(SelectedTheme: null, EffectiveTheme: EffectiveTheme));
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
tests\Shared\TestDashboardTelemetrySender.cs (1)
18return Task.FromResult(IsTelemetryEnabled);
Aspire.Dashboard.Tests (17)
Integration\DashboardClientAuthTests.cs (1)
167return Task.FromResult(new ApplicationInformationResponse()
Integration\Playwright\Infrastructure\MockDashboardClient.cs (1)
42return Task.FromResult(new ResourceViewModelSubscription(
Model\DashboardClientTests.cs (5)
253Task.FromResult(new Metadata()), 262Task.FromResult(new ApplicationInformationResponse 266Task.FromResult(new Metadata()), 276Task.FromResult(new Metadata()), 289return Task.FromResult(false);
Telemetry\DashboardTelemetrySenderTests.cs (2)
84return Task.FromResult(new HttpResponseMessage(telemetryEnabledResponseStatusCode.Value) { Content = new StringContent(telemetryEnabledResponseBody ?? string.Empty) }); 92return Task.FromResult(new HttpResponseMessage(startTelemetryResponseStatusCode.Value));
Telemetry\DashboardTelemetryServiceTests.cs (6)
47return Task.FromResult(0); 108return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) 115return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)); 119return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)); 123return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) 133return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
tests\Shared\TestDashboardTelemetrySender.cs (1)
18return Task.FromResult(IsTelemetryEnabled);
Aspire.Hosting (9)
Backchannel\AppHostRpcTarget.cs (1)
213return Task.FromResult(new string[] {
ContainerResourceBuilderExtensions.cs (2)
756Callback = (_, _) => Task.FromResult(entries), 873Callback = (_, _) => Task.FromResult(ContainerDirectory.GetFileSystemItemsFromPath(sourceFullPath, searchOptions: SearchOption.AllDirectories)),
Dashboard\DashboardService.cs (1)
40return Task.FromResult(new ApplicationInformationResponse
Dashboard\DashboardServiceAuth.cs (4)
43return Task.FromResult(AuthenticateResult.Fail($"'{ApiKeyHeaderName}' header not found")); 48return Task.FromResult(AuthenticateResult.Fail($"Expecting only a single '{ApiKeyHeaderName}' header.")); 53return Task.FromResult(AuthenticateResult.Fail($"Invalid '{ApiKeyHeaderName}' header value.")); 57return Task.FromResult(
Dcp\KubernetesService.cs (1)
455(DcpKubernetesClient kubernetes) => Task.FromResult(operation(kubernetes)),
Aspire.Hosting.Azure.AIFoundry (2)
FoundryLocalHealthCheck.cs (2)
15return Task.FromResult(HealthCheckResult.Unhealthy("Foundry Local not running")); 18return Task.FromResult(HealthCheckResult.Healthy());
Aspire.Hosting.Azure.EventHubs (2)
AzureEventHubsExtensions.cs (2)
280return Task.FromResult<IEnumerable<ContainerFileSystemItem>>([ 314return Task.FromResult<IEnumerable<ContainerFileSystemItem>>([
Aspire.Hosting.Azure.ServiceBus (2)
AzureServiceBusExtensions.cs (2)
417return Task.FromResult<IEnumerable<ContainerFileSystemItem>>([ 451return Task.FromResult<IEnumerable<ContainerFileSystemItem>>([
Aspire.Hosting.Azure.Tests (19)
AzureBicepProvisionerTests.cs (1)
197return Task.FromResult(CompilationResult);
AzureCosmosDBExtensionsTests.cs (4)
348return Task.FromResult<string?>(null); 351return Task.FromResult<string?>(value); 452return Task.FromResult<string?>(null); 455return Task.FromResult<string?>(value);
AzureDeployerTests.cs (2)
526public Task<JsonObject> LoadUserSecretsAsync(CancellationToken cancellationToken = default) => Task.FromResult(new JsonObject()); 535return Task.FromResult(true);
AzureKeyVaultTests.cs (1)
58return Task.FromResult<string?>("my secret value");
AzureSignalREmulatorFunctionalTest.cs (1)
109option.AccessTokenProvider = () => Task.FromResult(negotiationResponse.AccessToken);
ProvisioningTestHelpers.cs (10)
210return Task.FromResult<(ISubscriptionResource, ITenantResource)>((subscription, tenant)); 219return Task.FromResult<IEnumerable<ISubscriptionResource>>(subscriptions); 230return Task.FromResult<IEnumerable<(string, string)>>(locations); 312return Task.FromResult(Response.FromValue<IResourceGroupResource>(resourceGroup, new MockResponse(200))); 327return Task.FromResult<ArmOperation<IResourceGroupResource>>(operation); 407return Task.FromResult<ArmOperation<ArmDeploymentResource>>(operation); 565return Task.FromResult(@"{ 580return Task.FromResult(_userSecrets); 595return Task.FromResult(principal); 641var resultTask = Task.FromResult(result);
Aspire.Hosting.GitHub.Models.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.Kafka.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.MySql.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.NodeJs.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.OpenAI.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.PostgreSQL.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.RabbitMQ.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.Hosting.Testing (1)
DistributedApplicationTestingBuilder.cs (1)
402return Task.FromResult(Build());
Aspire.Hosting.Tests (22)
Dashboard\DashboardLifecycleHookTests.cs (1)
570return Task.FromResult("http://localhost:1010");
Dashboard\DashboardResourceTests.cs (1)
624return Task.FromResult("http://localhost:5000");
Dashboard\DashboardServiceTests.cs (2)
155executeCommand: c => Task.FromResult(CommandResults.Success()), 473executeCommand: c => Task.FromResult(CommandResults.Success()));
Dcp\DcpHostNotificationTests.cs (1)
393return Task.FromResult(DcpInfoResult);
Dcp\TestDcpDependencyCheckService.cs (1)
22return Task.FromResult((DcpInfo?)dcpInfo);
Dcp\TestKubernetesService.cs (6)
56return Task.FromResult(res); 90return Task.FromResult(res); 129return Task.FromResult(res.ToList()); 177return Task.FromResult(_startStream(obj, logStreamType)); 226return Task.FromResult(res); 230return Task.FromResult(obj);
Publishing\ResourceContainerImageBuilderTests.cs (1)
485return Task.FromResult(!shouldFail);
ResourceCommandServiceTests.cs (4)
170return Task.FromResult(new ExecuteCommandResult { Success = false, ErrorMessage = "Failure!" }); 202return Task.FromResult(CommandResults.Canceled()); 229return Task.FromResult(CommandResults.Canceled()); 259return Task.FromResult(count switch
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Utils\PeriodicRestartAsyncEnumerableTests.cs (2)
20var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(CountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(50), cancellationToken)); 43var innerFactory = (int? lastValue, CancellationToken cancellationToken) => Task.FromResult(RefCountingAsyncEnumerable(0, TimeSpan.FromMilliseconds(10), cancellationToken));
VersionChecking\VersionCheckServiceTests.cs (1)
300_versionTask = versionTask ?? Task.FromResult<List<NuGetPackage>>([]);
WithHttpCommandTests.cs (1)
347return Task.FromResult(CommandResults.Failure("A test error message"));
Aspire.Hosting.Valkey.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.OpenAI.Tests (2)
AspireOpenAIClientBuilderChatClientExtensionsTests.cs (1)
269=> Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Hello from middleware")));
AspireOpenAIClientBuilderEmbeddingGeneratorExtensionsTests.cs (1)
271return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>(inputs.Select(i => new Embedding<float>(floats))));
Aspire.Playground.Tests (1)
tests\Shared\AsyncTestHelpers.cs (1)
200return AssertIsTrueRetryAsync(() => Task.FromResult(assert()), message, logger, retries);
Aspire.RabbitMQ.Client (1)
AspireRabbitMQExtensions.cs (1)
172return Task.FromResult(new HealthCheckResult(context.Registration.FailureStatus, exception: ex));
Aspire.StackExchange.Redis.DistributedCaching (2)
AspireRedisDistributedCacheExtensions.cs (2)
43options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredService<IConnectionMultiplexer>()); 73options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredKeyedService<IConnectionMultiplexer>(name));
Aspire.StackExchange.Redis.OutputCaching (2)
AspireRedisOutputCacheExtensions.cs (2)
42options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredService<IConnectionMultiplexer>()); 72options.ConnectionMultiplexerFactory = () => Task.FromResult(sp.GetRequiredKeyedService<IConnectionMultiplexer>(name));
BasicTestApp (13)
InteropTest\ByteArrayInterop.cs (2)
19return Task.FromResult(byteArray); 31return Task.FromResult(byteArrayWrapper);
InteropTest\DotNetStreamReferenceInterop.cs (2)
27return Task.FromResult(GetDotNetStreamReference()); 46return Task.FromResult(GetDotNetStreamWrapperReference());
InteropTest\JavaScriptInterop.cs (9)
304return Task.FromResult(new decimal[] { 0.1M, 0.2M }); 310return Task.FromResult(new object[] { parameter1 }); 318return Task.FromResult(new object[] { parameter1, parameter2 }); 327return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue() }); 337return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4 }); 348return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5 }); 359return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6 }); 372return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6, parameter7 }); 386return Task.FromResult(new object[] { parameter1, parameter2, parameter3.Value.GetNonSerializedValue(), parameter4, parameter5, parameter6, parameter7, parameter8 });
BasicWebSite (13)
BasicAuthenticationHandler.cs (2)
21return Task.FromResult(AuthenticateResult.NoResult()); 34return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(
Controllers\AsyncActionsController.cs (1)
33return Task.FromResult<IActionResult>(View());
Controllers\ContentNegotiation\NoContentController.cs (3)
12return Task.FromResult<string>(null); 17return Task.FromResult<object>(null); 32return Task.FromResult<bool>(true);
Controllers\ContentNegotiation\NoContentDoNotTreatNullValueAsNoContentController.cs (2)
26return Task.FromResult<string>(null); 31return Task.FromResult<object>(null);
Controllers\ContentNegotiation\TextPlainController.cs (3)
12return Task.FromResult<string>("ReturnTaskOfString"); 17return Task.FromResult<object>("ReturnTaskOfObject_StringValue"); 22return Task.FromResult(new object());
Controllers\HomeController.cs (1)
74return Task.FromResult(true);
ManagerHandler.cs (1)
17return Task.FromResult(0);
Binding.Http.IntegrationTests (2)
BasicHttpBindingTests.4.0.0.cs (2)
118return Task.FromResult((HttpResponseMessage)null); 176return Task.FromResult((HttpResponseMessage)null);
Binding.ReliableSession.IntegrationTests (5)
NetHttpBindingTests.cs (2)
146return Task.FromResult(response); 378return Task.FromResult<HttpResponseMessage>(null);
NetTcpBindingTests.cs (1)
137return Task.FromResult(echo);
WSHttpBindingTests.cs (2)
146return Task.FromResult(response); 378return Task.FromResult<HttpResponseMessage>(null);
BlazorServerApp (1)
Data\WeatherForecastService.cs (1)
15return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
BlazorUnitedApp (1)
Data\WeatherForecastService.cs (1)
15return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
CatalogDb (4)
CatalogDbInitializerHealthCheck.cs (4)
13{ IsCompletedSuccessfully: true } => Task.FromResult(HealthCheckResult.Healthy()), 14{ IsFaulted: true } => Task.FromResult(HealthCheckResult.Unhealthy(task.Exception?.InnerException?.Message, task.Exception)), 15{ IsCanceled: true } => Task.FromResult(HealthCheckResult.Unhealthy("Database initialization was canceled")), 16_ => Task.FromResult(HealthCheckResult.Degraded("Database initialization is still in progress"))
ClaimsTransformation (1)
ClaimsTransformer.cs (1)
23return Task.FromResult(transformed);
CookieSessionSample (3)
MemoryCacheTicketStore.cs (3)
40return Task.FromResult(0); 47return Task.FromResult(ticket); 53return Task.FromResult(0);
csc (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
CustomAuthorizationFailureResponse (1)
Authentication\SampleAuthenticationHandler.cs (1)
21=> Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(_id, "Api")));
CustomPolicyProvider (1)
Authorization\MinimumAgePolicyProvider.cs (1)
46return Task.FromResult(policy.Build());
DatabaseErrorPageSample (1)
Startup.cs (1)
25return Task.FromResult(0);
dotnet-openapi (2)
Commands\AddCommand.cs (1)
26return Task.FromResult(0);
Commands\RemoveCommand.cs (1)
48return Task.FromResult(0);
dotnet-svcutil-lib (35)
FrameworkFork\Microsoft.Xml\Xml\AsyncHelper.cs (4)
17public static readonly Task DoneTask = Task.FromResult(true); 19public static readonly Task<bool> DoneTaskTrue = Task.FromResult(true); 21public static readonly Task<bool> DoneTaskFalse = Task.FromResult(false); 23public static readonly Task<int> DoneTaskZero = Task.FromResult(0);
FrameworkFork\Microsoft.Xml\Xml\Core\XmlSubtreeReaderAsync.cs (4)
25return Task.FromResult(_curNode.value); 515return Task.FromResult(0); 533return Task.FromResult(copyCount); 554return Task.FromResult(0);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdCachingReaderAsync.cs (2)
28return Task.FromResult(_cachedNode.OriginalStringValue); 32return Task.FromResult(_cachedNode.RawValue);
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReaderAsync.cs (1)
30return Task.FromResult(_cachedNode.RawValue);
FrameworkFork\Microsoft.Xml\Xml\Resolvers\XmlPreloadedResolverAsync.cs (2)
40return Task.FromResult<Object>(data.AsStream()); 44return Task.FromResult<Object>(data.AsTextReader());
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TaskHelpers.cs (1)
239return Task.FromResult(true);
FrameworkFork\System.ServiceModel\Internals\System\Runtime\TimeoutHelper.cs (1)
326tokenTask = Task.FromResult(new CancellationTokenSource(millisecondsTimeout).Token);
FrameworkFork\System.ServiceModel\System\IdentityModel\Selectors\KerberosSecurityTokenProvider.cs (1)
70return Task.FromResult(GetToken(cancellationToken, null));
FrameworkFork\System.ServiceModel\System\IdentityModel\Selectors\UserNameSecurityTokenProvider.cs (1)
28return Task.FromResult((SecurityToken)_userNameToken);
FrameworkFork\System.ServiceModel\System\IdentityModel\Selectors\X509SecurityTokenProvider.cs (1)
65return await Task.FromResult<SecurityToken>(new X509SecurityToken(_certificate));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\HttpChannelHelpers.cs (2)
60return Task.FromResult((NetworkCredential)null); 246return Task.FromResult(bytesRead);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageContent.cs (2)
185return Task.FromResult(_stream); 219return Task.FromResult(_stream);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\MessageEncoder.cs (3)
39return Task.FromResult(ReadMessage(stream, maxSizeOfHeaders, contentType)); 44return Task.FromResult(ReadMessage(buffer, bufferManager, contentType)); 133return Task.FromResult(WriteMessage(message, maxMessageSize, bufferManager, messageOffset));
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\TextMessageEncoder.cs (1)
513return Task.FromResult(messageData);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (3)
1030return Task.FromResult(0); 1035return Task.FromResult(GetBytesFromInitialReadBuffer(buffer, offset, count)); 1042return Task.FromResult(0);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DispatchRuntime.cs (2)
408return Task.FromResult((object)Message.CreateMessage(message.Version, fault, message.Version.Addressing.DefaultFaultAction)); 414return Task.FromResult((object)null);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\SyncMethodInvoker.cs (1)
185return Task.FromResult(Tuple.Create(returnValue, outputs));
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\ClientCredentialsSecurityTokenManager.cs (1)
274return Task.FromResult((SecurityToken)new KerberosRequestorSecurityToken(_innerProvider.ServicePrincipalName,
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\SspiSecurityTokenProvider.cs (1)
36return Task.FromResult<SecurityToken>(_token);
Shared\Utilities\SafeLogger.cs (1)
75return Task.FromResult(DateTime.Now);
dotnet-svcutil-lib.Tests (1)
TestLogger.cs (1)
50return Task.FromResult(DateTime.Now);
FormatterWebSite (4)
Controllers\DataContractSerializerController.cs (2)
40return Task.FromResult(new Person(name)); 48return Task.FromResult<object>(new Person(name));
Controllers\XmlSerializerController.cs (2)
51return Task.FromResult(new DummyClass { SampleInt = 10 }); 57return Task.FromResult<object>(new DummyClass { SampleInt = 10 });
GenerateDocumentationAndConfigFiles (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
HealthChecksSample (3)
GCInfoHealthCheck.cs (1)
72return Task.FromResult(new HealthCheckResult(
SlowDependencyHealthCheck.cs (2)
25return Task.FromResult(HealthCheckResult.Healthy("Dependency is ready")); 28return Task.FromResult(new HealthCheckResult(
HostedBlazorWebassemblyApp.Server (1)
Data\WeatherForecastService.cs (1)
21return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
Identity.DefaultUI.WebSite (50)
Services\ContosoAuthenticationHandler.cs (1)
23Task.FromResult(AuthenticateResult.NoResult());
src\Identity\test\InMemory.Test\InMemoryUserStore.cs (49)
36return Task.FromResult<IList<Claim>>(claims); 45return Task.FromResult(0); 56return Task.FromResult(0); 71return Task.FromResult(0); 77return Task.FromResult(0); 82return Task.FromResult(user.Email); 87return Task.FromResult(user.NormalizedEmail); 93return Task.FromResult(0); 98return Task.FromResult(user.EmailConfirmed); 104return Task.FromResult(0); 110Task.FromResult( 116return Task.FromResult(user.LockoutEnd); 122return Task.FromResult(0); 128return Task.FromResult(user.AccessFailedCount); 134return Task.FromResult(0); 139return Task.FromResult(user.AccessFailedCount); 144return Task.FromResult(user.LockoutEnabled); 150return Task.FromResult(0); 169return Task.FromResult(0); 185return Task.FromResult(0); 192return Task.FromResult(result); 200return Task.FromResult(_logins[key]); 202return Task.FromResult<TUser>(null); 207return Task.FromResult(user.Id); 212return Task.FromResult(user.UserName); 218return Task.FromResult(0); 224return Task.FromResult(IdentityResult.Success); 230return Task.FromResult(IdentityResult.Success); 237return Task.FromResult(_users[userId]); 239return Task.FromResult<TUser>(null); 249Task.FromResult( 260return Task.FromResult(IdentityResult.Success); 266return Task.FromResult(0); 271return Task.FromResult(user.PasswordHash); 276return Task.FromResult(user.PasswordHash != null); 282return Task.FromResult(0); 287return Task.FromResult(user.PhoneNumber); 292return Task.FromResult(user.PhoneNumberConfirmed); 298return Task.FromResult(0); 304return Task.FromResult(0); 309return Task.FromResult(user.SecurityStamp); 315return Task.FromResult(0); 320return Task.FromResult(user.TwoFactorEnabled); 325return Task.FromResult(user.NormalizedUserName); 331return Task.FromResult(0); 342return Task.FromResult<IList<TUser>>(query.ToList()); 366return Task.FromResult(0); 380return Task.FromResult(0); 390return Task.FromResult(tokenEntity?.TokenValue);
IdentitySample.DefaultUI (1)
Startup.cs (1)
15return Task.FromResult(false);
IdentitySample.Mvc (4)
MessageServices.cs (2)
11return Task.FromResult(0); 17return Task.FromResult(0);
Services\MessageServices.cs (2)
14return Task.FromResult(0); 20return Task.FromResult(0);
IdentitySample.PasskeyConformance (11)
InMemoryUserStore.cs (11)
22return Task.FromResult(IdentityResult.Success); 31return Task.FromResult(IdentityResult.Success); 35=> Task.FromResult(_users.TryGetValue(userId, out var result) ? result : null); 38=> Task.FromResult(_users.Values.FirstOrDefault(u => string.Equals(u.NormalizedUserName, normalizedUserName, StringComparison.Ordinal))); 41=> Task.FromResult(_users.Values.FirstOrDefault(u => u.Passkeys.Any(p => p.CredentialId.SequenceEqual(credentialId)))); 44=> Task.FromResult(ToUserPasskeyInfo(user.Passkeys.FirstOrDefault(p => p.CredentialId.SequenceEqual(credentialId)))); 47=> Task.FromResult<string?>(user.NormalizedUserName); 50=> Task.FromResult(user.Id); 53=> Task.FromResult<string?>(user.UserName); 70return Task.FromResult(IdentityResult.Success); 91=> Task.FromResult<IList<UserPasskeyInfo>>(user.Passkeys.Select(ToUserPasskeyInfo).ToList()!);
IdentitySample.PasskeyUI (11)
InMemoryUserStore.cs (11)
22return Task.FromResult(IdentityResult.Success); 31return Task.FromResult(IdentityResult.Success); 35=> Task.FromResult(_users.TryGetValue(userId, out var result) ? result : null); 38=> Task.FromResult(_users.Values.FirstOrDefault(u => string.Equals(u.NormalizedUserName, normalizedUserName, StringComparison.Ordinal))); 41=> Task.FromResult(_users.Values.FirstOrDefault(u => u.Passkeys.Any(p => p.CredentialId.SequenceEqual(credentialId)))); 44=> Task.FromResult(ToUserPasskeyInfo(user.Passkeys.FirstOrDefault(p => p.CredentialId.SequenceEqual(credentialId)))); 47=> Task.FromResult<string?>(user.NormalizedUserName); 50=> Task.FromResult(user.Id); 53=> Task.FromResult<string?>(user.UserName); 70return Task.FromResult(IdentityResult.Success); 91=> Task.FromResult<IList<UserPasskeyInfo>>(user.Passkeys.Select(ToUserPasskeyInfo).ToList()!);
IIS.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
IIS.LongTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
IIS.NewHandler.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
IIS.NewShim.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
IIS.ShadowCopy.Tests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
IISExpress.FunctionalTests (2)
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\Helpers.cs (1)
107return RetryRequestAsync(client, uri, message => Task.FromResult(predicate(message)));
src\Servers\IIS\IIS\test\Common.FunctionalTests\Infrastructure\PublishedApplicationPublisher.cs (1)
40return Task.FromResult(new PublishedApplication(target.FullName, logger));
InMemory.FunctionalTests (2)
ResponseTests.cs (2)
2874return Task.FromResult<object>(null); 2919return Task.FromResult<object>(null);
InProcessWebSite (9)
Startup.cs (9)
1203return Task.FromResult(0); 1210return Task.FromResult(0); 1220return Task.FromResult(0); 1227return Task.FromResult(0); 1273return Task.FromResult(0); 1287return Task.FromResult(0); 1297return Task.FromResult(0); 1348return Task.FromResult(0); 1371return Task.FromResult(0);
IntegrationTestsWebsite (1)
Services\GreeterService.cs (1)
18return Task.FromResult(new HelloReply
InteropWebsite (1)
TestServiceImpl.cs (1)
30return Task.FromResult(new Empty());
Metrics (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Metrics.Legacy (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.Analyzers.Extra.Tests (2)
CallAnalysis\LegacyLoggingTests.cs (2)
849GetSyntaxRootAsync = (_, _) => Task.FromResult<SyntaxNode?>(null) 862GetSemanticModelAsync = (_, _) => Task.FromResult<SemanticModel?>(null)
Microsoft.Arcade.Common (2)
ArcadeHttpMessageHandler.cs (2)
24return Task.FromResult(new HttpResponseMessage() 31return Task.FromResult(new HttpResponseMessage()
Microsoft.Arcade.Test.Common (2)
FakeHttpClient.cs (2)
46return Task.FromResult(_responseEnumerator.Current); 83return Task.FromResult(responseEnumerator.Current);
Microsoft.AspNetCore.Antiforgery.Test (7)
AntiforgeryMiddlewareTest.cs (2)
19antiforgeryService.Setup(af => af.ValidateRequestAsync(It.IsAny<HttpContext>())).Returns(Task.FromResult(true)); 67antiforgeryService.Setup(af => af.ValidateRequestAsync(It.IsAny<HttpContext>())).Returns(Task.FromResult(true));
DefaultAntiforgeryTest.cs (5)
853.Returns(Task.FromResult(tokenSet)); 877.Returns(Task.FromResult(tokenSet)); 903.Returns(Task.FromResult(tokenSet)); 929.Returns(Task.FromResult(tokenSet)); 1444.Returns(() => Task.FromResult(new AntiforgeryTokenSet(
Microsoft.AspNetCore.App.Analyzers (6)
RouteEmbeddedLanguage\FrameworkParametersCompletionProvider.cs (3)
70return Task.FromResult<CompletionDescription?>(null); 73return Task.FromResult<CompletionDescription?>(CompletionDescription.Create( 87return Task.FromResult(CompletionChange.Create(
RouteEmbeddedLanguage\RoutePatternCompletionProvider.cs (3)
64return Task.FromResult<CompletionDescription?>(null); 67return Task.FromResult<CompletionDescription?>(CompletionDescription.Create( 81return Task.FromResult(CompletionChange.Create(
Microsoft.AspNetCore.App.Analyzers.Test (1)
Dependencies\AddPackageTests.cs (1)
80return Task.FromResult<CodeAction>(null);
Microsoft.AspNetCore.App.CodeFixes (6)
Authorization\AddAuthorizationBuilderFixer.cs (1)
138return Task.FromResult(document.WithSyntaxRoot(
Http\HeaderDictionaryAddFixer.cs (2)
74return Task.FromResult(document.WithSyntaxRoot( 103return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode(diagnosticTarget, assignment)));
RouteParameterUnusedParameterFixer.cs (2)
68return Task.FromResult(document); 71return Task.FromResult(UpdateDocument(diagnostic, root, document, routeUsage.UsageContext.MethodSyntax));
WebApplicationBuilderFixer.cs (1)
81return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode(diagnosticTarget, invocation)));
Microsoft.AspNetCore.Authentication (3)
AuthenticationHandler.cs (1)
183protected virtual Task<object> CreateEventsAsync() => Task.FromResult(new object());
RemoteAuthenticationHandler.cs (2)
62=> Task.FromResult<object>(new RemoteAuthenticationEvents()); 69=> Task.FromResult(Options.CallbackPath == Request.Path);
Microsoft.AspNetCore.Authentication.Certificate (1)
CertificateAuthenticationHandler.cs (1)
40protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new CertificateAuthenticationEvents());
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieAuthenticationHandler.cs (1)
80protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new CookieAuthenticationEvents());
Microsoft.AspNetCore.Authentication.Core (6)
AuthenticationSchemeProvider.cs (5)
50private static readonly Task<AuthenticationScheme?> _nullScheme = Task.FromResult<AuthenticationScheme?>(null); 123=> Task.FromResult(_schemes.TryGetValue(name, out var scheme) ? scheme : null); 130=> Task.FromResult(_requestHandlersCopy); 208=> Task.FromResult(_schemesCopy); 216_autoDefaultScheme = Task.FromResult<AuthenticationScheme?>(_schemesCopy.First());
NoopClaimsTransformation.cs (1)
20return Task.FromResult(principal);
Microsoft.AspNetCore.Authentication.Core.Test (27)
AuthenticationServiceTests.cs (25)
249return Task.FromResult(new ClaimsPrincipal()); 257return Task.FromResult(AuthenticateResult.Success( 266return Task.FromResult(0); 271return Task.FromResult(0); 276return Task.FromResult(0); 284return Task.FromResult(AuthenticateResult.NoResult()); 289return Task.FromResult(0); 294return Task.FromResult(0); 299return Task.FromResult(0); 304return Task.FromResult(0); 309return Task.FromResult(0); 317return Task.FromResult(AuthenticateResult.NoResult()); 322return Task.FromResult(0); 327return Task.FromResult(0); 332return Task.FromResult(0); 337return Task.FromResult(0); 345return Task.FromResult(AuthenticateResult.NoResult()); 350return Task.FromResult(0); 355return Task.FromResult(0); 360return Task.FromResult(false); 365return Task.FromResult(0); 370return Task.FromResult(0); 375return Task.FromResult(0); 393return Task.FromResult(0); 403return Task.FromResult(0);
TokenExtensionTests.cs (2)
181return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), props, "simple"))); 196return Task.FromResult(0);
Microsoft.AspNetCore.Authentication.JwtBearer (1)
JwtBearerHandler.cs (1)
50protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new JwtBearerEvents());
Microsoft.AspNetCore.Authentication.Negotiate (1)
NegotiateHandler.cs (1)
61protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new NegotiateEvents());
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthHandler.cs (1)
61protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new OAuthEvents());
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
OpenIdConnectHandler.cs (1)
86protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new OpenIdConnectEvents());
Microsoft.AspNetCore.Authentication.Test (199)
AuthenticationMetricsTest.cs (5)
20authenticationHandler.Setup(h => h.AuthenticateAsync()).Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom")))); 48authenticationHandler.Setup(h => h.AuthenticateAsync()).Returns(Task.FromResult(AuthenticateResult.Fail("Authentication failed"))); 76authenticationHandler.Setup(h => h.AuthenticateAsync()).Returns(Task.FromResult(AuthenticateResult.NoResult())); 335authenticationHandlerProvider.Setup(p => p.GetHandlerAsync(It.IsAny<HttpContext>(), "custom")).Returns(Task.FromResult(authenticationHandler)); 338claimsTransform.Setup(t => t.TransformAsync(It.IsAny<ClaimsPrincipal>())).Returns((ClaimsPrincipal p) => Task.FromResult(p));
AuthenticationMiddlewareTests.cs (13)
65.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom")))); 68.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler)))); 88.Returns(Task.FromResult(AuthenticateResult.Fail("not authenticated"))); 91.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler)))); 108.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom")))); 111.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler)))); 134.Returns(Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(), "custom")))); 137.Returns(Task.FromResult(new AuthenticationScheme("custom", "custom", typeof(JwtBearerHandler)))); 268return Task.FromResult(true); 274return Task.FromResult(0); 315return Task.FromResult(0); 350return Task.FromResult(false); 356return Task.FromResult(0);
CookieTests.cs (17)
225return Task.FromResult(0); 232return Task.FromResult(ticket); 238return Task.FromResult(0); 569return Task.FromResult(0); 600return Task.FromResult(0); 628return Task.FromResult(0); 665return Task.FromResult(0); 710return Task.FromResult(0); 743return Task.FromResult(0); 786return Task.FromResult(0); 842return Task.FromResult(0); 901return Task.FromResult(0); 947return Task.FromResult(0); 999return Task.FromResult(0); 1048return Task.FromResult(0); 1757return Task.FromResult(0); 1846return Task.FromResult(p);
DynamicSchemeTests.cs (1)
125return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name)));
FacebookTests.cs (1)
105return Task.FromResult(0);
GoogleTests.cs (16)
190return Task.FromResult<object>(null); 242return Task.FromResult<object>(null); 298return Task.FromResult<object>(null); 335return Task.FromResult(0); 398return Task.FromResult(0); 437return Task.FromResult(0); 466return Task.FromResult(0); 480return Task.FromResult(0); 516return Task.FromResult(0); 617return Task.FromResult(0); 670return Task.FromResult(0); 714return Task.FromResult(0); 755return Task.FromResult(0); 797return Task.FromResult(0); 849return Task.FromResult(0); 1147return Task.FromResult(p);
JwtBearerTests.cs (13)
189return Task.FromResult(0); 237return Task.FromResult<object>(null); 407return Task.FromResult(0); 504return Task.FromResult<object>(null); 530return Task.FromResult<object>(null); 560return Task.FromResult(0); 595return Task.FromResult(0); 631return Task.FromResult(0); 666return Task.FromResult(0); 707return Task.FromResult(0); 742return Task.FromResult(0); 775return Task.FromResult(0); 825return Task.FromResult(0);
JwtBearerTests_Handler.cs (14)
180return Task.FromResult(0); 225return Task.FromResult<object>(null); 379return Task.FromResult(0); 474return Task.FromResult<object>(null); 497return Task.FromResult<object>(null); 523return Task.FromResult(0); 557return Task.FromResult(0); 593return Task.FromResult(0); 625return Task.FromResult(0); 663return Task.FromResult(0); 695return Task.FromResult(0); 725return Task.FromResult(0); 773return Task.FromResult(0); 1216return Task.FromResult(new TokenValidationResult
MicrosoftAccountTests.cs (2)
65return Task.FromResult(0); 236return Task.FromResult<object>(null);
OpenIdConnect\OpenIdConnectAuthenticateTests.cs (1)
89return Task.FromResult(0);
OpenIdConnect\OpenIdConnectChallengeTests.cs (6)
223return Task.FromResult(0); 263return Task.FromResult(0); 302return Task.FromResult(0); 346return Task.FromResult(0); 380return Task.FromResult(0); 410return Task.FromResult(0);
OpenIdConnect\OpenIdConnectEventTests.cs (43)
41return Task.FromResult(0); 63return Task.FromResult(0); 87return Task.FromResult(0); 109return Task.FromResult(0); 132return Task.FromResult(0); 158return Task.FromResult(0); 183return Task.FromResult(0); 188return Task.FromResult(0); 194return Task.FromResult(0); 217return Task.FromResult(0); 241return Task.FromResult(0); 268return Task.FromResult(0); 292return Task.FromResult(0); 298return Task.FromResult(0); 322return Task.FromResult(0); 347return Task.FromResult(0); 375return Task.FromResult(0); 400return Task.FromResult(0); 406return Task.FromResult(0); 430return Task.FromResult(0); 455return Task.FromResult(0); 483return Task.FromResult(0); 508return Task.FromResult(0); 514return Task.FromResult(0); 539return Task.FromResult(0); 565return Task.FromResult(0); 594return Task.FromResult(0); 620return Task.FromResult(0); 626return Task.FromResult(0); 657return Task.FromResult(0); 689return Task.FromResult(0); 724return Task.FromResult(0); 766return Task.FromResult(0); 772return Task.FromResult(0); 794return Task.FromResult(0); 818return Task.FromResult(0); 849return Task.FromResult(0); 855return Task.FromResult(0); 889return Task.FromResult(0); 915return Task.FromResult(0); 942return Task.FromResult(0); 1395return Task.FromResult(new HttpResponseMessage() 1403return Task.FromResult(new HttpResponseMessage() { Content = new StringContent("{ }", Encoding.ASCII, "application/json") });
OpenIdConnect\OpenIdConnectEventTests_Handler.cs (44)
41return Task.FromResult(0); 63return Task.FromResult(0); 87return Task.FromResult(0); 109return Task.FromResult(0); 132return Task.FromResult(0); 158return Task.FromResult(0); 183return Task.FromResult(0); 188return Task.FromResult(0); 194return Task.FromResult(0); 217return Task.FromResult(0); 241return Task.FromResult(0); 268return Task.FromResult(0); 292return Task.FromResult(0); 298return Task.FromResult(0); 322return Task.FromResult(0); 347return Task.FromResult(0); 375return Task.FromResult(0); 400return Task.FromResult(0); 406return Task.FromResult(0); 430return Task.FromResult(0); 455return Task.FromResult(0); 483return Task.FromResult(0); 508return Task.FromResult(0); 514return Task.FromResult(0); 539return Task.FromResult(0); 565return Task.FromResult(0); 594return Task.FromResult(0); 620return Task.FromResult(0); 626return Task.FromResult(0); 657return Task.FromResult(0); 689return Task.FromResult(0); 724return Task.FromResult(0); 766return Task.FromResult(0); 772return Task.FromResult(0); 794return Task.FromResult(0); 818return Task.FromResult(0); 849return Task.FromResult(0); 855return Task.FromResult(0); 889return Task.FromResult(0); 915return Task.FromResult(0); 942return Task.FromResult(0); 1354return Task.FromResult(new TokenValidationResult() 1390return Task.FromResult(new HttpResponseMessage() 1398return Task.FromResult(new HttpResponseMessage() { Content = new StringContent("{ }", Encoding.ASCII, "application/json") });
PolicyTests.cs (2)
377return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name))); 427return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name)));
SharedAuthenticationTests.cs (1)
211return Task.FromResult(new ClaimsPrincipal());
TestHandlers.cs (2)
42return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name))); 74return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(principal, new AuthenticationProperties(), Scheme.Name)));
TestHttpMessageHandler.cs (2)
16return Task.FromResult(Sender(request)); 19return Task.FromResult<HttpResponseMessage>(null);
TwitterTests.cs (1)
63return Task.FromResult(0);
WsFederation\TestTokenHandler.cs (1)
20return Task.FromResult(new TokenValidationResult
WsFederation\WsFederationTest.cs (7)
317return Task.FromResult(0); 327return Task.FromResult(0); 332return Task.FromResult(0); 347return Task.FromResult(0); 355return Task.FromResult(0); 360return Task.FromResult(0); 461return Task.FromResult<HttpResponseMessage>(newResponse);
WsFederation\WsFederationTest_Handler.cs (7)
306return Task.FromResult(0); 316return Task.FromResult(0); 321return Task.FromResult(0); 336return Task.FromResult(0); 344return Task.FromResult(0); 349return Task.FromResult(0); 450return Task.FromResult<HttpResponseMessage>(newResponse);
Microsoft.AspNetCore.Authentication.Twitter (1)
TwitterHandler.cs (1)
55protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new TwitterEvents());
Microsoft.AspNetCore.Authentication.WsFederation (1)
WsFederationHandler.cs (1)
61protected override Task<object> CreateEventsAsync() => Task.FromResult<object>(new WsFederationEvents());
Microsoft.AspNetCore.Authorization (7)
AssertionRequirement.cs (1)
29Handler = context => Task.FromResult(handler(context));
AuthorizationOptions.cs (3)
16private static readonly Task<AuthorizationPolicy?> _nullPolicyTask = Task.FromResult<AuthorizationPolicy?>(null); 59PolicyMap[name] = Task.FromResult<AuthorizationPolicy?>(policy); 74PolicyMap[name] = Task.FromResult<AuthorizationPolicy?>(policyBuilder.Build());
DefaultAuthorizationHandlerProvider.cs (1)
27_handlersTask = Task.FromResult(handlers);
DefaultAuthorizationPolicyProvider.cs (2)
40_cachedDefaultPolicy = Task.FromResult(_options.DefaultPolicy); 54_cachedFallbackPolicy = Task.FromResult(_options.FallbackPolicy);
Microsoft.AspNetCore.Authorization.Test (25)
AuthorizationMiddlewareTests.cs (1)
344return Task.FromResult(new AuthorizationPolicyBuilder().RequireAssertion(_ => true).Build());
DefaultAuthorizationServiceTests.cs (15)
150return Task.FromResult(0); 166return Task.FromResult(0); 631return Task.FromResult(0); 691return Task.FromResult(0); 823return Task.FromResult(0); 835return Task.FromResult(0); 879return Task.FromResult(0); 983options.AddPolicy("Basic", policy => policy.RequireAssertion(context => Task.FromResult(true))); 999return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1004return Task.FromResult<AuthorizationPolicy>(null); 1009return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1038return Task.FromResult(new AuthorizationPolicyBuilder().RequireAuthenticatedUser().Build()); 1043return Task.FromResult<AuthorizationPolicy>(null); 1048return Task.FromResult(new AuthorizationPolicyBuilder().RequireClaim(policyName).Build()); 1135return Task.FromResult<IEnumerable<IAuthorizationHandler>>(new IAuthorizationHandler[1] { new FailHandler() });
PassThroughAuthorizationHandlerTests.cs (1)
68return Task.FromResult(0);
PolicyEvaluatorTests.cs (6)
172=> Task.FromResult(AuthorizationResult.Success()); 175=> Task.FromResult(AuthorizationResult.Success()); 181=> Task.FromResult(AuthorizationResult.Failed()); 184=> Task.FromResult(AuthorizationResult.Failed()); 190=> Task.FromResult(AuthenticateResult.Fail("Sad.")); 212return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(Principal, scheme)));
TestObjects\TestAuthenticationService.cs (2)
27return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(new ClaimsPrincipal(identity), scheme))); 30return Task.FromResult(AuthenticateResult.Fail("Denied"));
Microsoft.AspNetCore.Components (5)
PersistentState\ComponentStatePersistenceManager.cs (4)
239return Task.FromResult(false); 250return Task.FromResult(true); 260return Task.FromResult(true); 270return Task.FromResult(false);
Rendering\RendererSynchronizationContextDispatcher.cs (1)
49return Task.FromResult(workItem());
Microsoft.AspNetCore.Components.Analyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
57return Task.FromResult(document.WithSyntaxRoot(newSyntaxRoot));
Microsoft.AspNetCore.Components.Authorization.Tests (11)
AuthorizeRouteViewTest.cs (2)
25_authenticationStateProvider.CurrentAuthStateTask = Task.FromResult( 179_authenticationStateProvider.CurrentAuthStateTask = Task.FromResult(new AuthenticationState(
AuthorizeViewTest.cs (2)
524= Task.FromResult(new AuthenticationState(new ClaimsPrincipal())); 561=> Task.FromResult(new AuthenticationState(
CascadingAuthenticationStateTest.cs (3)
39CurrentAuthStateTask = Task.FromResult(CreateAuthenticationState("Bert")) 124CurrentAuthStateTask = Task.FromResult(CreateAuthenticationState(null)) 138Task.FromResult(CreateAuthenticationState("Bert")));
TestAuthorizationPolicyProvider.cs (3)
13=> Task.FromResult(options.DefaultPolicy); 16=> Task.FromResult(options.FallbackPolicy); 18public Task<AuthorizationPolicy> GetPolicyAsync(string policyName) => Task.FromResult(
TestAuthorizationService.cs (1)
25return Task.FromResult(NextResult);
Microsoft.AspNetCore.Components.Endpoints (2)
Rendering\EndpointHtmlRenderer.cs (1)
98hostEnvironmentAuthenticationStateProvider.SetAuthenticationState(Task.FromResult(authenticationState));
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
48return Task.FromResult((IDictionary<string, byte[]>)ExistingState);
Microsoft.AspNetCore.Components.SdkAnalyzers (1)
ComponentParametersShouldBePublicCodeFixProvider.cs (1)
57return Task.FromResult(document.WithSyntaxRoot(newSyntaxRoot));
Microsoft.AspNetCore.Components.Server (5)
Circuits\CircuitHost.cs (1)
636authenticationStateProvider.SetAuthenticationState(Task.FromResult(authenticationState));
Circuits\DefaultInMemoryCircuitPersistenceProvider.cs (2)
19private static readonly Task<PersistedCircuitState> _noMatch = Task.FromResult<PersistedCircuitState>(null); 112return Task.FromResult(state);
Circuits\RevalidatingServerAuthenticationStateProvider.cs (1)
106SetAuthenticationState(Task.FromResult(anonymousState));
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
48return Task.FromResult((IDictionary<string, byte[]>)ExistingState);
Microsoft.AspNetCore.Components.Server.Tests (9)
Circuits\CircuitPersistenceManagerTest.cs (1)
572return Task.FromResult(new PersistedCircuitState());
Circuits\RevalidatingServerAuthenticationStateProviderTest.cs (6)
38provider.NextValidationResult = Task.FromResult(true); 61provider.NextValidationResult = Task.FromResult(false); 109provider.NextValidationResult = Task.FromResult(true); 134provider.NextValidationResult = Task.FromResult(true); 166provider.NextValidationResult = Task.FromResult(true); 222return Task.FromResult(authenticationState);
Circuits\ServerAuthenticationStateProviderTest.cs (2)
28provider.SetAuthenticationState(Task.FromResult(expectedAuthenticationState1)); 37provider.SetAuthenticationState(Task.FromResult(expectedAuthenticationState2));
Microsoft.AspNetCore.Components.Tests (10)
PersistentState\ComponentStatePersistenceManagerTest.cs (2)
482return Task.FromResult(State); 506return Task.FromResult(State as IDictionary<string, byte[]>);
PersistentState\PersistentServicesRegistryTest.cs (1)
298return Task.FromResult(State);
PersistentStateValueProviderKeyResolverTests.cs (1)
412return Task.FromResult(State);
PersistentValueProviderComponentSubscriptionTests.cs (2)
528return Task.FromResult(workItem()); 623public Task<IDictionary<string, byte[]>> GetPersistedStateAsync() => Task.FromResult(state);
RendererTest.cs (2)
3885return Task.FromResult((1, NestedAsyncComponent.EventType.OnAfterRenderAsyncSync)); 5809EventAction = () => Task.FromResult((id, @event))
Rendering\RendererSynchronizationContextTest.cs (2)
685return Task.FromResult(Thread.CurrentThread); 718return Task.FromResult(Thread.CurrentThread);
Microsoft.AspNetCore.Components.WebAssembly (5)
Rendering\NullDispatcher.cs (1)
35return Task.FromResult(workItem());
Rendering\WebAssemblyDispatcher.cs (1)
57return Task.FromResult(workItem());
Services\DefaultWebAssemblyJSRuntime.cs (1)
162=> Task.FromResult<Stream>(PullFromJSDataStream.CreateJSDataStream(this, jsStreamReference, totalLength, cancellationToken));
Services\LazyAssemblyLoader.cs (1)
64return Task.FromResult<IEnumerable<Assembly>>(loadedAssemblies);
src\Shared\Components\PrerenderComponentApplicationStore.cs (1)
48return Task.FromResult((IDictionary<string, byte[]>)ExistingState);
Microsoft.AspNetCore.Components.WebView (1)
Services\WebViewJSRuntime.cs (1)
70=> Task.FromResult<Stream>(PullFromJSDataStream.CreateJSDataStream(this, jsStreamReference, totalLength, cancellationToken));
Microsoft.AspNetCore.Components.WebView.Photino (1)
PhotinoDispatcher.cs (1)
48return Task.FromResult(workItem());
Microsoft.AspNetCore.ConcurrencyLimiter.Tests (1)
TestUtils.cs (1)
85this(state => Task.FromResult(onTryEnter(state))
Microsoft.AspNetCore.CookiePolicy.Test (5)
CookiePolicyTests.cs (5)
27return Task.FromResult(0); 35return Task.FromResult(0); 45return Task.FromResult(0); 261return Task.FromResult(0); 300return Task.FromResult(0);
Microsoft.AspNetCore.Cors (3)
Infrastructure\CorsOptions.cs (2)
62PolicyMap[name] = (policy, Task.FromResult(policy)); 79PolicyMap[name] = (policy, Task.FromResult(policy));
Infrastructure\DefaultCorsPolicyProvider.cs (1)
12private static readonly Task<CorsPolicy?> NullResult = Task.FromResult<CorsPolicy?>(null);
Microsoft.AspNetCore.Cors.Test (9)
CorsMiddlewareTests.cs (9)
382.Returns(Task.FromResult<CorsPolicy>(null)) 411.Returns(Task.FromResult<CorsPolicy>(null)) 689.Returns(Task.FromResult<CorsPolicy>(null)) 719.Returns(Task.FromResult<CorsPolicy>(null)) 811.Returns(Task.FromResult<CorsPolicy>(null)) 843.Returns(Task.FromResult<CorsPolicy>(null)) 880.Returns(Task.FromResult<CorsPolicy>(null)) 916.Returns(Task.FromResult<CorsPolicy>(null)) 946.Returns(Task.FromResult<CorsPolicy>(null))
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (14)
HealthCheckMiddlewareTests.cs (14)
237.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))) 238.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad."))) 239.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))); 270.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))) 272.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))); 316.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))) 317.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad."))) 318.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))); 353.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))) 354.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("Pretty bad."))) 355.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))); 490.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!"))) 492.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Unhealthy("A-ok!"))) 493.AddAsyncCheck("Baz", () => Task.FromResult(HealthCheckResult.Healthy("A-ok!")));
Microsoft.AspNetCore.Diagnostics.Tests (2)
StatusCodeMiddlewareTest.cs (2)
36return Task.FromResult(1); 98return Task.FromResult(1);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (42)
TestObjects\Services\HttpBodyService.cs (1)
16return Task.FromResult(new HttpBody
UnaryServerCallHandlerTests.cs (41)
52return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 96return Task.FromResult(new HelloReply { Message = r.Name }); 130return Task.FromResult(new HelloReply { NullableMessage = null }); 165return Task.FromResult(new HelloReply { Values = { "One", "Two", "" } }); 195return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 230return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 270return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 320return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 370return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 420return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 470return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 520return Task.FromResult(new HelloReply()); 548return Task.FromResult(new HelloReply()); 575return Task.FromResult(new HelloReply()); 611return Task.FromResult(new HelloReply()); 646return Task.FromResult(new HelloReply()); 672return Task.FromResult(new HelloReply()); 699return Task.FromResult(new HelloReply()); 733return Task.FromResult(new HelloReply()); 765return Task.FromResult(new HelloReply()); 800return Task.FromResult(new HelloReply()); 1099return Task.FromResult(new HelloReply()); 1131return Task.FromResult(new HelloReply { Message = $"Hello {name}!" }); 1176return Task.FromResult(new HelloReply { Message = $"Hello {requestData.Length}!" }); 1219return Task.FromResult(new HelloReply()); 1252return Task.FromResult(new HelloReply()); 1285return Task.FromResult(new HelloReply()); 1312return Task.FromResult(new HelloReply { Message = $"Hello {r.Name}" }); 1347return Task.FromResult(new HttpBody 1381return Task.FromResult(new HelloReply()); 1403return Task.FromResult(new HelloReply()); 1441return Task.FromResult(new HelloReply()); 1488return Task.FromResult(new HelloReply()); 1516return Task.FromResult(new HelloReply()); 1573return Task.FromResult(new HelloReply()); 1587return Task.FromResult(new HelloReply()); 1640return handler != null ? handler(r, c) : Task.FromResult(new HelloReply()); 1660return Task.FromResult(new HelloReply()); 1702return Task.FromResult(new HelloReply 1751return Task.FromResult(new HelloReply()); 1787return Task.FromResult(new HelloReply());
Microsoft.AspNetCore.Grpc.Swagger.Tests (5)
Services\GreeterService.cs (1)
22return Task.FromResult(new HelloReply { Message = $"Hello {request.Name}" });
Services\ParametersService.cs (4)
13return Task.FromResult(new ParamResponse { Message = "DemoParametersOne Response" }); 18return Task.FromResult(new ParamResponse { Message = "DemoParametersTwo Response" }); 23return Task.FromResult(new ParamResponse { Message = "DemoParametersThree Response " }); 28return Task.FromResult(new ParamResponse { Message = "DemoParametersFour Response" });
Microsoft.AspNetCore.HeaderPropagation.Tests (2)
HeaderPropagationIntegrationTest.cs (1)
235return Task.FromResult(new HttpResponseMessage());
HeaderPropagationMessageHandlerTest.cs (1)
269return Task.FromResult(new HttpResponseMessage());
Microsoft.AspNetCore.Http (2)
Features\FormFeature.cs (1)
167_parsedFormTask = Task.FromResult(Form);
Features\TlsConnectionFeature.cs (1)
19return Task.FromResult(ClientCertificate);
Microsoft.AspNetCore.Http.Abstractions.Tests (5)
MapPathMiddlewareTests.cs (1)
17return Task.FromResult<object?>(null);
MapPredicateMiddlewareTests.cs (1)
17return Task.FromResult<object>(null!);
UseMiddlewareTest.cs (1)
393return Task.FromResult(0);
UsePathBaseExtensionsTests.cs (1)
217return Task.FromResult(0);
UseWhenExtensionsTests.cs (1)
145return terminate ? Task.FromResult<object?>(null) : next();
Microsoft.AspNetCore.Http.Connections (2)
src\SignalR\common\Shared\TaskCache.cs (2)
8public static readonly Task<bool> True = Task.FromResult(true); 9public static readonly Task<bool> False = Task.FromResult(false);
Microsoft.AspNetCore.Http.Connections.Client (2)
HttpConnection.cs (2)
34private static readonly Task<string?> _noAccessToken = Task.FromResult<string?>(null); 342_accessTokenProvider = () => Task.FromResult<string?>(accessToken);
Microsoft.AspNetCore.Http.Connections.Tests (4)
HttpConnectionDispatcherTests.cs (2)
3269AccessTokenProvider = () => Task.FromResult(token), 3431AccessTokenProvider = () => Task.FromResult(token),
HttpConnectionManagerTests.cs (1)
116connection.TransportTask = Task.FromResult(true);
TestWebSocketConnectionFeature.cs (1)
50return Task.FromResult<WebSocket>(serverSocket);
Microsoft.AspNetCore.Http.Extensions.Tests (12)
RequestDelegateFactoryTests.cs (11)
1337Task<JsonTodo> TaskTestAction() => Task.FromResult<JsonTodo>(originalTodo); 1450Task<CustomResult> TaskTestAction() => Task.FromResult(new CustomResult(resultString)); 1455static Task<CustomResult> StaticTaskTestAction() => Task.FromResult(new CustomResult("Still not enough tests!")); 1463static Task<object> StaticTaskOfIResultAsObject() => Task.FromResult<object>(new CustomResult("Still not enough tests!")); 1468Task<StructResult> TaskTestStructAction() => Task.FromResult(new StructResult(resultString)); 1523Task<IResult?> TaskTestAction() => Task.FromResult<IResult?>(null); 2350return Task.FromResult(default(FSharp.Core.Unit)!); 2476return Task.FromResult(new TodoStruct { Name = "Test todo" }); 2661var @delegate = () => Task.FromResult(new AddsCustomEndpointMetadataResult()); 2723var @delegate = () => Task.FromResult(new CountsDefaultEndpointMetadataResult()); 2982var @delegate = (Todo todo) => Task.FromResult(new RemovesAcceptsMetadataResult());
SendFileResponseExtensionsTests.cs (1)
131return Task.FromResult(0);
Microsoft.AspNetCore.Http.Results.Tests (2)
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (1)
274.Returns(Task.FromResult<int>(0));
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (1)
553return Task.FromResult(0);
Microsoft.AspNetCore.Http.Tests (2)
DefaultHttpContextTests.cs (2)
465return Task.FromResult(0); 470return Task.FromResult(0);
Microsoft.AspNetCore.HttpOverrides (3)
CertificateForwardingFeature.cs (3)
28set => _certificateTask = value is not null ? Task.FromResult<X509Certificate2?>(value) : null; 38_certificateTask = Task.FromResult<X509Certificate2?>(certificate); 44return Task.FromResult<X509Certificate2?>(null);
Microsoft.AspNetCore.HttpOverrides.Tests (13)
ForwardedHeadersMiddlewareTest.cs (7)
370return Task.FromResult(0); 455return Task.FromResult(0); 506return Task.FromResult(0); 557return Task.FromResult(0); 593return Task.FromResult(0); 682return Task.FromResult(0); 739return Task.FromResult(0);
HttpMethodOverrideMiddlewareTest.cs (6)
30return Task.FromResult(0); 61return Task.FromResult(0); 91return Task.FromResult(0); 124return Task.FromResult(0); 162return Task.FromResult(0); 199return Task.FromResult(0);
Microsoft.AspNetCore.Identity (2)
DataProtectorTokenProvider.cs (1)
189return Task.FromResult(false);
SignInManager.cs (1)
1301return Task.FromResult(SignInResult.LockedOut);
Microsoft.AspNetCore.Identity.EntityFrameworkCore (8)
RoleStore.cs (4)
199return Task.FromResult(ConvertIdToString(role.Id)!); 213return Task.FromResult(role.Name); 298return Task.FromResult(role.NormalizedName); 358return Task.FromResult(false);
UserOnlyStore.cs (2)
358return Task.FromResult(false); 421return Task.FromResult(false);
UserStore.cs (2)
475return Task.FromResult(false); 538return Task.FromResult(false);
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (1)
src\Identity\test\Shared\MockHelpers.cs (1)
73.Returns(Task.FromResult(IdentityResult.Success)).Verifiable();
Microsoft.AspNetCore.Identity.FunctionalTests (1)
MapIdentityApiTests.cs (1)
1501return Task.FromResult(true);
Microsoft.AspNetCore.Identity.InMemory.Test (73)
ControllerTest.cs (2)
26It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 80auth.Setup(a => a.AuthenticateAsync(context, It.IsAny<string>())).Returns(Task.FromResult(AuthenticateResult.NoResult()));
FunctionalTest.cs (1)
179return Task.FromResult(0);
InMemoryStore.cs (20)
25return Task.FromResult(0); 37return Task.FromResult(0); 47return Task.FromResult(roles); 54return Task.FromResult(result); 65return Task.FromResult<IList<TUser>>(new List<TUser>()); 67return Task.FromResult<IList<TUser>>(Users.Where(u => (u.Roles.Where(x => x.RoleId == role.Id).Any())).Select(x => x).ToList()); 75return Task.FromResult(IdentityResult.Success); 85return Task.FromResult(IdentityResult.Success); 90return Task.FromResult(role.Id); 95return Task.FromResult(role.Name); 101return Task.FromResult(0); 107return Task.FromResult(IdentityResult.Success); 114return Task.FromResult(_roles[roleId]); 116return Task.FromResult<TRole>(null); 122Task.FromResult( 129return Task.FromResult<IList<Claim>>(claims); 135return Task.FromResult(0); 147return Task.FromResult(0); 152return Task.FromResult(role.NormalizedName); 158return Task.FromResult(0);
InMemoryUserStore.cs (49)
36return Task.FromResult<IList<Claim>>(claims); 45return Task.FromResult(0); 56return Task.FromResult(0); 71return Task.FromResult(0); 77return Task.FromResult(0); 82return Task.FromResult(user.Email); 87return Task.FromResult(user.NormalizedEmail); 93return Task.FromResult(0); 98return Task.FromResult(user.EmailConfirmed); 104return Task.FromResult(0); 110Task.FromResult( 116return Task.FromResult(user.LockoutEnd); 122return Task.FromResult(0); 128return Task.FromResult(user.AccessFailedCount); 134return Task.FromResult(0); 139return Task.FromResult(user.AccessFailedCount); 144return Task.FromResult(user.LockoutEnabled); 150return Task.FromResult(0); 169return Task.FromResult(0); 185return Task.FromResult(0); 192return Task.FromResult(result); 200return Task.FromResult(_logins[key]); 202return Task.FromResult<TUser>(null); 207return Task.FromResult(user.Id); 212return Task.FromResult(user.UserName); 218return Task.FromResult(0); 224return Task.FromResult(IdentityResult.Success); 230return Task.FromResult(IdentityResult.Success); 237return Task.FromResult(_users[userId]); 239return Task.FromResult<TUser>(null); 249Task.FromResult( 260return Task.FromResult(IdentityResult.Success); 266return Task.FromResult(0); 271return Task.FromResult(user.PasswordHash); 276return Task.FromResult(user.PasswordHash != null); 282return Task.FromResult(0); 287return Task.FromResult(user.PhoneNumber); 292return Task.FromResult(user.PhoneNumberConfirmed); 298return Task.FromResult(0); 304return Task.FromResult(0); 309return Task.FromResult(user.SecurityStamp); 315return Task.FromResult(0); 320return Task.FromResult(user.TwoFactorEnabled); 325return Task.FromResult(user.NormalizedUserName); 331return Task.FromResult(0); 342return Task.FromResult<IList<TUser>>(query.ToList()); 366return Task.FromResult(0); 380return Task.FromResult(0); 390return Task.FromResult(tokenEntity?.TokenValue);
src\Identity\test\Shared\MockHelpers.cs (1)
73.Returns(Task.FromResult(IdentityResult.Success)).Verifiable();
Microsoft.AspNetCore.Identity.Specification.Tests (11)
IdentitySpecificationTestBase.cs (3)
145return Task.FromResult(IdentityResult.Failed(ErrorMessage)); 150return Task.FromResult(IdentityResult.Failed(ErrorMessage)); 155return Task.FromResult(IdentityResult.Failed(ErrorMessage));
UserManagerSpecificationTests.cs (8)
147return Task.FromResult(IdentityResult.Failed(ErrorMessage)); 152return Task.FromResult(IdentityResult.Failed(ErrorMessage)); 161return Task.FromResult(IdentityResult.Failed()); 166return Task.FromResult(IdentityResult.Failed()); 973return Task.FromResult(true); 1416=> Task.FromResult(true); 1419=> Task.FromResult(purpose); 1422=> Task.FromResult(true);
Microsoft.AspNetCore.Identity.Test (192)
NoopRoleStore.cs (10)
10return Task.FromResult(IdentityResult.Success); 15return Task.FromResult(IdentityResult.Success); 20return Task.FromResult<string>(null); 25return Task.FromResult(0); 30return Task.FromResult<PocoRole>(null); 35return Task.FromResult<PocoRole>(null); 44return Task.FromResult(IdentityResult.Success); 49return Task.FromResult<string>(null); 54return Task.FromResult<string>(null); 59return Task.FromResult(0);
NoopUserStore.cs (10)
10return Task.FromResult(user.Id); 15return Task.FromResult(user.UserName); 20return Task.FromResult(0); 25return Task.FromResult(IdentityResult.Success); 30return Task.FromResult(IdentityResult.Success); 35return Task.FromResult<PocoUser>(null); 40return Task.FromResult<PocoUser>(null); 49return Task.FromResult(IdentityResult.Success); 54return Task.FromResult<string>(null); 59return Task.FromResult(0);
Passkeys\PasskeyHandlerAssertionTest.cs (4)
1030.Returns(Task.FromResult<PocoUser?>(User)); 1033.Returns((PocoUser user, byte[] credentialId) => Task.FromResult( 1039.Returns((PocoUser user) => Task.FromResult<IList<UserPasskeyInfo>>( 1046.Returns(Task.FromResult(User.Id));
Passkeys\PasskeyHandlerAttestationTest.cs (2)
1018return Task.FromResult<PocoUser?>(existingUser); 1021return Task.FromResult<PocoUser?>(null);
RoleManagerTest.cs (7)
18store.Setup(s => s.GetRoleNameAsync(role, CancellationToken.None)).Returns(Task.FromResult(role.Name)).Verifiable(); 19store.Setup(s => s.SetNormalizedRoleNameAsync(role, normalizer.NormalizeName(role.Name), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 38store.Setup(s => s.GetRoleNameAsync(role, CancellationToken.None)).Returns(Task.FromResult(role.Name)).Verifiable(); 39store.Setup(s => s.SetNormalizedRoleNameAsync(role, normalizer.NormalizeName(role.Name), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 65store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName("Foo"), CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable(); 82store.Setup(s => s.FindByNameAsync(role.Name, CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable(); 101store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName("Foo"), CancellationToken.None)).Returns(Task.FromResult(role)).Verifiable();
SecurityStampValidatorTest.cs (2)
287signInManager.Setup(s => s.ValidateSecurityStampAsync(It.IsAny<ClaimsPrincipal>())).Returns(Task.FromResult(user)); 288signInManager.Setup(s => s.CreateUserPrincipalAsync(It.IsAny<PocoUser>())).Returns(Task.FromResult(new ClaimsPrincipal(new ClaimsIdentity("auth"))));
SignInManagerTest.cs (37)
322manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable(); 332It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 364manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable(); 380It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 441.Returns(Task.FromResult(new PasskeyRequestOptionsResult 448.Returns(Task.FromResult(assertionResult)); 452.Returns(Task.FromResult(IdentityResult.Success)) 524.Returns(() => Task.FromResult(authenticateResult)) 532return Task.FromResult(true); 569It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 626return Task.FromResult(IdentityResult.Success); 630manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout)); 723It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 724auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 725auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 833.Returns(Task.FromResult(authResult)).Verifiable(); 846.Returns(Task.FromResult(0)).Verifiable(); 885.Returns(Task.FromResult(AuthenticateResult.NoResult())).Verifiable(); 921.Returns(Task.FromResult(authResult)).Verifiable(); 976It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 979auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 980auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 992It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 1019return Task.FromResult(IdentityResult.Success); 1022manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout)); 1059It.Is<AuthenticationProperties>(v => v.IsPersistent == true))).Returns(Task.FromResult(0)).Verifiable(); 1120manager.Setup(m => m.GetValidTwoFactorProvidersAsync(user)).Returns(Task.FromResult(providers)).Verifiable(); 1160auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ApplicationScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 1161auth.Setup(a => a.SignOutAsync(context, IdentityConstants.TwoFactorUserIdScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 1162auth.Setup(a => a.SignOutAsync(context, IdentityConstants.ExternalScheme, It.IsAny<AuthenticationProperties>())).Returns(Task.FromResult(0)).Verifiable(); 1271return Task.FromResult(IdentityResult.Success); 1274manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout)); 1298return Task.FromResult(IdentityResult.Success); 1301manager.Setup(m => m.IsLockedOutAsync(user)).Returns(() => Task.FromResult(lockedout)); 1370It.Is<AuthenticationProperties>(v => isPersistent == null || v.IsPersistent == isPersistent))).Returns(Task.FromResult(0)).Verifiable(); 1747public Task<IEnumerable<AuthenticationScheme>> GetAllSchemesAsync() => Task.FromResult<IEnumerable<AuthenticationScheme>>(_defaultCookieSchemes.Values); 1748public Task<AuthenticationScheme> GetSchemeAsync(string name) => Task.FromResult(_defaultCookieSchemes.TryGetValue(name, out var scheme) ? scheme : null);
src\Identity\test\Shared\MockHelpers.cs (1)
73.Returns(Task.FromResult(IdentityResult.Success)).Verifiable();
UserManagerTest.cs (119)
73store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable(); 74store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 92store.Setup(s => s.GetSecurityStampAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.SecurityStamp)).Verifiable(); 93store.Setup(s => s.SetSecurityStampAsync(user, It.IsAny<string>(), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 112store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable(); 113store.Setup(s => s.GetEmailAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.Email)).Verifiable(); 114store.Setup(s => s.SetNormalizedEmailAsync(user, normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 115store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 188store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable(); 189store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 208store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.UserName)).Verifiable(); 209store.Setup(s => s.GetEmailAsync(user, CancellationToken.None)).Returns(Task.FromResult(user.Email)).Verifiable(); 210store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 211store.Setup(s => s.SetNormalizedEmailAsync(user, normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 230store.Setup(s => s.SetUserNameAsync(user, "foo", CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 231store.Setup(s => s.GetUserNameAsync(user, CancellationToken.None)).Returns(Task.FromResult("foo")).Verifiable(); 232store.Setup(s => s.SetNormalizedUserNameAsync(user, normalizer.NormalizeName("foo"), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 233store.Setup(s => s.UpdateAsync(user, CancellationToken.None)).Returns(Task.FromResult(IdentityResult.Success)).Verifiable(); 250store.Setup(s => s.FindByIdAsync(user.Id, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 268store.Setup(s => s.FindByNameAsync(normalizer.NormalizeName(user.UserName), CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 285store.Setup(s => s.FindByNameAsync(user.UserName, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 304store.Setup(s => s.FindByEmailAsync(normalizer.NormalizeEmail(user.Email), CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 321store.Setup(s => s.FindByEmailAsync(user.Email, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 345store.Setup(s => s.FindByEmailAsync("@Foo", CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 363store.Setup(s => s.FindByNameAsync("#Foo", CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 384.Returns(Task.FromResult(0)) 387.Returns(Task.FromResult(0)) 390.Returns(Task.FromResult(0)) 395.Returns(Task.FromResult(false)) 398.Returns(Task.FromResult(false)) 401.Returns(Task.FromResult(false)) 422.Returns(Task.FromResult(0)) 425.Returns(Task.FromResult(0)) 428.Returns(Task.FromResult(0)) 433.Returns(Task.FromResult(false)) 436.Returns(Task.FromResult(false)) 439.Returns(Task.FromResult(false)) 462.Returns(Task.FromResult(0)) 465.Returns(Task.FromResult(true)) 486.Returns(Task.FromResult(0)) 489.Returns(Task.FromResult(0)) 492.Returns(Task.FromResult(0)) 496.Returns(Task.FromResult(true)) 499.Returns(Task.FromResult(true)) 502.Returns(Task.FromResult(true)) 523.Returns(Task.FromResult(0)) 526.Returns(Task.FromResult(true)) 529.Returns(Task.FromResult(false)) 549.Returns(Task.FromResult(0)) 573.Returns(Task.FromResult(0)) 605.Returns(Task.FromResult(0)) 607store.Setup(s => s.UpdateAsync(user, CancellationToken.None)).Returns(Task.FromResult(IdentityResult.Success)).Verifiable(); 643store.Setup(s => s.SetPasswordHashAsync(user, It.IsAny<string>(), CancellationToken.None)).Returns(Task.FromResult(0)).Verifiable(); 644store.Setup(x => x.UpdateAsync(It.IsAny<PocoUser>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(IdentityResult.Success)); 737.Returns(Task.FromResult(0)) 768.Returns(Task.FromResult(0)) 815store.Setup(s => s.GetPasskeysAsync(user, CancellationToken.None)).Returns(Task.FromResult(passkeys)).Verifiable(); 833store.Setup(s => s.FindByPasskeyIdAsync(credentialId, CancellationToken.None)).Returns(Task.FromResult(user)).Verifiable(); 1020store.Setup(x => x.GetUserIdAsync(It.IsAny<PocoUser>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(Guid.NewGuid().ToString())); 1553=> Task.FromResult(badResult); 1570return Task.FromResult<IList<Claim>>(new List<Claim>()); 1575return Task.FromResult(0); 1580return Task.FromResult(0); 1585return Task.FromResult(0); 1590return Task.FromResult(0); 1595return Task.FromResult(""); 1600return Task.FromResult(false); 1605return Task.FromResult(0); 1610return Task.FromResult<PocoUser>(null); 1615return Task.FromResult<DateTimeOffset?>(DateTimeOffset.MinValue); 1620return Task.FromResult(0); 1625return Task.FromResult(0); 1630return Task.FromResult(0); 1635return Task.FromResult(0); 1640return Task.FromResult(false); 1645return Task.FromResult(0); 1650return Task.FromResult(0); 1655return Task.FromResult(0); 1660return Task.FromResult<IList<UserLoginInfo>>(new List<UserLoginInfo>()); 1665return Task.FromResult<PocoUser>(null); 1674return Task.FromResult(0); 1679return Task.FromResult(IdentityResult.Success); 1684return Task.FromResult(IdentityResult.Success); 1689return Task.FromResult(IdentityResult.Success); 1694return Task.FromResult<PocoUser>(null); 1699return Task.FromResult<PocoUser>(null); 1704return Task.FromResult(0); 1709return Task.FromResult<string>(null); 1714return Task.FromResult(false); 1719return Task.FromResult(0); 1724return Task.FromResult(""); 1729return Task.FromResult(false); 1734return Task.FromResult(0); 1739return Task.FromResult(0); 1744return Task.FromResult(0); 1749return Task.FromResult<IList<string>>(new List<string>()); 1754return Task.FromResult(false); 1759return Task.FromResult(0); 1764return Task.FromResult(""); 1769return Task.FromResult(0); 1774return Task.FromResult(false); 1779return Task.FromResult<string>(null); 1784return Task.FromResult<string>(null); 1789return Task.FromResult<string>(null); 1794return Task.FromResult(0); 1799return Task.FromResult<IList<PocoUser>>(new List<PocoUser>()); 1804return Task.FromResult<IList<PocoUser>>(new List<PocoUser>()); 1809return Task.FromResult(""); 1814return Task.FromResult(0); 1824return Task.FromResult<IList<UserPasskeyInfo>>([]); 1829return Task.FromResult<PocoUser>(null); 1834return Task.FromResult<UserPasskeyInfo>(null); 1849return Task.FromResult("Test"); 1854return Task.FromResult(true); 1859return Task.FromResult(true); 2161.Returns(Task.FromResult(user2)) 2164.Returns(Task.FromResult(user2.Id)) 2167.Returns(Task.FromResult(user.UserName)) 2170.Returns(Task.FromResult(user.Email))
Microsoft.AspNetCore.InternalTesting.Tests (2)
TaskExtensionsTest.cs (2)
24await Task.FromResult(true).TimeoutAfter(TimeSpan.FromMilliseconds(30000)); 60await Task.FromResult(true).DefaultTimeout();
Microsoft.AspNetCore.Localization (4)
AcceptLanguageHeaderRequestCultureProvider.cs (1)
48return Task.FromResult<ProviderCultureResult?>(new ProviderCultureResult(orderedLanguages));
CookieRequestCultureProvider.cs (1)
42return Task.FromResult<ProviderCultureResult?>(providerResultCulture);
QueryStringRequestCultureProvider.cs (1)
69return Task.FromResult<ProviderCultureResult?>(providerResultCulture);
RequestCultureProvider.cs (1)
18protected static readonly Task<ProviderCultureResult?> NullProviderCultureResult = Task.FromResult(default(ProviderCultureResult));
Microsoft.AspNetCore.Localization.Routing (1)
RouteDataRequestCultureProvider.cs (1)
64return Task.FromResult<ProviderCultureResult?>(providerResultCulture);
Microsoft.AspNetCore.Localization.Tests (18)
AcceptLanguageHeaderRequestCultureProviderTest.cs (4)
39return Task.FromResult(0); 80return Task.FromResult(0); 120return Task.FromResult(0); 166return Task.FromResult(0);
CookieRequestCultureProviderTest.cs (3)
53return Task.FromResult(0); 105return Task.FromResult(0); 154return Task.FromResult(0);
CustomRequestCultureProviderTest.cs (2)
42return Task.FromResult(requestCulture); 50return Task.FromResult(0);
QueryStringRequestCultureProviderTest.cs (8)
43return Task.FromResult(0); 77return Task.FromResult(0); 118return Task.FromResult(0); 159return Task.FromResult(0); 201return Task.FromResult(0); 243return Task.FromResult(0); 290return Task.FromResult(0); 338return Task.FromResult(0);
RequestLocalizationOptionsExtensionsTest.cs (1)
15var provider = new CustomRequestCultureProvider(context => Task.FromResult(new ProviderCultureResult("ar-YE")));
Microsoft.AspNetCore.Mvc.Abstractions (3)
Formatters\InputFormatterResult.cs (3)
13private static readonly Task<InputFormatterResult> _failureAsync = Task.FromResult(_failure); 14private static readonly Task<InputFormatterResult> _noValueAsync = Task.FromResult(_noValue); 96return Task.FromResult(Success(model));
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (2)
EndpointMetadataApiDescriptionProviderTest.cs (2)
554Task.FromResult(TypedResults.Created("https://example.com", new InferredJsonClass()))); 575() => Task.FromResult(Results.Ok(new InferredJsonClass())));
Microsoft.AspNetCore.Mvc.Core (3)
Infrastructure\ControllerActionInvoker.cs (1)
358return Task.FromResult<ActionExecutedContext>(_actionExecutedContext);
Infrastructure\ResourceInvoker.cs (2)
927return Task.FromResult<ResourceExecutedContext>(_resourceExecutedContext); 1423return Task.FromResult<ResultExecutedContext>(_resultExecutedContext);
Microsoft.AspNetCore.Mvc.Core.Test (65)
AcceptedAtActionResultTests.cs (1)
127.Returns(Task.FromResult(0));
AcceptedAtRouteResultTests.cs (1)
58.Returns(Task.FromResult(0));
AcceptedResultTests.cs (1)
54.Returns(Task.FromResult(0));
ApplicationModels\AuthorizationApplicationModelProviderTest.cs (1)
159.Returns(Task.FromResult(authorizationPolicy))
ApplicationModels\EndpointMetadataProviderTest.cs (4)
320=> Task.FromResult<AddsCustomEndpointMetadataResult>(null); 335=> Task.FromResult<AddsCustomEndpointMetadataActionResult>(null); 346=> Task.FromResult<RemovesAcceptsMetadataResult>(null); 357=> Task.FromResult<RemovesAcceptsMetadataActionResult>(null);
Authorization\AuthorizeFilterTest.cs (3)
241=> Task.FromResult(_true); 246return Task.FromResult(policyName == "true" ? _true : _false); 250=> Task.FromResult<AuthorizationPolicy>(null);
FileResultHelperTest.cs (1)
520return Task.FromResult(0);
Filters\MiddlewareFilterBuilderTest.cs (3)
138return Task.FromResult(context); 200return Task.FromResult(context); 268return Task.FromResult(context);
Filters\MiddlewareFilterTest.cs (4)
30Task requestDelegate(HttpContext context) => Task.FromResult(true); 56return Task.FromResult(true); // short circuit the request 102return Task.FromResult(true); // short circuits the request 228() => Task.FromResult(new ResourceExecutedContext(new ActionContext(), new List<IFilterMetadata>())));
Formatters\OutputFormatterTests.cs (1)
240return Task.FromResult(true);
Formatters\TextOutputFormatterTests.cs (2)
266return Task.FromResult(true); 286return Task.FromResult(true);
Infrastructure\ActionMethodExecutorTest.cs (7)
490public Task<IActionResult> ReturnIActionResultAsync() => Task.FromResult((IActionResult)new StatusCodeResult(201)); 492public Task<ViewResult> ReturnActionResultAsync() => Task.FromResult(new ViewResult { StatusCode = 200 }); 494public Task<StatusCodeResult> ReturnsIActionResultSubTypeAsync() => Task.FromResult(new StatusCodeResult(200)); 496public Task<TestModel> ReturnsModelAsModelAsync() => Task.FromResult(new TestModel()); 498public Task<object> ReturnsModelAsObjectAsync() => Task.FromResult((object)new TestModel()); 500public Task<object> ReturnIActionResultAsObjectAsync() => Task.FromResult((object)new OkResult()); 502public Task<ActionResult<TestModel>> ReturnActionResultOFTAsync() => Task.FromResult(new ActionResult<TestModel>(new TestModel()));
Infrastructure\ControllerActionInvokerTest.cs (13)
158.Returns(Task.FromResult(true)) 171return Task.FromResult(true); 324.Returns(Task.FromResult(true)) 381.Returns(Task.FromResult(true)) 400return Task.FromResult(true); 462return Task.FromResult(true); 651.Returns<ActionContext>((context) => Task.FromResult(true)) 1808return await Task.FromResult<TestActionResult>(new TestActionResult { Value = value }); 1823return await Task.FromResult(new TestActionResult { Value = value }); 1833return await Task.FromResult<IActionResult>(null); 1838return await Task.FromResult<TestActionResult>(null); 1930=> Task.FromResult(new ConvertibleToActionResult { Value = input }); 1966return Task.FromResult(0);
Infrastructure\DefaultOutputFormatterSelectorTest.cs (4)
404return Task.FromResult(0); 420return Task.FromResult(0); 435return Task.FromResult(0); 451return Task.FromResult(0);
Infrastructure\FileStreamResultExecutorTest.cs (1)
52=> Task.FromResult(0);
Infrastructure\ObjectResultExecutorTest.cs (4)
514return Task.FromResult(0); 531return Task.FromResult(0); 546return Task.FromResult(0); 562return Task.FromResult(0);
ModelBinding\Binders\BinderTypeModelBinderProviderTest.cs (1)
50return Task.FromResult(0);
ModelBinding\Binders\BinderTypeModelBinderTest.cs (1)
99return Task.FromResult(0);
ModelBinding\Binders\FormCollectionModelBinderTest.cs (1)
61.Returns(Task.FromResult(formCollection));
ModelBinding\Binders\FormFileModelBinderTest.cs (1)
476.Returns(Task.FromResult(formCollection));
ObjectResultTests.cs (1)
179return Task.FromResult(0);
ProducesAttributeTests.cs (3)
25() => Task.FromResult(CreateResultExecutedContext(resultExecutingContext))); 52() => Task.FromResult(CreateResultExecutedContext(resultExecutingContext))); 77() => Task.FromResult(CreateResultExecutedContext(resultExecutingContext)));
Routing\AttributeRouteTest.cs (1)
19private static readonly RequestDelegate NullHandler = (c) => Task.FromResult(0);
Routing\MvcRouteHandlerTests.cs (1)
90.Returns(Task.FromResult(true));
Routing\UrlHelperTest.cs (2)
147context.Handler = (c) => Task.FromResult(0); 148return Task.FromResult(false);
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (1)
274.Returns(Task.FromResult<int>(0));
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (1)
553return Task.FromResult(0);
Microsoft.AspNetCore.Mvc.Core.TestCommon (34)
CommonFilterTest.cs (4)
33var next = new ActionExecutionDelegate(() => Task.FromResult(CreateActionExecutedContext(context))); 102var next = new ResultExecutionDelegate(() => Task.FromResult(CreateResultExecutedContext(context))); 140var next = new ResultExecutionDelegate(() => Task.FromResult(CreateResultExecutedContext(context))); 233return Task.FromResult(true);
CommonResourceInvokerTest.cs (30)
60.Returns<ExceptionContext>((context) => Task.FromResult(true)) 83.Returns(Task.FromResult(true)) 125.Returns(Task.FromResult(true)) 131.Returns<ExceptionContext>((context) => Task.FromResult(true)) 144.Returns<ExceptionContext>((context) => Task.FromResult(true)) 196.Returns(Task.FromResult(true)) 262.Returns(Task.FromResult(true)) 308.Returns<ExceptionContext>((context) => Task.FromResult(true)) 330.Returns(Task.FromResult(true)) 343.Returns<ExceptionContext>((context) => Task.FromResult(true)) 377.Returns<ExceptionContext>((context) => Task.FromResult(true)) 398.Returns(Task.FromResult(true)) 411.Returns<ExceptionContext>((context) => Task.FromResult(true)) 439.Returns<ActionContext>((context) => Task.FromResult(true)) 449.Returns<ExceptionContext>((context) => Task.FromResult(true)) 498.Returns<ActionContext>((context) => Task.FromResult(true)) 526.Returns<ActionContext>((context) => Task.FromResult(true)) 597.Returns<AuthorizationFilterContext>(context => Task.FromResult(true)) 618.Returns(Task.FromResult(true)) 624.Callback<AuthorizationFilterContext>(c => Task.FromResult(true)) 652.Returns(Task.FromResult(true)) 660return Task.FromResult(true); 670return Task.FromResult(true); 739.Returns<ActionContext>((context) => Task.FromResult(true)) 859return Task.FromResult(true); 901return Task.FromResult(true); 1525.Returns(Task.FromResult(true)) 1544return Task.FromResult(true); 1592return Task.FromResult(true); 1627.Returns(Task.FromResult(true))
Microsoft.AspNetCore.Mvc.Cors.Test (2)
CorsApplicationModelProviderTest.cs (1)
296return Task.FromResult(0);
CorsAuthorizationFilterTest.cs (1)
121.Returns(Task.FromResult(new CorsPolicy()));
Microsoft.AspNetCore.Mvc.IntegrationTests (2)
AuthorizeFilterIntegrationTest.cs (2)
204return Task.FromResult(new AuthorizationPolicy(requirements, new string[] { })); 209return Task.FromResult<AuthorizationPolicy>(null);
Microsoft.AspNetCore.Mvc.Razor (2)
Compilation\DefaultViewCompiler.cs (2)
64compiledViews.TryAdd(compiledView.RelativePath, Task.FromResult(compiledView)); 111return Task.FromResult(new CompiledViewDescriptor
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (2)
PageLoaderMatcherPolicyTest.cs (2)
24var loader = Mock.Of<PageLoader>(p => p.LoadAsync(It.IsAny<PageActionDescriptor>(), It.IsAny<EndpointMetadataCollection>()) == Task.FromResult(compiled)); 44.Returns(Task.FromResult(compiled))
Microsoft.AspNetCore.Mvc.Razor.Test (26)
RazorPageTest.cs (10)
27private readonly RenderAsyncDelegate _nullRenderAsyncDelegate = () => Task.FromResult(0); 294return Task.FromResult(innerContentLevel1); 326return Task.FromResult(innerContentLevel1); 342return Task.FromResult(innerContentLevel2); 985executeChildContentAsync: () => Task.FromResult(result: true), 1027executeChildContentAsync: () => Task.FromResult(result: true), 1073executeChildContentAsync: () => Task.FromResult(result: true), 1116executeChildContentAsync: () => Task.FromResult(result: true), 1146executeChildContentAsync: () => Task.FromResult(result: true), 1382return Task.FromResult(0);
RazorViewTest.cs (2)
1821return Task.FromResult(0); 1843return Task.FromResult(0);
TagHelpers\TagHelperComponentTagHelperTest.cs (6)
80getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 136getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 167getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 198getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 233getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 266getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
TagHelpers\UrlResolutionTagHelperTest.cs (8)
74getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 104getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 164getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 225getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 281getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 320getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 358getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 396getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null));
Microsoft.AspNetCore.Mvc.RazorPages (3)
Infrastructure\DefaultPageLoader.cs (1)
46compiledPageActionDescriptor.CompiledPageActionDescriptorTask ??= Task.FromResult(compiledPageActionDescriptor);
Infrastructure\ExecutorFactory.cs (2)
165return Task.FromResult<IActionResult?>(null); 192return Task.FromResult(_thunk(receiver, arguments));
Microsoft.AspNetCore.Mvc.RazorPages.Test (27)
Filters\PageHandlerResultFilterTest.cs (4)
41ResultExecutionDelegate next = () => Task.FromResult(resultExecutedContext); 82ResultExecutionDelegate next = () => Task.FromResult(resultExecutedContext); 124ResultExecutionDelegate next = () => Task.FromResult(resultExecutedContext); 160return Task.FromResult(resultExecutedContext);
Infrastructure\DynamicPageEndpointMatcherPolicyTest.cs (1)
80.Returns((PageActionDescriptor descriptor, EndpointMetadataCollection endpoint) => Task.FromResult(new CompiledPageActionDescriptor
Infrastructure\ExecutorFactoryTest.cs (5)
250public Task<IActionResult> GenericTaskHandler() => Task.FromResult<IActionResult>(new EmptyResult()); 254return Task.FromResult(new ContentResult 295public Task<IActionResult> GenericTaskHandler() => Task.FromResult<IActionResult>(new EmptyResult()); 299return Task.FromResult(new ContentResult 307public Task<object> TaskOfObject() => Task.FromResult(new object());
Infrastructure\PageActionInvokerTest.cs (7)
835.Returns(Task.FromResult(true)) 895.Returns(Task.FromResult(true)) 916return Task.FromResult(true); 981return Task.FromResult(true); 1178.Returns<ActionContext>((context) => Task.FromResult(true)) 1457handlers.Add((obj, args) => Task.FromResult(result)); 1534handlers[i] = (obj, args) => Task.FromResult<IActionResult>(new PageResult());
Infrastructure\PageBinderFactoryTest.cs (4)
850public override Task ExecuteAsync() => Task.FromResult(0); 867public override Task ExecuteAsync() => Task.FromResult(0); 890public override Task ExecuteAsync() => Task.FromResult(0); 913public override Task ExecuteAsync() => Task.FromResult(0);
Infrastructure\PageHandlerPageFilterTest.cs (4)
36PageHandlerExecutionDelegate next = () => Task.FromResult(pageHandlerExecutedContext); 84PageHandlerExecutionDelegate next = () => Task.FromResult(pageHandlerExecutedContext); 127PageHandlerExecutionDelegate next = () => Task.FromResult(pageHandlerExecutedContext); 164return Task.FromResult(pageHandlerExecutedContext);
PageModelTest.cs (2)
1871() => Task.FromResult(pageHandlerExecutedContext)); 1906() => Task.FromResult(pageHandlerExecutedContext));
Microsoft.AspNetCore.Mvc.TagHelpers (2)
Cache\DistributedCacheTagHelperFormatter.cs (2)
29return Task.FromResult(serialized); 38return Task.FromResult(new HtmlString(content));
Microsoft.AspNetCore.Mvc.TagHelpers.Test (153)
AnchorTagHelperTest.cs (12)
47return Task.FromResult<TagHelperContent>(tagHelperContent); 104return Task.FromResult<TagHelperContent>(tagHelperContent); 154return Task.FromResult<TagHelperContent>(tagHelperContent); 206return Task.FromResult<TagHelperContent>(tagHelperContent); 264return Task.FromResult<TagHelperContent>(tagHelperContent); 323return Task.FromResult<TagHelperContent>(tagHelperContent); 381return Task.FromResult<TagHelperContent>(tagHelperContent); 432return Task.FromResult<TagHelperContent>(tagHelperContent); 501getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 548getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 586getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 624getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null));
CacheTagHelperTest.cs (6)
508return Task.FromResult(tagHelperContent); 562return Task.FromResult<TagHelperContent>(tagHelperContent); 728return Task.FromResult<TagHelperContent>(tagHelperContent); 824return Task.FromResult<TagHelperContent>(content); 912return Task.FromResult<TagHelperContent>(content); 964return Task.FromResult<TagHelperContent>(tagHelperContent);
ComponentTagHelperTest.cs (1)
75(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
DistributedCacheTagHelperTest.cs (4)
41.Returns(Task.FromResult(value)); 83.Returns(Task.FromResult<byte[]>(null)); 561return Task.FromResult<TagHelperContent>(tagHelperContent); 770return Task.FromResult<TagHelperContent>(tagHelperContent);
EnvironmentTagHelperTest.cs (1)
233return Task.FromResult<TagHelperContent>(tagHelperContent);
FormActionTagHelperTest.cs (12)
40return Task.FromResult<TagHelperContent>(tagHelperContent); 115return Task.FromResult<TagHelperContent>(tagHelperContent); 211return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 271return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 349return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 403return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 452return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 525getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 571getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 609getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 647getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 685getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null));
FormTagHelperTest.cs (21)
42return Task.FromResult<TagHelperContent>(tagHelperContent); 90return Task.FromResult<TagHelperContent>(tagHelperContent); 146return Task.FromResult<TagHelperContent>(tagHelperContent); 203return Task.FromResult<TagHelperContent>(tagHelperContent); 261return Task.FromResult<TagHelperContent>(tagHelperContent); 324return Task.FromResult<TagHelperContent>(tagHelperContent); 396return Task.FromResult<TagHelperContent>(tagHelperContent); 451return Task.FromResult<TagHelperContent>(tagHelperContent); 522return Task.FromResult<TagHelperContent>(tagHelperContent); 586return Task.FromResult<TagHelperContent>(tagHelperContent); 641return Task.FromResult<TagHelperContent>(tagHelperContent); 698return Task.FromResult<TagHelperContent>(tagHelperContent); 755return Task.FromResult<TagHelperContent>(tagHelperContent); 813return Task.FromResult<TagHelperContent>(tagHelperContent); 868return Task.FromResult<TagHelperContent>(tagHelperContent); 914return Task.FromResult<TagHelperContent>(tagHelperContent); 984return Task.FromResult<TagHelperContent>(tagHelperContent); 1022getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 1064getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 1098getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null)); 1132getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(null));
ImageTagHelperTest.cs (2)
53getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 354return Task.FromResult<TagHelperContent>(tagHelperContent);
InputTagHelperTest.cs (31)
92getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 140getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 187getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 231getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 283getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 328getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 382getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 438getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 489getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 545getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 656return Task.FromResult<TagHelperContent>(tagHelperContent); 891getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 945getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 1005getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 1065getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 1125getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 1169return Task.FromResult<TagHelperContent>(tagHelperContent); 1269return Task.FromResult<TagHelperContent>(tagHelperContent); 1368getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(result: null)) 1435return Task.FromResult<TagHelperContent>(tagHelperContent); 1535return Task.FromResult<TagHelperContent>(tagHelperContent); 1647return Task.FromResult<TagHelperContent>(tagHelperContent); 1765getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1838getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1907getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2001getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2081getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2143getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2211getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2277getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 2335getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
LabelTagHelperTest.cs (2)
199return Task.FromResult<TagHelperContent>(tagHelperContent); 320return Task.FromResult<TagHelperContent>(tagHelperContent);
LinkTagHelperTest.cs (1)
1161getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
OptionTagHelperTest.cs (4)
411return Task.FromResult<TagHelperContent>(null); 482return Task.FromResult<TagHelperContent>(tagHelperContent); 547return Task.FromResult<TagHelperContent>(tagHelperContent); 575getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
PartialTagHelperTest.cs (1)
863(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
PersistComponentStateTagHelperTest.cs (1)
252(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
RenderAtEndOfFormTagHelperTest.cs (2)
58return Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()); 101return Task.FromResult(true);
ScriptTagHelperTest.cs (1)
1131getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
SelectTagHelperTest.cs (9)
211return Task.FromResult<TagHelperContent>(tagHelperContent); 301return Task.FromResult<TagHelperContent>(tagHelperContent); 392return Task.FromResult<TagHelperContent>(tagHelperContent); 481return Task.FromResult<TagHelperContent>(tagHelperContent); 570return Task.FromResult<TagHelperContent>(tagHelperContent); 652return Task.FromResult<TagHelperContent>(tagHelperContent); 727(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 765(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 815(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
TagHelperOutputExtensionsTest.cs (24)
337getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 439getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 467return Task.FromResult<TagHelperContent>(tagHelperContent); 502return Task.FromResult<TagHelperContent>(tagHelperContent); 534return Task.FromResult<TagHelperContent>(tagHelperContent); 563getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 591getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 617getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 776getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 802getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 825getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 853getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 878getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 900getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 927getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 949getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 979getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1000getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1022getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1049getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1068getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1091getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1112getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 1135getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
TextAreaTagHelperTest.cs (3)
137return Task.FromResult<TagHelperContent>(tagHelperContent); 182(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 221(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()));
ValidationMessageTagHelperTest.cs (8)
57return Task.FromResult<TagHelperContent>(tagHelperContent); 123(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 168(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 221(_, __) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 271return Task.FromResult<TagHelperContent>(tagHelperContent); 327return Task.FromResult<TagHelperContent>(tagHelperContent); 390return Task.FromResult<TagHelperContent>(tagHelperContent); 428getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>(
ValidationSummaryTagHelperTest.cs (7)
236return Task.FromResult<TagHelperContent>(tagHelperContent); 306return Task.FromResult<TagHelperContent>(tagHelperContent); 367getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 422getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 481getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 537getChildContentAsync: (useCachedResult, encoder) => Task.FromResult<TagHelperContent>( 622return Task.FromResult<TagHelperContent>(tagHelperContent);
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (47)
DependencyInjection\MvcViewFeaturesMvcBuilderExtensionsTest.cs (1)
174public Task<string> InvokeAsync() => Task.FromResult("Hello world");
Filters\AutoValidateAntiforgeryTokenAuthorizationFilterTest.cs (3)
26.Returns(Task.FromResult(0)) 54.Returns(Task.FromResult(0)) 78.Returns(Task.FromResult(0))
Filters\SaveTempDataFilterTest.cs (1)
400private Func<Task> _responseStartingAsync = () => Task.FromResult(true);
Filters\ValidateAntiforgeryTokenAuthorizationFilterTest.cs (2)
30.Returns(Task.FromResult(0)) 54.Returns(Task.FromResult(0))
PartialViewResultTest.cs (1)
186.Returns(Task.FromResult(0))
Rendering\DefaultTemplatesUtilities.cs (1)
313.Returns(Task.FromResult(0));
Rendering\HtmlHelperDisplayExtensionsTest.cs (13)
53.Returns(Task.FromResult(0)); 136.Returns(Task.FromResult(0)); 162.Returns(Task.FromResult(0)); 188.Returns(Task.FromResult(0)); 216.Returns(Task.FromResult(0)); 244.Returns(Task.FromResult(0)); 291.Returns(Task.FromResult(0)); 322.Returns(Task.FromResult(0)); 363.Returns(Task.FromResult(0)); 388.Returns(Task.FromResult(0)); 416.Returns(Task.FromResult(0)); 463.Returns(Task.FromResult(0)); 490.Returns(Task.FromResult(0));
Rendering\HtmlHelperEditorExtensionsTest.cs (2)
20.Returns(Task.FromResult(0)); 46.Returns(Task.FromResult(0));
Rendering\HtmlHelperPartialExtensionsTest.cs (8)
53.Returns(Task.FromResult(htmlContent)) 127.Returns(Task.FromResult(htmlContent)) 202.Returns(Task.FromResult(true)) 250.Returns(Task.FromResult(true)) 272.Returns(Task.FromResult((IHtmlContent)expected)) 293.Returns(Task.FromResult((IHtmlContent)expected)) 317.Returns(Task.FromResult((IHtmlContent)expected)) 339.Returns(Task.FromResult((IHtmlContent)expected))
SessionStateTempDataProviderTest.cs (2)
111return Task.FromResult(0); 116return Task.FromResult(0);
ViewComponentResultTest.cs (3)
408var result = Task.FromResult<IHtmlContent>(new HtmlContentBuilder().AppendHtml(expected)); 450var result = Task.FromResult<IHtmlContent>(new HtmlContentBuilder().AppendHtml(expected)); 744return Task.FromResult(new HtmlString("Hello-Async, " + name));
ViewComponents\DefaultViewComponentDescriptorProviderTest.cs (3)
123public Task InvokeAsync() => Task.FromResult(0); 140public Task Invoke() => Task.FromResult(0); 145public Task<int> Invoke() => Task.FromResult(0);
ViewComponents\ViewComponentFeatureProviderTest.cs (1)
72public Task<string> InvokeAsync() => Task.FromResult("Hello world");
ViewComponents\ViewViewComponentResultTest.cs (3)
31.Returns(Task.FromResult(result: true)) 70.Returns(Task.FromResult(result: true)) 104.Returns(Task.FromResult(result: true))
ViewComponentTests.cs (2)
278return Task.FromResult(0); 283return Task.FromResult(0);
ViewResultTest.cs (1)
198.Returns(Task.FromResult(0))
Microsoft.AspNetCore.OpenApi.Tests (6)
Services\OpenApiDocumentServiceTestsBase.cs (1)
111return Task.FromResult(0);
Services\OpenApiGeneratorTests.cs (3)
162AssertJsonResponse(GetOpenApiOperation(() => Task.FromResult(new InferredJsonClass())), JsonSchemaType.Object); 163AssertJsonResponse(GetOpenApiOperation(() => Task.FromResult((IInferredJsonInterface)null)), JsonSchemaType.Object); 193AssertVoid(GetOpenApiOperation(() => Task.FromResult(default(FSharp.Core.Unit))));
Services\OpenApiSchemaService\OpenApiSchemaService.ParameterSchemas.cs (1)
987return Task.FromResult<IActionResult>(Ok());
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (1)
234static Task<Todo?> GetTodoAsync() => Task.FromResult(Random.Shared.Next() < 0.5 ? new Todo(1, "Test Title", true, DateTime.Now) : null);
Microsoft.AspNetCore.Owin.Tests (3)
OwinExtensionTests.cs (3)
38return Task.FromResult(0); 72return Task.FromResult(0); 106return Task.FromResult(0);
Microsoft.AspNetCore.Razor (1)
TagHelpers\TagHelperOutput.cs (1)
27(useCachedResult, encoder) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent()))
Microsoft.AspNetCore.Razor.Runtime.Test (13)
Runtime\TagHelpers\TagHelperExecutionContextTest.cs (12)
75return Task.FromResult(result: true); 97return Task.FromResult(true); 115return Task.FromResult(true); 155return Task.FromResult(true); 220executeChildContentAsync: async () => await Task.FromResult(result: true), 279return Task.FromResult(result: true); 302executeChildContentAsync: () => Task.FromResult(result: true), 327return Task.FromResult(result: true); 354return Task.FromResult(result: true); 381return Task.FromResult(result: true); 411return Task.FromResult(result: true); 435executeChildContentAsync: () => Task.FromResult(result: true),
Runtime\TagHelpers\TagHelperScopeManagerTest.cs (1)
239executeChildContentAsync: async () => await Task.FromResult(result: true));
Microsoft.AspNetCore.Razor.Test (8)
TagHelpers\TagHelperOutputTest.cs (8)
23(useCachedResult, encoder) => Task.FromResult<TagHelperContent>(initialGetChildContent); 76return Task.FromResult<TagHelperContent>(content); 118return Task.FromResult<TagHelperContent>(content); 147return Task.FromResult<TagHelperContent>(content); 192return Task.FromResult<TagHelperContent>(content); 355(cachedResult, encoder) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 389(cachedResult, encoder) => Task.FromResult<TagHelperContent>(new DefaultTagHelperContent())); 1103getChildContentAsync: (useCachedContent, encoder) => Task.FromResult<TagHelperContent>(
Microsoft.AspNetCore.RequestDecompression.Tests (2)
RequestDecompressionMiddlewareTests.cs (2)
616static Task requestDelegate(HttpContext context) => Task.FromResult(context); 631static Task requestDelegate(HttpContext context) => Task.FromResult(context);
Microsoft.AspNetCore.ResponseCompression.Tests (1)
ResponseCompressionMiddlewareTest.cs (1)
325return Task.FromResult(0);
Microsoft.AspNetCore.Routing (1)
EndpointRoutingMiddleware.cs (1)
266_initializationTask = Task.FromResult(matcher);
Microsoft.AspNetCore.Routing.Tests (15)
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (1)
91return await Task.FromResult("String Test");
RouteCollectionTest.cs (2)
556.Returns(Task.FromResult<object>(null)) 686.Returns(Task.FromResult<object>(null))
RouterMiddlewareTest.cs (3)
81return Task.FromResult<object>(null); 112return Task.FromResult<object>(null); 143return Task.FromResult<object>(null);
RouteTest.cs (8)
74.Returns(Task.FromResult(true)); 128.Returns(Task.FromResult(true)); 182.Returns(Task.FromResult(true)); 224.Returns(Task.FromResult(true)); 266.Returns(Task.FromResult(true)); 306.Returns(Task.FromResult(true)); 358.Returns(Task.FromResult(true)); 1843.Returns(Task.FromResult<object>(null));
Tree\TreeRouterTest.cs (1)
2118return Task.FromResult(true);
Microsoft.AspNetCore.Server.HttpSys (9)
AuthenticationHandler.cs (2)
19return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(_requestContext.User!, properties: null, authenticationScheme: _scheme!.Name))); 21return Task.FromResult(AuthenticateResult.NoResult());
RequestProcessing\RequestContext.cs (1)
111return Task.FromResult<Stream>(opaqueStream);
RequestProcessing\RequestContext.FeatureCollection.cs (2)
346_clientCertTask = Task.FromResult(value); 365return _clientCertTask = Task.FromResult(clientCert);
RequestProcessing\RequestStream.cs (4)
195return Task.FromResult<int>(0); 218return Task.FromResult<int>((int)dataRead); 275return Task.FromResult<int>((int)totalRead); 297return Task.FromResult<int>((int)totalRead);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (86)
AuthenticationTests.cs (8)
35return Task.FromResult(0); 75return Task.FromResult(0); 101return Task.FromResult(0); 137return Task.FromResult(0); 158return Task.FromResult(0); 184return Task.FromResult(0); 422return Task.FromResult(0); 449return Task.FromResult(0);
Http2Tests.cs (5)
324return Task.FromResult(0); 368return Task.FromResult(0); 407return Task.FromResult(0); 446return Task.FromResult(0); 670return Task.FromResult(0);
HttpsTests.cs (1)
29return Task.FromResult(0);
OpaqueUpgradeTests.cs (3)
36return Task.FromResult(0); 64return Task.FromResult(0); 170return Task.FromResult(0);
RequestBodyLimitTests.cs (10)
34return Task.FromResult(0); 78return Task.FromResult(0); 101return Task.FromResult(0); 145return Task.FromResult(0); 171return Task.FromResult(0); 196return Task.FromResult(0); 221return Task.FromResult(0); 247return Task.FromResult(0); 297return Task.FromResult(0); 324return Task.FromResult(0);
RequestBodyTests.cs (5)
35return Task.FromResult(0); 57return Task.FromResult(0); 113return Task.FromResult(0); 135return Task.FromResult(0); 157return Task.FromResult(0);
RequestHeaderTests.cs (8)
30return Task.FromResult(0); 52return Task.FromResult(0); 94return Task.FromResult(0); 113return Task.FromResult(0); 136return Task.FromResult(0); 167return Task.FromResult(0); 193return Task.FromResult(0); 221return Task.FromResult(0);
RequestTests.cs (11)
61return Task.FromResult(0); 125return Task.FromResult(0); 188return Task.FromResult(0); 232return Task.FromResult(0); 249return Task.FromResult(0); 329return Task.FromResult(0); 355return Task.FromResult(0); 371return Task.FromResult(0); 411return Task.FromResult(0); 436return Task.FromResult(0); 456return Task.FromResult(0);
ResponseBodyTests.cs (7)
240return Task.FromResult(0); 298return Task.FromResult(0); 327return Task.FromResult(0); 330return Task.FromResult(0); 355return Task.FromResult(0); 358return Task.FromResult(0); 383return Task.FromResult(0);
ResponseHeaderTests.cs (8)
26return Task.FromResult(0); 49return Task.FromResult(0); 75return Task.FromResult(0); 100return Task.FromResult(0); 125return Task.FromResult(0); 167return Task.FromResult(0); 230return Task.FromResult(0); 283return Task.FromResult(0);
ResponseSendFileTests.cs (1)
288return Task.FromResult(0);
ResponseTests.cs (6)
30return Task.FromResult(0); 49return Task.FromResult(0); 69return Task.FromResult(0); 87return Task.FromResult(0); 104return Task.FromResult(0); 119return Task.FromResult(0);
ResponseTrailersTests.cs (7)
29return Task.FromResult(0); 47return Task.FromResult(0); 68return Task.FromResult(0); 86return Task.FromResult(0); 274return Task.FromResult(0); 302return Task.FromResult(0); 322return Task.FromResult(0);
ServerTests.cs (6)
31return Task.FromResult(0); 59return Task.FromResult(0); 97return Task.FromResult(0); 340using (Utilities.CreateHttpServer(out address, httpContext => Task.FromResult(0), LoggerFactory)) { } 362}, httpContext => Task.FromResult(0), LoggerFactory)) 401}, httpContext => Task.FromResult(0), LoggerFactory))
Microsoft.AspNetCore.Server.IIS (4)
Core\EmptyStream.cs (1)
44return Task.FromResult(0);
Core\IISHttpContext.FeatureCollection.cs (1)
380return Task.FromResult(((ITlsConnectionFeature)this).ClientCertificate);
Core\IISServerAuthenticationHandlerInternal.cs (2)
30return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(user, Scheme.Name))); 34return Task.FromResult(AuthenticateResult.NoResult());
Microsoft.AspNetCore.Server.IISIntegration (3)
AuthenticationHandler.cs (2)
23return Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(_user, _scheme.Name))); 27return Task.FromResult(AuthenticateResult.NoResult());
ForwardedTlsConnectionFeature.cs (1)
50return Task.FromResult(ClientCertificate);
Microsoft.AspNetCore.Server.IISIntegration.Tests (6)
IISMiddlewareTests.cs (6)
42return Task.FromResult(0); 80return Task.FromResult(0); 305app.Run(context => Task.FromResult(0)); 338app.Run(context => Task.FromResult(0)); 371return Task.FromResult(0); 507return Task.FromResult(0);
Microsoft.AspNetCore.Server.IntegrationTesting (1)
ApplicationPublisher.cs (1)
99return Task.FromResult(new PublishedApplication(publishDirectory.FullName, logger));
Microsoft.AspNetCore.Server.IntegrationTesting.IIS (1)
IISDeployer.cs (1)
117return Task.FromResult<DeploymentResult>(new IISDeploymentResult(
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Internal\TlsConnectionFeature.cs (2)
42_clientCertTask = Task.FromResult(value); 89return _clientCertTask = Task.FromResult(ClientCertificate);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (2)
Http1ReadingBenchmark.cs (1)
26private static readonly Task _pseudoAsyncTask = Task.FromResult(27);
Http1WritingBenchmark.cs (1)
25private static readonly Task _pseudoAsyncTask = Task.FromResult(27);
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Internal\QuicConnectionContext.FeatureCollection.cs (2)
32_clientCertTask = Task.FromResult(value); 38return _clientCertTask ??= Task.FromResult(ClientCertificate);
Microsoft.AspNetCore.Session.Tests (10)
SessionTests.cs (10)
40return Task.FromResult(0); 77return Task.FromResult(0); 132return Task.FromResult(0); 346return Task.FromResult(0); 531return Task.FromResult(0); 617return Task.FromResult(0); 658return Task.FromResult(0); 856return Task.FromResult(0); 919return Task.FromResult(0); 1102return Task.FromResult(0);
Microsoft.AspNetCore.Shared.Tests (7)
ObjectMethodExecutorTest.cs (7)
453return Task.FromResult<int>(i + j); 463return Task.FromResult(default(Unit)); 483return Task.FromResult<TestObject>(new TestObject() { value = "Hello" }); 494await Task.FromResult(default(Unit)); 516Task.FromResult(default(Unit)); 530return Task.FromResult<TestObject>(parameter); 576return FSharpAsync.AwaitTask(Task.FromResult(parameter));
Microsoft.AspNetCore.SignalR.Client.Core (1)
HubConnectionExtensions.OnResult.cs (1)
23return Task.FromResult<object?>(currentHandler(parameters));
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
HubConnectionTests.cs (1)
1937return Task.FromResult("test");
Microsoft.AspNetCore.SignalR.Client.Tests (47)
HttpConnectionFactoryTests.cs (1)
80Func<Task<string>> tokenProvider = () => Task.FromResult("");
HttpConnectionTests.ConnectionLifecycle.cs (2)
307return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError)); 337return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.InternalServerError));
HttpConnectionTests.Negotiate.cs (2)
383return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Unauthorized)); 394Task<string> AccessTokenProvider() => Task.FromResult<string>("firstSecret");
HttpConnectionTests.Transport.cs (16)
56return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent)); 62return Task.FromResult(callCount.ToString(CultureInfo.InvariantCulture)); 89testHttpHandler.OnRequest((request, next, token) => Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent))); 138return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent)); 178return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.NoContent)); 237return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Accepted)); 331return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture)); 386return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Unauthorized)); 395return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK)); 401return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture)); 439return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture)); 486return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Unauthorized)); 493return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK, new StreamContent(stream))); 499return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture)); 536return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.OK, new StreamContent(stream))); 542return Task.FromResult(accessTokenCallCount.ToString(CultureInfo.InvariantCulture));
HubConnectionTests.cs (3)
764var accessTokenFactory = new Func<Task<string>>(() => Task.FromResult("fakeAccessToken")); 853.Returns(() => Task.FromResult(It.IsAny<ChannelReader<object>>())); 854mockConnection.Setup(c => c.InvokeCoreAsync(It.IsAny<string>(), It.IsAny<Type>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>())).Returns(() => Task.FromResult(It.IsAny<object>()));
HubConnectionTests.Extensions.cs (2)
488return Task.FromResult(returnResult); 518return Task.FromResult(returnResult);
HubServerProxyGeneratorTests.cs (12)
62.Returns(Task.FromResult(default(object))); 84.Returns(Task.FromResult((object)10)); 107.Returns(Task.FromResult((object)new List<int> { 10 })); 133.Returns(Task.FromResult((object)10)); 157.Returns(Task.FromResult((object)new List<int> { 10 })); 186.Returns(Task.FromResult(channel.Reader)); 193.Returns(Task.FromResult(channel.Reader)); 239.Returns(Task.FromResult((object)6)); 273.Returns(Task.FromResult(retChannelReader)); 280.Returns(Task.FromResult(retChannelReader)); 317.Returns(Task.FromResult(default(object))); 324.Returns(Task.FromResult((object)10));
LongPollingTransportTests.cs (1)
733return await Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
ServerSentEventsTransportTests.cs (1)
91return Task.FromResult(new HttpResponseMessage { Content = new StreamContent(mockStream.Object) });
TestHttpMessageHandler.cs (6)
126return Task.FromResult(ResponseUtils.CreateResponse(HttpStatusCode.Accepted)); 175public void OnNegotiate(Func<HttpRequestMessage, CancellationToken, HttpResponseMessage> handler) => OnNegotiate((req, cancellationToken) => Task.FromResult(handler(req, cancellationToken))); 192public void OnLongPollDelete(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPollDelete((cancellationToken) => Task.FromResult(handler(cancellationToken))); 209public void OnLongPoll(Func<CancellationToken, HttpResponseMessage> handler) => OnLongPoll(cancellationToken => Task.FromResult(handler(cancellationToken))); 218OnLongPoll((request, token) => Task.FromResult(handler(request, token))); 236public void OnSocketSend(Func<byte[], CancellationToken, HttpResponseMessage> handler) => OnSocketSend((data, cancellationToken) => Task.FromResult(handler(data, cancellationToken)));
WebSocketsTransportTests.cs (1)
30var webSocketsTransport = new WebSocketsTransport(options, loggerFactory: LoggerFactory, () => Task.FromResult<string>(null), null);
Microsoft.AspNetCore.SignalR.Core (2)
src\SignalR\common\Shared\TaskCache.cs (2)
8public static readonly Task<bool> True = Task.FromResult(true); 9public static readonly Task<bool> False = Task.FromResult(false);
Microsoft.AspNetCore.SignalR.Microbenchmarks (3)
DefaultHubDispatcherBenchmark.cs (2)
126return Task.FromResult(1); 147return Task.FromResult<ChannelReader<int>>(channel);
RedisHubLifetimeManagerBenchmark.cs (1)
42ConnectionFactory = _ => Task.FromResult<IConnectionMultiplexer>(new TestConnectionMultiplexer(server))
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (2)
RedisHubLifetimeManagerTests.cs (1)
32var options = new RedisOptions() { ConnectionFactory = async (t) => await Task.FromResult(new TestConnectionMultiplexer(server)) };
TestConnectionMultiplexer.cs (1)
440return Task.FromResult(t);
Microsoft.AspNetCore.SignalR.Tests (3)
EndToEndTests.cs (2)
490AccessTokenProvider = () => Task.FromResult(token), 664o.AccessTokenProvider = () => Task.FromResult(token);
HubConnectionHandlerTestUtils\Hubs.cs (1)
85return Task.FromResult(42);
Microsoft.AspNetCore.SpaServices.Extensions (1)
Proxying\SpaProxyingExtensions.cs (1)
46() => Task.FromResult(baseUri));
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaProxyTests.cs (1)
57var baseUriTask = Task.FromResult(new Uri(baseUrl));
Microsoft.AspNetCore.TestHost (1)
TestWebSocket.cs (1)
297return Task.FromResult(true);
Microsoft.AspNetCore.TestHost.Tests (11)
ClientHandlerTests.cs (6)
65return Task.FromResult(0); 104return Task.FromResult(0); 377return Task.FromResult(0); 391return Task.FromResult(0); 681return Task.FromResult(0); 710return Task.FromResult(0);
HttpContextBuilderTests.cs (3)
121return Task.FromResult(0); 145return Task.FromResult(0); 441return Task.FromResult(0);
ResponseFeatureTests.cs (1)
52return Task.FromResult(string.Empty);
WebSocketClientTests.cs (1)
38return Task.FromResult(0);
Microsoft.AspNetCore.Testing.Tests (2)
TestResources\ReturningHttpClientHandler.cs (1)
22return Task.FromResult(new HttpResponseMessage(HttpStatusCode.Gone));
TestResources\TestHandler.cs (1)
16return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK));
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
2859public Task<bool> HandleRequestAsync() => Task.FromResult(false); 2868return Task.FromResult(AuthenticateResult.Success(
Microsoft.AspNetCore.WebSockets.Tests (2)
BufferStream.cs (2)
99return Task.FromResult(0); 269return Task.FromResult<object>(null);
Microsoft.AspNetCore.WebUtilities.Tests (3)
FormReaderTests.cs (2)
207return Task.FromResult(reader.ReadForm()); 212return Task.FromResult(reader.ReadNextPair());
HttpRequestStreamReaderTest.cs (1)
484Task.FromResult(httpRequestStreamReader.ReadLine())
Microsoft.Build.Tasks.CodeAnalysis (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
Microsoft.Build.Tasks.CodeAnalysis.Sdk (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
Microsoft.CodeAnalysis (5)
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
644_lazyPrimaryTask = Task.FromResult(true);
DiagnosticAnalyzer\AsyncQueue.cs (1)
239? Task.FromResult(result.Value)
PEWriter\DebugSourceDocument.cs (1)
50_sourceInfo = Task.FromResult(new DebugSourceInfo(checksum, algorithm));
Syntax\SyntaxReference.cs (1)
40return Task.FromResult(this.GetSyntax(cancellationToken));
Syntax\SyntaxTree.cs (1)
122return Task.FromResult(this.TryGetText(out SourceText? text) ? text : this.GetText(cancellationToken));
Microsoft.CodeAnalysis.Analyzers (14)
MetaAnalyzers\Fixers\AnalyzerReleaseTrackingFix.cs (1)
109return Task.FromResult(project.Solution);
MetaAnalyzers\Fixers\ApplyDiagnosticAnalyzerAttributeFix.cs (1)
78return Task.FromResult(document.WithSyntaxRoot(newRoot));
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.AnalyzerUtilities (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.BannedApiAnalyzers (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.CodeStyle (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.CodeStyle.Fixes (6)
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
102return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode(finalTarget, replacement)));
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
64return Task.FromResult(document.WithSyntaxRoot(newRoot));
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
64token => Task.FromResult(otherDocument.WithSyntaxRoot(newRoot)),
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (2)
59_ => Task.FromResult(UpgradeProject(project, newVersion))); 68ct => Task.FromResult(UpgradeAllProjects(solution, language, newVersion, ct)));
src\Analyzers\Core\CodeFixes\UseAutoProperty\UseAutoPropertyFixAllProvider.cs (1)
32return Task.FromResult<CodeAction?>(CodeAction.Create(
Microsoft.CodeAnalysis.CSharp (1)
Syntax\CSharpSyntaxTree.cs (1)
102return Task.FromResult(this.TryGetRoot(out CSharpSyntaxNode? node) ? node : this.GetRoot(cancellationToken));
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (5)
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
84_ => Task.FromResult(document.WithSyntaxRoot(root)),
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
107return CodeAction.Create(title, _ => Task.FromResult(newDocument), title);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
34_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (2)
108return Task.FromResult<SyntaxNode>(propertyDeclaration); 143return Task.FromResult<SyntaxNode>(finalProperty);
Microsoft.CodeAnalysis.CSharp.EditorFeatures (3)
Formatting\CSharpFormattingInteractionService.cs (3)
88return Task.FromResult(Formatter.GetFormattedTextChanges(parsedDocument.Root, [formattingSpan], document.Project.Solution.Services, options, cancellationToken).ToImmutableArray()); 96return Task.FromResult(service.GetFormattingChangesOnPaste(parsedDocument, textSpan, options, cancellationToken)); 110return Task.FromResult(service.GetFormattingChangesOnTypedCharacter(parsedDocument, position, indentationOptions, cancellationToken));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (15)
CodeActions\AddUsing\AddUsingNuGetTests.cs (2)
61.Returns(Task.FromResult(true)); 98.Returns(Task.FromResult(true));
CodeActions\ApplyChangesOperationTests.cs (1)
53=> Task.FromResult<Solution?>(_changedSolution);
CodeActions\GenerateEqualsAndGetHashCodeFromMembers\GenerateEqualsAndGetHashCodeFromMembersTests.cs (1)
50return Task.FromResult<Workspace>(workspace);
CodeActions\MoveStaticMembers\CSharpMoveStaticMembersTests.cs (1)
3391return Task.FromResult<Workspace>(workspace);
CodeActions\PreviewTests.cs (1)
86return Task.FromResult(solution);
Diagnostics\FixAllProvider\BatchFixerTests.cs (1)
88var fix = CodeAction.Create("QualifyWithThisFix", _ => Task.FromResult(newDocument));
Formatting\CodeCleanupTests.TestFixers.cs (2)
88return Task.FromResult<CodeAction?>(CodeAction.Create( 144return Task.FromResult<CodeAction?>(CodeAction.Create(
PdbSourceDocument\NullResultMetadataAsSourceFileProvider.cs (1)
42return Task.FromResult<MetadataAsSourceFile?>(NullResult);
PdbSourceDocument\TestSourceLinkService.cs (4)
27return Task.FromResult<PdbFilePathResult?>(null); 30return Task.FromResult<PdbFilePathResult?>(new PdbFilePathResult(_pdbFilePath)); 37return Task.FromResult<SourceFilePathResult?>(null); 40return Task.FromResult<SourceFilePathResult?>(new SourceFilePathResult(_sourceFilePath));
TaskList\NoCompilationTaskListTests.cs (1)
61=> Task.FromResult(ImmutableArray.Create(new TaskListItem(
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (6)
Recommendations\DynamicKeywordRecommenderTests.cs (1)
23this.RecommendKeywordsAsync = (position, context) => Task.FromResult(_recommender.RecommendKeywords(position, context, CancellationToken.None));
Recommendations\KeywordRecommenderTests.cs (1)
53RecommendKeywordsAsync = (position, context) => Task.FromResult(recommender.GetTestAccessor().RecommendKeywords(position, context));
Recommendations\NativeIntegerKeywordRecommenderTests.cs (1)
21RecommendKeywordsAsync = (position, context) => Task.FromResult(Recommender.RecommendKeywords(position, context, CancellationToken.None));
Recommendations\NotnullKeywordRecommenderTests.cs (1)
22this.RecommendKeywordsAsync = (position, context) => Task.FromResult(_recommender.RecommendKeywords(position, context, CancellationToken.None));
Recommendations\ScopedKeywordRecommenderTests.cs (1)
20this.RecommendKeywordsAsync = (position, context) => Task.FromResult(_recommender.RecommendKeywords(position, context, CancellationToken.None));
Recommendations\VarKeywordRecommenderTests.cs (1)
23this.RecommendKeywordsAsync = (position, context) => Task.FromResult(_recommender.RecommendKeywords(position, context, CancellationToken.None));
Microsoft.CodeAnalysis.CSharp.Features (26)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.FixAllProvider.cs (1)
37return Task.FromResult<CodeAction?>(new FixAllCodeAction(EnableNullableReferenceTypesInSolutionAsync));
CodeRefactorings\UseRecursivePatterns\UseRecursivePatternsCodeRefactoringProvider.cs (1)
68_ => Task.FromResult(document.WithSyntaxRoot(replacementFunc(root))),
Completion\CompletionProviders\AttributeNamedParameterCompletionProvider.cs (1)
247=> Task.FromResult(GetTextChange(selectedItem, ch));
Completion\CompletionProviders\CrefCompletionProvider.cs (1)
382return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\CompletionProviders\ExplicitInterfaceTypeCompletionProvider.cs (1)
118return Task.FromResult(interfaceSet.SelectAsArray(t => new SymbolAndSelectionInfo(Symbol: t, Preselect: false)));
Completion\CompletionProviders\ImportCompletion\ExtensionMethodImportCompletionProvider.cs (1)
59=> Task.FromResult(commitKey is ';' or '.');
Completion\CompletionProviders\NamedParameterCompletionProvider.cs (1)
282return Task.FromResult<TextChange?>(new TextChange(
Completion\CompletionProviders\TupleNameCompletionProvider.cs (1)
118return Task.FromResult<TextChange?>(new TextChange(
Copilot\CSharpCopilotCodeFixProvider.DismissChangesCodeAction.cs (2)
26=> Task.FromResult<IEnumerable<CodeActionOperation>>(null!); 29=> Task.FromResult<IEnumerable<CodeActionOperation>>(
ExtractInterface\CSharpExtractInterfaceService.cs (1)
75return Task.FromResult(unformattedSolution);
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.MultipleStatementsCodeGenerator.cs (1)
89return Task.FromResult<SyntaxNode>(statement.WithAdditionalAnnotations(CallSiteAnnotation));
ExtractMethod\CSharpMethodExtractor.CSharpCodeGenerator.SingleStatementCodeGenerator.cs (1)
50return Task.FromResult<SyntaxNode>(statement.WithAdditionalAnnotations(CallSiteAnnotation));
GoToDefinition\CSharpGoToDefinitionSymbolService.cs (1)
26=> Task.FromResult(symbol);
IntroduceVariable\CSharpIntroduceVariableService_IntroduceField.cs (2)
64return Task.FromResult(document.Document.WithSyntaxRoot(newRoot)); 77return Task.FromResult(document.Document.WithSyntaxRoot(newRoot));
QuickInfo\CSharpDiagnosticAnalyzerQuickInfoProvider.cs (1)
47return Task.FromResult<QuickInfoItem?>(null);
QuickInfo\CSharpSyntacticQuickInfoProvider.cs (2)
29=> Task.FromResult(BuildQuickInfo(token, context.CancellationToken)); 34=> Task.FromResult(BuildQuickInfo(token, context.CancellationToken));
SignatureHelp\InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs (1)
32return Task.FromResult((items, selectedItemIndex));
Snippets\CSharpElseSnippetProvider.cs (1)
60return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), elseClause.ToFullString()));
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpAddYieldCodeFixProvider.cs (1)
84_ => Task.FromResult(document.WithSyntaxRoot(root)),
src\Analyzers\CSharp\CodeFixes\Iterator\CSharpChangeToIEnumerableCodeFixProvider.cs (1)
107return CodeAction.Create(title, _ => Task.FromResult(newDocument), title);
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
34_ => Task.FromResult(AllowUnsafeOnProject(context.Document.Project))), context.Diagnostics);
src\Analyzers\CSharp\CodeFixes\UseAutoProperty\CSharpUseAutoPropertyCodeFixProvider.cs (2)
108return Task.FromResult<SyntaxNode>(propertyDeclaration); 143return Task.FromResult<SyntaxNode>(finalProperty);
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (12)
Copilot\CSharpImplementNotImplementedExceptionFixProviderTests.cs (11)
579return Task.FromResult<Workspace>(_testWorkspace); 612=> Task.FromResult(true); 615=> Task.FromResult(true); 618=> Task.FromResult(true); 621=> Task.FromResult(true); 624=> Task.FromResult(true); 653=> Task.FromResult(true); 671return Task.FromResult(SetupFixAll.Invoke(document, methodOrProperties, cancellationToken)); 676return Task.FromResult(CreateSingleNodeResult(methodOrProperties, PrepareUsingSingleFakeResult)); 679return Task.FromResult(ImmutableDictionary<SyntaxNode, ImplementationDetails>.Empty); 697return Task.FromResult(true);
ExtractClass\ExtractClassTests.cs (1)
53return Task.FromResult<Workspace>(TestWorkspace.Create(WorkspaceKind, LanguageNames.CSharp, unusedCompilationOptions, unusedParseOptions));
Microsoft.CodeAnalysis.EditorFeatures (13)
Extensibility\NavigationBar\AbstractEditorNavigationBarItemService.cs (2)
82return Task.FromResult((document.Id, navigationSpan.Start, 0)); 90return Task.FromResult((documentId, span.Start, 0));
ExternalAccess\VSTypeScript\VSTypeScriptEditorInlineRenameService.cs (1)
41return Task.FromResult(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>.Empty);
InlineRename\AbstractEditorInlineRenameService.cs (1)
37return Task.FromResult(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>.Empty);
InlineRename\AbstractEditorInlineRenameService.FailureInlineRenameInfo.cs (1)
46public Task<IInlineRenameLocationSet> FindRenameLocationsAsync(SymbolRenameOptions options, CancellationToken cancellationToken) => Task.FromResult<IInlineRenameLocationSet>(null);
IntelliSense\AsyncCompletion\ItemManager.cs (1)
76return Task.FromResult(itemList);
LanguageServer\AbstractInProcLanguageClient.cs (1)
273return Task.FromResult<InitializationFailureContext?>(initializationFailureContext);
Organizing\OrganizeDocumentCommandHandler.cs (1)
172(snapshot, context) => Task.FromResult(snapshot.GetOpenDocumentInCurrentContextWithChanges()),
Preview\SolutionPreviewItem.cs (1)
29: this(projectId, documentId, c => Task.FromResult<object?>(text))
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs (1)
66return Task.FromResult(ImmutableArray.Create<CodeActionOperation>(committerOperation));
RenameTracking\RenameTrackingTaggerProvider.TrackingSession.cs (1)
41private static readonly Task<TriggerIdentifierKind> s_notRenamableTask = Task.FromResult(TriggerIdentifierKind.NotRenamable);
SignatureHelp\Controller.Session_SetModelSelectedItem.cs (1)
21(model, cancellationToken) => Task.FromResult(SetModelExplicitlySelectedItemInBackground(model, selector)),
Suggestions\SuggestedActionWithNestedActions.cs (1)
58=> Task.FromResult<IEnumerable<SuggestedActionSet>>(NestedActionSets);
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Workspaces\NoCompilationDocumentDiagnosticAnalyzer.cs (1)
25return Task.FromResult(ImmutableArray.Create(
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (19)
CodeFixes\CodeFixServiceTests.cs (6)
405createChangedDocument: _ => Task.FromResult(context.Document)), 561return Task.FromResult(ImmutableArray<Diagnostic>.Empty); 567return Task.FromResult(ImmutableArray<Diagnostic>.Empty); 786context.RegisterCodeFix(CodeAction.Create(_name, ct => Task.FromResult(context.Document)), fixableDiagnostics); 832ct => Task.FromResult(context.Document), 1211createChangedDocument: _ => Task.FromResult(context.Document),
CodeFixes\ErrorCases\CodeFixExceptionInFixableDiagnosticIds.cs (1)
25=> Task.FromResult(true);
CodeFixes\ErrorCases\CodeFixExceptionInFixableDiagnosticIds2.cs (1)
18=> Task.FromResult(true);
CodeFixes\ErrorCases\CodeFixExceptionInGetFixAllProvider.cs (2)
28context.RegisterCodeFix(CodeAction.Create("Do Nothing", token => Task.FromResult(context.Document)), context.Diagnostics[0]); 30return Task.FromResult(true);
CodeRefactorings\CodeRefactoringServiceTest.cs (2)
68context.RegisterRefactoring(CodeAction.Create($"Blocking=false", _ => Task.FromResult<Document>(null))); 124cancellationToken => Task.FromResult(context.Document),
Completion\CompletionServiceTests.cs (2)
121return Task.FromResult(CompletionDescription.FromText(nameof(DebugAssertTestCompletionProvider))); 126return Task.FromResult(CompletionChange.Create(new TextChange(item.Span, nameof(DebugAssertTestCompletionProvider))));
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
1052return Task.FromResult<ImmutableArray<Diagnostic>>(
LanguageServer\VSTypeScriptHandlerTests.cs (1)
186return Task.FromResult(Response);
LinkedFiles\LinkedFileDiffMergingEditorTests.cs (1)
111context.RegisterRefactoring(CodeAction.Create("Description", _ => Task.FromResult(newSolution)), context.Span);
RenameTracking\RenameTrackingTaggerProviderTests.cs (1)
867var notRenamable = Task.FromResult(RenameTrackingTaggerProvider.TriggerIdentifierKind.NotRenamable);
UnusedReferences\UnusedReferencesRemoverTests.cs (1)
219return Task.FromResult(true);
Microsoft.CodeAnalysis.ExternalAccess.Copilot (9)
Internal\Analyzer\AbstractCopilotCodeAnalysisService.cs (1)
171return Task.FromResult(diagnostics.WhereAsArray(static (diagnostic, span) => diagnostic.Location.SourceSpan.IntersectsWith(span), span));
Internal\Analyzer\CSharp\CSharpCopilotCodeAnalysisService.cs (8)
67return Task.FromResult(ImmutableArray<Diagnostic>.Empty); 75return Task.FromResult(ImmutableArray<string>.Empty); 83return Task.FromResult(ImmutableArray<Diagnostic>.Empty); 91return Task.FromResult(false); 107return Task.FromResult(string.Empty); 115return Task.FromResult((string.Empty, false)); 143return Task.FromResult(false); 151return Task.FromResult<(Dictionary<string, string>?, bool)>((null, false));
Microsoft.CodeAnalysis.ExternalAccess.FSharp (1)
Internal\Editor\FSharpEditorInlineRenameService.cs (1)
207return Task.FromResult(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>.Empty);
Microsoft.CodeAnalysis.Features (63)
AddConstructorParametersFromMembers\AddConstructorParametersFromMembersCodeRefactoringProvider.AddConstructorParametersCodeAction.cs (1)
68return Task.FromResult<Solution?>(constructorDocument.WithSyntaxRoot(newRoot).Project.Solution);
AddImport\CodeActions\InstallWithPackageManagerCodeAction.cs (1)
28return Task.FromResult(ImmutableArray.Create<CodeActionOperation>(
AddImport\CodeActions\MetadataSymbolReferenceCodeAction.cs (1)
34return Task.FromResult<CodeActionOperation?>(new ApplyChangesOperation(project.AddMetadataReference(reference).Solution));
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (2)
49return Task.FromResult<CodeActionOperation?>(applyOperation); 52return Task.FromResult<CodeActionOperation?>(new AddProjectReferenceCodeActionOperation(OriginalDocument.Project.Id, FixData.ProjectReferenceToAdd, applyOperation));
AddMissingReference\AddMissingReferenceCodeAction.cs (2)
80return Task.FromResult(ImmutableArray.Create<CodeActionOperation>( 88return Task.FromResult(ImmutableArray.Create(operation));
AddPackage\InstallPackageDirectlyCodeAction.cs (1)
34=> Task.FromResult(ImmutableArray.Create(_installPackageOperation));
AddPackage\InstallWithPackageManagerCodeAction.cs (1)
25return Task.FromResult(ImmutableArray.Create<CodeActionOperation>(
CodeFixes\Configuration\ConfigureCodeStyle\ConfigureCodeStyleOptionCodeFixProvider.cs (2)
56=> Task.FromResult(GetConfigurations(document.Project, diagnostics)); 59=> Task.FromResult(GetConfigurations(project, diagnostics));
CodeFixes\Configuration\ConfigureSeverity\ConfigureSeverityLevelCodeFixProvider.cs (2)
48=> Task.FromResult(GetConfigurations(document.Project, diagnostics, cancellationToken)); 51=> Task.FromResult(GetConfigurations(project, diagnostics, cancellationToken));
CodeFixes\Service\CodeFixService.FixAllPredefinedDiagnosticProvider.cs (2)
23=> Task.FromResult<IEnumerable<Diagnostic>>(_diagnostics); 26=> Task.FromResult<IEnumerable<Diagnostic>>(_diagnostics);
CodeFixes\Suppression\AbstractSuppressionBatchFixAllProvider.cs (1)
219return CodeAction.SolutionChangeAction.Create(title, _ => Task.FromResult(newSolution), title);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.cs (1)
145return Task.FromResult(ImmutableArray<CodeFix>.Empty);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (1)
63return Task.FromResult(document);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs (1)
149createChangedSolution: ct => Task.FromResult(currentSolution),
CodeLens\CodeLensReferencesService.cs (2)
95progress => Task.FromResult(new ReferenceCount( 99progress => Task.FromResult(new ReferenceCount(progress.SearchCap, IsCapped: true, projectVersion.ToString())),
CodeRefactorings\MoveType\AbstractMoveTypeService.RenameFileEditor.cs (1)
32=> Task.FromResult<Solution?>(
Completion\CommonCompletionProvider.cs (2)
106? Task.FromResult(CommonCompletionItem.GetDescription(item)) 107: Task.FromResult(CompletionDescription.Empty);
Completion\CompletionProvider.cs (2)
64=> Task.FromResult<CompletionDescription?>(CompletionDescription.Empty); 78=> Task.FromResult(CompletionChange.Create(new TextChange(item.Span, item.DisplayText)));
Completion\Providers\AbstractKeywordCompletionProvider.cs (1)
76=> Task.FromResult((TextChange?)new TextChange(item.Span, item.DisplayText));
Completion\Providers\AbstractObjectCreationCompletionProvider.cs (1)
100return Task.FromResult(ImmutableArray.Create(new SymbolAndSelectionInfo(Symbol: type, Preselect: !isArray)));
Completion\Providers\AbstractPartialTypeCompletionProvider.cs (1)
116return Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, insertionText));
Completion\Providers\AbstractSymbolCompletionProvider.cs (1)
470=> Task.FromResult<TextChange?>(new TextChange(selectedItem.Span, GetInsertionText(selectedItem, ch)));
Completion\Providers\Snippets\AbstractSnippetCompletionProvider.cs (1)
104return await Task.FromResult(CommonCompletionItem.GetDescription(item)).ConfigureAwait(false);
ConvertLinq\AbstractConvertLinqQueryToForEachProvider.cs (1)
49c => Task.FromResult(document.WithSyntaxRoot(documentUpdateInfo.UpdateRoot(root))),
ConvertLinq\ConvertForEachToLinqQuery\AbstractConvertForEachToLinqQueryProvider.cs (1)
155return Task.FromResult(document.WithSyntaxRoot(rootWithLinqUsing));
ConvertNumericLiteral\AbstractConvertNumericLiteralCodeRefactoringProvider.cs (1)
128return Task.FromResult(document.WithSyntaxRoot(updatedRoot));
ConvertToInterpolatedString\ConvertRegularStringToInterpolatedStringRefactoringProvider.cs (1)
110return Task.FromResult(document.WithSyntaxRoot(
EmbeddedLanguages\DateAndTime\DateAndTimeEmbeddedCompletionProvider.cs (2)
226return Task.FromResult(CompletionChange.Create( 235return Task.FromResult((CompletionDescription?)CompletionDescription.Create(
EmbeddedLanguages\RegularExpressions\LanguageServices\RegexEmbeddedCompletionProvider.cs (2)
455return Task.FromResult(CompletionChange.Create( 467return Task.FromResult(CompletionDescription.Create(
ExternalAccess\Pythia\Api\PythiaCompletionProviderBase.cs (1)
54: Task.FromResult(CommonCompletionItem.GetDescription(item));
MoveToNamespace\AbstractMoveToNamespaceService.cs (1)
176return Task.FromResult(MoveToNamespaceResult.Failed);
Navigation\DefaultSymbolNavigationService.cs (1)
22=> Task.FromResult<(string filePath, LinePosition linePosition)?>(null);
Navigation\INavigableLocation.cs (1)
39return Task.FromResult<INavigableLocation?>(
OrganizeImports\OrganizeImportsCodeRefactoringProvider.cs (1)
91cancellationToken => Task.FromResult(document.WithSyntaxRoot(newRoot))),
QuickInfo\CommonSemanticQuickInfoProvider.cs (1)
189=> Task.FromResult<OnTheFlyDocsInfo?>(null);
SemanticSearch\SearchCompilationFailureDefinitionItem.cs (1)
37=> Task.FromResult<INavigableLocation?>(null);
SemanticSearch\SearchExceptionDefinitionItem.cs (1)
41=> Task.FromResult<INavigableLocation?>(null);
Snippets\SnippetProviders\AbstractLockSnippetProvider.cs (1)
19return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), statement.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractMainMethodSnippetProvider.cs (1)
36return Task.FromResult(new TextChange(TextSpan.FromBounds(position, position), method.NormalizeWhitespace().ToFullString()));
Snippets\SnippetProviders\AbstractSnippetProvider.cs (1)
239=> Task.FromResult(document);
SplitOrMergeIfStatements\Nested\AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider.cs (1)
56return Task.FromResult(
src\Analyzers\Core\CodeFixes\AddExplicitCast\AbstractAddExplicitCastCodeFixProvider.cs (1)
102return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode(finalTarget, replacement)));
src\Analyzers\Core\CodeFixes\AliasAmbiguousType\AbstractAliasAmbiguousTypeCodeFixProvider.cs (1)
64return Task.FromResult(document.WithSyntaxRoot(newRoot));
src\Analyzers\Core\CodeFixes\ConvertToAsync\AbstractConvertToAsyncCodeFixProvider.cs (1)
64token => Task.FromResult(otherDocument.WithSyntaxRoot(newRoot)),
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (2)
59_ => Task.FromResult(UpgradeProject(project, newVersion))); 68ct => Task.FromResult(UpgradeAllProjects(solution, language, newVersion, ct)));
StackTraceExplorer\StackFrameMethodSymbolResolver.cs (1)
30return Task.FromResult(match);
StackTraceExplorer\StackTraceAnalyzer.cs (1)
29return Task.FromResult(result);
SymbolMapping\SymbolMappingServiceFactory.cs (1)
37=> Task.FromResult(new SymbolMappingResult(document.Project, symbol));
SyncNamespaces\AbstractSyncNamespacesService.cs (2)
154private static readonly Task<IEnumerable<Diagnostic>> EmptyDiagnosticResult = Task.FromResult(Enumerable.Empty<Diagnostic>()); 178? Task.FromResult<IEnumerable<Diagnostic>>(diagnostics)
UseNamedArguments\AbstractUseNamedArgumentsCodeRefactoringProvider.cs (1)
146return Task.FromResult(document.WithSyntaxRoot(newRoot));
Wrapping\AbstractCodeActionComputer.cs (1)
160return new WrapItemsAction(title, parentTitle, (_, _) => Task.FromResult(formattedDocument));
Microsoft.CodeAnalysis.InteractiveHost (8)
Interactive\Core\InteractiveHost.Service.cs (3)
140_lastTask = Task.FromResult(initialState); 178return Task.FromResult(s_currentPlatformInfo.Serialize()); 844=> Task.FromResult(RuntimeEnvironment.GetRuntimeDirectory());
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
Microsoft.CodeAnalysis.LanguageServer (4)
BrokeredServices\MefServiceBrokerOfExportedServices.cs (1)
25_containerTask = Task.FromResult(container);
HostWorkspace\WorkspaceProjectFactoryService.cs (1)
71return Task.FromResult((IReadOnlyCollection<string>)[]);
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
39return Task.FromResult(projects);
LanguageServer\Handler\Restore\RestorableProjectsHandler.cs (1)
46return Task.FromResult(projects.ToArray());
Microsoft.CodeAnalysis.LanguageServer.Protocol (14)
Features\DecompiledSource\AssemblyResolver.cs (2)
53return Task.FromResult(Resolve(name)); 58return Task.FromResult(ResolveModule(mainModule, moduleName));
Features\EditAndContinue\EditAndContinueDiagnosticSource_Workspace.cs (2)
24=> Task.FromResult(diagnostics); 31=> Task.FromResult(diagnostics);
Handler\Completion\CompletionResolveHandler.cs (2)
55return Task.FromResult(completionItem); 76return Task.FromResult(completionItem);
Handler\Diagnostics\BuildOnlyDiagnosticIdsHandler.cs (1)
77return Task.FromResult(new BuildOnlyDiagnosticIdsResult(builder.ToArray()));
Handler\Diagnostics\DiagnosticSources\AbstractProjectDiagnosticSource.cs (1)
71return Task.FromResult(diagnostics);
Handler\Diagnostics\DiagnosticSources\AbstractWorkspaceDocumentDiagnosticSource.cs (1)
99return Task.FromResult(diagnostics);
Handler\EditAndContinue\RegisterSolutionSnapshotHandler.cs (1)
37return Task.FromResult(new LspSolutionSnapshotId(id.Id));
Handler\ProjectContext\GetTextDocumentWithContextHandler.cs (1)
60return Task.FromResult<VSProjectContextList?>(new VSProjectContextList
Handler\ServerLifetime\InitializeHandler.cs (1)
47return Task.FromResult(new InitializeResult
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\Handlers\InitializeHandler.cs (1)
32return Task.FromResult(serverCapabilities);
Workspaces\SourceTextLoader.cs (1)
27=> Task.FromResult(TextAndVersion.Create(_sourceText, VersionStamp.Create(), _fileUri));
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (18)
Commands\ExecuteWorkspaceCommandTests.cs (1)
72return Task.FromResult<object>(true);
Completion\CompletionResolveTests.cs (3)
514CancellationToken cancellationToken = default) => Task.FromResult(CodeAnalysis.Completion.CompletionList.Empty); 529return Task.FromResult(CompletionChange.Create(textChange, newPosition: 0)); 539=> Task.FromResult(CompletionDescription.Empty);
Diagnostics\AbstractPullDiagnosticTestsBase.cs (1)
381return Task.FromResult(ImmutableArray.Create(
Diagnostics\AdditionalFileDiagnosticsTests.cs (1)
246return Task.FromResult<ImmutableArray<DiagnosticData>>([DiagnosticData.Create(diagnostic, context.TextDocument.Project)]);
Diagnostics\DiagnosticsPullCacheTests.cs (1)
124return Task.FromResult<ImmutableArray<DiagnosticData>>([new DiagnosticData(Id, category: "category", context.Document!.Name, DiagnosticSeverity.Error, DiagnosticSeverity.Error,
HandlerTests.cs (6)
321return Task.FromResult(this.GetType().Name); 343return Task.FromResult(this.GetType().Name); 360return Task.FromResult(this.GetType().Name); 443return Task.FromResult(this.GetType().Name); 467return Task.FromResult(this.GetType().Name); 486return Task.FromResult(this.GetType().Name);
Initialize\LocaleTests.cs (1)
98return Task.FromResult(new Response(CultureInfo.CurrentUICulture.Name));
Ordering\LongRunningNonMutatingRequestHandler.cs (1)
37return Task.FromResult(new TestResponse());
Ordering\NonLSPSolutionRequestHandlerProvider.cs (1)
34return Task.FromResult(new TestResponse());
TestSourceGeneratedDocumentSpanMappingService.cs (1)
43return Task.FromResult(ImmutableArray<MappedSpanResult>.Empty);
UriTests.cs (1)
388return Task.FromResult(new ResolvedDocumentInfo(context.Workspace!.Kind!, context.GetRequiredDocument().Project.Language));
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.PublicApiAnalyzers (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\BrokeredServiceBase.FactoryBase.cs (1)
70return Task.FromResult((object)Create(
Microsoft.CodeAnalysis.ResxSourceGenerator (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Microsoft.CodeAnalysis.Scripting (2)
Script.cs (1)
559return Task.FromResult((ScriptState<T>)previousState);
ScriptBuilder.cs (1)
93executor ??= (s) => Task.FromResult(default(T));
Microsoft.CodeAnalysis.Test.Utilities (1)
Diagnostics\ThrowingDiagnosticAnalyzer.cs (1)
68await VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync(a => Task.FromResult(runAnalysis(a)));
Microsoft.CodeAnalysis.Threading.Package (1)
AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
Microsoft.CodeAnalysis.UnitTests (1)
Diagnostics\SuppressMessageAttributeCompilerTests.cs (1)
32return Task.FromResult(false);
Microsoft.CodeAnalysis.VisualBasic (1)
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (1)
106Return Task.FromResult(_root)
Microsoft.CodeAnalysis.Workspaces (42)
CodeActions\Operations\ApplyChangesOperation.cs (1)
44=> Task.FromResult(ApplyOrMergeChanges(workspace, originalSolution, ChangedSolution, progressTracker, cancellationToken));
CodeCleanup\Providers\FormatCodeCleanupProvider.cs (1)
40: Task.FromResult(result.GetFormattedRoot(cancellationToken));
CodeCleanup\Providers\SimplificationCodeCleanupProvider.cs (1)
25return Task.FromResult(root);
CodeFixes\FixAllOccurrences\FixAllState.FixMultipleDiagnosticProvider.cs (3)
56return Task.FromResult<IEnumerable<Diagnostic>>(allDiagnosticsBuilder.ToImmutableAndFree()); 63return Task.FromResult<IEnumerable<Diagnostic>>(diagnostics); 73return Task.FromResult<IEnumerable<Diagnostic>>(diagnostics);
CodeFixes\FixAllOccurrences\NoOpFixAllProvider.cs (1)
26=> Task.FromResult<CodeAction?>(null);
CodeFixesAndRefactorings\DefaultFixAllProviderHelpers.cs (1)
47title, (_, _) => Task.FromResult(solution), equivalenceKey: null, CodeActionPriority.Default, fixAllContext.State.FixAllProvider.Cleanup);
Recommendations\Recommender.cs (1)
42return Task.FromResult(GetRecommendedSymbolsAtPosition(semanticModel, position, workspace, options, cancellationToken));
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
TemporaryStorage\TrivialTemporaryStorageService.cs (2)
37return Task.FromResult<ITemporaryStorageTextHandle>(new TextStorage(text)); 79return Task.FromResult(_sourceText);
Workspace\Host\TemporaryStorage\LegacyTemporaryStorageService.cs (2)
55return Task.FromResult(ReadStream(cancellationToken)); 96=> Task.FromResult(ReadText(cancellationToken));
Workspace\IsolatedAnalyzerReferenceSet.Core.cs (1)
213() => Task.FromResult(references),
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (1)
668=> Task.FromResult(TextAndVersion.Create(_textContainer.CurrentText, VersionStamp.Create(), _filePath));
Workspace\Solution\ConstantTextAndVersionSource.cs (1)
31=> Task.FromResult(_value);
Workspace\Solution\Document.cs (2)
95var result = Task.FromResult(syntaxTree); 188Interlocked.CompareExchange(ref _syntaxTreeResultTask, Task.FromResult(tree), null);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (1)
220return Task.FromResult(compilation);
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (1)
212Task.FromResult(CreateSkeletonSet(arg.services, arg.compilation, cancellationToken)),
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (8)
86=> Task.FromResult(oldCompilation); 123return Task.FromResult(oldCompilation.WithOptions(this.NewProjectState.CompilationOptions)); 245return Task.FromResult(oldCompilation.WithOptions(this.NewProjectState.CompilationOptions)); 266=> Task.FromResult(oldCompilation.WithAssemblyName(NewProjectState.AssemblyName)); 289=> Task.FromResult(oldCompilation); 320=> Task.FromResult(oldCompilation); 340=> Task.FromResult(oldCompilation); 359=> Task.FromResult(oldCompilation);
Workspace\Solution\TextLoader.cs (2)
204=> Task.FromResult(_textAndVersion); 227=> Task.FromResult(LoadTextAndVersionSynchronously(options, cancellationToken));
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\MSBuildProjectLoader.Worker.cs (1)
290return Task.FromResult(
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
RpcTests.cs (2)
238public Task<string> HelloAsync(string name) { return Task.FromResult("Hello " + name); } 243return Task.FromResult("Hello " + name);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (4)
Remote\InProcRemoteHostClientProvider.cs (1)
113=> Task.FromResult<RemoteHostClient?>(_lazyClient.Value);
TestDynamicFileInfoProviderThatProducesFiles.cs (1)
32return Task.FromResult(new DynamicFileInfo(
TestTextLoader.cs (1)
22=> Task.FromResult(_textAndVersion);
Workspaces\TestHostDocument.cs (1)
190=> Task.FromResult(TextAndVersion.Create(SourceText.From(_text, encoding: Encoding.UTF8, options.ChecksumAlgorithm), VersionStamp.Create(), _hostDocument.FilePath));
Microsoft.CodeAnalysis.Workspaces.UnitTests (24)
CodeCleanup\CodeCleanupTests.cs (1)
402return Task.FromResult(document);
CodeCleanup\MockCodeCleanupProvider.cs (1)
31=> Task.FromResult((CleanupNodeImpl ?? throw new NotImplementedException()).Invoke(root, spans, options, services));
Formatter\FormatterTests.cs (1)
42=> Task.FromResult(document.WithText(SourceText.From($"Formatted with options: {lineFormattingOptions.ToString().Replace("\r", "\\r").Replace("\n", "\\n")}")));
SolutionTests\TextLoaderTests.cs (11)
23=> Task.FromResult((TextAndVersion?)null!); 30=> Task.FromResult((TextAndVersion?)null!); 34=> Task.FromResult((TextAndVersion?)null!); 38=> Task.FromResult((TextAndVersion?)null!); 42=> Task.FromResult((TextAndVersion?)null!); 48=> Task.FromResult((TextAndVersion?)null!); 60=> Task.FromResult((TextAndVersion?)null!); 66=> Task.FromResult((TextAndVersion?)null!); 86=> Task.FromResult(Value); 95=> Task.FromResult(Value); 103=> Task.FromResult(Value);
SyntaxNodeTests.cs (4)
34return Task.FromResult<SyntaxNode>(decl.WithIdentifier(SyntaxFactory.Identifier("Y"))); 57return Task.FromResult<SyntaxNode>(classDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia))); 63return Task.FromResult<SyntaxNode>(varDecl.WithIdentifier(SyntaxFactory.Identifier(id.LeadingTrivia, id.ToString() + "1", id.TrailingTrivia))); 66return Task.FromResult(n);
UtilityTest\AsyncLazyTests.cs (5)
25var lazy = AsyncLazy.Create(static c => Task.FromResult(5)); 244static (synchronousComputation, c) => Task.FromResult(synchronousComputation(c)), 266var lazy = AsyncLazy.Create(static c => Task.FromResult(new object())); 342asynchronousComputation = _ => Task.FromResult("Returned from asynchronous computation: " + Guid.NewGuid()); 384return Task.FromResult("Returned from asynchronous computation: " + Guid.NewGuid());
UtilityTest\TaskExtensionsTests.cs (1)
19Assert.Equal(42, Task.FromResult(42).WaitAndGetResult_CanCallOnBackground(CancellationToken.None));
Microsoft.CommonLanguageServerProtocol.Framework.Example (1)
ExampleRequestContextFactory.cs (1)
25return Task.FromResult(requestContext);
Microsoft.CommonLanguageServerProtocol.Framework.Package (1)
Handlers\InitializeHandler.cs (1)
32return Task.FromResult(serverCapabilities);
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (8)
Mocks\TestMethodHandlers.cs (7)
27=> Task.FromResult<MockResponse>(new("stuff")); 42=> Task.FromResult(new MockResponse("true")); 56=> Task.FromResult(true); 69=> Task.FromResult(true); 98return Task.FromResult(new MockResponse(string.Empty)); 170=> Task.FromResult(new MockResponse(string.Empty)); 186=> Task.FromResult(new MockResponse("xaml"));
Mocks\TestRequestContext.cs (1)
17=> Task.FromResult(new TestRequestContext());
Microsoft.DotNet.Build.Tasks.Feed (1)
src\PublishArtifactsInManifestBase.cs (1)
736return dryRun ? Task.FromResult(SymbolUploadHelperFactory.GetSymbolHelperFromLocalTool(tracer, options, "."))
Microsoft.DotNet.Build.Tasks.Feed.Tests (4)
PublishArtifactsInManifestTests.cs (4)
61return Task.FromResult(_validationResult); 314return Task.FromResult(NuGetFeedUploadPackageResult.Success); 318return Task.FromResult(NuGetFeedUploadPackageResult.AlreadyExists); 404return Task.FromResult(bytesToWrite);
Microsoft.DotNet.Helix.JobSender (4)
Payloads\ArchivePayload.cs (1)
29=> Task.FromResult(
Payloads\DirectoryPayload.cs (1)
36=> Task.FromResult(
Payloads\EmptyPayload.cs (1)
12private readonly Task<string> _emptyStringTask = Task.FromResult("");
Payloads\UriPayload.cs (1)
21return Task.FromResult(_payloadUri.AbsoluteUri);
Microsoft.DotNet.Helix.JobSender.Tests (1)
Payloads\ArchivePayloadTests.cs (1)
23.Returns(Task.FromResult(new Uri("http://microsoft.com/blob")));
Microsoft.DotNet.Open.Api.Tools.Tests (2)
OpenApiTestBase.cs (2)
145return Task.FromResult<IHttpResponseMessageWrapper>(new TestHttpResponseMessageWrapper(stream, result?.Item2)); 170Stream = Task.FromResult<Stream>(stream);
Microsoft.DotNet.XUnitAssert.Tests (13)
EventAssertsTests.cs (5)
360 () => Task.FromResult(0) 419 () => Task.FromResult(0) 441 () => Task.FromResult(0) 534 () => Task.FromResult(0) 616 () => Task.FromResult(0)
ExceptionAssertsTests.cs (6)
97 static object testCode() => Task.FromResult(42); 250 static object testCode() => Task.FromResult(42); 567 static object testCode() => Task.FromResult(42); 638 Task testCode() => Task.FromResult(42); 697 Task testCode() => Task.FromResult(42); 766 Task testCode() => Task.FromResult(42);
PropertyAssertsTests.cs (2)
68 await Assert.ThrowsAsync<ArgumentNullException>("object", () => Assert.PropertyChangedAsync(null!, "propertyName", () => Task.FromResult(0))); 77 var ex = await Record.ExceptionAsync(() => Assert.PropertyChangedAsync(obj, nameof(NotifiedClass.Property1), () => Task.FromResult(0)));
Microsoft.Extensions.AI (1)
ChatReduction\MessageCountingChatReducer.cs (1)
42return Task.FromResult(GetReducedMessages(messages));
Microsoft.Extensions.AI.Abstractions.Tests (13)
ChatCompletion\ChatClientExtensionsTests.cs (1)
119return Task.FromResult(expectedResponse);
Embeddings\EmbeddingGeneratorExtensionsTests.cs (2)
94Task.FromResult<GeneratedEmbeddings<Embedding<float>>>([result]) 116Task.FromResult<GeneratedEmbeddings<Embedding<float>>>(new(embeddings))
Embeddings\GeneratedEmbeddingsTests.cs (1)
255GenerateAsyncCallback = (values, options, cancellationToken) => Task.FromResult(expectedGeneratedEmbeddings),
Image\ImageGeneratorExtensionsTests.cs (4)
78return Task.FromResult(expectedResponse); 127return Task.FromResult(expectedResponse); 189return Task.FromResult(new ImageGenerationResponse()); 212return Task.FromResult(new ImageGenerationResponse());
Image\ImageGeneratorTests.cs (3)
60return Task.FromResult(expectedResponse); 122return Task.FromResult(new ImageGenerationResponse()); 149return Task.FromResult(new ImageGenerationResponse());
SpeechToText\SpeechToTextClientTests.cs (1)
27return Task.FromResult(new SpeechToTextResponse("hello"));
TestImageGenerator.cs (1)
31Task.FromResult(new ImageGenerationResponse());
Microsoft.Extensions.AI.Integration.Tests (2)
ReducingChatClientTests.cs (1)
35return Task.FromResult(new ChatResponse());
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestImageGenerator.cs (1)
31Task.FromResult(new ImageGenerationResponse());
Microsoft.Extensions.AI.Tests (45)
ChatCompletion\ChatClientStructuredOutputExtensionsTests.cs (11)
77return Task.FromResult(expectedResponse); 138return Task.FromResult(expectedResponse); 190return Task.FromResult(expectedResponse); 234return Task.FromResult(expectedResponse); 248GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse), 267GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse), 286GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse), 313return Task.FromResult(expectedResponse); 342GetResponseAsyncCallback = (messages, options, cancellationToken) => Task.FromResult(expectedResponse) 409return Task.FromResult(expectedResponse); 437return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, resultDuplicatedJson)));
ChatCompletion\ConfigureOptionsChatClientTests.cs (1)
47return Task.FromResult(expectedResponse);
ChatCompletion\DistributedCachingChatClientTest.cs (3)
81return Task.FromResult(expectedResponse); 710return Task.FromResult(expectedResponse); 743return Task.FromResult(new ChatResponse(
ChatCompletion\FunctionInvokingChatClientTests.cs (2)
921return Task.FromResult(new ChatResponse(message)); 982Task.FromResult(callback(chatContents, chatOptions, cancellationToken)),
ChatCompletion\LoggingChatClientTests.cs (1)
59return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "blue whale")));
ChatCompletion\ReducingChatClientTests.cs (4)
58return Task.FromResult(expectedResponse); 109return Task.FromResult(new ChatResponse()); 147Task.FromResult(new ChatResponse()) 185return Task.FromResult(ReducedMessages ?? messages);
ChatCompletion\UseDelegateChatClientTests.cs (3)
42return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "hello"))); 91return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "hello"))); 184return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "non-streaming hello")));
ChatReduction\SummarizingChatReducerTests.cs (6)
76Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary of conversation"))); 131return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 169return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 192Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, "Summary"))); 232return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary))); 259return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, Summary)));
Embeddings\ConfigureOptionsEmbeddingGeneratorTests.cs (1)
44return Task.FromResult(expectedEmbeddings);
Embeddings\DistributedCachingEmbeddingGeneratorTest.cs (3)
55return Task.FromResult<GeneratedEmbeddings<Embedding<float>>>([_expectedEmbedding]); 101return Task.FromResult<GeneratedEmbeddings<Embedding<float>>>(new(values.Select(i => expected[int.Parse(i)]))); 382return Task.FromResult<GeneratedEmbeddings<Embedding<float>>>([_expectedEmbedding]);
Embeddings\LoggingEmbeddingGeneratorTests.cs (1)
58return Task.FromResult(new GeneratedEmbeddings<Embedding<float>>([new Embedding<float>(new float[] { 1f, 2f, 3f })]));
Embeddings\UseDelegateEmbeddingGeneratorTests.cs (1)
41return Task.FromResult(expectedEmbeddings);
Functions\AIFunctionFactoryTest.cs (1)
167func = AIFunctionFactory.Create(Task<string> (string a) => Task.FromResult(a + " " + a));
Image\ConfigureOptionsImageGeneratorTests.cs (1)
44return Task.FromResult(expectedResponse);
Image\LoggingImageGeneratorTests.cs (2)
60return Task.FromResult(new ImageGenerationResponse()); 108return Task.FromResult(new ImageGenerationResponse());
SpeechToText\ConfigureOptionsSpeechToTextClientTests.cs (1)
48return Task.FromResult(expectedResponse);
SpeechToText\LoggingSpeechToTextClientTests.cs (1)
61return Task.FromResult(new SpeechToTextResponse("blue whale"));
test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\TestImageGenerator.cs (1)
31Task.FromResult(new ImageGenerationResponse());
TestInMemoryCacheStorage.cs (1)
22=> Task.FromResult(Get(key));
Microsoft.Extensions.Caching.Hybrid (2)
Internal\DefaultHybridCache.TagInvalidation.cs (2)
13private static readonly Task<long> _zeroTimestamp = Task.FromResult<long>(0L); 244Task<long> timestampTask = Task.FromResult<long>(timestamp);
Microsoft.Extensions.Caching.Hybrid.Tests (4)
NullDistributedCache.cs (1)
12Task<byte[]?> IDistributedCache.GetAsync(string key, CancellationToken token) => Task.FromResult<byte[]?>(null);
RedisTests.cs (1)
36options.ConnectionMultiplexerFactory = () => Task.FromResult(redis);
SampleUsage.cs (2)
134return Task.FromResult(new SomeInformation { Id = id, Name = name }); 143return Task.FromResult(new SomeInformationReuse { Id = id, Name = name });
Microsoft.Extensions.Caching.Memory (1)
MemoryDistributedCache.cs (1)
64return Task.FromResult(Get(key));
Microsoft.Extensions.Caching.MicroBenchmarks (1)
DistributedCacheBenchmarks.cs (1)
64options.ConnectionMultiplexerFactory = () => Task.FromResult<IConnectionMultiplexer>(multiplexer);
Microsoft.Extensions.Diagnostics.HealthChecks (2)
DependencyInjection\HealthChecksBuilderDelegateExtensions.cs (2)
58var instance = new DelegateHealthCheck((ct) => Task.FromResult(check())); 101var instance = new DelegateHealthCheck((ct) => Task.FromResult(check(ct)));
Microsoft.Extensions.Diagnostics.HealthChecks.Common (5)
ApplicationLifecycleHealthCheck.cs (4)
16private static readonly Task<HealthCheckResult> _healthy = Task.FromResult(HealthCheckResult.Healthy()); 17private static readonly Task<HealthCheckResult> _unhealthyNotStarted = Task.FromResult(HealthCheckResult.Unhealthy("Not Started")); 18private static readonly Task<HealthCheckResult> _unhealthyStopping = Task.FromResult(HealthCheckResult.Unhealthy("Stopping")); 19private static readonly Task<HealthCheckResult> _unhealthyStopped = Task.FromResult(HealthCheckResult.Unhealthy("Stopped"));
ManualHealthCheckService.cs (1)
37public Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) => Task.FromResult(_tracker.GetHealthCheckResult());
Microsoft.Extensions.Diagnostics.HealthChecks.Tests (41)
DefaultHealthCheckServiceTest.cs (18)
34.AddCheck("Foo", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy()))) 35.AddCheck("Foo", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy()))) 36.AddCheck("Bar", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy()))) 37.AddCheck("Baz", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy()))) 38.AddCheck("Baz", new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy()))); 74b.AddAsyncCheck("HealthyCheck", _ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage, data)), healthyCheckTags); 75b.AddAsyncCheck("DegradedCheck", _ => Task.FromResult(HealthCheckResult.Degraded(DegradedMessage)), degradedCheckTags); 76b.AddAsyncCheck("UnhealthyCheck", _ => Task.FromResult(HealthCheckResult.Unhealthy(UnhealthyMessage, exception)), unhealthyCheckTags); 177b.AddAsyncCheck("HealthyCheck", _ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage, data))); 178b.AddAsyncCheck("DegradedCheck", _ => Task.FromResult(HealthCheckResult.Degraded(DegradedMessage))); 179b.AddAsyncCheck("UnhealthyCheck", _ => Task.FromResult(HealthCheckResult.Unhealthy(UnhealthyMessage, exception))); 284b.AddAsyncCheck("Succeeds", ct => Task.FromResult(HealthCheckResult.Healthy())); 334return Task.FromResult(HealthCheckResult.Healthy()); 668return Task.FromResult(HealthCheckResult.Healthy()); 686return Task.FromResult(HealthCheckResult.Healthy()); 690return Task.FromResult(HealthCheckResult.Unhealthy("failed", e)); 704return Task.FromResult(HealthCheckResult.Healthy(data: data)); 736return Task.FromResult(HealthCheckResult.Healthy(data: new Dictionary<string, object> { { "self", this } }));
DependencyInjection\HealthChecksBuilderTest.cs (5)
23return Task.FromResult(HealthCheckResult.Healthy()); 163return Task.FromResult(HealthCheckResult.Healthy()); 186return Task.FromResult(HealthCheckResult.Unhealthy()); 208.AddAsyncCheck("Foo", () => Task.FromResult(HealthCheckResult.Healthy())); 211.AddAsyncCheck("Bar", () => Task.FromResult(HealthCheckResult.Healthy()));
HealthCheckPublisherHostedServiceTest.cs (18)
251instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 258instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 270instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 282instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 297return Task.FromResult(HealthCheckResult.Healthy(HealthyMessage)); 310instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 322instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 334instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 346instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 526instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 533instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 545instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 557instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 572return Task.FromResult(HealthCheckResult.Healthy(HealthyMessage)); 585instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 597instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 609instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))), 621instance: new DelegateHealthCheck(_ => Task.FromResult(HealthCheckResult.Healthy(HealthyMessage))),
Microsoft.Extensions.Diagnostics.Probes.Tests (1)
MockHealthCheckService.cs (1)
27return Task.FromResult(new HealthReport(healthStatusRecords, TimeSpan.Zero));
Microsoft.Extensions.Http.Diagnostics.PerformanceTests (2)
NoRemoteCallHandler.cs (1)
46return Task.FromResult(response);
NoRemoteCallNotSeekableHandler.cs (1)
49return Task.FromResult(response);
Microsoft.Extensions.Http.Diagnostics.Tests (13)
Latency\Internal\HttpLatencyTelemetryHandlerTest.cs (1)
72}).Returns(Task.FromResult(resp.Object));
Logging\HttpClientLoggerTest.cs (11)
68new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); 146new TestingHandlerStub((_, _) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)))); 235new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); 332new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); 552new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); 646new TestingHandlerStub((_, _) => Task.FromResult(httpResponseMessage))); 690new TestingHandlerStub((_, _) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)))); 733new TestingHandlerStub((_, _) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)))); 771(_, _) => Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK)))); 920return Task.FromResult(httpResponseMessage); 962Task.FromResult(new HttpResponseMessage((HttpStatusCode)httpStatusCode))));
Logging\Internal\NoRemoteCallHandler.cs (1)
40return Task.FromResult(response);
Microsoft.Extensions.Http.Polly.Tests (11)
DependencyInjection\PollyHttpClientBuilderExtensionsTest.cs (2)
569return Task.FromResult(new HttpResponseMessage(HttpStatusCode.Created)); 583return Task.FromResult(func(request));
PolicyHttpMessageHandlerTest.cs (9)
40return Task.FromResult(expected); 85return Task.FromResult(expected); 126return Task.FromResult(firstResponse); 131return Task.FromResult(expected); 178return Task.FromResult(firstResponse); 183return Task.FromResult(expected); 255return Task.FromResult(expected); 285return Task.FromResult(expected); 315return Task.FromResult(expected);
Microsoft.Extensions.Http.Resilience.PerformanceTests (1)
NoRemoteCallHandler.cs (1)
23_completedResponse = Task.FromResult(_response);
Microsoft.Extensions.Http.Resilience.Tests (5)
Hedging\HedgingTests.cs (1)
358return Task.FromResult(_responses.Dequeue());
Helpers\TestHandlerStub.cs (1)
17: this((_, _) => Task.FromResult(new HttpResponseMessage(statusCode)))
Resilience\HttpClientBuilderExtensionsTests.Standard.cs (1)
245return Task.FromResult(new HttpResponseMessage(HttpStatusCode.InternalServerError));
Resilience\ResilienceHandlerTest.cs (2)
112return Task.FromResult(new HttpResponseMessage { StatusCode = HttpStatusCode.Created }); 137return Task.FromResult(new HttpResponseMessage { StatusCode = HttpStatusCode.Created });
Microsoft.Extensions.Identity.Core (4)
AuthenticatorTokenProvider.cs (1)
37return Task.FromResult(string.Empty);
PasswordValidator.cs (1)
77Task.FromResult(errors?.Count > 0
UserManager.cs (2)
458return id == null ? Task.FromResult<TUser?>(null) : FindByIdAsync(id); 471return Task.FromResult(Guid.NewGuid().ToString());
Microsoft.Extensions.Identity.Stores (19)
RoleStoreBase.cs (3)
84return Task.FromResult(ConvertIdToString(role.Id)!); 98return Task.FromResult(role.Name); 174return Task.FromResult(role.NormalizedName);
UserStoreBase.cs (16)
121return Task.FromResult(ConvertIdToString(user.Id)!); 135return Task.FromResult(user.UserName); 165return Task.FromResult(user.NormalizedUserName); 293return Task.FromResult(user.PasswordHash); 306return Task.FromResult(user.PasswordHash != null); 454return Task.FromResult(user.EmailConfirmed); 500return Task.FromResult(user.Email); 516return Task.FromResult(user.NormalizedEmail); 560return Task.FromResult(user.LockoutEnd); 591return Task.FromResult(user.AccessFailedCount); 621return Task.FromResult(user.AccessFailedCount); 637return Task.FromResult(user.LockoutEnabled); 683return Task.FromResult(user.PhoneNumber); 700return Task.FromResult(user.PhoneNumberConfirmed); 747return Task.FromResult(user.SecurityStamp); 782return Task.FromResult(user.TwoFactorEnabled);
Microsoft.Extensions.ML.Tests (2)
UriLoaderTests.cs (2)
97return Task.FromResult(true); 102return Task.FromResult(ETagMatches(uri, eTag));
Microsoft.Interop.LibraryImportGenerator (1)
Analyzers\CustomMarshallerAttributeFixer.cs (1)
84return CodeAction.Create(SR.AddMissingCustomTypeMarshallerMembers, ct => Task.FromResult(symbolEditor.ChangedSolution));
Microsoft.Maui (8)
ImageSources\ImageSourceExtensions.cs (2)
38 return Task.FromResult<IImageSourceServiceResult<PlatformImage>?>(null); 49 return Task.FromResult<IImageSourceServiceResult<PlatformImage>?>(null);
SoftInputExtensions.cs (4)
43 return Task.FromResult(false); 46 return Task.FromResult(platformView.HideSoftInput()); 66 return Task.FromResult(false); 95 return Task.FromResult(result).WaitAsync(token);
ViewExtensions.cs (1)
80 return Task.FromResult<IScreenshotResult?>(null);
WindowExtensions.cs (1)
29 return Task.FromResult<IScreenshotResult?>(null);
Microsoft.Maui.Controls (19)
DragAndDrop\DataPackageView.cs (2)
25 return Task.FromResult(DataPackage.Image); 31 return Task.FromResult(DataPackage.Text);
FileImageSource.cs (1)
26 return Task.FromResult(false);
ImageSource.cs (2)
56 return Task.FromResult(false); 62 return Task.FromResult(false);
Internals\AsyncValue.cs (1)
85 public static AsyncValue<T> Null => new AsyncValue<T>(Task.FromResult<T>(default(T)));
LockingSemaphore.cs (1)
11 static readonly Task Completed = Task.FromResult(true);
NavigationProxy.cs (6)
189 return inner is null ? Task.FromResult(Pop()) : inner.PopAsync(animated); 195 return innerNav is null ? Task.FromResult(PopModal()) : innerNav.PopModalAsync(animated); 204 return Task.FromResult<Page>(null); 209 return Task.FromResult(root); 220 return Task.FromResult(page); 231 return Task.FromResult<object>(null);
Platform\ModalNavigationManager\ModalNavigationManager.Standard.cs (1)
15 return Task.FromResult(currentPage);
ScrollView\ScrollView.cs (2)
251 return Task.FromResult(false); 262 return Task.FromResult(false);
Shell\ShellSection.cs (1)
868 return Task.FromResult(true);
TemplateUtilities.cs (2)
39 return Task.FromResult<Element>(null); 42 return Task.FromResult(parent);
Microsoft.Maui.Controls.Foldable (2)
DualScreenInfo.cs (1)
233 public Task<int> GetHingeAngleAsync() => FoldableService?.GetHingeAngleAsync() ?? Task.FromResult(0);
NoPlatformFoldableService.cs (1)
28 public Task<int> GetHingeAngleAsync() => Task.FromResult(0);
Microsoft.Maui.Essentials (2)
Flashlight\Flashlight.netstandard.tvos.watchos.macos.cs (1)
12 public Task<bool> IsSupportedAsync() => Task.FromResult(false);
MainThread\MainThread.shared.cs (1)
75 return Task.FromResult(func());
Microsoft.Maui.Graphics (1)
PlatformImage.cs (1)
80 return Task.FromResult(true);
Microsoft.ML.AutoML (6)
API\BinaryClassificationExperiment.cs (1)
457return Task.FromResult(Run(settings));
API\MulticlassClassificationExperiment.cs (1)
435return Task.FromResult(Run(settings));
API\RegressionExperiment.cs (2)
411return Task.FromResult(new TrialResult<RegressionMetrics>() 437return Task.FromResult(new TrialResult<RegressionMetrics>()
AutoMLExperiment\AutoMLExperiment.cs (1)
349return await Task.FromResult(_bestTrialResult);
AutoMLExperiment\Runner\SweepablePipelineRunner.cs (1)
103return Task.FromResult(Run(settings));
Microsoft.ML.Fairlearn (1)
Reductions\GridSearchTrialRunner.cs (1)
96return Task.FromResult<TrialResult>(new FairnessTrialResult()
Microsoft.ML.GenAI.Core (1)
CausalLMPipelineChatClient.cs (1)
48return Task.FromResult(new ChatResponse([chatMessage])
Microsoft.ML.GenAI.LLaMA (2)
LlamaCausalLMAgent.cs (1)
59return Task.FromResult<IMessage>(new TextMessage(Role.Assistant, output, from: this.Name));
LlamaTextCompletionService.cs (1)
75return Task.FromResult<IReadOnlyList<TextContent>>([new TextContent(response)]);
Microsoft.ML.GenAI.Mistral (2)
MistralCausalLMAgent.cs (2)
66return Task.FromResult<IMessage>(ParseAsToolCallMessage(output)); 69return Task.FromResult<IMessage>(new TextMessage(Role.Assistant, output, from: this.Name));
Microsoft.ML.GenAI.Phi (2)
Phi3\Phi3CausalLMAgent.cs (1)
58return Task.FromResult<IMessage>(new TextMessage(Role.Assistant, output, from: this.Name));
Phi3\Phi3CausalLMTextGenerationService.cs (1)
45return Task.FromResult<IReadOnlyList<TextContent>>([new TextContent(response)]);
Microsoft.ML.GenAI.Samples (1)
Mistral\Mistral_7B_Instruct.cs (1)
24return Task.FromResult($"The weather in {city} is sunny.");
Microsoft.ML.Sweeper (3)
AsyncSweeper.cs (3)
114return Task.FromResult<ParameterSetWithId>(null); 121return Task.FromResult(new ParameterSetWithId(_numGenerated++, paramSets[0])); 123return Task.FromResult<ParameterSetWithId>(null);
Microsoft.VisualStudio.LanguageServices (13)
CodeCleanup\AbstractCodeCleanUpFixer.cs (1)
49_ => Task.FromResult(false),
FindReferences\Entries\SimpleMessageEntry.cs (1)
36return Task.FromResult<Entry>(referenceEntry);
FindReferences\VisualStudioDefinitionsAndReferencesFactory.cs (1)
94return Task.FromResult<INavigableLocation?>(new NavigableLocation(async (options, cancellationToken) =>
NavigateTo\RoslynSearchResultPreviewPanel.cs (1)
38Task.FromResult(new TextDocumentLocation(uri, projectGuid, span)),
NavigateTo\RoslynSearchResultViewFactory.cs (1)
51=> Task.FromResult(GetPreviewPanels(result, searchResultView) ?? []);
Preview\PreviewUpdater.PreviewDialogWorkspace.cs (1)
51=> Task.FromResult(LoadTextAndVersionSynchronously(options, cancellationToken));
Progression\GraphNodeCreation.cs (2)
18=> Task.FromResult(GraphNodeId.Empty); 22=> Task.FromResult(graph.Nodes.GetOrCreate(GraphNodeId.Empty));
ProjectSystem\BrokeredService\WorkspaceProjectFactoryService.cs (1)
39return Task.FromResult((IReadOnlyCollection<string>)_workspaceProjectContextFactory.EvaluationItemNames);
RoslynPackage.cs (1)
174=> Task.FromResult((object?)null);
Snippets\SnippetFunctions\AbstractSnippetFunction.cs (2)
40return Task.FromResult((ExitCode: VSConstants.S_OK, Value: string.Empty, HasDefaultValue: 0)); 51return Task.FromResult((ExitCode: VSConstants.S_OK, Value: string.Empty, HasDefaultValue: 0));
Workspace\VisualStudioDocumentNavigationService.cs (1)
107_ => Task.FromResult(textSpan),
Microsoft.VisualStudio.LanguageServices.CodeLens (1)
ReferenceCodeLensProvider.cs (1)
87return Task.FromResult<IAsyncCodeLensDataPoint>(dataPoint);
Microsoft.VisualStudio.LanguageServices.CSharp (1)
SemanticSearch\SemanticSearchDocumentNavigationService.cs (1)
33return Task.FromResult<INavigableLocation?>(window.GetNavigableLocation(textSpan));
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (5)
Interactive\Commands\TestResetInteractive.cs (2)
64return Task.FromResult(_buildSucceeds); 91return Task.FromResult((IEnumerable<string>)NamespacesToImport);
Interactive\TestInteractiveEvaluator.cs (3)
27=> Task.FromResult(ExecutionResult.Success); 30=> Task.FromResult(ExecutionResult.Success); 38return Task.FromResult(ExecutionResult.Success);
Microsoft.VisualStudio.LanguageServices.LiveShare (4)
Client\Projects\WorkspaceFileTextLoaderNoException.cs (1)
32return Task.FromResult(TextAndVersion.Create(SourceText.From("", encoding: null, options.ChecksumAlgorithm), VersionStamp.Create()));
Client\RoslynLSPClientService.cs (1)
93return Task.FromResult<ICollaborationService>(lifeTimeService);
LiveShareInitializeHandler.cs (1)
29=> Task.FromResult(s_initializeResult);
LSPSDKInitializeHandler.cs (1)
38return Task.FromResult(result);
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Features\InlineRename\XamlEditorInlineRenameService.cs (1)
37return Task.FromResult(ImmutableDictionary<string, ImmutableArray<(string filePath, string content)>>.Empty);
Features\OrganizeImports\XamlRemoveUnnecessaryImportsService.cs (1)
33return _removeService.RemoveUnnecessaryNamespacesAsync(document, cancellationToken) ?? Task.FromResult(document);
PathSchemeSelection (1)
Startup.cs (1)
52=> Task.FromResult(AuthenticateResult.Success(new AuthenticationTicket(_id, "Api")));
ProjectCachePlugin (1)
AssemblyMockCache.cs (1)
54return Task.FromResult(CacheResult.IndicateNonCacheHit(CacheResultType.CacheNotApplicable));
RazorWebSite (2)
Services\TestBodyTagHelperComponent.cs (1)
43return Task.FromResult(0);
Services\TestHeadTagHelperComponent.cs (1)
19return Task.FromResult(0);
Replay (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
Roslyn.Compilers.Extension (2)
SetGlobalGlobalPropertiesForCPS.cs (2)
33? Task.FromResult<IImmutableDictionary<string, string>>(Empty.PropertiesMap.Add("RoslynHive", CompilerPackage.RoslynHive)) 34: Task.FromResult<IImmutableDictionary<string, string>>(Empty.PropertiesMap);
Roslyn.Diagnostics.Analyzers (13)
PartsExportedWithMEFv2MustBeMarkedAsShared.Fixer.cs (1)
65return Task.FromResult(document.WithSyntaxRoot(root.ReplaceNode(declaration, newDeclaration)));
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Roslyn.VisualStudio.DiagnosticsWindow (1)
VisualStudioDiagnosticsWindowPackage.cs (1)
116return Task.FromResult(new object());
Roslyn.VisualStudio.Next.UnitTests (1)
Services\ServiceHubServicesTests_ExtensionMessageHandler.cs (1)
791=> Task.FromResult(executeCallback!(message, argument, cancellationToken));
Sandbox (2)
Services\GreeterService.cs (2)
32return Task.FromResult(new HelloReply { Message = $"Hello {request.Name}" }); 38return Task.FromResult(new HelloReply { Message = $"Hello {request.Name} from {request.From}" });
ServerComparison.TestSites (1)
OneTransformPerRequest.cs (1)
29return Task.FromResult(principal);
Shared.Tests (1)
Memoization\MemoizeTests.cs (1)
24Func<int, Task<int>> doubler = x => Task.FromResult(x * 2);
SocialSample (4)
Startup.cs (4)
472return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<GoogleOptions>>().Get(currentAuthType)); 476return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<MicrosoftAccountOptions>>().Get(currentAuthType)); 480return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<FacebookOptions>>().Get(currentAuthType)); 484return Task.FromResult<OAuthOptions>(context.RequestServices.GetRequiredService<IOptionsMonitor<OAuthOptions>>().Get(currentAuthType));
SocialWeather (2)
Json\JSonStreamFormatter.cs (1)
24return Task.FromResult(0);
Protobuf\ProtobufWeatherStreamFormatter.cs (1)
15return Task.FromResult(new SocialWeather.WeatherReport
StatusCodePagesSample (1)
Startup.cs (1)
52await Task.FromResult(0);
Stress.AppHost (4)
InteractionCommands.cs (1)
212return Task.FromResult(CommandResults.Success());
Program.cs (3)
52return Task.FromResult(CommandResults.Success()); 63return Task.FromResult(CommandResults.Success()); 99return Task.FromResult(CommandResults.Success());
System.Console (5)
System\IO\SyncTextReader.cs (5)
96return Task.FromResult(ReadLine()); 108return Task.FromResult(ReadToEnd()); 115Task.FromResult(ReadToEnd()); 127return Task.FromResult(ReadBlock(buffer, index, count)); 139return Task.FromResult(Read(buffer, index, count));
System.Data.Common (11)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (2)
22internal static Task<bool> TrueTask => field ??= Task.FromResult(true); 23internal static Task<bool> FalseTask => field ??= Task.FromResult(false);
System\Data\Common\DbCommand.cs (3)
137return Task.FromResult(ExecuteNonQuery()); 178return Task.FromResult<DbDataReader>(ExecuteReader(behavior)); 210return Task.FromResult<object?>(ExecuteScalar());
System\Data\Common\DbConnection.cs (3)
238return Task.FromResult(GetSchema()); 270return Task.FromResult(GetSchema(collectionName)); 302return Task.FromResult(GetSchema(collectionName, restrictionValues));
System\Data\Common\DbDataReader.cs (3)
112return Task.FromResult(GetSchemaTable()); 142return Task.FromResult(this.GetColumnSchema()); 260return Task.FromResult<T>(GetFieldValue<T>(ordinal));
System.Data.Odbc (3)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (2)
22internal static Task<bool> TrueTask => field ??= Task.FromResult(true); 23internal static Task<bool> FalseTask => field ??= Task.FromResult(false);
src\libraries\Common\src\System\Data\ProviderBase\DbConnectionFactory.cs (1)
135return s_completedTask ??= Task.FromResult<DbConnectionInternal?>(null);
System.IO.Pipes (1)
System\IO\Pipes\PipeStream.Unix.cs (1)
76return Task.FromResult(0);
System.IO.Ports (1)
System\IO\Ports\SerialStream.Unix.cs (1)
447return Task<int>.FromResult(0); // return immediately if no bytes requested; no need for overhead.
System.Memory.Data (1)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (1)
132Task.FromResult(ReadBuffer(new Span<byte>(buffer, offset, count)));
System.Net.Http (12)
src\libraries\Common\src\System\IO\ReadOnlyMemoryStream.cs (1)
132Task.FromResult(ReadBuffer(new Span<byte>(buffer, offset, count)));
System\Net\Http\ByteArrayContent.cs (1)
65Task.FromResult<Stream>(CreateMemoryStreamForByteArray());
System\Net\Http\EmptyContent.cs (1)
33Task.FromResult<Stream>(EmptyReadStream.Instance);
System\Net\Http\HttpContent.cs (2)
244Task.FromResult<Stream>(CreateMemoryStreamFromBufferedContent()) : 256Task<Stream> ts = Task.FromResult((Stream)_contentReadStream);
System\Net\Http\ReadOnlyMemoryContent.cs (1)
38Task.FromResult<Stream>(new ReadOnlyMemoryStream(_content));
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (2)
356return Task.FromResult(false); 361return Task.FromResult(true);
System\Net\Http\SocketsHttpHandler\Http3Connection.cs (2)
251return Task.FromResult(false); 255return Task.FromResult(true);
System\Net\Http\SocketsHttpHandler\HttpConnectionResponseContent.cs (1)
76Task.FromResult<Stream>(ConsumeStream());
System\Net\Http\StreamContent.cs (1)
110return Task.FromResult<Stream>(new ReadOnlyStream(_content));
System.Net.NameResolution (4)
System\Net\Dns.cs (4)
565Task.FromResult((IPAddress[])resultOnFailure) : 566Task.FromResult((IPHostEntry)resultOnFailure); 583Task.FromResult(family == AddressFamily.Unspecified || ipAddress.AddressFamily == family ? new[] { ipAddress } : Array.Empty<IPAddress>()) : 584Task.FromResult(CreateHostEntryForAddress(ipAddress));
System.Net.Requests (1)
System\Net\HttpWebRequest.cs (1)
1257Task.FromResult(_httpClient.Send(_sendRequestMessage, completionOption, _sendRequestCts.Token));
System.Net.Security (1)
System\Net\Security\SslStreamCertificateContext.Linux.cs (1)
289return Task.FromResult<byte[]?>(null);
System.Net.Sockets (1)
System\Net\Sockets\Socket.Tasks.cs (1)
853t = Task.FromResult(fromNetworkStream & !isReceive ? 0 : saea.BytesTransferred);
System.Private.CoreLib (25)
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (1)
1052Task.FromResult(0);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (5)
1427public override Task<int> ReadAsync(char[] buffer, int index, int count) => Task.FromResult(0); 1436public override Task<int> ReadBlockAsync(char[] buffer, int index, int count) => Task.FromResult(0); 1443public override Task<string?> ReadLineAsync() => Task.FromResult<string?>(null); 1450public override Task<string> ReadToEndAsync() => Task.FromResult(""); 1453cancellationToken.IsCancellationRequested ? Task.FromCanceled<string>(cancellationToken) : Task.FromResult("");
src\libraries\System.Private.CoreLib\src\System\IO\StringReader.cs (5)
216return Task.FromResult(ReadLine()); 254return Task.FromResult(ReadToEnd()); 285: Task.FromResult(ReadToEnd()); 298return Task.FromResult(ReadBlock(buffer, index, count)); 316return Task.FromResult(Read(buffer, index, count));
src\libraries\System.Private.CoreLib\src\System\IO\TextReader.cs (5)
376public override Task<string?> ReadLineAsync() => Task.FromResult(ReadLine()); 383public override Task<string> ReadToEndAsync() => Task.FromResult(ReadToEnd()); 387=> cancellationToken.IsCancellationRequested ? Task.FromCanceled<string>(cancellationToken) : Task.FromResult(ReadToEnd()); 399return Task.FromResult(ReadBlock(buffer, index, count)); 412return Task.FromResult(Read(buffer, index, count));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncTaskMethodBuilderT.cs (1)
473m_task = Threading.Tasks.Task.FromResult(result);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\YieldAwaitable.cs (1)
178}, Task.FromResult(continuationId)); // pass the ID in a task to avoid a closure\
src\libraries\System.Private.CoreLib\src\System\Threading\SemaphoreSlim.cs (2)
698return Task.FromResult(true); 703return Task.FromResult(false);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\CachedCompletedInt32Task.cs (1)
33return _task = Task.FromResult(result);
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\Task.cs (2)
6617task1.IsCompleted ? FromResult(task1) : 6618task2.IsCompleted ? FromResult(task2) :
src\libraries\System.Private.CoreLib\src\System\Threading\Tasks\ValueTask.cs (2)
580return Task.FromResult(_result!); 608return Task.FromResult(t.GetResult(_token));
System.Private.Xml (17)
System\Xml\AsyncHelper.cs (3)
10public static readonly Task<bool> DoneTaskTrue = Task.FromResult(true); 12public static readonly Task<bool> DoneTaskFalse = Task.FromResult(false); 14public static readonly Task<int> DoneTaskZero = Task.FromResult(0);
System\Xml\Core\XmlCharCheckingReaderAsync.cs (2)
315return Task.FromResult(0); 369return Task.FromResult(0);
System\Xml\Core\XmlSubtreeReaderAsync.cs (2)
20return Task.FromResult(_curNode.value); 532return Task.FromResult(copyCount);
System\Xml\Core\XmlTextReaderImplAsync.cs (3)
37return Task.FromResult(_curNode.StringValue); 240return Task.FromResult(ParseFragmentAttribute()); 3164private readonly Task<(int, int, int, bool)> _parseText_dummyTask = Task.FromResult((0, 0, 0, false));
System\Xml\Core\XsdCachingReaderAsync.cs (2)
22return Task.FromResult(_cachedNode!.OriginalStringValue!); 26return Task.FromResult(_cachedNode!.RawValue);
System\Xml\Core\XsdValidatingReaderAsync.cs (1)
25return Task.FromResult(_cachedNode.RawValue);
System\Xml\Resolvers\XmlPreloadedResolverAsync.cs (2)
35return Task.FromResult<object>(data.AsStream()); 39return Task.FromResult<object>(data.AsTextReader());
System\Xml\XmlDownloadManager.cs (1)
32return Task.FromResult<Stream>(new FileStream(fileUri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read, 1, useAsync: true));
System\Xml\XmlResolver.FileSystemResolver.cs (1)
46return Task.FromResult<object>(new FileStream(absoluteUri.LocalPath, FileMode.Open, FileAccess.Read, FileShare.Read, 1, useAsync: true));
System.ServiceModel.Http (7)
System\ServiceModel\Channels\HttpChannelFactory.cs (1)
764return Task.FromResult(result);
System\ServiceModel\Channels\HttpChannelHelpers.cs (1)
65return Task.FromResult(result);
System\ServiceModel\Channels\MessageContent.cs (2)
200return Task.FromResult<Stream>(resultStream); 240return Task.FromResult(_stream);
System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (3)
1002return Task.FromResult(0); 1007return Task.FromResult(GetBytesFromInitialReadBuffer(buffer, offset, count)); 1014return Task.FromResult(0);
System.ServiceModel.Primitives (20)
Internals\System\Runtime\InputQueue.cs (3)
529return Task.FromResult(true); 534return Task.FromResult(true); 544return Task.FromResult(itemAvailable);
Internals\System\Runtime\TaskHelpers.cs (1)
351return Task.FromResult(true);
Internals\System\Runtime\TimeoutHelper.cs (1)
337tokenTask = Task.FromResult(new CancellationTokenSource(millisecondsTimeout).Token);
System\IdentityModel\Selectors\KerberosSecurityTokenProvider.cs (1)
65return Task.FromResult(GetToken(timeout, null));
System\IdentityModel\Selectors\SecurityTokenProvider.cs (2)
93return Task.FromResult(GetTokenCore(timeout)); 178return Task.FromResult(RenewTokenCore(timeout, tokenToBeRenewed));
System\IdentityModel\Selectors\UserNameSecurityTokenProvider.cs (1)
33return Task.FromResult((SecurityToken)_userNameToken);
System\IdentityModel\Selectors\X509SecurityTokenProvider.cs (1)
45return Task.FromResult<SecurityToken>(GetTokenCore(timeout));
System\ServiceModel\Channels\BufferedReadStream.cs (1)
264t = Task.FromResult(val);
System\ServiceModel\Channels\ClientReliableChannelBinder.cs (1)
220return Task.FromResult(true);
System\ServiceModel\Channels\ReliableMessagingHelpers.cs (1)
857return Task.FromResult(true);
System\ServiceModel\Dispatcher\DispatchRuntime.cs (2)
397return Task.FromResult((object)Message.CreateMessage(message.Version, fault, message.Version.Addressing.DefaultFaultAction)); 403return Task.FromResult((object)null);
System\ServiceModel\Dispatcher\SyncMethodInvoker.cs (1)
184return Task.FromResult(Tuple.Create(returnValue, outputs));
System\ServiceModel\Security\AcceleratedTokenProvider.cs (1)
168return Task.FromResult(new AcceleratedTokenProviderState(keyEntropy));
System\ServiceModel\Security\ClientCredentialsSecurityTokenManager.cs (1)
353return Task.FromResult(GetTokenCore(timeout));
System\ServiceModel\Security\IssuanceTokenProviderBase.cs (1)
379return Task.FromResult(result);
System\ServiceModel\Security\WSSecurityTokenSerializer.cs (1)
495return Task.FromResult(ReadTokenCore(reader, tokenResolver));
System.ServiceModel.Primitives.Tests (5)
IdentityModel\SecurityTokenProviderTest.cs (4)
162var result = Task.FromResult<SecurityToken>(new DummySecurityToken()); 181var result = Task.FromResult<SecurityToken>(new DummySecurityToken()); 223return Task.FromResult<SecurityToken>(new DummySecurityToken()); 235return Task.FromResult<SecurityToken>(new DummySecurityToken());
ServiceModel\DuplexClientBaseTest.cs (1)
84return Task.FromResult<Guid>(guid);
System.ServiceModel.UnixDomainSocket (1)
System\ServiceModel\Channels\UnixPosixIdentitySecurityUpgradeProvider.cs (1)
108return Task.FromResult(stream);
System.Threading.Channels (2)
System\Threading\Channels\ChannelUtilities.cs (2)
16internal static readonly Task<bool> s_trueTask = Task.FromResult(result: true); 18internal static readonly Task<bool> s_falseTask = Task.FromResult(result: false);
System.Threading.Tasks.Dataflow (1)
Base\DataflowBlock.cs (1)
993return Task.FromResult<TOutput>(fastCheckedItem);
TagHelpersWebSite (1)
TagHelpers\TagCloudViewComponentTagHelper.cs (1)
76return Task.FromResult(GetTags(count));
Test.Utilities (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
Text.Analyzers (12)
src\Dependencies\Threading\AsyncBatchingWorkQueue`2.cs (1)
92private Task<(bool ranToCompletion, TResult? result)> _updateTask = Task.FromResult((ranToCompletion: true, default(TResult?)));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy.cs (1)
24asynchronousComputeFunction: static (outerArg, cancellationToken) => Task.FromResult(outerArg.synchronousComputeFunction(outerArg.arg, cancellationToken)),
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\AsyncLazy`1.cs (3)
93/// Creates an AsyncLazy that always returns the value, analogous to <see cref="Task.FromResult{T}" />. 97_cachedResult = Task.FromResult(value); 302CompleteWithTask(Task.FromResult(result), CancellationToken.None);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\SpecializedTasks.cs (7)
18public static readonly Task<bool> True = Task.FromResult(true); 19public static readonly Task<bool> False = Task.FromResult(false); 184public static readonly Task<T?> Default = Task.FromResult<T?>(default); 185public static readonly Task<IEnumerable<T>> EmptyEnumerable = Task.FromResult<IEnumerable<T>>(SpecializedCollections.EmptyEnumerable<T>()); 186public static readonly Task<ImmutableArray<T>> EmptyImmutableArray = Task.FromResult(ImmutableArray<T>.Empty); 187public static readonly Task<IList<T>> EmptyList = Task.FromResult(SpecializedCollections.EmptyList<T>()); 188public static readonly Task<IReadOnlyList<T>> EmptyReadOnlyList = Task.FromResult(SpecializedCollections.EmptyReadOnlyList<T>());
UnitTests.Common (1)
TestHelpers.cs (1)
358return Task.FromResult<Guid>(guid);
vbc (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
VBCSCompiler (3)
src\Compilers\Shared\BuildServerConnection.cs (3)
223return Task.FromResult<NamedPipeClientStream?>(null); 234return Task.FromResult<NamedPipeClientStream?>(null); 254return Task.FromResult<NamedPipeClientStream?>(null);
VBCSCompiler.UnitTests (15)
BuildClientTests.cs (1)
181return Task.FromResult<BuildResponse>(new RejectedBuildResponse(""));
ClientConnectionHandlerTests.cs (11)
31ReadBuildRequestFunc = _ => Task.FromResult(ProtocolUtil.EmptyCSharpBuildRequest), 33var completionData = await clientConnectionHandler.ProcessAsync(Task.FromResult<IClientConnection>(clientConnection)); 51var completionData = await clientConnectionHandler.ProcessAsync(Task.FromResult<IClientConnection>(clientConnection)); 63ReadBuildRequestFunc = _ => Task.FromResult(ProtocolUtil.EmptyCSharpBuildRequest), 71var completionData = await clientConnectionHandler.ProcessAsync(Task.FromResult<IClientConnection>(clientConnection)); 95ReadBuildRequestFunc = _ => Task.FromResult(ProtocolUtil.EmptyCSharpBuildRequest), 104Task.FromResult<IClientConnection>(clientConnection), 130ReadBuildRequestFunc = _ => Task.FromResult(BuildRequest.CreateShutdown()), 139Task.FromResult<IClientConnection>(clientConnection), 164ReadBuildRequestFunc = _ => Task.FromResult(ProtocolUtil.EmptyBasicBuildRequest), 170var task = clientConnectionHandler.ProcessAsync(Task.FromResult<IClientConnection>(clientConnection));
CompilerServerApiTest.cs (3)
81ReadBuildRequestFunc = _ => Task.FromResult(ProtocolUtil.EmptyCSharpBuildRequest), 95ReadBuildRequestFunc = _ => Task.FromResult(BuildRequest.CreateShutdown()), 98return Task.FromResult<IClientConnection>(client);
Wasm.Performance.ConsoleHost (1)
NullDispatcher.cs (1)
25=> Task.FromResult(workItem());