Skip to content

Commit

Permalink
Optimize Options Source Gen when no need to run (#93427)
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekgh authored Oct 13, 2023
1 parent fe1247b commit bcec497
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 bcec497

Please sign in to comment.