CsEffect 0.15.0

dotnet add package CsEffect --version 0.15.0
                    
NuGet\Install-Package CsEffect -Version 0.15.0
                    
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="CsEffect" Version="0.15.0">
  <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="CsEffect" Version="0.15.0" />
                    
Directory.Packages.props
<PackageReference Include="CsEffect">
  <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 CsEffect --version 0.15.0
                    
#r "nuget: CsEffect, 0.15.0"
                    
#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 CsEffect@0.15.0
                    
#: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=CsEffect&version=0.15.0
                    
Install as a Cake Addin
#tool nuget:?package=CsEffect&version=0.15.0
                    
Install as a Cake Tool

CsEffect (Code Fixes)

Companion Roslyn code fixes for CsEffect that automatically add required effect annotations.

Overview

This package provides automated code fixes for CsEffect analyzer diagnostics. When the CsEffect analyzer detects that a method requires an effect attribute, this package offers one-click fixes to add the missing annotations automatically.

Features

Automatic Effect Addition

When you see a CSE001 diagnostic, use the IDE's quick actions (Ctrl+. in Visual Studio/VS Code) to automatically add the required effect attribute.

Before:

public void MyMethod() // CSE001: Member 'MyMethod' requires [ConsoleEffect]
{
    Console.WriteLine("Hello");
}

After applying fix:

[ConsoleEffect]
public void MyMethod()
{
    Console.WriteLine("Hello");
}

Interface Effect Synchronization

For CSE002 diagnostics (interface implementation mismatches), the code fix can add the missing effect attribute to the interface declaration.

Before:

public interface ILogger
{
    void Log(string message); // Missing [ConsoleEffect]
}

public class Logger : ILogger
{
    [ConsoleEffect] // CSE002: Interface doesn't declare this effect
    public void Log(string message)
    {
        Console.WriteLine(message);
    }
}

After applying "Add [ConsoleEffect] to interface" fix:

public interface ILogger
{
    [ConsoleEffect]
    void Log(string message);
}

public class Logger : ILogger
{
    [ConsoleEffect]
    public void Log(string message)
    {
        Console.WriteLine(message);
    }
}

Installation

This package is typically installed alongside the CsEffect analyzer:

<ItemGroup>
  <PackageReference Include="CsEffect" Version="0.2.0" OutputItemType="Analyzer" />
</ItemGroup>

The package includes both the analyzer and code fixes in a single package for convenience.

For separate installation:

<ItemGroup>
  <PackageReference Include="CsEffect.CodeFixes" Version="0.2.0" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

Supported Diagnostics

Diagnostic Code Fix
CSE001 Add missing effect attribute to the method
CSE002 Add missing effect attribute to interface method

How to Use

  1. Build your project - The analyzer will identify methods that need effect annotations
  2. Open the file with diagnostics in your IDE
  3. Position cursor on the squiggly line or diagnostic
  4. Press Ctrl+. (or Cmd+. on Mac) to open quick actions
  5. Select the fix - e.g., "Add [ConsoleEffect]"
  6. The attribute is added automatically with proper using statements if needed

Fix All Support

The code fix provider supports "Fix All" operations, allowing you to:

  • Fix all instances in the current document
  • Fix all instances in the current project
  • Fix all instances in the solution

Access this through the screwdriver icon that appears when you hover over a diagnostic, or through the "Fix All" command in the error list.

Technical Details

Attribute Resolution

The code fix automatically:

  • Resolves the correct attribute type from the diagnostic metadata
  • Adds necessary using statements if the attribute namespace isn't imported
  • Handles both simple names (e.g., ConsoleEffect) and fully qualified names

Interface Handling

For interface fixes, the code fix:

  • Finds all interface methods implemented by the problematic method
  • Adds the effect attribute to interface methods that don't already have it
  • Works across multiple files and projects in the same solution

Performance

  • Code fixes are only computed when requested (when you open quick actions)
  • Bulk operations use efficient batch processing
  • No impact on build performance

Requirements

  • CsEffect.Analyzer: The analyzer package that generates the diagnostics
  • Roslyn-compatible IDE: Visual Studio 2022+, VS Code with C# extension, or Rider
  • .NET Standard 2.0+: Compatible with .NET Framework 4.7.2+ and .NET Core/5+

License

MIT

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has 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
0.15.0 114 10/13/2025
0.14.0 110 10/13/2025
0.13.0 111 10/13/2025
0.12.0 104 10/13/2025
0.11.0 109 10/13/2025
0.10.0 106 10/12/2025
0.9.0 112 10/12/2025
0.8.0 114 10/12/2025
0.7.0 113 10/12/2025
0.6.0 114 10/12/2025
0.5.0 111 10/12/2025
0.4.0 111 10/12/2025
0.3.0 89 10/11/2025
0.2.0 90 10/11/2025
0.2.0-alpha.12 57 10/11/2025
0.2.0-alpha.11 39 10/10/2025
0.2.0-alpha.9 39 10/10/2025
0.2.0-alpha.8 39 10/10/2025
0.1.0 104 10/10/2025
0.1.0-alpha.1 48 10/10/2025
0.0.0 99 10/11/2025