Repository navigation
[release/10.0] Migrate all source files to file-scoped namespaces - #17499
Merged
ViktorHofer merged 1 commit intoSep 8, 2026
Merged
ViktorHofer merged 1 commit into
ViktorHofer merged 1 commit into
Conversation
Backport of dotnet#17470 to release/10.0. Applies the same mechanical migration: block-scoped namespace declarations are converted to file-scoped ones and the bodies are dedented. IDE0161 is enabled as an error in .editorconfig so the rule stays enforced. Where a file was byte-identical to its pre-migration counterpart on main, the already-reviewed migrated content was taken verbatim. The remaining files were converted mechanically. StaticReflectionConstants.cs declared two namespaces, so the System.Diagnostics.CodeAnalysis one was extracted into DynamicallyAccessedMembersAttribute.cs (mirroring main). src/Microsoft.DotNet.XUnitAssert is vendored xunit source that carries an explicit '#pragma warning disable IDE0161' and is intentionally left alone. No functional changes. Co-authored-by: Copilot <[email protected]> Copilot-Session: 939d3657-0375-4294-9751-1eb9a894e28a
Contributor
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The scope is a very large, cross-cutting mechanical refactor (namespace style migration + analyzer enforcement) that merits final human validation despite appearing non-functional and building cleanly.
Review tier: Lite
Findings: None
What changed in this PR
This PR backports the main-branch migration to file-scoped namespaces onto release/10.0, and enforces the convention by enabling IDE0161 as an error for *.cs via .editorconfig. The intent is a mechanical formatting/style migration with no functional behavior changes.
Changes:
- Convert C# source files from block-scoped (
namespace X { ... }) to file-scoped (namespace X;) namespaces. - Add
.editorconfigrules to require file-scoped namespaces and treat IDE0161 violations as errors. - Split out the
System.Diagnostics.CodeAnalysispolyfill intoDynamicallyAccessedMembersAttribute.csand include it in the shared projitems.
| File | Description |
|---|---|
| src/SignCheck/SignCheckTask/src/FileStatus.cs | Convert to file-scoped namespace. |
| src/SignCheck/SignCheck/SignCheck.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/UnsupportedFileVerifier.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/SignatureVerificationOptions.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/Jar/JarError.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/ISecurityInfoProvider.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/FileHeaders.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/DetailKeys.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Verification/CabVerifier.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Logging/LogVerbosity.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Logging/LoggerBase.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Logging/ILogger.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/WinTrustFileInfo.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/WinTrustData.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/WinTrust.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/UnionChoice.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/UIChoice.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/StateAction.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/RevocationChecks.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/PortableExecutable/ImageMagic.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/PortableExecutable/DllCharacteristics.cs | Convert to file-scoped namespace. |
| src/SignCheck/Microsoft.SignCheck/Interop/Ole32.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions/tests/AlphabeticalOrderer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/XunitConstants.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/TestRuntimes.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/TargetFrameworkMonikers.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/RuntimeConfiguration.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Microsoft.DotNet.XUnitExtensions.Shared.projitems | Include the new DynamicallyAccessedMembersAttribute.cs polyfill in shared items. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/DynamicallyAccessedMembersAttribute.cs | Add extracted polyfill to enable file-scoped namespace usage in the remaining file(s). |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/TestCategoryDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/SkipOnPlatformDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/SkipOnCIDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/ParallelTheoryDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Discoverers/ActiveIssueDiscoverer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/ConditionalDiscovererException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/WindowsOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/WindowsOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/UnixOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/UnixOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/ParallelTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/MacOSOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/MacOSOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/LinuxOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/LinuxOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/DotNetOnlyTheoryAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitExtensions.Shared/Attributes/DotNetOnlyFactAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/Utility/Transform.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/ParallelismOption.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/TargetInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/ResourceAssembly.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/Resolution/ICompilationAssemblyResolver.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/Resolution/CompositeCompilationAssemblyResolver.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IFileSystem.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IFile.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IEnvironment.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDirectory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/IDependencyContextReader.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/FileSystemWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/EnvironmentWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.Extensions.DependencyModel/DirectoryWrapper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/Platform.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/Microsoft.DotNet.PlatformAbstractions/ApplicationEnvironment.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XUnitConsoleRunner/src/common/AssemblyResolution/_DiagnosticMessage.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Validation.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Tasks/TaskItemExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Tasks/BuildErrorException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Release.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks/Model/XlfNames.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.XliffTasks.Tests/AssertHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/TypeModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/PropertyModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/MethodGroupModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/KeyValuePairExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/EnumTypeModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/Modeler/Disposable.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/GeneratorOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SwaggerGenerator/Microsoft.DotNet.SwaggerGenerator.CodeGenerator/CodeFile.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SourceBuild/tests/WriteBuildOutputPropsTests.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SourceBuild/tasks/src/UsageReport/UsageValidationData.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ZipPart.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/SigningStatus.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/PEInfo.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ItemToSign.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/FileSignInfoEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool/src/ExecutableType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SignTool.Tests/StrongNameSupportHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.SharedFramework.Sdk/src/PlatformManifestEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.RemoteExecutor/src/RemoteExecutionException.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.PackageTesting/NupkgParser.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.NuGetRepack/tasks/src/NuGetUtils.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/TaskItemExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/Helpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/FailureCategory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/Constants.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/BaseTask.Desktop.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk/BaseTask.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Sdk.Tests/Microsoft.DotNet.Helix.Sdk.Tests/NonParallelTestCollection.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/StorageRetryPolicy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/IBlobHelper.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/StorageHelpers/IBlobContainer.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/SentJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/Payloads/UriPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/Payloads/EmptyPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/JobListEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IWorkItemDefinition.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/ISentJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IPayload.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IJobDefinitionWithType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobSender/IJobDefinitionWithTargetQueue.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Models/WorkItemTestResults.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IJobMonitorRunner.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IBlobClientFactory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/JobMonitor/Interfaces/IBlobClient.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/RequestUriBuilderExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/IJob.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/HelixApiTokenCredential.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/HelixApiOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UploadedFile.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/UnknownWorkItemEvent.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/SingleSourceRequest.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ResponseType.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponseSource.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceResponse.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MultiSourceRequest.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/MachineStateChangeRequest.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/JobResultsUri.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/InvestigationResult.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ImageInfo.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/HistoricalAnalysisItem.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/FailureReasonPart.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/FailureReason.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Deploy1esImagesResult.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/CustomImagePrepared.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/CustomImagePreInstalled.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/BuildAggregationSource.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/Artifact.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/ApiError.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Helix/Client/CSharp/generated-code/Models/AggregatedVMScalingHistory.cs | Convert to file-scoped namespace (generated code). |
| src/Microsoft.DotNet.Git.IssueManager/src/Models/AzureDevOpsCommit.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Git.IssueManager/src/Helpers/CollectionExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.GenAPI/WriterType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.GenAPI/SyntaxWriterType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.CodeAnalysis/DiagnosticIds.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Wix/GuidOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/ToolsPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/TemplatePackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/SdkPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/PackageExtractionMethod.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Msi/PayloadPackageTokens.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Msi/MsiProperty.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/LibraryPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/FrameworkPackPackage.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/Extensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads/src/BuildData.wix.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/TestBase.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Workloads.Tests/Extensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/ProductOptProfTraining.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfTrainingTest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfTrainingConfiguration.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfInstrumentationArgument.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/OptProfFileFilteredTest.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/JsonSerializerExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.VisualStudio/OptProf/Json/AssemblyOptProfTraining.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageMetadata.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/PackageDirectory.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Packaging/src/Metadata.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/RpmSignatureTag.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/RpmHeaderEntryType.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/HexConverter.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Installers/src/ArEntry.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/VersionIdentifierProxy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/PushOptions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/LaunchDebugger.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/IAssetPublisher.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/GetEnvProxy.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureStorageContainerAssetTokenCredentialPublisher.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsFeedPermission.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/EnumerableExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/BuildModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/BlobArtifactModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/AssetManifestModel.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest/ArtifactKind.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest.Tests/VersionIdentifierTestAsset.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Build.Manifest.Tests/TestInputs/TestInputs.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/Utilities/CollectionExtensions.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/RepoWithConditionalProjectsToBuild/src/Maybe/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/RepoWithConditionalProjectsToBuild/src/Always/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.DotNet.Arcade.Sdk.Tests/testassets/MinimalRepo/src/ClassLib1/Class1.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxTokenType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxToken.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/SyntaxStyle.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/Syntax/IStyleSyntaxWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/IReviewCommentWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciDifferenceWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/ICciDeclarationWriter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Writers/CSharp/CSDeclarationWriter.Namespaces.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/PortingHelpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Mappings/MemberMapping.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/TypesOnlyMappingDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IncludeAllFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IMappingDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/IDifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/ICciFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/DifferenceFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Filters/AttributesFilter.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/AssemblyIdentityHelpers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/ApiKind.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Extensions/AccessorType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/IElementDifferenceFactory.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/IDiffingService.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/ExportDifferenceRuleAttribute.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Differs/DifferenceType.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/TypeDefinitionComparer.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/ICciComparers.cs | Convert to file-scoped namespace. |
| src/Microsoft.Cci.Extensions/Comparers/AttributeComparer.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Test.Common/StubTask.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/RequestResponseHelper.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/PackageArchiveReaderFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/MSBuildTaskBase.Desktop.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/IPackageArchiveReaderFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/INupkgInfoFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/IHelpers.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/ICommandFactory.cs | Convert to file-scoped namespace. |
| src/Common/Microsoft.Arcade.Common/ICommand.cs | Convert to file-scoped namespace. |
| src/Common/Internal/DisposeAction.cs | Convert to file-scoped namespace. |
| src/Common/Internal/BuildTask.Desktop.cs | Convert to file-scoped namespace. |
| .editorconfig | Enforce file-scoped namespaces and make IDE0161 an error for *.cs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
akoeplinger
approved these changes
Sep 7, 2026
premun
approved these changes
Sep 7, 2026
ViktorHofer
enabled auto-merge (squash)
September 7, 2026 13:51
This was referenced Sep 8, 2026
1 task
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.
Backport of #17470 to
release/10.0.What
Converts all block-scoped namespace declarations to file-scoped ones and enables
IDE0161as an error in.editorconfigso the convention stays enforced.No functional changes.
How this was produced
This is not a cherry-pick — the migration touches ~1000 files and would have conflicted with essentially every one of them. Instead:
main, the already-reviewed migrated content from Migrate all source files to file-scoped namespaces #17470 was taken verbatim. (635 files)namespace X { ... }->namespace X;plus a 4-space dedent of the body. Column-0 preprocessor directives and multi-line string literal content are left untouched, matching whatmaindid. (368 files)Notes
StaticReflectionConstants.csdeclared two namespaces, so theSystem.Diagnostics.CodeAnalysisone was extracted intoDynamicallyAccessedMembersAttribute.csand registered in the shared.projitems— mirroring what Migrate all source files to file-scoped namespaces #17470 did onmain.src/Microsoft.DotNet.XUnitAssertis vendored xunit source that carries an explicit#pragma warning disable IDE0161. It is intentionally left untouched.ServiceClient.hbhas unrelated differences frommain, so the namespace transform was applied to this branch's version rather than copyingmain's.Validation
Build.cmd -configuration Release-> Build succeeded, 0 warnings, 0 errors. SinceIDE0161is now an error, a clean build proves every compiled source uses file-scoped namespaces.release/10.0was audited: the only non-whitespace changes are the namespace declarations themselves, the.editorconfigblock, the.projitemsentry, and theStaticReflectionConstants.cssplit.