Arcturus.CodeAnalysis.CSharp
2026.2.26.266
See the version list below for details.
dotnet add package Arcturus.CodeAnalysis.CSharp --version 2026.2.26.266
NuGet\Install-Package Arcturus.CodeAnalysis.CSharp -Version 2026.2.26.266
<PackageReference Include="Arcturus.CodeAnalysis.CSharp" Version="2026.2.26.266"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Arcturus.CodeAnalysis.CSharp" Version="2026.2.26.266" />
<PackageReference Include="Arcturus.CodeAnalysis.CSharp"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Arcturus.CodeAnalysis.CSharp --version 2026.2.26.266
#r "nuget: Arcturus.CodeAnalysis.CSharp, 2026.2.26.266"
#:package Arcturus.CodeAnalysis.CSharp@2026.2.26.266
#addin nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.2.26.266
#tool nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.2.26.266
Arcturus.CodeAnalysis.CSharp
A Roslyn analyzer package that provides code analysis rules to help enforce best practices and prevent common pitfalls in C# development.
Features
This analyzer package currently includes the following diagnostic rules:
- SDA001: Avoid direct HttpClient instantiation - Detects direct instantiation of
HttpClientwhich can lead to socket exhaustion. Recommends usingIHttpClientFactoryor a shared instance instead.
Installation
Install the package via NuGet Package Manager:
dotnet add package Arcturus.CodeAnalysis.CSharp
Or via Package Manager Console:
Install-Package Arcturus.CodeAnalysis.CSharp
Or add it directly to your .csproj file:
<ItemGroup>
<PackageReference Include="Arcturus.CodeAnalysis.CSharp" Version="1.0.0" />
</ItemGroup>
Usage
Once installed, the analyzers will automatically run during compilation and provide warnings or errors for detected issues in your code.
Example: HttpClient Instantiation
Bad Practice (will trigger SDA001 warning):
public class MyService
{
public async Task<string> GetDataAsync()
{
var client = new HttpClient(); // Warning: Avoid direct HttpClient instantiation
return await client.GetStringAsync("https://api.example.com");
}
}
Recommended Approach:
public class MyService
{
private readonly IHttpClientFactory _httpClientFactory;
public MyService(IHttpClientFactory httpClientFactory)
{
_httpClientFactory = httpClientFactory;
}
public async Task<string> GetDataAsync()
{
var client = _httpClientFactory.CreateClient();
return await client.GetStringAsync("https://api.example.com");
}
}
Diagnostic Rules
| Rule ID | Category | Severity | Description |
|---|---|---|---|
| SDA001 | Usage | Warning | Avoid direct HttpClient instantiation to prevent socket exhaustion |
Configuration
You can configure the behavior of individual analyzers using an .editorconfig file in your project:
# Disable SDA001
dotnet_diagnostic.SDA001.severity = none
# Make SDA001 an error instead of warning
dotnet_diagnostic.SDA001.severity = error
# Keep as warning (default)
dotnet_diagnostic.SDA001.severity = warning
Requirements
- .NET Standard 2.0 or higher
- Compatible with .NET Framework 4.7.2+, .NET Core 2.0+, and .NET 5.0+
Contributing
Contributions are welcome! If you have suggestions for new analyzer rules or improvements to existing ones, please open an issue or submit a pull request.
License
This project is part of the Arcturus framework. Please refer to the main repository for license information.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.3.15.316 | 26 | 3/15/2026 |
| 2026.3.12.308 | 45 | 3/12/2026 |
| 2026.3.11.295 | 73 | 3/11/2026 |
| 2026.3.11.291 | 76 | 3/11/2026 |
| 2026.3.9.275 | 85 | 3/9/2026 |
| 2026.3.9.271 | 79 | 3/9/2026 |
| 2026.3.9.269 | 77 | 3/9/2026 |
| 2026.3.7.268 | 77 | 3/7/2026 |
| 2026.2.26.266 | 95 | 2/26/2026 |
| 2026.2.25.258 | 96 | 2/25/2026 |
| 2026.2.25.257 | 80 | 2/25/2026 |
| 2026.2.25.256 | 78 | 2/25/2026 |
| 2026.2.25.255 | 83 | 2/25/2026 |
| 2026.2.25.253 | 76 | 2/25/2026 |
| 2026.2.25.252 | 82 | 2/25/2026 |
| 2026.2.23.242 | 103 | 2/23/2026 |
| 2026.2.5.233 | 122 | 2/5/2026 |
| 2026.1.13.213 | 143 | 1/13/2026 |
| 1.0.0 | 97 | 1/13/2026 |