Cleanup style: unused usings and file-scoped namespaces - #53491
Merged
Merged
Conversation
Member
Author
|
@DustinCampbell ptal |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR standardizes style across dotnet-watch (and related test utilities) by removing unused using directives and converting many C# files to file-scoped namespaces, reducing indentation and improving consistency.
Changes:
- Removed unused
usingdirectives across watch, middleware, Hot Reload, and test projects. - Converted many files from block-scoped to file-scoped namespaces and flattened type nesting/indentation.
- Updated
sdk.slnxorganization to placedotnet-formatunder a dedicated/src/Dotnet.Format/folder.
Reviewed changes
Copilot reviewed 89 out of 89 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/dotnet-watch.Tests/Web/RSATests.cs | Removes unused using directives. |
| test/dotnet-watch.Tests/Watch/NoRestoreTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/Watch/GlobbingAppTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/Watch/FileUpdateTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/Watch/BuildEvaluatorTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/TestUtilities/TestReporter.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/TestUtilities/TestConsole.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/TestUtilities/TaskExtensions.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/TestUtilities/DotNetWatchTestBase.cs | Removes unused using directives. |
| test/dotnet-watch.Tests/HotReload/TerminationTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/HotReload/SourceFileUpdateTests.HotReloadNotSupported.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/HotReload/MetadataUpdateHandlerTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/HotReload/MauiHotReloadTests.cs | Converts to file-scoped namespace; removes unused using. |
| test/dotnet-watch.Tests/HotReload/LoggingTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/HotReload/BuildProjectsTests.cs | Removes unused using directives. |
| test/dotnet-watch.Tests/ConsoleReporterTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/CommandLine/SubcommandTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.HostArguments.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/CommandLine/ProgramTests.Arguments.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| test/dotnet-watch.Tests/CommandLine/LaunchSettingsTests.cs | Converts to file-scoped namespace; removes unused using. |
| test/dotnet-watch-test-browser/Program.cs | Removes unused using directives. |
| src/Dotnet.Watch/dotnet-watch/Watch/StaticFileHandler.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/dotnet-watch/Watch/MsBuildFileSetFactory.cs | Converts to file-scoped namespace; removes unused using directives; formatting cleanup. |
| src/Dotnet.Watch/dotnet-watch/Watch/MSBuildFileSetResult.cs | Converts to file-scoped namespace; flattens nested types into top-level internal types. |
| src/Dotnet.Watch/dotnet-watch/Watch/DotNetWatcher.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/dotnet-watch/Watch/BuildEvaluator.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Web.Middleware/ResponseStreamWrapper.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Web.Middleware/HostingStartup.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Web.Middleware/BrowserScriptMiddleware.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Web.Middleware/BlazorWasmHotReloadMiddleware.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Web.Middleware/ApplicationPaths.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Utilities/ProcessUtilities.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/UI/TargetFrameworkSelectionPrompt.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/UI/RestartPrompt.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/UI/PhysicalConsole.cs | Converts to file-scoped namespace; removes unused using directives; formatting cleanup. |
| src/Dotnet.Watch/Watch/UI/IConsole.cs | Removes outdated infrastructure comment. |
| src/Dotnet.Watch/Watch/UI/ConsoleReporter.cs | Converts to file-scoped namespace; removes outdated infrastructure comment; formatting cleanup. |
| src/Dotnet.Watch/Watch/UI/ConsoleInputReader.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Process/RunningProject.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Process/ProjectLauncher.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/Process/ProcessSpec.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Process/ProcessLaunchResult.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Process/LaunchSettingsProfile.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Process/IRuntimeProcessLauncherFactory.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/HotReload/HotReloadProjectUpdatesBuilder.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/FileWatcher/PollingDirectoryWatcher.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/FileWatcher/EventBasedDirectoryWatcher.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Context/EnvironmentOptions.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Context/DotNetWatchContext.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Build/ProjectGraphUtilities.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/Build/LoadedProjectGraph.cs | Converts to file-scoped namespace; removes unused using directives; formatting cleanup. |
| src/Dotnet.Watch/Watch/Build/FileItem.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/Watch/Browser/BrowserRefreshServerFactory.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch/Browser/BrowserLauncher.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch.Aspire/Server/WatchStatusEvent.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch.Aspire/Server/WatchControlReader.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch.Aspire/Program.cs | Removes unused using directives. |
| src/Dotnet.Watch/Watch.Aspire/Host/AspireHostLauncher.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/Web/WebAssemblyHotReloadClient.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/HotReloadClient/Web/StaticWebAsset.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/Web/AbstractBrowserRefreshServer.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/Utilities/ResponseFunc.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/Utilities/PathExtensions.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/Logging/LogEvents.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadClient/HotReloadClients.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadAgent/MetadataUpdateHandlerInvoker.cs | Removes unused using directives. |
| src/Dotnet.Watch/HotReloadAgent.WebAssembly.Browser/WebAssemblyHotReload.cs | Removes unused using directives. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/RequiredMemberAttribute.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/IsExternalInit.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/DotNetWatchTasks/Utilities/CompilerFeatureRequiredAttribute.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| src/Dotnet.Watch/DotNetWatchTasks/FileSetSerializer.cs | Converts to file-scoped namespace; formatting/indentation cleanup. |
| sdk.slnx | Reorganizes solution folder structure to place dotnet-format under /src/Dotnet.Format/. |
Member
Author
|
@copilot open a new pull request to apply changes based on the comments in this thread |
Member
Author
JoeRobich
approved these changes
Mar 18, 2026
MichaelSimons
approved these changes
Mar 18, 2026
DustinCampbell
approved these changes
Mar 18, 2026
This was referenced Mar 18, 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.
No description provided.