ErrorCodes.Net.Analyzers
0.2.1
See the version list below for details.
dotnet add package ErrorCodes.Net.Analyzers --version 0.2.1
NuGet\Install-Package ErrorCodes.Net.Analyzers -Version 0.2.1
<PackageReference Include="ErrorCodes.Net.Analyzers" Version="0.2.1" />
<PackageVersion Include="ErrorCodes.Net.Analyzers" Version="0.2.1" />
<PackageReference Include="ErrorCodes.Net.Analyzers" />
paket add ErrorCodes.Net.Analyzers --version 0.2.1
#r "nuget: ErrorCodes.Net.Analyzers, 0.2.1"
#:package ErrorCodes.Net.Analyzers@0.2.1
#addin nuget:?package=ErrorCodes.Net.Analyzers&version=0.2.1
#tool nuget:?package=ErrorCodes.Net.Analyzers&version=0.2.1
ErrorCodes.Net
ErrorCodes.Net is a library for generating structured error codes with the format 0x12345678.
How the value is broken down:
0x |
12 |
34 |
5678 |
|---|---|---|---|
| Product ID | Project ID | Error Type | Error Code |
Product ID
Denotes which product the error belongs to. For example:
Service A with Product ID of 0 will have the format 0xXXXXXXXX while Service B with a Product ID of 1 will have the format 1xXXXXXXXX
Quick Start
- Install
ErrorCodes.Net.Analyzersusing the NuGet package manager in your IDE or use the following command in the project directory:PS C:\YOURSRC> dotnet add package ErrorCodes.Net.Analyzers - In the project file, make sure to add the
PrivateAssets="all"to the package:<PackageReference Include="ErrorCodes.Net.Analyzers" PrivateAssets="all" /> - Create a file in your project with the name
ErrorCodes.yamlorErrorCodes.ymland fill it with an example:--- projectId: 6 namespace: ErrorCodes.Net.Generated errorTypes: - name: TestErrors errorTypeId: 0 errorCodes: - errorCode: 1 name: RunError - errorCode: 2 name: LogsError - errorCode: 3 name: UninstallError - Set the build action for the new file to
C# analyzer additional filein Visual Studio orAdditionalFilesin Rider. - Rebuild the project.
If the rebuild was successful, you should be able to reference the error codes in the following way:
string error = ErrorCodeLookup.TestErrors.RunError.FormattedErrorCode;
For the above example file, the results of the FormatedErrorCode are:
| Name | Formatted output |
|---|---|
| RunError | 0x060001 |
| LogsError | 0x060002 |
| UninstallError | 0x060003 |
Example top-level console application:
Program.cs
using SampleConsole;
Console.WriteLine(ErrorCodeLookup.TestErrors.RunError.FormattedErrorCode);
Console.WriteLine(ErrorCodeLookup.TestErrors.LogsError.FormattedErrorCode);
Console.WriteLine(ErrorCodeLookup.TestErrors.UninstallError.FormattedErrorCode);
Output
1x06000001
1x06000002
1x06000003
See the full sample project here
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
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.2.2-preview.2 | 203 | 4/14/2025 |
| 0.2.2-preview.1 | 196 | 4/14/2025 |
| 0.2.1 | 227 | 5/7/2024 |
| 0.2.0 | 190 | 4/30/2024 |
| 0.1.1-preview.8 | 107 | 4/30/2024 |
| 0.1.1-preview.7 | 113 | 4/26/2024 |
| 0.1.1-preview.6 | 111 | 4/25/2024 |
| 0.1.1-preview.5 | 111 | 4/23/2024 |
| 0.1.1-preview.4 | 103 | 4/23/2024 |
| 0.1.1-preview.3 | 116 | 4/22/2024 |