Skip to main content
Extensions are code files injected into your project at build time. Enable them via MSBuild properties.

Available Extensions

PropertyWhat it does
InjectSourceGenHelpersRoslyn utilities for source generators
InjectFakeLoggerTest helpers for FakeLogCollector
InjectStringOrdinalComparerSingleton string comparers

Source Generator Helpers

For source generator projects. Injects utilities from ANcpLua.Roslyn.Utilities.
<PropertyGroup>
  <InjectSourceGenHelpers>true</InjectSourceGenHelpers>
</PropertyGroup>
Source generators can’t reference NuGet packages at design-time. This property embeds the utilities as internal source files instead.

FakeLogger Extensions

For test projects. Adds helpers for FakeLogCollector from Microsoft.Extensions.Diagnostics.Testing.
<PropertyGroup>
  <InjectFakeLogger>true</InjectFakeLogger>
</PropertyGroup>
Methods injected:
  • GetFullLoggerText() - Dump all logs as string
  • WaitForLogAsync() - Async polling for log entries
  • WaitForLogCountAsync() - Wait for N matching entries

String Comparers

Singleton ordinal comparers for allocation-free comparisons.
<PropertyGroup>
  <InjectStringOrdinalComparer>true</InjectStringOrdinalComparer>
</PropertyGroup>
Classes injected:
  • StringOrdinalComparer.Instance
  • StringOrdinalIgnoreCaseComparer.Instance