Arcturus.CodeAnalysis.CSharp
2026.6.11.330
See the version list below for details.
dotnet add package Arcturus.CodeAnalysis.CSharp --version 2026.6.11.330
NuGet\Install-Package Arcturus.CodeAnalysis.CSharp -Version 2026.6.11.330
<PackageReference Include="Arcturus.CodeAnalysis.CSharp" Version="2026.6.11.330"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="Arcturus.CodeAnalysis.CSharp" Version="2026.6.11.330" />
<PackageReference Include="Arcturus.CodeAnalysis.CSharp"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add Arcturus.CodeAnalysis.CSharp --version 2026.6.11.330
#r "nuget: Arcturus.CodeAnalysis.CSharp, 2026.6.11.330"
#:package Arcturus.CodeAnalysis.CSharp@2026.6.11.330
#addin nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.6.11.330
#tool nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.6.11.330
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.10.9.370 | 135 | 10/9/2026 |
| 2026.8.27.364 | 159 | 8/27/2026 |
| 2026.8.25.356 | 121 | 8/25/2026 |
| 2026.8.24.348 | 123 | 8/24/2026 |
| 2026.8.10.345 | 142 | 8/10/2026 |
| 2026.6.11.331 | 176 | 6/11/2026 |
| 2026.6.11.330 | 131 | 6/11/2026 |
| 2026.6.11.329 | 127 | 6/11/2026 |
| 2026.6.11.327 | 124 | 6/11/2026 |
| 2026.6.11.325 | 134 | 6/11/2026 |
| 2026.6.10.323 | 135 | 6/10/2026 |
| 2026.6.9.322 | 129 | 6/9/2026 |
| 2026.6.9.321 | 132 | 6/9/2026 |
| 2026.4.14.320 | 170 | 4/14/2026 |
| 2026.4.14.318 | 132 | 4/14/2026 |
| 2026.3.15.316 | 157 | 3/15/2026 |
| 2026.3.12.308 | 142 | 3/12/2026 |
| 2026.3.11.295 | 145 | 3/11/2026 |
| 2026.3.11.291 | 133 | 3/11/2026 |
| 2026.3.9.275 | 139 | 3/9/2026 |