ToStringWithoutOverrideAnalyzer 0.5.0
See the version list below for details.
dotnet add package ToStringWithoutOverrideAnalyzer --version 0.5.0
NuGet\Install-Package ToStringWithoutOverrideAnalyzer -Version 0.5.0
<PackageReference Include="ToStringWithoutOverrideAnalyzer" Version="0.5.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add ToStringWithoutOverrideAnalyzer --version 0.5.0
#r "nuget: ToStringWithoutOverrideAnalyzer, 0.5.0"
// Install ToStringWithoutOverrideAnalyzer as a Cake Addin #addin nuget:?package=ToStringWithoutOverrideAnalyzer&version=0.5.0 // Install ToStringWithoutOverrideAnalyzer as a Cake Tool #tool nuget:?package=ToStringWithoutOverrideAnalyzer&version=0.5.0
NET Compiler Platform ("Roslyn") analyzer to disallow calling object.ToString() on types lacking an override.
Imagine we have the following simple plain old CLR object for representing money:
struct Money {
public decimal amount;
public string currency;
}
Then we try to print out an instance of it:
System.WriteLine("I need about {0}", new Money { amount = 3.50m, currency = "$" });
The statement will print `I need about Money`, which is not very useful. This came up a number of times on a team when writing code logging the state of objects for debugging purposes, leading to the creation of this analyzer.
After installing this analyzer the above `WriteLine` call will result in a compile-time error message `Expression of type 'Money' will be implicitly converted to a string, but does not override ToString()`.
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 (2)
Showing the top 2 popular GitHub repositories that depend on ToStringWithoutOverrideAnalyzer:
Repository | Stars |
---|---|
Genbox/VelcroPhysics
High performance 2D collision detection system with realistic physics responses.
|
|
emgarten/Sleet
A static nuget feed generator for Azure Storage, AWS S3, and more.
|
Version 0.5.0.0