Skip to content

Utilities and fluent testing framework for Roslyn incremental source generators. DiagnosticFlow, EquatableArray, snapshot testing.

License

Notifications You must be signed in to change notification settings

ANcpLua/ANcpLua.Roslyn.Utilities

Repository files navigation

NuGet NuGet NuGet NuGet .NET Standard 2.0 License: MIT

ANcpLua.Roslyn.Utilities

Utilities for Roslyn analyzers and source generators.

Packages

Package Purpose
ANcpLua.Roslyn.Utilities Core utilities (DLL reference)
ANcpLua.Roslyn.Utilities.Sources Source-only package (embeds as internal in analyzers/generators)
ANcpLua.Roslyn.Utilities.Polyfills Source-only polyfills for netstandard2.0 (no Roslyn dependency)
ANcpLua.Roslyn.Utilities.Testing Testing framework for Roslyn tooling

Installation

# For analyzers/generators (source-only, no runtime dependency)
dotnet add package ANcpLua.Roslyn.Utilities.Sources

# For polyfills only (no Roslyn dependency)
dotnet add package ANcpLua.Roslyn.Utilities.Polyfills

# For runtime reference
dotnet add package ANcpLua.Roslyn.Utilities

# For testing
dotnet add package ANcpLua.Roslyn.Utilities.Testing

Polyfills

The .Polyfills and .Sources packages include polyfills for modern C# features on netstandard2.0:

Polyfill What it enables Opt-out property
Index / Range array[^1], array[1..3] syntax InjectIndexRangeOnLegacy
IsExternalInit record types and init properties InjectIsExternalInitOnLegacy
Nullable attributes [NotNull], [MaybeNull], etc. InjectNullabilityAttributesOnLegacy
Trim/AOT attributes [RequiresUnreferencedCode], etc. InjectTrimAttributesOnLegacy
TimeProvider Testable time abstraction InjectTimeProviderPolyfill
Lock System.Threading.Lock polyfill InjectLockPolyfill
String extensions string.Contains(StringComparison) InjectStringExtensionsPolyfill

All polyfills are enabled by default. Set any property to false to opt out, or disable all with:

<InjectAllPolyfillsOnLegacy>false</InjectAllPolyfillsOnLegacy>

Documentation

ancplua.mintlify.app/utilities

Related

About

Utilities and fluent testing framework for Roslyn incremental source generators. DiagnosticFlow, EquatableArray, snapshot testing.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •