Skip to content

Unify samples analyzer configuration more with Roslyn, and ensure correctness build reports warnings - #85038

Merged
dibarbet merged 2 commits into
dotnet:mainfrom
dibarbet:dibarbet-unify-sdk-sample-editorconfig
Aug 28, 2026
Merged

dibarbet merged 2 commits into
dotnet:mainfrom
dibarbet:dibarbet-unify-sdk-sample-editorconfig

Conversation

@dibarbet

@dibarbet dibarbet commented Aug 25, 2026

Copy link
Copy Markdown
Member
Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 25, 2026 22:14
@dibarbet
dibarbet requested a review from a team as a code owner August 25, 2026 22:14
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Roslyn SDK samples to align more closely with Roslyn repo build/analyzer conventions, with an emphasis on making sample validation stricter (warnings/code-style) while keeping samples building cleanly.

Changes:

  • Tighten sample validation (--warnaserror + /p:RoslynEnforceCodeStyle=true) and adjust sample-wide build/analyzer configuration.
  • Apply broad cleanup/modernization across samples: license headers, removal of trailing blank lines, ConfigureAwait(...), cancellation token plumbing, readonly/sealed/static adjustments.
  • Improve analyzer sample initialization patterns (generated-code configuration + concurrent execution).
Show a summary per file
File Description
src/RoslynSdk/Samples/VisualBasic/VisualBasicToCSharpConverter/VisualBasicToCSharpConverter.Test/UnitTest1.vb Add license header; whitespace cleanup
src/RoslynSdk/Samples/VisualBasic/VisualBasicToCSharpConverter/VisualBasicToCSharpConverter.Lib/QueryClauseConvertingVisitor.vb Make collections ReadOnly; whitespace cleanup
src/RoslynSdk/Samples/VisualBasic/VisualBasicToCSharpConverter/VisualBasicToCSharpConverter.Lib/NodeConvertingVisitor.vb Remove extra blank lines; formatting cleanup
src/RoslynSdk/Samples/VisualBasic/VisualBasicToCSharpConverter/VisualBasicToCSharpConverter.Lib/Converter.vb Seal converter type (NotInheritable)
src/RoslynSdk/Samples/VisualBasic/TreeTransforms/TreeTransforms.vb Remove stray blank line
src/RoslynSdk/Samples/VisualBasic/TreeTransforms/Transforms.vb Seal transforms type (NotInheritable)
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/SourceGeneratorSamples/SettingsXmlGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/SourceGeneratorSamples/HelloWorldGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/SourceGeneratorSamples/CsvGenerator.vb Add license header; comment cleanup
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/GeneratedDemo/UseHelloWorldGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/GeneratedDemo/UseCsvGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/GeneratedDemo/UseAutoNotifyGenerator.vb Add license header
src/RoslynSdk/Samples/VisualBasic/SourceGenerators/GeneratedDemo/Program.vb Add license header
src/RoslynSdk/Samples/VisualBasic/MakeConst/MakeConst/MakeConstAnalyzer.vb Configure generated-code + concurrency
src/RoslynSdk/Samples/VisualBasic/MakeConst/MakeConst.Test/MakeConstUnitTests.vb Add license header; whitespace cleanup
src/RoslynSdk/Samples/VisualBasic/ConvertToAutoProperty/ConvertToAutoProperty/CodeRefactoringProvider.vb Pass cancellation tokens to Roslyn APIs
src/RoslynSdk/Samples/VisualBasic/ConsoleClassifier/Program.vb Add ConfigureAwait(...) to awaits
src/RoslynSdk/Samples/VisualBasic/APISamples/SyntaxTrees.vb Remove stray blank line
src/RoslynSdk/Samples/VisualBasic/APISamples/SymbolsAndSemantics.vb Formatting cleanup in compilation creation
src/RoslynSdk/Samples/VisualBasic/APISamples/FAQ.vb Seal MyAnnotation; whitespace cleanup
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SyntaxTreeAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SyntaxNodeAnalyzer.vb Add generated-code + concurrency configuration
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SymbolAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SemanticModelAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/CompilationAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatelessAnalyzers/CodeBlockAnalyzer.vb Add generated-code + concurrency configuration
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatefulAnalyzers/CompilationStartedAnalyzerWithCompilationWideAnalysis.vb Concurrency-safe state handling + init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatefulAnalyzers/CompilationStartedAnalyzer.vb Add generated-code + concurrency configuration
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/StatefulAnalyzers/CodeBlockStartedAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/AdditionalFileAnalyzers/XmlAdditionalFileAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/VisualBasic/Analyzers/Analyzers.Implementation/AdditionalFileAnalyzers/SimpleAdditionalFileAnalyzer.vb Message text tweak; analyzer init conventions
src/RoslynSdk/Samples/Directory.Packages.props Pin transitive dependency version for security
src/RoslynSdk/Samples/Directory.Build.props Adjust sample build properties; disable nullable
src/RoslynSdk/Samples/CSharp/TreeTransforms/Transforms.cs Convert to static transforms utility
src/RoslynSdk/Samples/CSharp/SourceGenerators/SourceGeneratorSamples/SettingsXmlGenerator.cs Remove stray blank line
src/RoslynSdk/Samples/CSharp/SourceGenerators/SourceGeneratorSamples/MathsGenerator.cs Improve field modifiers; const/readonly cleanup
src/RoslynSdk/Samples/CSharp/SourceGenerators/SourceGeneratorSamples/CsvGenerator.cs Remove stray blank lines
src/RoslynSdk/Samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs Remove stray blank line
src/RoslynSdk/Samples/CSharp/SolutionExplorer/ViewModels/MainWindowViewModel.cs Use async command delegate; explicit ConfigureAwait
src/RoslynSdk/Samples/CSharp/SolutionExplorer/ViewModels/HierarchyItemViewModel.cs Make children collection field readonly
src/RoslynSdk/Samples/CSharp/SolutionExplorer/ViewModels/DocumentViewModel.cs Add ConfigureAwait(false) to await
src/RoslynSdk/Samples/CSharp/SolutionExplorer/Services/WorkspaceService.cs Add ConfigureAwait(false) to awaits
src/RoslynSdk/Samples/CSharp/SolutionExplorer/Properties/AssemblyInfo.cs Remove stray blank line
src/RoslynSdk/Samples/CSharp/SolutionExplorer/Framework/ViewModel_CommandBindings.cs Add async RegisterCommand(Func<Task>) overload
src/RoslynSdk/Samples/CSharp/SolutionExplorer/Framework/NotifyTaskCompletion.cs Use ConfigureAwait(true) before raising property changes
src/RoslynSdk/Samples/CSharp/RefOutModifier/RefOutModifier.Implementation/ApplicableActionFinder.cs Fix reference-location handling; readonly field
src/RoslynSdk/Samples/CSharp/FormatSolution/Program.cs Add ConfigureAwait(false) to awaits
src/RoslynSdk/Samples/CSharp/CSharpToVisualBasicConverter/CSharpToVisualBasicConverter.Lib/Converting/Converter.StatementVisitor.cs Remove unused helper method
src/RoslynSdk/Samples/CSharp/CSharpToVisualBasicConverter/CSharpToVisualBasicConverter.Lib/Converting/Converter.NodeVisitor.cs Remove unused helper method
src/RoslynSdk/Samples/CSharp/ConvertToConditional/ConvertToConditional.Implementation/ConvertToConditionalCodeRefactoringProvider.cs Pass cancellation token to GetRoot
src/RoslynSdk/Samples/CSharp/ConvertToAutoProperty/ConvertToAutoProperty.Implementation/PropertyRewriter.cs Remove stray blank line
src/RoslynSdk/Samples/CSharp/ConvertToAutoProperty/ConvertToAutoProperty.Implementation/ConvertToAutoPropertyCodeRefactoringProvider.cs Pass cancellation tokens to Roslyn APIs
src/RoslynSdk/Samples/CSharp/ConsoleClassifier/Program.cs Add ConfigureAwait(false) to awaits
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SyntaxTreeAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SyntaxNodeAnalyzer.cs Title punctuation cleanup
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatelessAnalyzers/SymbolAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatelessAnalyzers/IOperationAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatelessAnalyzers/CompilationAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatefulAnalyzers/CompilationStartedAnalyzerWithCompilationWideAnalysis.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/StatefulAnalyzers/CodeBlockStartedAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/AdditionalFileAnalyzers/XmlAdditionalFileAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/CSharp/Analyzers/Analyzers.Implementation/AdditionalFileAnalyzers/SimpleAdditionalFileAnalyzer.cs Message text tweak (punctuation)
src/RoslynSdk/Samples/.editorconfig Simplify sample overrides; disable RS003x in samples
src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Packages.props Scope transitive pinning behavior to testing
src/RoslynSdk/Directory.Packages.props Remove transitive pinning opt-out at repo level
eng/validate-roslyn-sdk-samples.ps1 Enforce warnings-as-errors + code-style in sample validation

Review details

  • Files reviewed: 67/67 changed files
  • Comments generated: 0
  • Review effort level: Lite

Comment thread src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Packages.props Outdated
Copilot AI review requested due to automatic review settings August 25, 2026 23:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review details

  • Files reviewed: 67/67 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@dibarbet

Copy link
Copy Markdown
Member Author

/azp run roslyn-CI

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@dibarbet
dibarbet merged commit bc3b961 into dotnet:main Aug 28, 2026
24 of 25 checks passed
@dibarbet
dibarbet deleted the dibarbet-unify-sdk-sample-editorconfig branch August 28, 2026 03:10
@dotnet-policy-service dotnet-policy-service Bot added this to the Next milestone Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants