SharpSource 1.25.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpSource --version 1.25.1                
NuGet\Install-Package SharpSource -Version 1.25.1                
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="SharpSource" Version="1.25.1">
  <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.
paket add SharpSource --version 1.25.1                
#r "nuget: SharpSource, 1.25.1"                
#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.
// Install SharpSource as a Cake Addin
#addin nuget:?package=SharpSource&version=1.25.1

// Install SharpSource as a Cake Tool
#tool nuget:?package=SharpSource&version=1.25.1                

Nuget Downloads Visual Studio Marketplace Downloads

Demonstration of an analyzer which removes unnecessary IEnumerable materializations

Quickstart

Install it through the command line:

Install-Package SharpSource

or add a reference yourself:

<ItemGroup>
    <PackageReference Include="SharpSource" Version="1.25.1" PrivateAssets="All" />
</ItemGroup>

If you would like to install it as an extension instead, download it from the marketplace.


This repo houses a collection of analyzers that aim to make some language features and framework types easier to work with. It does this by highlighting when you might be using something incorrectly in a way that would result in suboptimal performance, runtime exceptions or general unintended behaviour.

In other words, this repo only contains analyzers for patterns that have a concrete potential to turn into a defect ticket. It is not intended to help with general housekeeping tasks like formatting your code or providing productivity helpers.

Interested in contributing? Take a look at the guidelines!


Detailed explanations of each analyzer can be found in the documentation: https://github.com/Vannevelj/SharpSource/tree/master/docs

Code Name
SS001 AsyncMethodWithVoidReturnType
SS002 DateTimeNow
SS003 DivideIntegerByInteger
SS004 ElementaryMethodsOfTypeInCollectionNotOverridden
SS005 EqualsAndGetHashcodeNotImplementedTogether
SS006 ThrowNull
SS007 FlagsEnumValuesAreNotPowersOfTwo
SS008 GetHashCodeRefersToMutableMember
SS009 LoopedRandomInstantiation
SS010 NewGuid
SS011 OnPropertyChangedWithoutNameofOperator
SS012 RecursiveOperatorOverload
SS013 RethrowExceptionWithoutLosingStacktrace
SS014 StringDotFormatWithDifferentAmountOfArguments
SS015 StringPlaceholdersInWrongOrder
SS017 StructWithoutElementaryMethodsOverridden
SS018 SwitchDoesNotHandleAllEnumOptions
SS019 SwitchIsMissingDefaultLabel
SS020 TestMethodWithoutPublicModifier
SS021 TestMethodWithoutTestAttribute
SS022 ExceptionThrownFromImplicitOperator
SS023 ExceptionThrownFromPropertyGetter
SS024 ExceptionThrownFromStaticConstructor
SS025 ExceptionThrownFromFinallyBlock
SS026 ExceptionThrownFromEqualityOperator
SS027 ExceptionThrownFromDispose
SS028 ExceptionThrownFromFinalizer
SS029 ExceptionThrownFromGetHashCode
SS030 ExceptionThrownFromEquals
SS032 ThreadSleepInAsyncMethod
SS033 AsyncOverloadsAvailable
SS034 AccessingTaskResultWithoutAwait
SS035 SynchronousTaskWait
SS036 ExplicitEnumValues
SS037 HttpClientInstantiatedDirectly
SS038 HttpContextStoredInField
SS039 EnumWithoutDefaultValue
SS040 UnusedResultOnImmutableObject
SS041 UnnecessaryEnumerableMaterialization
SS042 InstanceFieldWithThreadStatic
SS043 MultipleFromBodyParameters
SS044 AttributeMustSpecifyAttributeUsage
SS045 StaticInitializerAccessedBeforeInitialization
SS046 UnboundedStackalloc
SS047 LinqTraversalBeforeFilter
SS048 LockingOnDiscouragedObject
SS049 ComparingStringsWithoutStringComparison
SS050 ParameterAssignedInConstructor
SS051 LockingOnMutableReference
SS052 ThreadStaticWithInitializer
SS053 PointlessCollectionToString
SS054 NewtonsoftMixedWithSystemTextJson
SS055 MultipleOrderByCalls
SS056 FormReadSynchronously
SS057 CollectionManipulatedDuringTraversal
SS058 StringConcatenatedInLoop
SS059 DisposeAsyncDisposable
SS060 ConcurrentDictionaryEmptyCheck

Configuration

Is a particular rule not to your liking? There are many ways to adjust their severity and even disable them altogether. For an overview of some of the options, check out this document.

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.25.2 1,684 9/15/2024
1.25.1 101 9/15/2024
1.25.0 132 9/15/2024
1.24.1 151 9/13/2024
1.24.0 8,962 2/21/2024
1.23.4 858 1/5/2024
1.23.3 5,690 5/15/2023
1.23.2 791 3/18/2023
1.23.1 2,019 2/28/2023
1.23.0 311 2/26/2023
1.22.2 287 2/25/2023
1.22.1 311 2/21/2023
1.22.0 277 2/21/2023
1.21.6 681 2/10/2023
1.21.5 407 1/31/2023
1.21.4 338 1/29/2023
1.21.3 332 1/25/2023
1.21.2 314 1/23/2023
1.21.1 318 1/22/2023
1.21.0 330 1/21/2023
1.20.0 347 1/20/2023
1.19.1 366 1/14/2023
1.19.0 330 1/12/2023
1.18.0 10,942 1/10/2023
1.17.6 343 1/8/2023
1.17.5 359 1/6/2023
1.17.4 348 1/4/2023
1.17.3 329 1/3/2023
1.17.2 355 1/2/2023
1.17.1 329 1/2/2023
1.17.0 350 1/1/2023
1.16.22 349 1/1/2023
1.16.21 344 1/1/2023
1.16.20 330 1/1/2023
1.16.19 337 1/1/2023
1.16.18 319 12/31/2022
1.16.17 302 12/31/2022
1.16.16 339 12/30/2022
1.16.15 348 12/30/2022
1.16.14 355 12/30/2022
1.16.13 301 12/30/2022
1.16.12 321 12/30/2022
1.16.11 338 12/30/2022
1.16.10 323 12/30/2022
1.16.9 334 12/30/2022
1.16.8 303 12/30/2022
1.16.7 342 12/30/2022
1.16.6 338 12/30/2022
1.16.5 360 12/29/2022
1.16.4 343 12/29/2022
1.16.3 311 12/29/2022
1.16.2 340 12/29/2022
1.16.1 344 12/28/2022
1.16.0 307 12/27/2022
1.15.0 344 12/25/2022
1.14.1 9,671 10/16/2022
1.14.0 438 10/16/2022
1.13.1 431 10/1/2022
1.13.0 425 10/1/2022
1.12.0 480 9/25/2022
1.11.2 459 9/25/2022
1.11.1 425 9/24/2022
1.11.0 464 9/24/2022
1.10.1 449 9/16/2022
1.10.0 494 9/14/2022
1.9.4 514 9/13/2022
1.9.3 436 9/12/2022
1.9.2 417 9/12/2022
1.9.1 452 9/11/2022
1.9.0 455 9/11/2022
1.8.0 438 9/8/2022
1.7.2 455 9/6/2022
1.7.1 458 9/5/2022
1.7.0 452 9/5/2022
1.6.0 415 9/4/2022
1.5.0 418 9/4/2022
1.4.2 447 9/4/2022
1.3.1 453 9/3/2022
1.3.0 458 9/2/2022
1.2.4 462 8/31/2022
1.2.3 468 8/29/2022
1.2.2 459 8/29/2022
1.2.1 444 8/29/2022
1.2.0 458 8/29/2022
1.1.1 462 8/28/2022
1.1.0 443 8/28/2022
1.0.0 476 8/28/2022
0.9.0 466 8/26/2022
0.8.0 460 8/23/2022
0.7.0 421 8/22/2022
0.6.0 471 8/15/2022
0.5.0 442 8/14/2022
0.4.0 466 8/14/2022
0.3.0 538 5/10/2020
0.2.0 548 4/12/2020
0.1.0 574 4/12/2020

For a full overview of the changes, visit https://github.com/vannevelj/sharpsource/releases