@@ -49,6 +49,7 @@ public sealed partial class DeclarePublicApiAnalyzer : DiagnosticAnalyzer
49
49
internal const string FileName = "FileName" ;
50
50
51
51
private const char ObliviousMarker = '~' ;
52
+ private static readonly char [ ] ObliviousMarkerArray = { ObliviousMarker } ;
52
53
53
54
/// <summary>
54
55
/// Boolean option to configure if public API analyzer should bail out silently if public API files are missing.
@@ -397,7 +398,7 @@ private static bool ValidateApiFiles(ApiData shippedData, ApiData unshippedData,
397
398
errors . Add ( Diagnostic . Create ( descriptor , Location . None , InvalidReasonMisplacedNullableEnable ) ) ;
398
399
}
399
400
400
- var publicApiMap = new Dictionary < string , ApiLine > ( StringComparer . Ordinal ) ;
401
+ using var publicApiMap = PooledDictionary < string , ApiLine > . GetInstance ( StringComparer . Ordinal ) ;
401
402
ValidateApiList ( publicApiMap , shippedData . ApiList , isPublic , errors ) ;
402
403
ValidateApiList ( publicApiMap , unshippedData . ApiList , isPublic , errors ) ;
403
404
@@ -408,7 +409,7 @@ private static void ValidateApiList(Dictionary<string, ApiLine> publicApiMap, Im
408
409
{
409
410
foreach ( ApiLine cur in apiList )
410
411
{
411
- string textWithoutOblivious = cur . Text . TrimStart ( ObliviousMarker ) ;
412
+ string textWithoutOblivious = cur . Text . TrimStart ( ObliviousMarkerArray ) ;
412
413
if ( publicApiMap . TryGetValue ( textWithoutOblivious , out ApiLine existingLine ) )
413
414
{
414
415
LinePositionSpan existingLinePositionSpan = existingLine . SourceText . Lines . GetLinePositionSpan ( existingLine . Span ) ;
0 commit comments