Compiler Warning ASPIREDURABLETASK001
이 콘텐츠는 아직 번역되지 않았습니다.
Durable Task scheduler and task hub APIs are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.
This diagnostic warning is reported when using the experimental Durable Task scheduler and task hub APIs in the Aspire.Hosting.Azure.Functions package. The following APIs are affected:
AddDurableTaskSchedulerextension method onIDistributedApplicationBuilderRunAsExistingextension methods onIResourceBuilder<DurableTaskSchedulerResource>RunAsEmulatorextension method onIResourceBuilder<DurableTaskSchedulerResource>AddTaskHubextension method onIResourceBuilder<DurableTaskSchedulerResource>WithTaskHubNameextension methods onIResourceBuilder<DurableTaskHubResource>DurableTaskSchedulerResourceclassDurableTaskHubResourceclassDurableTaskSchedulerEmulatorResourceclass
These APIs are brand new and may change shape before the feature becomes generally available (GA).
Example
Section titled “Example”The following code generates ASPIREDURABLETASK001:
var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var scheduler = builder.AddDurableTaskScheduler("scheduler") .RunAsEmulator();
var hub = scheduler.AddTaskHub("hub");
builder.AddAzureFunctionsProject<Projects.MyFunctions>("functions") .WithHostStorage(storage) .WithReference(hub);
builder.Build().Run();To correct this warning
Section titled “To correct this warning”Suppress the warning with any of the following methods:
-
Add a
#pragma warning disabledirective in the source file where the API is used:C# — AppHost.cs #pragma warning disable ASPIREDURABLETASK001var scheduler = builder.AddDurableTaskScheduler("scheduler").RunAsEmulator();#pragma warning restore ASPIREDURABLETASK001 -
Set the severity of the rule in the .editorconfig file:
.editorconfig [*.{cs,vb}]dotnet_diagnostic.ASPIREDURABLETASK001.severity = noneFor more information about editor config files, see Configuration files for code analysis rules.
-
Add the following
PropertyGroupto your project file:C# project file <PropertyGroup><NoWarn>$(NoWarn);ASPIREDURABLETASK001</NoWarn></PropertyGroup>
See also
Section titled “See also”- Azure Functions Hosting integration — Learn about the Azure Functions hosting integration, including Durable Task support