Browse Source

Fixup whitespace issues from top-level statement change (#39161)

* Fixup whitespace issues from top-level statement change

The top-level statement codefix resulted in the formatting within
nested lambdas to be incorrect in a number of places. As a part of this change,
I enabled the styling diagnostic and re-ran the tool to correct these issues.
Pranav K 4 years ago
parent
commit
c65dac77cf
100 changed files with 658 additions and 729 deletions
  1. 5 0
      .editorconfig
  2. 6 6
      src/Analyzers/Analyzers/src/MiddlewareAnalyzer.cs
  3. 6 6
      src/Analyzers/Analyzers/src/ServicesAnalyzer.cs
  4. 15 15
      src/Analyzers/Analyzers/src/StartupAnalyzer.cs
  5. 1 1
      src/Azure/AzureAD/Authentication.AzureAD.UI/src/Properties/AssemblyInfo.cs
  6. 1 1
      src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Properties/AssemblyInfo.cs
  7. 2 2
      src/Azure/AzureAD/test/FunctionalTests/WebAuthenticationTests.cs
  8. 0 59
      src/Caching/StackExchangeRedis/test/Infrastructure/RedisXunitTestExecutor.cs
  9. 0 20
      src/Caching/StackExchangeRedis/test/Infrastructure/RedisXunitTestFramework.cs
  10. 19 19
      src/Components/Analyzers/src/ComponentParameterAnalyzer.cs
  11. 23 23
      src/Components/Analyzers/src/ComponentParameterUsageAnalyzer.cs
  12. 1 1
      src/Components/Analyzers/test/Microsoft.AspNetCore.Components.Analyzers.Tests.csproj
  13. 4 4
      src/Components/Authorization/test/AuthorizeRouteViewTest.cs
  14. 1 1
      src/Components/Components/perf/AssemblyInfo.cs
  15. 26 26
      src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs
  16. 1 1
      src/Components/Components/src/RenderTree/RenderTreeEditType.cs
  17. 1 1
      src/Components/Components/src/RenderTree/RenderTreeFrameType.cs
  18. 7 7
      src/Components/Components/test/CascadingParameterTest.cs
  19. 43 43
      src/Components/Components/test/LayoutViewTest.cs
  20. 48 48
      src/Components/Components/test/RendererTest.cs
  21. 2 2
      src/Components/Components/test/Rendering/RendererSynchronizationContextTest.cs
  22. 2 2
      src/Components/Components/test/RouteViewTest.cs
  23. 2 2
      src/Components/Ignitor/src/CancellableOperation.cs
  24. 25 25
      src/Components/Server/src/Circuits/CircuitHost.cs
  25. 3 3
      src/Components/Server/src/Circuits/CircuitRegistry.cs
  26. 2 2
      src/Components/Server/src/Circuits/RemoteJSRuntime.cs
  27. 3 3
      src/Components/Server/src/Circuits/RemoteRenderer.cs
  28. 4 4
      src/Components/Server/test/Circuits/RemoteJSDataStreamTest.cs
  29. 1 1
      src/Components/Web/src/Forms/InputDate.cs
  30. 2 2
      src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Server/Startup.cs
  31. 18 18
      src/Components/WebAssembly/Server/src/ComponentsWebAssemblyApplicationBuilderExtensions.cs
  32. 8 8
      src/Components/WebAssembly/Server/src/DebugProxyLauncher.cs
  33. 5 5
      src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHost.cs
  34. 6 6
      src/Components/WebAssembly/WebAssembly/src/Services/DefaultWebAssemblyJSRuntime.cs
  35. 3 3
      src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs
  36. 5 5
      src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs
  37. 3 3
      src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Program.cs
  38. 6 6
      src/Components/WebView/Samples/PhotinoPlatform/src/PhotinoWebViewManager.cs
  39. 4 4
      src/Components/WebView/WebView/src/WebViewManager.cs
  40. 2 2
      src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs
  41. 1 1
      src/Components/test/E2ETest/AssemblyInfo.cs
  42. 1 1
      src/Components/test/E2ETest/Tests/ErrorBoundaryTest.cs
  43. 2 2
      src/Components/test/E2ETest/Tests/InputFileTest.cs
  44. 2 2
      src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingDisposeComponent.cs
  45. 2 2
      src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingOnAfterRenderAsyncComponent.cs
  46. 2 2
      src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingOnAfterRenderSyncComponent.cs
  47. 2 2
      src/Components/test/testassets/TestServer/ClientStartup.cs
  48. 9 9
      src/Components/test/testassets/TestServer/CorsStartup.cs
  49. 4 4
      src/Components/test/testassets/TestServer/InternationalizationStartup.cs
  50. 3 3
      src/Components/test/testassets/TestServer/Program.cs
  51. 1 1
      src/Components/test/testassets/TestServer/ServerStartup.cs
  52. 2 2
      src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs
  53. 2 2
      src/Configuration.KeyPerFile/src/KeyPerFileConfigurationBuilderExtensions.cs
  54. 11 11
      src/DataProtection/Cryptography.Internal/src/CryptoUtil.cs
  55. 1 1
      src/DataProtection/Cryptography.Internal/src/SafeHandles/SafeLibraryHandle.cs
  56. 2 2
      src/DataProtection/Cryptography.Internal/src/SafeHandles/SecureLocalAllocHandle.cs
  57. 9 9
      src/DataProtection/Cryptography.Internal/src/UnsafeBufferUtil.cs
  58. 3 3
      src/DataProtection/Cryptography.Internal/src/UnsafeNativeMethods.cs
  59. 2 2
      src/DataProtection/Cryptography.Internal/test/WeakReferenceHelpersTests.cs
  60. 1 1
      src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs
  61. 4 4
      src/DataProtection/DataProtection/src/Cng/DpapiSecretSerializerHelper.cs
  62. 2 2
      src/DataProtection/DataProtection/src/DataProtectionServiceCollectionExtensions.cs
  63. 6 6
      src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs
  64. 1 1
      src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs
  65. 1 1
      src/DataProtection/DataProtection/src/Managed/ManagedGenRandomImpl.cs
  66. 8 8
      src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs
  67. 2 2
      src/DataProtection/DataProtection/test/Internal/KeyManagementOptionsSetupTest.cs
  68. 3 3
      src/DataProtection/DataProtection/test/KeyManagement/KeyRingBasedDataProtectorTests.cs
  69. 2 2
      src/DataProtection/DataProtection/test/KeyManagement/KeyRingProviderTests.cs
  70. 4 4
      src/DataProtection/DataProtection/test/MockExtensions.cs
  71. 2 2
      src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs
  72. 42 42
      src/DataProtection/DataProtection/test/Repositories/FileSystemXmlRepositoryTests.cs
  73. 40 40
      src/DataProtection/DataProtection/test/Repositories/RegistryXmlRepositoryTests.cs
  74. 2 2
      src/DataProtection/DataProtection/test/XmlEncryption/CertificateXmlEncryptionTests.cs
  75. 40 40
      src/DataProtection/Extensions/test/DataProtectionProviderTests.cs
  76. 1 1
      src/DataProtection/Extensions/test/Properties/AssemblyInfo.cs
  77. 2 2
      src/DataProtection/StackExchangeRedis/src/RedisDataProtectionBuilderExtensions.cs
  78. 1 1
      src/DataProtection/StackExchangeRedis/test/TestRedisServer.cs
  79. 1 1
      src/DataProtection/StackExchangeRedis/test/TestRedisServerIsAvailableAttribute.cs
  80. 3 3
      src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs
  81. 32 32
      src/DefaultBuilder/src/WebApplicationBuilder.cs
  82. 9 9
      src/DefaultBuilder/src/WebHost.cs
  83. 10 10
      src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs
  84. 16 16
      src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs
  85. 2 2
      src/DefaultBuilder/testassets/DependencyInjectionApp/Program.cs
  86. 2 2
      src/Features/JsonPatch/src/Adapters/AdapterFactory.cs
  87. 2 2
      src/Features/JsonPatch/src/Adapters/IAdapterFactory.cs
  88. 1 1
      src/Features/JsonPatch/src/Internal/ParsedPath.cs
  89. 1 1
      src/Features/JsonPatch/src/Internal/PathHelpers.cs
  90. 1 1
      src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs
  91. 3 3
      src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMismatchedParameterOptionality.cs
  92. 1 1
      src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs
  93. 4 4
      src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DetectMismatchedParameterOptionalityTest.cs
  94. 6 3
      src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DetectMisplacedLambdaAttributeTest.cs
  95. 7 7
      src/Framework/test/SharedFxTests.cs
  96. 2 2
      src/Framework/test/TargetingPackTests.cs
  97. 2 2
      src/Grpc/test/testassets/InteropClient/InteropClient.cs
  98. 5 5
      src/Grpc/test/testassets/InteropWebsite/Program.cs
  99. 4 4
      src/HealthChecks/HealthChecks/test/DefaultHealthCheckServiceTest.cs
  100. 3 3
      src/Hosting/Abstractions/src/HostingAbstractionsWebHostBuilderExtensions.cs

+ 5 - 0
.editorconfig

@@ -207,6 +207,9 @@ dotnet_diagnostic.IDE0043.severity = warning
 # IDE0044: Make field readonly
 dotnet_diagnostic.IDE0044.severity = warning
 
+# IDE0055: All formatting rules
+dotnet_diagnostic.IDE0055.severity = warning
+
 # IDE0073: File header
 dotnet_diagnostic.IDE0073.severity = warning
 file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.
@@ -260,5 +263,7 @@ dotnet_diagnostic.CA2016.severity = suggestion
 # Defaults for content in the shared src/ and shared runtime dir
 
 [{**/Shared/runtime/**.{cs,vb},src/Shared/test/Shared.Tests/runtime/**.{cs,vb},**/microsoft.extensions.hostfactoryresolver.sources/**.{cs,vb}}]
+# IDE0055: Fix formatting
+dotnet_diagnostic.IDE0055.severity = silent
 # IDE0161: Convert to file-scoped namespace
 dotnet_diagnostic.IDE0161.severity = silent

+ 6 - 6
src/Analyzers/Analyzers/src/MiddlewareAnalyzer.cs

@@ -28,12 +28,12 @@ internal class MiddlewareAnalyzer
         // This can currently be confused by things like Map(...)
         context.RegisterOperationAction(context =>
         {
-                // We're looking for usage of extension methods, so we need to look at the 'this' parameter
-                // rather than invocation.Instance.
-                if (context.Operation is IInvocationOperation invocation &&
-                invocation.Instance == null &&
-                invocation.Arguments.Length >= 1 &&
-                SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IApplicationBuilder))
+            // We're looking for usage of extension methods, so we need to look at the 'this' parameter
+            // rather than invocation.Instance.
+            if (context.Operation is IInvocationOperation invocation &&
+            invocation.Instance == null &&
+            invocation.Arguments.Length >= 1 &&
+            SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IApplicationBuilder))
             {
                 middleware.Add(new MiddlewareItem(invocation));
             }

+ 6 - 6
src/Analyzers/Analyzers/src/ServicesAnalyzer.cs

@@ -23,12 +23,12 @@ internal class ServicesAnalyzer
         var services = ImmutableArray.CreateBuilder<ServicesItem>();
         context.RegisterOperationAction(context =>
         {
-                // We're looking for usage of extension methods, so we need to look at the 'this' parameter
-                // rather than invocation.Instance.
-                if (context.Operation is IInvocationOperation invocation &&
-                invocation.Instance == null &&
-                invocation.Arguments.Length >= 1 &&
-                SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IServiceCollection))
+            // We're looking for usage of extension methods, so we need to look at the 'this' parameter
+            // rather than invocation.Instance.
+            if (context.Operation is IInvocationOperation invocation &&
+            invocation.Instance == null &&
+            invocation.Arguments.Length >= 1 &&
+            SymbolEqualityComparer.Default.Equals(invocation.Arguments[0].Parameter?.Type, _context.StartupSymbols.IServiceCollection))
             {
                 services.Add(new ServicesItem(invocation));
             }

+ 15 - 15
src/Analyzers/Analyzers/src/StartupAnalyzer.cs

@@ -43,13 +43,13 @@ public partial class StartupAnalyzer : DiagnosticAnalyzer
             var type = (INamedTypeSymbol)context.Symbol;
             if (!StartupFacts.IsStartupClass(symbols, type) && !SymbolEqualityComparer.Default.Equals(entryPoint?.ContainingType, type))
             {
-                    // Not a startup class, nothing to do.
-                    return;
+                // Not a startup class, nothing to do.
+                return;
             }
 
-                // This analyzer fans out a bunch of jobs. The context will capture the results of doing analysis
-                // on the startup code, so that other analyzers that run later can examine them.
-                var builder = new StartupAnalysisBuilder(this, symbols);
+            // This analyzer fans out a bunch of jobs. The context will capture the results of doing analysis
+            // on the startup code, so that other analyzers that run later can examine them.
+            var builder = new StartupAnalysisBuilder(this, symbols);
 
             var services = new ServicesAnalyzer(builder);
             var options = new OptionsAnalyzer(builder);
@@ -69,8 +69,8 @@ public partial class StartupAnalyzer : DiagnosticAnalyzer
                     OnConfigureServicesMethodFound(method);
                 }
 
-                    // In the future we can consider looking at more methods, but for now limit to Main, implicit Main, and Configure* methods
-                    var isMain = SymbolEqualityComparer.Default.Equals(entryPoint, context.OwningSymbol);
+                // In the future we can consider looking at more methods, but for now limit to Main, implicit Main, and Configure* methods
+                var isMain = SymbolEqualityComparer.Default.Equals(entryPoint, context.OwningSymbol);
 
                 if (isConfigureServices || isMain)
                 {
@@ -89,14 +89,14 @@ public partial class StartupAnalyzer : DiagnosticAnalyzer
                 }
             });
 
-                // Run after analyses have had a chance to finish to add diagnostics.
-                context.RegisterSymbolEndAction(context =>
-            {
-                var analysis = builder.Build();
-                new UseMvcAnalyzer(analysis).AnalyzeSymbol(context);
-                new BuildServiceProviderAnalyzer(analysis).AnalyzeSymbol(context);
-                new UseAuthorizationAnalyzer(analysis).AnalyzeSymbol(context);
-            });
+            // Run after analyses have had a chance to finish to add diagnostics.
+            context.RegisterSymbolEndAction(context =>
+        {
+            var analysis = builder.Build();
+            new UseMvcAnalyzer(analysis).AnalyzeSymbol(context);
+            new BuildServiceProviderAnalyzer(analysis).AnalyzeSymbol(context);
+            new UseAuthorizationAnalyzer(analysis).AnalyzeSymbol(context);
+        });
 
         }, SymbolKind.NamedType);
     }

+ 1 - 1
src/Azure/AzureAD/Authentication.AzureAD.UI/src/Properties/AssemblyInfo.cs

@@ -3,4 +3,4 @@
 
 using System.Runtime.CompilerServices;
 
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureAD.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureAD.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

+ 1 - 1
src/Azure/AzureAD/Authentication.AzureADB2C.UI/src/Properties/AssemblyInfo.cs

@@ -3,4 +3,4 @@
 
 using System.Runtime.CompilerServices;
 
-[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
+[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Authentication.AzureADB2C.UI.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]

+ 2 - 2
src/Azure/AzureAD/test/FunctionalTests/WebAuthenticationTests.cs

@@ -183,8 +183,8 @@ public class WebAuthenticationTests : IClassFixture<WebApplicationFactory<Startu
                         AuthorizationEndpoint = "https://www.example.com/authorize",
                         EndSessionEndpoint = "https://www.example.com/logout"
                     };
-                        // CookieContainer doesn't allow cookies from other paths
-                        o.CorrelationCookie.Path = "/";
+                    // CookieContainer doesn't allow cookies from other paths
+                    o.CorrelationCookie.Path = "/";
                     o.NonceCookie.Path = "/";
                 });
 

+ 0 - 59
src/Caching/StackExchangeRedis/test/Infrastructure/RedisXunitTestExecutor.cs

@@ -1,59 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-//using System;
-//using System.Reflection;
-//using Xunit.Abstractions;
-//using Xunit.Sdk;
-
-//namespace Microsoft.Extensions.Caching.StackExchangeRedis
-//{
-    // TODO - should replace this whole approach with a CollectionFixture when
-    // Xunit CollectionFixtures are working correctly.
-    //public class RedisXunitTestExecutor : XunitTestFrameworkExecutor, IDisposable
-    //{
-    //    private bool _isDisposed;
-
-    //    public RedisXunitTestExecutor(
-    //        AssemblyName assemblyName, ISourceInformationProvider sourceInformationProvider)
-    //        : base(assemblyName, sourceInformationProvider)
-    //    {
-    //        try
-    //        {
-    //            RedisTestConfig.GetOrStartServer();
-    //        }
-    //        catch (Exception)
-    //        {
-    //            // do not let exceptions starting server prevent XunitTestFrameworkExecutor from being created
-    //        }
-    //    }
-
-    //    ~RedisXunitTestExecutor()
-    //    {
-    //        Dispose(false);
-    //    }
-
-    //    void IDisposable.Dispose()
-    //    {
-    //        Dispose(true);
-    //        GC.SuppressFinalize(this);
-    //    }
-
-    //    protected virtual void Dispose(bool disposing)
-    //    {
-    //        if (!_isDisposed)
-    //        {
-    //            try
-    //            {
-    //                RedisTestConfig.StopRedisServer();
-    //            }
-    //            catch (Exception)
-    //            {
-    //                // do not let exceptions stopping server prevent XunitTestFrameworkExecutor from being disposed
-    //            }
-
-    //            _isDisposed = true;
-    //        }
-    //    }
-    //}
-//}

+ 0 - 20
src/Caching/StackExchangeRedis/test/Infrastructure/RedisXunitTestFramework.cs

@@ -1,20 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-//using System.Reflection;
-//using Xunit;
-//using Xunit.Abstractions;
-//using Xunit.Sdk;
-
-// TODO: Disabled due to CI failures. [assembly: TestFramework("Microsoft.Extensions.Cache.Redis.RedisXunitTestFramework", "Microsoft.Extensions.Cache.StackExchangeRedis.Tests")]
-
-//namespace Microsoft.Extensions.Caching.StackExchangeRedis
-//{
-//    public class RedisXunitTestFramework : XunitTestFramework
-//    {
-//        protected override ITestFrameworkExecutor CreateExecutor(AssemblyName assemblyName)
-//        {
-//            return new RedisXunitTestExecutor(assemblyName, SourceInformationProvider);
-//        }
-//    }
-//}

+ 19 - 19
src/Components/Analyzers/src/ComponentParameterAnalyzer.cs

@@ -18,11 +18,11 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
     {
         SupportedDiagnostics = ImmutableArray.Create(new[]
         {
-                DiagnosticDescriptors.ComponentParametersShouldBePublic,
-                DiagnosticDescriptors.ComponentParameterSettersShouldBePublic,
-                DiagnosticDescriptors.ComponentParameterCaptureUnmatchedValuesMustBeUnique,
-                DiagnosticDescriptors.ComponentParameterCaptureUnmatchedValuesHasWrongType,
-            });
+            DiagnosticDescriptors.ComponentParametersShouldBePublic,
+            DiagnosticDescriptors.ComponentParameterSettersShouldBePublic,
+            DiagnosticDescriptors.ComponentParameterCaptureUnmatchedValuesMustBeUnique,
+            DiagnosticDescriptors.ComponentParameterCaptureUnmatchedValuesHasWrongType,
+        });
     }
 
     public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get; }
@@ -35,13 +35,13 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
         {
             if (!ComponentSymbols.TryCreate(context.Compilation, out var symbols))
             {
-                    // Types we need are not defined.
-                    return;
+                // Types we need are not defined.
+                return;
             }
 
-                // This operates per-type because one of the validations we need has to look for duplicates
-                // defined on the same type.
-                context.RegisterSymbolStartAction(context =>
+            // This operates per-type because one of the validations we need has to look for duplicates
+            // defined on the same type.
+            context.RegisterSymbolStartAction(context =>
             {
                 var properties = new List<IPropertySymbol>();
 
@@ -50,8 +50,8 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
                 {
                     if (member is IPropertySymbol property && ComponentFacts.IsParameter(symbols, property))
                     {
-                            // Annotated with [Parameter]. We ignore [CascadingParameter]'s because they don't interact with tooling and don't currently have any analyzer restrictions.
-                            properties.Add(property);
+                        // Annotated with [Parameter]. We ignore [CascadingParameter]'s because they don't interact with tooling and don't currently have any analyzer restrictions.
+                        properties.Add(property);
                     }
                 }
 
@@ -64,8 +64,8 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
                 {
                     var captureUnmatchedValuesParameters = new List<IPropertySymbol>();
 
-                        // Per-property validations
-                        foreach (var property in properties)
+                    // Per-property validations
+                    foreach (var property in properties)
                     {
                         var propertyLocation = property.Locations.FirstOrDefault();
                         if (propertyLocation == null)
@@ -92,8 +92,8 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
                         {
                             captureUnmatchedValuesParameters.Add(property);
 
-                                // Check the type, we need to be able to assign a Dictionary<string, object>
-                                var conversion = context.Compilation.ClassifyConversion(symbols.ParameterCaptureUnmatchedValuesRuntimeType, property.Type);
+                            // Check the type, we need to be able to assign a Dictionary<string, object>
+                            var conversion = context.Compilation.ClassifyConversion(symbols.ParameterCaptureUnmatchedValuesRuntimeType, property.Type);
                             if (!conversion.Exists || conversion.IsExplicit)
                             {
                                 context.ReportDiagnostic(Diagnostic.Create(
@@ -106,9 +106,9 @@ public class ComponentParameterAnalyzer : DiagnosticAnalyzer
                         }
                     }
 
-                        // Check if the type defines multiple CaptureUnmatchedValues parameters. Doing this outside the loop means we place the
-                        // errors on the type.
-                        if (captureUnmatchedValuesParameters.Count > 1)
+                    // Check if the type defines multiple CaptureUnmatchedValues parameters. Doing this outside the loop means we place the
+                    // errors on the type.
+                    if (captureUnmatchedValuesParameters.Count > 1)
                     {
                         context.ReportDiagnostic(Diagnostic.Create(
                             DiagnosticDescriptors.ComponentParameterCaptureUnmatchedValuesMustBeUnique,

+ 23 - 23
src/Components/Analyzers/src/ComponentParameterUsageAnalyzer.cs

@@ -31,8 +31,8 @@ public class ComponentParameterUsageAnalyzer : DiagnosticAnalyzer
         {
             if (!ComponentSymbols.TryCreate(context.Compilation, out var symbols))
             {
-                    // Types we need are not defined.
-                    return;
+                // Types we need are not defined.
+                return;
             }
 
             context.RegisterOperationBlockStartAction(startBlockContext =>
@@ -53,15 +53,15 @@ public class ComponentParameterUsageAnalyzer : DiagnosticAnalyzer
 
                     if (leftHandSide == null)
                     {
-                            // Malformed assignment, no left hand side.
-                            return;
+                        // Malformed assignment, no left hand side.
+                        return;
                     }
 
                     if (leftHandSide.Kind != OperationKind.PropertyReference)
                     {
-                            // We don't want to capture situations where a user does
-                            // MyOtherProperty = aComponent.SomeParameter
-                            return;
+                        // We don't want to capture situations where a user does
+                        // MyOtherProperty = aComponent.SomeParameter
+                        return;
                     }
 
                     var propertyReference = (IPropertyReferenceOperation)leftHandSide;
@@ -69,44 +69,44 @@ public class ComponentParameterUsageAnalyzer : DiagnosticAnalyzer
 
                     if (!ComponentFacts.IsParameter(symbols, componentProperty))
                     {
-                            // This is not a property reference that we care about, it is not decorated with [Parameter].
-                            return;
+                        // This is not a property reference that we care about, it is not decorated with [Parameter].
+                        return;
                     }
 
                     var propertyContainingType = componentProperty.ContainingType;
                     if (!ComponentFacts.IsComponent(symbols, context.Compilation, propertyContainingType))
                     {
-                            // Someone referenced a property as [Parameter] inside something that is not a component.
-                            return;
+                        // Someone referenced a property as [Parameter] inside something that is not a component.
+                        return;
                     }
 
                     var assignmentContainingType = startBlockContext.OwningSymbol?.ContainingType;
                     if (assignmentContainingType == null)
                     {
-                            // Assignment location has no containing type. Most likely we're operating on malformed code, don't try and validate.
-                            return;
+                        // Assignment location has no containing type. Most likely we're operating on malformed code, don't try and validate.
+                        return;
                     }
 
                     var conversion = context.Compilation.ClassifyConversion(propertyContainingType, assignmentContainingType);
                     if (conversion.Exists && conversion.IsIdentity)
                     {
-                            // The assignment is taking place inside of the declaring component.
-                            return;
+                        // The assignment is taking place inside of the declaring component.
+                        return;
                     }
 
                     if (conversion.Exists && conversion.IsExplicit)
                     {
-                            // The assignment is taking place within the components type hierarchy. This means the user is setting this in a supported
-                            // scenario.
-                            return;
+                        // The assignment is taking place within the components type hierarchy. This means the user is setting this in a supported
+                        // scenario.
+                        return;
                     }
 
-                        // At this point the user is referencing a component parameter outside of its declaring class.
+                    // At this point the user is referencing a component parameter outside of its declaring class.
 
-                        context.ReportDiagnostic(Diagnostic.Create(
-                        DiagnosticDescriptors.ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent,
-                        propertyReference.Syntax.GetLocation(),
-                        propertyReference.Member.Name));
+                    context.ReportDiagnostic(Diagnostic.Create(
+                    DiagnosticDescriptors.ComponentParametersShouldNotBeSetOutsideOfTheirDeclaredComponent,
+                    propertyReference.Syntax.GetLocation(),
+                    propertyReference.Member.Name));
                 }, OperationKind.SimpleAssignment, OperationKind.CompoundAssignment, OperationKind.CoalesceAssignment, OperationKind.Increment, OperationKind.Decrement);
             });
         });

+ 1 - 1
src/Components/Analyzers/test/Microsoft.AspNetCore.Components.Analyzers.Tests.csproj

@@ -4,7 +4,7 @@
     <TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
     <PreserveCompilationContext>true</PreserveCompilationContext>
     <BaseOutputPath />
-    <NoWarn>$(NoWarn);IDE0161</NoWarn>
+    <NoWarn>$(NoWarn);IDE0055;IDE0161</NoWarn>
   </PropertyGroup>
 
   <ItemGroup>

+ 4 - 4
src/Components/Authorization/test/AuthorizeRouteViewTest.cs

@@ -356,15 +356,15 @@ public class AuthorizeRouteViewTest
         Assert.Collection(diff.Edits,
             edit =>
             {
-                    // Inside the layout, we add the new content
-                    Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
+                // Inside the layout, we add the new content
+                Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
                 Assert.Equal(1, edit.SiblingIndex);
                 AssertFrame.Text(batch2.ReferenceFrames[edit.ReferenceFrameIndex], "Not authorized");
             },
             edit =>
             {
-                    // ... and remove the old content
-                    Assert.Equal(RenderTreeEditType.RemoveFrame, edit.Type);
+                // ... and remove the old content
+                Assert.Equal(RenderTreeEditType.RemoveFrame, edit.Type);
                 Assert.Equal(2, edit.SiblingIndex);
             });
     }

+ 1 - 1
src/Components/Components/perf/AssemblyInfo.cs

@@ -1,4 +1,4 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]
+[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark]

+ 26 - 26
src/Components/Components/src/EventCallbackFactoryBinderExtensions.cs

@@ -699,19 +699,19 @@ public static class EventCallbackFactoryBinderExtensions
             {
             }
 
-                // We only invoke the setter if the conversion didn't throw, or if the newly-entered value is empty.
-                // If the user entered some non-empty value we couldn't parse, we leave the state of the .NET field
-                // unchanged, which for a two-way binding results in the UI reverting to its previous valid state
-                // because the diff will see the current .NET output no longer matches the render tree since we
-                // patched it to reflect the state of the UI.
-                //
-                // This reversion behavior is valuable because alternatives are problematic:
-                // - If we assigned default(T) on failure, the user would lose whatever data they were editing,
-                //   for example if they accidentally pressed an alphabetical key while editing a number with
-                //   @bind:event="oninput"
-                // - If the diff mechanism didn't revert to the previous good value, the user wouldn't necessarily
-                //   know that the data they are submitting is different from what they think they've typed
-                if (converted)
+            // We only invoke the setter if the conversion didn't throw, or if the newly-entered value is empty.
+            // If the user entered some non-empty value we couldn't parse, we leave the state of the .NET field
+            // unchanged, which for a two-way binding results in the UI reverting to its previous valid state
+            // because the diff will see the current .NET output no longer matches the render tree since we
+            // patched it to reflect the state of the UI.
+            //
+            // This reversion behavior is valuable because alternatives are problematic:
+            // - If we assigned default(T) on failure, the user would lose whatever data they were editing,
+            //   for example if they accidentally pressed an alphabetical key while editing a number with
+            //   @bind:event="oninput"
+            // - If the diff mechanism didn't revert to the previous good value, the user wouldn't necessarily
+            //   know that the data they are submitting is different from what they think they've typed
+            if (converted)
             {
                 setter(value!);
             }
@@ -743,19 +743,19 @@ public static class EventCallbackFactoryBinderExtensions
             {
             }
 
-                // We only invoke the setter if the conversion didn't throw, or if the newly-entered value is empty.
-                // If the user entered some non-empty value we couldn't parse, we leave the state of the .NET field
-                // unchanged, which for a two-way binding results in the UI reverting to its previous valid state
-                // because the diff will see the current .NET output no longer matches the render tree since we
-                // patched it to reflect the state of the UI.
-                //
-                // This reversion behavior is valuable because alternatives are problematic:
-                // - If we assigned default(T) on failure, the user would lose whatever data they were editing,
-                //   for example if they accidentally pressed an alphabetical key while editing a number with
-                //   @bind:event="oninput"
-                // - If the diff mechanism didn't revert to the previous good value, the user wouldn't necessarily
-                //   know that the data they are submitting is different from what they think they've typed
-                if (converted)
+            // We only invoke the setter if the conversion didn't throw, or if the newly-entered value is empty.
+            // If the user entered some non-empty value we couldn't parse, we leave the state of the .NET field
+            // unchanged, which for a two-way binding results in the UI reverting to its previous valid state
+            // because the diff will see the current .NET output no longer matches the render tree since we
+            // patched it to reflect the state of the UI.
+            //
+            // This reversion behavior is valuable because alternatives are problematic:
+            // - If we assigned default(T) on failure, the user would lose whatever data they were editing,
+            //   for example if they accidentally pressed an alphabetical key while editing a number with
+            //   @bind:event="oninput"
+            // - If the diff mechanism didn't revert to the previous good value, the user wouldn't necessarily
+            //   know that the data they are submitting is different from what they think they've typed
+            if (converted)
             {
                 setter(value!);
             }

+ 1 - 1
src/Components/Components/src/RenderTree/RenderTreeEditType.cs

@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree;
 /// </summary>
 //
 //Describes the type of a render tree edit operation.
-public enum RenderTreeEditType: int
+public enum RenderTreeEditType : int
 {
     /// <summary>
     /// Indicates that a new frame should be inserted before the specified tree frame.

+ 1 - 1
src/Components/Components/src/RenderTree/RenderTreeFrameType.cs

@@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree;
 /// </summary>
 //
 // Describes the type of a <see cref="RenderTreeFrame"/>.
-public enum RenderTreeFrameType: short
+public enum RenderTreeFrameType : short
 {
     /// <summary>
     /// Used only for uninitialized frames.

+ 7 - 7
src/Components/Components/test/CascadingParameterTest.cs

@@ -93,7 +93,7 @@ public class CascadingParameterTest
             {
                 Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
                 Assert.Equal(0, edit.ReferenceFrameIndex); // This is the only change
-                    AssertFrame.Text(secondBatch.ReferenceFrames[0], "CascadingParameter=Hello; RegularParameter=Changed value");
+                AssertFrame.Text(secondBatch.ReferenceFrames[0], "CascadingParameter=Hello; RegularParameter=Changed value");
             });
         Assert.Equal(2, nestedComponent.NumRenders);
     }
@@ -139,7 +139,7 @@ public class CascadingParameterTest
             {
                 Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
                 Assert.Equal(0, edit.ReferenceFrameIndex); // This is the only change
-                    AssertFrame.Text(secondBatch.ReferenceFrames[0], "CascadingParameter=Updated value; RegularParameter=Goodbye");
+                AssertFrame.Text(secondBatch.ReferenceFrames[0], "CascadingParameter=Updated value; RegularParameter=Goodbye");
             });
         Assert.Equal(2, nestedComponent.NumRenders);
     }
@@ -189,14 +189,14 @@ public class CascadingParameterTest
         var renderer = new TestRenderer();
         var component = new TestComponent(builder =>
         {
-                // At the outer level, have an unrelated fixed cascading value to show we can deal with combining both types
-                builder.OpenComponent<CascadingValue<int>>(0);
+            // At the outer level, have an unrelated fixed cascading value to show we can deal with combining both types
+            builder.OpenComponent<CascadingValue<int>>(0);
             builder.AddAttribute(1, "Value", 123);
             builder.AddAttribute(2, "IsFixed", true);
             builder.AddAttribute(3, "ChildContent", new RenderFragment(builder2 =>
             {
-                    // Then also have a non-fixed cascading value so we can show that unsubscription works
-                    builder2.OpenComponent<CascadingValue<string>>(0);
+                // Then also have a non-fixed cascading value so we can show that unsubscription works
+                builder2.OpenComponent<CascadingValue<string>>(0);
                 builder2.AddAttribute(1, "Value", providedValue);
                 builder2.AddAttribute(2, "ChildContent", new RenderFragment(builder3 =>
                 {
@@ -339,7 +339,7 @@ public class CascadingParameterTest
         {
             builder.OpenComponent<CascadingValue<object>>(0);
             if (isFixed) // Showing also that "unset" is treated as "false"
-                {
+            {
                 builder.AddAttribute(1, "IsFixed", true);
             }
             builder.AddAttribute(2, "Value", new object());

+ 43 - 43
src/Components/Components/test/LayoutViewTest.cs

@@ -188,8 +188,8 @@ public class LayoutViewTest
             diff => Assert.Empty(diff.Edits), // RootLayout rerendered, but with no changes
             diff =>
             {
-                    // NestedLayout rerendered, patching content in place
-                    Assert.Collection(diff.Edits, edit =>
+                // NestedLayout rerendered, patching content in place
+                Assert.Collection(diff.Edits, edit =>
                 {
                     Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
                     Assert.Equal(1, edit.SiblingIndex);
@@ -229,50 +229,50 @@ public class LayoutViewTest
             diff => Assert.Empty(diff.Edits), // LayoutView rerendered, but with no changes
             diff =>
             {
-                    // RootLayout rerendered, changing child
-                    Assert.Collection(diff.Edits,
-                    edit =>
-                    {
-                        Assert.Equal(RenderTreeEditType.RemoveFrame, edit.Type);
-                        Assert.Equal(1, edit.SiblingIndex);
-                    },
-                    edit =>
-                    {
-                        Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
-                        Assert.Equal(1, edit.SiblingIndex);
-                        AssertFrame.Component<OtherNestedLayout>(
-                            batch.ReferenceFrames[edit.ReferenceFrameIndex],
-                            sequence: 0);
-                    });
+                // RootLayout rerendered, changing child
+                Assert.Collection(diff.Edits,
+                edit =>
+                {
+                    Assert.Equal(RenderTreeEditType.RemoveFrame, edit.Type);
+                    Assert.Equal(1, edit.SiblingIndex);
+                },
+                edit =>
+                {
+                    Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
+                    Assert.Equal(1, edit.SiblingIndex);
+                    AssertFrame.Component<OtherNestedLayout>(
+                        batch.ReferenceFrames[edit.ReferenceFrameIndex],
+                        sequence: 0);
+                });
             },
             diff =>
             {
-                    // Inserts new OtherNestedLayout
-                    Assert.Collection(diff.Edits,
-                    edit =>
-                    {
-                        Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
-                        Assert.Equal(0, edit.SiblingIndex);
-                        AssertFrame.Text(
-                            batch.ReferenceFrames[edit.ReferenceFrameIndex],
-                            "OtherNestedLayout starts here");
-                    },
-                    edit =>
-                    {
-                        Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
-                        Assert.Equal(1, edit.SiblingIndex);
-                        AssertFrame.Text(
-                            batch.ReferenceFrames[edit.ReferenceFrameIndex],
-                            "Some content");
-                    },
-                    edit =>
-                    {
-                        Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
-                        Assert.Equal(2, edit.SiblingIndex);
-                        AssertFrame.Text(
-                            batch.ReferenceFrames[edit.ReferenceFrameIndex],
-                            "OtherNestedLayout ends here");
-                    });
+                // Inserts new OtherNestedLayout
+                Assert.Collection(diff.Edits,
+                edit =>
+                {
+                    Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
+                    Assert.Equal(0, edit.SiblingIndex);
+                    AssertFrame.Text(
+                        batch.ReferenceFrames[edit.ReferenceFrameIndex],
+                        "OtherNestedLayout starts here");
+                },
+                edit =>
+                {
+                    Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
+                    Assert.Equal(1, edit.SiblingIndex);
+                    AssertFrame.Text(
+                        batch.ReferenceFrames[edit.ReferenceFrameIndex],
+                        "Some content");
+                },
+                edit =>
+                {
+                    Assert.Equal(RenderTreeEditType.PrependFrame, edit.Type);
+                    Assert.Equal(2, edit.SiblingIndex);
+                    AssertFrame.Text(
+                        batch.ReferenceFrames[edit.ReferenceFrameIndex],
+                        "OtherNestedLayout ends here");
+                });
             });
     }
 

+ 48 - 48
src/Components/Components/test/RendererTest.cs

@@ -370,11 +370,11 @@ public class RendererTest
                 {
                     hasRendered = true;
 
-                        // If we were to await here, then it would deadlock, because the component would be saying it's not
-                        // finished rendering until the rendering system has already finished. The point of this test is to
-                        // show that, as long as we don't await quiescence here, nothing within the system will be doing so
-                        // and hence the whole process can complete.
-                        _ = renderer.RenderRootComponentAsync(componentId.Value, ParameterView.Empty);
+                    // If we were to await here, then it would deadlock, because the component would be saying it's not
+                    // finished rendering until the rendering system has already finished. The point of this test is to
+                    // show that, as long as we don't await quiescence here, nothing within the system will be doing so
+                    // and hence the whole process can complete.
+                    _ = renderer.RenderRootComponentAsync(componentId.Value, ParameterView.Empty);
                 }
             }
         };
@@ -1344,8 +1344,8 @@ public class RendererTest
             builder.OpenComponent<EventComponent>(0);
             builder.AddAttribute(1, nameof(EventComponent.OnClickAction), (Action)(() =>
             {
-                    // Do nothing.
-                }));
+                // Do nothing.
+            }));
             builder.CloseComponent();
         };
 
@@ -1376,8 +1376,8 @@ public class RendererTest
             builder.OpenComponent<EventComponent>(0);
             builder.AddAttribute(1, nameof(EventComponent.OnClickEventCallback), EventCallback.Factory.Create(parentComponent, (Action)(() =>
             {
-                    // Do nothing.
-                })));
+                // Do nothing.
+            })));
             builder.CloseComponent();
         };
 
@@ -2214,8 +2214,8 @@ public class RendererTest
         {
             if (firstRender)
             {
-                    // Nested descendants
-                    builder.OpenComponent<ConditionalParentComponent<FakeComponent>>(100);
+                // Nested descendants
+                builder.OpenComponent<ConditionalParentComponent<FakeComponent>>(100);
                 builder.AddAttribute(101, nameof(ConditionalParentComponent<FakeComponent>.IncludeChild), true);
                 builder.CloseComponent();
             }
@@ -2817,8 +2817,8 @@ public class RendererTest
         Assert.Collection(batch.DiffsInOrder,
             diff =>
             {
-                    // First we triggered the root component to re-render
-                    Assert.Equal(rootComponentId, diff.ComponentId);
+                // First we triggered the root component to re-render
+                Assert.Equal(rootComponentId, diff.ComponentId);
                 Assert.Collection(diff.Edits, edit =>
                 {
                     Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
@@ -2829,8 +2829,8 @@ public class RendererTest
             },
             diff =>
             {
-                    // Then the root re-render will have triggered an update to the child
-                    Assert.Equal(childComponentId, diff.ComponentId);
+                // Then the root re-render will have triggered an update to the child
+                Assert.Equal(childComponentId, diff.ComponentId);
                 Assert.Collection(diff.Edits, edit =>
                 {
                     Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
@@ -2841,8 +2841,8 @@ public class RendererTest
             },
             diff =>
             {
-                    // Finally we explicitly requested a re-render of the child
-                    Assert.Equal(childComponentId, diff.ComponentId);
+                // Finally we explicitly requested a re-render of the child
+                Assert.Equal(childComponentId, diff.ComponentId);
                 Assert.Collection(diff.Edits, edit =>
                 {
                     Assert.Equal(RenderTreeEditType.UpdateText, edit.Type);
@@ -2974,10 +2974,10 @@ public class RendererTest
                 builder.OpenComponent<RendersSelfAfterEventComponent>(1);
                 builder.AddAttribute(2, "onclick", (Action<object>)((object obj) =>
                 {
-                        // First we queue (1) a re-render of the root component, then the child component
-                        // will queue (2) its own re-render. But by the time (1) completes, the child will
-                        // have been disposed, even though (2) is still in the queue
-                        shouldRenderChild = false;
+                    // First we queue (1) a re-render of the root component, then the child component
+                    // will queue (2) its own re-render. But by the time (1) completes, the child will
+                    // have been disposed, even though (2) is still in the queue
+                    shouldRenderChild = false;
                     component.TriggerRender();
                 }));
                 builder.CloseComponent();
@@ -3181,17 +3181,17 @@ public class RendererTest
         var showComponent3 = true;
         var parentComponent = new TestComponent(builder =>
         {
-                // First child will be re-rendered because we'll change its param
-                builder.OpenComponent<AfterRenderCaptureComponent>(0);
+            // First child will be re-rendered because we'll change its param
+            builder.OpenComponent<AfterRenderCaptureComponent>(0);
             builder.AddAttribute(1, "some param", showComponent3);
             builder.CloseComponent();
 
-                // Second child will not be re-rendered because nothing changes
-                builder.OpenComponent<AfterRenderCaptureComponent>(2);
+            // Second child will not be re-rendered because nothing changes
+            builder.OpenComponent<AfterRenderCaptureComponent>(2);
             builder.CloseComponent();
 
-                // Third component will be disposed
-                if (showComponent3)
+            // Third component will be disposed
+            if (showComponent3)
             {
                 builder.OpenComponent<AfterRenderCaptureComponent>(3);
                 builder.CloseComponent();
@@ -3280,9 +3280,9 @@ public class RendererTest
         {
             numEventsFired++;
 
-                // Replace the old event handler with a different one,
-                // (old the old handler ID will be disposed) then re-render.
-                component.OnTest = args => eventHandler(args);
+            // Replace the old event handler with a different one,
+            // (old the old handler ID will be disposed) then re-render.
+            component.OnTest = args => eventHandler(args);
             component.TriggerRender();
         };
 
@@ -4126,10 +4126,10 @@ public class RendererTest
         var batch2 = renderer.Batches[1];
         Assert.Collection(batch2.DiffsInOrder.Single().Edits.ToArray(), edit =>
         {
-                // The only edit is updating the event handler ID, since the test component
-                // deliberately uses a capturing lambda. The whole point of this test is to
-                // show that the diff does *not* update the BoundString value attribute.
-                Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
+            // The only edit is updating the event handler ID, since the test component
+            // deliberately uses a capturing lambda. The whole point of this test is to
+            // show that the diff does *not* update the BoundString value attribute.
+            Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
             var attributeFrame = batch2.ReferenceFrames[edit.ReferenceFrameIndex];
             AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<ChangeEventArgs>));
             Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId);
@@ -4178,10 +4178,10 @@ public class RendererTest
             var latestBatch = renderer.Batches.Last();
             Assert.Collection(latestBatch.DiffsInOrder.Single().Edits.ToArray(), edit =>
             {
-                    // The only edit is updating the event handler ID, since the test component
-                    // deliberately uses a capturing lambda. The whole point of this test is to
-                    // show that the diff does *not* update the BoundString value attribute.
-                    Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
+                // The only edit is updating the event handler ID, since the test component
+                // deliberately uses a capturing lambda. The whole point of this test is to
+                // show that the diff does *not* update the BoundString value attribute.
+                Assert.Equal(RenderTreeEditType.SetAttribute, edit.Type);
                 var attributeFrame = latestBatch.ReferenceFrames[edit.ReferenceFrameIndex];
                 AssertFrame.Attribute(attributeFrame, "ontestevent", typeof(Action<ChangeEventArgs>));
                 Assert.NotEqual(default, attributeFrame.AttributeEventHandlerId);
@@ -4197,11 +4197,11 @@ public class RendererTest
         var renderer = new InvalidRecursiveRenderer();
         var component = new CallbackOnRenderComponent(() =>
         {
-                // The renderer disallows one batch to be started inside another, because that
-                // would violate all kinds of state tracking invariants. It's not something that
-                // would ever happen except if you subclass the renderer and do something unsupported
-                // that commences batches from inside each other.
-                renderer.ProcessPendingRender();
+            // The renderer disallows one batch to be started inside another, because that
+            // would violate all kinds of state tracking invariants. It's not something that
+            // would ever happen except if you subclass the renderer and do something unsupported
+            // that commences batches from inside each other.
+            renderer.ProcessPendingRender();
         });
         var componentId = renderer.AssignRootComponentId(component);
 
@@ -4607,9 +4607,9 @@ public class RendererTest
         {
             renderer.RemoveRootComponent(rootComponentId);
 
-                // Even though we didn't await anything, it's synchronously unavailable for re-removal
-                var ex = Assert.Throws<ArgumentException>(() =>
-                renderer.RemoveRootComponent(rootComponentId));
+            // Even though we didn't await anything, it's synchronously unavailable for re-removal
+            var ex = Assert.Throws<ArgumentException>(() =>
+            renderer.RemoveRootComponent(rootComponentId));
             Assert.Equal($"The renderer does not have a component with ID {rootComponentId}.", ex.Message);
             didRunTestLogic = true;
         });
@@ -5603,8 +5603,8 @@ public class RendererTest
             builder.OpenComponent<TestErrorBoundary>(0);
             builder.AddAttribute(1, nameof(TestErrorBoundary.ChildContent), (RenderFragment)(builder =>
             {
-                    // ... containing another error boundary, containing the content
-                    builder.OpenComponent<TestErrorBoundary>(0);
+                // ... containing another error boundary, containing the content
+                builder.OpenComponent<TestErrorBoundary>(0);
                 builder.AddAttribute(1, nameof(TestErrorBoundary.ChildContent), innerContent);
                 builder.CloseComponent();
             }));

+ 2 - 2
src/Components/Components/test/Rendering/RendererSynchronizationContextTest.cs

@@ -779,8 +779,8 @@ public class RendererSynchronizationContextTest
 
         var invokeTask = context.InvokeAsync(async () =>
         {
-                // When the sync context is idle, queued work items start synchronously
-                actual += " Second";
+            // When the sync context is idle, queued work items start synchronously
+            actual += " Second";
             await Task.Delay(250);
             actual += " Fourth";
         });

+ 2 - 2
src/Components/Components/test/RouteViewTest.cs

@@ -29,8 +29,8 @@ public class RouteViewTest
     {
         var ex = Assert.Throws<InvalidOperationException>(() =>
         {
-                // Throws synchronously, so no need to await
-                _ = _routeViewComponent.SetParametersAsync(ParameterView.Empty);
+            // Throws synchronously, so no need to await
+            _ = _routeViewComponent.SetParametersAsync(ParameterView.Empty);
         });
 
 

+ 2 - 2
src/Components/Ignitor/src/CancellableOperation.cs

@@ -40,8 +40,8 @@ internal class CancellableOperation<TResult>
 
                 if (cancellationToken.IsCancellationRequested)
                 {
-                        // The operation was externally canceled before it timed out.
-                        Dispose();
+                    // The operation was externally canceled before it timed out.
+                    Dispose();
                     return;
                 }
 

+ 25 - 25
src/Components/Server/src/Circuits/CircuitHost.cs

@@ -101,12 +101,12 @@ internal partial class CircuitHost : IAsyncDisposable
             {
                 _initialized = true; // We're ready to accept incoming JSInterop calls from here on
 
-                    await OnCircuitOpenedAsync(cancellationToken);
+                await OnCircuitOpenedAsync(cancellationToken);
                 await OnConnectionUpAsync(cancellationToken);
 
-                    // Here, we add each root component but don't await the returned tasks so that the
-                    // components can be processed in parallel.
-                    var count = Descriptors.Count;
+                // Here, we add each root component but don't await the returned tasks so that the
+                // components can be processed in parallel.
+                var count = Descriptors.Count;
                 var pendingRenders = new Task[count];
                 for (var i = 0; i < count; i++)
                 {
@@ -114,20 +114,20 @@ internal partial class CircuitHost : IAsyncDisposable
                     pendingRenders[i] = Renderer.AddComponentAsync(componentType, parameters, sequence.ToString(CultureInfo.InvariantCulture));
                 }
 
-                    // Now we wait for all components to finish rendering.
-                    await Task.WhenAll(pendingRenders);
+                // Now we wait for all components to finish rendering.
+                await Task.WhenAll(pendingRenders);
 
-                    // At this point all components have successfully produced an initial render and we can clear the contents of the component
-                    // application state store. This ensures the memory that was not used during the initial render of these components gets
-                    // reclaimed since no-one else is holding on to it any longer.
-                    store.ExistingState.Clear();
+                // At this point all components have successfully produced an initial render and we can clear the contents of the component
+                // application state store. This ensures the memory that was not used during the initial render of these components gets
+                // reclaimed since no-one else is holding on to it any longer.
+                store.ExistingState.Clear();
 
                 Log.InitializationSucceeded(_logger);
             }
             catch (Exception ex)
             {
-                    // Report errors asynchronously. InitializeAsync is designed not to throw.
-                    Log.InitializationFailed(_logger, ex);
+                // Report errors asynchronously. InitializeAsync is designed not to throw.
+                Log.InitializationFailed(_logger, ex);
                 UnhandledException?.Invoke(this, new UnhandledExceptionEventArgs(ex, isTerminating: false));
                 await TryNotifyClientErrorAsync(Client, GetClientErrorMessage(ex), ex);
             }
@@ -149,8 +149,8 @@ internal partial class CircuitHost : IAsyncDisposable
                 return;
             }
 
-                // Make sure that no hub or connection can refer to this circuit anymore now that it's shutting down.
-                Handle.CircuitHost = null;
+            // Make sure that no hub or connection can refer to this circuit anymore now that it's shutting down.
+            Handle.CircuitHost = null;
             _disposed = true;
 
             try
@@ -159,9 +159,9 @@ internal partial class CircuitHost : IAsyncDisposable
             }
             catch
             {
-                    // Individual exceptions logged as part of OnConnectionDownAsync - nothing to do here
-                    // since we're already shutting down.
-                }
+                // Individual exceptions logged as part of OnConnectionDownAsync - nothing to do here
+                // since we're already shutting down.
+            }
 
             try
             {
@@ -169,15 +169,15 @@ internal partial class CircuitHost : IAsyncDisposable
             }
             catch
             {
-                    // Individual exceptions logged as part of OnCircuitDownAsync - nothing to do here
-                    // since we're already shutting down.
-                }
+                // Individual exceptions logged as part of OnCircuitDownAsync - nothing to do here
+                // since we're already shutting down.
+            }
 
             try
             {
-                    // Prevent any further JS interop calls
-                    // Helps with scenarios like https://github.com/dotnet/aspnetcore/issues/32808
-                    JSRuntime.MarkPermanentlyDisconnected();
+                // Prevent any further JS interop calls
+                // Helps with scenarios like https://github.com/dotnet/aspnetcore/issues/32808
+                JSRuntime.MarkPermanentlyDisconnected();
 
                 await Renderer.DisposeAsync();
                 await _scope.DisposeAsync();
@@ -368,8 +368,8 @@ internal partial class CircuitHost : IAsyncDisposable
             {
                 if (!succeeded)
                 {
-                        // We can log the arguments here because it is simply the JS error with the call stack.
-                        Log.EndInvokeJSFailed(_logger, asyncCall, arguments);
+                    // We can log the arguments here because it is simply the JS error with the call stack.
+                    Log.EndInvokeJSFailed(_logger, asyncCall, arguments);
                 }
                 else
                 {

+ 3 - 3
src/Components/Server/src/Circuits/CircuitRegistry.cs

@@ -198,9 +198,9 @@ internal partial class CircuitRegistry
             {
                 if (previouslyConnected)
                 {
-                        // During reconnects, we may transition from Connect->Connect i.e.without ever having invoking OnConnectionDownAsync during
-                        // a formal client disconnect. To allow authors of CircuitHandlers to have reasonable expectations will pair the connection up with a connection down.
-                        await circuitHost.OnConnectionDownAsync(cancellationToken);
+                    // During reconnects, we may transition from Connect->Connect i.e.without ever having invoking OnConnectionDownAsync during
+                    // a formal client disconnect. To allow authors of CircuitHandlers to have reasonable expectations will pair the connection up with a connection down.
+                    await circuitHost.OnConnectionDownAsync(cancellationToken);
                 }
 
                 await circuitHost.OnConnectionUpAsync(cancellationToken);

+ 2 - 2
src/Components/Server/src/Circuits/RemoteJSRuntime.cs

@@ -161,8 +161,8 @@ internal partial class RemoteJSRuntime : JSRuntime
         var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token;
         cancellationToken.Register(() =>
         {
-                // If by now the stream hasn't been claimed for sending, stop tracking it
-                if (_pendingDotNetToJSStreams.TryRemove(streamId, out var timedOutStream) && !timedOutStream.LeaveOpen)
+            // If by now the stream hasn't been claimed for sending, stop tracking it
+            if (_pendingDotNetToJSStreams.TryRemove(streamId, out var timedOutStream) && !timedOutStream.LeaveOpen)
             {
                 timedOutStream.Stream.Dispose();
             }

+ 3 - 3
src/Components/Server/src/Circuits/RemoteRenderer.cs

@@ -273,9 +273,9 @@ internal partial class RemoteRenderer : WebRenderer
             // We return the task in here, but the caller doesn't await it.
             return Dispatcher.InvokeAsync(() =>
             {
-                    // Now we're on the sync context, check again whether we got disposed since this
-                    // work item was queued. If so there's nothing to do.
-                    if (!_disposing)
+                // Now we're on the sync context, check again whether we got disposed since this
+                // work item was queued. If so there's nothing to do.
+                if (!_disposing)
                 {
                     ProcessPendingRender();
                 }

+ 4 - 4
src/Components/Server/test/Circuits/RemoteJSDataStreamTest.cs

@@ -60,8 +60,8 @@ public class RemoteJSDataStreamTest
 
         var sendDataTask = Task.Run(async () =>
         {
-                // Act 1
-                var success = await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout();
+            // Act 1
+            var success = await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout();
             return success;
         });
 
@@ -88,8 +88,8 @@ public class RemoteJSDataStreamTest
 
         var sendDataTask = Task.Run(async () =>
         {
-                // Act 1
-                var success = await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout();
+            // Act 1
+            var success = await RemoteJSDataStream.ReceiveData(jsRuntime, streamId, chunkId: 0, chunk, error: null).DefaultTimeout();
             return success;
         });
 

+ 1 - 1
src/Components/Web/src/Forms/InputDate.cs

@@ -96,7 +96,7 @@ public class InputDate<[DynamicallyAccessedMembers(DynamicallyAccessedMemberType
             DateOnly dateOnlyValue => BindConverter.FormatValue(dateOnlyValue, _format, CultureInfo.InvariantCulture),
             TimeOnly timeOnlyValue => BindConverter.FormatValue(timeOnlyValue, _format, CultureInfo.InvariantCulture),
             _ => string.Empty, // Handles null for Nullable<DateTime>, etc.
-            };
+        };
 
     /// <inheritdoc />
     protected override bool TryParseValueFromString(string? value, [MaybeNullWhen(false)] out TValue result, [NotNullWhen(false)] out string? validationErrorMessage)

+ 2 - 2
src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Server/Startup.cs

@@ -57,8 +57,8 @@ public class Startup
         {
             endpoints.MapRazorPages();
             endpoints.MapControllers();
-                //endpoints.MapFallbackToFile("index.html");
-                endpoints.MapFallbackToPage("/_Host");
+            //endpoints.MapFallbackToFile("index.html");
+            endpoints.MapFallbackToPage("/_Host");
         });
     }
 }

+ 18 - 18
src/Components/WebAssembly/Server/src/ComponentsWebAssemblyApplicationBuilderExtensions.cs

@@ -49,18 +49,18 @@ public static class ComponentsWebAssemblyApplicationBuilderExtensions
 
                 if (webHostEnvironment.IsDevelopment())
                 {
-                        // DOTNET_MODIFIABLE_ASSEMBLIES is used by the runtime to initialize hot-reload specific environment variables and is configured
-                        // by the launching process (dotnet-watch / Visual Studio).
-                        // In Development, we'll transmit the environment variable to WebAssembly as a HTTP header. The bootstrapping code will read the header
-                        // and configure it as env variable for the wasm app.
-                        if (Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES") is string dotnetModifiableAssemblies)
+                    // DOTNET_MODIFIABLE_ASSEMBLIES is used by the runtime to initialize hot-reload specific environment variables and is configured
+                    // by the launching process (dotnet-watch / Visual Studio).
+                    // In Development, we'll transmit the environment variable to WebAssembly as a HTTP header. The bootstrapping code will read the header
+                    // and configure it as env variable for the wasm app.
+                    if (Environment.GetEnvironmentVariable("DOTNET_MODIFIABLE_ASSEMBLIES") is string dotnetModifiableAssemblies)
                     {
                         context.Response.Headers.Append("DOTNET-MODIFIABLE-ASSEMBLIES", dotnetModifiableAssemblies);
                     }
 
-                        // See https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000
-                        // Translate the _ASPNETCORE_BROWSER_TOOLS environment configured by the browser tools agent in to a HTTP response header.
-                        if (Environment.GetEnvironmentVariable("__ASPNETCORE_BROWSER_TOOLS") is string blazorWasmHotReload)
+                    // See https://github.com/dotnet/aspnetcore/issues/37357#issuecomment-941237000
+                    // Translate the _ASPNETCORE_BROWSER_TOOLS environment configured by the browser tools agent in to a HTTP response header.
+                    if (Environment.GetEnvironmentVariable("__ASPNETCORE_BROWSER_TOOLS") is string blazorWasmHotReload)
                     {
                         context.Response.Headers.Append("ASPNETCORE-BROWSER-TOOLS", blazorWasmHotReload);
                     }
@@ -105,21 +105,21 @@ public static class ComponentsWebAssemblyApplicationBuilderExtensions
         // sending the file.
         options.OnPrepareResponse = fileContext =>
         {
-                // At this point we mapped something from the /_framework
-                fileContext.Context.Response.Headers.Append(HeaderNames.CacheControl, "no-cache");
+            // At this point we mapped something from the /_framework
+            fileContext.Context.Response.Headers.Append(HeaderNames.CacheControl, "no-cache");
 
             var requestPath = fileContext.Context.Request.Path;
             var fileExtension = Path.GetExtension(requestPath.Value);
             if (string.Equals(fileExtension, ".gz") || string.Equals(fileExtension, ".br"))
             {
-                    // When we are serving framework files (under _framework/ we perform content negotiation
-                    // on the accept encoding and replace the path with <<original>>.gz|br if we can serve gzip or brotli content
-                    // respectively.
-                    // Here we simply calculate the original content type by removing the extension and apply it
-                    // again.
-                    // When we revisit this, we should consider calculating the original content type and storing it
-                    // in the request along with the original target path so that we don't have to calculate it here.
-                    var originalPath = Path.GetFileNameWithoutExtension(requestPath.Value);
+                // When we are serving framework files (under _framework/ we perform content negotiation
+                // on the accept encoding and replace the path with <<original>>.gz|br if we can serve gzip or brotli content
+                // respectively.
+                // Here we simply calculate the original content type by removing the extension and apply it
+                // again.
+                // When we revisit this, we should consider calculating the original content type and storing it
+                // in the request along with the original target path so that we don't have to calculate it here.
+                var originalPath = Path.GetFileNameWithoutExtension(requestPath.Value);
                 if (originalPath != null && contentTypeProvider.TryGetContentType(originalPath, out var originalContentType))
                 {
                     fileContext.Context.Response.ContentType = originalContentType;

+ 8 - 8
src/Components/WebAssembly/Server/src/DebugProxyLauncher.cs

@@ -117,14 +117,14 @@ internal static class DebugProxyLauncher
     {
         process.OutputDataReceived += (sender, eventArgs) =>
         {
-                // It's confusing if the debug proxy emits its own startup status messages, because the developer
-                // may think the ports/environment/paths refer to their actual application. So we want to suppress
-                // them, but we can't stop the debug proxy app from emitting the messages entirely (e.g., via
-                // SuppressStatusMessages) because we need the "Now listening on" one to detect the chosen port.
-                // Instead, we'll filter out known strings from the passthrough logic. It's legit to hardcode these
-                // strings because they are also hardcoded like this inside WebHostExtensions.cs and can't vary
-                // according to culture.
-                if (eventArgs.Data is not null)
+            // It's confusing if the debug proxy emits its own startup status messages, because the developer
+            // may think the ports/environment/paths refer to their actual application. So we want to suppress
+            // them, but we can't stop the debug proxy app from emitting the messages entirely (e.g., via
+            // SuppressStatusMessages) because we need the "Now listening on" one to detect the chosen port.
+            // Instead, we'll filter out known strings from the passthrough logic. It's legit to hardcode these
+            // strings because they are also hardcoded like this inside WebHostExtensions.cs and can't vary
+            // according to culture.
+            if (eventArgs.Data is not null)
             {
                 foreach (var prefix in MessageSuppressionPrefixes)
                 {

+ 5 - 5
src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHost.cs

@@ -155,9 +155,9 @@ public sealed class WebAssemblyHost : IAsyncDisposable
 
                 try
                 {
-                        // Here, we add each root component but don't await the returned tasks so that the
-                        // components can be processed in parallel.
-                        var count = rootComponents.Count;
+                    // Here, we add each root component but don't await the returned tasks so that the
+                    // components can be processed in parallel.
+                    var count = rootComponents.Count;
                     var pendingRenders = new Task[count];
                     for (var i = 0; i < count; i++)
                     {
@@ -168,8 +168,8 @@ public sealed class WebAssemblyHost : IAsyncDisposable
                             rootComponent.Selector);
                     }
 
-                        // Now we wait for all components to finish rendering.
-                        await Task.WhenAll(pendingRenders);
+                    // Now we wait for all components to finish rendering.
+                    await Task.WhenAll(pendingRenders);
 
                     initializationTcs.SetResult();
                 }

+ 6 - 6
src/Components/WebAssembly/WebAssembly/src/Services/DefaultWebAssemblyJSRuntime.cs

@@ -46,9 +46,9 @@ internal sealed class DefaultWebAssemblyJSRuntime : WebAssemblyJSRuntime
     {
         WebAssemblyCallQueue.Schedule(argsJson, static argsJson =>
         {
-                // This is not expected to throw, as it takes care of converting any unhandled user code
-                // exceptions into a failure on the Task that was returned when calling InvokeAsync.
-                DotNetDispatcher.EndInvokeJS(Instance, argsJson);
+            // This is not expected to throw, as it takes care of converting any unhandled user code
+            // exceptions into a failure on the Task that was returned when calling InvokeAsync.
+            DotNetDispatcher.EndInvokeJS(Instance, argsJson);
         });
     }
 
@@ -74,9 +74,9 @@ internal sealed class DefaultWebAssemblyJSRuntime : WebAssemblyJSRuntime
         var callInfo = new DotNetInvocationInfo(assemblyName, methodIdentifier, dotNetObjectId, callId);
         WebAssemblyCallQueue.Schedule((callInfo, argsJson), static state =>
         {
-                // This is not expected to throw, as it takes care of converting any unhandled user code
-                // exceptions into a failure on the JS Promise object.
-                DotNetDispatcher.BeginInvokeDotNet(Instance, state.callInfo, state.argsJson);
+            // This is not expected to throw, as it takes care of converting any unhandled user code
+            // exceptions into a failure on the JS Promise object.
+            DotNetDispatcher.BeginInvokeDotNet(Instance, state.callInfo, state.argsJson);
         });
     }
 

+ 3 - 3
src/Components/WebAssembly/testassets/HostedInAspNet.Server/Program.cs

@@ -17,9 +17,9 @@ public class Program
         Host.CreateDefaultBuilder(args)
         .ConfigureWebHostDefaults(webHostBuilder =>
         {
-                // We require this line because we run in Production environment
-                // and static web assets are only on by default during development.
-                webHostBuilder.UseStaticWebAssets();
+            // We require this line because we run in Production environment
+            // and static web assets are only on by default during development.
+            webHostBuilder.UseStaticWebAssets();
 
             webHostBuilder.UseStartup<Startup>();
         })

+ 5 - 5
src/Components/WebAssembly/testassets/HostedInAspNet.Server/Startup.cs

@@ -33,11 +33,11 @@ public class Startup
         var mapAllApps = Configuration.GetValue<bool>("MapAllApps");
         app.Use((context, next) =>
         {
-                // This is used by E2E tests to verify that the correct resources were fetched,
-                // and that it was possible to override the loading mechanism
-                if (context.Request.Query.ContainsKey("customizedbootresource")
-                || context.Request.Headers.ContainsKey("customizedbootresource")
-                || context.Request.Path.Value.EndsWith("/blazor.boot.json", StringComparison.Ordinal))
+            // This is used by E2E tests to verify that the correct resources were fetched,
+            // and that it was possible to override the loading mechanism
+            if (context.Request.Query.ContainsKey("customizedbootresource")
+            || context.Request.Headers.ContainsKey("customizedbootresource")
+            || context.Request.Path.Value.EndsWith("/blazor.boot.json", StringComparison.Ordinal))
             {
                 bootResourceRequestLog.AddRequest(context.Request);
             }

+ 3 - 3
src/Components/WebAssembly/testassets/Wasm.Authentication.Server/Program.cs

@@ -21,9 +21,9 @@ public class Program
             {
                 webBuilder.UseSetting(WebHostDefaults.ApplicationKey, typeof(Program).Assembly.GetName().Name);
 
-                    // We require this line because we run in Production environment
-                    // and static web assets are only on by default during development.
-                    webBuilder.UseStaticWebAssets();
+                // We require this line because we run in Production environment
+                // and static web assets are only on by default during development.
+                webBuilder.UseStaticWebAssets();
                 webBuilder.UseStartup<Startup>();
             });
 }

+ 6 - 6
src/Components/WebView/Samples/PhotinoPlatform/src/PhotinoWebViewManager.cs

@@ -33,13 +33,13 @@ internal class PhotinoWebViewManager : WebViewManager
         _window = window ?? throw new ArgumentNullException(nameof(window));
         _window.WebMessageReceived += (sender, message) =>
         {
-                // On some platforms, we need to move off the browser UI thread
-                Task.Factory.StartNew(message =>
+            // On some platforms, we need to move off the browser UI thread
+            Task.Factory.StartNew(message =>
             {
-                    // TODO: Fix this. Photino should ideally tell us the URL that the message comes from so we
-                    // know whether to trust it. Currently it's hardcoded to trust messages from any source, including
-                    // if the webview is somehow navigated to an external URL.
-                    var messageOriginUrl = new Uri(AppBaseUri);
+                // TODO: Fix this. Photino should ideally tell us the URL that the message comes from so we
+                // know whether to trust it. Currently it's hardcoded to trust messages from any source, including
+                // if the webview is somehow navigated to an external URL.
+                var messageOriginUrl = new Uri(AppBaseUri);
 
                 MessageReceived(messageOriginUrl, (string)message!);
             }, message, CancellationToken.None, TaskCreationOptions.DenyChildAttach, TaskScheduler.Default);

+ 4 - 4
src/Components/WebView/WebView/src/WebViewManager.cs

@@ -156,10 +156,10 @@ public abstract class WebViewManager : IAsyncDisposable
 
         _ = _dispatcher.InvokeAsync(async () =>
         {
-                // TODO: Verify this produces the correct exception-surfacing behaviors.
-                // For example, JS interop exceptions should flow back into JS, whereas
-                // renderer exceptions should be fatal.
-                try
+            // TODO: Verify this produces the correct exception-surfacing behaviors.
+            // For example, JS interop exceptions should flow back into JS, whereas
+            // renderer exceptions should be fatal.
+            try
             {
                 await _ipcReceiver.OnMessageReceivedAsync(_currentPageContext, message);
             }

+ 2 - 2
src/Components/benchmarkapps/Wasm.Performance/Driver/Program.cs

@@ -92,8 +92,8 @@ public class Program
                 }
                 catch
                 {
-                        // Do nothing;
-                    }
+                    // Do nothing;
+                }
                 BenchmarkResultTask.TrySetException(new TimeoutException(exceptionMessage));
             });
 

+ 1 - 1
src/Components/test/E2ETest/AssemblyInfo.cs

@@ -3,4 +3,4 @@
 
 using Microsoft.AspNetCore.Testing;
 
-[assembly:Retry]
+[assembly: Retry]

+ 1 - 1
src/Components/test/E2ETest/Tests/ErrorBoundaryTest.cs

@@ -165,4 +165,4 @@ public class ErrorBoundaryTest : ServerTestBase<ToggleExecutionModeServerFixture
         var globalErrorUi = Browser.Exists(By.Id("blazor-error-ui"));
         Browser.Equal(hasGlobalError ? "block" : "none", () => globalErrorUi.GetCssValue("display"));
     }
-}
+}

+ 2 - 2
src/Components/test/E2ETest/Tests/InputFileTest.cs

@@ -120,8 +120,8 @@ public class InputFileTest : ServerTestBase<ToggleExecutionModeServerFixture<Pro
             var fileContentTypeElement = fileContainer.FindElement(By.Id("file-content-type"));
             var fileContentElement = fileContainer.FindElement(By.Id("file-content"));
 
-                // Validate that the file was uploaded correctly and all fields are present
-                Browser.False(() => string.IsNullOrWhiteSpace(fileNameElement.Text));
+            // Validate that the file was uploaded correctly and all fields are present
+            Browser.False(() => string.IsNullOrWhiteSpace(fileNameElement.Text));
             Browser.NotEqual(default, () => DateTimeOffset.Parse(fileLastModifiedElement.Text, CultureInfo.InvariantCulture));
             Browser.Equal(file.Contents.Length.ToString(CultureInfo.InvariantCulture), () => fileSizeElement.Text);
             Browser.Equal("text/plain", () => fileContentTypeElement.Text);

+ 2 - 2
src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingDisposeComponent.cs

@@ -13,8 +13,8 @@ public class ThrowingDisposeComponent : IComponent, IDisposable
     {
         renderHandle.Render(builder =>
         {
-                // Do nothing.
-            });
+            // Do nothing.
+        });
     }
 
     public void Dispose()

+ 2 - 2
src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingOnAfterRenderAsyncComponent.cs

@@ -13,8 +13,8 @@ public class ThrowingOnAfterRenderAsyncComponent : IComponent, IHandleAfterRende
     {
         renderHandle.Render(builder =>
         {
-                // Do nothing.
-            });
+            // Do nothing.
+        });
     }
 
     public async Task OnAfterRenderAsync()

+ 2 - 2
src/Components/test/testassets/BasicTestApp/ServerReliability/ThrowingOnAfterRenderSyncComponent.cs

@@ -13,8 +13,8 @@ public class ThrowingOnAfterRenderSyncComponent : IComponent, IHandleAfterRender
     {
         renderHandle.Render(builder =>
         {
-                // Do nothing.
-            });
+            // Do nothing.
+        });
     }
 
     public Task OnAfterRenderAsync()

+ 2 - 2
src/Components/test/testassets/TestServer/ClientStartup.cs

@@ -39,8 +39,8 @@ public class ClientStartup
         // Mount the server-side Blazor app on /subdir
         app.Map("/subdir", app =>
         {
-                // Add it before to ensure it takes priority over files in wwwroot
-                app.UseBlazorFrameworkFiles();
+            // Add it before to ensure it takes priority over files in wwwroot
+            app.UseBlazorFrameworkFiles();
             app.UseStaticFiles();
 
             app.UseRouting();

+ 9 - 9
src/Components/test/testassets/TestServer/CorsStartup.cs

@@ -27,16 +27,16 @@ public class CorsStartup
         services.AddMvc();
         services.AddCors(options =>
         {
-                // It's not enough just to return "Access-Control-Allow-Origin: *", because
-                // browsers don't allow wildcards in conjunction with credentials. So we must
-                // specify explicitly which origin we want to allow.
+            // It's not enough just to return "Access-Control-Allow-Origin: *", because
+            // browsers don't allow wildcards in conjunction with credentials. So we must
+            // specify explicitly which origin we want to allow.
 
-                options.AddPolicy("AllowAll", policy => policy
-                .SetIsOriginAllowed(host => host.StartsWith("http://localhost:", StringComparison.Ordinal) || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal))
-                .AllowAnyHeader()
-                .WithExposedHeaders("MyCustomHeader")
-                .AllowAnyMethod()
-                .AllowCredentials());
+            options.AddPolicy("AllowAll", policy => policy
+            .SetIsOriginAllowed(host => host.StartsWith("http://localhost:", StringComparison.Ordinal) || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal))
+            .AllowAnyHeader()
+            .WithExposedHeaders("MyCustomHeader")
+            .AllowAnyMethod()
+            .AllowCredentials());
         });
     }
 

+ 4 - 4
src/Components/test/testassets/TestServer/InternationalizationStartup.cs

@@ -47,12 +47,12 @@ public class InternationalizationStartup
                 options.AddSupportedCultures("en-US", "fr-FR");
                 options.AddSupportedUICultures("en-US", "fr-FR");
 
-                    // Cookie culture provider is included by default, but we want it to be the only one.
-                    options.RequestCultureProviders.Clear();
+                // Cookie culture provider is included by default, but we want it to be the only one.
+                options.RequestCultureProviders.Clear();
                 options.RequestCultureProviders.Add(new CookieRequestCultureProvider());
 
-                    // We want the default to be en-US so that the tests for bind can work consistently.
-                    options.SetDefaultCulture("en-US");
+                // We want the default to be en-US so that the tests for bind can work consistently.
+                options.SetDefaultCulture("en-US");
             });
 
             app.UseRouting();

+ 3 - 3
src/Components/test/testassets/TestServer/Program.cs

@@ -83,9 +83,9 @@ public class Program
             {
                 webHostBuilder.UseStartup<TStartup>();
 
-                    // We require this line because we run in Production environment
-                    // and static web assets are only on by default during development.
-                    webHostBuilder.UseStaticWebAssets();
+                // We require this line because we run in Production environment
+                // and static web assets are only on by default during development.
+                webHostBuilder.UseStaticWebAssets();
             })
             .Build();
 }

+ 1 - 1
src/Components/test/testassets/TestServer/ServerStartup.cs

@@ -29,7 +29,7 @@ public class ServerStartup
         services.AddServerSideBlazor(options =>
         {
             options.RootComponents.MaxJSRootComponents = 5; // To make it easier to test
-                options.RootComponents.RegisterForJavaScript<BasicTestApp.DynamicallyAddedRootComponent>("my-dynamic-root-component");
+            options.RootComponents.RegisterForJavaScript<BasicTestApp.DynamicallyAddedRootComponent>("my-dynamic-root-component");
             options.RootComponents.RegisterForJavaScript<BasicTestApp.JavaScriptRootComponentParameterTypes>(
                 "component-with-many-parameters",
                 javaScriptInitializer: "myJsRootComponentInitializers.testInitializer");

+ 2 - 2
src/Components/test/testassets/TestServer/StartupWithMapFallbackToClientSideBlazor.cs

@@ -41,8 +41,8 @@ public class StartupWithMapFallbackToClientSideBlazor
             subApp.UseBlazorFrameworkFiles();
             subApp.UseStaticFiles();
 
-                // The calls to `Map` allow us to test each of these overloads, while keeping them isolated.
-                subApp.Map("/filepath", filepath =>
+            // The calls to `Map` allow us to test each of these overloads, while keeping them isolated.
+            subApp.Map("/filepath", filepath =>
             {
                 filepath.UseRouting();
                 filepath.UseEndpoints(endpoints =>

+ 2 - 2
src/Configuration.KeyPerFile/src/KeyPerFileConfigurationBuilderExtensions.cs

@@ -46,8 +46,8 @@ public static class KeyPerFileConfigurationBuilderExtensions
     public static IConfigurationBuilder AddKeyPerFile(this IConfigurationBuilder builder, string directoryPath, bool optional, bool reloadOnChange)
         => builder.AddKeyPerFile(source =>
         {
-                // Only try to set the file provider if its not optional or the directory exists 
-                if (!optional || Directory.Exists(directoryPath))
+            // Only try to set the file provider if its not optional or the directory exists 
+            if (!optional || Directory.Exists(directoryPath))
             {
                 source.FileProvider = new PhysicalFileProvider(directoryPath);
             }

+ 11 - 11
src/DataProtection/Cryptography.Internal/src/CryptoUtil.cs

@@ -72,15 +72,15 @@ internal static unsafe class CryptoUtil
 
     [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count)
     {
 #if NETCOREAPP
-            var byteCount = Convert.ToInt32(count);
-            var bytesA = new ReadOnlySpan<byte>(bufA, byteCount);
-            var bytesB = new ReadOnlySpan<byte>(bufB, byteCount);
-            return CryptographicOperations.FixedTimeEquals(bytesA, bytesB);
+        var byteCount = Convert.ToInt32(count);
+        var bytesA = new ReadOnlySpan<byte>(bufA, byteCount);
+        var bytesB = new ReadOnlySpan<byte>(bufB, byteCount);
+        return CryptographicOperations.FixedTimeEquals(bytesA, bytesB);
 #else
         bool areEqual = true;
         for (uint i = 0; i < count; i++)
@@ -99,12 +99,12 @@ internal static unsafe class CryptoUtil
         Assert(countA == countB, "countA == countB");
 
 #if NETCOREAPP
-            unsafe
-            {
-                return CryptographicOperations.FixedTimeEquals(
-                    bufA.AsSpan(start: offsetA, length: countA),
-                    bufB.AsSpan(start: offsetB, length: countB));
-            }
+        unsafe
+        {
+            return CryptographicOperations.FixedTimeEquals(
+                bufA.AsSpan(start: offsetA, length: countA),
+                bufB.AsSpan(start: offsetB, length: countB));
+        }
 #else
         bool areEqual = true;
         for (int i = 0; i < countA; i++)

+ 1 - 1
src/DataProtection/Cryptography.Internal/src/SafeHandles/SafeLibraryHandle.cs

@@ -143,7 +143,7 @@ internal sealed unsafe class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInval
         // http://msdn.microsoft.com/en-us/library/ms683152(v=vs.85).aspx
         [return: MarshalAs(UnmanagedType.Bool)]
 #if NETSTANDARD2_0
-            [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
         [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
         internal static extern bool FreeLibrary(IntPtr hModule);

+ 2 - 2
src/DataProtection/Cryptography.Internal/src/SafeHandles/SecureLocalAllocHandle.cs

@@ -2,8 +2,8 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System;
-using System.Runtime.InteropServices;
 using System.Runtime.ConstrainedExecution;
+using System.Runtime.InteropServices;
 
 namespace Microsoft.AspNetCore.Cryptography.SafeHandles;
 
@@ -39,7 +39,7 @@ internal sealed unsafe class SecureLocalAllocHandle : LocalAllocHandle
     }
 
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
     private void AllocateImpl(IntPtr cb)
     {

+ 9 - 9
src/DataProtection/Cryptography.Internal/src/UnsafeBufferUtil.cs

@@ -13,7 +13,7 @@ internal static unsafe class UnsafeBufferUtil
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void BlockCopy(void* from, void* to, int byteCount)
     {
@@ -22,7 +22,7 @@ internal static unsafe class UnsafeBufferUtil
 
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void BlockCopy(void* from, void* to, uint byteCount)
     {
@@ -33,7 +33,7 @@ internal static unsafe class UnsafeBufferUtil
     }
 
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
     public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount)
     {
@@ -53,7 +53,7 @@ internal static unsafe class UnsafeBufferUtil
     }
 
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
     public static void BlockCopy(void* from, LocalAllocHandle to, uint byteCount)
     {
@@ -73,7 +73,7 @@ internal static unsafe class UnsafeBufferUtil
     }
 
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
 #endif
     public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length)
     {
@@ -127,7 +127,7 @@ internal static unsafe class UnsafeBufferUtil
     /// </summary>
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void SecureZeroMemory(byte* buffer, int byteCount)
     {
@@ -139,7 +139,7 @@ internal static unsafe class UnsafeBufferUtil
     /// </summary>
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void SecureZeroMemory(byte* buffer, uint byteCount)
     {
@@ -160,7 +160,7 @@ internal static unsafe class UnsafeBufferUtil
     /// </summary>
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void SecureZeroMemory(byte* buffer, ulong byteCount)
     {
@@ -180,7 +180,7 @@ internal static unsafe class UnsafeBufferUtil
     /// Securely clears a memory buffer.
     /// </summary>
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     public static void SecureZeroMemory(byte* buffer, IntPtr length)
     {

+ 3 - 3
src/DataProtection/Cryptography.Internal/src/UnsafeNativeMethods.cs

@@ -83,7 +83,7 @@ internal static unsafe class UnsafeNativeMethods
 
     [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375399(v=vs.85).aspx
     internal static extern int BCryptDestroyHash(
@@ -91,7 +91,7 @@ internal static unsafe class UnsafeNativeMethods
 
     [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx
     internal static extern int BCryptDestroyKey(
@@ -245,7 +245,7 @@ internal static unsafe class UnsafeNativeMethods
 
     [DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
 #if NETSTANDARD2_0
-        [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
 #endif
     // http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx
     internal static extern int NCryptCloseProtectionDescriptor(

+ 2 - 2
src/DataProtection/Cryptography.Internal/test/WeakReferenceHelpersTests.cs

@@ -57,8 +57,8 @@ public class WeakReferenceHelpersTests
         // Act
         var retVal = WeakReferenceHelpers.GetSharedInstance(ref wr, () =>
         {
-                // mimic another thread creating the instance while our factory is being invoked
-                WeakReferenceHelpers.GetSharedInstance(ref wr, () => instanceThatWillBeCreatedFirst);
+            // mimic another thread creating the instance while our factory is being invoked
+            WeakReferenceHelpers.GetSharedInstance(ref wr, () => instanceThatWillBeCreatedFirst);
             return instanceThatWillBeCreatedSecond;
         });
 

+ 1 - 1
src/DataProtection/DataProtection/src/AuthenticatedEncryption/AuthenticatedEncryptorFactory.cs

@@ -56,7 +56,7 @@ public sealed class AuthenticatedEncryptorFactory : IAuthenticatedEncryptorFacto
         if (IsGcmAlgorithm(authenticatedConfiguration.EncryptionAlgorithm))
         {
 #if NETCOREAPP
-                return new AesGcmAuthenticatedEncryptor(secret, GetAlgorithmKeySizeInBits(authenticatedConfiguration.EncryptionAlgorithm) / 8);
+            return new AesGcmAuthenticatedEncryptor(secret, GetAlgorithmKeySizeInBits(authenticatedConfiguration.EncryptionAlgorithm) / 8);
 #else
             // GCM requires CNG, and CNG is only supported on Windows.
             if (!OSVersionUtil.IsWindows())

+ 4 - 4
src/DataProtection/DataProtection/src/Cng/DpapiSecretSerializerHelper.cs

@@ -79,7 +79,7 @@ internal static unsafe class DpapiSecretSerializerHelper
         var dataOut = default(DATA_BLOB);
 
 #if NETSTANDARD2_0
-            RuntimeHelpers.PrepareConstrainedRegions();
+        RuntimeHelpers.PrepareConstrainedRegions();
 #endif
 
         try
@@ -171,7 +171,7 @@ internal static unsafe class DpapiSecretSerializerHelper
                     var handleAcquired = false;
 
 #if NETSTANDARD2_0
-                        RuntimeHelpers.PrepareConstrainedRegions();
+                    RuntimeHelpers.PrepareConstrainedRegions();
 #endif
 
                     try
@@ -222,7 +222,7 @@ internal static unsafe class DpapiSecretSerializerHelper
         var dataOut = default(DATA_BLOB);
 
 #if NETSTANDARD2_0
-            RuntimeHelpers.PrepareConstrainedRegions();
+        RuntimeHelpers.PrepareConstrainedRegions();
 #endif
 
         try
@@ -297,7 +297,7 @@ internal static unsafe class DpapiSecretSerializerHelper
             var handleAcquired = false;
 
 #if NETSTANDARD2_0
-                RuntimeHelpers.PrepareConstrainedRegions();
+            RuntimeHelpers.PrepareConstrainedRegions();
 #endif
 
             try

+ 2 - 2
src/DataProtection/DataProtection/src/DataProtectionServiceCollectionExtensions.cs

@@ -96,8 +96,8 @@ public static class DataProtectionServiceCollectionExtensions
 
             IDataProtectionProvider dataProtectionProvider = new KeyRingBasedDataProtectionProvider(keyRingProvider, loggerFactory);
 
-                // Link the provider to the supplied discriminator
-                if (!string.IsNullOrEmpty(dpOptions.Value.ApplicationDiscriminator))
+            // Link the provider to the supplied discriminator
+            if (!string.IsNullOrEmpty(dpOptions.Value.ApplicationDiscriminator))
             {
                 dataProtectionProvider = dataProtectionProvider.CreateProtector(dpOptions.Value.ApplicationDiscriminator);
             }

+ 6 - 6
src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs

@@ -146,8 +146,8 @@ internal sealed unsafe class KeyRingBasedDataProtector : IDataProtector, IPersis
     private static Guid ReadGuid(void* ptr)
     {
 #if NETCOREAPP
-            // Performs appropriate endianness fixups
-            return new Guid(new ReadOnlySpan<byte>(ptr, sizeof(Guid)));
+        // Performs appropriate endianness fixups
+        return new Guid(new ReadOnlySpan<byte>(ptr, sizeof(Guid)));
 #elif NETSTANDARD2_0 || NETFRAMEWORK
         Debug.Assert(BitConverter.IsLittleEndian);
         return Unsafe.ReadUnaligned<Guid>(ptr);
@@ -303,11 +303,11 @@ internal sealed unsafe class KeyRingBasedDataProtector : IDataProtector, IPersis
     private static void WriteGuid(void* ptr, Guid value)
     {
 #if NETCOREAPP
-            var span = new Span<byte>(ptr, sizeof(Guid));
+        var span = new Span<byte>(ptr, sizeof(Guid));
 
-            // Performs appropriate endianness fixups
-            var success = value.TryWriteBytes(span);
-            Debug.Assert(success, "Failed to write Guid.");
+        // Performs appropriate endianness fixups
+        var success = value.TryWriteBytes(span);
+        Debug.Assert(success, "Failed to write Guid.");
 #elif NETSTANDARD2_0 || NETFRAMEWORK
         Debug.Assert(BitConverter.IsLittleEndian);
         Unsafe.WriteUnaligned<Guid>(ptr, value);

+ 1 - 1
src/DataProtection/DataProtection/src/KeyManagement/KeyRingProvider.cs

@@ -260,7 +260,7 @@ internal sealed class KeyRingProvider : ICacheableKeyRingProvider, IKeyRingProvi
         // we'll return a value in the vicinity of 48 - 60 minutes. We use the Random class since
         // we don't need a secure PRNG for this.
 #if NET6_0_OR_GREATER
-            var random = Random.Shared;
+        var random = Random.Shared;
 #else
         var random = new Random();
 #endif

+ 1 - 1
src/DataProtection/DataProtection/src/Managed/ManagedGenRandomImpl.cs

@@ -23,7 +23,7 @@ internal sealed unsafe class ManagedGenRandomImpl : IManagedGenRandom
 #if NETSTANDARD2_0 || NETFRAMEWORK
         _rng.GetBytes(bytes);
 #else
-            RandomNumberGenerator.Fill(bytes);
+        RandomNumberGenerator.Fill(bytes);
 #endif
         return bytes;
     }

+ 8 - 8
src/DataProtection/DataProtection/test/Cng/CngAuthenticatedEncryptorBaseTests.cs

@@ -23,8 +23,8 @@ public unsafe class CngAuthenticatedEncryptorBaseTests
             .Setup(o => o.DecryptHook(It.IsAny<IntPtr>(), 2, It.IsAny<IntPtr>(), 4))
             .Returns((IntPtr pbCiphertext, uint cbCiphertext, IntPtr pbAdditionalAuthenticatedData, uint cbAdditionalAuthenticatedData) =>
             {
-                    // ensure that pointers started at the right place
-                    Assert.Equal((byte)0x03, *(byte*)pbCiphertext);
+                // ensure that pointers started at the right place
+                Assert.Equal((byte)0x03, *(byte*)pbCiphertext);
                 Assert.Equal((byte)0x11, *(byte*)pbAdditionalAuthenticatedData);
                 return new byte[] { 0x20, 0x21, 0x22 };
             });
@@ -48,10 +48,10 @@ public unsafe class CngAuthenticatedEncryptorBaseTests
             .Setup(o => o.DecryptHook(It.IsAny<IntPtr>(), 2, It.IsAny<IntPtr>(), 0))
             .Returns((IntPtr pbCiphertext, uint cbCiphertext, IntPtr pbAdditionalAuthenticatedData, uint cbAdditionalAuthenticatedData) =>
             {
-                    // ensure that pointers started at the right place
-                    Assert.Equal((byte)0x03, *(byte*)pbCiphertext);
+                // ensure that pointers started at the right place
+                Assert.Equal((byte)0x03, *(byte*)pbCiphertext);
                 Assert.NotEqual(IntPtr.Zero, pbAdditionalAuthenticatedData); // CNG will complain if this pointer is zero
-                    return new byte[] { 0x20, 0x21, 0x22 };
+                return new byte[] { 0x20, 0x21, 0x22 };
             });
 
         // Act
@@ -73,9 +73,9 @@ public unsafe class CngAuthenticatedEncryptorBaseTests
             .Setup(o => o.DecryptHook(It.IsAny<IntPtr>(), 0, It.IsAny<IntPtr>(), 4))
             .Returns((IntPtr pbCiphertext, uint cbCiphertext, IntPtr pbAdditionalAuthenticatedData, uint cbAdditionalAuthenticatedData) =>
             {
-                    // ensure that pointers started at the right place
-                    Assert.NotEqual(IntPtr.Zero, pbCiphertext); // CNG will complain if this pointer is zero
-                    Assert.Equal((byte)0x11, *(byte*)pbAdditionalAuthenticatedData);
+                // ensure that pointers started at the right place
+                Assert.NotEqual(IntPtr.Zero, pbCiphertext); // CNG will complain if this pointer is zero
+                Assert.Equal((byte)0x11, *(byte*)pbAdditionalAuthenticatedData);
                 return new byte[] { 0x20, 0x21, 0x22 };
             });
 

+ 2 - 2
src/DataProtection/DataProtection/test/Internal/KeyManagementOptionsSetupTest.cs

@@ -123,8 +123,8 @@ public class KeyManagementOptionsSetupTest
         }
         catch
         {
-                // swallow all failures
-                return null;
+            // swallow all failures
+            return null;
         }
     });
 

+ 3 - 3
src/DataProtection/DataProtection/test/KeyManagement/KeyRingBasedDataProtectorTests.cs

@@ -54,7 +54,7 @@ public class KeyRingBasedDataProtectorTests
                 Assert.Equal(expectedPlaintext, actualPlaintext);
                 Assert.Equal(expectedAad, actualAad);
                 return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
-                });
+            });
 
         var mockKeyRing = new Mock<IKeyRing>(MockBehavior.Strict);
         mockKeyRing.Setup(o => o.DefaultKeyId).Returns(defaultKey);
@@ -92,7 +92,7 @@ public class KeyRingBasedDataProtectorTests
                 Assert.Equal(expectedPlaintext, actualPlaintext);
                 Assert.Equal(expectedAad, actualAad);
                 return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
-                });
+            });
 
         var mockKeyRing = new Mock<IKeyRing>(MockBehavior.Strict);
         mockKeyRing.Setup(o => o.DefaultKeyId).Returns(defaultKey);
@@ -603,7 +603,7 @@ public class KeyRingBasedDataProtectorTests
                 Assert.Equal(expectedPlaintext, actualPlaintext);
                 Assert.Equal(expectedAad, actualAad);
                 return new byte[] { 0x23, 0x29, 0x31, 0x37 }; // ciphertext + tag
-                });
+            });
 
         var mockKeyRing = new Mock<IKeyRing>(MockBehavior.Strict);
         mockKeyRing.Setup(o => o.DefaultKeyId).Returns(defaultKey);

+ 2 - 2
src/DataProtection/DataProtection/test/KeyManagement/KeyRingProviderTests.cs

@@ -526,8 +526,8 @@ public class KeyRingProviderTests
         mockCacheableKeyRingProvider.Setup(o => o.GetCacheableKeyRing(updatedKeyRingTime))
             .Returns<DateTimeOffset>(dto =>
             {
-                    // at this point we're inside the critical section - spawn the background thread now
-                    var backgroundGetKeyRingTask = Task.Run(() =>
+                // at this point we're inside the critical section - spawn the background thread now
+                var backgroundGetKeyRingTask = Task.Run(() =>
                 {
                     keyRingReturnedToBackgroundThread = keyRingProvider.GetCurrentKeyRingCore(updatedKeyRingTime);
                 });

+ 4 - 4
src/DataProtection/DataProtection/test/MockExtensions.cs

@@ -28,8 +28,8 @@ internal static class MockExtensions
                     .Setup(o => o.ImportFromXml(It.IsAny<XElement>()))
                     .Returns<XElement>(el =>
                     {
-                            // Only return the descriptor if the XML matches
-                            XmlAssert.Equal(xml, el);
+                        // Only return the descriptor if the XML matches
+                        XmlAssert.Equal(xml, el);
                         return descriptor;
                     });
                 return mockDeserializer.Object;
@@ -51,8 +51,8 @@ internal static class MockExtensions
                     .Setup(o => o.Decrypt(It.IsAny<XElement>()))
                     .Returns<XElement>(el =>
                     {
-                            // Only return the descriptor if the XML matches
-                            XmlAssert.Equal(expectedInputXml, el);
+                        // Only return the descriptor if the XML matches
+                        XmlAssert.Equal(expectedInputXml, el);
                         return XElement.Parse(outputXml);
                     });
                 return mockDecryptor.Object;

+ 2 - 2
src/DataProtection/DataProtection/test/RegistryPolicyResolverTests.cs

@@ -283,8 +283,8 @@ public class RegistryPolicyResolverTests
         }
         catch
         {
-                // swallow all failures
-                return null;
+            // swallow all failures
+            return null;
         }
     });
 

+ 42 - 42
src/DataProtection/DataProtection/test/Repositories/FileSystemXmlRepositoryTests.cs

@@ -35,14 +35,14 @@ public class FileSystemXmlRepositoryTests
     {
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Arrange
-                var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
 
-                // Act
-                var retVal = repository.Directory;
+            // Act
+            var retVal = repository.Directory;
 
-                // Assert
-                Assert.Equal(dirInfo, retVal);
+            // Assert
+            Assert.Equal(dirInfo, retVal);
         });
     }
 
@@ -51,14 +51,14 @@ public class FileSystemXmlRepositoryTests
     {
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Arrange
-                var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
 
-                // Act
-                var allElements = repository.GetAllElements();
+            // Act
+            var allElements = repository.GetAllElements();
 
-                // Assert
-                Assert.Equal(0, allElements.Count);
+            // Assert
+            Assert.Equal(0, allElements.Count);
         });
     }
 
@@ -67,22 +67,22 @@ public class FileSystemXmlRepositoryTests
     {
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Arrange
-                var element = XElement.Parse("<element1 />");
+            // Arrange
+            var element = XElement.Parse("<element1 />");
             var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(element, "valid-friendly-name");
+            // Act
+            repository.StoreElement(element, "valid-friendly-name");
 
-                // Assert
-                var fileInfos = dirInfo.GetFiles();
+            // Assert
+            var fileInfos = dirInfo.GetFiles();
             var fileInfo = fileInfos.Single(); // only one file should've been created
 
-                // filename should be "valid-friendly-name.xml"
-                Assert.Equal("valid-friendly-name.xml", fileInfo.Name, StringComparer.OrdinalIgnoreCase);
+            // filename should be "valid-friendly-name.xml"
+            Assert.Equal("valid-friendly-name.xml", fileInfo.Name, StringComparer.OrdinalIgnoreCase);
 
-                // file contents should be "<element1 />"
-                var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName));
+            // file contents should be "<element1 />"
+            var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName));
             XmlAssert.Equal("<element1 />", parsedElement);
         });
     }
@@ -97,26 +97,26 @@ public class FileSystemXmlRepositoryTests
     {
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Arrange
-                var element = XElement.Parse("<element1 />");
+            // Arrange
+            var element = XElement.Parse("<element1 />");
             var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(element, friendlyName);
+            // Act
+            repository.StoreElement(element, friendlyName);
 
-                // Assert
-                var fileInfos = dirInfo.GetFiles();
+            // Assert
+            var fileInfos = dirInfo.GetFiles();
             var fileInfo = fileInfos.Single(); // only one file should've been created
 
-                // filename should be "{GUID}.xml"
-                var filename = fileInfo.Name;
+            // filename should be "{GUID}.xml"
+            var filename = fileInfo.Name;
             Assert.EndsWith(".xml", filename, StringComparison.OrdinalIgnoreCase);
             var filenameNoSuffix = filename.Substring(0, filename.Length - ".xml".Length);
             Guid parsedGuid = Guid.Parse(filenameNoSuffix);
             Assert.NotEqual(Guid.Empty, parsedGuid);
 
-                // file contents should be "<element1 />"
-                var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName));
+            // file contents should be "<element1 />"
+            var parsedElement = XElement.Parse(File.ReadAllText(fileInfo.FullName));
             XmlAssert.Equal("<element1 />", parsedElement);
         });
     }
@@ -126,17 +126,17 @@ public class FileSystemXmlRepositoryTests
     {
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Arrange
-                var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new FileSystemXmlRepository(dirInfo, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(new XElement("element1"), friendlyName: null);
+            // Act
+            repository.StoreElement(new XElement("element1"), friendlyName: null);
             repository.StoreElement(new XElement("element2"), friendlyName: null);
             repository.StoreElement(new XElement("element3"), friendlyName: null);
             var allElements = repository.GetAllElements();
 
-                // Assert
-                var orderedNames = allElements.Select(el => el.Name.LocalName).OrderBy(name => name);
+            // Assert
+            var orderedNames = allElements.Select(el => el.Name.LocalName).OrderBy(name => name);
             Assert.Equal(new[] { "element1", "element2", "element3" }, orderedNames);
         });
     }
@@ -150,11 +150,11 @@ public class FileSystemXmlRepositoryTests
         var loggerFactory = new StringLoggerFactory(LogLevel.Warning);
         WithUniqueTempDirectory(dirInfo =>
         {
-                // Act
-                var repo = new FileSystemXmlRepository(dirInfo, loggerFactory);
+            // Act
+            var repo = new FileSystemXmlRepository(dirInfo, loggerFactory);
 
-                // Assert
-                Assert.Contains(Resources.FormatFileSystem_EphemeralKeysLocationInContainer(dirInfo.FullName), loggerFactory.ToString());
+            // Assert
+            Assert.Contains(Resources.FormatFileSystem_EphemeralKeysLocationInContainer(dirInfo.FullName), loggerFactory.ToString());
         });
     }
 

+ 40 - 40
src/DataProtection/DataProtection/test/Repositories/RegistryXmlRepositoryTests.cs

@@ -20,14 +20,14 @@ public class RegistryXmlRepositoryTests
     {
         WithUniqueTempRegKey(regKey =>
         {
-                // Arrange
-                var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
 
-                // Act
-                var retVal = repository.RegistryKey;
+            // Act
+            var retVal = repository.RegistryKey;
 
-                // Assert
-                Assert.Equal(regKey, retVal);
+            // Assert
+            Assert.Equal(regKey, retVal);
         });
     }
 
@@ -37,14 +37,14 @@ public class RegistryXmlRepositoryTests
     {
         WithUniqueTempRegKey(regKey =>
         {
-                // Arrange
-                var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
 
-                // Act
-                var allElements = repository.GetAllElements();
+            // Act
+            var allElements = repository.GetAllElements();
 
-                // Assert
-                Assert.Equal(0, allElements.Count);
+            // Assert
+            Assert.Equal(0, allElements.Count);
         });
     }
 
@@ -54,22 +54,22 @@ public class RegistryXmlRepositoryTests
     {
         WithUniqueTempRegKey(regKey =>
         {
-                // Arrange
-                var element = XElement.Parse("<element1 />");
+            // Arrange
+            var element = XElement.Parse("<element1 />");
             var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(element, "valid-friendly-name");
+            // Act
+            repository.StoreElement(element, "valid-friendly-name");
 
-                // Assert
-                var valueNames = regKey.GetValueNames();
+            // Assert
+            var valueNames = regKey.GetValueNames();
             var valueName = valueNames.Single(); // only one value should've been created
 
-                // value name should be "valid-friendly-name"
-                Assert.Equal("valid-friendly-name", valueName, StringComparer.OrdinalIgnoreCase);
+            // value name should be "valid-friendly-name"
+            Assert.Equal("valid-friendly-name", valueName, StringComparer.OrdinalIgnoreCase);
 
-                // value contents should be "<element1 />"
-                var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string);
+            // value contents should be "<element1 />"
+            var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string);
             XmlAssert.Equal("<element1 />", parsedElement);
         });
     }
@@ -85,23 +85,23 @@ public class RegistryXmlRepositoryTests
     {
         WithUniqueTempRegKey(regKey =>
         {
-                // Arrange
-                var element = XElement.Parse("<element1 />");
+            // Arrange
+            var element = XElement.Parse("<element1 />");
             var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(element, friendlyName);
+            // Act
+            repository.StoreElement(element, friendlyName);
 
-                // Assert
-                var valueNames = regKey.GetValueNames();
+            // Assert
+            var valueNames = regKey.GetValueNames();
             var valueName = valueNames.Single(); // only one value should've been created
 
-                // value name should be "{GUID}"
-                Guid parsedGuid = Guid.Parse(valueName as string);
+            // value name should be "{GUID}"
+            Guid parsedGuid = Guid.Parse(valueName as string);
             Assert.NotEqual(Guid.Empty, parsedGuid);
 
-                // value contents should be "<element1 />"
-                var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string);
+            // value contents should be "<element1 />"
+            var parsedElement = XElement.Parse(regKey.GetValue(valueName) as string);
             XmlAssert.Equal("<element1 />", parsedElement);
         });
     }
@@ -112,17 +112,17 @@ public class RegistryXmlRepositoryTests
     {
         WithUniqueTempRegKey(regKey =>
         {
-                // Arrange
-                var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
+            // Arrange
+            var repository = new RegistryXmlRepository(regKey, NullLoggerFactory.Instance);
 
-                // Act
-                repository.StoreElement(new XElement("element1"), friendlyName: null);
+            // Act
+            repository.StoreElement(new XElement("element1"), friendlyName: null);
             repository.StoreElement(new XElement("element2"), friendlyName: null);
             repository.StoreElement(new XElement("element3"), friendlyName: null);
             var allElements = repository.GetAllElements();
 
-                // Assert
-                var orderedNames = allElements.Select(el => el.Name.LocalName).OrderBy(name => name);
+            // Assert
+            var orderedNames = allElements.Select(el => el.Name.LocalName).OrderBy(name => name);
             Assert.Equal(new[] { "element1", "element2", "element3" }, orderedNames);
         });
     }
@@ -153,8 +153,8 @@ public class RegistryXmlRepositoryTests
         }
         catch
         {
-                // swallow all failures
-                return null;
+            // swallow all failures
+            return null;
         }
     });
 

+ 2 - 2
src/DataProtection/DataProtection/test/XmlEncryption/CertificateXmlEncryptionTests.cs

@@ -27,7 +27,7 @@ public class CertificateXmlEncryptorTests
             .Returns<EncryptedXml, XmlElement>((encryptedXml, element) =>
             {
                 encryptedXml.AddKeyNameMapping("theKey", symmetricAlgorithm); // use symmetric encryption
-                    return encryptedXml.Encrypt(element, "theKey");
+                return encryptedXml.Encrypt(element, "theKey");
             });
 
         var mockInternalDecryptor = new Mock<IInternalEncryptedXmlDecryptor>();
@@ -35,7 +35,7 @@ public class CertificateXmlEncryptorTests
             .Callback<EncryptedXml>(encryptedXml =>
             {
                 encryptedXml.AddKeyNameMapping("theKey", symmetricAlgorithm); // use symmetric encryption
-                });
+            });
 
         var serviceCollection = new ServiceCollection();
         serviceCollection.AddSingleton<IInternalEncryptedXmlDecryptor>(mockInternalDecryptor.Object);

+ 40 - 40
src/DataProtection/Extensions/test/DataProtectionProviderTests.cs

@@ -26,16 +26,16 @@ public class DataProtectionProviderTests
     {
         WithUniqueTempDirectory(directory =>
         {
-                // Step 1: directory should be completely empty
-                directory.Create();
+            // Step 1: directory should be completely empty
+            directory.Create();
             Assert.Empty(directory.GetFiles());
 
-                // Step 2: instantiate the system and round-trip a payload
-                var protector = DataProtectionProvider.Create(directory).CreateProtector("purpose");
+            // Step 2: instantiate the system and round-trip a payload
+            var protector = DataProtectionProvider.Create(directory).CreateProtector("purpose");
             Assert.Equal("payload", protector.Unprotect(protector.Protect("payload")));
 
-                // Step 3: validate that there's now a single key in the directory and that it's not protected
-                var allFiles = directory.GetFiles();
+            // Step 3: validate that there's now a single key in the directory and that it's not protected
+            var allFiles = directory.GetFiles();
             Assert.Single(allFiles);
             Assert.StartsWith("key-", allFiles[0].Name, StringComparison.OrdinalIgnoreCase);
             string fileText = File.ReadAllText(allFiles[0].FullName);
@@ -92,19 +92,19 @@ public class DataProtectionProviderTests
     {
         WithUniqueTempDirectory(directory =>
         {
-                // Step 1: directory should be completely empty
-                directory.Create();
+            // Step 1: directory should be completely empty
+            directory.Create();
             Assert.Empty(directory.GetFiles());
 
-                // Step 2: instantiate the system and round-trip a payload
-                var protector = DataProtectionProvider.Create(directory, configure =>
-            {
-                configure.ProtectKeysWithDpapi();
-            }).CreateProtector("purpose");
+            // Step 2: instantiate the system and round-trip a payload
+            var protector = DataProtectionProvider.Create(directory, configure =>
+        {
+            configure.ProtectKeysWithDpapi();
+        }).CreateProtector("purpose");
             Assert.Equal("payload", protector.Unprotect(protector.Protect("payload")));
 
-                // Step 3: validate that there's now a single key in the directory and that it's protected with DPAPI
-                var allFiles = directory.GetFiles();
+            // Step 3: validate that there's now a single key in the directory and that it's protected with DPAPI
+            var allFiles = directory.GetFiles();
             Assert.Single(allFiles);
             Assert.StartsWith("key-", allFiles[0].Name, StringComparison.OrdinalIgnoreCase);
             string fileText = File.ReadAllText(allFiles[0].FullName);
@@ -136,21 +136,21 @@ public class DataProtectionProviderTests
                 Assert.True(certificate.HasPrivateKey, "Cert should have a private key");
                 try
                 {
-                        // Step 1: directory should be completely empty
-                        directory.Create();
+                    // Step 1: directory should be completely empty
+                    directory.Create();
                     Assert.Empty(directory.GetFiles());
 
-                        // Step 2: instantiate the system and round-trip a payload
-                        var protector = DataProtectionProvider.Create(directory, certificate).CreateProtector("purpose");
+                    // Step 2: instantiate the system and round-trip a payload
+                    var protector = DataProtectionProvider.Create(directory, certificate).CreateProtector("purpose");
                     var data = protector.Protect("payload");
 
-                        // add a cert without the private key to ensure the decryption will still fallback to the cert store
-                        var certWithoutKey = new X509Certificate2(Path.Combine(GetTestFilesPath(), "TestCertWithoutPrivateKey.pfx"), "password");
+                    // add a cert without the private key to ensure the decryption will still fallback to the cert store
+                    var certWithoutKey = new X509Certificate2(Path.Combine(GetTestFilesPath(), "TestCertWithoutPrivateKey.pfx"), "password");
                     var unprotector = DataProtectionProvider.Create(directory, o => o.UnprotectKeysWithAnyCertificate(certWithoutKey)).CreateProtector("purpose");
                     Assert.Equal("payload", unprotector.Unprotect(data));
 
-                        // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
-                        var allFiles = directory.GetFiles();
+                    // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
+                    var allFiles = directory.GetFiles();
                     Assert.Single(allFiles);
                     Assert.StartsWith("key-", allFiles[0].Name, StringComparison.OrdinalIgnoreCase);
                     string fileText = File.ReadAllText(allFiles[0].FullName);
@@ -220,16 +220,16 @@ public class DataProtectionProviderTests
 
         WithUniqueTempDirectory(directory =>
         {
-                // Step 1: directory should be completely empty
-                directory.Create();
+            // Step 1: directory should be completely empty
+            directory.Create();
             Assert.Empty(directory.GetFiles());
 
-                // Step 2: instantiate the system and round-trip a payload
-                var protector = DataProtectionProvider.Create(directory, certificate).CreateProtector("purpose");
+            // Step 2: instantiate the system and round-trip a payload
+            var protector = DataProtectionProvider.Create(directory, certificate).CreateProtector("purpose");
             Assert.Equal("payload", protector.Unprotect(protector.Protect("payload")));
 
-                // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
-                var allFiles = directory.GetFiles();
+            // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
+            var allFiles = directory.GetFiles();
             Assert.Single(allFiles);
             Assert.StartsWith("key-", allFiles[0].Name, StringComparison.OrdinalIgnoreCase);
             string fileText = File.ReadAllText(allFiles[0].FullName);
@@ -264,28 +264,28 @@ public class DataProtectionProviderTests
 
         WithUniqueTempDirectory(directory =>
         {
-                // Step 1: directory should be completely empty
-                directory.Create();
+            // Step 1: directory should be completely empty
+            directory.Create();
             Assert.Empty(directory.GetFiles());
 
-                // Step 2: instantiate the system and create some data
-                var protector = DataProtectionProvider
-                .Create(directory, certificate)
-                .CreateProtector("purpose");
+            // Step 2: instantiate the system and create some data
+            var protector = DataProtectionProvider
+            .Create(directory, certificate)
+            .CreateProtector("purpose");
 
             var data = protector.Protect("payload");
 
-                // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
-                var allFiles = directory.GetFiles();
+            // Step 3: validate that there's now a single key in the directory and that it's is protected using the certificate
+            var allFiles = directory.GetFiles();
             Assert.Single(allFiles);
             Assert.StartsWith("key-", allFiles[0].Name, StringComparison.OrdinalIgnoreCase);
             string fileText = File.ReadAllText(allFiles[0].FullName);
             Assert.DoesNotContain("Warning: the key below is in an unencrypted form.", fileText, StringComparison.Ordinal);
             Assert.Contains("X509Certificate", fileText, StringComparison.Ordinal);
 
-                // Step 4: setup a second system and validate it can decrypt keys and unprotect data
-                var unprotector = DataProtectionProvider.Create(directory,
-                b => b.UnprotectKeysWithAnyCertificate(certificate));
+            // Step 4: setup a second system and validate it can decrypt keys and unprotect data
+            var unprotector = DataProtectionProvider.Create(directory,
+            b => b.UnprotectKeysWithAnyCertificate(certificate));
             Assert.Equal("payload", unprotector.CreateProtector("purpose").Unprotect(data));
         });
     }

+ 1 - 1
src/DataProtection/Extensions/test/Properties/AssemblyInfo.cs

@@ -5,4 +5,4 @@ using Xunit;
 
 // Workaround for DataProtectionProviderTests.System_UsesProvidedDirectoryAndCertificate
 // https://github.com/aspnet/DataProtection/issues/160
-[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]
+[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

+ 2 - 2
src/DataProtection/StackExchangeRedis/src/RedisDataProtectionBuilderExtensions.cs

@@ -2,10 +2,10 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System;
-using StackExchange.Redis;
 using Microsoft.AspNetCore.DataProtection.KeyManagement;
-using Microsoft.Extensions.DependencyInjection;
 using Microsoft.AspNetCore.DataProtection.StackExchangeRedis;
+using Microsoft.Extensions.DependencyInjection;
+using StackExchange.Redis;
 
 namespace Microsoft.AspNetCore.DataProtection;
 

+ 1 - 1
src/DataProtection/StackExchangeRedis/test/TestRedisServer.cs

@@ -1,8 +1,8 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Microsoft.Extensions.Configuration;
 using System;
+using Microsoft.Extensions.Configuration;
 
 namespace Microsoft.AspNetCore.DataProtection;
 

+ 1 - 1
src/DataProtection/StackExchangeRedis/test/TestRedisServerIsAvailableAttribute.cs

@@ -1,8 +1,8 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Microsoft.AspNetCore.Testing;
 using System;
+using Microsoft.AspNetCore.Testing;
 
 namespace Microsoft.AspNetCore.DataProtection;
 

+ 3 - 3
src/DataProtection/samples/EntityFrameworkCoreSample/Program.cs

@@ -20,9 +20,9 @@ class Program
             .AddDbContext<DataProtectionKeyContext>(o =>
             {
                 o.UseInMemoryDatabase("DataProtection_EntityFrameworkCore");
-                    // Make sure to create a sql server called DataProtectionApp
-                    //o.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=DataProtectionApp;Trusted_Connection=True;Connect Timeout=5;ConnectRetryCount=0");
-                    o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
+                // Make sure to create a sql server called DataProtectionApp
+                //o.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=DataProtectionApp;Trusted_Connection=True;Connect Timeout=5;ConnectRetryCount=0");
+                o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
                 o.EnableSensitiveDataLogging();
             })
             .AddDataProtection()

+ 32 - 32
src/DefaultBuilder/src/WebApplicationBuilder.cs

@@ -56,11 +56,11 @@ public sealed class WebApplicationBuilder
 
         _bootstrapHostBuilder.ConfigureWebHostDefaults(webHostBuilder =>
         {
-                // Runs inline.
-                webHostBuilder.Configure(ConfigureApplication);
+            // Runs inline.
+            webHostBuilder.Configure(ConfigureApplication);
 
-                // Attempt to set the application name from options
-                options.ApplyApplicationName(webHostBuilder);
+            // Attempt to set the application name from options
+            options.ApplyApplicationName(webHostBuilder);
         });
 
         // Apply the args to host configuration last since ConfigureWebHostDefaults overrides a host specific setting (the application name).
@@ -71,8 +71,8 @@ public sealed class WebApplicationBuilder
                 config.AddCommandLine(args);
             }
 
-                // Apply the options after the args
-                options.ApplyHostConfiguration(config);
+            // Apply the options after the args
+            options.ApplyHostConfiguration(config);
         });
 
         Configuration = new();
@@ -166,50 +166,50 @@ public sealed class WebApplicationBuilder
         // Copy the services that were added via WebApplicationBuilder.Services into the final IServiceCollection
         _hostBuilder.ConfigureServices((context, services) =>
         {
-                // We've only added services configured by the GenericWebHostBuilder and WebHost.ConfigureWebDefaults
-                // at this point. HostBuilder news up a new ServiceCollection in HostBuilder.Build() we haven't seen
-                // until now, so we cannot clear these services even though some are redundant because
-                // we called ConfigureWebHostDefaults on both the _deferredHostBuilder and _hostBuilder.
-                foreach (var s in _services)
+            // We've only added services configured by the GenericWebHostBuilder and WebHost.ConfigureWebDefaults
+            // at this point. HostBuilder news up a new ServiceCollection in HostBuilder.Build() we haven't seen
+            // until now, so we cannot clear these services even though some are redundant because
+            // we called ConfigureWebHostDefaults on both the _deferredHostBuilder and _hostBuilder.
+            foreach (var s in _services)
             {
                 services.Add(s);
             }
 
-                // Add the hosted services that were initially added last
-                // this makes sure any hosted services that are added run after the initial set
-                // of hosted services. This means hosted services run before the web host starts.
-                foreach (var s in _services.HostedServices)
+            // Add the hosted services that were initially added last
+            // this makes sure any hosted services that are added run after the initial set
+            // of hosted services. This means hosted services run before the web host starts.
+            foreach (var s in _services.HostedServices)
             {
                 services.Add(s);
             }
 
-                // Clear the hosted services list out
-                _services.HostedServices.Clear();
+            // Clear the hosted services list out
+            _services.HostedServices.Clear();
 
-                // Add any services to the user visible service collection so that they are observable
-                // just in case users capture the Services property. Orchard does this to get a "blueprint"
-                // of the service collection
+            // Add any services to the user visible service collection so that they are observable
+            // just in case users capture the Services property. Orchard does this to get a "blueprint"
+            // of the service collection
 
-                // Drop the reference to the existing collection and set the inner collection
-                // to the new one. This allows code that has references to the service collection to still function.
-                _services.InnerCollection = services;
+            // Drop the reference to the existing collection and set the inner collection
+            // to the new one. This allows code that has references to the service collection to still function.
+            _services.InnerCollection = services;
 
             var hostBuilderProviders = ((IConfigurationRoot)context.Configuration).Providers;
 
             if (!hostBuilderProviders.Contains(chainedConfigSource.BuiltProvider))
             {
-                    // Something removed the _hostBuilder's TrackingChainedConfigurationSource pointing back to the ConfigurationManager.
-                    // This is likely a test using WebApplicationFactory. Replicate the effect by clearing the ConfingurationManager sources.
-                    ((IConfigurationBuilder)Configuration).Sources.Clear();
+                // Something removed the _hostBuilder's TrackingChainedConfigurationSource pointing back to the ConfigurationManager.
+                // This is likely a test using WebApplicationFactory. Replicate the effect by clearing the ConfingurationManager sources.
+                ((IConfigurationBuilder)Configuration).Sources.Clear();
             }
 
-                // Make the ConfigurationManager match the final _hostBuilder's configuration. To do that, we add the additional providers
-                // to the inner _hostBuilders's configuration to the ConfigurationManager. We wrap the existing provider in a
-                // configuration source to avoid rebulding or reloading the already added configuration sources.
-                foreach (var provider in hostBuilderProviders)
+            // Make the ConfigurationManager match the final _hostBuilder's configuration. To do that, we add the additional providers
+            // to the inner _hostBuilders's configuration to the ConfigurationManager. We wrap the existing provider in a
+            // configuration source to avoid rebulding or reloading the already added configuration sources.
+            foreach (var provider in hostBuilderProviders)
             {
-                    // Avoid creating a circular reference to the ConfigurationManager via the chained configuration source.
-                    if (!ReferenceEquals(provider, chainedConfigSource.BuiltProvider))
+                // Avoid creating a circular reference to the ConfigurationManager via the chained configuration source.
+                if (!ReferenceEquals(provider, chainedConfigSource.BuiltProvider))
                 {
                     ((IConfigurationBuilder)Configuration).Add(new ConfigurationProviderSource(provider));
                 }

+ 9 - 9
src/DefaultBuilder/src/WebHost.cs

@@ -227,20 +227,20 @@ public static class WebHost
         })
         .ConfigureServices((hostingContext, services) =>
         {
-                // Fallback
-                services.PostConfigure<HostFilteringOptions>(options =>
+            // Fallback
+            services.PostConfigure<HostFilteringOptions>(options =>
             {
                 if (options.AllowedHosts == null || options.AllowedHosts.Count == 0)
                 {
-                        // "AllowedHosts": "localhost;127.0.0.1;[::1]"
-                        var hosts = hostingContext.Configuration["AllowedHosts"]?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
-                        // Fall back to "*" to disable.
-                        options.AllowedHosts = (hosts?.Length > 0 ? hosts : new[] { "*" });
+                    // "AllowedHosts": "localhost;127.0.0.1;[::1]"
+                    var hosts = hostingContext.Configuration["AllowedHosts"]?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
+                    // Fall back to "*" to disable.
+                    options.AllowedHosts = (hosts?.Length > 0 ? hosts : new[] { "*" });
                 }
             });
-                // Change notification
-                services.AddSingleton<IOptionsChangeTokenSource<HostFilteringOptions>>(
-                        new ConfigurationChangeTokenSource<HostFilteringOptions>(hostingContext.Configuration));
+            // Change notification
+            services.AddSingleton<IOptionsChangeTokenSource<HostFilteringOptions>>(
+                    new ConfigurationChangeTokenSource<HostFilteringOptions>(hostingContext.Configuration));
 
             services.AddTransient<IStartupFilter, HostFilteringStartupFilter>();
             services.AddTransient<IStartupFilter, ForwardedHeadersStartupFilter>();

+ 10 - 10
src/DefaultBuilder/test/Microsoft.AspNetCore.FunctionalTests/WebHostFunctionalTests.cs

@@ -47,10 +47,10 @@ public class WebHostFunctionalTests : LoggedTest
             var responseText = await response.Content.ReadAsStringAsync();
             try
             {
-                    // Assert server is Kestrel
-                    Assert.Equal("Kestrel", response.Headers.Server.ToString());
-                    // The application name will be sent in response when all asserts succeed in the test app.
-                    Assert.Equal(applicationName, responseText);
+                // Assert server is Kestrel
+                Assert.Equal("Kestrel", response.Headers.Server.ToString());
+                // The application name will be sent in response when all asserts succeed in the test app.
+                Assert.Equal(applicationName, responseText);
             }
             catch (XunitException)
             {
@@ -72,10 +72,10 @@ public class WebHostFunctionalTests : LoggedTest
             var responseText = await response.Content.ReadAsStringAsync();
             try
             {
-                    // Assert server is Kestrel
-                    Assert.Equal("Kestrel", response.Headers.Server.ToString());
-                    // The application name will be sent in response when all asserts succeed in the test app.
-                    Assert.Equal(applicationName, responseText);
+                // Assert server is Kestrel
+                Assert.Equal("Kestrel", response.Headers.Server.ToString());
+                // The application name will be sent in response when all asserts succeed in the test app.
+                Assert.Equal(applicationName, responseText);
             }
             catch (XunitException)
             {
@@ -98,8 +98,8 @@ public class WebHostFunctionalTests : LoggedTest
             var responseText = await response.Content.ReadAsStringAsync();
             try
             {
-                    // Assert UseDeveloperExceptionPage is called in WebHostStartupFilter.
-                    Assert.Contains(expected, responseText);
+                // Assert UseDeveloperExceptionPage is called in WebHostStartupFilter.
+                Assert.Contains(expected, responseText);
             }
             catch (XunitException)
             {

+ 16 - 16
src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs

@@ -601,9 +601,9 @@ public class WebApplicationTests
             new(),
             bootstrapBuilder =>
             {
-                    // Verify the defaults observed by the boostrap host builder we use internally to populate
-                    // the defaults
-                    bootstrapBuilder.ConfigureAppConfiguration((context, config) =>
+                // Verify the defaults observed by the boostrap host builder we use internally to populate
+                // the defaults
+                bootstrapBuilder.ConfigureAppConfiguration((context, config) =>
                 {
                     Assert.Equal(assemblyName, context.HostingEnvironment.ApplicationName);
                 });
@@ -642,12 +642,12 @@ public class WebApplicationTests
             options,
             bootstrapBuilder =>
             {
-                    // Verify the defaults observed by the boostrap host builder we use internally to populate
-                    // the defaults
-                    bootstrapBuilder.ConfigureAppConfiguration((context, config) =>
-                {
-                    Assert.Equal(assemblyName, context.HostingEnvironment.ApplicationName);
-                });
+                // Verify the defaults observed by the boostrap host builder we use internally to populate
+                // the defaults
+                bootstrapBuilder.ConfigureAppConfiguration((context, config) =>
+            {
+                Assert.Equal(assemblyName, context.HostingEnvironment.ApplicationName);
+            });
             });
 
         Assert.Equal(assemblyName, builder.Environment.ApplicationName);
@@ -809,8 +809,8 @@ public class WebApplicationTests
         {
             hostBuilder.ConfigureHostConfiguration(config =>
             {
-                    // Clearing here would not remove the app config added via builder.Configuration.
-                    config.AddInMemoryCollection(new Dictionary<string, string>()
+                // Clearing here would not remove the app config added via builder.Configuration.
+                config.AddInMemoryCollection(new Dictionary<string, string>()
                 {
                         { "A", "A" },
                 });
@@ -818,8 +818,8 @@ public class WebApplicationTests
 
             hostBuilder.ConfigureAppConfiguration(config =>
             {
-                    // This clears both the chained host configuration and chained builder.Configuration.
-                    config.Sources.Clear();
+                // This clears both the chained host configuration and chained builder.Configuration.
+                config.Sources.Clear();
                 config.AddInMemoryCollection(new Dictionary<string, string>()
                 {
                         { "B", "B" },
@@ -1923,8 +1923,8 @@ public class WebApplicationTests
             {
                 next(app);
 
-                    // This should be true
-                    var val = app.Properties["didsomething"];
+                // This should be true
+                var val = app.Properties["didsomething"];
                 Assert.True((bool)val);
             };
         }
@@ -2134,7 +2134,7 @@ public class WebApplicationTests
                 app.Run(context =>
                 {
                     context.Response.StatusCode = 418; // I'm a teapot
-                        return Task.CompletedTask;
+                    return Task.CompletedTask;
                 });
             };
         }

+ 2 - 2
src/DefaultBuilder/testassets/DependencyInjectionApp/Program.cs

@@ -47,14 +47,14 @@ public class Program
     {
     }
 
-    class Service<T>: IService<T>
+    class Service<T> : IService<T>
     {
         public Service(T t)
         {
         }
     }
 
-    class AnotherService: IAnotherService
+    class AnotherService : IAnotherService
     {
     }
 }

+ 2 - 2
src/Features/JsonPatch/src/Adapters/AdapterFactory.cs

@@ -1,11 +1,11 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
+using System;
+using System.Collections;
 using Microsoft.AspNetCore.JsonPatch.Internal;
 using Newtonsoft.Json.Linq;
 using Newtonsoft.Json.Serialization;
-using System;
-using System.Collections;
 
 namespace Microsoft.AspNetCore.JsonPatch.Adapters;
 

+ 2 - 2
src/Features/JsonPatch/src/Adapters/IAdapterFactory.cs

@@ -1,11 +1,11 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Microsoft.AspNetCore.JsonPatch.Internal;
-using Newtonsoft.Json.Serialization;
 using System;
 using System.Collections.Generic;
 using System.Text;
+using Microsoft.AspNetCore.JsonPatch.Internal;
+using Newtonsoft.Json.Serialization;
 
 namespace Microsoft.AspNetCore.JsonPatch.Adapters;
 

+ 1 - 1
src/Features/JsonPatch/src/Internal/ParsedPath.cs

@@ -1,10 +1,10 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Microsoft.AspNetCore.JsonPatch.Exceptions;
 using System;
 using System.Collections.Generic;
 using System.Text;
+using Microsoft.AspNetCore.JsonPatch.Exceptions;
 
 namespace Microsoft.AspNetCore.JsonPatch.Internal;
 

+ 1 - 1
src/Features/JsonPatch/src/Internal/PathHelpers.cs

@@ -1,8 +1,8 @@
 // Licensed to the .NET Foundation under one or more agreements.
 // The .NET Foundation licenses this file to you under the MIT license.
 
-using Microsoft.AspNetCore.JsonPatch.Exceptions;
 using System;
+using Microsoft.AspNetCore.JsonPatch.Exceptions;
 
 namespace Microsoft.AspNetCore.JsonPatch.Internal;
 

+ 1 - 1
src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs

@@ -2,9 +2,9 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 
 using System;
-using System.Linq;
 using System.Collections.Generic;
 using System.Globalization;
+using System.Linq;
 using System.Linq.Expressions;
 using Microsoft.AspNetCore.JsonPatch.Adapters;
 using Microsoft.AspNetCore.JsonPatch.Converters;

+ 3 - 3
src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMismatchedParameterOptionality.cs

@@ -84,7 +84,7 @@ public partial class RouteHandlerAnalyzer : DiagnosticAnalyzer
                 return false;
             }
 
-            findStartBrace:
+        findStartBrace:
             var startIndex = _routeTemplate.IndexOf('{');
             if (startIndex == -1)
             {
@@ -100,7 +100,7 @@ public partial class RouteHandlerAnalyzer : DiagnosticAnalyzer
 
             var tokenStart = startIndex + 1;
 
-            findEndBrace:
+        findEndBrace:
             var endIndex = IndexOf(_routeTemplate, tokenStart, '}');
             if (endIndex == -1)
             {
@@ -134,4 +134,4 @@ public partial class RouteHandlerAnalyzer : DiagnosticAnalyzer
 
         return -1;
     }
-}
+}

+ 1 - 1
src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/DetectMisplacedLambdaAttribute.cs

@@ -83,4 +83,4 @@ public partial class RouteHandlerAnalyzer : DiagnosticAnalyzer
             return false;
         }
     }
-}
+}

+ 4 - 4
src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DetectMismatchedParameterOptionalityTest.cs

@@ -366,12 +366,12 @@ app.MapGet(""/hello/{name?}"", (string name) => $""Hello {name}"");
     [InlineData("{id}", new[] { "id" }, new[] { "" })]
     [InlineData("{category}/product/{group}", new[] { "category", "group" }, new[] { "", "" })]
     [InlineData("{category:int}/product/{group:range(10, 20)}?", new[] { "category", "group" }, new[] { ":int", ":range(10, 20)" })]
-    [InlineData("{person:int}/{ssn:regex(^\\d{{3}}-\\d{{2}}-\\d{{4}}$)}", new[] { "person", "ssn" }, new[] { ":int", ":regex(^\\d{{3}}-\\d{{2}}-\\d{{4}}$)"})]
+    [InlineData("{person:int}/{ssn:regex(^\\d{{3}}-\\d{{2}}-\\d{{4}}$)}", new[] { "person", "ssn" }, new[] { ":int", ":regex(^\\d{{3}}-\\d{{2}}-\\d{{4}}$)" })]
     [InlineData("{area=Home}/{controller:required}/{id=0:int}", new[] { "area", "controller", "id" }, new[] { "=Home", ":required", "=0:int" })]
-    [InlineData("{category}/product/{group?}", new[] { "category", "group" }, new[] { "", "?"})]
+    [InlineData("{category}/product/{group?}", new[] { "category", "group" }, new[] { "", "?" })]
     [InlineData("{category}/{product}/{*sku}", new[] { "category", "product", "*sku" }, new[] { "", "", "" })]
-    [InlineData("{category}-product-{sku}", new[] { "category", "sku" }, new[] { "", "" } )]
-    [InlineData("category-{product}-sku", new[] { "product" }, new[] { "" } )]
+    [InlineData("{category}-product-{sku}", new[] { "category", "sku" }, new[] { "", "" })]
+    [InlineData("category-{product}-sku", new[] { "product" }, new[] { "" })]
     [InlineData("{category}.{sku?}", new[] { "category", "sku" }, new[] { "", "?" })]
     [InlineData("{category}.{product?}/{sku}", new[] { "category", "product", "sku" }, new[] { "", "?", "" })]
     public void RouteTokenizer_Works_ForSimpleRouteTemplates(string template, string[] expectedNames, string[] expectedQualifiers)

+ 6 - 3
src/Framework/AspNetCoreAnalyzers/test/RouteHandlers/DetectMisplacedLambdaAttributeTest.cs

@@ -92,12 +92,14 @@ void Hello() { }
 
         // Assert
         Assert.Collection(diagnostics,
-            diagnostic => {
+            diagnostic =>
+            {
                 Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor);
                 AnalyzerAssert.DiagnosticLocation(source.DefaultMarkerLocation, diagnostic.Location);
                 Assert.Equal("'AuthorizeAttribute' should be placed directly on the route handler lambda to be effective", diagnostic.GetMessage(CultureInfo.InvariantCulture));
             },
-            diagnostic => {
+            diagnostic =>
+            {
                 Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor);
                 AnalyzerAssert.DiagnosticLocation(source.DefaultMarkerLocation, diagnostic.Location);
                 Assert.Equal("'ProducesAttribute' should be placed directly on the route handler lambda to be effective", diagnostic.GetMessage(CultureInfo.InvariantCulture));
@@ -123,7 +125,8 @@ void Hello() { }
 
         // Assert
         Assert.Collection(diagnostics,
-            diagnostic => {
+            diagnostic =>
+            {
                 Assert.Same(DiagnosticDescriptors.DetectMisplacedLambdaAttribute, diagnostic.Descriptor);
                 AnalyzerAssert.DiagnosticLocation(source.DefaultMarkerLocation, diagnostic.Location);
                 Assert.Equal("'ProducesAttribute' should be placed directly on the route handler lambda to be effective", diagnostic.GetMessage(CultureInfo.InvariantCulture));

+ 7 - 7
src/Framework/test/SharedFxTests.cs

@@ -178,8 +178,8 @@ public class SharedFxTests
 
         Assert.All(dlls, path =>
         {
-                // Unlike dotnet/aspnetcore, dotnet/runtime varies the assembly version while in servicing.
-                if (!repoAssemblies.Contains(Path.GetFileNameWithoutExtension(path)))
+            // Unlike dotnet/aspnetcore, dotnet/runtime varies the assembly version while in servicing.
+            if (!repoAssemblies.Contains(Path.GetFileNameWithoutExtension(path)))
             {
                 return;
             }
@@ -189,8 +189,8 @@ public class SharedFxTests
             var reader = peReader.GetMetadataReader(MetadataReaderOptions.Default);
             var assemblyDefinition = reader.GetAssemblyDefinition();
 
-                // Assembly versions should all match Major.Minor.0.0
-                Assert.Equal(version.Major, assemblyDefinition.Version.Major);
+            // Assembly versions should all match Major.Minor.0.0
+            Assert.Equal(version.Major, assemblyDefinition.Version.Major);
             Assert.Equal(version.Minor, assemblyDefinition.Version.Minor);
             Assert.Equal(0, assemblyDefinition.Version.Build);
             Assert.Equal(0, assemblyDefinition.Version.Revision);
@@ -211,9 +211,9 @@ public class SharedFxTests
 
         Assert.All(dlls, path =>
         {
-                // Unlike dotnet/aspnetcore, dotnet/runtime varies the assembly version while in servicing.
-                // dotnet/aspnetcore assemblies build against RTM targeting pack from dotnet/runtime.
-                if (!repoAssemblies.Contains(Path.GetFileNameWithoutExtension(path)))
+            // Unlike dotnet/aspnetcore, dotnet/runtime varies the assembly version while in servicing.
+            // dotnet/aspnetcore assemblies build against RTM targeting pack from dotnet/runtime.
+            if (!repoAssemblies.Contains(Path.GetFileNameWithoutExtension(path)))
             {
                 return;
             }

+ 2 - 2
src/Framework/test/TargetingPackTests.cs

@@ -109,8 +109,8 @@ public class TargetingPackTests
 
         Assert.All(dlls, path =>
         {
-                // Skip netstandard2.0 System.IO.Pipelines assembly. References have old versions.
-                var filename = Path.GetFileName(path);
+            // Skip netstandard2.0 System.IO.Pipelines assembly. References have old versions.
+            var filename = Path.GetFileName(path);
             if (!string.Equals("System.IO.Pipelines.dll", filename, StringComparison.OrdinalIgnoreCase))
             {
                 using var fileStream = File.OpenRead(path);

+ 2 - 2
src/Grpc/test/testassets/InteropClient/InteropClient.cs

@@ -100,10 +100,10 @@ public class InteropClient : IDisposable
             configure.AddConsole(loggerOptions =>
             {
 #pragma warning disable CS0618 // Type or member is obsolete
-                    loggerOptions.IncludeScopes = true;
+                loggerOptions.IncludeScopes = true;
                 loggerOptions.DisableColors = true;
 #pragma warning restore CS0618 // Type or member is obsolete
-                });
+            });
         });
 
         serviceProvider = services.BuildServiceProvider();

+ 5 - 5
src/Grpc/test/testassets/InteropWebsite/Program.cs

@@ -40,18 +40,18 @@ public class Program
                 builder.AddConsole(loggerOptions =>
                 {
 #pragma warning disable CS0618 // Type or member is obsolete
-                        loggerOptions.DisableColors = true;
+                    loggerOptions.DisableColors = true;
 #pragma warning restore CS0618 // Type or member is obsolete
-                    });
+                });
                 builder.SetMinimumLevel(LogLevel.Trace);
             })
             .ConfigureWebHostDefaults(webBuilder =>
             {
                 webBuilder.ConfigureKestrel((context, options) =>
                 {
-                        // Support --port and --use_tls cmdline arguments normally supported
-                        // by gRPC interop servers.
-                        var useTls = context.Configuration.GetValue("use_tls", false);
+                    // Support --port and --use_tls cmdline arguments normally supported
+                    // by gRPC interop servers.
+                    var useTls = context.Configuration.GetValue("use_tls", false);
 
                     options.Limits.MinRequestBodyDataRate = null;
                     options.ListenAnyIP(0, listenOptions =>

+ 4 - 4
src/HealthChecks/HealthChecks/test/DefaultHealthCheckServiceTest.cs

@@ -337,8 +337,8 @@ public class DefaultHealthCheckServiceTest
         var loggerFactory = new TestLoggerFactory(sink, enabled: true);
         var service = CreateHealthChecksService(b =>
         {
-                // Override the logger factory for testing
-                b.Services.AddSingleton<ILoggerFactory>(loggerFactory);
+            // Override the logger factory for testing
+            b.Services.AddSingleton<ILoggerFactory>(loggerFactory);
 
             b.AddCheck("TestScope", check);
         });
@@ -579,8 +579,8 @@ public class DefaultHealthCheckServiceTest
 
             SingleThreadedSynchronizationContext.Run(() =>
             {
-                    // Act
-                    service.CheckHealthAsync(token).GetAwaiter().GetResult();
+                // Act
+                service.CheckHealthAsync(token).GetAwaiter().GetResult();
                 hangs = false;
             });
         }

+ 3 - 3
src/Hosting/Abstractions/src/HostingAbstractionsWebHostBuilderExtensions.cs

@@ -79,9 +79,9 @@ public static class HostingAbstractionsWebHostBuilderExtensions
 
         return hostBuilder.ConfigureServices(services =>
         {
-                // It would be nicer if this was transient but we need to pass in the
-                // factory instance directly
-                services.AddSingleton(server);
+            // It would be nicer if this was transient but we need to pass in the
+            // factory instance directly
+            services.AddSingleton(server);
         });
     }
 

Some files were not shown because too many files changed in this diff