File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 1919 </ItemGroup >
2020
2121 <ItemGroup >
22+ <ProjectReference Include =" ..\..\Shared\Microsoft.AspNetCore.Razor.Utilities.Shared\Microsoft.AspNetCore.Razor.Utilities.Shared.csproj" />
2223 <ProjectReference Include =" ..\Microsoft.AspNetCore.Mvc.Razor.Extensions\src\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj" />
2324 <ProjectReference Include =" ..\Microsoft.AspNetCore.Razor.Language\src\Microsoft.AspNetCore.Razor.Language.csproj" />
2425 <ProjectReference Include =" ..\Microsoft.CodeAnalysis.Razor\src\Microsoft.CodeAnalysis.Razor.csproj" />
Original file line number Diff line number Diff line change 77using System . IO ;
88using System . Linq ;
99using Microsoft . AspNetCore . Razor . Language ;
10+ using Microsoft . AspNetCore . Razor . PooledObjects ;
1011using Microsoft . CodeAnalysis ;
1112using Microsoft . CodeAnalysis . CSharp ;
1213using Microsoft . CodeAnalysis . CSharp . Syntax ;
@@ -185,7 +186,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
185186 var tagHelperFeature = new StaticCompilationTagHelperFeature ( ) ;
186187 var discoveryProjectEngine = GetDiscoveryProjectEngine ( compilation . References . ToImmutableArray ( ) , tagHelperFeature ) ;
187188
188- var descriptors = ImmutableArray . CreateBuilder < TagHelperDescriptor > ( ) ;
189+ using var pool = ArrayBuilderPool < TagHelperDescriptor > . GetPooledObject ( out var descriptors ) ;
189190 tagHelperFeature . Compilation = compilation ;
190191 foreach ( var reference in compilation . References )
191192 {
@@ -212,8 +213,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
212213 return ImmutableArray < TagHelperDescriptor > . Empty ;
213214 }
214215
215- var allTagHelpers = ImmutableArray . CreateBuilder < TagHelperDescriptor > ( count ) ;
216- allTagHelpers . AddRange ( tagHelpersFromCompilation ) ;
216+ using var pool = ArrayBuilderPool < TagHelperDescriptor > . GetPooledObject ( out var allTagHelpers ) ;
217+ allTagHelpers . AddRange ( tagHelpersFromCompilation ) ;
217218 allTagHelpers . AddRange ( tagHelpersFromReferences ) ;
218219 allTagHelpers . AddRange ( tagHelpersFromComponents ) ;
219220
Original file line number Diff line number Diff line change 55using System . Collections . Immutable ;
66using System . Linq ;
77using Microsoft . AspNetCore . Razor . Language ;
8+ using Microsoft . AspNetCore . Razor . PooledObjects ;
89using Microsoft . CodeAnalysis ;
910using Microsoft . CodeAnalysis . Razor ;
1011
@@ -21,8 +22,8 @@ public ImmutableArray<TagHelperDescriptor> GetDescriptors()
2122 return ImmutableArray < TagHelperDescriptor > . Empty ;
2223 }
2324
24- var results = ImmutableArray . CreateBuilder < TagHelperDescriptor > ( ) ;
25- var context = TagHelperDescriptorProviderContext . Create ( results ) ;
25+ using var pool = ArrayBuilderPool < TagHelperDescriptor > . GetPooledObject ( out var results ) ;
26+ var context = TagHelperDescriptorProviderContext . Create ( results ) ;
2627 context . SetCompilation ( Compilation ) ;
2728 if ( TargetSymbol is not null )
2829 {
You can’t perform that action at this time.
0 commit comments