ISOCodex.Currency.Analyzers 1.0.2

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

ISOCodex.Currency.Analyzers

Roslyn analyzers for ISOCodex.Currency.

Install

<PackageReference Include="ISOCodex.Currency.Analyzers" Version="1.0.2" PrivateAssets="all" />

Diagnostics

ISOCCUR001

Avoid default(Money). Use Money.Zero(currency) or Money.Of(amount, currency).

Money value = default(Money); // ISOCCUR001
Money other = default;        // ISOCCUR001 when converted to Money

ISOCCUR002

Avoid default(CurrencyCode). Use CurrencyCode.Parse(...), CurrencyCode.TryParse(...), or a known static code such as CurrencyCode.GBP.

CurrencyCode value = default(CurrencyCode); // ISOCCUR002
CurrencyCode other = default;               // ISOCCUR002 when converted to CurrencyCode

ISOCCUR003

Do not ignore MoneyValidationResult or MoneyParseResult. Store the result and check Succeeded plus the stable failure reason before continuing.

Money.TryCreate(12.345m, CurrencyCode.GBP);        // ISOCCUR003
new MoneyParser().Parse("GBP 12.345");             // ISOCCUR003

var result = Money.TryCreate(12.345m, CurrencyCode.GBP);
if (!result.Succeeded)
{
    Console.WriteLine(result.FailureReason);
}

ISOCCUR005

Do not enable symbol parsing without an expected currency. Currency symbols are ambiguous across cultures and territories, so symbol parsing should be anchored to the currency the caller already expects.

new MoneyParseOptions(
    new CultureInfo("en-GB"),
    currencyStyles: MoneyParseCurrencyStyles.CodeOrSymbol); // ISOCCUR005

new MoneyParseOptions(
    new CultureInfo("en-GB"),
    CurrencyCode.GBP,
    MoneyParseCurrencyStyles.CodeOrSymbol);                 // ok

This analyzer package does not include code fixes.

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
1.0.2 108 6/23/2026
1.0.1 100 6/23/2026
1.0.0 104 6/23/2026
0.9.0-alpha.15 56 6/23/2026
0.9.0-alpha.14 59 6/23/2026
0.9.0-alpha.13 57 6/23/2026
0.9.0-alpha.12 58 6/23/2026
0.9.0-alpha.11 55 6/23/2026
0.9.0-alpha.10 60 6/23/2026
0.9.0-alpha.9 57 6/22/2026
0.9.0-alpha.8 57 6/22/2026
0.9.0-alpha.7 71 6/22/2026
0.9.0-alpha.6 59 6/22/2026
0.9.0-alpha.5 55 6/22/2026
0.9.0-alpha.4 55 6/22/2026
0.9.0-alpha.2 61 6/22/2026
0.9.0-alpha.1 64 6/22/2026
0.1.0-alpha.8 57 6/22/2026
0.1.0-alpha.7 58 6/22/2026