Arcturus.CodeAnalysis.CSharp 2026.3.15.316

dotnet add package Arcturus.CodeAnalysis.CSharp --version 2026.3.15.316
                    
NuGet\Install-Package Arcturus.CodeAnalysis.CSharp -Version 2026.3.15.316
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Arcturus.CodeAnalysis.CSharp" Version="2026.3.15.316">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Arcturus.CodeAnalysis.CSharp" Version="2026.3.15.316" />
                    
Directory.Packages.props
<PackageReference Include="Arcturus.CodeAnalysis.CSharp">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Arcturus.CodeAnalysis.CSharp --version 2026.3.15.316
                    
#r "nuget: Arcturus.CodeAnalysis.CSharp, 2026.3.15.316"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Arcturus.CodeAnalysis.CSharp@2026.3.15.316
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.3.15.316
                    
Install as a Cake Addin
#tool nuget:?package=Arcturus.CodeAnalysis.CSharp&version=2026.3.15.316
                    
Install as a Cake Tool

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 HttpClient which can lead to socket exhaustion. Recommends using IHttpClientFactory or 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.

There are no supported framework assets in this package.

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