Skip to content

Commit

Permalink
Optimize Options Source Gen when no need to run (#93481)
Browse files Browse the repository at this point in the history
Co-authored-by: Tarek Mahmoud Sayed <tarekms@microsoft.com>
  • Loading branch information
github-actions[bot] and tarekgh authored Oct 13, 2023
1 parent fb1d8b4 commit ae26d3e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/libraries/Microsoft.Extensions.Options/gen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public void Initialize(IncrementalGeneratorInitializationContext context)

private static void HandleAnnotatedTypes(Compilation compilation, ImmutableArray<(TypeDeclarationSyntax? TypeSyntax, SemanticModel SemanticModel)> types, SourceProductionContext context)
{
if (types.Length == 0)
{
return;
}

if (!SymbolLoader.TryLoad(compilation, out var symbolHolder))
{
// Not eligible compilation
Expand Down

0 comments on commit ae26d3e

Please sign in to comment.