Skip to main content
The SDK enforces modern API usage via BannedApiAnalyzers.

DateTime

Use TimeProvider for testability.
BannedUse instead
DateTime.NowTimeProvider.System.GetUtcNow()
DateTime.UtcNowTimeProvider.System.GetUtcNow()
DateTimeOffset.NowTimeProvider.System.GetUtcNow()
DateTimeOffset.UtcNowTimeProvider.System.GetUtcNow()

Guard Clauses

Use SDK’s Throw utilities.
BannedUse instead
ArgumentNullException.ThrowIfNull()Throw.IfNull()
ArgumentException.ThrowIfNullOrEmpty()Throw.IfNullOrEmpty()
ArgumentException.ThrowIfNullOrWhiteSpace()Throw.IfNullOrWhiteSpace()

File System Times

Use UTC variants to avoid timezone bugs.

String Comparison

Use Ordinal for performance; InvariantCulture has overhead.
BannedUse instead
StringComparison.InvariantCultureOrdinal
StringComparison.InvariantCultureIgnoreCaseOrdinalIgnoreCase
StringComparer.InvariantCultureOrdinal
StringComparer.InvariantCultureIgnoreCaseOrdinalIgnoreCase

Explicit Parameters

Require explicit intent, no implicit defaults.
BannedFix
Enum.TryParse()Add ignoreCase parameter
Math.Round()Add MidpointRounding parameter
MathF.Round()Add MidpointRounding parameter
new CultureInfo(string)CultureInfo.GetCultureInfo() (cached)

Legacy Types

BannedUse instead
Tuple<T1, ...>Value tuples: (string, int)

Opt-out

<PropertyGroup>
  <IncludeDefaultBannedSymbols>false</IncludeDefaultBannedSymbols>
</PropertyGroup>