@@ -29,8 +29,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context)
2929 . Select ( static ( x , _ ) => x ! ) ;
3030
3131 var symbolsInReferencedAssemblies = context . CompilationProvider
32- . SelectMany ( ( x , _ ) => x . SourceModule . ReferencedAssemblySymbols )
33- . SelectMany ( ( asm , _ ) => asm . GlobalNamespace . CrawlForAllSymbols ( ) . Where ( x => x . Kind is SymbolKind . NamedType or SymbolKind . Method ) ) ;
32+ . SelectMany ( ( x , _ ) => x . SourceModule . ReferencedAssemblySymbols )
33+ . SelectMany ( ( asm , _ ) => asm . GlobalNamespace . CrawlForAllSymbols ( ) ) ;
3434
3535 var markdownFiles = context . AdditionalTextsProvider
3636 . Where ( static file => file . Path . EndsWith ( ".md" ) )
@@ -80,7 +80,7 @@ void Execute(IncrementalValuesProvider<ISymbol> types, bool skipDiagnostics = fa
8080 // Auto-assign the attached method name as the generated property name.
8181 buttonActionAttribute . Name = x . Item1 . Name ;
8282
83- item = ( x . Item1 , buttonActionAttribute ) ;
83+ item = ( x . Item1 . ContainingSymbol , buttonActionAttribute ) ;
8484 }
8585
8686 // Add extra property data, like Title, back to Attribute
@@ -138,7 +138,7 @@ void Execute(IncrementalValuesProvider<ISymbol> types, bool skipDiagnostics = fa
138138 sample . Attribute . Description ,
139139 sample . AttachedQualifiedTypeName ,
140140 optionsPaneAttribute . FirstOrDefault ( x => x . Item1 ? . SampleId == sample . Attribute . Id ) . Item2 ? . ToString ( ) ,
141- generatedOptionPropertyData . Where ( x => ReferenceEquals ( x . Item1 , sample . Symbol ) ) . Select ( x => x . Item2 )
141+ generatedOptionPropertyData . Where ( x => Equals ( x . Symbol , sample . Symbol ) ) . Select ( x => x . Item2 )
142142 )
143143 ) ;
144144
@@ -256,7 +256,9 @@ private static void ReportDiagnosticsGeneratedOptionsPane(SourceProductionContex
256256 ctx . ReportDiagnostic ( Diagnostic . Create ( DiagnosticDescriptors . SamplePaneOptionWithDuplicateName , item . SelectMany ( x => x . Item1 . Locations ) . FirstOrDefault ( ) , item . Key ) ) ;
257257
258258 // Check for generated options that conflict with an existing property name
259- var generatedOptionsWithConflictingPropertyNames = generatedOptionPropertyData . Where ( x => x . Item1 is INamedTypeSymbol sym && GetAllMembers ( sym ) . Any ( y => x . Item2 . Name == y . Name ) ) ;
259+ var generatedOptionsWithConflictingPropertyNames = generatedOptionPropertyData
260+ . Where ( x => x . Item2 is not ToolkitSampleButtonActionAttribute )
261+ . Where ( x => x . Item1 is INamedTypeSymbol sym && GetAllMembers ( sym ) . Any ( y => x . Item2 . Name == y . Name ) ) ;
260262
261263 foreach ( var item in generatedOptionsWithConflictingPropertyNames )
262264 ctx . ReportDiagnostic ( Diagnostic . Create ( DiagnosticDescriptors . SamplePaneOptionWithConflictingName , item . Item1 . Locations . FirstOrDefault ( ) , item . Item2 . Name ) ) ;
0 commit comments