Orleans.FSharp.Analyzers
1.0.0
See the version list below for details.
dotnet add package Orleans.FSharp.Analyzers --version 1.0.0
NuGet\Install-Package Orleans.FSharp.Analyzers -Version 1.0.0
<PackageReference Include="Orleans.FSharp.Analyzers" Version="1.0.0" />
<PackageVersion Include="Orleans.FSharp.Analyzers" Version="1.0.0" />
<PackageReference Include="Orleans.FSharp.Analyzers" />
paket add Orleans.FSharp.Analyzers --version 1.0.0
#r "nuget: Orleans.FSharp.Analyzers, 1.0.0"
#:package Orleans.FSharp.Analyzers@1.0.0
#addin nuget:?package=Orleans.FSharp.Analyzers&version=1.0.0
#tool nuget:?package=Orleans.FSharp.Analyzers&version=1.0.0
Orleans.FSharp.Analyzers
F# code analyzer that detects async {} computation expression usage and recommends task {} instead.
Why
Orleans is Task-native. Using async {} in grain code introduces unnecessary overhead from Async.StartAsTask conversions and can cause deadlocks on the grain's single-threaded scheduler. This analyzer catches async {} usage at edit-time so you can fix it before it reaches production.
Diagnostic
| Code | Severity | Message |
|---|---|---|
| OF0001 | Warning | Use task {} instead of async {} for Orleans compatibility. Orleans is Task-native; async introduces overhead and potential deadlocks. |
Opt-out
Apply [<AllowAsync>] to a method or property to suppress the diagnostic for that binding:
open Orleans.FSharp.Analyzers
[<AllowAsync>]
let legacyOperation () = async {
// OF0001 suppressed here
return! someAsyncLib ()
}
Installation
This analyzer is distributed via FSharp.Analyzers.SDK. To enable it:
- Install
Orleans.FSharp.Analyzersas a NuGet reference. - Configure your editor or build to load analyzers from the SDK path.
Refer to the FSharp.Analyzers.SDK docs for editor integration details.
How it works
The analyzer walks the untyped F# AST (ParsedInput) looking for SynExpr.App nodes where the function is SynExpr.Ident("async") applied to a SynExpr.ComputationExpr. Bindings decorated with [<AllowAsync>] or [<AllowAsyncAttribute>] are skipped.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FSharp.Analyzers.SDK (>= 0.36.0)
- FSharp.Core (>= 10.1.201)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.