Unify samples analyzer configuration more with Roslyn, and ensure correctness build reports warnings - #85038
Merged
dibarbet merged 2 commits intoAug 28, 2026
Conversation
…rectness build reports issues
|
Azure Pipelines: Successfully started running 2 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
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
jasonmalinowski
approved these changes
Aug 25, 2026
akhera99
approved these changes
Aug 26, 2026
dibarbet
enabled auto-merge
August 27, 2026 18:48
Member
Author
|
/azp run roslyn-CI |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This was referenced Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Microsoft Reviewers: Open in CodeFlow