From d0a2864e1b9d3255f71b06f65498f23d22943867 Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Sun, 17 Dec 2023 11:19:23 -0600 Subject: [PATCH] After better-lambda --- .../src/Common/Routing/RouteParser.cs | 7 +- .../Authorization/FacebookAuthorizeFilter.cs | 7 +- .../FingerprintingExpressionVisitor.cs | 5 +- .../ModelBinding/ModelBinderProviders.cs | 5 +- .../src/Microsoft.Web.Mvc/RadioExtensions.cs | 4 +- .../Headers/CookieHeaderValue.cs | 4 +- .../HttpRequestHeadersExtensions.cs | 10 +- .../MultipartRelatedStreamProvider.cs | 4 +- .../src/System.Web.Cors/CorsResult.cs | 15 +- .../src/System.Web.Http/AuthorizeAttribute.cs | 4 +- .../Controllers/HttpActionDescriptor.cs | 10 +- .../HttpParameterDescriptorExtensions.cs | 5 +- .../Dispatcher/HttpControllerTypeCache.cs | 5 +- .../src/System.Web.Http/FromBodyAttribute.cs | 5 +- .../HttpRequestMessageExtensions.cs | 6 +- .../System.Web.Http/Metadata/ModelMetadata.cs | 4 +- .../ModelBinding/DefaultActionValueBinder.cs | 19 +- .../Services/ServicesContainer.cs | 4 +- .../Validation/DefaultBodyModelValidator.cs | 4 +- .../Async/ReflectedAsyncActionDescriptor.cs | 13 +- .../DataAnnotationsModelMetadataProvider.cs | 9 +- .../src/System.Web.Mvc/DefaultModelBinder.cs | 4 +- .../Html/DefaultEditorTemplates.cs | 4 +- .../src/System.Web.Mvc/MultiSelectList.cs | 4 +- .../Routing/DirectRouteCandidate.cs | 4 +- .../src/System.Web.Mvc/TypeCacheUtil.cs | 4 +- .../Generator/HelperCodeGenerator.cs | 11 +- .../Parser/HtmlMarkupParser.Block.cs | 42 +- .../System.Web.Razor/Parser/VBCodeParser.cs | 4 +- .../Framework/packages/PackageSourceFile.cs | 7 +- .../Framework/packages/WebProjectManager.cs | 6 +- .../AntiXsrf/MachineKey45CryptoSystem.cs | 5 +- .../Utils/SessionStateUtil.cs | 5 +- .../VirtualPathFactoryManager.cs | 3 +- .../HelpPageSampleGenerator.cs | 4 +- .../SimpleMembershipProvider.cs | 8 +- .../Helpers/MockHelpers.cs | 11 +- .../Microsoft.Web.Helpers.Test/ThemesTest.cs | 11 +- .../Test/ComplexModelDtoModelBinderTest.cs | 12 +- .../Test/DictionaryModelBinderTest.cs | 4 +- .../Test/KeyValuePairModelBinderUtilTest.cs | 8 +- .../MutableObjectModelBinderProviderTest.cs | 15 +- .../Test/FormExtensionsTest.cs | 4 +- .../OAuthWebSecurityTest.cs | 36 +- .../FormUrlEncodedMediaTypeFormatterTests.cs | 4 +- .../Formatting/MediaTypeFormatterTestBase.cs | 79 +- ...TypeWithQualityHeaderValueComparerTests.cs | 4 +- ...ringWithQualityHeaderValueComparerTests.cs | 4 +- .../Internal/TranscodingStreamTests.cs | 70 +- .../Tracing/CorsEngineTracerTest.cs | 46 +- .../Tracing/CorsPolicyProviderTracerTest.cs | 20 +- .../ApiExplorer/FormattersTest.cs | 32 +- .../ApiExplorer/ResponseTypeAttributeTest.cs | 9 +- .../Tracing/TracingTest.cs | 138 +- .../HttpMessageHandlerAdapterTest.cs | 132 +- .../OwinResponseExtensionsTests.cs | 5 +- .../WebApiAppBuilderExtensionsTest.cs | 62 +- .../HttpSelfHostConfigurationTest.cs | 37 +- .../ApiControllerActionInvokerTest.cs | 200 +- .../Controllers/ApiControllerTest.cs | 190 +- .../AuthenticationFilterResultTests.cs | 88 +- .../Controllers/ExceptionFilterResultTests.cs | 64 +- .../Controllers/HttpConfigurationTest.cs | 45 +- .../HttpControllerDescriptorTest.cs | 10 +- .../HttpParameterDescriptorTest.cs | 5 +- .../CompositeExceptionLoggerTests.cs | 16 +- .../ExceptionHandlerTests.cs | 11 +- .../ExceptionLoggerExtensionsTests.cs | 11 +- .../Binders/MutableObjectModelBinderTest.cs | 146 +- .../FormatterParameterBindingTest.cs | 21 +- .../BadRequestErrorMessageResultTests.cs | 4 +- .../Results/InvalidModelStateResultTests.cs | 17 +- .../Routing/LinkGenerationRouteTests.cs | 5 +- .../Tracing/Tracers/ActionFilterTracerTest.cs | 26 +- .../AuthenticationFilterTracerTests.cs | 67 +- .../Tracers/AuthorizationFilterTracerTest.cs | 26 +- .../Tracers/ContentNegotiatorTracerTest.cs | 104 +- ...mUrlEncodedMediaTypeFormatterTracerTest.cs | 10 +- .../Tracers/HttpActionDescriptorTracerTest.cs | 86 +- .../Tracers/HttpControllerTracerTest.cs | 24 +- .../RouteDataValueProviderFactoryTest.cs | 5 +- .../HttpControllerHandlerTest.cs | 341 +- .../Routing/HttpRouteExceptionHandlerTests.cs | 99 +- .../Html/Test/ChildActionExtensionsTest.cs | 164 +- .../Html/Test/DisplayNameExtensionsTest.cs | 30 +- .../Html/Test/TemplateHelpersTest.cs | 47 +- .../Html/Test/ValidationExtensionsTest.cs | 64 +- .../Test/AssociatedValidatorProviderTest.cs | 27 +- .../Test/AuthorizeAttributeTest.cs | 49 +- .../Test/ControllerActionInvokerTest.cs | 339 +- .../Test/DefaultModelBinderTest.cs | 100 +- .../Test/FormValueProviderFactoryTest.cs | 8 +- .../Test/HttpDeleteAttributeTest.cs | 4 +- .../Test/HttpPatchAttributeTest.cs | 4 +- .../Test/ModelMetadataTest.cs | 117 +- .../Test/ModelValidatorTest.cs | 5 +- .../Test/RedirectResultTest.cs | 27 +- .../System.Web.Mvc.Test/Test/UrlHelperTest.cs | 13 +- .../System.Web.Mvc.Test/Test/ViewPageTest.cs | 13 +- .../Test/ViewResultTest.cs | 45 +- .../Parser/CallbackParserListenerTest.cs | 54 +- .../RazorTemplateEngineTest.cs | 28 +- .../AssemblyUtilsTest.cs | 12 +- .../Extensions/HttpResponseExtensionsTest.cs | 7 +- .../Extensions/StringWriterExtensionsTest.cs | 20 +- .../Helpers/AntiXsrf/AntiForgeryWorkerTest.cs | 16 +- .../Utils/UrlRewriterHelperTest.cs | 6 +- .../HelppageSampleGeneratorTest.cs | 68 +- .../UnusedResourceUsageRule.cs | 9 +- .../Annotations/ValueResolverAttribute.cs | 4 +- .../Configuration/ConfigurationValidator.cs | 19 +- .../src/AutoMapper/Internal/TypeDetails.cs | 45 +- AutoMapper/src/AutoMapper/PropertyMap.cs | 4 +- .../QueryableExtensions/Extensions.cs | 8 +- .../QueryableExtensions/ProjectionBuilder.cs | 29 +- .../AutoMapper/ServiceCollectionExtensions.cs | 24 +- .../src/IntegrationTests/ChildClassTests.cs | 15 +- .../CustomMapFrom/CustomMapFromTest.cs | 36 +- .../MembersToExpandExpressions.cs | 37 +- .../ProjectionWithExplicitExpansion.cs | 3 +- .../IEnumerableAggregateProjections.cs | 11 +- .../src/IntegrationTests/IncludeMembers.cs | 17 +- .../src/IntegrationTests/NullSubstitute.cs | 7 +- AutoMapper/src/UnitTests/BasicFlattening.cs | 7 +- ...MapICollectionToAggregateSumDestination.cs | 4 +- AutoMapper/src/UnitTests/Bug/ConditionBug.cs | 42 +- .../Bug/ConstructUsingReturnsNull.cs | 4 +- .../UnitTests/Bug/ConvertMapperThreading.cs | 11 +- .../src/UnitTests/Bug/EnumConditionsBug.cs | 71 +- .../src/UnitTests/Bug/NonExistingProperty.cs | 4 +- .../src/UnitTests/Bug/PropertyNamedType.cs | 4 +- .../src/UnitTests/Bug/UseDestinationValue.cs | 17 +- .../src/UnitTests/ConditionalMapping.cs | 30 +- .../src/UnitTests/ConfigurationValidation.cs | 20 +- AutoMapper/src/UnitTests/ContextItems.cs | 11 +- AutoMapper/src/UnitTests/CustomMapping.cs | 131 +- .../IMappingExpression/ForCtorParam.cs | 57 +- AutoMapper/src/UnitTests/InterfaceMapping.cs | 44 +- .../Internal/CreateProxyThreading.cs | 11 +- .../src/UnitTests/MapToAttributeTest.cs | 17 +- .../Mappers/StringDictionaryMapperTests.cs | 9 +- ...ncludedMappingShouldInheritBaseMappings.cs | 11 +- ...dSupportOnlyDestinationTypeBeingDerived.cs | 4 +- AutoMapper/src/UnitTests/NullBehavior.cs | 28 +- .../UnitTests/Projection/ConstructorTests.cs | 7 +- .../src/UnitTests/Projection/MapFromTest.cs | 27 +- .../Projection/NestedAndArraysTests.cs | 5 +- AutoMapper/src/UnitTests/ReverseMapping.cs | 9 +- AutoMapper/src/UnitTests/ValueConverters.cs | 13 +- AutoMapper/src/UnitTests/ValueTypes.cs | 7 +- .../CustomModifiersTestCase.cs | 16 +- .../GenericMethodsProxyTestCase.cs | 4 +- .../DynamicProxy.Tests/ModuleScopeTestCase.cs | 9 +- .../OutRefParamsTestCase.cs | 4 +- .../DictionaryAdapterBase.Notify.cs | 4 +- .../Serializers/XmlEnumerationSerializer.cs | 5 +- .../Generators/Emitters/GenericUtil.cs | 4 +- .../DynamicProxy/Generators/GeneratorUtil.cs | 7 +- .../SerializeComparisonBenchmarks.cs | 13 +- .../JsonPath/QueryJsonSelectTokenWithLinq.cs | 4 +- .../Samples/Linq/SerializeWithLinq.cs | 27 +- .../SerializationErrorHandlingTests.cs | 8 +- .../Serialization/ShouldSerializeTests.cs | 18 +- .../Schema/JsonSchemaResolver.cs | 8 +- .../Newtonsoft.Json/Utilities/StringUtils.cs | 8 +- .../src/DiagnosticAnalyzerRunner.cs | 7 +- .../src/Internal/DefaultClaimUidExtractor.cs | 13 +- .../SqlServerCacheServicesExtensionsTest.cs | 4 +- ...scadingValueServiceCollectionExtensions.cs | 16 +- .../Components/test/CascadingParameterTest.cs | 34 +- .../Components/test/Routing/RouterTest.cs | 5 +- ...omponentsEndpointRouteBuilderExtensions.cs | 19 +- .../EndpointHtmlRenderer.PrerenderingState.cs | 4 +- .../test/Binding/FormDataMapperTests.cs | 55 +- .../Endpoints/test/HotReloadServiceTests.cs | 15 +- .../RazorComponentEndpointDataSourceTest.cs | 15 +- .../test/RazorComponentResultTest.cs | 12 +- .../AsyncQueryExecutorSupplier.cs | 13 +- .../Data/WeatherForecastService.cs | 15 +- .../Server/src/Circuits/CircuitHost.cs | 4 +- .../test/Circuits/CircuitClientProxyTest.cs | 23 +- ...eterFromFormServiceCollectionExtensions.cs | 19 +- .../src/JSComponents/JSComponentInterop.cs | 4 +- .../Components/Web/test/Forms/EditFormTest.cs | 4 +- .../Client/Program.cs | 7 +- ...thenticationServiceCollectionExtensions.cs | 7 +- .../src/Hosting/WebAssemblyHostBuilder.cs | 8 +- .../src/HotReload/HotReloadAgent.cs | 5 +- .../src/Services/LazyAssemblyLoader.cs | 4 +- .../test/StaticContentProviderTests.cs | 4 +- .../Driver/BenchmarkResultsStartup.cs | 8 +- .../MultipleRootComponentsTest.cs | 15 +- .../ServerReconnectionTest.cs | 6 +- .../E2ETest/Tests/BootResourceCachingTest.cs | 38 +- .../Components/test/E2ETest/Tests/KeyTest.cs | 11 +- .../test/testassets/BasicTestApp/Program.cs | 9 +- .../Components.TestServer/CorsStartup.cs | 7 +- .../RazorComponentEndpointsStartup.cs | 4 +- .../src/KeyManagement/DefaultKeyResolver.cs | 11 +- .../src/KeyManagement/XmlKeyManager.cs | 9 +- .../Repositories/FileSystemXmlRepository.cs | 13 +- ...tedEncryptorDescriptorDeserializerTests.cs | 7 +- ...tedEncryptorDescriptorDeserializerTests.cs | 21 +- .../HostingTests.cs | 55 +- .../KeyManagement/XmlKeyManagerTests.cs | 28 +- .../RegistryPolicyResolverTests.cs | 4 +- .../test/DataProtectionProviderTests.cs | 15 +- .../samples/SampleApp/Program.cs | 43 +- .../WebApplicationTests.cs | 42 +- .../CreateDefaultBuilderOfTApp/Program.cs | 80 +- .../JsonPatch/src/JsonPatchDocumentOfT.cs | 4 +- .../AddAuthorizationBuilderAnalyzer.cs | 19 +- .../Infrastructure/RouteUsageDetector.cs | 34 +- .../RoutePatternAnalyzer.cs | 13 +- .../RoutePatternHighlighter.cs | 26 +- .../AtMostOneFromBodyAttribute.cs | 8 +- .../WebApplicationBuilderAnalyzer.cs | 16 +- .../RoutePatternParserTests.cs | 15 +- .../DynamicEndpointDataSource.cs | 4 +- .../src/GenericHost/SlimWebHostBuilder.cs | 4 +- .../src/Hosting/Hosting/src/WebHostBuilder.cs | 3 +- .../Hosting/test/StartupManagerTests.cs | 7 +- .../src/Hosting/Hosting/test/WebHostTests.cs | 54 +- .../RemoteWindowsDeployer.cs | 4 +- .../TestHost/src/RequestLifetimeFeature.cs | 5 +- .../TestHost/src/WebHostBuilderExtensions.cs | 22 +- .../Hosting/TestHost/test/TestServerTests.cs | 47 +- .../src/AuthenticationService.cs | 7 +- .../test/TokenExtensionTests.cs | 4 +- .../gen/RequestDelegateGenerator.cs | 56 +- .../EndpointParameter.cs | 34 +- .../src/RequestDelegateFactory.cs | 4 +- ...mDetailsServiceCollectionExtensionsTest.cs | 50 +- .../test/PropertyAsParameterInfoTests.cs | 4 +- .../test/RequestDelegateFactoryTests.cs | 4 +- .../RequestDelegateCreationTestBase.cs | 9 +- .../RequestDelegateCreationTests.Forms.cs | 8 +- ...DelegateCreationTests.JsonBodyOrService.cs | 8 +- .../RequestDelegateCreationTests.Logging.cs | 44 +- .../Http.Results/test/ProblemResultTests.cs | 4 +- .../Features/HttpRequestIdentifierFeature.cs | 5 +- .../Http/src/Internal/DefaultHttpRequest.cs | 12 +- .../Http/Http/test/DefaultHttpContextTests.cs | 14 +- .../src/Http/Owin/test/OwinExtensionTests.cs | 9 +- .../test/FunctionalTests/RouteHandlerTest.cs | 11 +- ...DefaultLinkGeneratorProcessTemplateTest.cs | 17 +- .../test/UnitTests/DefaultLinkParserTest.cs | 4 +- .../InlineRouteParameterParserTests.cs | 4 +- .../Matching/BarebonesMatcherBuilder.cs | 9 +- .../test/UnitTests/RouteCollectionTest.cs | 4 +- .../test/UnitTests/RouteOptionsTests.cs | 3 +- .../Http/Routing/test/UnitTests/RouteTest.cs | 17 +- ...FrameworkEndpointRouteBuilderExtensions.cs | 5 +- .../UseEndpointRoutingStartup.cs | 4 +- .../EntityFrameworkCore/src/RoleStore.cs | 9 +- .../EntityFrameworkCore/src/UserStore.cs | 18 +- .../test/EF.Test/CustomSchemaTest.cs | 9 +- .../test/EF.Test/DefaultPocoTest.cs | 9 +- .../test/EF.Test/MaxKeyLengthSchemaTest.cs | 9 +- .../test/EF.Test/UserOnlyTest.cs | 9 +- .../20190411154115_CreateIdentitySchema.cs | 160 +- .../IdentitySample.DefaultUI/Startup.cs | 15 +- ...ctionalTestsServiceCollectionExtensions.cs | 25 +- .../ManagementTests.cs | 28 +- .../test/Identity.Test/IdentityOptionsTest.cs | 4 +- .../Identity.Test/IdentityUIScriptsTest.cs | 5 +- .../test/Identity.Test/SignInManagerTest.cs | 333 +- .../test/Identity.Test/UserManagerTest.cs | 248 +- .../test/InMemory.Test/ControllerTest.cs | 15 +- .../test/InMemory.Test/InMemoryStore.cs | 8 +- .../test/InMemory.Test/InMemoryUserStore.cs | 38 +- .../test/Shared/ApiConsistencyTestBase.cs | 4 +- .../src/BlobLoggerProvider.cs | 7 +- .../test/AzureBlobSinkTests.cs | 6 +- .../MigrationsEndPointMiddlewareTest.cs | 19 +- .../DatabaseErrorPageSample/Startup.cs | 4 +- .../test/DbContextHealthCheckTest.cs | 4 +- .../UnitTests/HealthCheckMiddlewareTests.cs | 85 +- .../test/HttpLoggingMiddlewareTests.cs | 4 +- .../test/CertificateForwardingTest.cs | 8 +- .../Middleware/Localization/sample/Startup.cs | 11 +- ...equestLocalizationOptionsExtensionsTest.cs | 4 +- .../test/OutputCacheServiceExtensionsTests.cs | 12 +- .../samples/OutputCachingSample/Startup.cs | 30 +- .../SampleRateLimiterPolicy.cs | 17 +- .../ResponseCaching/src/FastGuid.cs | 5 +- .../test/ResponseCachingTests.cs | 98 +- .../test/IISUrlRewrite/MiddleWareTests.cs | 109 +- .../Rewrite/test/MiddlewareTests.cs | 86 +- .../src/AngularCli/AngularCliBuilder.cs | 5 +- .../StaticFileMiddlewareTests.cs | 55 +- .../DirectoryBrowserMiddlewareTests.cs | 67 +- .../UnitTests/StaticFileMiddlewareTests.cs | 199 +- .../AddResponseTypeAttributeCodeFixAction.cs | 7 +- .../src/ApiConventionAnalyzer.cs | 5 +- ...nouslyReturnsValue_WithoutDocumentation.cs | 4 +- ...pointMetadataApiDescriptionProviderTest.cs | 16 +- .../ApplicationPartFactory.cs | 5 +- .../src/Authorization/AuthorizeFilter.cs | 4 +- ...ontrollerEndpointRouteBuilderExtensions.cs | 8 +- .../MvcCoreServiceCollectionExtensions.cs | 21 +- .../Mvc.Core/src/Routing/AttributeRoute.cs | 13 +- ...ApiBehaviorApplicationModelProviderTest.cs | 4 +- ...ControllerActionDescriptorProviderTests.cs | 50 +- .../DefaultApplicationModelProviderTest.cs | 9 +- ...InferParameterBindingInfoConventionTest.cs | 8 +- .../ControllerBinderDelegateProviderTest.cs | 44 +- .../ApiBehaviorOptionsSetupTest.cs | 25 +- .../MvcCoreServiceCollectionExtensionsTest.cs | 8 +- .../test/Infrastructure/ActionSelectorTest.cs | 20 +- .../ClientErrorResultFilterTest.cs | 15 +- .../Binders/BodyModelBinderTests.cs | 5 +- .../Binders/ComplexObjectModelBinderTest.cs | 4 +- .../Binders/ComplexTypeModelBinderTest.cs | 4 +- ...alidatorsValidationMetadataProviderTest.cs | 8 +- .../Validation/ClientValidatorCacheTest.cs | 4 +- .../Validation/ValidatorCacheTest.cs | 8 +- .../test/RedirectToRouteResultTest.cs | 11 +- .../Mvc.Core/test/VirtualFileResultTest.cs | 8 +- .../src/DataAnnotationsMetadataProvider.cs | 6 +- .../test/NumericClientModelValidatorTest.cs | 17 +- ...MvcLocalizationMvcBuilderExtensionsTest.cs | 25 +- ...lizationServiceCollectionExtensionsTest.cs | 4 +- .../test/ViewLocalizerTest.cs | 11 +- .../src/JsonSerializerSettingsProvider.cs | 5 +- .../NewtonsoftJsonPatchInputFormatterTest.cs | 10 +- .../src/AssemblyPartExtensions.cs | 4 +- ...timeCompilationMvcCoreBuilderExtensions.cs | 18 +- .../src/RazorProjectPageRouteModelProvider.cs | 18 +- .../test/RuntimeViewCompilerTest.cs | 7 +- .../RazorCompiledItemFeatureProviderTest.cs | 35 +- .../Mvc/Mvc.Razor/test/RazorViewEngineTest.cs | 121 +- ...azorPagesEndpointRouteBuilderExtensions.cs | 4 +- .../MvcRazorPagesMvcCoreBuilderExtensions.cs | 11 +- ...DefaultPageApplicationModelProviderTest.cs | 8 +- .../Infrastructure/DefaultPageLoaderTest.cs | 4 +- .../DynamicPageEndpointMatcherPolicyTest.cs | 11 +- .../PageActionInvokerProviderTest.cs | 22 +- .../src/TagHelperOutputExtensions.cs | 13 +- .../test/AnchorTagHelperTest.cs | 173 +- .../Mvc.TagHelpers/test/CacheTagHelperTest.cs | 9 +- .../test/ComponentTagHelperTest.cs | 9 +- .../test/DefaultTagHelperActivatorTest.cs | 5 +- .../Mvc.TagHelpers/test/FormTagHelperTest.cs | 136 +- .../test/SelectTagHelperTest.cs | 87 +- .../test/TagHelperOutputExtensionsTest.cs | 12 +- .../test/ValidationSummaryTagHelperTest.cs | 51 +- .../Mvc.Testing/src/WebApplicationFactory.cs | 28 +- .../AutoValidateAntiforgeryTokenAttribute.cs | 4 +- .../DefaultViewComponentDescriptorProvider.cs | 7 +- .../Mvc.ViewFeatures/test/ControllerTest.cs | 9 +- .../test/DefaultEditorTemplatesTest.cs | 544 ++-- ...aultValidationHtmlAttributeProviderTest.cs | 26 +- .../test/PageRemoteAttributeTest.cs | 9 +- .../test/PartialViewResultTest.cs | 104 +- .../test/RemoteAttributeTest.cs | 9 +- .../Rendering/HtmlHelperFormExtensionsTest.cs | 489 ++- .../Rendering/HtmlHelperLinkGenerationTest.cs | 30 +- .../test/TemplateRendererTest.cs | 4 +- .../test/ViewComponentResultTest.cs | 8 +- .../ViewViewComponentResultTest.cs | 260 +- .../test/ViewResultExecutorTest.cs | 156 +- .../MvcServiceCollectionExtensionsTest.cs | 15 +- .../PreserveComponentStateBenchmark.cs | 4 +- .../perf/benchmarkapps/BasicApi/Startup.cs | 46 +- .../20180609000611_InitialCreate.cs | 43 +- .../CommonResourceInvokerTest.cs | 396 ++- .../Mvc.FunctionalTests/ErrorPageTests.cs | 21 +- .../HtmlGenerationWithCultureTest.cs | 13 +- .../JsonResultWithNewtonsoftJsonTest.cs | 9 +- .../Mvc.FunctionalTests/RazorBuildTest.cs | 12 +- .../RoutingDynamicOrderTest.cs | 96 +- .../SimpleWithWebApplicationBuilderTests.cs | 10 +- .../TestingInfrastructureInheritanceTests.cs | 8 +- .../ComplexTypeIntegrationTestBase.cs | 34 +- .../DictionaryModelBinderIntegrationTest.cs | 4 +- .../GenericModelBinderIntegrationTest.cs | 8 +- .../HeaderModelBinderIntegrationTest.cs | 16 +- .../SimpleTypeModelBinderIntegrationTest.cs | 4 +- .../ValidationWithRecordIntegrationTests.cs | 36 +- .../Controllers/HomeController.cs | 4 +- .../WebSites/Common/TestResponseGenerator.cs | 7 +- .../StartupWithComplexParentValidation.cs | 4 +- .../ValidateBodyParameterAttribute.cs | 4 +- .../RazorPagesWebSite/ModelWithPageFilter.cs | 3 +- .../StartupWithClientValidationDisabled.cs | 3 +- ...emoveControllerActionDescriptorProvider.cs | 4 +- .../RoutingWebSite/StartupForDynamic.cs | 4 +- .../RoutingWebSite/StartupForDynamicOrder.cs | 4 +- .../RoutingWebSite/StartupForFallback.cs | 4 +- .../StartupRoutingDifferentBranches.cs | 4 +- ...nApiEndpointConventionBuilderExtensions.cs | 5 +- .../src/OpenApi/test/OpenApiGeneratorTests.cs | 16 +- .../00000000000000_CreateIdentitySchema.cs | 172 +- .../BlazorWeb-CSharp/Program.cs | 8 +- .../Program.Main.cs | 7 +- .../00000000000000_CreateIdentitySchema.cs | 156 +- .../content/RazorPagesWeb-CSharp/Program.cs | 11 +- .../00000000000000_CreateIdentitySchema.cs | 144 +- .../content/StarterWeb-CSharp/Program.cs | 11 +- .../content/WebApi-CSharp/Program.Main.cs | 45 +- .../Program.MinimalAPIs.WindowsOrNoAuth.cs | 13 +- .../test/Templates.Tests/BaselineTest.cs | 5 +- .../samples/MinimalJwtBearerSample/Program.cs | 19 +- .../test/Negotiate.Test/EventTests.cs | 19 +- .../OAuth/src/ClaimActionCollection.cs | 4 +- .../OAuth/src/MapAllClaimsAction.cs | 7 +- .../OpenIdConnect/src/OpenIdConnectHandler.cs | 35 +- .../src/UniqueJsonKeyClaimAction.cs | 4 +- .../test/AuthenticationMiddlewareTests.cs | 82 +- .../Authentication/test/DynamicSchemeTests.cs | 127 +- .../Authentication/test/GoogleTests.cs | 212 +- .../Authentication/test/JwtBearerTests.cs | 285 +- .../test/MicrosoftAccountTests.cs | 162 +- .../Authentication/test/OAuthTests.cs | 541 ++-- .../OpenIdConnectConfigurationTests.cs | 21 +- .../OpenIdConnectEventTests_Handler.cs | 73 +- .../test/OpenIdConnect/TestServerBuilder.cs | 145 +- .../test/RemoteAuthenticationTests.cs | 34 +- .../Authentication/test/TwitterTests.cs | 125 +- .../test/WsFederation/WsFederationTest.cs | 320 +- .../test/AuthorizationMiddlewareTests.cs | 9 +- ...pleAuthorizationMiddlewareResultHandler.cs | 8 +- .../00000000000000_CreateIdentitySchema.cs | 156 +- .../Identity.ExternalClaims/Startup.cs | 9 +- .../src/WebHostBuilderHttpSysExtensions.cs | 4 +- .../GlobalVersionTests.cs | 15 +- .../Common.FunctionalTests/LoggingTests.cs | 11 +- .../test/Common.LongTests/ShutdownTests.cs | 13 +- .../UpgradeFeatureDetectionTests.cs | 5 +- .../InProcessWebSite/Startup.WebSockets.cs | 9 +- .../testassets/InProcessWebSite/Startup.cs | 8 +- .../src/Internal/Http3/Http3ControlStream.cs | 5 +- ...istenOptionsConnectionLoggingExtensions.cs | 8 +- .../Core/test/Http1/Http1ConnectionTests.cs | 15 +- .../Kestrel/Core/test/KestrelServerTests.cs | 29 +- .../Kestrel/shared/CorrelationIdGenerator.cs | 5 +- .../BindTests/AddressRegistrationTests.cs | 53 +- .../MaxRequestBufferSizeTests.cs | 59 +- .../test/FunctionalTests/ResponseTests.cs | 30 +- .../ConnectionMiddlewareTests.cs | 28 +- .../Http2/Http2TimeoutTests.cs | 66 +- .../Http3/Http3ConnectionTests.cs | 4 +- .../WebTransportHandshakeTests.cs | 5 +- .../MaxRequestBodySizeTests.cs | 14 +- .../InMemory.FunctionalTests/RequestTests.cs | 5 +- .../src/Shared/PropertyAsParameterInfo.cs | 4 +- .../ResultsTests/VirtualFileResultTestBase.cs | 4 +- .../Shared/RoslynUtils/SymbolExtensions.cs | 4 +- .../src/Shared/SignalR/InProcessTestServer.cs | 9 +- .../src/HubConnectionBuilderExtensions.cs | 7 +- ...HttpConnectionTests.ConnectionLifecycle.cs | 4 +- .../HttpConnectionTests.Transport.cs | 9 +- .../HubConnectionTests.ConnectionLifecycle.cs | 4 +- .../UnitTests/HubServerProxyGeneratorTests.cs | 257 +- .../clients/ts/FunctionalTests/Startup.cs | 11 +- .../test/HttpConnectionDispatcherTests.cs | 19 +- .../Tests.Utils/HubProtocolHelpers.cs | 5 +- .../server/Core/src/HubOptionsSetup.cs | 7 +- .../Core/src/Internal/HubMethodDescriptor.cs | 14 +- .../server/SignalR/test/ClientProxyTests.cs | 135 +- .../test/HttpHeaderConnectionHandler.cs | 4 +- .../SignalR/test/HubConnectionHandlerTests.cs | 177 +- .../server/SignalR/test/TestAuthHandler.cs | 4 +- .../SignalR/test/WebSocketsTransportTests.cs | 9 +- .../test/DefaultHubMessageSerializerTests.cs | 4 +- .../test/RedisProtocolTests.cs | 8 +- .../src/xunit/SkipOnAlpineAttribute.cs | 7 +- .../Testing/test/XunitLoggerProviderTest.cs | 8 +- .../Tools/Shared/TestHelpers/TestConsole.cs | 4 +- .../RenderingPlayground/DirectoryTableView.cs | 4 +- .../Perf_Parser_Options_With_Arguments.cs | 13 +- .../System.CommandLine.Benchmarks/Program.cs | 12 +- .../ConfigureFromMethodTests.cs | 4 +- .../XmlDocReader.cs | 15 +- .../ModelBindingCommandHandler.cs | 4 +- .../ConsoleRendererTests.cs | 3 +- .../OutputFormattingTests.cs | 5 +- .../TestTerminalTests.cs | 7 +- .../GlobalToolsSuggestionRegistration.cs | 6 +- .../CustomParsingTests.cs | 7 +- .../System.CommandLine.Tests/OptionTests.cs | 17 +- .../ParserTests.RootCommandAndArg0.cs | 11 +- .../System.CommandLine.Tests/ParserTests.cs | 14 +- .../ParsingValidationTests.cs | 157 +- .../SuggestDirectiveTests.cs | 3 +- .../Utility/AssertionExtensions.cs | 6 +- .../VersionOptionTests.cs | 8 +- .../src/System.CommandLine/ParseResult.cs | 8 +- .../Parsing/SymbolResultExtensions.cs | 4 +- .../AdventureWorksContextBase.cs | 107 +- .../InternalUsageDiagnosticAnalyzer.cs | 7 +- .../Internal/CosmosModelValidator.cs | 16 +- .../Conventions/StoreKeyConvention.cs | 4 +- .../Query/Internal/CosmosMathTranslator.cs | 4 +- ...yableMethodTranslatingExpressionVisitor.cs | 6 +- ...ionBindingRemovingExpressionVisitorBase.cs | 18 +- ...ssionVisitor.ReadItemQueryingEnumerable.cs | 4 +- .../CosmosSqlTranslatingExpressionVisitor.cs | 40 +- .../Update/Internal/DocumentSource.cs | 4 +- .../Design/FluentApiCodeFragment.cs | 11 +- .../Design/Internal/DbContextOperations.cs | 9 +- .../Design/MigrationsCodeGenerator.cs | 34 +- .../Migrations/Design/MigrationsScaffolder.cs | 15 +- .../Internal/LinqToCSharpSyntaxTranslator.cs | 95 +- .../Internal/ModelCodeGeneratorSelector.cs | 4 +- .../Internal/TextTemplatingEngineHost.cs | 4 +- .../InMemoryServiceCollectionExtensions.cs | 15 +- ...emoryProjectionBindingExpressionVisitor.cs | 4 +- .../Storage/Internal/InMemoryTable.cs | 9 +- .../Proxies/Internal/ProxyBindingRewriter.cs | 7 +- .../Design/AnnotationCodeGenerator.cs | 11 +- .../RelationalDbContextOptionsBuilder.cs | 28 +- .../RelationalModelValidator.cs | 100 +- .../EntityTypeHierarchyMappingConvention.cs | 9 +- .../EFCore.Relational/Metadata/ITableIndex.cs | 5 +- .../RelationalForeignKeyExtensions.cs | 4 +- .../Internal/RelationalKeyExtensions.cs | 7 +- .../Internal/MigrationsModelDiffer.cs | 152 +- ...ionalProjectionBindingExpressionVisitor.cs | 12 +- ...electExpressionPruningExpressionVisitor.cs | 7 +- ...lExpressionSimplifyingExpressionVisitor.cs | 22 +- .../RelationalMethodCallTranslatorProvider.cs | 4 +- ...yableMethodTranslatingExpressionVisitor.cs | 9 +- ...lationalSqlTranslatingExpressionVisitor.cs | 111 +- .../SqlExpressions/SelectExpression.Helper.cs | 24 +- .../Query/SqlNullabilityProcessor.cs | 42 +- .../Update/Internal/ColumnAccessorsFactory.cs | 6 +- .../Internal/CompositeRowValueFactory.cs | 4 +- .../Update/ReaderModificationCommandBatch.cs | 8 +- .../Extensions/SqlServerPropertyExtensions.cs | 37 +- .../SqlServerOutputClauseConvention.cs | 7 +- .../Internal/SqlServerAnnotationProvider.cs | 23 +- .../Internal/SqlServerJsonPostprocessor.cs | 4 +- .../Internal/SqlServerTypeMappingSource.cs | 4 +- .../SqliteMigrationsSqlGenerator.cs | 4 +- .../SqliteQueryTranslationPostprocessor.cs | 4 +- .../Internal/SqliteDatabaseModelFactory.cs | 39 +- .../Internal/InternalEntityEntry.cs | 28 +- .../Internal/NavigationFixer.cs | 7 +- .../EFCore/ChangeTracking/ValueComparer`.cs | 28 +- efcore/src/EFCore/DbContextOptionsBuilder.cs | 13 +- .../UpdatingIdentityResolutionInterceptor.cs | 8 +- .../EntityFrameworkQueryableExtensions.cs | 52 +- .../Extensions/Internal/TypeExtensions.cs | 11 +- .../Extensions/PropertyBaseExtensions.cs | 11 +- .../EntityFrameworkServicesBuilder.cs | 27 +- .../ForeignKeyAttributeConvention.cs | 28 +- .../ForeignKeyPropertyDiscoveryConvention.cs | 46 +- .../InversePropertyAttributeConvention.cs | 26 +- .../Conventions/KeyDiscoveryConvention.cs | 20 +- .../RelationshipDiscoveryConvention.cs | 55 +- ...pendencyInjectionMethodParameterBinding.cs | 9 +- .../EFCore/Metadata/IReadOnlyEntityType.cs | 4 +- efcore/src/EFCore/Metadata/IReadOnlyIndex.cs | 9 +- .../Internal/ComplexPropertySnapshot.cs | 7 +- .../Internal/InternalForeignKeyBuilder.cs | 88 +- efcore/src/EFCore/Metadata/Internal/Model.cs | 4 +- .../src/EFCore/Metadata/Internal/Property.cs | 31 +- efcore/src/EFCore/Metadata/RuntimeTypeBase.cs | 4 +- .../Metadata/ServiceParameterBinding.cs | 3 +- efcore/src/EFCore/ModelBuilder.cs | 9 +- .../EFCore/Query/QueryCompilationContext.cs | 19 +- .../Query/ReplacingExpressionVisitor.cs | 8 +- .../ShapedQueryCompilingExpressionVisitor.cs | 83 +- .../ValueConversion/ValueConverterSelector.cs | 67 +- efcore/src/Shared/MethodInfoExtensions.cs | 21 +- efcore/src/Shared/SharedTypeExtensions.cs | 13 +- efcore/src/dotnet-ef/RootCommand.cs | 9 +- .../CommandLineApplication.cs | 16 +- .../AspNetIdentityTestBase.cs | 9 +- .../PersistedGrantDbContextTestBase.cs | 9 +- .../CosmosConcurrencyTest.cs | 4 +- .../EmbeddedDocumentsTest.cs | 58 +- .../NorthwindFunctionsQueryCosmosTest.cs | 35 +- .../CosmosModelBuilderGenericTest.cs | 39 +- .../Design/Internal/CSharpHelperTest.cs | 224 +- .../Internal/DbContextOperationsTest.cs | 15 +- .../CSharpMigrationOperationGeneratorTest.cs | 4 +- ...rpMigrationsGeneratorTest.ModelSnapshot.cs | 132 +- .../Design/MigrationScaffolderTest.cs | 4 +- .../RelationalScaffoldingModelFactoryTest.cs | 15 +- .../FakeScaffoldingModelFactory.cs | 4 +- .../CompositeKeyEndToEndTest.cs | 8 +- .../DatabaseErrorLogStateTest.cs | 8 +- .../GlobalDatabaseTest.cs | 7 +- .../NullabilityCheckInMemoryTest.cs | 14 +- .../Query/QueryBugsInMemoryTest.cs | 121 +- .../Query/WarningsTest.cs | 22 +- .../ValueConvertersEndToEndInMemoryTest.cs | 8 +- .../Storage/InMemoryDatabaseTest.cs | 4 +- .../Query/NorthwindControllers.cs | 4 +- .../ChangeDetectionProxyTests.cs | 8 +- .../ComplexTypeBulkUpdatesTestBase.cs | 15 +- .../InheritanceBulkUpdatesTestBase.cs | 28 +- ...rencyDetectorDisabledRelationalTestBase.cs | 19 +- .../LoggingRelationalTestBase.cs | 31 +- .../Migrations/MigrationsTestBase.cs | 55 +- .../Query/EntitySplittingQueryTestBase.cs | 97 +- .../Query/FromSqlSprocQueryTestBase.cs | 26 +- .../Query/JsonQueryAdHocTestBase.cs | 59 +- .../Query/JsonQueryTestBase.cs | 1232 ++++---- ...dKeylessEntitiesQueryRelationalTestBase.cs | 36 +- .../Query/NorthwindSqlQueryTestBase.cs | 15 +- .../Query/OperatorsProceduralQueryTestBase.cs | 14 +- .../OwnedEntityQueryRelationalTestBase.cs | 71 +- .../Query/QueryNoClientEvalTestBase.cs | 7 +- .../SharedTypeQueryRelationalTestBase.cs | 11 +- .../Query/WarningsTestBase.cs | 11 +- .../RelationalComplianceTestBase.cs | 4 +- .../RelationalDatabaseCleaner.cs | 4 +- .../Update/UpdatesRelationalTestBase.cs | 11 +- .../RelationalModelValidatorTest.Json.cs | 4 +- .../RelationalModelBuilderTest.cs | 150 +- .../RelationalApiConsistencyTest.cs | 7 +- .../ApiConsistencyTestBase.cs | 211 +- .../BuiltInDataTypesTestBase.cs | 897 +++--- .../ComplianceTestBase.cs | 7 +- .../ConcurrencyDetectorTestBase.cs | 42 +- .../CustomConvertersTestBase.cs | 60 +- .../F1FixtureBase.cs | 8 +- .../FieldMappingTestBase.cs | 13 +- .../GraphUpdatesTestBaseOneToManyAk.cs | 18 +- .../GraphUpdatesTestBaseOneToOneAk.cs | 6 +- .../ProxyGraphUpdatesTestBaseOneToManyAk.cs | 14 +- .../ProxyGraphUpdatesTestBaseOneToOneAk.cs | 28 +- .../KeysWithConvertersTestBase.cs | 520 ++-- .../LoggingTestBase.cs | 6 +- .../ManyToManyLoadTestBase.cs | 20 +- .../MusicStoreTestBase.cs | 106 +- .../Query/ComplexNavigationsQueryTestBase.cs | 877 +++--- .../Query/ComplexTypeQueryTestBase.cs | 74 +- .../Query/CompositeKeysQueryTestBase.cs | 199 +- .../Query/FunkyDataQueryTestBase.cs | 109 +- .../Query/GearsOfWarQueryTestBase.cs | 2755 +++++++---------- .../Query/IncludeOneToOneTestBase.cs | 18 +- .../Query/InheritanceQueryTestBase.cs | 20 +- .../InheritanceRelationshipsQueryTestBase.cs | 95 +- .../Query/ManyToManyFieldsQueryFixtureBase.cs | 45 +- .../ManyToManyNoTrackingQueryTestBase.cs | 4 +- .../Query/ManyToManyQueryTestBase.cs | 80 +- ...orthwindAggregateOperatorsQueryTestBase.cs | 430 ++- .../Query/NorthwindCompiledQueryTestBase.cs | 229 +- ...NorthwindEFPropertyIncludeQueryTestBase.cs | 27 +- .../Query/NorthwindGroupByQueryTestBase.cs | 1122 +++---- .../Query/NorthwindIncludeQueryTestBase.cs | 30 +- .../NorthwindKeylessEntitiesQueryTestBase.cs | 15 +- .../NorthwindNavigationsQueryTestBase.cs | 101 +- .../NorthwindSetOperationsQueryTestBase.cs | 17 +- .../Query/NorthwindWhereQueryTestBase.cs | 277 +- .../Query/OwnedEntityQueryTestBase.cs | 94 +- .../PrimitiveCollectionsQueryTestBase.cs | 118 +- .../Query/SharedTypeQueryTestBase.cs | 9 +- .../AspNetIdentity/IdentityUserContext.cs | 21 +- .../ConferencePlanner/EntityExtensions.cs | 33 +- .../InheritanceModel/InheritanceData.cs | 27 +- .../InheritanceRelationshipsContext.cs | 5 +- .../TestModels/MonsterContext`.cs | 22 +- .../TestModels/MusicStore/ShoppingCart.cs | 8 +- .../QueryFilterFuncletizationContext.cs | 12 +- .../ExpectedQueryRewritingVisitor.cs | 20 +- .../QueryTestGeneration/ExpressionMutator.cs | 44 +- .../ServiceCollectionExtensions.cs | 22 +- .../TestUtilities/TestHelpers.cs | 13 +- .../TestUtilities/TestModelSource.cs | 22 +- .../TestUtilities/TestServiceFactory.cs | 7 +- ...nidirectionalManyToManyTrackingTestBase.cs | 32 +- .../Update/UpdatesTestBase.cs | 143 +- .../DbContextPoolingTest.cs | 91 +- .../ExecutionStrategyTest.cs | 16 +- .../GraphUpdatesSqlServerOwnedTest.cs | 8 +- .../Migrations/MigrationsSqlServerTest.cs | 555 ++-- .../OptimisticConcurrencySqlServerTest.cs | 21 +- .../Query/GearsOfWarQuerySqlServerTest.cs | 31 +- .../Query/QueryBugsTest.cs | 832 +++-- ...TemporalGearsOfWarQuerySqlServerFixture.cs | 13 +- ...TemporalManyToManyQuerySqlServerFixture.cs | 90 +- .../Query/TemporalOwnedQuerySqlServerTest.cs | 210 +- .../Query/TemporalTableSqlServerTest.cs | 53 +- .../SqlServerValueGenerationConflictTest.cs | 11 +- .../StoreGeneratedSqlServerTestBase.cs | 9 +- .../Update/MismatchedKeyTypesSqlServerTest.cs | 30 +- ...toreValueGenerationSqlServerFixtureBase.cs | 7 +- .../ValueConvertersEndToEndSqlServerTest.cs | 8 +- .../SqlServerAnnotationCodeGeneratorTest.cs | 3 +- .../SqlServerModelValidatorTest.cs | 49 +- .../SqlServerMetadataBuilderExtensionsTest.cs | 6 +- .../SqlServerModelBuilderTestBase.cs | 127 +- .../SqlServerConnectionTest.cs | 4 +- .../Internal/SqlServerConnectionTest.cs | 4 +- .../NorthwindMiscellaneousQuerySqliteTest.cs | 11 +- .../Query/OwnedQuerySqliteTest.cs | 4 +- .../ChangeTracking/PropertyEntryTest.cs | 4 +- .../ChangeTracking/SkipCollectionEntryTest.cs | 14 +- .../test/EFCore.Tests/DbContextLoggerTests.cs | 4 +- efcore/test/EFCore.Tests/DbContextTest.cs | 7 +- efcore/test/EFCore.Tests/EventSourceTest.cs | 4 +- .../Extensions/QueryableExtensionsTest.cs | 219 +- .../Infrastructure/EventIdTestBase.cs | 13 +- .../ModelValidatorTest.PropertyMapping.cs | 20 +- .../ServiceCollectionMapTest.cs | 8 +- .../DiscriminatorConventionTest.cs | 6 +- .../NonNullableNavigationConventionTest.cs | 4 +- .../Internal/InternalEntityTypeBuilderTest.cs | 5 +- .../ModelBuilding/ComplexTypeTestBase.cs | 19 +- .../ModelBuilding/ManyToManyTestBase.cs | 8 +- ...ModelBuilderGenericRelationshipTypeTest.cs | 12 +- .../ModelBuilding/NonRelationshipTestBase.cs | 34 +- .../ModelBuilding/OneToOneTestBase.cs | 116 +- .../Query/EntityMaterializerSourceTest.cs | 55 +- .../Query/ExpressionPrinterTest.cs | 9 +- .../Storage/ExecutionStrategyTest.cs | 24 +- format/perf/Utilities/MSBuildRegister.cs | 5 +- format/src/Analyzers/AnalyzerFormatter.cs | 45 +- .../AnalyzerReferenceInformationProvider.cs | 7 +- .../src/Analyzers/SolutionCodeFixApplier.cs | 4 +- .../src/Workspaces/MSBuildWorkspaceFinder.cs | 11 +- .../Analyzers/AnalyzerAssemblyGenerator.cs | 12 +- .../tests/Analyzers/FilterDiagnosticsTests.cs | 9 +- .../ThirdPartyAnalyzerFormatterTests.cs | 4 +- .../profiler-stress/runner.cs | 11 +- .../ProjectRootElement.cs | 33 +- .../Microsoft.Build.Evaluation/Project.cs | 44 +- .../ProjectCollection.cs | 6 +- .../ProjectInstance.cs | 50 +- .../ProjectPropertyGroupTaskInstance.cs | 6 +- .../BuildParametersTest.cs | 8 +- .../ExprVisitor.cs | 56 +- .../Mono.CodeContracts.Static.AST/Module.cs | 4 +- .../SubroutineBase.cs | 11 +- .../EnvironmentDomain.cs | 4 +- .../ComposedFactQuery.cs | 3 +- .../Mono.Debugger.Soft/StackFrame.cs | 14 +- .../class/Mono.Debugger.Soft/Test/dtest.cs | 19 +- .../RfcFilter.cs | 6 +- .../Composition/CompositionException.cs | 15 +- .../Hosting/CompositionServices.cs | 7 +- ...ryCatalog.DirectoryCatalogDebuggerProxy.cs | 3 +- .../ImportEngine.RecompositionManager.cs | 4 +- .../Composition/Hosting/TypeCatalog.cs | 4 +- .../ReflectionMemberImportDefinition.cs | 5 +- .../Test/System.Linq/EnumerableFixture.cs | 1 + .../Client/ALinq/ProjectionAnalyzer.cs | 7 +- .../Data/Services/Client/AtomMaterializer.cs | 7 +- .../Services/Client/Binding/BindingGraph.cs | 7 +- .../Services/Client/DataServiceContext.cs | 20 +- .../Services/Client/ProjectionPlanCompiler.cs | 7 +- .../OleDbCommandBuilder_DeriveParameters_O.cs | 5 +- .../DataColumnCollection_CollectionChanged.cs | 5 +- .../HttpRequestHeaders.cs | 16 +- .../System.Net.Http.Headers/QualityValue.cs | 4 +- .../XsdDataContractImporterTest.cs | 4 +- .../UdpDuplexChannel.cs | 9 +- .../DiscoveryService.cs | 4 +- .../AnnouncementClientTest.cs | 22 +- .../AnnouncementServiceTest.cs | 14 +- .../DiscoveryEndpointTest.cs | 97 +- .../DiscoveryServiceTest.cs | 28 +- .../DynamicEndpointTest.cs | 6 +- .../UdpAnnouncementEndpointTest.cs | 6 +- .../HttpListenerManagerTable.cs | 4 +- .../SecurityDuplexSessionChannel.cs | 7 +- .../ContractDescriptionGenerator.cs | 30 +- .../MessageDescription.cs | 5 +- .../ServiceContractGenerator.cs | 12 +- .../System.ServiceModel/ClientRealProxy.cs | 9 +- .../System.ServiceModel/ServiceHostBase.cs | 8 +- ...tionOrientedTransportBindingElementTest.cs | 20 +- .../HttpTransportBindingElementTest.cs | 27 +- .../StandardEndpointsSectionTest.cs | 4 +- .../ContractDescriptionTest.cs | 47 +- .../MetadataSetTest.cs | 4 +- .../ServiceCredentialsTest.cs | 10 +- .../Bug32886Test.cs | 8 +- .../Test/System.ServiceModel/Bug36080Test.cs | 8 +- .../OptionsTest.cs | 47 +- .../Async/ReflectedAsyncActionDescriptor.cs | 13 +- .../System.Web.Mvc3/Mvc/DefaultModelBinder.cs | 4 +- .../Mvc/Html/DefaultEditorTemplates.cs | 4 +- .../Mvc/Html/ValidationExtensions.cs | 4 +- .../DiscoveryClientProtocol.cs | 5 +- .../System.Web.Compilation/AppCodeCompiler.cs | 5 +- .../System.Web.Hosting/SimpleWorkerRequest.cs | 7 +- .../System.Web.UI.WebControls/GridViewTest.cs | 12 +- .../ObjectDataSourceTest.cs | 30 +- .../SiteMapPathTest.cs | 6 +- .../WizardStepBaseTest.cs | 6 +- .../TableRowCollection_AddAt_IT.aspx.cs | 5 +- .../TableRowCollection_Add_T.aspx.cs | 5 +- .../TableStyle_BackImageUrl.aspx.cs | 5 +- .../TableStyle/TableStyle_CellSpacing.aspx.cs | 5 +- .../TableStyle/TableStyle_GridLines.aspx.cs | 5 +- .../DataGridViewColumnHeaderTest.cs | 5 +- .../System.Windows.Forms/DataGridViewTest.cs | 5 +- .../XmlSchemaLengthFacetTests.cs | 5 +- .../System.Xaml/TypeExtensionMethods.cs | 13 +- .../System.Xaml/XamlObjectWriter.cs | 7 +- .../System.Xaml/XamlSchemaContext.cs | 8 +- .../System.Xaml/System.Xaml/XamlXmlReader.cs | 8 +- .../System.Configuration/ConfigXmlDocument.cs | 35 +- mono/mcs/class/System/Test/System/UriTest.cs | 7 +- .../Test/System.Reflection/MethodInfoTest.cs | 5 +- .../ClaimsPrincipalTest.cs | 33 +- .../class/corlib/Test/System/StringTest.cs | 4 +- .../Presentation/FlowchartDesigner.Helpers.cs | 24 +- .../Presentation/SequenceDesigner.xaml.cs | 5 +- .../StateContainerEditor.CompositeView.cs | 21 +- .../Presentation/StateContainerEditor.xaml.cs | 4 +- .../Presentation/TransitionDesigner.xaml.cs | 26 +- .../Presentation/TryCatchDesigner.xaml.cs | 5 +- .../DynamicArgumentDesigner.xaml.cs | 25 +- .../Presentation/DynamicArgumentDialog.cs | 10 +- .../Presentation/BindingEditor.xaml.cs | 11 +- .../SendReplyValidationFeature.cs | 38 +- .../Activities/VisualBasicHelper.cs | 4 +- .../Debugger/XamlDebuggerXmlReader.cs | 5 +- .../System/Activities/ExpressionUtilities.cs | 5 +- .../Activities/NativeActivityContext.cs | 4 +- .../Activities/Runtime/ActivityInstanceMap.cs | 6 +- .../Activities/Runtime/BookmarkManager.cs | 5 +- .../Activities/Statements/MethodResolver.cs | 9 +- .../Activities/Statements/TransactionScope.cs | 8 +- .../Activities/Validation/ValidationHelper.cs | 12 +- ...mitedStringAttributeCollectionConverter.cs | 5 +- .../System/Data/SortExpressionBuilder.cs | 4 +- .../Design/Common/MetadataItemSerializer.cs | 8 +- .../EntityViewGenerator.cs | 8 +- .../EntityModel/Emitters/EntityTypeEmitter.cs | 4 +- .../Common/CommandTrees/DbQueryCommandTree.cs | 7 +- .../Data/Common/EntitySql/SemanticResolver.cs | 4 +- .../Data/Common/EntitySql/TypeResolver.cs | 15 +- .../Data/Common/Utils/MetadataHelper.cs | 23 +- ...onImportMapping.ReturnTypeRenameMapping.cs | 9 +- .../Mapping/StorageEntityContainerMapping.cs | 20 +- .../Update/Internal/ExtractorMetadata.cs | 4 +- .../Update/Internal/FunctionUpdateCommand.cs | 11 +- .../Internal/Propagator.JoinPropagator.cs | 5 +- .../Update/Internal/UpdateTranslator.cs | 8 +- .../ViewGeneration/BasicViewGenerator.cs | 4 +- .../ViewGeneration/CqlGeneration/CqlBlock.cs | 11 +- .../QueryRewriting/FragmentQueryKB.cs | 10 +- .../QueryRewriting/QueryRewriter.cs | 24 +- .../Structures/LeftCellWrapper.cs | 5 +- .../Structures/ScalarRestriction.cs | 9 +- .../Structures/TypeRestriction.cs | 4 +- .../Data/Mapping/ViewGeneration/Validator.cs | 6 +- .../Mapping/ViewGeneration/ViewGenerator.cs | 4 +- .../System/Data/Mapping/ViewValidator.cs | 8 +- .../System/Data/Metadata/Converter.cs | 12 +- .../Edm/Provider/EdmProviderManifest.cs | 8 +- .../Data/Metadata/MappingMetadataHelper.cs | 42 +- .../System/Data/Metadata/MetadataWorkspace.cs | 11 +- .../ObjectLayer/KnownAssembliesSet.cs | 4 +- .../Data/Objects/DataClasses/RelatedEnd.cs | 8 +- .../Data/Objects/ELinq/ExpressionConverter.cs | 15 +- .../Data/Query/PlanCompiler/ITreeGenerator.cs | 9 +- .../Data/Query/PlanCompiler/JoinGraph.cs | 4 +- .../System/Data/Spatial/DbGeography.cs | 4 +- .../System/Data/Spatial/DbGeometry.cs | 4 +- .../SqlClient/Common/TypeSystem.cs | 8 +- .../SqlClient/Query/QueryConverter.cs | 4 +- .../SqlClient/Query/SqlRetyper.cs | 8 +- .../System.Data/System/Data/DataTable.cs | 9 +- .../System/Data/OleDb/OleDbCommand.cs | 5 +- .../Data/ProviderBase/DbConnectionClosed.cs | 5 +- .../ProviderBase/DbConnectionPoolGroup.cs | 12 +- .../Data/SqlClient/SqlSymmetricKeyCache.cs | 16 +- .../System/Data/SqlClient/TdsParser.cs | 5 +- .../Configuration/IdentityConfiguration.cs | 9 +- .../Diagnostics/SecurityTraceRecordHelper.cs | 4 +- .../WSTrust/WSTrustSerializationContext.cs | 4 +- .../WSTrust/WSTrustSerializationHelper.cs | 8 +- .../Tokens/EncryptedSecurityTokenHandler.cs | 4 +- .../Tokens/Saml2SecurityTokenHandler.cs | 4 +- .../Tokens/SamlSecurityTokenHandler.cs | 4 +- .../Collaboration/PeerCollaboration.cs | 5 +- .../DurableInstancing/InstanceHandle.cs | 4 +- .../DurableInstancing/InstanceStore.cs | 4 +- .../System/Runtime/PersistencePipeline.cs | 6 +- .../System/Xml/ArrayHelper.cs | 15 +- .../Activation/AspNetPartialTrustHelpers.cs | 4 +- .../ServiceModel/ServiceHostingEnvironment.cs | 5 +- .../Activities/CorrelationHandle.cs | 5 +- .../PersistenceProviderDirectory.cs | 12 +- .../Dispatcher/WorkflowServiceInstance.cs | 24 +- .../Activities/InternalSendMessage.cs | 24 +- .../Activities/ReceiveMessageContent.cs | 8 +- .../Activities/SendMessageContent.cs | 8 +- .../Activities/TransactedReceiveScope.cs | 8 +- .../WorkflowUpdateableControlClient.cs | 4 +- .../Routing/ProcessMessagesAsyncResult.cs | 4 +- .../WebScriptMetadataMessageEncoderFactory.cs | 4 +- .../Dispatcher/HelpHtmlBuilder.cs | 4 +- .../Dispatcher/WebErrorHandler.cs | 18 +- .../Activation/AspNetEnvironment.cs | 5 +- .../Channels/CallbackContextMessageHeader.cs | 10 +- .../ServiceModel/Channels/ChannelBuilder.cs | 5 +- .../Channels/ChannelReliableSession.cs | 5 +- ...tWebSocketTransportDuplexSessionChannel.cs | 5 +- .../Channels/HttpsChannelFactory.cs | 4 +- .../Channels/NamedPipeChannelFactory.cs | 4 +- .../Channels/PeerUnsafeNativeMethods.cs | 5 +- .../SecurityBindingElementImporter.cs | 5 +- .../Channels/SecurityChannelFactory.cs | 5 +- .../Channels/SessionConnectionReader.cs | 5 +- .../SymmetricSecurityBindingElement.cs | 5 +- .../Channels/TransactionFlowBindingElement.cs | 5 +- .../TransportSecurityBindingElement.cs | 5 +- .../ServiceModelExtensionCollectionElement.cs | 11 +- .../Configuration/SslStreamSecurityElement.cs | 5 +- .../UseManagedPresentationElement.cs | 5 +- .../Description/ClientCredentials.cs | 4 +- .../Description/MetadataExchangeClient.cs | 15 +- .../Description/ServiceMetadataExtension.cs | 5 +- .../ServiceModel/Description/TypeLoader.cs | 4 +- .../WsdlEndpointConversionContext.cs | 8 +- .../ServiceModel/Description/WsdlHelper.cs | 4 +- .../ServicePerformanceCountersBase.cs | 5 +- .../Dispatcher/AsyncMethodInvoker.cs | 8 +- .../Dispatcher/MessageQueryTable.cs | 11 +- .../ServiceModel/MessageSecurityVersion.cs | 24 +- .../ClientCredentialsSecurityTokenManager.cs | 4 +- ...dentityModelServiceAuthorizationManager.cs | 8 +- .../ServiceModel/Security/InfoCardHelper.cs | 5 +- ...SessionSymmetricMessageSecurityProtocol.cs | 5 +- ...curitySessionSecurityTokenAuthenticator.cs | 8 +- .../Security/SecuritySessionServerSettings.cs | 5 +- .../Security/SendSecurityHeader.cs | 5 +- .../Tokens/X509SecurityTokenParameters.cs | 8 +- ...SecurityOneDotZeroReceiveSecurityHeader.cs | 5 +- .../Security/WSTrustChannelFactory.cs | 4 +- .../ServiceModel/ServiceConfiguration.cs | 18 +- .../Common/ChartTypes/BoxPlotChart.cs | 5 +- .../DynamicData/FilterRepeater.cs | 10 +- .../DynamicData/MetaTable.cs | 7 +- .../ModelProviders/EFAssociationProvider.cs | 12 +- .../Discovery/DiscoveryClientProtocol.cs | 5 +- .../System.Web/Compilation/BuildManager.cs | 24 +- .../Compilation/PageCodeDomTreeGenerator.cs | 5 +- .../BrowserCapabilitiesCodeGenerator.cs | 4 +- .../System.Web/Hosting/HostingEnvironment.cs | 6 +- .../System.Web/HttpApplication.cs | 5 +- .../DataAnnotationsModelMetadataProvider.cs | 9 +- .../System.Web/Routing/ContentPathSegment.cs | 4 +- .../System.Web/Routing/RouteParser.cs | 5 +- .../System.Web/UI/ControlBuilder.cs | 4 +- .../System.Web/UI/TemplateParser.cs | 4 +- .../WebControls/DetailsViewRowsGenerator.cs | 5 +- .../WebControls/GridViewColumnsGenerator.cs | 10 +- .../Rules/CodeDomDecompiler.cs | 5 +- .../Design/Dialogs/ConditionBrowserDialog.cs | 5 +- .../WebServiceResponse.cs | 4 +- .../AuthoringOM/Bind.cs | 5 +- .../System/Activities/Statements/Interop.cs | 17 +- .../Tracking/TrackPoint.cs | 5 +- .../Description/WorkflowOperationBehavior.cs | 4 +- .../Description/WorkflowServiceBehavior.cs | 4 +- .../WorkflowInstanceContextProvider.cs | 4 +- .../Dispatcher/WorkflowOperationInvoker.cs | 4 +- .../System.Xml.Linq/System/Xml/Linq/XLinq.cs | 10 +- .../Xml/Schema/DataTypeImplementation.cs | 20 +- .../System/Xml/Serialization/CodeExporter.cs | 5 +- .../microsoft/visualbasic/VBCodeProvider.cs | 8 +- .../system/codedom/compiler/CodeCompiler.cs | 8 +- .../componentmodel/DebugTypeDescriptor.cs | 5 +- .../system/componentmodel/TypeDescriptor.cs | 5 +- .../permissions/ResourcePermissionBase.cs | 6 +- .../SystemIPGlobalProperties.cs | 5 +- .../System/net/System/Net/_Connection.cs | 3 +- .../Tasks/Xaml/PartialClassGenerationTask.cs | 4 +- .../mscorlib/system/appdomainmanager.cs | 5 +- .../diagnostics/contracts/contractsbcl.cs | 4 +- .../TraceLogging/TraceLoggingDataCollector.cs | 5 +- .../mscorlib/system/environment.cs | 21 +- .../globalization/datetimeformatinfo.cs | 6 +- .../mscorlib/system/io/longpath.cs | 25 +- .../mscorlib/system/progress.cs | 5 +- .../referencesource/mscorlib/system/rttype.cs | 6 +- .../mscorlib/system/runtime/remoting/soap.cs | 6 +- .../security/permissions/fileiopermission.cs | 9 +- .../mscorlib/system/text/decoder.cs | 5 +- .../mscorlib/system/text/encoder.cs | 5 +- .../Tasks/ConcurrentExclusiveSchedulerPair.cs | 6 +- .../system/threading/Tasks/TaskScheduler.cs | 5 +- mono/mcs/mcs/anonymous.cs | 4 +- mono/mcs/mcs/assembly.cs | 4 +- mono/mcs/mcs/eval.cs | 4 +- mono/mcs/mcs/parameter.cs | 5 +- mono/mcs/mcs/property.cs | 5 +- mono/mcs/tests/gtest-lambda-06.cs | 4 +- .../cil-strip/Mono.Cecil.Cil/CodeWriter.cs | 10 +- .../mono-symbolicate/LocationProvider.cs | 13 +- .../OracleSchemaLoader.Constraints.cs | 23 +- .../OracleSchemaLoader.StoredProcedures.cs | 4 +- .../DbLinq.PostgreSql/PgsqlSchemaLoader.cs | 12 +- .../src/DbLinq.Sqlite/SqliteSchemaLoader.cs | 4 +- .../src/DbLinq/Vendor/DbSchemaLoader.cs | 4 +- .../Vendor/Implementation/SchemaLoader.cs | 4 +- .../src/DbMetal/Generator/CodeDomGenerator.cs | 37 +- .../svcutil/MoonlightChannelBaseExtension.cs | 12 +- moq4/src/Moq.Tests/ActionObserverFixture.cs | 3 +- moq4/src/Moq.Tests/CallbacksFixture.cs | 190 +- .../Moq.Tests/CustomTypeMatchersFixture.cs | 15 +- moq4/src/Moq.Tests/Demo.cs | 4 +- .../Moq.Tests/Linq/QueryableMocksFixture.cs | 7 +- .../Matchers/ConstantMatcherFixture.cs | 8 +- moq4/src/Moq.Tests/MockedEventsFixture.cs | 15 +- .../Regressions/IssueReportsFixture.cs | 95 +- moq4/src/Moq.Tests/ReturnsFixture.cs | 95 +- moq4/src/Moq.Tests/SetupTaskResultFixture.cs | 18 +- moq4/src/Moq.Tests/ThrowsFixture.cs | 95 +- .../Moq/Interception/CastleProxyFactory.cs | 11 +- .../Moq/Matchers/MatcherAttributeMatcher.cs | 25 +- moq4/src/Moq/Mock.cs | 16 +- .../ConvertProgramAnalysis_ProgramMain.cs | 4 +- ...eStructFieldsWritableDiagnosticAnalyzer.cs | 9 +- ...placedUsingDirectivesDiagnosticAnalyzer.cs | 15 +- ...essionClausePlacementDiagnosticAnalyzer.cs | 22 +- ...ecutiveBracePlacementDiagnosticAnalyzer.cs | 13 +- ...rInitializerPlacementDiagnosticAnalyzer.cs | 13 +- .../UseCollectionExpressionHelpers.cs | 32 +- .../UseIndexOrRangeOperator/Helpers.cs | 24 +- ...SharpUseLocalFunctionDiagnosticAnalyzer.cs | 15 +- .../CSharpAsAndNullCheckDiagnosticAnalyzer.cs | 17 +- ...UsePrimaryConstructorDiagnosticAnalyzer.cs | 25 +- .../ConvertToRecord/ConvertToRecordHelpers.cs | 24 +- .../PositionalParameterInfo.cs | 25 +- ...ateWithConditionalAccessCodeFixProvider.cs | 4 +- .../MakeLocalFunctionStaticCodeFixHelper.cs | 23 +- ...uredVariablesAsArgumentsCodeFixProvider.cs | 11 +- ...MakeStructMemberReadOnlyCodeFixProvider.cs | 12 +- ...beddedStatementPlacementCodeFixProvider.cs | 4 +- ...moveConfusingSuppressionCodeFixProvider.cs | 4 +- .../CSharpUseDefaultLiteralCodeFixProvider.cs | 7 +- ...yConstructorCodeFixProvider_DocComments.cs | 12 +- .../UseSimpleUsingStatementCodeFixProvider.cs | 12 +- ...nInterpolatedStringCodeFixProviderTests.cs | 4 +- .../Tests/NamingStyles/NamingStylesTests.cs | 12 +- ...ForNullableTernaryConditionalCheckTests.cs | 4 +- ...ccessibilityModifiersDiagnosticAnalyzer.cs | 9 +- .../DeserializationConstructorCheck.cs | 5 +- ...iveStatementPlacementDiagnosticAnalyzer.cs | 9 +- ...bstractOrderModifiersDiagnosticAnalyzer.cs | 9 +- ...AttributeSuppressionsDiagnosticAnalyzer.cs | 5 +- ...sDiagnosticAnalyzer.SymbolStartAnalyzer.cs | 4 +- ...edParametersAndValuesDiagnosticAnalyzer.cs | 5 +- ...bstractUseCollectionInitializerAnalyzer.cs | 4 +- .../AddParameter/AddParameterService.cs | 9 +- ...bstractMakeFieldReadonlyCodeFixProvider.cs | 4 +- ...geNamespaceToMatchFolderCodeFixProvider.cs | 9 +- .../NamingStyle/NamingStyleCodeFixProvider.cs | 4 +- ...tractRemoveAsyncModifierCodeFixProvider.cs | 3 +- ...tractRemoveUnusedMembersCodeFixProvider.cs | 5 +- roslyn/src/CodeStyle/Tools/Program.cs | 11 +- .../Binder/Binder.CapturedParametersFinder.cs | 4 +- .../BinderFactory.BinderFactoryVisitor.cs | 4 +- .../Portable/Binder/Binder_Attributes.cs | 10 +- .../CSharp/Portable/Binder/Binder_Crefs.cs | 12 +- .../Portable/Binder/Binder_Expressions.cs | 26 +- .../Portable/Binder/Binder_Invocation.cs | 9 +- .../Portable/Binder/Binder_Operators.cs | 6 +- .../Portable/Binder/Binder_Statements.cs | 5 +- .../Portable/Binder/Binder_TupleOperators.cs | 8 +- .../Portable/Binder/ForEachLoopBinder.cs | 9 +- .../BinaryOperatorOverloadResolutionResult.cs | 5 +- .../OverloadResolution/OverloadResolution.cs | 22 +- .../Portable/BoundTree/BoundDecisionDag.cs | 7 +- .../CSharp/Portable/CodeGen/EmitStatement.cs | 33 +- .../CommandLine/CSharpCommandLineParser.cs | 11 +- ...ilation.UsingsFromOptionsAndDiagnostics.cs | 4 +- .../Compilation/DeconstructionInfo.cs | 9 +- ...SpeculativeSemanticModelWithMemberModel.cs | 4 +- ...nCommentCompiler.IncludeElementExpander.cs | 11 +- .../Portable/Emitter/Model/PEModuleBuilder.cs | 13 +- .../FlowAnalysis/ControlFlowAnalysis.cs | 6 +- .../Portable/FlowAnalysis/NullableWalker.cs | 26 +- .../AsyncExceptionHandlerRewriter.cs | 20 +- .../ClosureConversion.Analysis.cs | 7 +- .../ClosureConversion/ClosureConversion.cs | 5 +- .../Lowering/LocalRewriter/LocalRewriter.cs | 13 +- .../LocalRewriter_CollectionExpression.cs | 5 +- ...writer_DeconstructionAssignmentOperator.cs | 4 +- .../LocalRewriter_StringConcat.cs | 5 +- .../LocalRewriter_UsingStatement.cs | 13 +- .../IteratorAndAsyncCaptureWalker.cs | 4 +- .../Operations/CSharpOperationFactory.cs | 18 +- .../SymbolDisplayVisitor_Minimal.cs | 7 +- .../Portable/Symbols/ConstraintsHelper.cs | 5 +- .../FunctionPointerMethodSymbol.cs | 5 +- .../Symbols/Metadata/PE/PEFieldSymbol.cs | 9 +- .../Symbols/Metadata/PE/PENamedTypeSymbol.cs | 9 +- .../Symbols/Metadata/PE/PEPropertySymbol.cs | 16 +- .../Symbols/PublicModel/NamedTypeSymbol.cs | 8 +- .../Source/ConstantEvaluationHelpers.cs | 14 +- .../Symbols/Source/CustomModifierUtils.cs | 34 +- .../Symbols/Source/SourceAssemblySymbol.cs | 44 +- .../Source/SourceComplexParameterSymbol.cs | 5 +- ...berContainerSymbol_ImplementationChecks.cs | 17 +- .../SourceMethodSymbolWithAttributes.cs | 13 +- .../Symbols/Source/SourceNamedTypeSymbol.cs | 17 +- .../Symbols/Source/SourceNamespaceSymbol.cs | 5 +- .../Source/SourceTypeParameterSymbol.cs | 4 +- .../CSharp/Portable/Symbols/Symbol.cs | 10 +- .../Records/SynthesizedRecordDeconstruct.cs | 4 +- .../CSharp/Portable/Symbols/VarianceSafety.cs | 9 +- .../CSharp/Portable/Syntax/LambdaUtilities.cs | 8 +- .../Test/CommandLine/CommandLineTests.cs | 12 +- .../Emit/CodeGen/CodeGenAsyncLocalsTests.cs | 20 +- .../CodeGen/CodeGenOverridingAndHiding.cs | 4 +- .../Test/Emit/CodeGen/DestructorTests.cs | 66 +- .../CSharp/Test/Emit/CodeGen/SwitchTests.cs | 11 +- .../Test/Emit/Emit/CompilationEmitTests.cs | 29 +- .../EditAndContinue/EditAndContinueTests.cs | 79 +- .../EditAndContinue/SymbolMatcherTests.cs | 32 +- .../Test/Emit/PDB/PDBSourceLinkTests.cs | 6 +- .../Attributes/AttributeTests_Assembly.cs | 30 +- .../Attributes/AttributeTests_Nullable.cs | 43 +- .../Attributes/AttributeTests_Synthesized.cs | 11 +- .../InternalsVisibleToAndStrongNameTests.cs | 9 +- .../Emit2/Semantics/PatternMatchingTests.cs | 22 +- .../IOperation/IOperation/IOperationTests.cs | 15 +- ...rationTests_IDelegateCreationExpression.cs | 4 +- .../Test/Semantic/Semantics/ConstantTests.cs | 48 +- .../Semantic/Semantics/DelegateTypeTests.cs | 4 +- .../Test/Semantic/Semantics/ImportsTests.cs | 5 +- .../Test/Semantic/Semantics/LambdaTests.cs | 20 +- .../Test/Semantic/Semantics/LookupTests.cs | 68 +- .../Test/Semantic/Semantics/NameOfTests.cs | 16 +- .../Test/Semantic/Semantics/OperatorTests.cs | 15 +- .../Semantic/Semantics/SemanticErrorTests.cs | 1 + .../Semantics/TopLevelStatementsTests.cs | 12 +- .../Test/Semantic/Semantics/UnsafeTests.cs | 3 +- .../GeneratorDriverFuzzTests.cs | 40 +- .../SourceGeneration/StateTableTests.cs | 6 +- .../GetUnusedImportDirectivesTests.cs | 2 + .../SemanticModelGetDeclaredSymbolAPITests.cs | 27 +- .../Symbol/Compilation/UsedAssembliesTests.cs | 32 +- .../Symbol/DocumentationComments/CrefTests.cs | 57 +- .../DocumentationModeTests.cs | 26 +- .../CheckedUserDefinedOperatorsTests.cs | 120 +- .../Symbols/InterfaceImplementationTests.cs | 10 +- .../Symbols/Metadata/PE/TypeForwarders.cs | 33 +- .../Symbol/Symbols/MissingSpecialMember.cs | 1 + .../Symbol/Symbols/Source/PropertyTests.cs | 27 +- .../StaticAbstractMembersInInterfacesTests.cs | 540 ++-- .../Test/Syntax/Diagnostics/LocationsTests.cs | 5 +- .../Test/Syntax/LexicalAndXml/LexicalTests.cs | 7 +- .../Syntax/Parsing/LanguageVersionTests.cs | 9 +- .../Parsing/LocalFunctionParsingTests.cs | 4 +- .../Syntax/Syntax/StructuredTriviaTests.cs | 4 +- .../Test/WinRT/Metadata/WinMdDumpTest.cs | 8 +- .../AnalyzerDriver/DeclarationComputer.cs | 4 +- .../AnalyzerAssemblyLoaderTests.cs | 13 +- .../Analyzers/AnalyzerConfigTests.cs | 4 +- .../Analyzers/AnalyzerFileReferenceTests.cs | 7 +- .../Collections/DebuggerAttributes.cs | 12 +- .../ImmutableSegmentedDictionaryTest.cs | 7 +- .../Collections/ImmutableSegmentedListTest.cs | 12 +- .../Emit/EmitBaselineTests.cs | 4 +- .../MetadataHelpersTests.cs | 9 +- .../GenerateMSBuildEditorConfig.cs | 4 +- .../Core/Portable/CodeGen/ILBuilder.cs | 7 +- .../IdentifierCollection.Collection.cs | 4 +- .../Portable/CommandLine/CommonCompiler.cs | 23 +- .../DiagnosticAnalyzer/AnalyzerDriver.cs | 51 +- ...sageAttributeState.TargetSymbolResolver.cs | 23 +- .../SuppressMessageAttributeState.cs | 7 +- .../DeletedSourceDefinition.cs | 7 +- .../Emit/EditAndContinue/SymbolMatcher.cs | 15 +- .../MetadataReader/MetadataDecoder.cs | 5 +- .../Operations/ControlFlowGraphBuilder.cs | 24 +- .../CommonReferenceManager.State.cs | 16 +- .../SourceGeneration/GeneratorDriver.cs | 22 +- .../Nodes/SharedInputNodes.cs | 12 +- .../Core/Portable/Syntax/GreenNode.cs | 5 +- .../Core/Portable/Syntax/SyntaxNode.cs | 4 +- .../Core/RebuildTest/CSharpRebuildTests.cs | 4 +- .../CompilationRebuildArtifactResolver.cs | 7 +- .../Compilers/Test/Core/Assert/AssertEx.cs | 12 +- .../Core/Compilation/CompilationExtensions.cs | 17 +- .../Compilation/ControlFlowGraphVerifier.cs | 30 +- .../Core/Compilation/TestOperationVisitor.cs | 5 +- .../Test/Core/CompilationVerifier.cs | 9 +- .../CouldHaveMoreSpecificTypeAnalyzer.cs | 4 +- .../Core/Diagnostics/OperationTestAnalyzer.cs | 4 +- ...ssageAttributeTests.DiagnosticAnalyzers.cs | 13 +- .../Diagnostics/ThrowingDiagnosticAnalyzer.cs | 4 +- .../Test/Core/Metadata/ILBuilderVisualizer.cs | 16 +- .../Test/Core/Metadata/MetadataReaderUtils.cs | 17 +- .../Platform/Custom/SigningTestHelpers.cs | 5 +- .../Test/Utilities/CSharp/CSharpTestBase.cs | 34 +- .../Utilities/CSharp/CompilationTestUtils.cs | 11 +- .../CSharp/FunctionPointerUtilities.cs | 8 +- .../Collections/SegmentedDictionary`2.cs | 60 +- .../Collections/SegmentedList`1.cs | 4 +- ...utomaticLineEnderCommandHandler_Helpers.cs | 9 +- ...EventHookupCommandHandler_TabKeyCommand.cs | 5 +- .../KnownSourcePasteProcessor.cs | 4 +- .../StringCopyPasteCommandHandler_CutCopy.cs | 5 +- .../ChangeSignature/RemoveParametersTests.cs | 8 +- ...rpToggleBlockCommentCommandHandlerTests.cs | 5 +- .../ArgumentProviderOrderTests.cs | 24 +- .../AbstractCSharpCompletionProviderTests.cs | 4 +- .../CompletionProviderOrderTests.cs | 24 +- ...sionMethodImportCompletionProviderTests.cs | 7 +- .../OverrideCompletionProviderTests.cs | 12 +- .../ProximityExpressionsGetterTestFile.cs | 4 +- .../DiagnosticAnalyzerDriverTests.cs | 102 +- .../EditorConfigNamingStyleParserTests.cs | 16 +- ...emoveUnnecessaryPragmaSuppressionsTests.cs | 4 +- .../Suppression/SuppressionTests.cs | 13 +- .../EncapsulateFieldTestState.cs | 4 +- .../ExtractMethod/ExtractMethodBase.cs | 7 +- .../CSharpTest/Intents/IntentTestsBase.cs | 4 +- .../CSharpTest/NavigateTo/NavigateToTests.cs | 82 +- .../AbstractPdbSourceDocumentTests.cs | 23 +- .../RawStringLiteralCommandHandlerTests.cs | 4 +- .../StringCopyPasteCommandHandlerTests.cs | 8 +- .../CSharpTest/SymbolKey/SymbolKeyTests.cs | 4 +- .../KeywordRecommenderTests.cs | 4 +- .../Recommendations/RecommenderTests.cs | 6 +- .../UI/InlineRenameAdornmentProvider.cs | 31 +- ...ableSymbolService.NavigableSymbolSource.cs | 9 +- .../Preview/DifferenceViewerPreview.cs | 8 +- .../AbstractAddImportsPasteCommandHandler.cs | 4 +- .../CodeActionEditHandlerService.cs | 4 +- .../DefinitionContextTracker.cs | 4 +- .../AbstractCommentSelectionBase.cs | 38 +- .../ToggleLineCommentCommandHandler.cs | 4 +- ....SingleDiagnosticKindPullTaggerProvider.cs | 7 +- ...tractDocumentationCommentCommandHandler.cs | 45 +- .../EditAndContinueLanguageService.cs | 25 +- .../Aggregator/SettingsAggregator.cs | 9 +- .../Data/AnalyzerSetting.cs | 4 +- .../AbstractEditorNavigationBarItemService.cs | 8 +- ...AddMissingImportsFeatureServiceAccessor.cs | 15 +- .../VSTypeScriptBlockStructureService.cs | 23 +- ...STypeScriptNavigableItemsServiceFactory.cs | 3 +- .../Formatting/FormatCommandHandler.Paste.cs | 5 +- .../GoToDefinitionCommandHandler.cs | 4 +- ...lineRenameSession.OpenTextBufferManager.cs | 110 +- .../AsyncCompletion/CommitManager.cs | 9 +- .../AsyncCompletion/CompletionSource.cs | 18 +- .../AsyncCompletion/ItemManager.cs | 4 +- .../ExecuteInInteractiveCommandHandler.cs | 3 +- ...rojectionBufferFactoryServiceExtensions.cs | 3 +- .../Shared/Utilities/LinkedEditsTracker.cs | 16 +- ...actAsynchronousTaggerProvider.TagSource.cs | 15 +- ...ousTaggerProvider.TagSource_ProduceTags.cs | 11 +- .../ChangeSignatureTestState.cs | 4 +- .../AbstractSuppressionAllCodeTests.cs | 4 +- .../Test/AssemblyReferenceTests.cs | 4 +- .../Test/CodeFixes/CodeFixServiceTests.cs | 26 +- .../CodeGeneration/CodeGenerationTests.cs | 21 +- .../CodeRefactoringServiceTest.cs | 18 +- ...ntUncommentSelectionCommandHandlerTests.cs | 18 +- .../Test/Completion/CompletionServiceTests.cs | 4 +- .../DiagnosticAnalyzerServiceTests.cs | 98 +- .../ActiveStatementsMapTests.cs | 4 +- .../EditSessionActiveStatementsTests.cs | 84 +- .../RemoteEditAndContinueServiceTests.cs | 9 +- .../Test/Preview/PreviewWorkspaceTests.cs | 13 +- .../SolutionCrawler/WorkCoordinatorTests.cs | 22 +- .../AbstractCommandHandlerTestState.cs | 4 +- .../TestChangeSignatureOptionsService.cs | 9 +- .../AbstractToggleCommentTestBase.cs | 4 +- .../AbstractArgumentProviderTests`1.cs | 5 +- .../TestAnalyzerReferenceByLanguage.cs | 11 +- .../ActiveStatementsDescription.cs | 60 +- .../EditAndContinueTestHelpers.cs | 29 +- .../RudeEditDiagnosticDescription.cs | 4 +- .../Extensions/ExportProviderExtensions.cs | 14 +- .../Formatting/CoreFormatterTestsBase.cs | 19 +- .../AbstractLanguageServerProtocolTests.cs | 113 +- .../AbstractLspBuildOnlyDiagnosticsTests.cs | 8 +- .../Semantics/SpeculationAnalyzerTestsBase.cs | 14 +- .../TestUtilities/Workspaces/TestWorkspace.cs | 17 +- .../TestWorkspace_XmlConsumption.cs | 11 +- .../Text/Extensions.SnapshotSourceText.cs | 26 +- .../XunitHook/XunitDisposeHook.cs | 3 +- .../ExpressionCompiler/CompilationContext.cs | 23 +- .../ExpressionCompiler/EvaluationContext.cs | 21 +- .../Symbols/ObjectIdLocalSymbol.cs | 27 +- .../ExpressionCompilerTests.cs | 12 +- .../ExpressionCompiler/HoistedThisTests.cs | 18 +- .../ExpressionCompiler/UsingDebugInfoTests.cs | 33 +- .../ExpressionCompiler/InstructionDecoder.cs | 5 +- .../PDB/MethodDebugInfo.Native.cs | 18 +- .../Source/ResultProvider/ResultProvider.cs | 5 +- .../ExpressionCompilerTestHelpers.cs | 31 +- ...essAndGreaterThanBraceCompletionService.cs | 4 +- .../CSharpChangeSignatureService.cs | 18 +- ...enerateDeconstructMethodCodeFixProvider.cs | 15 +- ...FunctionToMethodCodeRefactoringProvider.cs | 42 +- .../CSharpChangeNamespaceService.cs | 4 +- .../PartialMethodCompletionProvider.cs | 4 +- .../SnippetCompletionProvider.cs | 11 +- .../CheckedKeywordRecommender.cs | 4 +- ...CSharpConvertLinqQueryToForEachProvider.cs | 28 +- .../DefaultConverter.cs | 21 +- ...gularConstructorCodeRefactoringProvider.cs | 49 +- .../ConvertProgramTransform_ProgramMain.cs | 7 +- ...ressionsService_ExpressionTermCollector.cs | 4 +- ...SharpDocumentationCommentSnippetService.cs | 19 +- .../CSharpEditAndContinueAnalyzer.cs | 19 +- .../EditAndContinue/SyntaxUtilities.cs | 4 +- .../PythiaDeclarationNameRecommender.cs | 15 +- ...harpMethodExtractor.CSharpCodeGenerator.cs | 49 +- .../CSharpMethodExtractor.TriviaResult.cs | 4 +- .../CSharpSelectionResult.ExpressionResult.cs | 5 +- .../ExtractMethod/CSharpSelectionValidator.cs | 254 +- .../Portable/ExtractMethod/Extensions.cs | 7 +- .../CSharpGenerateConstructorService.cs | 27 +- ...geImplementationCodeRefactoringProvider.cs | 8 +- ...tructorParameterCodeRefactoringProvider.cs | 4 +- ...calForExpressionCodeRefactoringProvider.cs | 17 +- ...IntroduceVariableService_IntroduceLocal.cs | 42 +- .../AttributeSignatureHelpProvider.cs | 21 +- ...ntAccessExpressionSignatureHelpProvider.cs | 31 +- .../GenericNameSignatureHelpProvider.cs | 47 +- ...vocationExpressionSignatureHelpProvider.cs | 4 +- ...onSignatureHelpProviderBase_MethodGroup.cs | 23 +- ...onstructorBaseTypeSignatureHelpProvider.cs | 25 +- .../TupleConstructionSignatureHelpProvider.cs | 19 +- .../CSharpUseAutoPropertyCodeFixProvider.cs | 4 +- .../CSharpTest/AddUsing/AddUsingNuGetTests.cs | 449 ++- ...ateEqualsAndGetHashCodeFromMembersTests.cs | 14 +- .../AddImport/SymbolReferenceFinder.cs | 97 +- .../AddMissingReferenceCodeAction.cs | 4 +- .../AbstractChangeSignatureService.cs | 12 +- .../ChangeSignature/SignatureChange.cs | 8 +- .../AbstractSuppressionBatchFixAllProvider.cs | 17 +- .../CodeLens/CodeLensReferencesService.cs | 18 +- .../AbstractMoveTypeService.MoveTypeEditor.cs | 16 +- .../MoveType/AbstractMoveTypeService.State.cs | 5 +- .../AbstractChangeNamespaceService.cs | 87 +- ...eRefactoringProvider.MoveFileCodeAction.cs | 18 +- .../Portable/Completion/CompletionService.cs | 63 +- .../CompletionService_GetCompletions.cs | 27 +- .../AbstractDocCommentCompletionProvider.cs | 46 +- ...AbstractPartialMethodCompletionProvider.cs | 17 +- .../AbstractImportCompletionProvider.cs | 4 +- .../AbstractTypeImportCompletionService.cs | 4 +- .../ExtensionMethodImportCompletionHelper.cs | 4 +- .../Providers/SymbolCompletionItem.cs | 3 +- ...ymousTypeToClassCodeRefactoringProvider.cs | 12 +- ...onvertIfToSwitchCodeRefactoringProvider.cs | 12 +- ...ToInterpolatedStringRefactoringProvider.cs | 7 +- .../AbstractHostDiagnosticUpdateSource.cs | 4 +- .../EditAndContinue/DebuggingSession.cs | 13 +- .../DebuggingSessionTelemetry.cs | 7 +- .../EditAndContinueDocumentAnalysesCache.cs | 43 +- .../Portable/EditAndContinue/EditSession.cs | 27 +- .../AbstractEmbeddedLanguageFeatureService.cs | 4 +- .../EmbeddedLanguages/Json/JsonParser.cs | 4 +- ...mpilationOutputFilesWithImplicitPdbPath.cs | 8 +- .../API/UnitTestingSearchHelpers.cs | 21 +- ...UnitTestingIncrementalAnalyzerProcessor.cs | 8 +- ...ator.UnitTestingNormalPriorityProcessor.cs | 4 +- .../VSTypeScriptDocumentDiagnosticAnalyzer.cs | 8 +- .../Watch/Api/WatchHotReloadService.cs | 19 +- .../MethodExtractor.CodeGenerator.cs | 4 +- .../Formatting/FormattingRuleUtilities.cs | 4 +- .../AbstractFullyQualifyService.cs | 56 +- ...GenerateConstructorWithDialogCodeAction.cs | 11 +- ...uctorFromMembersCodeRefactoringProvider.cs | 7 +- ...nerateDefaultConstructorCodeFixProvider.cs | 5 +- ...aultConstructorsCodeRefactoringProvider.cs | 5 +- ...nerateEqualsAndHashWithDialogCodeAction.cs | 12 +- .../AbstractGenerateConstructorService.cs | 9 +- ...erizedMemberService.MethodSignatureInfo.cs | 7 +- ...enerateParameterizedMemberService.State.cs | 17 +- .../AbstractGenerateTypeService.CodeAction.cs | 4 +- .../AbstractGenerateTypeService.Editor.cs | 29 +- .../AbstractGenerateTypeService.State.cs | 5 +- .../GoToBase/AbstractGoToBaseService.cs | 7 +- .../Highlighting/HighlightingService.cs | 3 +- ...terfaceService.DisposePatternCodeAction.cs | 4 +- ...erCodeRefactoringProviderMemberCreation.cs | 8 +- ...efactoringProvider.MethodParametersInfo.cs | 55 +- ...AbstractInlineMethodRefactoringProvider.cs | 7 +- ...troduceParameterCodeRefactoringProvider.cs | 8 +- ...ceUsingStatementCodeRefactoringProvider.cs | 11 +- .../AbstractIntroduceVariableService.State.cs | 12 +- .../AbstractIntroduceVariableService.cs | 10 +- .../DocumentationCommentUtilities.cs | 6 +- ...ionNearReferenceCodeRefactoringProvider.cs | 10 +- .../MoveStaticMembersWithDialogCodeAction.cs | 41 +- .../AbstractMoveToNamespaceService.cs | 15 +- ...ateToSearchService.CachedDocumentSearch.cs | 21 +- .../NavigateTo/INavigateToSearcherHost.cs | 4 +- .../Portable/NavigateTo/NavigateToSearcher.cs | 9 +- .../NavigateTo/NavigateToUtilities.cs | 5 +- .../Navigation/NavigableItemFactory.cs | 4 +- .../Organizing/AbstractOrganizingService.cs | 3 +- ...rceDocumentMetadataAsSourceFileProvider.cs | 41 +- .../Portable/PullMemberUp/MembersPuller.cs | 45 +- .../QuickInfoServiceWithProviders.cs | 10 +- .../Portable/Rename/SymbolicRenameInfo.cs | 19 +- ...pertyWithMethodsCodeRefactoringProvider.cs | 12 +- ...AbstractSimplifyThisOrMeCodeFixProvider.cs | 13 +- ...oordinator.IncrementalAnalyzerProcessor.cs | 25 +- ...WorkCoordinator.NormalPriorityProcessor.cs | 4 +- .../SolutionCrawler/WorkCoordinator.cs | 13 +- .../AbstractSpellCheckSpanService.cs | 5 +- ...ergeIfStatementsCodeRefactoringProvider.cs | 4 +- .../AbstractSyncNamespacesService.cs | 4 +- .../ProjectAssets/ProjectAssetsReader.cs | 43 +- .../ValueTracker.OperationCollector.cs | 5 +- .../Core/Portable/Wrapping/AbstractWrapper.cs | 7 +- .../BrokeredServiceContainer.cs | 5 +- .../BrokeredServices/ServiceBrokerFactory.cs | 5 +- .../BrokeredServiceBridgeManifestService.cs | 27 +- .../FileWatching/LspFileChangeWatcher.cs | 23 +- .../LanguageServerProjectSystem.cs | 7 +- .../Program.cs | 12 +- .../Features/CodeFixes/CodeFixService.cs | 31 +- .../DiagnosticIncrementalAnalyzer.Executor.cs | 18 +- ...alyzer.InProcOrRemoteHostAnalyzerRunner.cs | 7 +- ...ementalAnalyzer.StateManager.HostStates.cs | 4 +- .../CodeActions/CodeActionResolveHelper.cs | 16 +- .../Handler/CodeLens/CodeLensHandler.cs | 3 +- .../CodeLens/CodeLensRefreshQueueFactory.cs | 5 +- ...tractLspCompletionResultCreationService.cs | 4 +- .../Handler/Completion/CompletionHandler.cs | 9 +- .../Completion/CompletionResolveHandler.cs | 9 +- ...AbstractWorkspacePullDiagnosticsHandler.cs | 4 +- .../Diagnostics/DiagnosticsRefreshQueue.cs | 5 +- .../FoldingRanges/FoldingRangesHandler.cs | 5 +- .../Protocol/Handler/Hover/HoverHandler.cs | 4 +- .../InlayHint/InlayHintRefreshQueueFactory.cs | 5 +- .../InlineCompletionsHandler.cs | 4 +- .../Handler/MapCode/MapCodeHandler.cs | 19 +- .../OnAutoInsert/OnAutoInsertHandler.cs | 5 +- .../SemanticTokens/SemanticTokensHelpers.cs | 9 +- .../SemanticTokens/SemanticTokensSchema.cs | 14 +- .../Protocol/LspServices/LspServices.cs | 18 +- .../Workspaces/LspWorkspaceManager.cs | 4 +- .../CodeActions/CodeActionsTests.cs | 15 +- .../CodeLens/AbstractCodeLensTests.cs | 13 +- .../Completion/CompletionResolveTests.cs | 4 +- ...ngeConfigurationNotificationHandlerTest.cs | 17 +- .../AdditionalFileDiagnosticsTests.cs | 5 +- .../FoldingRanges/FoldingRangesTests.cs | 14 +- .../ProtocolUnitTests/Hover/HoverTests.cs | 4 +- .../InlayHint/AbstractInlayHintTests.cs | 4 +- .../TestSnippetInfoService.cs | 9 +- .../FindAllReferencesHandlerTests.cs | 27 +- .../SemanticTokensRangeTests.cs | 4 +- .../LspWorkspaceRegistrationServiceTests.cs | 4 +- .../InteractiveAssemblyLoader.cs | 4 +- roslyn/src/Scripting/Core/Script.cs | 4 +- .../CoreTestUtilities/ScriptingTestHelpers.cs | 4 +- .../EditAndContinueTest.GenerationVerifier.cs | 16 +- .../Reader/MethodDebugInfoBytes.cs | 11 +- .../Test/PdbUtilities/Reader/PdbValidation.cs | 10 +- .../DiagnosticAnalyzerRunner.cs | 9 +- .../IncrementalAnalyzerRunner.cs | 18 +- .../Editor/FSharpEditorInlineRenameService.cs | 20 +- .../InlineHints/FSharpInlineHintsService.cs | 8 +- .../FSharpVisualStudioWorkspaceExtensions.cs | 9 +- .../OmniSharpInlineHintsService.cs | 17 +- .../RazorDocumentServiceProviderWrapper.cs | 4 +- .../IdeCoreBenchmarks/NavigateToBenchmarks.cs | 53 +- roslyn/src/Tools/PrepareTests/MinimizeUtil.cs | 4 +- .../CSharpSyntaxGenerator/SourceWriter.cs | 37 +- .../IOperationClassWriter.cs | 26 +- .../Impl/CodeModel/CSharpCodeModelService.cs | 16 +- .../CSharpProjectShim.ICSharpProjectSite.cs | 11 +- .../CodeModel/FileCodeModelTestHelpers.cs | 9 +- .../AnalyzerDependencyChecker.cs | 5 +- .../AnalyzerFileWatcherService.cs | 4 +- .../Finders/AbstractCallFinder.cs | 13 +- .../Finders/ImplementerFinder.cs | 8 +- ...tureDialogViewModel.ParameterViewModels.cs | 8 +- .../CodeCleanup/AbstractCodeCleanUpFixer.cs | 5 +- .../MemberSelectionViewModel.cs | 36 +- ...DebuggerTextView.HACK_CompletionSession.cs | 3 +- ...AnalyzerProvider.WorkspaceEventListener.cs | 9 +- .../DocumentOutlineViewModel_Utilities.cs | 4 +- .../VisualStudioExtractClassOptionsService.cs | 26 +- .../IFindAllReferencesWindowExtensions.cs | 4 +- .../Implementation/AbstractEditorFactory.cs | 5 +- .../AbstractVsTextViewFilter.cs | 9 +- .../HierarchyItemToProjectIdMap.cs | 10 +- .../InheritanceMarginViewMarginProvider.cs | 4 +- .../MarginGlyph/InheritanceMarginGlyph.cs | 4 +- .../Interactive/VsInteractiveWindowPackage.cs | 4 +- .../Def/Interactive/VsResetInteractive.cs | 12 +- ...ctLanguageService`2.VsCodeWindowManager.cs | 12 +- .../StaticMemberSelectionViewModel.cs | 4 +- ...alStudioMoveStaticMembersOptionsService.cs | 40 +- .../RoslynNavigateToSearchCallback.cs | 15 +- .../Core/Def/Preview/PreviewEngine.cs | 35 +- .../Core/Def/Preview/PreviewUpdater.Tagger.cs | 4 +- .../Core/Def/Preview/ReferenceChange.cs | 106 +- .../Core/Def/Progression/GraphProvider.cs | 96 +- .../GraphQueries/InheritsGraphQuery.cs | 4 +- .../Def/ProjectSystem/FileChangeWatcher.cs | 15 +- .../VisualStudioProjectFactory.cs | 8 +- ...sualStudioWorkspaceImpl.OpenFileTracker.cs | 4 +- ...aceImpl.RemoveMetadataReferenceUndoUnit.cs | 4 +- .../VisualStudioPullMemberUpService.cs | 26 +- .../AbstractSnippetExpansionClient.cs | 19 +- .../Storage/CloudCachePersistentStorage.cs | 9 +- .../AbstractDelayStartedService.cs | 16 +- .../AbstractTableEntriesSnapshot.cs | 7 +- .../TableDataSource/OpenDocumentTracker.cs | 11 +- ...iagnosticListTable.BuildTableDataSource.cs | 7 +- .../Core/Def/Telemetry/TelemetryLogger.cs | 9 +- .../ValueTrackingCommandHandler.cs | 5 +- .../Core/Def/Venus/ContainedDocument.cs | 13 +- .../ContainedLanguage.IVsContainedCode.cs | 28 +- ...anguage.IVsContainedLanguageCodeSupport.cs | 4 +- .../Core/Impl/Options/AbstractOptionPage.cs | 4 +- .../Options/AbstractOptionPreviewViewModel.cs | 17 +- .../Style/BooleanCodeStyleOptionViewModel.cs | 8 +- .../Style/EnumCodeStyleOptionViewModel.cs | 8 +- .../ManageNamingStylesDialogViewModel.cs | 13 +- .../SymbolSpecificationDialog.xaml.cs | 36 +- ...isualStudioSettingsOptionPersisterTests.cs | 4 +- .../Services/ServiceHubServicesTests.cs | 21 +- .../CSharp/CSharpCodeActions.cs | 7 +- .../CSharp/CSharpGoToImplementation.cs | 19 +- .../CSharp/CSharpRename.cs | 7 +- .../InProcess/WorkspaceInProcess.cs | 5 +- .../InProcess/ChangeSignatureDialog_InProc.cs | 3 +- .../TestUtilities/InProcess/Editor_InProc.cs | 15 +- .../InProcess/SolutionExplorer_InProc.cs | 32 +- .../InProcess/VisualStudioWorkspace_InProc.cs | 58 +- .../RoslynRemoteProjectInfoProvider.cs | 40 +- .../LiveShare/Impl/ProjectsHandler.cs | 4 +- .../VenusMargin/ProjectionSpanTagger.cs | 11 +- .../Handler/Completion/CompletionHandler.cs | 32 +- .../Completion/CompletionResolveHandler.cs | 7 +- .../AbstractPullDiagnosticHandler.cs | 49 +- .../AbstractFormatDocumentHandlerBase.cs | 4 +- .../Formatting/FormatDocumentOnTypeHandler.cs | 4 +- .../Handler/Hover/HoverHandler.cs | 7 +- .../Extensions/SemanticModelExtensions.cs | 8 +- .../CSharpRenameRewriterLanguageService.cs | 53 +- .../CSharpSimplificationService.Expander.cs | 15 +- .../Reducers/CSharpEscapingReducer.cs | 9 +- .../Simplifiers/AbstractCSharpSimplifier.cs | 7 +- .../Core/MSBuild.BuildHost/Program.cs | 17 +- .../Workspaces/Core/MSBuild/Rpc/RpcClient.cs | 4 +- .../Portable/Classification/Classifier.cs | 4 +- .../Core/Portable/CodeFixes/CodeFix.cs | 4 +- .../FixAllOccurrences/BatchFixAllProvider.cs | 4 +- .../FixAllOccurrences/FixAllContext.cs | 15 +- .../CodeFixesAndRefactorings/FixAllLogger.cs | 12 +- .../FixAllOccurences/FixAllState.cs | 16 +- .../Diagnostics/HostDiagnosticAnalyzers.cs | 4 +- .../Core/Portable/Editing/SymbolEditor.cs | 20 +- .../Core/Portable/Editing/SyntaxGenerator.cs | 28 +- .../DeclarationFinder_SourceDeclarations.cs | 4 +- .../FindReferences/DependentTypeFinder.cs | 4 +- .../DependentTypeFinder_ProjectIndex.cs | 4 +- .../Shared/AbstractSyntaxIndex_Persistence.cs | 7 +- .../FindSymbols/SymbolFinder_Helpers.cs | 11 +- .../SymbolTree/SymbolTreeInfo_Metadata.cs | 47 +- ...FileMergeConflictCommentAdditionService.cs | 17 +- .../Portable/Options/SolutionOptionSet.cs | 11 +- .../ContainerPatternMatcher.cs | 8 +- .../AbstractRecommendationServiceRunner.cs | 32 +- .../ConflictResolver.Session.cs | 103 +- .../MutableConflictResolution.cs | 7 +- .../Rename/LightweightRenameLocations.cs | 9 +- .../Core/Portable/Rename/RenameUtilities.cs | 16 +- .../Rename/Renamer.RenameDocumentActionSet.cs | 4 +- ...olicRenameLocations.ReferenceProcessing.cs | 7 +- .../Extensions/ILanguageMetadataExtensions.cs | 11 +- .../Extensions/IMethodSymbolExtensions.cs | 23 +- ...xGeneratorExtensions_CreateEqualsMethod.cs | 8 +- .../AsynchronousOperationListenerProvider.cs | 6 +- .../Shared/Utilities/DocumentationComment.cs | 10 +- .../Portable/Workspace/CommandLineProject.cs | 13 +- .../NoOpPersistentStorage.cs | 5 +- ...ystemProject.BatchingDocumentCollection.cs | 50 +- .../Workspace/Solution/DocumentState.cs | 5 +- .../Workspace/Solution/FileTextLoader.cs | 9 +- .../Solution/ProjectDependencyGraph.cs | 11 +- .../Workspace/Solution/ProjectInfo.cs | 4 +- .../Workspace/Solution/ProjectState.cs | 98 +- .../Portable/Workspace/Solution/Solution.cs | 4 +- ...eneratorDriverTranslationAction_Actions.cs | 8 +- ...tionState.CompilationTracker_Generators.cs | 12 +- .../SolutionState.SkeletonReferenceCache.cs | 7 +- .../Solution/SolutionState_Checksum.cs | 13 +- .../CodeCleanup/FixIncorrectTokenTests.cs | 9 +- .../NormalizeModifiersOrOperatorsTests.cs | 9 +- .../RemoveUnnecessaryLineContinuationTests.cs | 9 +- .../CoreTest/Remote/ServiceDescriptorTests.cs | 36 +- .../ProjectDependencyGraphTests.cs | 16 +- .../SolutionWithSourceGeneratorTests.cs | 4 +- .../CoreTest/UtilityTest/AsyncLazyTests.cs | 25 +- .../TemporaryStorageServiceTests.cs | 4 +- ...EachAdditionalFileWithContentsCommented.cs | 7 +- .../Remote/TestSerializerService.cs | 4 +- .../CoreTestUtilities/WorkspaceExtensions.cs | 4 +- .../Workspaces/MSBuildTest/NetCoreTests.cs | 4 +- .../MSBuildTest/SolutionGeneration.cs | 4 +- .../Remote/ServiceHub/Host/AssetProvider.cs | 3 +- ...vertTupleToStructCodeRefactoringService.cs | 4 +- .../PerformanceTrackerService.cs | 4 +- .../RemoteDocumentHighlightsService.cs | 13 +- ...RemoteGlobalNotificationDeliveryService.cs | 14 +- ...teSemanticClassificationService.Caching.cs | 8 +- .../RemoteUnitTestingSearchService.cs | 14 +- .../RemoteValueTrackingService.cs | 18 +- .../Extensions/ITypeSymbolExtensions.cs | 11 +- .../Extensions/SyntaxTriviaListExtensions.cs | 22 +- .../Rules/ElasticTriviaFormattingRule.cs | 14 +- .../Rules/SuppressFormattingRule.cs | 4 +- .../SelectedMembers/CSharpSelectedMembers.cs | 8 +- .../Simplifiers/CastSimplifier.cs | 4 +- .../TypeStyle/CSharpTypeStyleHelper.cs | 11 +- .../DiagnosticDescriptorExtensions.cs | 27 +- .../Core/Extensions/ITypeSymbolExtensions.cs | 35 +- .../Core/Extensions/OperationExtensions.cs | 3 +- .../Core/Extensions/SyntaxNodeExtensions.cs | 4 +- .../FormattingContext.InitialContextFinder.cs | 14 +- .../AbstractAggregatedFormattingResult.cs | 9 +- ...ditorConfigNamingStyleParser_SymbolSpec.cs | 4 +- .../CodeGeneration/AttributeGenerator.cs | 22 +- .../CSharpCodeGenerationHelpers.cs | 11 +- .../CSharp/CodeGeneration/FieldGenerator.cs | 7 +- .../CodeGeneration/NamedTypeGenerator.cs | 14 +- .../ContextQuery/SyntaxTreeExtensions.cs | 17 +- ...olExtensions.TypeSyntaxGeneratorVisitor.cs | 26 +- .../CSharpIndentationService.Indenter.cs | 5 +- .../CSharpRemoveUnnecessaryImportsService.cs | 4 +- .../CSharpSyntaxGeneratorInternal.cs | 5 +- .../SyntaxEditorBasedCodeFixProvider.cs | 17 +- .../AbstractCodeGenerationService.cs | 3 +- .../CodeGeneration/CodeGenerationHelpers.cs | 8 +- ...veDeclarationNearReferenceService.State.cs | 4 +- .../Core/Workspace/Mef/MefLanguageServices.cs | 11 +- .../Runtime/Dispensers/DispenserAlgorithm.cs | 5 +- .../src/System/Type.NativeAot.cs | 5 +- .../DynamicallyAccessedMembersBinder.cs | 4 +- ...CompilerTypeSystemContext.DynamicInvoke.cs | 11 +- .../InterfaceGenericVirtualMethodTableNode.cs | 4 +- .../NodeFactory.NativeLayout.cs | 19 +- .../DependencyAnalysis/NodeFactory.cs | 119 +- .../DependencyAnalyzer.cs | 4 +- .../Writer/NativeFormatWriterGen.cs | 167 +- .../CodeGen/ReadyToRunObjectWriter.cs | 7 +- .../ReadyToRun/MethodFixupSignature.cs | 4 +- .../ObjectWriter/MapFileBuilder.cs | 5 +- .../ObjectWriter/ProfileFileBuilder.cs | 22 +- .../Extensions/NiceIO.cs | 4 +- .../TestCasesRunner/AssemblyChecker.cs | 141 +- .../TestCasesRunner/TestCaseCollector.cs | 23 +- .../TestCasesRunner/TestCaseCompiler.cs | 8 +- .../TestCaseMetadataProvider.cs | 45 +- .../SignatureTests.cs | 4 +- .../coreclr/tools/aot/crossgen2/Program.cs | 5 +- .../tools/dotnet-pgo/MethodMemoryMap.cs | 4 +- .../src/coreclr/tools/dotnet-pgo/Program.cs | 164 +- .../TraceRuntimeDescToTypeSystemDesc.cs | 8 +- .../coreclr/tools/r2rtest/BuildFolderSet.cs | 30 +- ...mblyVersionResolutionMultipleFrameworks.cs | 58 +- .../RidAssetResolution.cs | 14 +- .../FrameworkResolution/ComplexHierarchies.cs | 13 +- .../IncludedFrameworksSettings.cs | 33 +- ...rdAndRollForwardOnNoCandidateFxSettings.cs | 14 +- .../RollForwardOnNoCandidateFx.cs | 290 +- .../RollForwardOnNoCandidateFxSettings.cs | 124 +- .../RollForwardReleaseAndPreRelease.cs | 9 +- .../RollForwardSettings.cs | 70 +- .../NativeHosting/Nethost.cs | 4 +- .../BundlerConsistencyTests.cs | 22 +- .../RegFreeComManifestTests.cs | 7 +- .../tests/TestUtils/DotNetBuilder.cs | 6 +- .../src/installer/tests/TestUtils/TestApp.cs | 13 +- ...alueProvider_ForAttributeWithSimpleName.cs | 3 +- .../IgnoreAccessChecksToAttributeBuilder.cs | 7 +- .../tests/StaticTestGenerator/Program.cs | 11 +- .../System/IO/Compression/ZipTestHelper.cs | 23 +- .../HttpClientHandlerTest.AutoRedirect.cs | 19 +- .../System/Net/Http/HttpClientHandlerTest.cs | 21 +- .../Prerequisites/NetCoreServer/Startup.cs | 25 +- .../AES/AesCipherTests.cs | 48 +- .../AES/AesContractTests.cs | 4 +- .../DSA/DSASignVerify.cs | 9 +- .../DSA/DSATestData.cs | 10 +- .../EC/EccTestData.cs | 60 +- .../ECDiffieHellmanTests.ImportExport.cs | 24 +- .../ECDsa/ECDsaImportExport.cs | 24 +- .../ECDsa/ECDsaTests.netcoreapp.cs | 45 +- .../RSA/EncryptDecrypt.netcoreapp.cs | 18 +- .../RSA/SignVerify.netcoreapp.cs | 18 +- .../TripleDES/TripleDESCipherTests.cs | 56 +- ...imeBinderInternalCompilerExceptionTests.cs | 5 +- .../tests/CacheServiceExtensionsTests.cs | 12 +- .../gen/Emitter/CoreBindingHelpers.cs | 4 +- .../gen/Specs/TypeIndex.cs | 4 +- .../tests/Common/ConfigurationBinderTests.cs | 7 +- .../ConfigBindingGenTestDriver.cs | 5 +- .../InternalConfigurationRootExtensions.cs | 9 +- .../DependencyInjectionSpecificationTests.cs | 20 +- .../Expressions/ExpressionResolverBuilder.cs | 11 +- .../tests/DI.Tests/CallSiteTests.cs | 6 +- .../DependencyInjectionEventSourceTests.cs | 34 +- .../src/DependencyContextExtensions.cs | 8 +- .../tests/CompilationLibraryTests.cs | 11 +- .../tests/MetricsSubscriptionManagerTests.cs | 4 +- .../tests/UseWindowsServiceTests.cs | 6 +- .../src/HostingHostBuilderExtensions.cs | 17 +- .../UnitTests/ConsoleLifetimeExitTests.cs | 4 +- .../OptionsBuilderExtensionsTests.cs | 17 +- .../HttpClientBuilderExtensions.cs | 36 +- ...lientFactoryServiceCollectionExtensions.cs | 8 +- ...tFactoryServiceCollectionExtensionsTest.cs | 12 +- .../Logging/HttpClientLoggerTest.cs | 70 +- .../SocketsHttpHandlerConfigurationTest.cs | 56 +- .../tests/Common/EventLogLoggerTest.cs | 9 +- .../Common/LoggerBuilderExtensionsTests.cs | 4 +- .../Common/LoggerFactoryExtensionsTest.cs | 50 +- .../tests/Common/LoggerFilterTest.cs | 198 +- .../tests/Common/LoggerTest.cs | 92 +- .../tests/Common/TraceSourceScopeTest.cs | 8 +- .../gen/ParserUtilities.cs | 35 +- .../OptionsMonitorTest.cs | 23 +- .../OptionsTest.cs | 23 +- ...ted.SerializableAssembly.XmlSerializers.cs | 95 +- .../src/System/CodeDom/CodeNamespace.cs | 10 +- .../System/CodeDom/CodeTypeReferenceTests.cs | 4 +- .../CodeDom/Compiler/VBCodeGenerationTests.cs | 10 +- .../tests/BlockingCollectionTests.cs | 7 +- .../tests/ProducerConsumerCollectionTests.cs | 117 +- .../Immutable/ImmutableDictionary.cs | 11 +- .../Immutable/ImmutableSortedDictionary.cs | 11 +- .../tests/ImmutableArrayBuilderTest.cs | 7 +- .../tests/ImmutableArrayTest.cs | 271 +- .../tests/ImmutableDictionaryBuilderTest.cs | 7 +- ...utableDictionaryTestBase.nonnetstandard.cs | 11 +- .../tests/ImmutableHashSetTest.cs | 7 +- .../tests/ImmutableListTest.cs | 7 +- .../tests/ImmutableQueueTest.cs | 7 +- .../tests/ImmutableSortedDictionaryTest.cs | 18 +- .../tests/StackTests.cs | 4 +- .../tests/BitArray/BitArray_GetSetTests.cs | 13 +- .../Composition/Registration/PartBuilder.cs | 12 +- .../Registration/RegistrationBuilder.cs | 4 +- .../Registration/PartBuilderOfTTests.cs | 12 +- .../Hosting/CompositionServices.cs | 7 +- .../ImportEngine.RecompositionManager.cs | 4 +- .../Composition/Hosting/TypeCatalog.cs | 4 +- .../AttributedModel/INotifyImportTests.cs | 5 +- .../Composition/CompositionServicesTests.cs | 7 +- .../Hosting/DirectoryCatalogTests.cs | 7 +- .../FilteredCatalogTransitiveClosureTests.cs | 16 +- .../Hosting/ScopeExtensionsTests.cs | 10 +- .../Composition/MetadataTests.cs | 7 +- .../System/UnitTesting/EqualityExtensions.cs | 20 +- .../System/ComponentModel/TypeDescriptor.cs | 5 +- .../Convention/PartConventionBuilderOfT.cs | 7 +- .../tests/ConventionBuilderTests.cs | 11 +- .../tests/PartBuilderOfTTests.cs | 6 +- .../Hosting/Core/CompositionDependency.cs | 4 +- .../Core/ExportDescriptorRegistryUpdate.cs | 17 +- ...oryWithMetadataExportDescriptorProvider.cs | 58 +- .../Lazy/LazyExportDescriptorProvider.cs | 37 +- .../Metadata/MetadataViewProvider.cs | 19 +- .../OnImportsSatisfiedFeature.cs | 11 +- .../Composition/TypedParts/ContractHelpers.cs | 5 +- .../DictionaryExportDescriptorProvider.cs | 4 +- .../System.Console/tests/KeyParserTests.cs | 16 +- .../src/System/Data/DataTable.cs | 9 +- .../src/System/Data/SortExpressionBuilder.cs | 4 +- .../EnumerableRowCollectionExtensionsTests.cs | 8 +- .../System.Data.OleDb/src/OleDbCommand.cs | 5 +- .../System.Data.OleDb/src/OleDbDataReader.cs | 1 + .../Data/ProviderBase/DbConnectionClosed.cs | 5 +- .../tests/MetricEventSourceTests.cs | 240 +- .../Diagnostics/Reader/UnsafeNativeMethods.cs | 5 +- .../src/System/Diagnostics/Process.Unix.cs | 5 +- .../tests/ProcessStartInfoTests.cs | 40 +- .../tests/ProcessTests.Unix.cs | 4 +- .../AccountManagement/SAM/SAMMembersSet.cs | 5 +- .../ActiveDirectory/ActiveDirectorySite.cs | 5 +- .../ActiveDirectorySiteLink.cs | 5 +- ...rmance.dynamic.context.indexer.regclass.cs | 4 +- ...mance.dynamic.context.operator.regclass.cs | 6 +- .../src/System/Formats/Asn1/AsnWriter.cs | 5 +- .../tests/Reader/CborReaderTests.Tag.cs | 4 +- ...ile.CreateFromDirectoryAsync.File.Tests.cs | 16 +- ...TarFile.ExtractToDirectory.Stream.Tests.cs | 4 +- ...le.ExtractToDirectoryAsync.Stream.Tests.cs | 4 +- .../TarReader.File.Async.Tests.Base.cs | 7 +- .../TarReader/TarReader.File.Tests.Base.cs | 4 +- .../TarWriter.WriteEntryAsync.Tests.cs | 4 +- .../GregorianCalendarAddYears.cs | 5 +- .../GregorianCalendarToDateTime.cs | 5 +- .../KoreanCalendar/KoreanCalendarAddYears.cs | 5 +- .../KoreanCalendarGetDaysInMonth.cs | 5 +- .../KoreanCalendarGetMonthsInYear.cs | 5 +- .../ThaiBuddhistCalendarAddYears.cs | 5 +- .../ThaiBuddhistCalendarGetDaysInMonth.cs | 5 +- .../ThaiBuddhistCalendarGetMonthsInYear.cs | 5 +- .../ThaiBuddhistCalendarIsLeapMonth.cs | 5 +- .../tests/ZipFile.Create.Stream.cs | 3 +- .../tests/ZipArchive/zip_UpdateTests.cs | 5 +- .../tests/FileSystemAclExtensionsTests.cs | 5 +- .../tests/FileSystemWatcher.File.Move.cs | 46 +- .../System.IO.Hashing/tests/Crc64Tests.cs | 16 +- .../System.IO.Packaging/tests/Tests.cs | 7 +- .../NamedPipeTests/NamedPipeTest.Specific.cs | 7 +- .../Expressions/Interpreter/LocalAccess.cs | 5 +- .../tests/CompilerTests.cs | 10 +- .../tests/Dynamic/InvokeMemberBindingTests.cs | 23 +- .../tests/Goto/MakeGoto.cs | 4 +- .../tests/MemberInit/ListBindTests.cs | 44 +- .../Unary/IncDecAssign/IncDecAssignTests.cs | 30 +- .../Combinatorial/SourcesAndOperators.cs | 30 +- .../tests/QueryOperators/MinTests.cs | 18 +- .../QueryOperators/OrderByThenByTests.cs | 44 +- .../src/System/Linq/EnumerableRewriter.cs | 14 +- .../System.Linq.Queryable/tests/Queryable.cs | 12 +- .../System.Linq/tests/ConsistencyTests.cs | 8 +- .../System.Linq/tests/GroupByTests.cs | 24 +- .../tests/ToLookupTests.DebuggerAttributes.cs | 4 +- .../src/System/Management/WMIGenerator.cs | 16 +- .../Binary/ReverseEndiannessUnitTests.cs | 22 +- .../Parser/TestData.Parser.Boolean.cs | 4 +- .../Parser/TestData.Parser.Date.cs | 8 +- .../Parser/TestData.Parser.Guid.cs | 4 +- .../FunctionalTests/WinHttpHandlerTest.cs | 7 +- .../src/System/Net/Http/CancellationHelper.cs | 5 +- .../Net/Http/Headers/HttpRequestHeaders.cs | 81 +- .../HttpClientHandlerTest.Http3.cs | 70 +- ...SocketsHttpHandlerTest.Http2FlowControl.cs | 4 +- .../tests/FunctionalTests/TelemetryTest.cs | 17 +- .../StressTests/HttpStress/StressServer.cs | 17 +- .../UnitTests/Headers/HttpHeadersTest.cs | 4 +- .../src/System/Net/Mail/MailHeaderInfo.cs | 5 +- .../src/System/Net/Mime/ContentDisposition.cs | 6 +- .../tests/FunctionalTests/MetricsTest.cs | 9 +- .../LinuxNetworkInterface.cs | 7 +- .../src/System/Net/CookieContainer.cs | 5 +- .../tests/FunctionalTests/IPNetworkTest.cs | 4 +- .../tests/FunctionalTests/MsQuicTests.cs | 16 +- .../Net/Security/SslConnectionInfo.OSX.cs | 5 +- .../System/Net/Security/SslStream.Protocol.cs | 5 +- .../CertificateValidationRemoteServer.cs | 5 +- .../SslStreamRemoteExecutorTests.cs | 5 +- .../tests/FunctionalTests/TelemetryTest.cs | 8 +- .../FunctionalTests/SocketDuplicationTests.cs | 5 +- .../tests/FunctionalTests/SocketTestHelper.cs | 26 +- .../tests/ClientWebSocketTestBase.cs | 4 +- .../tests/ConnectTest.Http2.cs | 4 +- .../tests/WebSocketCreateTest.cs | 4 +- ...eCollection_ConstructorAndPropertyTests.cs | 7 +- .../ReadOnlyDictionaryTests.cs | 21 +- .../ReadOnlyObservableCollectionTests.cs | 7 +- .../src/System/Array.Enumerators.cs | 4 +- .../Tracing/TraceLogging/XplatEventLogger.cs | 7 +- .../src/System/Progress.cs | 5 +- .../Loader/AssemblyDependencyResolver.cs | 4 +- .../Runtime/Loader/AssemblyLoadContext.cs | 5 +- .../System/Text/DecoderExceptionFallback.cs | 5 +- .../PortableThreadPool.GateThread.cs | 4 +- .../System/Threading/Tasks/TaskScheduler.cs | 5 +- .../System/Threading/ThreadPool.Windows.cs | 4 +- .../Runtime/Serialization/DataContractSet.cs | 4 +- .../Json/JsonCollectionDataContract.cs | 33 +- .../Serialization/PrimitiveDataContract.cs | 5 +- .../src/System/Xml/ArrayHelper.cs | 15 +- .../TreeManipulation/XNodeSequenceRemove.cs | 9 +- .../System/Xml/Core/XsdValidatingReader.cs | 5 +- .../src/System/Xml/Schema/XsdBuilder.cs | 5 +- .../XmlSerializationReaderILGen.cs | 8 +- .../System/Xml/XPath/Internal/XPathParser.cs | 5 +- .../XmlPreloadedResolverGetEntity.cs | 13 +- .../tests/GetCustomAttributes_Assembly.cs | 91 +- .../tests/GetCustomAttributes_MemberInfo.cs | 130 +- .../tests/Metadata/MetadataReaderTests.cs | 11 +- .../PortableExecutable/PEBuilderTests.cs | 15 +- .../PortableExecutable/PEHeadersTests.cs | 5 +- .../MetadataLoadContext.CoreAssembly.cs | 6 +- .../Assemblies/Ecma/EcmaAssembly.cs | 5 +- .../tests/src/TestUtils/TestUtils.cs | 15 +- .../Tests/CustomAttributes/DllImportTests.cs | 8 +- .../tests/src/Tests/Field/FieldTests.cs | 139 +- .../tests/MethodInfoTests.cs | 9 +- .../JSExportCodeGenerator.cs | 12 +- .../JSImportCodeGenerator.cs | 12 +- .../JSImportGenerator/JSManagedTypeInfo.cs | 8 +- ...omImportToGeneratedComInterfaceAnalyzer.cs | 22 +- .../ComInterfaceGenerator.cs | 49 +- .../VirtualMethodPointerStubGenerator.cs | 11 +- .../ConvertToSourceGeneratedInteropFixer.cs | 21 +- .../ConvertToLibraryImportAnalyzer.cs | 21 +- .../CustomMarshallerAttributeAnalyzer.cs | 15 +- .../ShapeBreakingDiagnosticSuppressor.cs | 35 +- .../MarshallerShape.cs | 404 ++- .../ComInterfaceGeneratorOutputShape.cs | 6 +- .../Compiles.cs | 432 ++- .../tests/Common/TestUtils.cs | 15 +- .../CollectionMarshallingFails.cs | 75 +- .../ShapeBreakingDiagnosticSuppressorTests.cs | 4 +- .../tests/ApplyUpdateTest.cs | 4 +- .../tests/EqualityExtensions.cs | 20 +- .../tests/PlatformExtensions.cs | 4 +- .../Serialization/Schema/CodeExporter.cs | 5 +- .../tests/DataContractSerializer.cs | 28 +- .../IXmlSerializableTypes.cs | 5 +- ...namic.context.ExplicitImple.Inheritance.cs | 5 +- ...rmance.dynamic.context.indexer.regclass.cs | 4 +- ...namic.context.method.genmethod.regclass.cs | 4 +- ...mance.dynamic.context.operator.regclass.cs | 6 +- .../GregorianCalendarAddMonths.cs | 5 +- .../GregorianCalendarToFourDigitYear.cs | 5 +- .../KoreanCalendarGetDayOfMonth.cs | 5 +- .../KoreanCalendarGetDayOfYear.cs | 5 +- .../KoreanCalendarGetDaysInYear.cs | 5 +- .../KoreanCalendarGetWeekOfYear.cs | 5 +- .../KoreanCalendarToFourDigitYear.cs | 5 +- .../ThaiBuddhistCalendarAddMonths.cs | 5 +- .../ThaiBuddhistCalendarGetDayOfMonth.cs | 5 +- .../ThaiBuddhistCalendarGetDayOfYear.cs | 5 +- .../ThaiBuddhistCalendarGetDaysInYear.cs | 5 +- .../ThaiBuddhistCalendarGetMonth.cs | 5 +- .../ThaiBuddhistCalendarGetWeekOfYear.cs | 5 +- .../ThaiBuddhistCalendarIsLeapDay.cs | 5 +- .../ThaiBuddhistCalendarIsLeapYear.cs | 5 +- .../CultureInfo/CultureInfoAll.cs | 17 +- .../System.Reflection.Tests/FieldInfoTests.cs | 4 +- .../ParameterInfoTests.cs | 8 +- .../System.Reflection.Tests/TypeInfoTests.cs | 4 +- .../ResourceManagerTests.cs | 22 +- .../System/ArraySegmentTests.cs | 4 +- .../System/Reflection/SignatureTypes.cs | 4 +- .../System/Type/TypeTests.cs | 24 +- .../System/ValueTypeTests.cs | 20 +- .../Encoding/TranscodingStreamTests.cs | 28 +- .../AsyncTaskMethodBuilderTests.cs | 4 +- .../Task/TaskContinueWithTests.cs | 67 +- .../tests/System/Reflection/SignatureTypes.cs | 4 +- .../tests/System/Text/StringBuilderTests.cs | 24 +- .../tests/TripleDESCngTests.cs | 11 +- .../Pal/AnyOS/ManagedPal.Encrypt.cs | 21 +- .../KeyAgreeRecipientInfoPalWindows.cs | 4 +- .../tests/DSAKeyValueTest.cs | 5 +- .../tests/RSAKeyValueTest.cs | 17 +- .../X509Certificates/ChainPal.Android.cs | 7 +- .../OpenSslX509ChainProcessor.cs | 5 +- .../tests/AesGcmTests.cs | 28 +- .../tests/ChaCha20Poly1305Tests.cs | 8 +- .../tests/HKDFTests.cs | 36 +- .../tests/TripleDesTests.cs | 4 +- .../tests/X509Certificates/Cert.cs | 8 +- .../CertificateRequestUsageTests.cs | 4 +- .../tests/X509Certificates/ChainTests.cs | 8 +- .../tests/X509Certificates/PublicKeyTests.cs | 12 +- .../tests/X509Certificates/TestData.cs | 34 +- .../X500DistinguishedNameTests.cs | 4 +- .../tests/WindowsPrincipalTests.cs | 8 +- .../CategoriesDocumentFormatterTests.cs | 5 +- .../ResourceCollectionInfoTests.cs | 5 +- .../src/System/ServiceProcess/ServiceBase.cs | 4 +- .../tests/TextEncoderTests.cs | 25 +- .../tools/GenUnicodeRanges/Program.cs | 7 +- .../gen/Helpers/RoslynExtensions.cs | 21 +- .../gen/JsonSourceGenerator.Emitter.cs | 5 +- .../gen/JsonSourceGenerator.Parser.cs | 6 +- .../JsonSerializer.Read.HandlePropertyName.cs | 4 +- .../Metadata/JsonPropertyInfo.cs | 8 +- .../Metadata/PolymorphicTypeResolver.cs | 4 +- .../CollectionTests.AsyncEnumerable.cs | 16 +- .../ConstructorTests.AttributePresence.cs | 28 +- .../tests/Common/PropertyVisibilityTests.cs | 4 +- .../JsonSerializerContextTests.cs | 4 +- .../JsonSourceGeneratorDiagnosticsTests.cs | 10 +- .../JsonPolymorphismOptionsTests.cs | 8 +- ...nTypeInfoResolverTests.JsonPropertyInfo.cs | 7 +- .../JsonTypeInfoResolverTests.cs | 20 +- .../Serialization/Null.WriteTests.cs | 9 +- .../PolymorphicTests.CustomTypeHierarchies.cs | 8 +- .../Stream.DeserializeAsyncEnumerable.cs | 50 +- .../IsReflectionEnabledByDefaultFalse.cs | 8 +- .../gen/RegexGenerator.Parser.cs | 3 +- .../RegularExpressions/RegexPrefixAnalyzer.cs | 11 +- .../tests/FunctionalTests/AttRegexTests.cs | 15 +- .../CaptureCollectionTests2.cs | 7 +- .../FunctionalTests/GroupCollectionTests2.cs | 7 +- .../FunctionalTests/MatchCollectionTests2.cs | 7 +- .../FunctionalTests/Regex.Groups.Tests.cs | 10 +- .../FunctionalTests/Regex.Match.Tests.cs | 66 +- .../FunctionalTests/RegexCharacterSetTests.cs | 8 +- .../RegexGeneratorHelper.netcoreapp.cs | 14 +- .../tests/FunctionalTests/RegexPcreTests.cs | 15 +- .../tests/FunctionalTests/RegexRustTests.cs | 15 +- .../tests/MutexAclTests.cs | 5 +- .../tests/SemaphoreAclTests.cs | 5 +- .../System.Threading.Channels/tests/Stress.cs | 3 +- .../tests/PartitionedRateLimiterTests.cs | 285 +- .../src/Blocks/JoinBlock.cs | 6 +- .../tests/Dataflow/ActionBlockTests.cs | 44 +- .../tests/Dataflow/BatchedJoinBlockTests.cs | 30 +- .../tests/Dataflow/BufferBlockTests.cs | 11 +- .../Dataflow/DataflowBlockExtensionTests.cs | 40 +- .../tests/Dataflow/JoinBlockTests.cs | 63 +- .../tests/Dataflow/TransformBlockTests.cs | 15 +- ...ransformManyBlockTests.IAsyncEnumerable.cs | 15 +- .../tests/HttpUtility/HttpUtilityTest.cs | 9 +- .../src/System/Array.Mono.cs | 4 +- .../mono/sample/wasm/blazor-frame/Program.cs | 7 +- runtime/src/mono/tools/jitdiff/jitdiff.cs | 15 +- .../Common/HelperExtensions.cs | 4 +- .../Wasm.Build.Tests/ProjectProviderBase.cs | 8 +- .../TestAppScenarios/LazyLoadingTests.cs | 4 +- .../MemberObjectsExplorer.cs | 14 +- .../BrowserDebugProxy/MonoSDBHelper.cs | 10 +- .../DebuggerTestSuite/SteppingTests.cs | 14 +- .../DebuggerTestSuite/TestHarnessProxy.cs | 25 +- .../debugger-test/debugger-async-test.cs | 3 +- .../tests/debugger-test/debugger-test.cs | 4 +- .../src/mono/wasm/host/DevServer/DevServer.cs | 25 +- runtime/src/mono/wasm/host/WebServer.cs | 41 +- .../wasm/testassets/Blazor_net50/Program.cs | 7 +- .../tasks/AotCompilerTask/MonoAOTCompiler.cs | 4 +- runtime/src/tasks/Common/AndroidSdkHelper.cs | 9 +- .../ComputeWasmPublishAssets.cs | 6 +- .../WebcilReader.Reflection.cs | 7 +- .../tasks/WasmAppBuilder/PInvokeCollector.cs | 8 +- .../RegenerateDownloadTable.cs | 4 +- .../RegenerateThirdPartyNotices.cs | 17 +- .../XUnitWrapperGenerator.cs | 16 +- .../InteropTestsWebsite/TestServiceImpl.cs | 9 +- .../DllImportPath/DllImportPathTest.cs | 9 +- .../DelegatePInvoke/DelegatePInvokeTest.cs | 10 +- .../JIT/Generics/Coverage/chaos55915408cs.cs | 18 +- .../JIT/Generics/Coverage/chaos65204782cs.cs | 132 +- .../ConvertToInt32WithTruncation.Int32.cs | 8 +- .../X86_Avx/Avx1/DotProduct.cs | 25 +- .../TypeIntrinsics.IsAssignableTo.cs | 7 +- runtime/src/tests/JIT/Stress/ABI/Program.cs | 4 +- .../binding/tracing/BinderEventListener.cs | 13 +- .../binding/tracing/BinderTracingTest.cs | 9 +- .../classloader/nesting/coreclr/vsw491577.cs | 4 +- .../PortablePdb/IlasmPortablePdbTester.cs | 4 +- .../DynamicGenerics/dictionaries.cs | 7 +- .../SmokeTests/UnitTests/Interfaces.cs | 5 +- runtime/src/tests/readytorun/tests/main.cs | 4 +- ...noresAccessChecksToAttributeIsRespected.cs | 11 +- ...namicallyAccessedMembersCodeFixProvider.cs | 32 +- .../TrimAnalysis/ReflectionAccessAnalyzer.cs | 6 +- .../DynamicallyAccessedMembersBinder.cs | 4 +- .../src/linker/Linker.Steps/MarkStep.cs | 22 +- ...emblyUsingTargetTypeNameInOtherAssembly.cs | 5 +- ...getTypeNameOfGenericTypeInOtherAssembly.cs | 4 +- .../UnusedAttributeOnReturnTypeIsRemoved.cs | 14 +- .../DataFlow/PropertyDataFlow.cs | 6 +- ...InOtherUsedOnlyByCopiedAssemblyExplicit.cs | 4 +- ...dTypePreserveFieldsWithInterfacesMarked.cs | 4 +- ...TypePreserveMethodsWithInterfacesMarked.cs | 4 +- .../ConstructorUsedViaReflection.cs | 4 +- .../Reflection/MethodUsedViaReflection.cs | 24 +- .../TestFramework/CanCompileILAssembly.cs | 4 +- .../TestFramework/ILVerificationWorks.cs | 4 +- .../Mono.Linker.Tests/Extensions/NiceIO.cs | 4 +- .../Mono.Linker.Tests/TestCases/TestCase.cs | 4 +- .../ILVerification/ILVerifier.cs | 23 +- .../TestCasesRunner/ResultChecker.cs | 105 +- .../TestCaseCompilationMetadataProvider.cs | 40 +- .../BaseMetadataProvider.cs | 8 +- 2069 files changed, 26030 insertions(+), 29601 deletions(-) diff --git a/AspNetWebStack/src/Common/Routing/RouteParser.cs b/AspNetWebStack/src/Common/Routing/RouteParser.cs index 58ece4eb39d..b94a2fefe6b 100644 --- a/AspNetWebStack/src/Common/Routing/RouteParser.cs +++ b/AspNetWebStack/src/Common/Routing/RouteParser.cs @@ -355,10 +355,9 @@ private static Exception ValidateUriParts(List pathSegments) return exception; } - foundCatchAllParameter = subsegments.Any( - seg => - (seg is PathParameterSubsegment) - && ((PathParameterSubsegment)seg).IsCatchAll + foundCatchAllParameter = subsegments.Any(seg => + (seg is PathParameterSubsegment) + && ((PathParameterSubsegment)seg).IsCatchAll ); } } diff --git a/AspNetWebStack/src/Microsoft.AspNet.Facebook/Authorization/FacebookAuthorizeFilter.cs b/AspNetWebStack/src/Microsoft.AspNet.Facebook/Authorization/FacebookAuthorizeFilter.cs index d35d7e38e15..65bdbf94316 100644 --- a/AspNetWebStack/src/Microsoft.AspNet.Facebook/Authorization/FacebookAuthorizeFilter.cs +++ b/AspNetWebStack/src/Microsoft.AspNet.Facebook/Authorization/FacebookAuthorizeFilter.cs @@ -359,10 +359,9 @@ string redirectUrl // Declined permissions and skipped permissions can persist through multiple pages. So we need to cross check // them against the current pages permissions, this will determine if we should invoke the denied permission hook. bool deniedPermissions = missingPermissions - .Where( - permission => - declinedPermissions.Contains(permission) - || skippedPermissions.Contains(permission) + .Where(permission => + declinedPermissions.Contains(permission) + || skippedPermissions.Contains(permission) ) .Any(); diff --git a/AspNetWebStack/src/Microsoft.Web.Mvc/ExpressionUtil/FingerprintingExpressionVisitor.cs b/AspNetWebStack/src/Microsoft.Web.Mvc/ExpressionUtil/FingerprintingExpressionVisitor.cs index 81fa646dcc9..02d772bde36 100644 --- a/AspNetWebStack/src/Microsoft.Web.Mvc/ExpressionUtil/FingerprintingExpressionVisitor.cs +++ b/AspNetWebStack/src/Microsoft.Web.Mvc/ExpressionUtil/FingerprintingExpressionVisitor.cs @@ -14,8 +14,9 @@ internal sealed class FingerprintingExpressionVisitor : ExpressionVisitor private readonly List _seenConstants = new List(); private readonly List _seenParameters = new List(); - private readonly ExpressionFingerprintChain _currentChain = - new ExpressionFingerprintChain(); + private readonly ExpressionFingerprintChain _currentChain = new ExpressionFingerprintChain( + + ); private bool _gaveUp; private FingerprintingExpressionVisitor() { } diff --git a/AspNetWebStack/src/Microsoft.Web.Mvc/ModelBinding/ModelBinderProviders.cs b/AspNetWebStack/src/Microsoft.Web.Mvc/ModelBinding/ModelBinderProviders.cs index 3fea4256c0d..8a4a5a58c0e 100644 --- a/AspNetWebStack/src/Microsoft.Web.Mvc/ModelBinding/ModelBinderProviders.cs +++ b/AspNetWebStack/src/Microsoft.Web.Mvc/ModelBinding/ModelBinderProviders.cs @@ -5,8 +5,9 @@ namespace Microsoft.Web.Mvc.ModelBinding { public static class ModelBinderProviders { - private static readonly ModelBinderProviderCollection _providers = - CreateDefaultCollection(); + private static readonly ModelBinderProviderCollection _providers = CreateDefaultCollection( + + ); public static ModelBinderProviderCollection Providers { diff --git a/AspNetWebStack/src/Microsoft.Web.Mvc/RadioExtensions.cs b/AspNetWebStack/src/Microsoft.Web.Mvc/RadioExtensions.cs index 14bae001d4b..40ebd86e734 100644 --- a/AspNetWebStack/src/Microsoft.Web.Mvc/RadioExtensions.cs +++ b/AspNetWebStack/src/Microsoft.Web.Mvc/RadioExtensions.cs @@ -173,8 +173,8 @@ from object value in defaultValues } } - IEnumerable radioButtons = selectList.Select( - item => htmlHelper.RadioButton(name, item.Value, item.Selected, htmlAttributes) + IEnumerable radioButtons = selectList.Select(item => + htmlHelper.RadioButton(name, item.Value, item.Selected, htmlAttributes) ); return radioButtons.ToArray(); diff --git a/AspNetWebStack/src/System.Net.Http.Formatting/Headers/CookieHeaderValue.cs b/AspNetWebStack/src/System.Net.Http.Formatting/Headers/CookieHeaderValue.cs index e4858286828..6898b10e5d2 100644 --- a/AspNetWebStack/src/System.Net.Http.Formatting/Headers/CookieHeaderValue.cs +++ b/AspNetWebStack/src/System.Net.Http.Formatting/Headers/CookieHeaderValue.cs @@ -99,8 +99,8 @@ public CookieState this[string name] return null; } - CookieState cookie = Cookies.FirstOrDefault( - c => String.Equals(c.Name, name, StringComparison.OrdinalIgnoreCase) + CookieState cookie = Cookies.FirstOrDefault(c => + String.Equals(c.Name, name, StringComparison.OrdinalIgnoreCase) ); if (cookie == null) { diff --git a/AspNetWebStack/src/System.Net.Http.Formatting/HttpRequestHeadersExtensions.cs b/AspNetWebStack/src/System.Net.Http.Formatting/HttpRequestHeadersExtensions.cs index e4f3e22a14e..44cdf56ce88 100644 --- a/AspNetWebStack/src/System.Net.Http.Formatting/HttpRequestHeadersExtensions.cs +++ b/AspNetWebStack/src/System.Net.Http.Formatting/HttpRequestHeadersExtensions.cs @@ -84,12 +84,10 @@ string name IEnumerable cookieHeaderValues = GetCookies(headers); CookieHeaderValue[] matches = cookieHeaderValues - .Where( - header => - header.Cookies.Any( - state => - String.Equals(state.Name, name, StringComparison.OrdinalIgnoreCase) - ) + .Where(header => + header.Cookies.Any(state => + String.Equals(state.Name, name, StringComparison.OrdinalIgnoreCase) + ) ) .ToArray(); return new Collection(matches); diff --git a/AspNetWebStack/src/System.Net.Http.Formatting/MultipartRelatedStreamProvider.cs b/AspNetWebStack/src/System.Net.Http.Formatting/MultipartRelatedStreamProvider.cs index 9833ba9c9e3..f56d61f5444 100644 --- a/AspNetWebStack/src/System.Net.Http.Formatting/MultipartRelatedStreamProvider.cs +++ b/AspNetWebStack/src/System.Net.Http.Formatting/MultipartRelatedStreamProvider.cs @@ -128,8 +128,8 @@ string parameterName } // Look for parameter - return parentContentType.Parameters.FirstOrDefault( - nvp => String.Equals(nvp.Name, parameterName, StringComparison.OrdinalIgnoreCase) + return parentContentType.Parameters.FirstOrDefault(nvp => + String.Equals(nvp.Name, parameterName, StringComparison.OrdinalIgnoreCase) ); } } diff --git a/AspNetWebStack/src/System.Web.Cors/CorsResult.cs b/AspNetWebStack/src/System.Web.Cors/CorsResult.cs index 50ce2b4d463..93ec5ef2457 100644 --- a/AspNetWebStack/src/System.Web.Cors/CorsResult.cs +++ b/AspNetWebStack/src/System.Web.Cors/CorsResult.cs @@ -105,8 +105,8 @@ public virtual IDictionary ToResponseHeaders() if (AllowedMethods.Count > 0) { // Filter out simple methods - IEnumerable nonSimpleAllowMethods = AllowedMethods.Where( - m => !CorsConstants.SimpleMethods.Contains(m, StringComparer.OrdinalIgnoreCase) + IEnumerable nonSimpleAllowMethods = AllowedMethods.Where(m => + !CorsConstants.SimpleMethods.Contains(m, StringComparer.OrdinalIgnoreCase) ); AddHeader(headers, CorsConstants.AccessControlAllowMethods, nonSimpleAllowMethods); } @@ -114,12 +114,11 @@ public virtual IDictionary ToResponseHeaders() if (AllowedHeaders.Count > 0) { // Filter out simple request headers - IEnumerable nonSimpleAllowRequestHeaders = AllowedHeaders.Where( - header => - !CorsConstants.SimpleRequestHeaders.Contains( - header, - StringComparer.OrdinalIgnoreCase - ) + IEnumerable nonSimpleAllowRequestHeaders = AllowedHeaders.Where(header => + !CorsConstants.SimpleRequestHeaders.Contains( + header, + StringComparer.OrdinalIgnoreCase + ) ); AddHeader( headers, diff --git a/AspNetWebStack/src/System.Web.Http/AuthorizeAttribute.cs b/AspNetWebStack/src/System.Web.Http/AuthorizeAttribute.cs index 22861fbc63f..0aadc254133 100644 --- a/AspNetWebStack/src/System.Web.Http/AuthorizeAttribute.cs +++ b/AspNetWebStack/src/System.Web.Http/AuthorizeAttribute.cs @@ -178,7 +178,9 @@ private static bool SkipAuthorization(HttpActionContext actionContext) .ActionDescriptor.GetCustomAttributes() .Any() || actionContext - .ControllerContext.ControllerDescriptor.GetCustomAttributes() + .ControllerContext.ControllerDescriptor.GetCustomAttributes( + + ) .Any(); } diff --git a/AspNetWebStack/src/System.Web.Http/Controllers/HttpActionDescriptor.cs b/AspNetWebStack/src/System.Web.Http/Controllers/HttpActionDescriptor.cs index e3570bb4e1c..fcdf50fec1e 100644 --- a/AspNetWebStack/src/System.Web.Http/Controllers/HttpActionDescriptor.cs +++ b/AspNetWebStack/src/System.Web.Http/Controllers/HttpActionDescriptor.cs @@ -35,8 +35,9 @@ public abstract class HttpActionDescriptor private static readonly ResponseMessageResultConverter _responseMessageResultConverter = new ResponseMessageResultConverter(); - private static readonly VoidResultConverter _voidResultConverter = - new VoidResultConverter(); + private static readonly VoidResultConverter _voidResultConverter = new VoidResultConverter( + + ); protected HttpActionDescriptor() { @@ -79,8 +80,9 @@ public virtual HttpActionBinding ActionBinding ServicesContainer controllerServices = _controllerDescriptor .Configuration .Services; - IActionValueBinder actionValueBinder = - controllerServices.GetActionValueBinder(); + IActionValueBinder actionValueBinder = controllerServices.GetActionValueBinder( + + ); HttpActionBinding actionBinding = actionValueBinder.GetBinding(this); _actionBinding = actionBinding; } diff --git a/AspNetWebStack/src/System.Web.Http/Controllers/HttpParameterDescriptorExtensions.cs b/AspNetWebStack/src/System.Web.Http/Controllers/HttpParameterDescriptorExtensions.cs index 2a86b86af82..36d4fa9b807 100644 --- a/AspNetWebStack/src/System.Web.Http/Controllers/HttpParameterDescriptorExtensions.cs +++ b/AspNetWebStack/src/System.Web.Http/Controllers/HttpParameterDescriptorExtensions.cs @@ -69,8 +69,9 @@ IModelBinder binder ) { HttpConfiguration config = parameter.Configuration; - IEnumerable valueProviderFactories = - new ModelBinderAttribute().GetValueProviderFactories(config); + IEnumerable valueProviderFactories = new ModelBinderAttribute( + + ).GetValueProviderFactories(config); return BindWithModelBinding(parameter, binder, valueProviderFactories); } diff --git a/AspNetWebStack/src/System.Web.Http/Dispatcher/HttpControllerTypeCache.cs b/AspNetWebStack/src/System.Web.Http/Dispatcher/HttpControllerTypeCache.cs index d567171263d..9e34ea0413f 100644 --- a/AspNetWebStack/src/System.Web.Http/Dispatcher/HttpControllerTypeCache.cs +++ b/AspNetWebStack/src/System.Web.Http/Dispatcher/HttpControllerTypeCache.cs @@ -53,8 +53,9 @@ public ICollection GetControllerTypes(string controllerName) private Dictionary> InitializeCache() { - IAssembliesResolver assembliesResolver = - _configuration.Services.GetAssembliesResolver(); + IAssembliesResolver assembliesResolver = _configuration.Services.GetAssembliesResolver( + + ); IHttpControllerTypeResolver controllersResolver = _configuration.Services.GetHttpControllerTypeResolver(); diff --git a/AspNetWebStack/src/System.Web.Http/FromBodyAttribute.cs b/AspNetWebStack/src/System.Web.Http/FromBodyAttribute.cs index daf1c2dc2a9..76ba1303456 100644 --- a/AspNetWebStack/src/System.Web.Http/FromBodyAttribute.cs +++ b/AspNetWebStack/src/System.Web.Http/FromBodyAttribute.cs @@ -28,8 +28,9 @@ public override HttpParameterBinding GetBinding(HttpParameterDescriptor paramete } IEnumerable formatters = parameter.Configuration.Formatters; - IBodyModelValidator validator = - parameter.Configuration.Services.GetBodyModelValidator(); + IBodyModelValidator validator = parameter.Configuration.Services.GetBodyModelValidator( + + ); return parameter.BindWithFormatter(formatters, validator); } diff --git a/AspNetWebStack/src/System.Web.Http/HttpRequestMessageExtensions.cs b/AspNetWebStack/src/System.Web.Http/HttpRequestMessageExtensions.cs index 9fa0aac64bd..a0a7fd27b61 100644 --- a/AspNetWebStack/src/System.Web.Http/HttpRequestMessageExtensions.cs +++ b/AspNetWebStack/src/System.Web.Http/HttpRequestMessageExtensions.cs @@ -447,8 +447,10 @@ Exception exception return request.CreateErrorResponse( statusCode, - includeErrorDetail => - new HttpError(exception, includeErrorDetail) { Message = message } + includeErrorDetail => new HttpError(exception, includeErrorDetail) + { + Message = message + } ); } diff --git a/AspNetWebStack/src/System.Web.Http/Metadata/ModelMetadata.cs b/AspNetWebStack/src/System.Web.Http/Metadata/ModelMetadata.cs index 1c223922db9..8b5dc22834b 100644 --- a/AspNetWebStack/src/System.Web.Http/Metadata/ModelMetadata.cs +++ b/AspNetWebStack/src/System.Web.Http/Metadata/ModelMetadata.cs @@ -206,8 +206,8 @@ IEnumerable validatorProviders throw Error.ArgumentNull("validatorProviders"); } - return validatorProviders.SelectMany( - provider => provider.GetValidators(this, validatorProviders) + return validatorProviders.SelectMany(provider => + provider.GetValidators(this, validatorProviders) ); } diff --git a/AspNetWebStack/src/System.Web.Http/ModelBinding/DefaultActionValueBinder.cs b/AspNetWebStack/src/System.Web.Http/ModelBinding/DefaultActionValueBinder.cs index 363d89d571d..742e0c37007 100644 --- a/AspNetWebStack/src/System.Web.Http/ModelBinding/DefaultActionValueBinder.cs +++ b/AspNetWebStack/src/System.Web.Http/ModelBinding/DefaultActionValueBinder.cs @@ -129,17 +129,16 @@ internal static ParameterBindingRulesCollection GetDefaultParameterBinders() ); // Warning binder for HttpContent. - pb.Add( - parameter => - typeof(HttpContent).IsAssignableFrom(parameter.ParameterType) - ? parameter.BindAsError( - Error.Format( - SRResources.ParameterBindingIllegalType, - parameter.ParameterType.Name, - parameter.ParameterName - ) + pb.Add(parameter => + typeof(HttpContent).IsAssignableFrom(parameter.ParameterType) + ? parameter.BindAsError( + Error.Format( + SRResources.ParameterBindingIllegalType, + parameter.ParameterType.Name, + parameter.ParameterName ) - : null + ) + : null ); return pb; diff --git a/AspNetWebStack/src/System.Web.Http/Services/ServicesContainer.cs b/AspNetWebStack/src/System.Web.Http/Services/ServicesContainer.cs index 2ad3527f5d2..85ca88f1554 100644 --- a/AspNetWebStack/src/System.Web.Http/Services/ServicesContainer.cs +++ b/AspNetWebStack/src/System.Web.Http/Services/ServicesContainer.cs @@ -180,8 +180,8 @@ public void InsertRange(Type serviceType, int index, IEnumerable service } object[] filteredServices = services.Where(svc => svc != null).ToArray(); - object incorrectlyTypedService = filteredServices.FirstOrDefault( - svc => !serviceType.IsAssignableFrom(svc.GetType()) + object incorrectlyTypedService = filteredServices.FirstOrDefault(svc => + !serviceType.IsAssignableFrom(svc.GetType()) ); if (incorrectlyTypedService != null) { diff --git a/AspNetWebStack/src/System.Web.Http/Validation/DefaultBodyModelValidator.cs b/AspNetWebStack/src/System.Web.Http/Validation/DefaultBodyModelValidator.cs index 091a1a1a77b..b3cd9969f22 100644 --- a/AspNetWebStack/src/System.Web.Http/Validation/DefaultBodyModelValidator.cs +++ b/AspNetWebStack/src/System.Web.Http/Validation/DefaultBodyModelValidator.cs @@ -363,7 +363,9 @@ IEnumerable validators { modelKey = validationContext.RootPrefix; foreach ( - IBodyModelValidatorKeyBuilder keyBuilder in validationContext.KeyBuilders.Reverse() + IBodyModelValidatorKeyBuilder keyBuilder in validationContext.KeyBuilders.Reverse( + + ) ) { modelKey = keyBuilder.AppendTo(modelKey); diff --git a/AspNetWebStack/src/System.Web.Mvc/Async/ReflectedAsyncActionDescriptor.cs b/AspNetWebStack/src/System.Web.Mvc/Async/ReflectedAsyncActionDescriptor.cs index f3007e46482..2c64b23d0df 100644 --- a/AspNetWebStack/src/System.Web.Mvc/Async/ReflectedAsyncActionDescriptor.cs +++ b/AspNetWebStack/src/System.Web.Mvc/Async/ReflectedAsyncActionDescriptor.cs @@ -150,13 +150,12 @@ select ExtractParameterFromDictionary( // to simplify the logic, force the rest of the pipeline to execute in an asynchronous callback listener.SetContinuation( () => - ThreadPool.QueueUserWorkItem( - _ => - asyncResult.MarkCompleted( - false /* completedSynchronously */ - , - asyncCallback - ) + ThreadPool.QueueUserWorkItem(_ => + asyncResult.MarkCompleted( + false /* completedSynchronously */ + , + asyncCallback + ) ) ); diff --git a/AspNetWebStack/src/System.Web.Mvc/DataAnnotationsModelMetadataProvider.cs b/AspNetWebStack/src/System.Web.Mvc/DataAnnotationsModelMetadataProvider.cs index f500480d6a5..f131b2ebf3f 100644 --- a/AspNetWebStack/src/System.Web.Mvc/DataAnnotationsModelMetadataProvider.cs +++ b/AspNetWebStack/src/System.Web.Mvc/DataAnnotationsModelMetadataProvider.cs @@ -44,13 +44,8 @@ string propertyName // We prefer [UIHint("...", PresentationLayer = "MVC")] but will fall back to [UIHint("...")] IEnumerable uiHintAttributes = attributeList.OfType(); UIHintAttribute uiHintAttribute = - uiHintAttributes.FirstOrDefault( - a => - String.Equals( - a.PresentationLayer, - "MVC", - StringComparison.OrdinalIgnoreCase - ) + uiHintAttributes.FirstOrDefault(a => + String.Equals(a.PresentationLayer, "MVC", StringComparison.OrdinalIgnoreCase) ) ?? uiHintAttributes.FirstOrDefault(a => String.IsNullOrEmpty(a.PresentationLayer)); if (uiHintAttribute != null) diff --git a/AspNetWebStack/src/System.Web.Mvc/DefaultModelBinder.cs b/AspNetWebStack/src/System.Web.Mvc/DefaultModelBinder.cs index 64f1da1c6d8..fadef44b3e6 100644 --- a/AspNetWebStack/src/System.Web.Mvc/DefaultModelBinder.cs +++ b/AspNetWebStack/src/System.Web.Mvc/DefaultModelBinder.cs @@ -362,8 +362,8 @@ PropertyDescriptor propertyDescriptor // Convert FormatExceptions (type conversion failures) into InvalidValue messages foreach ( ModelError error in modelState - .Errors.Where( - err => String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null + .Errors.Where(err => + String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null ) .ToList() ) diff --git a/AspNetWebStack/src/System.Web.Mvc/Html/DefaultEditorTemplates.cs b/AspNetWebStack/src/System.Web.Mvc/Html/DefaultEditorTemplates.cs index 970024cd122..d7966a265d7 100644 --- a/AspNetWebStack/src/System.Web.Mvc/Html/DefaultEditorTemplates.cs +++ b/AspNetWebStack/src/System.Web.Mvc/Html/DefaultEditorTemplates.cs @@ -309,8 +309,8 @@ TemplateHelpers.TemplateHelperDelegate templateHelper } foreach ( - ModelMetadata propertyMetadata in modelMetadata.Properties.Where( - pm => ShouldShow(pm, templateInfo) + ModelMetadata propertyMetadata in modelMetadata.Properties.Where(pm => + ShouldShow(pm, templateInfo) ) ) { diff --git a/AspNetWebStack/src/System.Web.Mvc/MultiSelectList.cs b/AspNetWebStack/src/System.Web.Mvc/MultiSelectList.cs index fe89d8d3414..3c9713650ef 100644 --- a/AspNetWebStack/src/System.Web.Mvc/MultiSelectList.cs +++ b/AspNetWebStack/src/System.Web.Mvc/MultiSelectList.cs @@ -342,8 +342,8 @@ private SelectListGroup GetGroup(object container, HashSet disabledGroup // We use StringComparison.CurrentCulture because the group name is used to display as the value of // optgroup HTML tag's label attribute. - SelectListGroup group = _groups.FirstOrDefault( - g => String.Equals(g.Name, groupName, StringComparison.CurrentCulture) + SelectListGroup group = _groups.FirstOrDefault(g => + String.Equals(g.Name, groupName, StringComparison.CurrentCulture) ); if (group == null) { diff --git a/AspNetWebStack/src/System.Web.Mvc/Routing/DirectRouteCandidate.cs b/AspNetWebStack/src/System.Web.Mvc/Routing/DirectRouteCandidate.cs index f2164c3a178..b6e3c820eac 100644 --- a/AspNetWebStack/src/System.Web.Mvc/Routing/DirectRouteCandidate.cs +++ b/AspNetWebStack/src/System.Web.Mvc/Routing/DirectRouteCandidate.cs @@ -159,8 +159,8 @@ ControllerContext controllerContext actionName = actionName ?? candidate.ActionDescriptor.ActionName; if ( - candidate.ActionNameSelectors.All( - selector => selector(controllerContext, actionName) + candidate.ActionNameSelectors.All(selector => + selector(controllerContext, actionName) ) ) { diff --git a/AspNetWebStack/src/System.Web.Mvc/TypeCacheUtil.cs b/AspNetWebStack/src/System.Web.Mvc/TypeCacheUtil.cs index d2a70840cfe..dcdbebe1401 100644 --- a/AspNetWebStack/src/System.Web.Mvc/TypeCacheUtil.cs +++ b/AspNetWebStack/src/System.Web.Mvc/TypeCacheUtil.cs @@ -88,8 +88,8 @@ TypeCacheSerializer serializer List deserializedTypes = serializer.DeserializeTypes(reader); if ( deserializedTypes != null - && deserializedTypes.All( - type => TypeIsPublicClass(type) && predicate(type) + && deserializedTypes.All(type => + TypeIsPublicClass(type) && predicate(type) ) ) { diff --git a/AspNetWebStack/src/System.Web.Razor/Generator/HelperCodeGenerator.cs b/AspNetWebStack/src/System.Web.Razor/Generator/HelperCodeGenerator.cs index 607fdf0181a..8341470f290 100644 --- a/AspNetWebStack/src/System.Web.Razor/Generator/HelperCodeGenerator.cs +++ b/AspNetWebStack/src/System.Web.Razor/Generator/HelperCodeGenerator.cs @@ -31,12 +31,11 @@ public override void GenerateStartBlockCode(Block target, CodeGeneratorContext c { _writer = context.CreateCodeWriter(); - string prefix = context.BuildCodeString( - cw => - cw.WriteHelperHeaderPrefix( - context.Host.GeneratedClassContext.TemplateTypeName, - context.Host.StaticHelpers - ) + string prefix = context.BuildCodeString(cw => + cw.WriteHelperHeaderPrefix( + context.Host.GeneratedClassContext.TemplateTypeName, + context.Host.StaticHelpers + ) ); _writer.WriteLinePragma( diff --git a/AspNetWebStack/src/System.Web.Razor/Parser/HtmlMarkupParser.Block.cs b/AspNetWebStack/src/System.Web.Razor/Parser/HtmlMarkupParser.Block.cs index c1983138680..5229ec909e8 100644 --- a/AspNetWebStack/src/System.Web.Razor/Parser/HtmlMarkupParser.Block.cs +++ b/AspNetWebStack/src/System.Web.Razor/Parser/HtmlMarkupParser.Block.cs @@ -369,8 +369,8 @@ private void BeforeAttribute() { // http://dev.w3.org/html5/spec/tokenization.html#before-attribute-name-state // Capture whitespace - var whitespace = ReadWhile( - sym => sym.Type == HtmlSymbolType.WhiteSpace || sym.Type == HtmlSymbolType.NewLine + var whitespace = ReadWhile(sym => + sym.Type == HtmlSymbolType.WhiteSpace || sym.Type == HtmlSymbolType.NewLine ); if (At(HtmlSymbolType.Transition)) @@ -386,16 +386,13 @@ private void BeforeAttribute() var name = Enumerable.Empty(); if (At(HtmlSymbolType.Text)) { - name = ReadWhile( - sym => - sym.Type != HtmlSymbolType.WhiteSpace - && sym.Type != HtmlSymbolType.NewLine - && sym.Type != HtmlSymbolType.Equals - && sym.Type != HtmlSymbolType.CloseAngle - && sym.Type != HtmlSymbolType.OpenAngle - && ( - sym.Type != HtmlSymbolType.Solidus || !NextIs(HtmlSymbolType.CloseAngle) - ) + name = ReadWhile(sym => + sym.Type != HtmlSymbolType.WhiteSpace + && sym.Type != HtmlSymbolType.NewLine + && sym.Type != HtmlSymbolType.Equals + && sym.Type != HtmlSymbolType.CloseAngle + && sym.Type != HtmlSymbolType.OpenAngle + && (sym.Type != HtmlSymbolType.Solidus || !NextIs(HtmlSymbolType.CloseAngle)) ); } else @@ -500,8 +497,8 @@ IEnumerable nameSymbols private void AttributeValue(HtmlSymbolType quote) { SourceLocation prefixStart = CurrentLocation; - var prefix = ReadWhile( - sym => sym.Type == HtmlSymbolType.WhiteSpace || sym.Type == HtmlSymbolType.NewLine + var prefix = ReadWhile(sym => + sym.Type == HtmlSymbolType.WhiteSpace || sym.Type == HtmlSymbolType.NewLine ); Accept(prefix); @@ -543,15 +540,14 @@ private void AttributeValue(HtmlSymbolType quote) { // Literal value // 'quote' should be "Unknown" if not quoted and symbols coming from the tokenizer should never have "Unknown" type. - var value = ReadWhile( - sym => - // These three conditions find separators which break the attribute value into portions - sym.Type != HtmlSymbolType.WhiteSpace - && sym.Type != HtmlSymbolType.NewLine - && sym.Type != HtmlSymbolType.Transition - && - // This condition checks for the end of the attribute value (it repeats some of the checks above but for now that's ok) - !IsEndOfAttributeValue(quote, sym) + var value = ReadWhile(sym => + // These three conditions find separators which break the attribute value into portions + sym.Type != HtmlSymbolType.WhiteSpace + && sym.Type != HtmlSymbolType.NewLine + && sym.Type != HtmlSymbolType.Transition + && + // This condition checks for the end of the attribute value (it repeats some of the checks above but for now that's ok) + !IsEndOfAttributeValue(quote, sym) ); Accept(value); Span.CodeGenerator = new LiteralAttributeCodeGenerator( diff --git a/AspNetWebStack/src/System.Web.Razor/Parser/VBCodeParser.cs b/AspNetWebStack/src/System.Web.Razor/Parser/VBCodeParser.cs index f56ac7a150b..a61bbd6c902 100644 --- a/AspNetWebStack/src/System.Web.Razor/Parser/VBCodeParser.cs +++ b/AspNetWebStack/src/System.Web.Razor/Parser/VBCodeParser.cs @@ -127,8 +127,8 @@ public override void ParseBlock() NextToken(); using (Context.StartBlock()) { - IEnumerable syms = ReadWhile( - sym => sym.Type == VBSymbolType.WhiteSpace + IEnumerable syms = ReadWhile(sym => + sym.Type == VBSymbolType.WhiteSpace ); if (At(VBSymbolType.Transition)) { diff --git a/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/PackageSourceFile.cs b/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/PackageSourceFile.cs index 066ea2a401c..369a46b2e45 100644 --- a/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/PackageSourceFile.cs +++ b/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/PackageSourceFile.cs @@ -47,10 +47,9 @@ internal static IEnumerable ReadFeeds(Func getStream) var document = XDocument.Load(stream); var root = document.Root; - return ( - from element in root.Elements() - select ParsePackageSource(element) - ).ToList(); + return (from element in root.Elements() select ParsePackageSource(element)).ToList( + + ); } } diff --git a/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/WebProjectManager.cs b/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/WebProjectManager.cs index c99a66c9a06..1c929560a11 100644 --- a/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/WebProjectManager.cs +++ b/AspNetWebStack/src/System.Web.WebPages.Administration/Framework/packages/WebProjectManager.cs @@ -114,10 +114,8 @@ bool filterPreferredPackages var packagesToUpdate = GetPackages(LocalRepository, searchTerms); if (filterPreferredPackages) { - packagesToUpdate = packagesToUpdate.Where( - p => - !String.IsNullOrEmpty(p.Tags) - && p.Tags.ToLower().Contains(WebPagesPreferredTag) + packagesToUpdate = packagesToUpdate.Where(p => + !String.IsNullOrEmpty(p.Tags) && p.Tags.ToLower().Contains(WebPagesPreferredTag) ); } return SourceRepository diff --git a/AspNetWebStack/src/System.Web.WebPages/Helpers/AntiXsrf/MachineKey45CryptoSystem.cs b/AspNetWebStack/src/System.Web.WebPages/Helpers/AntiXsrf/MachineKey45CryptoSystem.cs index f4f18aabac2..3d38c9eb0a5 100644 --- a/AspNetWebStack/src/System.Web.WebPages/Helpers/AntiXsrf/MachineKey45CryptoSystem.cs +++ b/AspNetWebStack/src/System.Web.WebPages/Helpers/AntiXsrf/MachineKey45CryptoSystem.cs @@ -13,8 +13,9 @@ internal sealed class MachineKey45CryptoSystem : ICryptoSystem { "System.Web.Helpers.AntiXsrf.AntiForgeryToken.v1" }; - private static readonly MachineKey45CryptoSystem _singletonInstance = - GetSingletonInstance(); + private static readonly MachineKey45CryptoSystem _singletonInstance = GetSingletonInstance( + + ); public static MachineKey45CryptoSystem Instance { diff --git a/AspNetWebStack/src/System.Web.WebPages/Utils/SessionStateUtil.cs b/AspNetWebStack/src/System.Web.WebPages/Utils/SessionStateUtil.cs index ac9c8549ae5..c5974af0b88 100644 --- a/AspNetWebStack/src/System.Web.WebPages/Utils/SessionStateUtil.cs +++ b/AspNetWebStack/src/System.Web.WebPages/Utils/SessionStateUtil.cs @@ -75,9 +75,8 @@ internal static void SetUpSessionState( var attributes = (RazorDirectiveAttribute[]) type.GetCustomAttributes(typeof(RazorDirectiveAttribute), inherit: false); var directiveAttributes = attributes - .Where( - attr => - StringComparer.OrdinalIgnoreCase.Equals("sessionstate", attr.Name) + .Where(attr => + StringComparer.OrdinalIgnoreCase.Equals("sessionstate", attr.Name) ) .ToList(); diff --git a/AspNetWebStack/src/System.Web.WebPages/VirtualPathFactoryManager.cs b/AspNetWebStack/src/System.Web.WebPages/VirtualPathFactoryManager.cs index 4ae68dd8230..2ceb5631030 100644 --- a/AspNetWebStack/src/System.Web.WebPages/VirtualPathFactoryManager.cs +++ b/AspNetWebStack/src/System.Web.WebPages/VirtualPathFactoryManager.cs @@ -77,8 +77,7 @@ public object CreateInstance(string virtualPath) internal T CreateInstanceOfType(string virtualPath) where T : class { - var virtualPathFactory = _virtualPathFactories.FirstOrDefault( - f => f.Exists(virtualPath) + var virtualPathFactory = _virtualPathFactories.FirstOrDefault(f => f.Exists(virtualPath) ); if (virtualPathFactory != null) { diff --git a/AspNetWebStack/src/WebApiHelpPage/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs b/AspNetWebStack/src/WebApiHelpPage/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs index cdee3d4b871..41fc477851a 100644 --- a/AspNetWebStack/src/WebApiHelpPage/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs +++ b/AspNetWebStack/src/WebApiHelpPage/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs @@ -370,8 +370,8 @@ out type { case SampleDirection.Request: ApiParameterDescription requestBodyParameter = - api.ParameterDescriptions.FirstOrDefault( - p => p.Source == ApiParameterSource.FromBody + api.ParameterDescriptions.FirstOrDefault(p => + p.Source == ApiParameterSource.FromBody ); type = requestBodyParameter == null diff --git a/AspNetWebStack/src/WebMatrix.WebData/SimpleMembershipProvider.cs b/AspNetWebStack/src/WebMatrix.WebData/SimpleMembershipProvider.cs index e2fdf2a4ad9..7e59718a362 100644 --- a/AspNetWebStack/src/WebMatrix.WebData/SimpleMembershipProvider.cs +++ b/AspNetWebStack/src/WebMatrix.WebData/SimpleMembershipProvider.cs @@ -562,12 +562,8 @@ public override bool ConfirmAccount(string accountConfirmationToken) + " WHERE [ConfirmationToken] = @0", accountConfirmationToken ) - .Where( - r => - ((string)r[1]).Equals( - accountConfirmationToken, - StringComparison.Ordinal - ) + .Where(r => + ((string)r[1]).Equals(accountConfirmationToken, StringComparison.Ordinal) ) .ToList(); Debug.Assert( diff --git a/AspNetWebStack/test/Microsoft.AspNet.Facebook.Test/Helpers/MockHelpers.cs b/AspNetWebStack/test/Microsoft.AspNet.Facebook.Test/Helpers/MockHelpers.cs index a1a5c9c00e5..7d9694d1418 100644 --- a/AspNetWebStack/test/Microsoft.AspNet.Facebook.Test/Helpers/MockHelpers.cs +++ b/AspNetWebStack/test/Microsoft.AspNet.Facebook.Test/Helpers/MockHelpers.cs @@ -58,12 +58,11 @@ public static ActionDescriptor CreateActionDescriptor( .Setup(a => a.GetCustomAttributes(typeof(FacebookAuthorizeAttribute), true)) .Returns(actionAuthorizeAttributes ?? new object[0]); actionDescriptor - .Setup( - a => - a.ControllerDescriptor.GetCustomAttributes( - typeof(FacebookAuthorizeAttribute), - true - ) + .Setup(a => + a.ControllerDescriptor.GetCustomAttributes( + typeof(FacebookAuthorizeAttribute), + true + ) ) .Returns(controllerAuthorizeAttributes ?? new object[0]); return actionDescriptor.Object; diff --git a/AspNetWebStack/test/Microsoft.Web.Helpers.Test/ThemesTest.cs b/AspNetWebStack/test/Microsoft.Web.Helpers.Test/ThemesTest.cs index b76d2864c03..d0a211a1c55 100644 --- a/AspNetWebStack/test/Microsoft.Web.Helpers.Test/ThemesTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Helpers.Test/ThemesTest.cs @@ -509,13 +509,12 @@ params Dir[] fileSystem var directoryPath = themeRoot + '\\' + directory.Name; dir.SetupGet(d => d.Name).Returns(directory.Name); mockVpp - .Setup( - c => - c.GetDirectory( - It.Is( - p => p.Equals(directoryPath, StringComparison.OrdinalIgnoreCase) - ) + .Setup(c => + c.GetDirectory( + It.Is(p => + p.Equals(directoryPath, StringComparison.OrdinalIgnoreCase) ) + ) ) .Returns(dir.Object); diff --git a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/ComplexModelDtoModelBinderTest.cs b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/ComplexModelDtoModelBinderTest.cs index 733bf60d85e..1efb42a954c 100644 --- a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/ComplexModelDtoModelBinderTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/ComplexModelDtoModelBinderTest.cs @@ -25,8 +25,8 @@ public void BindModel() Mock mockStringBinder = new Mock(); mockStringBinder - .Setup( - b => b.BindModel(controllerContext, It.IsAny()) + .Setup(b => + b.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) @@ -44,8 +44,8 @@ public void BindModel() Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - b => b.BindModel(controllerContext, It.IsAny()) + .Setup(b => + b.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) @@ -63,8 +63,8 @@ public void BindModel() Mock mockDateTimeBinder = new Mock(); mockDateTimeBinder - .Setup( - b => b.BindModel(controllerContext, It.IsAny()) + .Setup(b => + b.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) diff --git a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/DictionaryModelBinderTest.cs b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/DictionaryModelBinderTest.cs index 4f21e3e5c92..01fe44a1c93 100644 --- a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/DictionaryModelBinderTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/DictionaryModelBinderTest.cs @@ -33,8 +33,8 @@ public void BindModel() Mock mockKvpBinder = new Mock(); mockKvpBinder - .Setup( - o => o.BindModel(controllerContext, It.IsAny()) + .Setup(o => + o.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) diff --git a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/KeyValuePairModelBinderUtilTest.cs b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/KeyValuePairModelBinderUtilTest.cs index 61b5edd2146..5f6f56d1d9b 100644 --- a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/KeyValuePairModelBinderUtilTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/KeyValuePairModelBinderUtilTest.cs @@ -29,8 +29,8 @@ public void TryBindStrongModel_BinderExists_BinderReturnsCorrectlyTypedObject_Re Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - o => o.BindModel(controllerContext, It.IsAny()) + .Setup(o => + o.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) @@ -82,8 +82,8 @@ public void TryBindStrongModel_BinderExists_BinderReturnsIncorrectlyTypedObject_ Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - o => o.BindModel(controllerContext, It.IsAny()) + .Setup(o => + o.BindModel(controllerContext, It.IsAny()) ) .Returns( delegate(ControllerContext cc, ExtensibleModelBindingContext mbc) diff --git a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/MutableObjectModelBinderProviderTest.cs b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/MutableObjectModelBinderProviderTest.cs index a1330ba03cd..ce85a042176 100644 --- a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/MutableObjectModelBinderProviderTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/ModelBinding/Test/MutableObjectModelBinderProviderTest.cs @@ -23,8 +23,9 @@ public void GetBinder_NoPrefixInValueProvider_ReturnsNull() ValueProvider = new SimpleValueProvider() }; - MutableObjectModelBinderProvider binderProvider = - new MutableObjectModelBinderProvider(); + MutableObjectModelBinderProvider binderProvider = new MutableObjectModelBinderProvider( + + ); // Act IExtensibleModelBinder binder = binderProvider.GetBinder(null, bindingContext); @@ -47,8 +48,9 @@ public void GetBinder_PrefixInValueProvider_ReturnsBinder() ValueProvider = new SimpleValueProvider { { "foo.bar", "someValue" } } }; - MutableObjectModelBinderProvider binderProvider = - new MutableObjectModelBinderProvider(); + MutableObjectModelBinderProvider binderProvider = new MutableObjectModelBinderProvider( + + ); // Act IExtensibleModelBinder binder = binderProvider.GetBinder(null, bindingContext); @@ -72,8 +74,9 @@ public void GetBinder_TypeIsComplexModelDto_ReturnsNull() ValueProvider = new SimpleValueProvider { { "foo.bar", "someValue" } } }; - MutableObjectModelBinderProvider binderProvider = - new MutableObjectModelBinderProvider(); + MutableObjectModelBinderProvider binderProvider = new MutableObjectModelBinderProvider( + + ); // Act IExtensibleModelBinder binder = binderProvider.GetBinder(null, bindingContext); diff --git a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/Test/FormExtensionsTest.cs b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/Test/FormExtensionsTest.cs index c34b733d01c..c460f41add0 100644 --- a/AspNetWebStack/test/Microsoft.Web.Mvc.Test/Test/FormExtensionsTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.Mvc.Test/Test/FormExtensionsTest.cs @@ -23,8 +23,8 @@ public void FormWithPostAction() HtmlHelper htmlHelper = GetFormHelper(out writer); // Act - IDisposable formDisposable = htmlHelper.BeginForm( - action => action.About() + IDisposable formDisposable = htmlHelper.BeginForm(action => + action.About() ); formDisposable.Dispose(); diff --git a/AspNetWebStack/test/Microsoft.Web.WebPages.OAuth.Test/OAuthWebSecurityTest.cs b/AspNetWebStack/test/Microsoft.Web.WebPages.OAuth.Test/OAuthWebSecurityTest.cs index 4102ff80fa0..b6f08c09e55 100644 --- a/AspNetWebStack/test/Microsoft.Web.WebPages.OAuth.Test/OAuthWebSecurityTest.cs +++ b/AspNetWebStack/test/Microsoft.Web.WebPages.OAuth.Test/OAuthWebSecurityTest.cs @@ -68,18 +68,16 @@ public void RequestAuthenticationRedirectsToProviderWithNullReturnUrl() var client = new Mock(); client.Setup(c => c.ProviderName).Returns("windowslive"); client - .Setup( - c => - c.RequestAuthentication( - context.Object, - It.Is( - u => - u.AbsoluteUri.StartsWith( - "http://live.com/login.aspx?__provider__=windowslive", - StringComparison.OrdinalIgnoreCase - ) + .Setup(c => + c.RequestAuthentication( + context.Object, + It.Is(u => + u.AbsoluteUri.StartsWith( + "http://live.com/login.aspx?__provider__=windowslive", + StringComparison.OrdinalIgnoreCase ) ) + ) ) .Verifiable(); @@ -108,18 +106,16 @@ public void RequestAuthenticationRedirectsToProviderWithReturnUrl() var client = new Mock(); client.Setup(c => c.ProviderName).Returns("yahoo"); client - .Setup( - c => - c.RequestAuthentication( - context.Object, - It.Is( - u => - u.AbsoluteUri.StartsWith( - "http://yahoo.com/?__provider__=yahoo", - StringComparison.OrdinalIgnoreCase - ) + .Setup(c => + c.RequestAuthentication( + context.Object, + It.Is(u => + u.AbsoluteUri.StartsWith( + "http://yahoo.com/?__provider__=yahoo", + StringComparison.OrdinalIgnoreCase ) ) + ) ) .Verifiable(); diff --git a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedMediaTypeFormatterTests.cs b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedMediaTypeFormatterTests.cs index cbbe009c334..ea00af677cf 100644 --- a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedMediaTypeFormatterTests.cs +++ b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/FormUrlEncodedMediaTypeFormatterTests.cs @@ -48,8 +48,8 @@ public void SupportedMediaTypes_HeaderValuesAreNotSharedBetweenInstances() foreach (MediaTypeHeaderValue mediaType1 in formatter1.SupportedMediaTypes) { - MediaTypeHeaderValue mediaType2 = formatter2.SupportedMediaTypes.Single( - m => m.Equals(mediaType1) + MediaTypeHeaderValue mediaType2 = formatter2.SupportedMediaTypes.Single(m => + m.Equals(mediaType1) ); Assert.NotSame(mediaType1, mediaType2); } diff --git a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs index 048e50342e9..e7a7570c7f0 100644 --- a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs +++ b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeFormatterTestBase.cs @@ -55,8 +55,8 @@ public void SupportedMediaTypes_HeaderValuesAreNotSharedBetweenInstances() foreach (MediaTypeHeaderValue mediaType1 in formatter1.SupportedMediaTypes) { - MediaTypeHeaderValue mediaType2 = formatter2.SupportedMediaTypes.Single( - m => m.Equals(mediaType1) + MediaTypeHeaderValue mediaType2 = formatter2.SupportedMediaTypes.Single(m => + m.Equals(mediaType1) ); Assert.NotSame(mediaType1, mediaType2); } @@ -70,8 +70,7 @@ public void SupportEncodings_ValuesAreNotSharedBetweenInstances() foreach (Encoding mediaType1 in formatter1.SupportedEncodings) { - Encoding mediaType2 = formatter2.SupportedEncodings.Single( - m => m.Equals(mediaType1) + Encoding mediaType2 = formatter2.SupportedEncodings.Single(m => m.Equals(mediaType1) ); Assert.NotSame(mediaType1, mediaType2); } @@ -338,15 +337,14 @@ public virtual async Task Overridden_WriteToStreamAsyncWithoutCancellationToken_ ObjectContent content = new ObjectContent(42, formatter.Object); formatter - .Setup( - f => - f.WriteToStreamAsync( - typeof(int), - 42, - stream, - content, - null /* transportContext */ - ) + .Setup(f => + f.WriteToStreamAsync( + typeof(int), + 42, + stream, + content, + null /* transportContext */ + ) ) .Returns(TaskHelpers.Completed()) .Verifiable(); @@ -367,17 +365,16 @@ public virtual async Task Overridden_WriteToStreamAsyncWithCancellationToken_Get ObjectContent content = new ObjectContent(42, formatter.Object); formatter - .Setup( - f => - f.WriteToStreamAsync( - typeof(int), - 42, - stream, - content, - null /* transportContext */ - , - CancellationToken.None - ) + .Setup(f => + f.WriteToStreamAsync( + typeof(int), + 42, + stream, + content, + null /* transportContext */ + , + CancellationToken.None + ) ) .Returns(TaskHelpers.Completed()) .Verifiable(); @@ -402,14 +399,13 @@ public virtual async Task Overridden_ReadFromStreamAsyncWithoutCancellationToken CancellationTokenSource cts = new CancellationTokenSource(); formatter - .Setup( - f => - f.ReadFromStreamAsync( - typeof(string), - It.IsAny(), - content, - null /*formatterLogger */ - ) + .Setup(f => + f.ReadFromStreamAsync( + typeof(string), + It.IsAny(), + content, + null /*formatterLogger */ + ) ) .Returns(Task.FromResult(null)) .Verifiable(); @@ -434,16 +430,15 @@ public virtual async Task Overridden_ReadFromStreamAsyncWithCancellationToken_Ge CancellationTokenSource cts = new CancellationTokenSource(); formatter - .Setup( - f => - f.ReadFromStreamAsync( - typeof(string), - It.IsAny(), - content, - null /*formatterLogger */ - , - cts.Token - ) + .Setup(f => + f.ReadFromStreamAsync( + typeof(string), + It.IsAny(), + content, + null /*formatterLogger */ + , + cts.Token + ) ) .Returns(Task.FromResult(null)) .Verifiable(); diff --git a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeWithQualityHeaderValueComparerTests.cs b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeWithQualityHeaderValueComparerTests.cs index 6c131deccba..bdc93c745ba 100644 --- a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeWithQualityHeaderValueComparerTests.cs +++ b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/MediaTypeWithQualityHeaderValueComparerTests.cs @@ -181,8 +181,8 @@ public void ComparerReturnsNonZeroForNonEqualValues(string mediaType1, string me public void ComparerSortsListCorrectly(string[] unsorted, string[] expectedSorted) { // Arrange - IEnumerable unsortedValues = unsorted.Select( - u => MediaTypeWithQualityHeaderValue.Parse(u) + IEnumerable unsortedValues = unsorted.Select(u => + MediaTypeWithQualityHeaderValue.Parse(u) ); IEnumerable expectedSortedValues = diff --git a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/StringWithQualityHeaderValueComparerTests.cs b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/StringWithQualityHeaderValueComparerTests.cs index 614f5196e03..763bc18f569 100644 --- a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/StringWithQualityHeaderValueComparerTests.cs +++ b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Formatting/StringWithQualityHeaderValueComparerTests.cs @@ -174,8 +174,8 @@ string stringWithQuality2 public void ComparerSortsListCorrectly(string[] unsorted, string[] expectedSorted) { // Arrange - IEnumerable unsortedValues = unsorted.Select( - u => StringWithQualityHeaderValue.Parse(u) + IEnumerable unsortedValues = unsorted.Select(u => + StringWithQualityHeaderValue.Parse(u) ); IEnumerable expectedSortedValues = expectedSorted.Select( diff --git a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs index 71d6396f326..57c8aa27fbc 100644 --- a/AspNetWebStack/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs +++ b/AspNetWebStack/test/System.Net.Http.Formatting.Test/Internal/TranscodingStreamTests.cs @@ -803,28 +803,26 @@ private async Task RunReadTestAsync( if (suppressExpectedCancellationTokenAsserts) { delegatingInnerStreamMock - .Setup( - o => - o.ReadAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(o => + o.ReadAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(innerStream.ReadAsync); } else { delegatingInnerStreamMock - .Setup( - o => - o.ReadAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - expectedCancellationToken - ) + .Setup(o => + o.ReadAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + expectedCancellationToken + ) ) .Returns(innerStream.ReadAsync); } @@ -1105,23 +1103,24 @@ public void Write_WithInvalidArgs_Throws() public async Task WriteAsync_WithFullData() { MemoryStream sink = new(); - CancellationToken expectedFlushAsyncCancellationToken = - new CancellationTokenSource().Token; - CancellationToken expectedWriteAsyncCancellationToken = - new CancellationTokenSource().Token; + CancellationToken expectedFlushAsyncCancellationToken = new CancellationTokenSource( + + ).Token; + CancellationToken expectedWriteAsyncCancellationToken = new CancellationTokenSource( + + ).Token; var innerStreamMock = new Mock(MockBehavior.Strict); innerStreamMock.Setup(o => o.CanWrite).Returns(true); #if true // In current src/ projects, always pass byte array to inner Stream. innerStreamMock - .Setup( - o => - o.WriteAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - expectedWriteAsyncCancellationToken - ) + .Setup(o => + o.WriteAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + expectedWriteAsyncCancellationToken + ) ) .Returns(sink.WriteAsync); #else @@ -1215,14 +1214,13 @@ public async Task WriteAsync_WithPartialData() innerStreamMock.Setup(o => o.CanWrite).Returns(true); #if true // In current src/ projects, always pass byte array to inner Stream. innerStreamMock - .Setup( - o => - o.WriteAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - expectedCancellationToken - ) + .Setup(o => + o.WriteAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + expectedCancellationToken + ) ) .Returns(sink.WriteAsync); #else diff --git a/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsEngineTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsEngineTracerTest.cs index 6505fe92ac5..7978a09afae 100644 --- a/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsEngineTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsEngineTracerTest.cs @@ -18,12 +18,8 @@ public void EvaluatePolicy_CallsInner() Mock corsEngineMock = new Mock(); bool innerIsCalled = false; corsEngineMock - .Setup( - engine => - engine.EvaluatePolicy( - It.IsAny(), - It.IsAny() - ) + .Setup(engine => + engine.EvaluatePolicy(It.IsAny(), It.IsAny()) ) .Returns(() => { @@ -47,14 +43,13 @@ public void EvaluatePolicy_EmitTraces() TraceRecord endTrace = null; Mock traceWriterMock = new Mock(); traceWriterMock - .Setup( - t => - t.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(t => + t.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback>( (request, category, level, traceAction) => @@ -73,12 +68,8 @@ public void EvaluatePolicy_EmitTraces() ); Mock corsEngineMock = new Mock(); corsEngineMock - .Setup( - engine => - engine.EvaluatePolicy( - It.IsAny(), - It.IsAny() - ) + .Setup(engine => + engine.EvaluatePolicy(It.IsAny(), It.IsAny()) ) .Returns(new CorsResult()); CorsEngineTracer tracer = new CorsEngineTracer( @@ -116,14 +107,13 @@ public void EvaluatePolicy_Trace_ContainsHttpRequest() Mock traceWriterMock = new Mock(); traceWriterMock - .Setup( - t => - t.Trace( - httpRequest, - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(t => + t.Trace( + httpRequest, + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Verifiable(); diff --git a/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsPolicyProviderTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsPolicyProviderTracerTest.cs index 00c75a1e46c..c3e6a70056b 100644 --- a/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsPolicyProviderTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Cors.Test/Tracing/CorsPolicyProviderTracerTest.cs @@ -20,9 +20,8 @@ public async Task GetCorsPolicyAsync_CallsInner() Mock traceWriterMock = new Mock(); Mock policyProviderMock = new Mock(); policyProviderMock - .Setup( - f => - f.GetCorsPolicyAsync(It.IsAny(), CancellationToken.None) + .Setup(f => + f.GetCorsPolicyAsync(It.IsAny(), CancellationToken.None) ) .Returns(() => { @@ -46,14 +45,13 @@ public async Task GetCorsPolicyAsync_EmitTraces() TraceRecord endTrace = null; Mock traceWriterMock = new Mock(); traceWriterMock - .Setup( - t => - t.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(t => + t.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback>( (request, category, level, traceAction) => diff --git a/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/FormattersTest.cs b/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/FormattersTest.cs index c5880167835..f71d6f01d7d 100644 --- a/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/FormattersTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/FormattersTest.cs @@ -32,12 +32,12 @@ public void CustomRequestBodyFormatters_ShowUpOnDescription() config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector); IApiExplorer explorer = config.Services.GetApiExplorer(); - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Assert.True( - description.SupportedRequestBodyFormatters.Any( - formatter => formatter == customFormatter + description.SupportedRequestBodyFormatters.Any(formatter => + formatter == customFormatter ), "Did not find the custom formatter on the SupportedRequestBodyFormatters." ); @@ -60,12 +60,12 @@ public void CustomResponseFormatters_ShowUpOnDescription() config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector); IApiExplorer explorer = config.Services.GetApiExplorer(); - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Assert.True( - description.SupportedResponseFormatters.Any( - formatter => formatter == customFormatter + description.SupportedResponseFormatters.Any(formatter => + formatter == customFormatter ), "Did not find the custom formatter on the SupportedResponseFormatters." ); @@ -91,8 +91,8 @@ public void SupportedRequestBodyFormatters_ReturnsFormattersWithoutTracers_WithN IApiExplorer explorer = config.Services.GetApiExplorer(); // Act - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Collection formatters = description.SupportedRequestBodyFormatters; @@ -121,8 +121,8 @@ public void SupportedResponseFormatters_ReturnsFormattersWithoutTracers_WithNoTr IApiExplorer explorer = config.Services.GetApiExplorer(); // Act - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Collection formatters = description.SupportedResponseFormatters; @@ -153,8 +153,8 @@ public void SupportedRequestBodyFormatters_ReturnsFormattersWithoutTracers_WithT IApiExplorer explorer = config.Services.GetApiExplorer(); // Act - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Collection formatters = description.SupportedRequestBodyFormatters; @@ -185,8 +185,8 @@ public void SupportedResponseFormatters_ReturnsFormattersWithoutTracers_WithTrac IApiExplorer explorer = config.Services.GetApiExplorer(); // Act - ApiDescription description = explorer.ApiDescriptions.FirstOrDefault( - desc => desc.ActionDescriptor.ActionName == "PostItem" + ApiDescription description = explorer.ApiDescriptions.FirstOrDefault(desc => + desc.ActionDescriptor.ActionName == "PostItem" ); Collection formatters = description.SupportedResponseFormatters; diff --git a/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/ResponseTypeAttributeTest.cs b/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/ResponseTypeAttributeTest.cs index c664f7b9400..ebe12159fb2 100644 --- a/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/ResponseTypeAttributeTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Integration.Test/ApiExplorer/ResponseTypeAttributeTest.cs @@ -36,11 +36,10 @@ int responseFormattersCount config.Services.Replace(typeof(IHttpControllerSelector), controllerSelector); Collection apis = config.Services.GetApiExplorer().ApiDescriptions; - ApiDescription expectedApi = apis.FirstOrDefault( - api => - api.ActionDescriptor.ActionName == actionName - && api.ResponseDescription.DeclaredType == declaredType - && api.ResponseDescription.ResponseType == responseType + ApiDescription expectedApi = apis.FirstOrDefault(api => + api.ActionDescriptor.ActionName == actionName + && api.ResponseDescription.DeclaredType == declaredType + && api.ResponseDescription.ResponseType == responseType ); Assert.NotNull(expectedApi); diff --git a/AspNetWebStack/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs b/AspNetWebStack/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs index fad12cdd438..d2c792979e0 100644 --- a/AspNetWebStack/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Integration.Test/Tracing/TracingTest.cs @@ -583,24 +583,23 @@ IList actualRecords foreach (ExpectedTraceRecord expectedRecord in expectedRecords) { - TraceRecord beginTrace = actualRecords.SingleOrDefault( - r => - String.Equals( - r.Category, - expectedRecord.Category, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operator, - expectedRecord.OperatorName, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operation, - expectedRecord.OperationName, - StringComparison.OrdinalIgnoreCase - ) - && r.Kind == TraceKind.Begin + TraceRecord beginTrace = actualRecords.SingleOrDefault(r => + String.Equals( + r.Category, + expectedRecord.Category, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operator, + expectedRecord.OperatorName, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operation, + expectedRecord.OperationName, + StringComparison.OrdinalIgnoreCase + ) + && r.Kind == TraceKind.Begin ); if (beginTrace == null) @@ -615,24 +614,23 @@ IList actualRecords ); } - TraceRecord endTrace = actualRecords.SingleOrDefault( - r => - String.Equals( - r.Category, - expectedRecord.Category, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operator, - expectedRecord.OperatorName, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operation, - expectedRecord.OperationName, - StringComparison.OrdinalIgnoreCase - ) - && r.Kind == TraceKind.End + TraceRecord endTrace = actualRecords.SingleOrDefault(r => + String.Equals( + r.Category, + expectedRecord.Category, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operator, + expectedRecord.OperatorName, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operation, + expectedRecord.OperationName, + StringComparison.OrdinalIgnoreCase + ) + && r.Kind == TraceKind.End ); if (endTrace == null) @@ -698,23 +696,22 @@ IList actualRecords continue; } - ExpectedTraceRecord expectedTrace = expectedRecords.FirstOrDefault( - r => - String.Equals( - r.Category, - actualRecord.Category, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.OperatorName, - actualRecord.Operator, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.OperationName, - actualRecord.Operation, - StringComparison.OrdinalIgnoreCase - ) + ExpectedTraceRecord expectedTrace = expectedRecords.FirstOrDefault(r => + String.Equals( + r.Category, + actualRecord.Category, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.OperatorName, + actualRecord.Operator, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.OperationName, + actualRecord.Operation, + StringComparison.OrdinalIgnoreCase + ) ); if (expectedTrace == null) @@ -744,24 +741,23 @@ IList actualRecords int traceBeginPos = 0; foreach (ExpectedTraceRecord expectedRecord in expectedRecords) { - TraceRecord beginTrace = actualRecords.SingleOrDefault( - r => - String.Equals( - r.Category, - expectedRecord.Category, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operator, - expectedRecord.OperatorName, - StringComparison.OrdinalIgnoreCase - ) - && String.Equals( - r.Operation, - expectedRecord.OperationName, - StringComparison.OrdinalIgnoreCase - ) - && object.Equals(r.Kind, expectedRecord.TraceKind) + TraceRecord beginTrace = actualRecords.SingleOrDefault(r => + String.Equals( + r.Category, + expectedRecord.Category, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operator, + expectedRecord.OperatorName, + StringComparison.OrdinalIgnoreCase + ) + && String.Equals( + r.Operation, + expectedRecord.OperationName, + StringComparison.OrdinalIgnoreCase + ) + && object.Equals(r.Kind, expectedRecord.TraceKind) ); // Ignore record of a ReflectionTypeLoadException to allow test to succeed in Visual Studio. The record is an diff --git a/AspNetWebStack/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs b/AspNetWebStack/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs index a2debf5f938..5dafe043934 100644 --- a/AspNetWebStack/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Owin.Test/HttpMessageHandlerAdapterTest.cs @@ -1470,8 +1470,8 @@ public async Task Invoke_IfBufferingFaults_CallsExceptionServices() exceptionLoggerMock.Verify( l => l.LogAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), expectedCancellationToken ), @@ -1799,14 +1799,13 @@ public async Task Invoke_IfBufferingErrorFaults_CallsExceptionLogger() mock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedOriginalException - && c.ExceptionContext.CatchBlock - == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferContent - && c.ExceptionContext.Request != null - && c.ExceptionContext.Response == expectedOriginalResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedOriginalException + && c.ExceptionContext.CatchBlock + == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferContent + && c.ExceptionContext.Request != null + && c.ExceptionContext.Response == expectedOriginalResponse ), expectedCancellationToken ), @@ -1815,14 +1814,13 @@ public async Task Invoke_IfBufferingErrorFaults_CallsExceptionLogger() mock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedErrorException - && c.ExceptionContext.CatchBlock - == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferError - && c.ExceptionContext.Request != null - && c.ExceptionContext.Response == expectedErrorResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedErrorException + && c.ExceptionContext.CatchBlock + == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferError + && c.ExceptionContext.Request != null + && c.ExceptionContext.Response == expectedErrorResponse ), expectedCancellationToken ), @@ -1883,14 +1881,13 @@ await Assert.ThrowsAsync( mock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedOriginalException - && c.ExceptionContext.CatchBlock - == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferContent - && c.ExceptionContext.Request != null - && c.ExceptionContext.Response == expectedOriginalResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedOriginalException + && c.ExceptionContext.CatchBlock + == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferContent + && c.ExceptionContext.Request != null + && c.ExceptionContext.Response == expectedOriginalResponse ), expectedCancellationToken ), @@ -1902,14 +1899,13 @@ await Assert.ThrowsAsync( mock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedErrorException - && c.ExceptionContext.CatchBlock - == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferError - && c.ExceptionContext.Request != null - && c.ExceptionContext.Response == expectedErrorResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedErrorException + && c.ExceptionContext.CatchBlock + == OwinExceptionCatchBlocks.HttpMessageHandlerAdapterBufferError + && c.ExceptionContext.Request != null + && c.ExceptionContext.Response == expectedErrorResponse ), expectedCancellationToken ), @@ -2290,12 +2286,11 @@ private static Exception CreateException() private static IExceptionHandler CreateExceptionHandler(IHttpActionResult result) { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback((c, i) => c.Result = result) .Returns(Task.FromResult(0)); @@ -2336,8 +2331,8 @@ private static IOwinRequest CreateFakeOwinRequest(Action disableBuffering) >(MockBehavior.Strict); object disableBufferingValue = disableBuffering; environmentMock - .Setup( - d => d.TryGetValue("server.DisableRequestBuffering", out disableBufferingValue) + .Setup(d => + d.TryGetValue("server.DisableRequestBuffering", out disableBufferingValue) ) .Returns(true); IDictionary environment = environmentMock.Object; @@ -2386,8 +2381,8 @@ private static IOwinResponse CreateFakeOwinResponse(Action disableBuffering) >(MockBehavior.Strict); object disableBufferingValue = disableBuffering; environmentMock - .Setup( - d => d.TryGetValue("server.DisableResponseBuffering", out disableBufferingValue) + .Setup(d => + d.TryGetValue("server.DisableResponseBuffering", out disableBufferingValue) ) .Returns(true); IDictionary environment = environmentMock.Object; @@ -2433,24 +2428,22 @@ private static MediaTypeFormatter CreateFaultingFormatter(Exception exception) { Mock mock = new Mock(); mock.Setup(f => f.CanWriteType(It.IsAny())).Returns(true); - mock.Setup( - f => - f.GetPerRequestFormatterInstance( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.GetPerRequestFormatterInstance( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(mock.Object); - mock.Setup( - f => - f.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(CreateFaultedTask(exception)); return mock.Object; @@ -2540,12 +2533,11 @@ private static HttpResponseMessage CreateResponse(HttpContent content) private static Mock CreateStubExceptionHandlerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); return mock; @@ -2559,12 +2551,8 @@ private static IExceptionLogger CreateStubExceptionLogger() private static Mock CreateStubExceptionLoggerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); return mock; diff --git a/AspNetWebStack/test/System.Web.Http.Owin.Test/OwinResponseExtensionsTests.cs b/AspNetWebStack/test/System.Web.Http.Owin.Test/OwinResponseExtensionsTests.cs index 8368fd2bc6d..7e257609bd0 100644 --- a/AspNetWebStack/test/System.Web.Http.Owin.Test/OwinResponseExtensionsTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Owin.Test/OwinResponseExtensionsTests.cs @@ -98,9 +98,8 @@ bool hasDisableBufferingAction Mock> mock = new Mock>( MockBehavior.Strict ); - mock.Setup( - d => - d.TryGetValue("server.DisableResponseBuffering", out disableBufferingAction) + mock.Setup(d => + d.TryGetValue("server.DisableResponseBuffering", out disableBufferingAction) ) .Returns(hasDisableBufferingAction); return mock.Object; diff --git a/AspNetWebStack/test/System.Web.Http.Owin.Test/WebApiAppBuilderExtensionsTest.cs b/AspNetWebStack/test/System.Web.Http.Owin.Test/WebApiAppBuilderExtensionsTest.cs index 3a53bc4bc77..eff36b6a596 100644 --- a/AspNetWebStack/test/System.Web.Http.Owin.Test/WebApiAppBuilderExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Owin.Test/WebApiAppBuilderExtensionsTest.cs @@ -80,14 +80,13 @@ public void UseWebApi_UsesAdapter() var config = new HttpConfiguration(); var appBuilder = new Mock(); appBuilder - .Setup( - ab => - ab.Use( - typeof(HttpMessageHandlerAdapter), - It.Is( - (o) => ((HttpServer)o.MessageHandler).Configuration == config - ) + .Setup(ab => + ab.Use( + typeof(HttpMessageHandlerAdapter), + It.Is( + (o) => ((HttpServer)o.MessageHandler).Configuration == config ) + ) ) .Returns(appBuilder.Object) .Verifiable(); @@ -120,17 +119,16 @@ public async Task UseWebApi_UsesAdapterAndConfigServices() }; appBuilder.SetupGet(b => b.Properties).Returns(properties); appBuilder - .Setup( - ab => - ab.Use( - typeof(HttpMessageHandlerAdapter), - It.Is( - (o) => - ((HttpServer)o.MessageHandler).Configuration == config - && o.BufferPolicySelector == bufferPolicySelector - && o.AppDisposing == expectedAppDisposing - ) + .Setup(ab => + ab.Use( + typeof(HttpMessageHandlerAdapter), + It.Is( + (o) => + ((HttpServer)o.MessageHandler).Configuration == config + && o.BufferPolicySelector == bufferPolicySelector + && o.AppDisposing == expectedAppDisposing ) + ) ) .Callback( (i, args) => @@ -159,12 +157,11 @@ public void UseWebApiWithHttpServer_UsesAdapter() HttpServer httpServer = new Mock().Object; Mock appBuilderMock = new Mock(); appBuilderMock - .Setup( - ab => - ab.Use( - typeof(HttpMessageHandlerAdapter), - It.Is((o) => o.MessageHandler == httpServer) - ) + .Setup(ab => + ab.Use( + typeof(HttpMessageHandlerAdapter), + It.Is((o) => o.MessageHandler == httpServer) + ) ) .Returns(appBuilderMock.Object) .Verifiable(); @@ -202,17 +199,16 @@ public async Task UseWebApiWithHttpServer_UsesAdapterAndConfigServices() }; appBuilderMock.SetupGet(b => b.Properties).Returns(properties); appBuilderMock - .Setup( - ab => - ab.Use( - typeof(HttpMessageHandlerAdapter), - It.Is( - (o) => - o.MessageHandler == httpServer - && o.BufferPolicySelector == bufferPolicySelector - && o.AppDisposing == expectedAppDisposing - ) + .Setup(ab => + ab.Use( + typeof(HttpMessageHandlerAdapter), + It.Is( + (o) => + o.MessageHandler == httpServer + && o.BufferPolicySelector == bufferPolicySelector + && o.AppDisposing == expectedAppDisposing ) + ) ) .Callback( (i, args) => diff --git a/AspNetWebStack/test/System.Web.Http.SelfHost.Test/HttpSelfHostConfigurationTest.cs b/AspNetWebStack/test/System.Web.Http.SelfHost.Test/HttpSelfHostConfigurationTest.cs index 8fe3b45fb69..6671118c7a1 100644 --- a/AspNetWebStack/test/System.Web.Http.SelfHost.Test/HttpSelfHostConfigurationTest.cs +++ b/AspNetWebStack/test/System.Web.Http.SelfHost.Test/HttpSelfHostConfigurationTest.cs @@ -22,11 +22,9 @@ public static TheoryDataSet< { get { - return new TheoryDataSet< - string, - HttpBindingSecurityMode, - HttpClientCredentialType - >() + return new TheoryDataSet( + + ) { { "http://localhost", @@ -50,11 +48,9 @@ public static TheoryDataSet< { get { - return new TheoryDataSet< - string, - HttpBindingSecurityMode, - HttpClientCredentialType - >() + return new TheoryDataSet( + + ) { { "http://localhost", @@ -78,11 +74,9 @@ public static TheoryDataSet< { get { - return new TheoryDataSet< - string, - HttpBindingSecurityMode, - HttpClientCredentialType - >() + return new TheoryDataSet( + + ) { { "http://localhost", @@ -146,11 +140,9 @@ public static TheoryDataSet< { get { - return new TheoryDataSet< - string, - HttpBindingSecurityMode, - HttpClientCredentialType - >() + return new TheoryDataSet( + + ) { { "http://localhost", @@ -453,8 +445,9 @@ public void HttpSelfHostConfiguration_UserNamePasswordValidator_RoundTrips() public void HttpSelfHostConfiguration_X509CertificateValidator_RoundTrips() { // Arrange - X509CertificateValidator x509CertificateValidator = - new Mock().Object; + X509CertificateValidator x509CertificateValidator = new Mock( + + ).Object; Assert.Reflection.Property( new HttpSelfHostConfiguration("http://localhost"), diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerActionInvokerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerActionInvokerTest.cs index d9a7ae7b1b4..75d648a9955 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerActionInvokerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerActionInvokerTest.cs @@ -17,8 +17,9 @@ public class ApiControllerActionInvokerTest private readonly HttpActionContext _actionContext; private readonly Mock _actionDescriptorMock = new Mock(); - private readonly ApiControllerActionInvoker _actionInvoker = - new ApiControllerActionInvoker(); + private readonly ApiControllerActionInvoker _actionInvoker = new ApiControllerActionInvoker( + + ); private readonly HttpControllerContext _controllerContext; private readonly HttpRequestMessage _request = new HttpRequestMessage(); private readonly Mock _converterMock = @@ -48,13 +49,12 @@ public async Task InvokeActionAsync_InvokesActionDescriptorExecuteAsync() { var cts = new CancellationTokenSource(); _actionDescriptorMock - .Setup( - ad => - ad.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(ad => + ad.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)null)); @@ -76,13 +76,12 @@ public async Task InvokeActionAsync_PassesExecutionResultToConfiguredConverter() { var value = new object(); _actionDescriptorMock - .Setup( - ad => - ad.ExecuteAsync( - _actionContext.ControllerContext, - _actionContext.ActionArguments, - CancellationToken.None - ) + .Setup(ad => + ad.ExecuteAsync( + _actionContext.ControllerContext, + _actionContext.ActionArguments, + CancellationToken.None + ) ) .Returns(Task.FromResult(value)); @@ -99,13 +98,12 @@ public async Task InvokeActionAsync_ReturnsResponseFromConverter() { var expectedResponse = new HttpResponseMessage(); _actionDescriptorMock - .Setup( - ad => - ad.ExecuteAsync( - _actionContext.ControllerContext, - _actionContext.ActionArguments, - CancellationToken.None - ) + .Setup(ad => + ad.ExecuteAsync( + _actionContext.ControllerContext, + _actionContext.ActionArguments, + CancellationToken.None + ) ) .Returns(Task.FromResult(new object())); _converterMock @@ -125,13 +123,12 @@ public async Task InvokeActionAsync_WhenExecuteThrowsHttpResponseException_Retur { HttpResponseMessage response = new HttpResponseMessage(); _actionDescriptorMock - .Setup( - ad => - ad.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - CancellationToken.None - ) + .Setup(ad => + ad.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + CancellationToken.None + ) ) .Throws(new HttpResponseException(response)); @@ -149,13 +146,12 @@ public async Task InvokeActionAsync_WhenExecuteThrows_ReturnsFaultedTask() { Exception expectedException = new Exception(); _actionDescriptorMock - .Setup( - ad => - ad.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - CancellationToken.None - ) + .Setup(ad => + ad.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + CancellationToken.None + ) ) .Throws(expectedException); @@ -177,13 +173,12 @@ public async Task InvokeActionAsync_ForActionResult_ReturnsResultResponse() IHttpActionResult result = CreateStubResult(expectedResponse); _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(IHttpActionResult)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - _actionContext.ControllerContext, - _actionContext.ActionArguments, - cancellationToken - ) + .Setup(d => + d.ExecuteAsync( + _actionContext.ControllerContext, + _actionContext.ActionArguments, + cancellationToken + ) ) .Returns(Task.FromResult((object)result)); @@ -215,13 +210,12 @@ public async Task InvokeActionAsync_ForActionResult_AddsRequestMessage_WhenMissi .Setup(d => d.ReturnType) .Returns(typeof(IHttpActionResult)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)result)); @@ -256,13 +250,12 @@ public async Task InvokeActionAsync_ForActionResult_LeavesRequestMessage_WhenPre .Setup(d => d.ReturnType) .Returns(typeof(IHttpActionResult)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)result)); @@ -288,13 +281,12 @@ public async Task InvokeActionAsync_ForActionResult_HandlesHttpResponseException HttpStatusCode.Ambiguous ); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Throws(expectedException); @@ -314,13 +306,12 @@ public Task InvokeActionAsync_ForActionResult_Throws_WhenResultIsNull() // Arrange _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(IHttpActionResult)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult(null)); @@ -344,13 +335,12 @@ public Task InvokeActionAsync_ForActionResult_Throws_WhenResponseIsNull() _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(IHttpActionResult)); IHttpActionResult emptyResult = CreateStubResult(null); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)emptyResult)); @@ -373,13 +363,12 @@ public Task InvokeActionAsync_ForActionResult_Throws_WhenResultIsNotActionResult // Arrange _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(IHttpActionResult)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult(new object())); @@ -405,13 +394,12 @@ public async Task InvokeActionAsync_DeclaredObject_ReturnsWidget() _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(object)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)result)); @@ -442,13 +430,12 @@ public async Task InvokeActionAsync_WrongReturnType_Throws() .SetupGet(d => d.ResultConverter) .Returns(new ValueResultConverter()); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)result)); @@ -472,13 +459,12 @@ public async Task InvokeActionAsync_DeclaredObject_ReturnsActionResult() _actionDescriptorMock.Setup(d => d.ReturnType).Returns(typeof(object)); _actionDescriptorMock - .Setup( - d => - d.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(d => + d.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult((object)mockActionResult.Object)); diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerTest.cs index f59d41af713..27713d2d959 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ApiControllerTest.cs @@ -30,8 +30,9 @@ namespace System.Web.Http { public class ApiControllerTest { - private readonly HttpActionContext _actionContextInstance = - ContextUtil.CreateActionContext(); + private readonly HttpActionContext _actionContextInstance = ContextUtil.CreateActionContext( + + ); private readonly HttpConfiguration _configurationInstance = new HttpConfiguration(); private readonly HttpActionDescriptor _actionDescriptorInstance = new Mock() { CallBase = true }.Object; @@ -53,12 +54,11 @@ public async Task Setting_CustomActionInvoker() Mock mockInvoker = new Mock(); mockInvoker - .Setup( - invoker => - invoker.InvokeActionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(invoker => + invoker.InvokeActionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => { @@ -428,12 +428,11 @@ public async Task ExecuteAsync_InvokesAuthenticationFilters_ThenInvokesAuthoriza Mock binderMock = new Mock(); Mock actionBindingMock = new Mock(); actionBindingMock - .Setup( - b => - b.ExecuteBindingAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(b => + b.ExecuteBindingAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( () => @@ -471,12 +470,11 @@ public async Task ExecuteAsync_InvokesAuthenticationFilters_ThenInvokesAuthoriza Mock authenticationFilterMock = new Mock(); authenticationFilterMock - .Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback(() => { @@ -496,12 +494,11 @@ public async Task ExecuteAsync_InvokesAuthenticationFilters_ThenInvokesAuthoriza return response; }); authenticationFilterMock - .Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -536,12 +533,11 @@ public async Task ExecuteAsync_InvokesAuthenticationFilters_ThenInvokesAuthoriza ApiController controller = controllerMock.Object; var invokerMock = new Mock(); invokerMock - .Setup( - i => - i.InvokeActionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(i => + i.InvokeActionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( () => @@ -626,8 +622,8 @@ public void GetFilters_UsesFilterProvidersToGetFilters() actionDescriptorMock.GetFilterPipeline().ToList(); // Assert - filterProviderMock.Verify( - fp => fp.GetFilters(_configurationInstance, actionDescriptorMock) + filterProviderMock.Verify(fp => + fp.GetFilters(_configurationInstance, actionDescriptorMock) ); } @@ -777,13 +773,12 @@ public Task ExecuteAsync_RunsExceptionFilter_WhenActionFilterThrowsException() ApiController controller = new ExceptionlessController(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.ExecuteActionFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(f => + f.ExecuteActionFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Callback(() => { @@ -810,13 +805,12 @@ public Task ExecuteAsync_RunsExceptionFilter_WhenAuthorizationFilterThrowsExcept ApiController controller = new ExceptionlessController(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.ExecuteAuthorizationFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(f => + f.ExecuteAuthorizationFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Callback(() => { @@ -843,12 +837,11 @@ public Task ExecuteAsync_RunsExceptionFilter_WhenAuthenticationFilterAuthenticat ApiController controller = new ExceptionlessController(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback(() => { @@ -875,21 +868,19 @@ public Task ExecuteAsync_RunsExceptionFilter_WhenAuthenticationFilterChallengeTh ApiController controller = new ExceptionlessController(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => Task.FromResult(null)); filterMock - .Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback(() => { @@ -941,12 +932,11 @@ Action configure } Mock spy = new Mock(); - spy.Setup( - f => - f.ExecuteExceptionFilterAsync( - It.IsAny(), - It.IsAny() - ) + spy.Setup(f => + f.ExecuteExceptionFilterAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -981,12 +971,8 @@ public async Task ExecuteAsync_IfActionThrows_CallsExceptionServicesFromConfigur MockBehavior.Strict ); exceptionLoggerMock - .Setup( - h => - h.LogAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.LogAsync(It.IsAny(), It.IsAny()) ) .Returns( (c, i) => @@ -1001,12 +987,11 @@ public async Task ExecuteAsync_IfActionThrows_CallsExceptionServicesFromConfigur MockBehavior.Strict ); exceptionHandlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -1620,13 +1605,12 @@ private Mock CreateAuthorizationFilterMock( { Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.ExecuteAuthorizationFilterAsync( - It.IsAny(), - CancellationToken.None, - It.IsAny>>() - ) + .Setup(f => + f.ExecuteAuthorizationFilterAsync( + It.IsAny(), + CancellationToken.None, + It.IsAny>>() + ) ) .Returns(implementation) .Verifiable(); @@ -1644,13 +1628,12 @@ private Mock CreateActionFilterMock( { Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.ExecuteActionFilterAsync( - It.IsAny(), - CancellationToken.None, - It.IsAny>>() - ) + .Setup(f => + f.ExecuteActionFilterAsync( + It.IsAny(), + CancellationToken.None, + It.IsAny>>() + ) ) .Returns(implementation) .Verifiable(); @@ -1685,12 +1668,11 @@ private static HttpRequestContext CreateRequestContext() private static IExceptionFilter CreateStubExceptionFilter() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - f => - f.ExecuteExceptionFilterAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ExecuteExceptionFilterAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); return mock.Object; diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/AuthenticationFilterResultTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/AuthenticationFilterResultTests.cs index c0e1966849a..2056a383522 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/AuthenticationFilterResultTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/AuthenticationFilterResultTests.cs @@ -546,12 +546,11 @@ Action authenticate ) { Mock mock = new Mock(); - mock.Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -560,12 +559,11 @@ Action authenticate } ) .Returns(() => Task.FromResult(null)); - mock.Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => Task.FromResult(null)); return mock.Object; @@ -577,12 +575,11 @@ Action challenge ) { Mock mock = new Mock(); - mock.Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -591,12 +588,11 @@ Action challenge } ) .Returns(() => Task.FromResult(null)); - mock.Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -613,20 +609,18 @@ Action challenge ) { Mock mock = new Mock(); - mock.Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => Task.FromResult(null)); - mock.Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -690,20 +684,18 @@ private static IHttpActionResult CreateStubActionResult() private static IAuthenticationFilter CreateStubFilter() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => Task.FromResult(null)); - mock.Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(() => Task.FromResult(null)); return mock.Object; diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ExceptionFilterResultTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ExceptionFilterResultTests.cs index 2c12676280b..0c3fe3d7112 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/ExceptionFilterResultTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/ExceptionFilterResultTests.cs @@ -183,8 +183,8 @@ await Assert.ThrowsAsync( exceptionLoggerMock.Verify( l => l.LogAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), cancellationToken ), @@ -270,12 +270,11 @@ public async Task ExecuteAsync_IfInnerResultTaskIsFaulted_AndNoFilterHandles_Run Mock exceptionHandlerMock = new Mock(); exceptionHandlerMock - .Setup( - l => - l.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, i) => @@ -338,12 +337,11 @@ public async Task ExecuteAsync_IfFilterChangesException_ThrowsUpdatedException() Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.ExecuteExceptionFilterAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.ExecuteExceptionFilterAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (c, t) => @@ -450,12 +448,11 @@ Func executeExceptionFilterA ) { Mock mock = new Mock(); - mock.Setup( - f => - f.ExecuteExceptionFilterAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ExecuteExceptionFilterAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(executeExceptionFilterAsync); return mock.Object; @@ -466,12 +463,8 @@ Func logAsync ) { Mock mock = new Mock(); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(logAsync); return mock.Object; @@ -554,12 +547,11 @@ private static IExceptionHandler CreateStubExceptionHandler() private static Mock CreateStubExceptionHandlerMock() { Mock mock = new Mock(); - mock.Setup( - l => - l.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(null)); return mock; @@ -573,12 +565,8 @@ private static IExceptionLogger CreateStubExceptionLogger() private static Mock CreateStubExceptionLoggerMock() { Mock mock = new Mock(); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); return mock; diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpConfigurationTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpConfigurationTest.cs index 68dcd31871b..4c21a0243ab 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpConfigurationTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpConfigurationTest.cs @@ -268,14 +268,13 @@ public void ApplyControllerSettings_Clone_Inherits_Tracing_On_PerController_Serv HttpConfiguration config = new HttpConfiguration(); Mock mockTracer = new Mock() { CallBase = true }; mockTracer - .Setup( - m => - m.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback(() => { @@ -317,14 +316,13 @@ public void ApplyControllerSettings_Clone_Inherits_Tracing_On_PerController_Form HttpConfiguration config = new HttpConfiguration(); Mock mockTracer = new Mock() { CallBase = true }; mockTracer - .Setup( - m => - m.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback(() => { @@ -367,14 +365,13 @@ public void ApplyControllerSettings_Clone_Can_Enable_Tracing_When_Original_Disab HttpConfiguration config = new HttpConfiguration(); Mock mockTracer = new Mock() { CallBase = true }; mockTracer - .Setup( - m => - m.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback(() => { diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpControllerDescriptorTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpControllerDescriptorTest.cs index 87c0ee4a2a3..6b39b2b2e03 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpControllerDescriptorTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpControllerDescriptorTest.cs @@ -343,8 +343,9 @@ HttpControllerDescriptor controllerDescriptor class MyBaseController : ApiController { public static IHttpActionSelector SelectorBase = new Mock().Object; - public static IActionValueBinder ActionValueBinderBase = - new Mock().Object; + public static IActionValueBinder ActionValueBinderBase = new Mock( + + ).Object; } class MyConfigDerived1Attribute : Attribute, IControllerConfiguration @@ -447,8 +448,9 @@ HttpControllerDescriptor controllerDescriptor [MyControllerWithCustomFormatterConfig] class MyControllerWithCustomFormatter : ApiController { - public static MediaTypeFormatter CustomFormatter = - new Mock().Object; + public static MediaTypeFormatter CustomFormatter = new Mock( + + ).Object; } } } diff --git a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpParameterDescriptorTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpParameterDescriptorTest.cs index 79267dbff68..d08face1d42 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpParameterDescriptorTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Controllers/HttpParameterDescriptorTest.cs @@ -14,8 +14,9 @@ public class HttpParameterDescriptorTest [Fact] public void Default_Constructor() { - HttpParameterDescriptor parameterDescriptor = - new Mock().Object; + HttpParameterDescriptor parameterDescriptor = new Mock( + + ).Object; Assert.Null(parameterDescriptor.ParameterName); Assert.Null(parameterDescriptor.ParameterType); diff --git a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/CompositeExceptionLoggerTests.cs b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/CompositeExceptionLoggerTests.cs index a4c532a4b91..a88845e5e99 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/CompositeExceptionLoggerTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/CompositeExceptionLoggerTests.cs @@ -89,21 +89,13 @@ public async Task LogAsync_DelegatesToLoggers() MockBehavior.Strict ); exceptionLogger1Mock - .Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); exceptionLogger2Mock - .Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); IEnumerable loggers = new IExceptionLogger[] diff --git a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionHandlerTests.cs b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionHandlerTests.cs index 5b5c28c0291..ec48943843c 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionHandlerTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionHandlerTests.cs @@ -34,12 +34,11 @@ public void HandleAsync_IfShouldHandleReturnsTrue_DelegatesToHandleAsyncCore() Mock mock = new Mock { CallBase = true }; Task expectedTask = CreateCompletedTask(); mock.Setup(h => h.ShouldHandle(It.IsAny())).Returns(true); - mock.Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(expectedTask); diff --git a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionLoggerExtensionsTests.cs b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionLoggerExtensionsTests.cs index fb163de2a6f..7aa181433b7 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionLoggerExtensionsTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ExceptionHandling/ExceptionLoggerExtensionsTests.cs @@ -16,12 +16,8 @@ public async Task LogAsync_DelegatesToInterfaceLogAsync() // Arrange Task expectedTask = CreateCompletedTask(); Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - h => - h.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(expectedTask); @@ -46,8 +42,7 @@ public async Task LogAsync_DelegatesToInterfaceLogAsync() mock.Verify( h => h.LogAsync( - It.Is( - c => c.ExceptionContext == expectedContext + It.Is(c => c.ExceptionContext == expectedContext ), expectedCancellationToken ), diff --git a/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs b/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs index a138573871e..a446f6d3985 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/Binders/MutableObjectModelBinderTest.cs @@ -145,8 +145,9 @@ public void CreateModel() ModelMetadata = GetMetadataForType(typeof(Person)) }; - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act object retModel = testableBinder.CreateModelPublic(null, bindingContext); @@ -222,8 +223,9 @@ public void GetMetadataForProperties_WithBindAttribute() ModelMetadata = GetMetadataForType(typeof(PersonWithBindExclusion)) }; - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act IEnumerable propertyMetadatas = @@ -256,8 +258,9 @@ public void GetMetadataForProperties_WithoutBindAttribute() ModelMetadata = GetMetadataForType(typeof(Person)) }; - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act IEnumerable propertyMetadatas = @@ -412,8 +415,9 @@ public void ProcessDto_BindRequiredFieldMissing_RaisesModelError() new ModelValidationNode(nameProperty, "") ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.ProcessDto(context, bindingContext, dto); @@ -457,11 +461,12 @@ public void ProcessDto_BindRequiredFieldNull_RaisesModelError() containerMetadata, containerMetadata.Properties ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); - ModelMetadata propertyMetadata = dto.PropertyMetadata.Single( - o => o.PropertyName == "Name" + ModelMetadata propertyMetadata = dto.PropertyMetadata.Single(o => + o.PropertyName == "Name" ); dto.Results[propertyMetadata] = new ComplexModelDtoResult( "John Doe", @@ -515,8 +520,9 @@ public void ProcessDto_RequiredFieldMissing_RaisesModelError() containerMetadata, containerMetadata.Properties ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.ProcessDto(context, bindingContext, dto); @@ -563,12 +569,13 @@ public void ProcessDto_RequiredFieldNull_RaisesModelError() containerMetadata, containerMetadata.Properties ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Make Age valid and City invalid. - ModelMetadata propertyMetadata = dto.PropertyMetadata.Single( - p => p.PropertyName == "Age" + ModelMetadata propertyMetadata = dto.PropertyMetadata.Single(p => + p.PropertyName == "Age" ); dto.Results[propertyMetadata] = new ComplexModelDtoResult( 23, @@ -617,8 +624,9 @@ public void ProcessDto_RequiredFieldMissing_RaisesModelErrorWithMessage() containerMetadata, containerMetadata.Properties ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.ProcessDto(context, bindingContext, dto); @@ -658,12 +666,13 @@ public void ProcessDto_RequiredFieldNull_RaisesModelErrorWithMessage() containerMetadata, containerMetadata.Properties ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Make ValueTypeRequired invalid. - ModelMetadata propertyMetadata = dto.PropertyMetadata.Single( - p => p.PropertyName == "ValueTypeRequired" + ModelMetadata propertyMetadata = dto.PropertyMetadata.Single(p => + p.PropertyName == "ValueTypeRequired" ); dto.Results[propertyMetadata] = new ComplexModelDtoResult( null, @@ -708,27 +717,28 @@ public void ProcessDto_Success() containerMetadata.Properties ); - ModelMetadata firstNameProperty = dto.PropertyMetadata.Single( - o => o.PropertyName == "FirstName" + ModelMetadata firstNameProperty = dto.PropertyMetadata.Single(o => + o.PropertyName == "FirstName" ); dto.Results[firstNameProperty] = new ComplexModelDtoResult( "John", new ModelValidationNode(firstNameProperty, "") ); - ModelMetadata lastNameProperty = dto.PropertyMetadata.Single( - o => o.PropertyName == "LastName" + ModelMetadata lastNameProperty = dto.PropertyMetadata.Single(o => + o.PropertyName == "LastName" ); dto.Results[lastNameProperty] = new ComplexModelDtoResult( "Doe", new ModelValidationNode(lastNameProperty, "") ); - ModelMetadata dobProperty = dto.PropertyMetadata.Single( - o => o.PropertyName == "DateOfBirth" + ModelMetadata dobProperty = dto.PropertyMetadata.Single(o => + o.PropertyName == "DateOfBirth" ); dto.Results[dobProperty] = null; - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.ProcessDto(context, bindingContext, dto); @@ -751,8 +761,8 @@ public void SetProperty_PropertyHasDefaultValue_SetsDefaultValue() ModelMetadata = GetMetadataForObject(new Person()) }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "PropertyWithDefaultValue" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "PropertyWithDefaultValue" ); ModelValidationNode validationNode = new ModelValidationNode(propertyMetadata, "foo"); ComplexModelDtoResult dtoResult = new ComplexModelDtoResult( @@ -765,8 +775,9 @@ public void SetProperty_PropertyHasDefaultValue_SetsDefaultValue() .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -792,8 +803,8 @@ public void SetProperty_PropertyIsReadOnly_DoesNothing() ModelMetadata = GetMetadataForType(typeof(Person)) }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "NonUpdateableProperty" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "NonUpdateableProperty" ); ModelValidationNode validationNode = new ModelValidationNode(propertyMetadata, "foo"); ComplexModelDtoResult dtoResult = new ComplexModelDtoResult( @@ -802,8 +813,9 @@ public void SetProperty_PropertyIsReadOnly_DoesNothing() validationNode ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -829,8 +841,8 @@ public void SetProperty_PropertyIsSettable_CallsSetter() ModelMetadata = GetMetadataForObject(model) }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "DateOfBirth" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "DateOfBirth" ); ModelValidationNode validationNode = new ModelValidationNode(propertyMetadata, "foo"); ComplexModelDtoResult dtoResult = new ComplexModelDtoResult( @@ -842,8 +854,9 @@ public void SetProperty_PropertyIsSettable_CallsSetter() .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -871,8 +884,8 @@ public void SetProperty_PropertyIsSettable_SetterThrows_RecordsError() ModelMetadata = GetMetadataForObject(model) }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "DateOfDeath" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "DateOfDeath" ); ModelValidationNode validationNode = new ModelValidationNode(propertyMetadata, "foo"); ComplexModelDtoResult dtoResult = new ComplexModelDtoResult( @@ -880,8 +893,9 @@ public void SetProperty_PropertyIsSettable_SetterThrows_RecordsError() validationNode ); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -911,8 +925,8 @@ public void SetProperty_SettingNonNullableValueTypeToNull_RequiredValidatorNotPr ModelMetadata = GetMetadataForObject(new Person()), }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "DateOfBirth" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "DateOfBirth" ); ModelValidationNode validationNode = new ModelValidationNode(propertyMetadata, "foo"); ComplexModelDtoResult dtoResult = new ComplexModelDtoResult( @@ -925,8 +939,9 @@ public void SetProperty_SettingNonNullableValueTypeToNull_RequiredValidatorNotPr .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -954,8 +969,8 @@ public void SetProperty_SettingNonNullableValueTypeToNull_RequiredValidatorPrese ModelName = "foo" }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "ValueTypeRequired" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "ValueTypeRequired" ); ModelValidationNode validationNode = new ModelValidationNode( propertyMetadata, @@ -971,8 +986,9 @@ public void SetProperty_SettingNonNullableValueTypeToNull_RequiredValidatorPrese .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -1003,8 +1019,8 @@ public void SetProperty_SettingNullableTypeToNull_RequiredValidatorNotPresent_Pr ModelName = "foo" }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "NameNoAttribute" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "NameNoAttribute" ); ModelValidationNode validationNode = new ModelValidationNode( propertyMetadata, @@ -1020,8 +1036,9 @@ public void SetProperty_SettingNullableTypeToNull_RequiredValidatorNotPresent_Pr .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( @@ -1054,8 +1071,8 @@ public void SetProperty_SettingNullableTypeToNull_RequiredValidatorPresent_Prope ModelName = "foo" }; - ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single( - o => o.PropertyName == "Name" + ModelMetadata propertyMetadata = bindingContext.ModelMetadata.Properties.Single(o => + o.PropertyName == "Name" ); ModelValidationNode validationNode = new ModelValidationNode( propertyMetadata, @@ -1071,8 +1088,9 @@ public void SetProperty_SettingNullableTypeToNull_RequiredValidatorPresent_Prope .Where(v => v.IsRequired) .FirstOrDefault(); - TestableMutableObjectModelBinder testableBinder = - new TestableMutableObjectModelBinder(); + TestableMutableObjectModelBinder testableBinder = new TestableMutableObjectModelBinder( + + ); // Act testableBinder.SetPropertyPublic( diff --git a/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/FormatterParameterBindingTest.cs b/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/FormatterParameterBindingTest.cs index 0b56ecec00f..fc99df76231 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/FormatterParameterBindingTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ModelBinding/FormatterParameterBindingTest.cs @@ -90,8 +90,8 @@ public async Task ExecuteBindingAsync_PassesCancellationTokenTo_ReadContentAsync ); binding.CallBase = true; binding - .Setup( - b => b.ReadContentAsync(request, null, formatters, It.IsAny()) + .Setup(b => + b.ReadContentAsync(request, null, formatters, It.IsAny()) ) .Returns(Task.FromResult(42)) .Verifiable(); @@ -120,15 +120,14 @@ public async Task ReadContentAsync_PassesCancellationToken_Further() formatter.Setup(f => f.CanReadType(typeof(int))).Returns(true); formatter.Object.SupportedMediaTypes.Add(request.Content.Headers.ContentType); formatter - .Setup( - f => - f.ReadFromStreamAsync( - typeof(int), - It.IsAny(), - request.Content, - logger, - cts.Token - ) + .Setup(f => + f.ReadFromStreamAsync( + typeof(int), + It.IsAny(), + request.Content, + logger, + cts.Token + ) ) .Returns(Task.FromResult(42)) .Verifiable(); diff --git a/AspNetWebStack/test/System.Web.Http.Test/Results/BadRequestErrorMessageResultTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Results/BadRequestErrorMessageResultTests.cs index eb38c35c9f3..4bf1b3b0d24 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Results/BadRequestErrorMessageResultTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Results/BadRequestErrorMessageResultTests.cs @@ -334,8 +334,8 @@ public async Task ExecuteAsync_ForApiController_ReturnsCorrectResponse_WhenConte using (HttpRequestMessage expectedRequest = CreateRequest()) { Mock spy = new Mock(); - spy.Setup( - n => n.Negotiate(typeof(HttpError), expectedRequest, It.Is(formattersMatch)) + spy.Setup(n => + n.Negotiate(typeof(HttpError), expectedRequest, It.Is(formattersMatch)) ) .Returns(negotiationResult); IContentNegotiator contentNegotiator = spy.Object; diff --git a/AspNetWebStack/test/System.Web.Http.Test/Results/InvalidModelStateResultTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Results/InvalidModelStateResultTests.cs index 03a70130ead..1be68a367a5 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Results/InvalidModelStateResultTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Results/InvalidModelStateResultTests.cs @@ -419,13 +419,12 @@ public async Task ExecuteAsync_ReturnsCorrectResponse_WhenContentNegotiationFail IEnumerable expectedFormatters = CreateFormatters(); Mock spy = new Mock(); - spy.Setup( - n => - n.Negotiate( - typeof(ModelStateDictionary), - expectedRequest, - expectedFormatters - ) + spy.Setup(n => + n.Negotiate( + typeof(ModelStateDictionary), + expectedRequest, + expectedFormatters + ) ) .Returns(negotiationResult); IContentNegotiator contentNegotiator = spy.Object; @@ -496,8 +495,8 @@ public async Task ExecuteAsync_ForApiController_ReturnsCorrectResponse_WhenConte using (HttpRequestMessage expectedRequest = CreateRequest()) { Mock spy = new Mock(); - spy.Setup( - n => n.Negotiate(typeof(HttpError), expectedRequest, It.Is(formattersMatch)) + spy.Setup(n => + n.Negotiate(typeof(HttpError), expectedRequest, It.Is(formattersMatch)) ) .Returns(negotiationResult); IContentNegotiator contentNegotiator = spy.Object; diff --git a/AspNetWebStack/test/System.Web.Http.Test/Routing/LinkGenerationRouteTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Routing/LinkGenerationRouteTests.cs index ab707f837fd..87dcfffc3e9 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Routing/LinkGenerationRouteTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Routing/LinkGenerationRouteTests.cs @@ -64,8 +64,9 @@ public void GenerateRoute_GetVirtualPathIsForwarded() private class InnerRoute : IHttpRoute { private readonly IHttpRouteData _routeData = new Mock().Object; - private readonly IHttpVirtualPathData _virtualPathData = - new Mock().Object; + private readonly IHttpVirtualPathData _virtualPathData = new Mock( + + ).Object; public InnerRoute() { diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ActionFilterTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ActionFilterTracerTest.cs index 649edc34a23..bb9d3777839 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ActionFilterTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ActionFilterTracerTest.cs @@ -22,13 +22,12 @@ public async Task ExecuteActionAsync_Traces_ExecuteActionFilterAsync() HttpResponseMessage response = new HttpResponseMessage(); Mock mockFilter = new Mock() { CallBase = true }; mockFilter - .Setup( - f => - f.ExecuteActionFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(f => + f.ExecuteActionFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Returns(Task.FromResult(response)); Mock mockActionDescriptor = new Mock() @@ -94,13 +93,12 @@ public async Task ExecuteActionAsync_Faults_And_Traces_When_Inner_Faults() new TaskCompletionSource(null); tcs.TrySetException(exception); mockFilter - .Setup( - f => - f.ExecuteActionFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(f => + f.ExecuteActionFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Returns(tcs.Task); Mock mockActionDescriptor = new Mock() diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthenticationFilterTracerTests.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthenticationFilterTracerTests.cs index a682aae7c98..0f1e9a7053a 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthenticationFilterTracerTests.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthenticationFilterTracerTests.cs @@ -37,12 +37,8 @@ public async Task AuthenticateAsync_DelegatesToInnerFilter() CancellationToken expectedCancellationToken = CreateCancellationToken(); Mock mock = new Mock(); int calls = 0; - mock.Setup( - f => - f.AuthenticateAsync( - expectedAuthenticationContext, - expectedCancellationToken - ) + mock.Setup(f => + f.AuthenticateAsync(expectedAuthenticationContext, expectedCancellationToken) ) .Callback(() => { @@ -78,12 +74,11 @@ public async Task AuthenticateAsync_Traces(bool withIdentity, string expectedMes CancellationToken cancellationToken = CreateCancellationToken(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (HttpAuthenticationContext context, CancellationToken token) => @@ -132,12 +127,11 @@ public async Task AuthenticateAsync_Traces_ErrorResult() CancellationToken cancellationToken = CreateCancellationToken(); Mock filterMock = new Mock(); filterMock - .Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Callback( (HttpAuthenticationContext context, CancellationToken token) => @@ -435,20 +429,18 @@ private static HttpRequestMessage CreateRequest() private static IAuthenticationFilter CreateStubFilter() { Mock mock = new Mock(); - mock.Setup( - f => - f.AuthenticateAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.AuthenticateAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(null)); - mock.Setup( - f => - f.ChallengeAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(f => + f.ChallengeAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(null)); return mock.Object; @@ -463,14 +455,13 @@ private static ITraceWriter CreateTracer(Action trace) { Mock mock = new Mock(MockBehavior.Strict); TraceRecord record = null; - mock.Setup( - t => - t.Trace( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + mock.Setup(t => + t.Trace( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Callback>( (r, c, l, a) => diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthorizationFilterTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthorizationFilterTracerTest.cs index 98753796b8a..2fdc0e3d4df 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthorizationFilterTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/AuthorizationFilterTracerTest.cs @@ -25,13 +25,12 @@ public async Task ExecuteAuthorizationFilterAsync_Traces() CallBase = true }; mockFilter - .Setup( - f => - f.ExecuteAuthorizationFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(f => + f.ExecuteAuthorizationFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Returns(Task.FromResult(response)); Mock mockActionDescriptor = new Mock() @@ -104,13 +103,12 @@ public async Task ExecuteAuthorizationFilterAsync_Faults_And_Traces_When_Inner_F new TaskCompletionSource(response); tcs.TrySetException(exception); mockAttr - .Setup( - a => - a.ExecuteAuthorizationFilterAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>>() - ) + .Setup(a => + a.ExecuteAuthorizationFilterAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>>() + ) ) .Returns(tcs.Task); Mock mockActionDescriptor = new Mock() diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ContentNegotiatorTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ContentNegotiatorTracerTest.cs index 42b6d040cbd..339dac6b1b1 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ContentNegotiatorTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/ContentNegotiatorTracerTest.cs @@ -51,13 +51,12 @@ public void Negotiate_Returns_Inner_MediaType() // Arrange MediaTypeHeaderValue expectedMediaType = new MediaTypeHeaderValue("application/xml"); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns( new ContentNegotiationResult(new JsonMediaTypeFormatter(), expectedMediaType) @@ -80,13 +79,12 @@ public void Negotiate_Returns_Wrapped_Inner_XmlFormatter() // Arrange MediaTypeFormatter expectedFormatter = new XmlMediaTypeFormatter(); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns(new ContentNegotiationResult(expectedFormatter, null)); @@ -107,13 +105,12 @@ public void Negotiate_Returns_Wrapped_Inner_JsonFormatter() // Arrange MediaTypeFormatter expectedFormatter = new JsonMediaTypeFormatter(); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns(new ContentNegotiationResult(expectedFormatter, null)); @@ -134,13 +131,12 @@ public void Negotiate_Returns_Wrapped_Inner_FormUrlEncodedFormatter() // Arrange MediaTypeFormatter expectedFormatter = new FormUrlEncodedMediaTypeFormatter(); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns(new ContentNegotiationResult(expectedFormatter, null)); @@ -160,13 +156,12 @@ public void Negotiate_Returns_Null_Inner_Formatter() { // Arrange _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns(value: null); @@ -187,13 +182,12 @@ public void Negotiate_Traces_BeginEnd() // Arrange MediaTypeFormatter expectedFormatter = new XmlMediaTypeFormatter(); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns(new ContentNegotiationResult(expectedFormatter, null)); TraceRecord[] expectedTraces = new TraceRecord[] @@ -230,13 +224,12 @@ public void Negotiate_Throws_When_Inner_Throws() MediaTypeFormatter expectedFormatter = new XmlMediaTypeFormatter(); InvalidOperationException expectedException = new InvalidOperationException("test"); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Throws(expectedException); @@ -261,13 +254,12 @@ public void Negotiate_Traces_BeginEnd_When_Inner_Throws() MediaTypeFormatter expectedFormatter = new XmlMediaTypeFormatter(); InvalidOperationException expectedException = new InvalidOperationException("test"); _mockNegotiator - .Setup( - n => - n.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(n => + n.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Throws(expectedException); TraceRecord[] expectedTraces = new TraceRecord[] diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/FormUrlEncodedMediaTypeFormatterTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/FormUrlEncodedMediaTypeFormatterTracerTest.cs index 8df8d1e164f..795404b6db9 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/FormUrlEncodedMediaTypeFormatterTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/FormUrlEncodedMediaTypeFormatterTracerTest.cs @@ -25,8 +25,9 @@ public void MaxDepth_Uses_Inners() { // Arrange HttpRequestMessage request = new HttpRequestMessage(); - FormUrlEncodedMediaTypeFormatter innerFormatter = - new FormUrlEncodedMediaTypeFormatter(); + FormUrlEncodedMediaTypeFormatter innerFormatter = new FormUrlEncodedMediaTypeFormatter( + + ); innerFormatter.MaxDepth = innerFormatter.MaxDepth + 1; FormUrlEncodedMediaTypeFormatterTracer tracer = new FormUrlEncodedMediaTypeFormatterTracer( @@ -44,8 +45,9 @@ public void ReadBufferSize_Uses_Inners() { // Arrange HttpRequestMessage request = new HttpRequestMessage(); - FormUrlEncodedMediaTypeFormatter innerFormatter = - new FormUrlEncodedMediaTypeFormatter(); + FormUrlEncodedMediaTypeFormatter innerFormatter = new FormUrlEncodedMediaTypeFormatter( + + ); innerFormatter.ReadBufferSize = innerFormatter.ReadBufferSize + 1; FormUrlEncodedMediaTypeFormatterTracer tracer = new FormUrlEncodedMediaTypeFormatterTracer( diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpActionDescriptorTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpActionDescriptorTracerTest.cs index 9b96ca2a25d..9b5798d1c0b 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpActionDescriptorTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpActionDescriptorTracerTest.cs @@ -22,8 +22,9 @@ public class HttpActionDescriptorTracerTest public void ActionName_Calls_Inner() { // Arrange - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -48,8 +49,9 @@ public void ActionName_Calls_Inner() public void SupportedHttpMethods_Calls_Inner() { // Arrange - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Collection methods = new Collection() { HttpMethod.Delete }; Mock mockDescriptor = new Mock( @@ -76,8 +78,9 @@ public void ActionBinding_Calls_Inner() { // Arrange HttpActionBinding binding = new Mock().Object; - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -102,8 +105,9 @@ public void ActionBinding_Calls_Inner() public void ReturnType_Calls_Inner() { // Arrange - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -129,8 +133,9 @@ public void ResultConverter_Calls_Inner() { // Arrange IActionResultConverter resultConverter = new Mock().Object; - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -157,8 +162,9 @@ public void Properties_Calls_Inner() // Arrange ConcurrentDictionary properties = new ConcurrentDictionary(); - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -184,8 +190,9 @@ public void GetCustomAttributes_Calls_Inner() { // Arrange Collection customAttributes = new Collection(); - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -215,8 +222,9 @@ public void GetParameters_Calls_Inner() // Arrange Collection parameters = new Collection(); - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -242,8 +250,9 @@ public void GetFilters_Calls_Inner() { // Arrange Collection filters = new Collection(); - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -271,8 +280,9 @@ public void GetFilterPipeline_Calls_Inner() { // Arrange Collection filters = new Collection(); - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -299,8 +309,9 @@ public void GetFilterPipeline_Calls_Inner() public void Configuration_Uses_Inners() { // Assert - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -323,8 +334,9 @@ public void Configuration_Uses_Inners() public void ControllerDescriptor_Uses_Inners() { // Assert - HttpControllerDescriptor controllerDescriptor = - new Mock().Object; + HttpControllerDescriptor controllerDescriptor = new Mock( + + ).Object; controllerDescriptor.Configuration = new HttpConfiguration(); Mock mockDescriptor = new Mock( controllerDescriptor @@ -456,13 +468,12 @@ public async Task ExecuteAsync_Traces() }; mockActionDescriptor.Setup(a => a.ActionName).Returns("test"); mockActionDescriptor - .Setup( - a => - a.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - CancellationToken.None - ) + .Setup(a => + a.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + CancellationToken.None + ) ) .Returns(Task.FromResult(null)); HttpControllerContext controllerContext = ContextUtil.CreateControllerContext(); @@ -520,13 +531,12 @@ public void ExecuteAsync_Throws_What_Inner_Throws_And_Traces() }; InvalidOperationException exception = new InvalidOperationException("test"); mockActionDescriptor - .Setup( - a => - a.ExecuteAsync( - It.IsAny(), - It.IsAny>(), - CancellationToken.None - ) + .Setup(a => + a.ExecuteAsync( + It.IsAny(), + It.IsAny>(), + CancellationToken.None + ) ) .Throws(exception); mockActionDescriptor.Setup(a => a.ActionName).Returns("test"); diff --git a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpControllerTracerTest.cs b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpControllerTracerTest.cs index 1029fabe585..0951a2d3d67 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpControllerTracerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/Tracing/Tracers/HttpControllerTracerTest.cs @@ -120,12 +120,8 @@ public async Task ExecuteAsync_Invokes_Inner_And_Traces() HttpResponseMessage response = new HttpResponseMessage(); Mock mockController = new Mock() { CallBase = true }; mockController - .Setup( - b => - b.ExecuteAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(b => + b.ExecuteAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(response)); @@ -194,12 +190,8 @@ public async Task ExecuteAsync_Faults_And_Traces_When_Inner_Faults() tcs.TrySetException(exception); Mock mockController = new Mock() { CallBase = true }; mockController - .Setup( - b => - b.ExecuteAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(b => + b.ExecuteAsync(It.IsAny(), It.IsAny()) ) .Returns(tcs.Task); @@ -267,12 +259,8 @@ public async Task ExecuteAsync_IsCancelled_And_Traces_When_Inner_IsCancelled() // Arrange Mock mockController = new Mock() { CallBase = true }; mockController - .Setup( - b => - b.ExecuteAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(b => + b.ExecuteAsync(It.IsAny(), It.IsAny()) ) .Returns(TaskHelpers.Canceled()); diff --git a/AspNetWebStack/test/System.Web.Http.Test/ValueProviders/Providers/RouteDataValueProviderFactoryTest.cs b/AspNetWebStack/test/System.Web.Http.Test/ValueProviders/Providers/RouteDataValueProviderFactoryTest.cs index b92427a6a99..b122ebedb98 100644 --- a/AspNetWebStack/test/System.Web.Http.Test/ValueProviders/Providers/RouteDataValueProviderFactoryTest.cs +++ b/AspNetWebStack/test/System.Web.Http.Test/ValueProviders/Providers/RouteDataValueProviderFactoryTest.cs @@ -13,8 +13,9 @@ namespace System.Web.Http.ValueProviders.Providers { public class RouteDataValueProviderFactoryTest { - private readonly RouteDataValueProviderFactory _factory = - new RouteDataValueProviderFactory(); + private readonly RouteDataValueProviderFactory _factory = new RouteDataValueProviderFactory( + + ); [Fact] public void GetValueProvider_WhenActionContextParameterIsNull_Throws() diff --git a/AspNetWebStack/test/System.Web.Http.WebHost.Test/HttpControllerHandlerTest.cs b/AspNetWebStack/test/System.Web.Http.WebHost.Test/HttpControllerHandlerTest.cs index b87f0853f9d..07a194afcaf 100644 --- a/AspNetWebStack/test/System.Web.Http.WebHost.Test/HttpControllerHandlerTest.cs +++ b/AspNetWebStack/test/System.Web.Http.WebHost.Test/HttpControllerHandlerTest.cs @@ -963,15 +963,14 @@ public async Task CopyResponseAsync_IfHandlerIsDefault_Returns_Error_Response_Wh } formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(tcs.Task); @@ -1042,15 +1041,14 @@ public async Task CopyResponseAsync_IfHandlerIsDefault_Returns_Error_Response_Wh CallBase = true }; formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new NotSupportedException("Expected error")); @@ -1126,15 +1124,14 @@ public async Task CopyResponseAsync_Returns_User_Response_When_Formatter_Write_T CallBase = true }; formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new HttpResponseException(errorResponse)); @@ -1176,15 +1173,14 @@ public async Task CopyResponseAsync_Returns_User_Response_When_Formatter_Write_T CallBase = true }; formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new HttpResponseException(errorResponse)); @@ -1228,15 +1224,14 @@ public async Task CopyResponseAsync_Returns_InternalServerError_And_No_Content_W // This formatter throws on any write attempt formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(tcs.Task); @@ -1286,15 +1281,14 @@ public async Task CopyResponseAsync_Returns_InternalServerError_And_No_Content_W // This formatter throws on any write attempt formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new NotSupportedException("Expected error")); @@ -1342,13 +1336,12 @@ public async Task CopyResponseAsync_Returns_InternalServerError_And_No_Content_W CallBase = true }; negotiatorMock - .Setup( - m => - m.Negotiate( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Negotiate( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Returns( (Type t, HttpRequestMessage r, IEnumerable f) => @@ -1372,15 +1365,14 @@ public async Task CopyResponseAsync_Returns_InternalServerError_And_No_Content_W // This formatter throws on any write attempt formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new NotSupportedException("Expected error")); @@ -1431,15 +1423,14 @@ public async Task CopyResponseAsync_Returns_InternalServerError_And_No_Content_W // This formatter throws on any write attempt formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new NotSupportedException("Expected error")); @@ -1513,15 +1504,14 @@ public async Task WriteStreamedResponseContentAsync_Aborts_When_Formatter_Write_ CallBase = true }; formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new NotSupportedException("Expected error")); @@ -1564,15 +1554,14 @@ public async Task WriteStreamedResponseContentAsync_Aborts_When_Formatter_Write_ CallBase = true }; formatterMock - .Setup( - m => - m.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(tcs.Task); @@ -1605,12 +1594,8 @@ public async Task WriteStreamedResponseContentAsync_IfCopyToAsyncThrows_CallsExc Exception expectedException = CreateException(); Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); IExceptionLogger logger = mock.Object; @@ -1639,14 +1624,13 @@ await HttpControllerHandler.WriteStreamedResponseContentAsync( mock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerStreamContent - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerStreamContent + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedResponse ), expectedCancellationToken ), @@ -1735,8 +1719,8 @@ await Assert.ThrowsAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), expectedCancellationToken ), @@ -1745,8 +1729,8 @@ await Assert.ThrowsAsync( handlerMock.Verify( l => l.HandleAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), expectedCancellationToken ), @@ -1806,12 +1790,11 @@ public async Task WriteBufferedResponseContentAsync_IfCopyToAsyncThrowsAndHandle MockBehavior.Strict ); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -1910,12 +1893,11 @@ public async Task WriteBufferedResponseContentAsync_IfCopyToAsyncOnErrorResponse MockBehavior.Strict ); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -1945,14 +1927,13 @@ await HttpControllerHandler.WriteBufferedResponseContentAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedOriginalException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferContent - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedOriginalResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedOriginalException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferContent + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedOriginalResponse ), expectedCancellationToken ), @@ -1961,14 +1942,13 @@ await HttpControllerHandler.WriteBufferedResponseContentAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedErrorException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedErrorResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedErrorException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedErrorResponse ), expectedCancellationToken ), @@ -1998,12 +1978,11 @@ public async Task WriteBufferedResponseContentAsync_IfCopyToAsyncOnErrorResponse MockBehavior.Strict ); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -2035,14 +2014,13 @@ await Assert.ThrowsAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedOriginalException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferContent - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedOriginalResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedOriginalException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferContent + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedOriginalResponse ), expectedCancellationToken ), @@ -2051,14 +2029,13 @@ await Assert.ThrowsAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedErrorException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedErrorResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedErrorException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedErrorResponse ), expectedCancellationToken ), @@ -2098,14 +2075,13 @@ await HttpControllerHandler.PrepareHeadersAsync( loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerComputeContentLength - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerComputeContentLength + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedResponse ), expectedCancellationToken ), @@ -2480,12 +2456,11 @@ private static IExceptionHandler CreateStubExceptionHandler() private static Mock CreateStubExceptionHandlerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); return mock; @@ -2499,12 +2474,8 @@ private static IExceptionLogger CreateStubExceptionLogger() private static Mock CreateStubExceptionLoggerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); return mock; diff --git a/AspNetWebStack/test/System.Web.Http.WebHost.Test/Routing/HttpRouteExceptionHandlerTests.cs b/AspNetWebStack/test/System.Web.Http.WebHost.Test/Routing/HttpRouteExceptionHandlerTests.cs index ce0b8abdc04..bfd6fc5ee4b 100644 --- a/AspNetWebStack/test/System.Web.Http.WebHost.Test/Routing/HttpRouteExceptionHandlerTests.cs +++ b/AspNetWebStack/test/System.Web.Http.WebHost.Test/Routing/HttpRouteExceptionHandlerTests.cs @@ -205,8 +205,8 @@ public async Task ProcessRequestAsync_IfExceptionIsNotHttpResponseException_Call loggerMock.Verify( l => l.LogAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), CancellationToken.None ), @@ -215,8 +215,8 @@ public async Task ProcessRequestAsync_IfExceptionIsNotHttpResponseException_Call handlerMock.Verify( l => l.HandleAsync( - It.Is( - c => exceptionContextMatches(c.ExceptionContext) + It.Is(c => + exceptionContextMatches(c.ExceptionContext) ), CancellationToken.None ), @@ -236,12 +236,11 @@ public async Task ProcessRequestAsync_IfHandlerHandles_UsesHandlerResult() HttpStatusCode expectedStatusCode = HttpStatusCode.Ambiguous; Mock handlerMock = new Mock(MockBehavior.Strict); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -339,12 +338,11 @@ public async Task ProcessRequestAsync_IfCopyToAsyncOnErrorResponseThrows_CallsEx MockBehavior.Strict ); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, i) => @@ -372,13 +370,12 @@ public async Task ProcessRequestAsync_IfCopyToAsyncOnErrorResponseThrows_CallsEx loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedOriginalException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpWebRoute - && c.ExceptionContext.Request == expectedRequest + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedOriginalException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpWebRoute + && c.ExceptionContext.Request == expectedRequest ), CancellationToken.None ), @@ -387,14 +384,13 @@ public async Task ProcessRequestAsync_IfCopyToAsyncOnErrorResponseThrows_CallsEx loggerMock.Verify( l => l.LogAsync( - It.Is( - c => - c.ExceptionContext != null - && c.ExceptionContext.Exception == expectedErrorException - && c.ExceptionContext.CatchBlock - == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError - && c.ExceptionContext.Request == expectedRequest - && c.ExceptionContext.Response == expectedErrorResponse + It.Is(c => + c.ExceptionContext != null + && c.ExceptionContext.Exception == expectedErrorException + && c.ExceptionContext.CatchBlock + == WebHostExceptionCatchBlocks.HttpControllerHandlerBufferError + && c.ExceptionContext.Request == expectedRequest + && c.ExceptionContext.Response == expectedErrorResponse ), CancellationToken.None ), @@ -461,24 +457,22 @@ public async Task ProcessRequestAsync_IfExceptionIsNotHttpResponseException_Disp ExceptionDispatchInfo exceptionInfo = CreateExceptionInfo(CreateException()); Mock loggerMock = new Mock(MockBehavior.Strict); loggerMock - .Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LogAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); Mock handlerMock = new Mock( MockBehavior.Strict ); handlerMock - .Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); @@ -692,12 +686,11 @@ private static IExceptionHandler CreateStubExceptionHandler() private static Mock CreateStubExceptionHandlerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - h => - h.HandleAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(h => + h.HandleAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)); return mock; @@ -711,12 +704,8 @@ private static IExceptionLogger CreateStubExceptionLogger() private static Mock CreateStubExceptionLoggerMock() { Mock mock = new Mock(MockBehavior.Strict); - mock.Setup( - l => - l.LogAsync( - It.IsAny(), - It.IsAny() - ) + mock.Setup(l => + l.LogAsync(It.IsAny(), It.IsAny()) ) .Returns(Task.FromResult(0)); return mock; diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ChildActionExtensionsTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ChildActionExtensionsTest.cs index 33de1ee99b5..2ce34b21442 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ChildActionExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ChildActionExtensionsTest.cs @@ -26,12 +26,8 @@ public ChildActionExtensionsTest() { _route = new Mock(); _route - .Setup( - r => - r.GetVirtualPath( - It.IsAny(), - It.IsAny() - ) + .Setup(r => + r.GetVirtualPath(It.IsAny(), It.IsAny()) ) .Returns(() => _virtualPathData); @@ -49,13 +45,12 @@ public ChildActionExtensionsTest() .Setup(hc => hc.Response.ApplyAppPathModifier(It.IsAny())) .Callback(s => returnValue = s) .Returns(() => returnValue); - _httpContext.Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + _httpContext.Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ); _viewContext = new ViewContext @@ -126,13 +121,12 @@ public void ServerExecuteCalledWithWrappedChildActionMvcHandler() TextWriter callbackTextWriter = null; bool callbackPreserveForm = false; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, textWriter, preserveForm) => @@ -174,13 +168,12 @@ public void RouteDataTokensIncludesParentActionViewContext() // Arrange MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -214,13 +207,12 @@ public void RouteValuesIncludeNewActionName() // Arrange MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -251,13 +243,12 @@ public void RouteValuesIncludeOldControllerNameWhenControllerNameIsNullOrEmpty() _originalRouteData.Values["controller"] = "oldController"; MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -288,13 +279,12 @@ public void RouteValuesIncludeNewControllerNameWhenControllNameIsNotEmpty() _originalRouteData.Values["controller"] = "oldController"; MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -325,13 +315,12 @@ public void PassedRouteValuesOverrideParentRequestRouteValues() _originalRouteData.Values["name2"] = "value2"; MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -371,13 +360,12 @@ public void NoChildActionValuesDictionaryCreatedIfNoRouteValuesPassed() // Arrange MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -408,13 +396,12 @@ public void RouteValuesDoesNotIncludeExplicitlyPassedAreaName() route.DataTokens["area"] = "myArea"; MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -450,13 +437,12 @@ public void RouteValuesIncludeExplicitlyPassedAreaNameIfAreasNotInUse() Route route = _routes.MapRoute("my-area", "my-area"); MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -521,13 +507,12 @@ public void ActionHelper_ChildAction_WithControllerDirectRoute() MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => @@ -562,13 +547,12 @@ public void ActionHelper_ChildAction_WithActionDirectRoute() MvcHandler mvcHandler = null; _httpContext - .Setup( - hc => - hc.Server.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(hc => + hc.Server.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (handler, _, __) => diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/DisplayNameExtensionsTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/DisplayNameExtensionsTest.cs index 4e4d9b04ad9..254cf248bed 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/DisplayNameExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/DisplayNameExtensionsTest.cs @@ -78,13 +78,12 @@ public void DisplayNameConsultsMetadataProviderForMetadataAboutProperty() MetadataHelper metadataHelper = new MetadataHelper(); metadataHelper - .MetadataProvider.Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - typeof(Model), - "PropertyName" - ) + .MetadataProvider.Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + typeof(Model), + "PropertyName" + ) ) .Returns(metadataHelper.Metadata.Object) .Verifiable(); @@ -110,8 +109,8 @@ public void DisplayNameUsesMetadataForPropertyName() "Custom property name from metadata" ); metadataHelper - .MetadataProvider.Setup( - p => p.GetMetadataForType(It.IsAny>(), It.IsAny()) + .MetadataProvider.Setup(p => + p.GetMetadataForType(It.IsAny>(), It.IsAny()) ) .Returns(metadataHelper.Metadata.Object); @@ -343,13 +342,12 @@ public MetadataHelper() .Setup(p => p.GetMetadataForProperties(It.IsAny(), It.IsAny())) .Returns(new ModelMetadata[0]); MetadataProvider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Returns(Metadata.Object); MetadataProvider diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/TemplateHelpersTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/TemplateHelpersTest.cs index 45e6b2fb63e..c98d03012d1 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/TemplateHelpersTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/TemplateHelpersTest.cs @@ -78,8 +78,8 @@ public void ExecuteTemplateUsesViewFromViewEngineInReadOnlyMode() ); ViewContext callbackViewContext = null; engine - .Engine.Setup( - e => e.FindPartialView(html.ViewContext, "DisplayTemplates/String", true) + .Engine.Setup(e => + e.FindPartialView(html.ViewContext, "DisplayTemplates/String", true) ) .Returns(new ViewEngineResult(engine.View.Object, engine.Engine.Object)) .Verifiable(); @@ -136,8 +136,8 @@ public void ExecuteTemplateUsesViewFromViewEngineInEditMode() ); ViewContext callbackViewContext = null; engine - .Engine.Setup( - e => e.FindPartialView(html.ViewContext, "EditorTemplates/String", true) + .Engine.Setup(e => + e.FindPartialView(html.ViewContext, "EditorTemplates/String", true) ) .Returns(new ViewEngineResult(engine.View.Object, engine.Engine.Object)) .Verifiable(); @@ -193,13 +193,12 @@ public void ExecuteTemplateUsesViewFromDefaultActionsInReadOnlyMode() html.ViewData ); engine - .Engine.Setup( - e => - e.FindPartialView( - html.ViewContext, - "DisplayTemplates/String", - It.IsAny() - ) + .Engine.Setup(e => + e.FindPartialView( + html.ViewContext, + "DisplayTemplates/String", + It.IsAny() + ) ) .Returns(new ViewEngineResult(new string[0])) .Verifiable(); @@ -240,13 +239,12 @@ public void ExecuteTemplateUsesViewFromDefaultActionsInEditMode() html.ViewData ); engine - .Engine.Setup( - e => - e.FindPartialView( - html.ViewContext, - "EditorTemplates/String", - It.IsAny() - ) + .Engine.Setup(e => + e.FindPartialView( + html.ViewContext, + "EditorTemplates/String", + It.IsAny() + ) ) .Returns(new ViewEngineResult(new string[0])) .Verifiable(); @@ -1842,13 +1840,12 @@ public MockViewEngine(bool returnView = true) Engine = new Mock(); Engine - .Setup( - e => - e.FindPartialView( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(e => + e.FindPartialView( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( returnView diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ValidationExtensionsTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ValidationExtensionsTest.cs index ce0fee38817..ac3379c5243 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ValidationExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Html/Test/ValidationExtensionsTest.cs @@ -47,12 +47,8 @@ public void Validate_AddsClientValidationMetadata() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -165,12 +161,8 @@ public void ValidateFor_AddsClientValidationMetadata() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -540,12 +532,8 @@ public void ValidationMessageWithClientValidation_DefaultMessage_Valid() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -611,12 +599,8 @@ public void ValidationMessageWithClientValidation_DefaultMessage_Valid_Unobtrusi Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -671,12 +655,8 @@ public void ValidationMessageWithClientValidation_ExplicitMessage_Valid() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -742,12 +722,8 @@ public void ValidationMessageWithClientValidation_ExplicitMessage_Valid_Unobtrus Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -1474,12 +1450,8 @@ public void ValidationMessageForWithClientValidation() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); @@ -1546,12 +1518,8 @@ public void ValidationMessageForWithClientValidation_Unobtrusive() Mock mockValidatorProvider = new Mock(); mockValidatorProvider - .Setup( - vp => - vp.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(vp => + vp.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new[] { mockValidator.Object }); ModelValidatorProviders.Providers.Add(mockValidatorProvider.Object); diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/AssociatedValidatorProviderTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/AssociatedValidatorProviderTest.cs index 93de040b193..1d445885d42 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/AssociatedValidatorProviderTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/AssociatedValidatorProviderTest.cs @@ -50,13 +50,8 @@ public void GetValidatorsForPropertyWithLocalAttributes() Mock provider = new Mock { CallBase = true }; provider - .Setup( - p => - p.AbstractGetValidators( - metadata, - context, - It.IsAny>() - ) + .Setup(p => + p.AbstractGetValidators(metadata, context, It.IsAny>()) ) .Callback>( (m, c, attributes) => callbackAttributes = attributes @@ -86,13 +81,8 @@ public void GetValidatorsForPropertyWithMetadataAttributes() Mock provider = new Mock { CallBase = true }; provider - .Setup( - p => - p.AbstractGetValidators( - metadata, - context, - It.IsAny>() - ) + .Setup(p => + p.AbstractGetValidators(metadata, context, It.IsAny>()) ) .Callback>( (m, c, attributes) => callbackAttributes = attributes @@ -122,13 +112,8 @@ public void GetValidatorsForPropertyWithMixedAttributes() Mock provider = new Mock { CallBase = true }; provider - .Setup( - p => - p.AbstractGetValidators( - metadata, - context, - It.IsAny>() - ) + .Setup(p => + p.AbstractGetValidators(metadata, context, It.IsAny>()) ) .Callback>( (m, c, attributes) => callbackAttributes = attributes diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/AuthorizeAttributeTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/AuthorizeAttributeTest.cs index 9d1938fa9c3..d23e73acf27 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/AuthorizeAttributeTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/AuthorizeAttributeTest.cs @@ -34,8 +34,9 @@ private class ClassWithMultipleAuthorizeAttributes { } public void CanRetrieveMultipleAuthorizeAttributesFromOneClass() { // Arrange - ClassWithMultipleAuthorizeAttributes @class = - new ClassWithMultipleAuthorizeAttributes(); + ClassWithMultipleAuthorizeAttributes @class = new ClassWithMultipleAuthorizeAttributes( + + ); // Act IEnumerable attributes = TypeDescriptor @@ -165,12 +166,11 @@ public void OnAuthorizationCallsHandleUnauthorizedRequestIfUserUnauthorized() mockAuthContext.Setup(c => c.HttpContext.User.Identity.IsAuthenticated).Returns(false); mockAuthContext.Setup(c => c.HttpContext.Items).Returns(new Hashtable()); mockAuthContext - .Setup( - c => - c.ActionDescriptor.ControllerDescriptor.IsDefined( - typeof(AllowAnonymousAttribute), - true - ) + .Setup(c => + c.ActionDescriptor.ControllerDescriptor.IsDefined( + typeof(AllowAnonymousAttribute), + true + ) ) .Returns(false); AuthorizationContext authContext = mockAuthContext.Object; @@ -228,12 +228,11 @@ public void OnAuthorizationHooksCacheValidationIfUserAuthorized() .Verifiable(); mockFilterContext.Setup(c => c.HttpContext.Items).Returns(new Hashtable()); mockFilterContext - .Setup( - c => - c.HttpContext.Response.Cache.AddValidationCallback( - It.IsAny(), - null /* data */ - ) + .Setup(c => + c.HttpContext.Response.Cache.AddValidationCallback( + It.IsAny(), + null /* data */ + ) ) .Callback( delegate(HttpCacheValidateHandler handler, object data) @@ -244,12 +243,11 @@ public void OnAuthorizationHooksCacheValidationIfUserAuthorized() ) .Verifiable(); mockFilterContext - .Setup( - c => - c.ActionDescriptor.ControllerDescriptor.IsDefined( - typeof(AllowAnonymousAttribute), - true - ) + .Setup(c => + c.ActionDescriptor.ControllerDescriptor.IsDefined( + typeof(AllowAnonymousAttribute), + true + ) ) .Returns(false); AuthorizationContext filterContext = mockFilterContext.Object; @@ -317,12 +315,11 @@ public void OnAuthorizationReturnsWithNoResultIfAllowAnonymousAttributeIsDefined Mock mockFilterContext = new Mock(); mockFilterContext.Setup(c => c.HttpContext.Items).Returns(new Hashtable()); mockFilterContext - .Setup( - c => - c.ActionDescriptor.ControllerDescriptor.IsDefined( - typeof(AllowAnonymousAttribute), - true - ) + .Setup(c => + c.ActionDescriptor.ControllerDescriptor.IsDefined( + typeof(AllowAnonymousAttribute), + true + ) ) .Returns(true); diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs index 96b23e3ab81..0813ea99297 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ControllerActionInvokerTest.cs @@ -971,24 +971,18 @@ public void InvokeAction() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns(authorizationContext) .Verifiable(); @@ -997,37 +991,34 @@ public void InvokeAction() .Returns(parameters) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeActionMethodWithFilters( - context, - filterInfo.ActionFilters, - ad, - parameters - ) + .Setup(h => + h.PublicInvokeActionMethodWithFilters( + context, + filterInfo.ActionFilters, + ad, + parameters + ) ) .Returns(postContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFiltersChallenge( - context, - filterInfo.AuthenticationFilters, - ad, - actionResult - ) + .Setup(h => + h.PublicInvokeAuthenticationFiltersChallenge( + context, + filterInfo.AuthenticationFilters, + ad, + actionResult + ) ) .Returns(authenticationChallengeContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeActionResultWithFilters( - context, - filterInfo.ResultFilters, - challengeResult - ) + .Setup(h => + h.PublicInvokeActionResultWithFilters( + context, + filterInfo.ResultFilters, + challengeResult + ) ) .Returns((ResultExecutedContext)null) .Verifiable(); @@ -1074,24 +1065,18 @@ public void InvokeActionCallsValidateRequestIfAsked() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns(authorizationContext) .Verifiable(); @@ -1133,24 +1118,18 @@ public void InvokeActionDoesNotCallValidateRequestForChildActions() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns(authorizationContext) .Verifiable(); @@ -1444,24 +1423,18 @@ public void InvokeActionInvokesExceptionFiltersAndExecutesResultIfExceptionHandl .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Throws(exception) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeExceptionFilters( - context, - filterInfo.ExceptionFilters, - exception - ) + .Setup(h => + h.PublicInvokeExceptionFilters(context, filterInfo.ExceptionFilters, exception) ) .Returns(exContext) .Verifiable(); @@ -1501,35 +1474,24 @@ public void InvokeActionInvokesExceptionFiltersAndRethrowsExceptionIfNotHandled( .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Throws(exception) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeExceptionFilters( - context, - filterInfo.ExceptionFilters, - exception - ) + .Setup(h => + h.PublicInvokeExceptionFilters(context, filterInfo.ExceptionFilters, exception) ) .Returns(exContext) .Verifiable(); @@ -1591,25 +1553,23 @@ public void InvokeActionInvokesResultIfAuthenticationFilterReturnsResult() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFiltersChallenge( - context, - filterInfo.AuthenticationFilters, - ad, - actionResult - ) + .Setup(h => + h.PublicInvokeAuthenticationFiltersChallenge( + context, + filterInfo.AuthenticationFilters, + ad, + actionResult + ) ) .Returns(authenticationChallengeContext) .Verifiable(); @@ -1657,36 +1617,29 @@ public void InvokeActionInvokesResultIfAuthorizationFilterReturnsResult() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns(authorizationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFiltersChallenge( - context, - filterInfo.AuthenticationFilters, - ad, - actionResult - ) + .Setup(h => + h.PublicInvokeAuthenticationFiltersChallenge( + context, + filterInfo.AuthenticationFilters, + ad, + actionResult + ) ) .Returns(authenticationChallengeContext) .Verifiable(); @@ -1717,8 +1670,8 @@ public void InvokeActionMethod() Mock mockHelper = new Mock() { CallBase = true }; mockHelper - .Setup( - h => h.PublicCreateActionResult(controllerContext, mockAd.Object, "hello world") + .Setup(h => + h.PublicCreateActionResult(controllerContext, mockAd.Object, "hello world") ) .Returns(expectedResult); ControllerActionInvokerHelper helper = mockHelper.Object; @@ -1885,24 +1838,18 @@ public void InvokeActionPropagatesThreadAbortException() .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns( delegate( @@ -2051,24 +1998,18 @@ public void InvokeActionWithResultExceptionInvokesExceptionFiltersAndExecutesRes .Verifiable(); mockHelper.Setup(h => h.PublicGetFilters(context, ad)).Returns(filterInfo).Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFilters( - context, - filterInfo.AuthenticationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthenticationFilters( + context, + filterInfo.AuthenticationFilters, + ad + ) ) .Returns(authenticationContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthorizationFilters( - context, - filterInfo.AuthorizationFilters, - ad - ) + .Setup(h => + h.PublicInvokeAuthorizationFilters(context, filterInfo.AuthorizationFilters, ad) ) .Returns(authorizationContext) .Verifiable(); @@ -2077,48 +2018,40 @@ public void InvokeActionWithResultExceptionInvokesExceptionFiltersAndExecutesRes .Returns(parameters) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeActionMethodWithFilters( - context, - filterInfo.ActionFilters, - ad, - parameters - ) + .Setup(h => + h.PublicInvokeActionMethodWithFilters( + context, + filterInfo.ActionFilters, + ad, + parameters + ) ) .Returns(postContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeActionResultWithFilters( - context, - filterInfo.ResultFilters, - actionResult - ) + .Setup(h => + h.PublicInvokeActionResultWithFilters( + context, + filterInfo.ResultFilters, + actionResult + ) ) .Throws(exception) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeAuthenticationFiltersChallenge( - context, - filterInfo.AuthenticationFilters, - ad, - actionResult - ) + .Setup(h => + h.PublicInvokeAuthenticationFiltersChallenge( + context, + filterInfo.AuthenticationFilters, + ad, + actionResult + ) ) .Returns(authenticationChallengeContext) .Verifiable(); mockHelper - .Setup( - h => - h.PublicInvokeExceptionFilters( - context, - filterInfo.ExceptionFilters, - exception - ) + .Setup(h => + h.PublicInvokeExceptionFilters(context, filterInfo.ExceptionFilters, exception) ) .Returns(exContext) .Verifiable(); @@ -3227,7 +3160,9 @@ public void FindAction_ControllerLevelDirectRoute_FindsMatch() var context = new ControllerContext(); context.RouteData = new RouteData(); context.RouteData.Route = - DirectRouteTestHelpers.BuildDirectRouteFromController(); + DirectRouteTestHelpers.BuildDirectRouteFromController( + + ); // Simulate a match that binds the action parameter context.RouteData.AddDirectRouteMatches( @@ -3268,7 +3203,9 @@ public void FindAction_ControllerLevelDirectRoute_NoMatch() var context = new ControllerContext(); context.RouteData = new RouteData(); context.RouteData.Route = - DirectRouteTestHelpers.BuildDirectRouteFromController(); + DirectRouteTestHelpers.BuildDirectRouteFromController( + + ); // Simulate a match that binds the action parameter context.RouteData.AddDirectRouteMatches( @@ -3304,7 +3241,9 @@ public void FindAction_ControllerLevelDirectRoute_AmbiguousMatch() var context = new ControllerContext(); context.RouteData = new RouteData(); context.RouteData.Route = - DirectRouteTestHelpers.BuildDirectRouteFromController(); + DirectRouteTestHelpers.BuildDirectRouteFromController( + + ); // Simulate a match that binds the action parameter context.RouteData.AddDirectRouteMatches( diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/DefaultModelBinderTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/DefaultModelBinderTest.cs index eed42f66cfd..1836df528e8 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/DefaultModelBinderTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/DefaultModelBinderTest.cs @@ -38,8 +38,8 @@ public void BindComplexElementalModelReturnsIfOnModelUpdatingReturnsFalse() CallBase = true }; mockHelper - .Setup( - b => b.PublicOnModelUpdating(controllerContext, It.IsAny()) + .Setup(b => + b.PublicOnModelUpdating(controllerContext, It.IsAny()) ) .Returns(false); DefaultModelBinderHelper helper = mockHelper.Object; @@ -89,8 +89,8 @@ public void BindComplexModelCanBindArrays() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -144,8 +144,8 @@ public void BindComplexModelCanBindCollections() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -348,8 +348,8 @@ public void BindComplexModelCanBindDictionaries() Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -368,8 +368,8 @@ public void BindComplexModelCanBindDictionaries() Mock mockStringBinder = new Mock(); mockStringBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -431,8 +431,8 @@ public void BindComplexModelCanBindObjects() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -474,8 +474,8 @@ public void BindComplexModelReturnsNullArrayIfNoValuesProvided() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -522,8 +522,8 @@ public void BindComplexModelWhereModelTypeContainsBindAttribute() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -571,8 +571,8 @@ public void BindComplexModelWhereModelTypeDoesNotContainBindAttribute() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -622,8 +622,8 @@ public void BindModelCanBindObjects() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -1017,8 +1017,8 @@ public void BindPropertyCanUpdateComplexReadOnlyProperties() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -1202,8 +1202,8 @@ public void BindPropertyUpdatesPropertyOnFailureIfInnerBinderReturnsNonNullObjec Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -1250,8 +1250,8 @@ public void BindPropertyUpdatesPropertyOnSuccess() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -1299,8 +1299,8 @@ public void BindPropertyReplaceErrorMessages(Type exceptionType) Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -1356,8 +1356,8 @@ public void BindPropertyNotShowErrorMessage(Type exceptionType) Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2088,8 +2088,8 @@ public void UpdateCollectionCreatesDefaultEntriesForInvalidElements() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2186,8 +2186,8 @@ public void UpdateCollectionReturnsModifiedCollectionOnSuccess_ZeroBased() Mock mockInnerBinder = new Mock(); mockInnerBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2270,8 +2270,8 @@ public void UpdateDictionaryCreatesDefaultEntriesForInvalidValues() Mock mockStringBinder = new Mock(); mockStringBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2287,8 +2287,8 @@ public void UpdateDictionaryCreatesDefaultEntriesForInvalidValues() Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2408,8 +2408,8 @@ public void UpdateDictionaryReturnsModifiedDictionaryOnSuccess_ZeroBased() Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2428,8 +2428,8 @@ public void UpdateDictionaryReturnsModifiedDictionaryOnSuccess_ZeroBased() Mock mockStringBinder = new Mock(); mockStringBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2550,8 +2550,8 @@ public void UpdateDictionarySkipsInvalidKeys() Mock mockIntBinder = new Mock(); mockIntBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -2566,8 +2566,8 @@ public void UpdateDictionarySkipsInvalidKeys() Mock mockStringBinder = new Mock(); mockStringBinder - .Setup( - b => b.BindModel(It.IsAny(), It.IsAny()) + .Setup(b => + b.BindModel(It.IsAny(), It.IsAny()) ) .Returns( delegate(ControllerContext cc, ModelBindingContext bc) @@ -3166,12 +3166,8 @@ public void OnModelUpdatedPassesNullContainerToValidate() Mock validator = new Mock(metadata, context); provider = new Mock(); provider - .Setup( - p => - p.GetValidators( - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetValidators(It.IsAny(), It.IsAny()) ) .Returns(new ModelValidator[] { validator.Object }); ModelValidatorProviders.Providers.Add(provider.Object); diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/FormValueProviderFactoryTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/FormValueProviderFactoryTest.cs index 0a44b817785..632e47b7dc3 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/FormValueProviderFactoryTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/FormValueProviderFactoryTest.cs @@ -24,8 +24,8 @@ public void GetValueProvider() // Arrange Mock mockUnvalidatedValues = new Mock(); - FormValueProviderFactory factory = new FormValueProviderFactory( - _ => mockUnvalidatedValues.Object + FormValueProviderFactory factory = new FormValueProviderFactory(_ => + mockUnvalidatedValues.Object ); Mock mockControllerContext = new Mock(); @@ -50,8 +50,8 @@ public void GetValueProvider_GetValue_SkipValidation() Mock mockUnvalidatedValues = new Mock(); mockUnvalidatedValues.Setup(o => o.Form).Returns(_unvalidatedBackingStore); - FormValueProviderFactory factory = new FormValueProviderFactory( - _ => mockUnvalidatedValues.Object + FormValueProviderFactory factory = new FormValueProviderFactory(_ => + mockUnvalidatedValues.Object ); Mock mockControllerContext = new Mock(); diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpDeleteAttributeTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpDeleteAttributeTest.cs index 7bc843fd8c4..9cf7d695b44 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpDeleteAttributeTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpDeleteAttributeTest.cs @@ -26,7 +26,9 @@ public void IsValidForRequestReturnsTrueIfHttpVerbIsPost() [Fact] public void IsValidForRequestThrowsIfControllerContextIsNull() { - HttpVerbAttributeHelper.TestHttpVerbAttributeNullControllerContext(); + HttpVerbAttributeHelper.TestHttpVerbAttributeNullControllerContext( + + ); } } } diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpPatchAttributeTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpPatchAttributeTest.cs index ba3a5f04d8f..76cf2ccab95 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpPatchAttributeTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/HttpPatchAttributeTest.cs @@ -22,7 +22,9 @@ public void IsValidForRequestReturnsTrueIfHttpVerbIsPatch() [Fact] public void IsValidForRequestThrowsIfControllerContextIsNull() { - HttpVerbAttributeHelper.TestHttpVerbAttributeNullControllerContext(); + HttpVerbAttributeHelper.TestHttpVerbAttributeNullControllerContext( + + ); } } } diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelMetadataTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelMetadataTest.cs index c6aa96ff01d..67973146347 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelMetadataTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelMetadataTest.cs @@ -445,8 +445,9 @@ public void SimpleDisplayTextReturnsFirstPropertyValueForNonNullModel() public void SimpleDisplayTextReturnsFirstPropertyNullDisplayTextForNonNullModelWithNullDisplayColumnPropertyValue() { // Arrange - SimpleDisplayTextModelWithoutToString model = - new SimpleDisplayTextModelWithoutToString(); + SimpleDisplayTextModelWithoutToString model = new SimpleDisplayTextModelWithoutToString( + + ); EmptyModelMetadataProvider propertyProvider = new EmptyModelMetadataProvider(); ModelMetadata propertyMetadata = propertyProvider.GetMetadataForProperty( () => model.FirstProperty, @@ -456,12 +457,8 @@ public void SimpleDisplayTextReturnsFirstPropertyNullDisplayTextForNonNullModelW propertyMetadata.NullDisplayText = "Null Display Text"; Mock provider = new Mock(); provider - .Setup( - p => - p.GetMetadataForProperties( - model, - typeof(SimpleDisplayTextModelWithoutToString) - ) + .Setup(p => + p.GetMetadataForProperties(model, typeof(SimpleDisplayTextModelWithoutToString)) ) .Returns(new[] { propertyMetadata }); ModelMetadata metadata = new ModelMetadata( @@ -693,13 +690,12 @@ public void FromStringExpressionNullItemFoundOnPropertyOfItemInViewData() ViewDataDictionary viewData = new ViewDataDictionary(); viewData["Object"] = model; provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -728,13 +724,12 @@ public void FromStringExpressionNonNullItemFoundOnPropertyOfItemInViewData() ViewDataDictionary viewData = new ViewDataDictionary(); viewData["Object"] = model; provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -763,13 +758,12 @@ public void FromStringExpressionContainerTest() ViewDataDictionary viewData = new ViewDataDictionary(); viewData["Object"] = model; provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Returns, Type, string>( (accessor, type, propertyName) => @@ -912,13 +906,12 @@ public void FromLambdaExpressionPropertyExpressionFromParameter() ViewDataDictionary viewData = new ViewDataDictionary(model); provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -950,13 +943,12 @@ public void FromLambdaExpressionPropertyExpressionFromClosureValue() DummyContactModel model = new DummyContactModel { FirstName = "Test" }; ViewDataDictionary viewData = new ViewDataDictionary(); provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -1144,13 +1136,12 @@ public void FromLambdaExpressionNullReferenceExceptionsInPropertyExpressionPrese ViewDataDictionary viewData = new ViewDataDictionary(); provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -1184,13 +1175,12 @@ public void FromLambdaExpressionSetsContainerTypeToDerivedMostType() derivedModel ); provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => @@ -1234,13 +1224,12 @@ public void FromLambdaExpressionSetsContainerWithoutObjectInViewData() DerivedModel derivedModel = new DerivedModel(); ViewDataDictionary viewData = new ViewDataDictionary(); provider - .Setup( - p => - p.GetMetadataForProperty( - It.IsAny>(), - It.IsAny(), - It.IsAny() - ) + .Setup(p => + p.GetMetadataForProperty( + It.IsAny>(), + It.IsAny(), + It.IsAny() + ) ) .Callback, Type, string>( (accessor, type, propertyName) => diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelValidatorTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelValidatorTest.cs index f19a4bd3cad..45d4ed83f99 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelValidatorTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ModelValidatorTest.cs @@ -87,8 +87,9 @@ public void IsRequiredFalseByDefault() [Fact] public void GetModelValidator_DoesNotReadPropertyValues() { - ModelValidatorProvider[] originalProviders = - ModelValidatorProviders.Providers.ToArray(); + ModelValidatorProvider[] originalProviders = ModelValidatorProviders.Providers.ToArray( + + ); try { // Arrange diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/RedirectResultTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/RedirectResultTest.cs index c9c40e04323..68701df69fb 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/RedirectResultTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/RedirectResultTest.cs @@ -82,12 +82,11 @@ public void ExecuteResultCallsResponseRedirect() // Arrange Mock mockResponse = new Mock(); mockResponse - .Setup( - o => - o.Redirect( - _baseUrl, - false /* endResponse */ - ) + .Setup(o => + o.Redirect( + _baseUrl, + false /* endResponse */ + ) ) .Verifiable(); Mock mockContext = new Mock(); @@ -112,12 +111,11 @@ public void ExecuteResultWithPermanentCallsResponseRedirectPermanent() // Arrange Mock mockResponse = new Mock(); mockResponse - .Setup( - o => - o.RedirectPermanent( - _baseUrl, - false /* endResponse */ - ) + .Setup(o => + o.RedirectPermanent( + _baseUrl, + false /* endResponse */ + ) ) .Verifiable(); Mock mockContext = new Mock(); @@ -159,8 +157,9 @@ public void RedirectInChildActionThrows() { // Arrange RouteData routeData = new RouteData(); - routeData.DataTokens[ControllerContext.ParentActionViewContextToken] = - new ViewContext(); + routeData.DataTokens[ControllerContext.ParentActionViewContextToken] = new ViewContext( + + ); ControllerContext context = new ControllerContext( new Mock().Object, routeData, diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/UrlHelperTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/UrlHelperTest.cs index 27cf38b8888..90f00cf8296 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/UrlHelperTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/UrlHelperTest.cs @@ -957,14 +957,13 @@ private static RouteCollection GetRouteCollection() // Adding a route that recognizes the httproute value for the HttpRouteUrl tests Mock mockHttpRoute = new Mock(); mockHttpRoute - .Setup( - mock => - mock.GetVirtualPath( - It.IsAny(), - It.Is( - routeValues => routeValues.ContainsKey("httproute") - ) + .Setup(mock => + mock.GetVirtualPath( + It.IsAny(), + It.Is(routeValues => + routeValues.ContainsKey("httproute") ) + ) ) .Returns(new VirtualPathData(null, "mock/http/route")); rt.Add("httproute", mockHttpRoute.Object); diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewPageTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewPageTest.cs index ab8247c703c..b06185b04eb 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewPageTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewPageTest.cs @@ -104,13 +104,12 @@ public void RenderInitsHelpersAndSetsID() mockViewContext.Setup(c => c.Writer).Returns(writer); mockViewContext.Setup(c => c.HttpContext.Response.Output).Returns(TextWriter.Null); mockViewContext - .Setup( - c => - c.HttpContext.Server.Execute( - It.IsAny(), - It.IsAny(), - true - ) + .Setup(c => + c.HttpContext.Server.Execute( + It.IsAny(), + It.IsAny(), + true + ) ) .Callback( (_h, _w, _pf) => diff --git a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewResultTest.cs b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewResultTest.cs index 96b62521675..423b6d42794 100644 --- a/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewResultTest.cs +++ b/AspNetWebStack/test/System.Web.Mvc.Test/Test/ViewResultTest.cs @@ -40,14 +40,13 @@ public void EmptyViewNameUsesActionNameAsViewName() .Setup(e => e.FindView(It.IsAny(), _viewName, _masterName)) .Returns(new ViewEngineResult(view.Object, viewEngine.Object)); viewEngine - .Setup( - e => - e.FindView( - It.IsAny(), - _viewName, - _masterName, - It.IsAny() - ) + .Setup(e => + e.FindView( + It.IsAny(), + _viewName, + _masterName, + It.IsAny() + ) ) .Callback( (controllerContext, viewName, masterName, useCache) => @@ -109,14 +108,13 @@ public void EngineLookupFailureThrows() .Setup(e => e.FindView(It.IsAny(), _viewName, _masterName)) .Returns(new ViewEngineResult(new[] { "location1", "location2" })); viewEngine - .Setup( - e => - e.FindView( - It.IsAny(), - _viewName, - _masterName, - It.IsAny() - ) + .Setup(e => + e.FindView( + It.IsAny(), + _viewName, + _masterName, + It.IsAny() + ) ) .Callback( (controllerContext, viewName, masterName, useCache) => @@ -178,14 +176,13 @@ public void EngineLookupSuccessRendersView() .Setup(e => e.FindView(It.IsAny(), _viewName, _masterName)) .Returns(new ViewEngineResult(view.Object, viewEngine.Object)); viewEngine - .Setup( - e => - e.FindView( - It.IsAny(), - _viewName, - _masterName, - It.IsAny() - ) + .Setup(e => + e.FindView( + It.IsAny(), + _viewName, + _masterName, + It.IsAny() + ) ) .Callback( (controllerContext, viewName, masterName, useCache) => diff --git a/AspNetWebStack/test/System.Web.Razor.Test/Parser/CallbackParserListenerTest.cs b/AspNetWebStack/test/System.Web.Razor.Test/Parser/CallbackParserListenerTest.cs index fcaa904dca5..e9df577ab94 100644 --- a/AspNetWebStack/test/System.Web.Razor.Test/Parser/CallbackParserListenerTest.cs +++ b/AspNetWebStack/test/System.Web.Razor.Test/Parser/CallbackParserListenerTest.cs @@ -47,35 +47,45 @@ public void ListenerConstructedWithSpanAndErrorCallbackCallsCallbackOnError() [Fact] public void ListenerConstructedWithAllCallbacksCallsCallbackOnEndSpan() { - RunOnEndSpanTest( - spanCallback => new CallbackVisitor(spanCallback, _ => { }, _ => { }, _ => { }) - ); + RunOnEndSpanTest(spanCallback => new CallbackVisitor( + spanCallback, + _ => { }, + _ => { }, + _ => { } + )); } [Fact] public void ListenerConstructedWithAllCallbacksCallsCallbackOnError() { - RunOnErrorTest( - errorCallback => new CallbackVisitor(_ => { }, errorCallback, _ => { }, _ => { }) - ); + RunOnErrorTest(errorCallback => new CallbackVisitor( + _ => { }, + errorCallback, + _ => { }, + _ => { } + )); } [Fact] public void ListenerConstructedWithAllCallbacksCallsCallbackOnStartBlock() { - RunOnStartBlockTest( - startBlockCallback => - new CallbackVisitor(_ => { }, _ => { }, startBlockCallback, _ => { }) - ); + RunOnStartBlockTest(startBlockCallback => new CallbackVisitor( + _ => { }, + _ => { }, + startBlockCallback, + _ => { } + )); } [Fact] public void ListenerConstructedWithAllCallbacksCallsCallbackOnEndBlock() { - RunOnEndBlockTest( - endBlockCallback => - new CallbackVisitor(_ => { }, _ => { }, _ => { }, endBlockCallback) - ); + RunOnEndBlockTest(endBlockCallback => new CallbackVisitor( + _ => { }, + _ => { }, + _ => { }, + endBlockCallback + )); } [Fact] @@ -93,8 +103,12 @@ public void ListenerCallsOnStartBlockCallbackUsingSynchronizationContextIfSpecif { RunSyncContextTest( BlockType.Template, - startBlockCallback => - new CallbackVisitor(_ => { }, _ => { }, startBlockCallback, _ => { }), + startBlockCallback => new CallbackVisitor( + _ => { }, + _ => { }, + startBlockCallback, + _ => { } + ), (listener, expected) => listener.VisitStartBlock(new BlockBuilder() { Type = expected }.Build()) ); @@ -105,8 +119,12 @@ public void ListenerCallsOnEndBlockCallbackUsingSynchronizationContextIfSpecifie { RunSyncContextTest( BlockType.Template, - endBlockCallback => - new CallbackVisitor(_ => { }, _ => { }, _ => { }, endBlockCallback), + endBlockCallback => new CallbackVisitor( + _ => { }, + _ => { }, + _ => { }, + endBlockCallback + ), (listener, expected) => listener.VisitEndBlock(new BlockBuilder() { Type = expected }.Build()) ); diff --git a/AspNetWebStack/test/System.Web.Razor.Test/RazorTemplateEngineTest.cs b/AspNetWebStack/test/System.Web.Razor.Test/RazorTemplateEngineTest.cs index 3acec12e80c..ca0f7a77a9d 100644 --- a/AspNetWebStack/test/System.Web.Razor.Test/RazorTemplateEngineTest.cs +++ b/AspNetWebStack/test/System.Web.Razor.Test/RazorTemplateEngineTest.cs @@ -130,12 +130,11 @@ public void ParseTemplateCopiesTextReaderContentToSeekableTextReaderAndPassesToP mockEngine.Object.ParseTemplate(reader, cancelToken: source.Token); // Assert - mockEngine.Verify( - e => - e.ParseTemplateCore( - It.Is(l => l.ReadToEnd() == "foo"), - source.Token - ) + mockEngine.Verify(e => + e.ParseTemplateCore( + It.Is(l => l.ReadToEnd() == "foo"), + source.Token + ) ); } @@ -160,15 +159,14 @@ public void GenerateCodeCopiesTextReaderContentToSeekableTextReaderAndPassesToGe ); // Assert - mockEngine.Verify( - e => - e.GenerateCodeCore( - It.Is(l => l.ReadToEnd() == "foo"), - className, - ns, - src, - source.Token - ) + mockEngine.Verify(e => + e.GenerateCodeCore( + It.Is(l => l.ReadToEnd() == "foo"), + className, + ns, + src, + source.Token + ) ); } diff --git a/AspNetWebStack/test/System.Web.WebPages.Deployment.Test/AssemblyUtilsTest.cs b/AspNetWebStack/test/System.Web.WebPages.Deployment.Test/AssemblyUtilsTest.cs index a8f7e8d7f36..05f5f600bad 100644 --- a/AspNetWebStack/test/System.Web.WebPages.Deployment.Test/AssemblyUtilsTest.cs +++ b/AspNetWebStack/test/System.Web.WebPages.Deployment.Test/AssemblyUtilsTest.cs @@ -122,8 +122,9 @@ public void GetVersionFromBinReturnsVersionFromBinIfLower() var binDirectory = @"X:\test\project"; TestFileSystem fileSystem = new TestFileSystem(); fileSystem.AddFile(Path.Combine(binDirectory, "System.Web.WebPages.Deployment.dll")); - Func getAssembyName = _ => - new AssemblyName(AssemblyName("1.0.0.0")); + Func getAssembyName = _ => new AssemblyName( + AssemblyName("1.0.0.0") + ); // Act var binVersion = AssemblyUtils.GetVersionFromBin( @@ -163,10 +164,9 @@ public void GetVersionFromBinReturnsVersionFromBinIfHigherVersion() var binDirectory = @"X:\test\project"; TestFileSystem fileSystem = new TestFileSystem(); fileSystem.AddFile(Path.Combine(binDirectory, "System.Web.WebPages.Deployment.dll")); - Func getAssembyName = _ => - new AssemblyName( - "System.Web.WebPages.Deployment, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" - ); + Func getAssembyName = _ => new AssemblyName( + "System.Web.WebPages.Deployment, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" + ); // Act var binVersion = AssemblyUtils.GetVersionFromBin( diff --git a/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/HttpResponseExtensionsTest.cs b/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/HttpResponseExtensionsTest.cs index 6b28aec86e5..a07fee2a565 100644 --- a/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/HttpResponseExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/HttpResponseExtensionsTest.cs @@ -89,11 +89,8 @@ public void OutputCacheSetsExpirationTimeBasedOnCurrentContext() var cache = new Mock(); cache - .Setup( - c => - c.SetCacheability( - It.Is(p => p == HttpCacheability.Public) - ) + .Setup(c => + c.SetCacheability(It.Is(p => p == HttpCacheability.Public)) ) .Verifiable(); cache diff --git a/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/StringWriterExtensionsTest.cs b/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/StringWriterExtensionsTest.cs index 1963ab364ac..d54e6482726 100644 --- a/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/StringWriterExtensionsTest.cs +++ b/AspNetWebStack/test/System.Web.WebPages.Test/Extensions/StringWriterExtensionsTest.cs @@ -60,19 +60,15 @@ public void OnlyUsesBufferUpToSize(int count) StringWriter writer = new StringWriter(); mock = new Mock(MockBehavior.Strict, stream) { CallBase = true }; - mock.Setup( - sw => - sw.Write( - It.IsAny(), - It.IsAny(), - It.Is( - c => - c == StringWriterExtensions.BufferSize - || c - == textInBytes.Length - % StringWriterExtensions.BufferSize - ) + mock.Setup(sw => + sw.Write( + It.IsAny(), + It.IsAny(), + It.Is(c => + c == StringWriterExtensions.BufferSize + || c == textInBytes.Length % StringWriterExtensions.BufferSize ) + ) ) .Verifiable(); diff --git a/AspNetWebStack/test/System.Web.WebPages.Test/Helpers/AntiXsrf/AntiForgeryWorkerTest.cs b/AspNetWebStack/test/System.Web.WebPages.Test/Helpers/AntiXsrf/AntiForgeryWorkerTest.cs index 1a62ff9ec5f..73fd6f6228b 100644 --- a/AspNetWebStack/test/System.Web.WebPages.Test/Helpers/AntiXsrf/AntiForgeryWorkerTest.cs +++ b/AspNetWebStack/test/System.Web.WebPages.Test/Helpers/AntiXsrf/AntiForgeryWorkerTest.cs @@ -513,8 +513,8 @@ public void Validate_FromStrings_Failure() Mock mockValidator = new Mock(); mockValidator - .Setup( - o => o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) + .Setup(o => + o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) ) .Throws(new HttpAntiForgeryException("my-message")); @@ -552,8 +552,8 @@ public void Validate_FromStrings_Success() Mock mockValidator = new Mock(); mockValidator - .Setup( - o => o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) + .Setup(o => + o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) ) .Verifiable(); @@ -592,8 +592,8 @@ public void Validate_FromStore_Failure() Mock mockValidator = new Mock(); mockValidator - .Setup( - o => o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) + .Setup(o => + o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) ) .Throws(new HttpAntiForgeryException("my-message")); @@ -632,8 +632,8 @@ public void Validate_FromStore_Success() Mock mockValidator = new Mock(); mockValidator - .Setup( - o => o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) + .Setup(o => + o.ValidateTokens(mockHttpContext.Object, identity, cookieToken, formToken) ) .Verifiable(); diff --git a/AspNetWebStack/test/System.Web.WebPages.Test/Utils/UrlRewriterHelperTest.cs b/AspNetWebStack/test/System.Web.WebPages.Test/Utils/UrlRewriterHelperTest.cs index 9421f716193..1c1730aa401 100644 --- a/AspNetWebStack/test/System.Web.WebPages.Test/Utils/UrlRewriterHelperTest.cs +++ b/AspNetWebStack/test/System.Web.WebPages.Test/Utils/UrlRewriterHelperTest.cs @@ -160,8 +160,7 @@ bool isUrlRewriteOnForRequest if (isUrlRewriteOnForServer) { mockWorkerRequest - .Setup( - wr => wr.GetServerVariable(UrlRewriterHelper.UrlRewriterEnabledServerVar) + .Setup(wr => wr.GetServerVariable(UrlRewriterHelper.UrlRewriterEnabledServerVar) ) .Returns("On!") .Verifiable(); @@ -169,8 +168,7 @@ bool isUrlRewriteOnForRequest else { mockWorkerRequest - .Setup( - wr => wr.GetServerVariable(UrlRewriterHelper.UrlRewriterEnabledServerVar) + .Setup(wr => wr.GetServerVariable(UrlRewriterHelper.UrlRewriterEnabledServerVar) ) .Returns((string)null) .Verifiable(); diff --git a/AspNetWebStack/test/WebApiHelpPage.Test/HelppageSampleGeneratorTest.cs b/AspNetWebStack/test/WebApiHelpPage.Test/HelppageSampleGeneratorTest.cs index d9e491bc1d9..9d2bc6c9c7d 100644 --- a/AspNetWebStack/test/WebApiHelpPage.Test/HelppageSampleGeneratorTest.cs +++ b/AspNetWebStack/test/WebApiHelpPage.Test/HelppageSampleGeneratorTest.cs @@ -372,15 +372,14 @@ public void WriteSampleObjectUsingFormatter_ReturnsFormatterError() Mock bogusFormatter = new Mock(); bogusFormatter.Setup(f => f.CanWriteType(It.IsAny())).Returns(true); bogusFormatter - .Setup( - f => - f.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(() => { @@ -407,15 +406,14 @@ public void WriteSampleObjectUsingFormatter_TryFormattingNonXmlSamples_DoesNotTh Mock customFormatter = new Mock(); customFormatter.Setup(f => f.CanWriteType(It.IsAny())).Returns(true); customFormatter - .Setup( - f => - f.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( ( @@ -452,15 +450,14 @@ public void WriteSampleObjectUsingFormatter_TryFormattingNonJsonSamples_DoesNotT Mock customFormatter = new Mock(); customFormatter.Setup(f => f.CanWriteType(It.IsAny())).Returns(true); customFormatter - .Setup( - f => - f.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( ( @@ -497,15 +494,14 @@ public void WriteSampleObjectUsingFormatter_UnwrapsAggregateException() Mock bogusFormatter = new Mock(); bogusFormatter.Setup(f => f.CanWriteType(It.IsAny())).Returns(true); bogusFormatter - .Setup( - f => - f.WriteToStreamAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.WriteToStreamAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(() => { diff --git a/AspNetWebStack/tools/src/Microsoft.Web.FxCop/UnusedResourceUsageRule.cs b/AspNetWebStack/tools/src/Microsoft.Web.FxCop/UnusedResourceUsageRule.cs index b263a4ccadc..6d64ca2e04f 100644 --- a/AspNetWebStack/tools/src/Microsoft.Web.FxCop/UnusedResourceUsageRule.cs +++ b/AspNetWebStack/tools/src/Microsoft.Web.FxCop/UnusedResourceUsageRule.cs @@ -119,11 +119,10 @@ private static bool IsResourceType(TypeNode typeNode) var classNode = typeNode as ClassNode; return ( classNode != null - && classNode.Attributes.Any( - c => - c.Type.FullName.Equals( - typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute).FullName - ) + && classNode.Attributes.Any(c => + c.Type.FullName.Equals( + typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute).FullName + ) ) && classNode.Name.Name.Contains("Resource") ); diff --git a/AutoMapper/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs b/AutoMapper/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs index c65528680f8..2b23fa41dad 100644 --- a/AutoMapper/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs +++ b/AutoMapper/src/AutoMapper/Configuration/Annotations/ValueResolverAttribute.cs @@ -23,7 +23,9 @@ public ValueResolverAttribute(Type type) public void ApplyConfiguration(IMemberConfigurationExpression memberConfigurationExpression) { var sourceMemberAttribute = - memberConfigurationExpression.DestinationMember.GetCustomAttribute(); + memberConfigurationExpression.DestinationMember.GetCustomAttribute( + + ); if (sourceMemberAttribute != null) { diff --git a/AutoMapper/src/AutoMapper/Configuration/ConfigurationValidator.cs b/AutoMapper/src/AutoMapper/Configuration/ConfigurationValidator.cs index 8f94499cfd1..7138f7077de 100644 --- a/AutoMapper/src/AutoMapper/Configuration/ConfigurationValidator.cs +++ b/AutoMapper/src/AutoMapper/Configuration/ConfigurationValidator.cs @@ -23,20 +23,13 @@ IEnumerable typeMaps .SelectMany(p => p.TypeMapConfigs, (profile, typeMap) => (profile, typeMap)) .GroupBy(x => x.typeMap.Types) .Where(g => g.Count() > 1) - .Select( - g => - ( - TypePair: g.Key, - ProfileNames: g.Select(tmc => tmc.profile.ProfileName).ToArray() - ) - ) - .Select( - g => - new DuplicateTypeMapConfigurationException.TypeMapConfigErrors( - g.TypePair, - g.ProfileNames - ) + .Select(g => + (TypePair: g.Key, ProfileNames: g.Select(tmc => tmc.profile.ProfileName).ToArray()) ) + .Select(g => new DuplicateTypeMapConfigurationException.TypeMapConfigErrors( + g.TypePair, + g.ProfileNames + )) .ToArray(); if (duplicateTypeMapConfigs.Any()) { diff --git a/AutoMapper/src/AutoMapper/Internal/TypeDetails.cs b/AutoMapper/src/AutoMapper/Internal/TypeDetails.cs index 596ed2f9863..b5e17e55e89 100644 --- a/AutoMapper/src/AutoMapper/Internal/TypeDetails.cs +++ b/AutoMapper/src/AutoMapper/Internal/TypeDetails.cs @@ -69,22 +69,21 @@ IEnumerable AddMethods(IEnumerable accessors) { var publicNoArgMethods = GetPublicNoArgMethods(); var noArgExtensionMethods = GetNoArgExtensionMethods( - Config.SourceExtensionMethods.Where( - m => !_nameToMember.ContainsKey(m.Name) && Config.ShouldMapMethod(m) + Config.SourceExtensionMethods.Where(m => + !_nameToMember.ContainsKey(m.Name) && Config.ShouldMapMethod(m) ) ); return accessors.Concat(publicNoArgMethods).Concat(noArgExtensionMethods); } IEnumerable GetPublicNoArgMethods() => Type.GetMethods(BindingFlags.Instance | BindingFlags.Public) - .Where( - m => - m.DeclaringType != typeof(object) - && m.ReturnType != typeof(void) - && !m.IsGenericMethodDefinition - && !_nameToMember.ContainsKey(m.Name) - && Config.ShouldMapMethod(m) - && m.GetParameters().Length == 0 + .Where(m => + m.DeclaringType != typeof(object) + && m.ReturnType != typeof(void) + && !m.IsGenericMethodDefinition + && !_nameToMember.ContainsKey(m.Name) + && Config.ShouldMapMethod(m) + && m.GetParameters().Length == 0 ); void CheckPrePostfixes(MemberInfo member) { @@ -101,10 +100,9 @@ IEnumerable sourceExtensionMethodSearch { var extensionMethods = (IEnumerable) - sourceExtensionMethodSearch.Where( - method => - !method.ContainsGenericParameters - && method.FirstParameterType().IsAssignableFrom(Type) + sourceExtensionMethodSearch.Where(method => + !method.ContainsGenericParameters + && method.FirstParameterType().IsAssignableFrom(Type) ); var genericInterfaces = Type.GetInterfaces().Where(t => t.IsGenericType); if (Type.IsInterface && Type.IsGenericType) @@ -264,21 +262,18 @@ private IEnumerable GetProperties( Func propertyAvailableFor ) => GetTypeInheritance() - .SelectMany( - type => - type.GetProperties(TypeExtensions.InstanceFlags) - .Where( - property => - propertyAvailableFor(property) && Config.ShouldMapProperty(property) - ) + .SelectMany(type => + type.GetProperties(TypeExtensions.InstanceFlags) + .Where(property => + propertyAvailableFor(property) && Config.ShouldMapProperty(property) + ) ); private IEnumerable GetFields(Func fieldAvailableFor) => GetTypeInheritance() - .SelectMany( - type => - type.GetFields(TypeExtensions.InstanceFlags) - .Where(field => fieldAvailableFor(field) && Config.ShouldMapField(field)) + .SelectMany(type => + type.GetFields(TypeExtensions.InstanceFlags) + .Where(field => fieldAvailableFor(field) && Config.ShouldMapField(field)) ); } diff --git a/AutoMapper/src/AutoMapper/PropertyMap.cs b/AutoMapper/src/AutoMapper/PropertyMap.cs index 228bb84027d..5752465600f 100644 --- a/AutoMapper/src/AutoMapper/PropertyMap.cs +++ b/AutoMapper/src/AutoMapper/PropertyMap.cs @@ -19,8 +19,8 @@ public PropertyMap(PropertyMap inheritedMappedProperty, TypeMap typeMap) DestinationMember = inheritedMappedProperty.DestinationMember; if (DestinationMember.DeclaringType.ContainsGenericParameters) { - DestinationMember = typeMap.DestinationSetters.Single( - m => m.Name == DestinationMember.Name + DestinationMember = typeMap.DestinationSetters.Single(m => + m.Name == DestinationMember.Name ); } DestinationType = inheritedMappedProperty.DestinationType; diff --git a/AutoMapper/src/AutoMapper/QueryableExtensions/Extensions.cs b/AutoMapper/src/AutoMapper/QueryableExtensions/Extensions.cs index 4828082df48..3844550d8be 100644 --- a/AutoMapper/src/AutoMapper/QueryableExtensions/Extensions.cs +++ b/AutoMapper/src/AutoMapper/QueryableExtensions/Extensions.cs @@ -78,8 +78,8 @@ params string[] membersToExpand source.ToCore( configuration, parameters, - membersToExpand.Select( - memberName => ReflectionHelper.GetMemberPath(typeof(TDestination), memberName) + membersToExpand.Select(memberName => + ReflectionHelper.GetMemberPath(typeof(TDestination), memberName) ) ); @@ -117,8 +117,8 @@ params string[] membersToExpand destinationType, configuration, parameters, - membersToExpand.Select( - memberName => ReflectionHelper.GetMemberPath(destinationType, memberName) + membersToExpand.Select(memberName => + ReflectionHelper.GetMemberPath(destinationType, memberName) ) ); diff --git a/AutoMapper/src/AutoMapper/QueryableExtensions/ProjectionBuilder.cs b/AutoMapper/src/AutoMapper/QueryableExtensions/ProjectionBuilder.cs index 63309ae23ff..0d955e42182 100644 --- a/AutoMapper/src/AutoMapper/QueryableExtensions/ProjectionBuilder.cs +++ b/AutoMapper/src/AutoMapper/QueryableExtensions/ProjectionBuilder.cs @@ -305,10 +305,9 @@ NewExpression CreateDestination() => { ConstructorMap: { CanResolve: true } constructorMap } => New( constructorMap.Ctor, - constructorMap.CtorParams.Select( - map => - TryProjectMember(map, map.DefaultValue(null)) - ?? Default(map.DestinationType) + constructorMap.CtorParams.Select(map => + TryProjectMember(map, map.DefaultValue(null)) + ?? Default(map.DestinationType) ) ), _ => New(typeMap.DestinationType) @@ -375,14 +374,13 @@ ParameterExpression instanceParameter ) { var letMapInfos = _savedPaths - .Select( - path => - ( - path.LetExpression, - MapFromSource: path.GetSourceExpression(instanceParameter), - Property: path.GetPropertyDescription(), - path.Marker - ) + .Select(path => + ( + path.LetExpression, + MapFromSource: path.GetSourceExpression(instanceParameter), + Property: path.GetPropertyDescription(), + path.Marker + ) ) .ToArray(); var properties = letMapInfos @@ -490,9 +488,10 @@ Expression target { var visitor = new GePropertiesVisitor(target); visitor.Visit(expression); - return visitor.Members.Select( - member => new PropertyDescription(member.Name, member.GetMemberType()) - ); + return visitor.Members.Select(member => new PropertyDescription( + member.Name, + member.GetMemberType() + )); } } diff --git a/AutoMapper/src/AutoMapper/ServiceCollectionExtensions.cs b/AutoMapper/src/AutoMapper/ServiceCollectionExtensions.cs index b965d6a6e86..813d5839b9e 100644 --- a/AutoMapper/src/AutoMapper/ServiceCollectionExtensions.cs +++ b/AutoMapper/src/AutoMapper/ServiceCollectionExtensions.cs @@ -146,8 +146,8 @@ private static IServiceCollection AddAutoMapperClasses( assembliesToScan = new HashSet( assembliesToScan.Where(a => !a.IsDynamic && a != typeof(Mapper).Assembly) ); - services.Configure( - options => options.AddMaps(assembliesToScan) + services.Configure(options => + options.AddMaps(assembliesToScan) ); var openTypes = new[] { @@ -158,18 +158,16 @@ private static IServiceCollection AddAutoMapperClasses( typeof(IMappingAction<,>) }; foreach ( - var type in assembliesToScan.SelectMany( - a => - a.GetTypes() - .Where( - type => - type.IsClass - && !type.IsAbstract - && Array.Exists( - openTypes, - openType => type.GetGenericInterface(openType) != null - ) + var type in assembliesToScan.SelectMany(a => + a.GetTypes() + .Where(type => + type.IsClass + && !type.IsAbstract + && Array.Exists( + openTypes, + openType => type.GetGenericInterface(openType) != null ) + ) ) ) { diff --git a/AutoMapper/src/IntegrationTests/ChildClassTests.cs b/AutoMapper/src/IntegrationTests/ChildClassTests.cs index c5b64d1fb9f..f59329cd072 100644 --- a/AutoMapper/src/IntegrationTests/ChildClassTests.cs +++ b/AutoMapper/src/IntegrationTests/ChildClassTests.cs @@ -79,15 +79,12 @@ public void AutoMapperEFRelationsTest() using (var context = new TestContext()) { var baseDTO = context - .Bases.Select( - b => - new BaseDTO - { - Base1 = b.Base1, - BaseID = b.BaseID, - Sub = new SubDTO { Sub1 = b.Sub.Sub1, } - } - ) + .Bases.Select(b => new BaseDTO + { + Base1 = b.Base1, + BaseID = b.BaseID, + Sub = new SubDTO { Sub1 = b.Sub.Sub1, } + }) .FirstOrDefault(); baseDTO.ShouldNotBeNull(); baseDTO.BaseID.ShouldBe(1); diff --git a/AutoMapper/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs b/AutoMapper/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs index 4fa5771cd65..96516463d6d 100644 --- a/AutoMapper/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs +++ b/AutoMapper/src/IntegrationTests/CustomMapFrom/CustomMapFromTest.cs @@ -3,17 +3,15 @@ public class CustomMapFromTest : IntegrationTest { protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateProjection() - .ForMember( - x => x.FullAddress, - o => - o.MapFrom( - c => - c.Address.Street + ", " + c.Address.City + " " + c.Address.State - ) - ) + new(cfg => + cfg.CreateProjection() + .ForMember( + x => x.FullAddress, + o => + o.MapFrom(c => + c.Address.Street + ", " + c.Address.City + " " + c.Address.State + ) + ) ); [Fact] @@ -22,16 +20,12 @@ public void can_map_with_projection() using (var context = new Context()) { var customerVms = context - .Customers.Select( - c => - new CustomerViewModel - { - FirstName = c.FirstName, - LastName = c.LastName, - FullAddress = - c.Address.Street + ", " + c.Address.City + " " + c.Address.State - } - ) + .Customers.Select(c => new CustomerViewModel + { + FirstName = c.FirstName, + LastName = c.LastName, + FullAddress = c.Address.Street + ", " + c.Address.City + " " + c.Address.State + }) .ToList(); customerVms.ForEach(x => diff --git a/AutoMapper/src/IntegrationTests/ExplicitExpansion/MembersToExpandExpressions.cs b/AutoMapper/src/IntegrationTests/ExplicitExpansion/MembersToExpandExpressions.cs index c3eab875431..6c2799eeaf7 100644 --- a/AutoMapper/src/IntegrationTests/ExplicitExpansion/MembersToExpandExpressions.cs +++ b/AutoMapper/src/IntegrationTests/ExplicitExpansion/MembersToExpandExpressions.cs @@ -32,25 +32,24 @@ public class Dto } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateProjection() - .ForMember( - dto => dto.InnerDescFlattened, - conf => - { - conf.ExplicitExpansion(); - conf.MapFrom(_ => _.Inner.Desc); - } - ) - .ForMember( - dto => dto.DeepFlattened, - conf => - { - conf.ExplicitExpansion(); - conf.MapFrom(_ => _.Inner.Deep.Desc); - } - ) + new(cfg => + cfg.CreateProjection() + .ForMember( + dto => dto.InnerDescFlattened, + conf => + { + conf.ExplicitExpansion(); + conf.MapFrom(_ => _.Inner.Desc); + } + ) + .ForMember( + dto => dto.DeepFlattened, + conf => + { + conf.ExplicitExpansion(); + conf.MapFrom(_ => _.Inner.Deep.Desc); + } + ) ); public class TestContext : LocalDbContext diff --git a/AutoMapper/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs b/AutoMapper/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs index 9b2af57786b..a591489c3c2 100644 --- a/AutoMapper/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs +++ b/AutoMapper/src/IntegrationTests/ExplicitExpansion/ProjectionWithExplicitExpansion.cs @@ -300,8 +300,7 @@ protected override void Seed(Context context) } protected override MapperConfiguration CreateConfiguration() => - new( - c => c.CreateProjection().ForCtorParam("Name", o => o.ExplicitExpansion()) + new(c => c.CreateProjection().ForCtorParam("Name", o => o.ExplicitExpansion()) ); [Fact] diff --git a/AutoMapper/src/IntegrationTests/IEnumerableAggregateProjections.cs b/AutoMapper/src/IntegrationTests/IEnumerableAggregateProjections.cs index 41781207f2d..c586afddde8 100644 --- a/AutoMapper/src/IntegrationTests/IEnumerableAggregateProjections.cs +++ b/AutoMapper/src/IntegrationTests/IEnumerableAggregateProjections.cs @@ -67,13 +67,10 @@ public void Can_map_with_projection() using (var context = new Context()) { var result = ProjectTo( - context.Customers.Select( - customer => - new CustomerItemCodes - { - ItemCodes = customer.Items.Select(item => item.Code) - } - ) + context.Customers.Select(customer => new CustomerItemCodes + { + ItemCodes = customer.Items.Select(item => item.Code) + }) ) .Single(); diff --git a/AutoMapper/src/IntegrationTests/IncludeMembers.cs b/AutoMapper/src/IntegrationTests/IncludeMembers.cs index b7224f9a953..0cc9b7884e0 100644 --- a/AutoMapper/src/IntegrationTests/IncludeMembers.cs +++ b/AutoMapper/src/IntegrationTests/IncludeMembers.cs @@ -625,10 +625,9 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( d => d.Details, o => - o.MapFrom( - s => - s.InnerSourceDetailsWrapper.Select(s => s.InnerSourceDetails) - .FirstOrDefault() + o.MapFrom(s => + s.InnerSourceDetailsWrapper.Select(s => s.InnerSourceDetails) + .FirstOrDefault() ) ); cfg.CreateProjection(MemberList.None) @@ -1069,8 +1068,8 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( d => d.Details, o => - o.MapFrom( - s => s.InnerSourceWrappers.Select(s => s.InnerSource).FirstOrDefault() + o.MapFrom(s => + s.InnerSourceWrappers.Select(s => s.InnerSource).FirstOrDefault() ) ) .ForMember( @@ -1078,10 +1077,8 @@ protected override MapperConfiguration CreateConfiguration() => o => o.MapFrom(s => s.OtherInnerSources.Select(s => s).FirstOrDefault()) ); cfg.CreateProjection() - .IncludeMembers( - s => - s.InnerSourceDetailsWrapper.Select(s => s.InnerSourceDetails) - .FirstOrDefault() + .IncludeMembers(s => + s.InnerSourceDetailsWrapper.Select(s => s.InnerSourceDetails).FirstOrDefault() ); cfg.CreateProjection() .IncludeMembers(s => s.OtherInnerSourceDetails.Select(s => s).FirstOrDefault()); diff --git a/AutoMapper/src/IntegrationTests/NullSubstitute.cs b/AutoMapper/src/IntegrationTests/NullSubstitute.cs index a1cb91f469d..1a2f79887a5 100644 --- a/AutoMapper/src/IntegrationTests/NullSubstitute.cs +++ b/AutoMapper/src/IntegrationTests/NullSubstitute.cs @@ -84,10 +84,9 @@ protected override void Seed(Context context) } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateProjection() - .ForMember(d => d.Value, o => o.NullSubstitute("5")) + new(cfg => + cfg.CreateProjection() + .ForMember(d => d.Value, o => o.NullSubstitute("5")) ); [Fact] diff --git a/AutoMapper/src/UnitTests/BasicFlattening.cs b/AutoMapper/src/UnitTests/BasicFlattening.cs index 9b2132ee882..75d3ec794ae 100644 --- a/AutoMapper/src/UnitTests/BasicFlattening.cs +++ b/AutoMapper/src/UnitTests/BasicFlattening.cs @@ -244,10 +244,9 @@ public class CustomerDTO } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap(MemberList.Source) - .ForMember(d => d.Id, o => o.MapFrom(s => s.AnotherId)) + new(cfg => + cfg.CreateMap(MemberList.Source) + .ForMember(d => d.Id, o => o.MapFrom(s => s.AnotherId)) ); [Fact] diff --git a/AutoMapper/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs b/AutoMapper/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs index 324020e29f9..f926f2372a3 100644 --- a/AutoMapper/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs +++ b/AutoMapper/src/UnitTests/Bug/CannotMapICollectionToAggregateSumDestination.cs @@ -32,8 +32,8 @@ public void Should_map_icollection_to_aggregate_sum_destination() public void Should_project_icollection_to_aggregate_sum_destination() { // arrange - var config = new MapperConfiguration( - cfg => cfg.CreateProjection() + var config = new MapperConfiguration(cfg => + cfg.CreateProjection() ); var source = new DummySource() { DummyCollection = new[] { 1, 4, 5 } }; diff --git a/AutoMapper/src/UnitTests/Bug/ConditionBug.cs b/AutoMapper/src/UnitTests/Bug/ConditionBug.cs index db35eecbd06..aadf66242fe 100644 --- a/AutoMapper/src/UnitTests/Bug/ConditionBug.cs +++ b/AutoMapper/src/UnitTests/Bug/ConditionBug.cs @@ -73,17 +73,16 @@ public class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .ForMember( - d => d.Value, - opt => - { - opt.PreCondition(src => src.Value.HasValue); - opt.MapFrom(src => src.Value.Value + 10); - } - ) + new(cfg => + cfg.CreateMap() + .ForMember( + d => d.Value, + opt => + { + opt.PreCondition(src => src.Value.HasValue); + opt.MapFrom(src => src.Value.Value + 10); + } + ) ); [Fact] @@ -127,17 +126,16 @@ public class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .ForMember( - itemDTO => itemDTO.BasePrice, - config => - { - config.PreCondition(item => item.HasBasePrice); - config.MapFrom(item => item.BasePrice); - } - ) + new(cfg => + cfg.CreateMap() + .ForMember( + itemDTO => itemDTO.BasePrice, + config => + { + config.PreCondition(item => item.HasBasePrice); + config.MapFrom(item => item.BasePrice); + } + ) ); [Fact] diff --git a/AutoMapper/src/UnitTests/Bug/ConstructUsingReturnsNull.cs b/AutoMapper/src/UnitTests/Bug/ConstructUsingReturnsNull.cs index 7483202f188..5259f14451b 100644 --- a/AutoMapper/src/UnitTests/Bug/ConstructUsingReturnsNull.cs +++ b/AutoMapper/src/UnitTests/Bug/ConstructUsingReturnsNull.cs @@ -23,8 +23,8 @@ public void Should_throw_when_construct_using_returns_null() { new Action( () => Mapper.Map(new Source()) - ).ShouldThrowException( - ex => ex.InnerException.ShouldBeOfType() + ).ShouldThrowException(ex => + ex.InnerException.ShouldBeOfType() ); } } diff --git a/AutoMapper/src/UnitTests/Bug/ConvertMapperThreading.cs b/AutoMapper/src/UnitTests/Bug/ConvertMapperThreading.cs index 63ca8c0f391..812cac4924e 100644 --- a/AutoMapper/src/UnitTests/Bug/ConvertMapperThreading.cs +++ b/AutoMapper/src/UnitTests/Bug/ConvertMapperThreading.cs @@ -17,12 +17,11 @@ public void Should_work() { var tasks = Enumerable .Range(0, 5) - .Select( - i => - Task.Factory.StartNew(() => - { - new MapperConfiguration(c => c.CreateMap()); - }) + .Select(i => + Task.Factory.StartNew(() => + { + new MapperConfiguration(c => c.CreateMap()); + }) ) .ToArray(); try diff --git a/AutoMapper/src/UnitTests/Bug/EnumConditionsBug.cs b/AutoMapper/src/UnitTests/Bug/EnumConditionsBug.cs index c534b2fd8ac..f561fe196aa 100644 --- a/AutoMapper/src/UnitTests/Bug/EnumConditionsBug.cs +++ b/AutoMapper/src/UnitTests/Bug/EnumConditionsBug.cs @@ -35,43 +35,40 @@ public void Mapper_respects_condition() { var _c1Called = false; var _c2Called = false; - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember( - m => m.Prop1, - o => - { - o.Condition( - (_, srcProp, destProp) => - { - _c1Called = true; - return srcProp != null; - } - ); - o.MapFrom( - (f, _) => - f.Prop1?.Aggregate((current, next) => current | next) - ); - } - ) - .ForMember( - m => m.Prop2, - o => - { - o.Condition( - (_, srcProp, destProp) => - { - _c2Called = true; - return srcProp != null; - } - ); - o.MapFrom( - (f, _) => - f.Prop2?.Aggregate((current, next) => current | next) - ); - } - ) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember( + m => m.Prop1, + o => + { + o.Condition( + (_, srcProp, destProp) => + { + _c1Called = true; + return srcProp != null; + } + ); + o.MapFrom( + (f, _) => f.Prop1?.Aggregate((current, next) => current | next) + ); + } + ) + .ForMember( + m => m.Prop2, + o => + { + o.Condition( + (_, srcProp, destProp) => + { + _c2Called = true; + return srcProp != null; + } + ); + o.MapFrom( + (f, _) => f.Prop2?.Aggregate((current, next) => current | next) + ); + } + ) ); var src = new EnumTestSource { Prop1 = new[] { Enum1.One }, Prop2 = null }; var dest = config.CreateMapper().Map(src); // will throw diff --git a/AutoMapper/src/UnitTests/Bug/NonExistingProperty.cs b/AutoMapper/src/UnitTests/Bug/NonExistingProperty.cs index 7bffd20e904..395bc896f66 100644 --- a/AutoMapper/src/UnitTests/Bug/NonExistingProperty.cs +++ b/AutoMapper/src/UnitTests/Bug/NonExistingProperty.cs @@ -11,8 +11,8 @@ public void Should_report_missing_property() { new Action( () => - new MapperConfiguration( - cfg => cfg.CreateMap().ForMember("X", s => { }) + new MapperConfiguration(cfg => + cfg.CreateMap().ForMember("X", s => { }) ) ).ShouldThrow(); } diff --git a/AutoMapper/src/UnitTests/Bug/PropertyNamedType.cs b/AutoMapper/src/UnitTests/Bug/PropertyNamedType.cs index 814095d2341..e5f4a9496b8 100644 --- a/AutoMapper/src/UnitTests/Bug/PropertyNamedType.cs +++ b/AutoMapper/src/UnitTests/Bug/PropertyNamedType.cs @@ -18,8 +18,8 @@ public void Should_detect_unmapped_destination_property_named_type() var config = new MapperConfiguration(c => c.CreateMap()); new Action( config.AssertConfigurationIsValid - ).ShouldThrowException( - ex => ex.Errors[0].UnmappedPropertyNames[0].ShouldBe("Type") + ).ShouldThrowException(ex => + ex.Errors[0].UnmappedPropertyNames[0].ShouldBe("Type") ); } } diff --git a/AutoMapper/src/UnitTests/Bug/UseDestinationValue.cs b/AutoMapper/src/UnitTests/Bug/UseDestinationValue.cs index 254ab47fd4f..88523f70b34 100644 --- a/AutoMapper/src/UnitTests/Bug/UseDestinationValue.cs +++ b/AutoMapper/src/UnitTests/Bug/UseDestinationValue.cs @@ -13,10 +13,8 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.UseDestinationValue()) + new(c => + c.CreateMap().ForMember(d => d.Value, o => o.UseDestinationValue()) ); [Fact] @@ -220,12 +218,11 @@ public void Should_report_missing_constructor() new Action( () => Mapper.Map(orgDto) - ).ShouldThrowException( - ex => - ex.InnerException.Message.ShouldStartWith( - typeof(CollectionController) - + " needs to have a constructor with 0 args or only optional args" - ) + ).ShouldThrowException(ex => + ex.InnerException.Message.ShouldStartWith( + typeof(CollectionController) + + " needs to have a constructor with 0 args or only optional args" + ) ); } } diff --git a/AutoMapper/src/UnitTests/ConditionalMapping.cs b/AutoMapper/src/UnitTests/ConditionalMapping.cs index 4c9ecc42433..431111de0b1 100644 --- a/AutoMapper/src/UnitTests/ConditionalMapping.cs +++ b/AutoMapper/src/UnitTests/ConditionalMapping.cs @@ -19,18 +19,17 @@ protected override MapperConfiguration CreateConfiguration() => new(cfg => { cfg.CreateMap() - .ForAllMembers( - o => - o.Condition( - (source, destination, sourceProperty, destinationProperty) => - { - source.ShouldBeSameAs(_source); - destination.ShouldBeSameAs(_destination); - ((int)sourceProperty).ShouldBe(3); - ((int)destinationProperty).ShouldBe(7); - return true; - } - ) + .ForAllMembers(o => + o.Condition( + (source, destination, sourceProperty, destinationProperty) => + { + source.ShouldBeSameAs(_source); + destination.ShouldBeSameAs(_destination); + ((int)sourceProperty).ShouldBe(3); + ((int)destinationProperty).ShouldBe(7); + return true; + } + ) ); }); @@ -42,10 +41,9 @@ public class When_ignoring_all_properties_with_an_inaccessible_setter_and_explic : AutoMapperSpecBase { protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .IgnoreAllPropertiesWithAnInaccessibleSetter() + new(c => + c.CreateMap() + .IgnoreAllPropertiesWithAnInaccessibleSetter() ); interface Interface diff --git a/AutoMapper/src/UnitTests/ConfigurationValidation.cs b/AutoMapper/src/UnitTests/ConfigurationValidation.cs index 09c2a5704ee..a6e83d1dab7 100644 --- a/AutoMapper/src/UnitTests/ConfigurationValidation.cs +++ b/AutoMapper/src/UnitTests/ConfigurationValidation.cs @@ -37,10 +37,8 @@ protected override MapperConfiguration CreateConfiguration() => public void Should_fail_validation() => new Action( AssertConfigurationIsValid - ).ShouldThrowException( - ex => - ex.MemberMap.ToString() - .ShouldBe("Void .ctor(ComplexType), parameter myComplexMember") + ).ShouldThrowException(ex => + ex.MemberMap.ToString().ShouldBe("Void .ctor(ComplexType), parameter myComplexMember") ); } @@ -390,10 +388,9 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap(MemberList.Source) - .ForMember(d => d.OtherValue, o => o.MapFrom(s => s.Value ?? "")) + new(c => + c.CreateMap(MemberList.Source) + .ForMember(d => d.OtherValue, o => o.MapFrom(s => s.Value ?? "")) ); [Fact] @@ -418,10 +415,9 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap(MemberList.Source) - .ForMember(d => d.Value, o => o.MapFrom(s => s.Value ?? "")) + new(c => + c.CreateMap(MemberList.Source) + .ForMember(d => d.Value, o => o.MapFrom(s => s.Value ?? "")) ); [Fact] diff --git a/AutoMapper/src/UnitTests/ContextItems.cs b/AutoMapper/src/UnitTests/ContextItems.cs index a0c18745a71..e9d4ddbbde9 100644 --- a/AutoMapper/src/UnitTests/ContextItems.cs +++ b/AutoMapper/src/UnitTests/ContextItems.cs @@ -3,12 +3,11 @@ public class Context_try_get_items : AutoMapperSpecBase { protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ConvertUsing( - (s, _, c) => c.TryGetItems(out var items) ? (int)items["override"] : s - ) + new(c => + c.CreateMap() + .ConvertUsing( + (s, _, c) => c.TryGetItems(out var items) ? (int)items["override"] : s + ) ); [Fact] diff --git a/AutoMapper/src/UnitTests/CustomMapping.cs b/AutoMapper/src/UnitTests/CustomMapping.cs index ba5f5d96abb..211c7866771 100644 --- a/AutoMapper/src/UnitTests/CustomMapping.cs +++ b/AutoMapper/src/UnitTests/CustomMapping.cs @@ -260,8 +260,8 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( x => x.SubModelId, opts => - opts.MapFrom( - src => src.SubModels.FirstOrDefault().SubSubModels.FirstOrDefault().Id + opts.MapFrom(src => + src.SubModels.FirstOrDefault().SubSubModels.FirstOrDefault().Id ) ); }); @@ -319,10 +319,8 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.MapFrom(src => _guid)) + new(c => + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom(src => _guid)) ); protected override void Because_of() @@ -353,10 +351,8 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.MapFrom()) + new(c => + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom()) ); class Resolver : IValueResolver @@ -391,20 +387,19 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember( - d => d.Value, - o => - o.MapFrom( - (s, d) => - { - Throw(); - return 0; - } - ) - ) + new(c => + c.CreateMap() + .ForMember( + d => d.Value, + o => + o.MapFrom( + (s, d) => + { + Throw(); + return 0; + } + ) + ) ); private void Throw() @@ -520,10 +515,9 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.MapFrom(src => new object())) + new(c => + c.CreateMap() + .ForMember(d => d.Value, o => o.MapFrom(src => new object())) ); protected override void Because_of() @@ -553,10 +547,9 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.MapFrom(s => s.ObjectValue)) + new(c => + c.CreateMap() + .ForMember(d => d.Value, o => o.MapFrom(s => s.ObjectValue)) ); protected override void Because_of() @@ -929,10 +922,9 @@ public When_specifying_a_custom_translator() [Fact] public void Should_use_the_custom_translator() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source); @@ -942,11 +934,10 @@ public void Should_use_the_custom_translator() [Fact] public void Should_ignore_other_mapping_rules() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source); @@ -978,10 +969,9 @@ public When_specifying_a_custom_translator_using_projection() [Fact] public void Should_use_the_custom_translator() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source); @@ -991,11 +981,10 @@ public void Should_use_the_custom_translator() [Fact] public void Should_ignore_other_mapping_rules() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source); @@ -1029,10 +1018,9 @@ public When_specifying_a_custom_translator_and_passing_in_the_destination_object [Fact] public void Should_resolve_to_the_destination_object_from_the_custom_translator() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source, _dest); @@ -1042,11 +1030,10 @@ public void Should_resolve_to_the_destination_object_from_the_custom_translator( [Fact] public void Should_ignore_other_mapping_rules() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source, _dest); @@ -1090,8 +1077,8 @@ ResolutionContext context [Fact] public void Should_use_the_custom_translator() { - var config = new MapperConfiguration( - cfg => cfg.CreateMap().ConvertUsing() + var config = new MapperConfiguration(cfg => + cfg.CreateMap().ConvertUsing() ); _dest = config.CreateMapper().Map(_source); @@ -1101,11 +1088,10 @@ public void Should_use_the_custom_translator() [Fact] public void Should_ignore_other_mapping_rules() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) - .ConvertUsing(s => new Destination { Value = s.Value + 10 }) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Value, opt => opt.MapFrom(src => src.AnotherValue)) + .ConvertUsing(s => new Destination { Value = s.Value + 10 }) ); _dest = config.CreateMapper().Map(_source); @@ -1452,10 +1438,9 @@ public void Should_fail_with_an_exception_during_configuration() { typeof(ArgumentException).ShouldBeThrownBy(() => { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest.Dest.Value, opt => opt.MapFrom(src => src.Value)) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dest => dest.Dest.Value, opt => opt.MapFrom(src => src.Value)) ); }); } @@ -1748,10 +1733,8 @@ public void Should_map_from_that_constant_value() { try { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dest => dest, opt => opt.MapFrom(src => 5)) + var config = new MapperConfiguration(cfg => + cfg.CreateMap().ForMember(dest => dest, opt => opt.MapFrom(src => 5)) ); } catch (Exception e) diff --git a/AutoMapper/src/UnitTests/IMappingExpression/ForCtorParam.cs b/AutoMapper/src/UnitTests/IMappingExpression/ForCtorParam.cs index ef9c8e3db3b..72e34209df3 100644 --- a/AutoMapper/src/UnitTests/IMappingExpression/ForCtorParam.cs +++ b/AutoMapper/src/UnitTests/IMappingExpression/ForCtorParam.cs @@ -7,10 +7,9 @@ record Source(float Value = 0); record Destination(DateTime Value); protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForCtorParam("Value", o => o.MapFrom(s => DateTime.MinValue)) + new(c => + c.CreateMap() + .ForCtorParam("Value", o => o.MapFrom(s => DateTime.MinValue)) ); [Fact] @@ -32,11 +31,10 @@ public Destination(string key1, string value1) } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap(typeof(KeyValuePair<,>), typeof(Destination)) - .ForCtorParam("value1", o => o.MapFrom("Value")) - .ForCtorParam("key1", o => o.MapFrom("Key")) + new(c => + c.CreateMap(typeof(KeyValuePair<,>), typeof(Destination)) + .ForCtorParam("value1", o => o.MapFrom("Value")) + .ForCtorParam("key1", o => o.MapFrom("Key")) ); [Fact] @@ -63,10 +61,9 @@ public class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateProjection() - .ForCtorParam("value", o => o.MapFrom(s => s.Value1)) + new(c => + c.CreateProjection() + .ForCtorParam("value", o => o.MapFrom(s => s.Value1)) ); [Fact] @@ -120,20 +117,19 @@ public void Should_redirect_value() [Fact] public void Should_resolve_using_custom_func() { - var mapper = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForCtorParam( - "thing", - opt => - opt.MapFrom( - (src, ctxt) => - { - var rev = src.Value + 3; - return rev; - } - ) - ) + var mapper = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForCtorParam( + "thing", + opt => + opt.MapFrom( + (src, ctxt) => + { + var rev = src.Value + 3; + return rev; + } + ) + ) ).CreateMapper(); var dest = mapper.Map(new Source { Value = 5 }); @@ -145,10 +141,9 @@ public void Should_resolve_using_custom_func() public void Should_resolve_using_custom_func_with_correct_ResolutionContext() { const string itemKey = "key"; - var mapper = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForCtorParam("thing", opt => opt.MapFrom((src, ctx) => ctx.Items[itemKey])) + var mapper = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForCtorParam("thing", opt => opt.MapFrom((src, ctx) => ctx.Items[itemKey])) ).CreateMapper(); var dest = mapper.Map( diff --git a/AutoMapper/src/UnitTests/InterfaceMapping.cs b/AutoMapper/src/UnitTests/InterfaceMapping.cs index cb4a4389332..58f23228b42 100644 --- a/AutoMapper/src/UnitTests/InterfaceMapping.cs +++ b/AutoMapper/src/UnitTests/InterfaceMapping.cs @@ -168,15 +168,14 @@ public interface IDestinationBase } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap(typeof(IList<>), typeof(IDestinationBase<>)) - .ForMember( - nameof(IDestinationBase.Items), - p_Expression => p_Expression.MapFrom(p_Source => p_Source) - ) - .ForMember("PropertyToMap", o => o.Ignore()) - .AsProxy() + new(cfg => + cfg.CreateMap(typeof(IList<>), typeof(IDestinationBase<>)) + .ForMember( + nameof(IDestinationBase.Items), + p_Expression => p_Expression.MapFrom(p_Source => p_Source) + ) + .ForMember("PropertyToMap", o => o.Ignore()) + .AsProxy() ); [Fact] @@ -238,8 +237,8 @@ public interface ITargetBase [Fact] public void Should_find_inherited_members_by_name() { - new MapperConfiguration( - c => c.CreateMap().ForMember("BaseId", opt => opt.Ignore()) + new MapperConfiguration(c => + c.CreateMap().ForMember("BaseId", opt => opt.Ignore()) ); } } @@ -390,18 +389,17 @@ public interface IDestination } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .AsProxy() - .ForMember(x => x.Value2, o => o.MapFrom(x => x.Value1)) - .ForMember(x => x.Value3, o => o.Ignore()) - .AfterMap( - (_, d) => - { - d.Value3 = "value 3"; - } - ) + new(cfg => + cfg.CreateMap() + .AsProxy() + .ForMember(x => x.Value2, o => o.MapFrom(x => x.Value1)) + .ForMember(x => x.Value3, o => o.Ignore()) + .AfterMap( + (_, d) => + { + d.Value3 = "value 3"; + } + ) ); protected override void Because_of() diff --git a/AutoMapper/src/UnitTests/Internal/CreateProxyThreading.cs b/AutoMapper/src/UnitTests/Internal/CreateProxyThreading.cs index 21cece9a426..5e7605197e6 100644 --- a/AutoMapper/src/UnitTests/Internal/CreateProxyThreading.cs +++ b/AutoMapper/src/UnitTests/Internal/CreateProxyThreading.cs @@ -9,12 +9,11 @@ public void Should_create_the_proxy_once() { var tasks = Enumerable .Range(0, 5) - .Select( - i => - Task.Factory.StartNew(() => - { - ProxyGenerator.GetProxyType(typeof(ISomeDto)); - }) + .Select(i => + Task.Factory.StartNew(() => + { + ProxyGenerator.GetProxyType(typeof(ISomeDto)); + }) ) .ToArray(); Task.WaitAll(tasks); diff --git a/AutoMapper/src/UnitTests/MapToAttributeTest.cs b/AutoMapper/src/UnitTests/MapToAttributeTest.cs index 77f6e5345c5..5b654064cdf 100644 --- a/AutoMapper/src/UnitTests/MapToAttributeTest.cs +++ b/AutoMapper/src/UnitTests/MapToAttributeTest.cs @@ -52,15 +52,14 @@ string nameToSearch sourceMembers.Length == 0 ? Empty : sourceMembers; } return sourceMembers - .FirstOrDefault( - d => - d.Attribute.IsMatch( - sourceTypeDetails, - d.Member, - destType, - destMemberType, - nameToSearch - ) + .FirstOrDefault(d => + d.Attribute.IsMatch( + sourceTypeDetails, + d.Member, + destType, + destMemberType, + nameToSearch + ) ) .Member; } diff --git a/AutoMapper/src/UnitTests/Mappers/StringDictionaryMapperTests.cs b/AutoMapper/src/UnitTests/Mappers/StringDictionaryMapperTests.cs index f5d87bc514d..ef28d7871b0 100644 --- a/AutoMapper/src/UnitTests/Mappers/StringDictionaryMapperTests.cs +++ b/AutoMapper/src/UnitTests/Mappers/StringDictionaryMapperTests.cs @@ -392,11 +392,10 @@ public void Should_throw() { new Action( () => Mapper.Map(new StringDictionary()) - ).ShouldThrowException( - ex => - ex.InnerException.Message.ShouldStartWith( - $"Cannot create an instance of abstract type {typeof(SomeBase)}." - ) + ).ShouldThrowException(ex => + ex.InnerException.Message.ShouldStartWith( + $"Cannot create an instance of abstract type {typeof(SomeBase)}." + ) ); } } diff --git a/AutoMapper/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs b/AutoMapper/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs index ad295cb9ef6..7916ed44e80 100644 --- a/AutoMapper/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs +++ b/AutoMapper/src/UnitTests/MappingInheritance/IncludedMappingShouldInheritBaseMappings.cs @@ -73,12 +73,11 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( d => d.KeyValuesOtherName, o => - o.MapFrom( - s => - new[] - { - new KeyValueModel { Key = "key1", Value = "value1" } - } + o.MapFrom(s => + new[] + { + new KeyValueModel { Key = "key1", Value = "value1" } + } ) ) .Include(); diff --git a/AutoMapper/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs b/AutoMapper/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs index 1c2dbc0d856..25e847ffa77 100644 --- a/AutoMapper/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs +++ b/AutoMapper/src/UnitTests/MappingInheritance/ShouldSupportOnlyDestinationTypeBeingDerived.cs @@ -59,8 +59,8 @@ public void Should_detect_unrelated_override() { new Action( () => - new MapperConfiguration( - c => c.CreateMap(typeof(Source), typeof(Destination)).As(typeof(Source)) + new MapperConfiguration(c => + c.CreateMap(typeof(Source), typeof(Destination)).As(typeof(Source)) ) ).ShouldThrowException(ex => { diff --git a/AutoMapper/src/UnitTests/NullBehavior.cs b/AutoMapper/src/UnitTests/NullBehavior.cs index 246d474555b..c27dc962a2f 100644 --- a/AutoMapper/src/UnitTests/NullBehavior.cs +++ b/AutoMapper/src/UnitTests/NullBehavior.cs @@ -88,10 +88,9 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Length, o => o.MapFrom(s => s.Value.Length)) + new(c => + c.CreateMap() + .ForMember(d => d.Length, o => o.MapFrom(s => s.Value.Length)) ); [Fact] @@ -340,10 +339,8 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .ForMember(d => d.Collection, o => o.MapAtRuntime()) + new(cfg => + cfg.CreateMap().ForMember(d => d.Collection, o => o.MapAtRuntime()) ); [Fact] @@ -651,11 +648,8 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( d => d.SubExpressionName, opt => - opt.MapFrom( - src => - src.Subs.FirstOrDefault( - spt => spt.Sub.Something == src.Id - ).Something + opt.MapFrom(src => + src.Subs.FirstOrDefault(spt => spt.Sub.Something == src.Id).Something ) ) .ForMember(d => d.NullableMapFrom, opt => opt.MapFrom(s => s.Sub.Something)); @@ -757,11 +751,9 @@ protected override MapperConfiguration CreateConfiguration() => .ForMember( d => d.SubExpressionName, opt => - opt.MapFrom( - src => - src.Subs.FirstOrDefault( - spt => spt.Sub.Something == src.Id - ).Something + opt.MapFrom(src => + src.Subs.FirstOrDefault(spt => spt.Sub.Something == src.Id + ).Something ) ) .ForMember( diff --git a/AutoMapper/src/UnitTests/Projection/ConstructorTests.cs b/AutoMapper/src/UnitTests/Projection/ConstructorTests.cs index d37023e6c3a..4a238972911 100644 --- a/AutoMapper/src/UnitTests/Projection/ConstructorTests.cs +++ b/AutoMapper/src/UnitTests/Projection/ConstructorTests.cs @@ -124,10 +124,9 @@ class Source record Destination(bool Value) { } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateProjection() - .ForCtorParam(nameof(Destination.Value), o => o.MapFrom(s => s.Value == 5)) + new(cfg => + cfg.CreateProjection() + .ForCtorParam(nameof(Destination.Value), o => o.MapFrom(s => s.Value == 5)) ); [Fact] diff --git a/AutoMapper/src/UnitTests/Projection/MapFromTest.cs b/AutoMapper/src/UnitTests/Projection/MapFromTest.cs index ce3d16815b7..776d9d9f0ca 100644 --- a/AutoMapper/src/UnitTests/Projection/MapFromTest.cs +++ b/AutoMapper/src/UnitTests/Projection/MapFromTest.cs @@ -22,10 +22,9 @@ public void Should_not_fail() [Fact] public void Should_map_from_String() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName")) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName")) ); var um = new UserModel(); @@ -50,10 +49,9 @@ public class UserDto [Fact] public void Should_project_from_String() { - var config = new MapperConfiguration( - cfg => - cfg.CreateMap() - .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName")) + var config = new MapperConfiguration(cfg => + cfg.CreateMap() + .ForMember(dto => dto.FullName, opt => opt.MapFrom("FirstName")) ); var result = new[] { new UserModel { FirstName = "Hallo" } } .AsQueryable() @@ -78,10 +76,9 @@ public class Dto } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateProjection() - .ForMember(d => d.ShortDescription, o => o.MapFrom(s => "mappedFrom")) + new(c => + c.CreateProjection() + .ForMember(d => d.ShortDescription, o => o.MapFrom(s => "mappedFrom")) ); protected override void Because_of() @@ -147,10 +144,8 @@ class Dto } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(d => d.Value, o => o.MapFrom("Inner.GetSomeValue")) + new(c => + c.CreateMap().ForMember(d => d.Value, o => o.MapFrom("Inner.GetSomeValue")) ); [Fact] diff --git a/AutoMapper/src/UnitTests/Projection/NestedAndArraysTests.cs b/AutoMapper/src/UnitTests/Projection/NestedAndArraysTests.cs index a5303e5da8f..75d171fb17f 100644 --- a/AutoMapper/src/UnitTests/Projection/NestedAndArraysTests.cs +++ b/AutoMapper/src/UnitTests/Projection/NestedAndArraysTests.cs @@ -103,9 +103,8 @@ public void SubMap() Assert.Equal(viewModel.EntityID, entity.EntityID); Assert.True( - entity.SubEntities.All( - subEntity => - viewModel.SubEntities.Any(s => s.Description == subEntity.Description) + entity.SubEntities.All(subEntity => + viewModel.SubEntities.Any(s => s.Description == subEntity.Description) ) ); } diff --git a/AutoMapper/src/UnitTests/ReverseMapping.cs b/AutoMapper/src/UnitTests/ReverseMapping.cs index 08c4deb209e..7d61c2502db 100644 --- a/AutoMapper/src/UnitTests/ReverseMapping.cs +++ b/AutoMapper/src/UnitTests/ReverseMapping.cs @@ -15,11 +15,10 @@ class Destination } protected override MapperConfiguration CreateConfiguration() => - new( - c => - c.CreateMap() - .ForMember(src => src.Id, opt => opt.MapFrom(_ => Guid.Empty)) - .ReverseMap() + new(c => + c.CreateMap() + .ForMember(src => src.Id, opt => opt.MapFrom(_ => Guid.Empty)) + .ReverseMap() ); [Fact] diff --git a/AutoMapper/src/UnitTests/ValueConverters.cs b/AutoMapper/src/UnitTests/ValueConverters.cs index 2ccd5d70e5f..0aeada78b77 100644 --- a/AutoMapper/src/UnitTests/ValueConverters.cs +++ b/AutoMapper/src/UnitTests/ValueConverters.cs @@ -166,13 +166,12 @@ public class Dest } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .ForMember( - d => d.ValueFoo1, - opt => opt.ConvertUsing() - ) + new(cfg => + cfg.CreateMap() + .ForMember( + d => d.ValueFoo1, + opt => opt.ConvertUsing() + ) ); [Fact] diff --git a/AutoMapper/src/UnitTests/ValueTypes.cs b/AutoMapper/src/UnitTests/ValueTypes.cs index 01f3c5aa498..0169dca8bce 100644 --- a/AutoMapper/src/UnitTests/ValueTypes.cs +++ b/AutoMapper/src/UnitTests/ValueTypes.cs @@ -143,10 +143,9 @@ public class DigiIn1 } protected override MapperConfiguration CreateConfiguration() => - new( - cfg => - cfg.CreateMap() - .ForMember(d => d.CncInfo, x => x.MapFrom(s => s.CNCinfo)) + new(cfg => + cfg.CreateMap() + .ForMember(d => d.CncInfo, x => x.MapFrom(s => s.CNCinfo)) ); [Fact] diff --git a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/CustomModifiersTestCase.cs b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/CustomModifiersTestCase.cs index 741d1282e4c..9f1ff99abf0 100644 --- a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/CustomModifiersTestCase.cs +++ b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/CustomModifiersTestCase.cs @@ -79,23 +79,23 @@ public CustomModifiersTestCase() } public static IEnumerable AsModoptOnParamTypeNames => - CustomModifiersTestCase.customModifiers.Keys.Select( - typeName => typeName + "_AsModoptOnParamType" + CustomModifiersTestCase.customModifiers.Keys.Select(typeName => + typeName + "_AsModoptOnParamType" ); public static IEnumerable AsModreqOnParamTypeNames => - CustomModifiersTestCase.customModifiers.Keys.Select( - typeName => typeName + "_AsModreqOnParamType" + CustomModifiersTestCase.customModifiers.Keys.Select(typeName => + typeName + "_AsModreqOnParamType" ); public static IEnumerable AsModoptOnReturnTypeNames => - CustomModifiersTestCase.customModifiers.Keys.Select( - typeName => typeName + "_AsModoptOnReturnType" + CustomModifiersTestCase.customModifiers.Keys.Select(typeName => + typeName + "_AsModoptOnReturnType" ); public static IEnumerable AsModreqOnReturnTypeNames => - CustomModifiersTestCase.customModifiers.Keys.Select( - typeName => typeName + "_AsModreqOnReturnType" + CustomModifiersTestCase.customModifiers.Keys.Select(typeName => + typeName + "_AsModreqOnReturnType" ); public static IEnumerable AllTypeNames => diff --git a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/GenericMethodsProxyTestCase.cs b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/GenericMethodsProxyTestCase.cs index 19842a4aac0..ca94670837a 100644 --- a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/GenericMethodsProxyTestCase.cs +++ b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/GenericMethodsProxyTestCase.cs @@ -93,7 +93,9 @@ public void ProxyAdditionalInterfaceWithGenericMethods() [Test] public void ProxyInterfaceWithGenericMethodWithTwoGenericParametersWhereOneIsBaseToAnother() { - generator.CreateInterfaceProxyWithoutTarget(); + generator.CreateInterfaceProxyWithoutTarget( + + ); } [Test] diff --git a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/ModuleScopeTestCase.cs b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/ModuleScopeTestCase.cs index dda12948fef..28ff83d1875 100644 --- a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/ModuleScopeTestCase.cs +++ b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/ModuleScopeTestCase.cs @@ -469,13 +469,8 @@ public void LoadAssemblyIntoCache_InvalidAssembly() [Test] public void LoadAssemblyIntoCache_CreateClassProxy() { - CheckLoadAssemblyIntoCache( - builder => - builder.CreateClassProxyType( - typeof(object), - null, - ProxyGenerationOptions.Default - ) + CheckLoadAssemblyIntoCache(builder => + builder.CreateClassProxyType(typeof(object), null, ProxyGenerationOptions.Default) ); } diff --git a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/OutRefParamsTestCase.cs b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/OutRefParamsTestCase.cs index eee72372082..c8e4a9d6f95 100644 --- a/Core/src/Castle.Core.Tests/DynamicProxy.Tests/OutRefParamsTestCase.cs +++ b/Core/src/Castle.Core.Tests/DynamicProxy.Tests/OutRefParamsTestCase.cs @@ -400,8 +400,8 @@ public void Exception_during_method_out_ref_arguments_set_interface_proxy_with_t [Test] public void Can_query_MethodInvocationTarget_for_overridden_class_method_having_a_generic_by_ref_parameter() { - var interceptor = new WithCallbackInterceptor( - invocation => _ = invocation.MethodInvocationTarget + var interceptor = new WithCallbackInterceptor(invocation => + _ = invocation.MethodInvocationTarget ); var proxy = generator.CreateClassProxy(interceptor); proxy.Create(out _); diff --git a/Core/src/Castle.Core/Components.DictionaryAdapter/DictionaryAdapterBase.Notify.cs b/Core/src/Castle.Core/Components.DictionaryAdapter/DictionaryAdapterBase.Notify.cs index a36fe13c078..54568fd1cff 100644 --- a/Core/src/Castle.Core/Components.DictionaryAdapter/DictionaryAdapterBase.Notify.cs +++ b/Core/src/Castle.Core/Components.DictionaryAdapter/DictionaryAdapterBase.Notify.cs @@ -147,8 +147,8 @@ public TrackPropertyChangeScope(DictionaryAdapterBase adapter) { this.adapter = adapter; this.readOnlyProperties = adapter - .This.Properties.Values.Where( - pd => !pd.Property.CanWrite || pd.IsDynamicProperty + .This.Properties.Values.Where(pd => + !pd.Property.CanWrite || pd.IsDynamicProperty ) .ToDictionary(pd => pd, pd => GetEffectivePropertyValue(pd)); } diff --git a/Core/src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Serializers/XmlEnumerationSerializer.cs b/Core/src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Serializers/XmlEnumerationSerializer.cs index f1a92e408e0..8244d144dce 100644 --- a/Core/src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Serializers/XmlEnumerationSerializer.cs +++ b/Core/src/Castle.Core/Components.DictionaryAdapter/Xml/Internal/Serializers/XmlEnumerationSerializer.cs @@ -18,8 +18,9 @@ namespace Castle.Components.DictionaryAdapter.Xml public class XmlEnumerationSerializer : XmlStringSerializer { - public static new readonly XmlEnumerationSerializer Instance = - new XmlEnumerationSerializer(); + public static new readonly XmlEnumerationSerializer Instance = new XmlEnumerationSerializer( + + ); protected XmlEnumerationSerializer() { } diff --git a/Core/src/Castle.Core/DynamicProxy/Generators/Emitters/GenericUtil.cs b/Core/src/Castle.Core/DynamicProxy/Generators/Emitters/GenericUtil.cs index ec77ebbed69..feacb1befa8 100644 --- a/Core/src/Castle.Core/DynamicProxy/Generators/Emitters/GenericUtil.cs +++ b/Core/src/Castle.Core/DynamicProxy/Generators/Emitters/GenericUtil.cs @@ -84,7 +84,9 @@ GenericTypeParameterBuilder[] newGenericParameters Trace.Assert( methodToCopyGenericsFrom.DeclaringType.IsGenericType && constraint.DeclaringType - == methodToCopyGenericsFrom.DeclaringType.GetGenericTypeDefinition(), + == methodToCopyGenericsFrom.DeclaringType.GetGenericTypeDefinition( + + ), "When a generic method parameter has a constraint on a generic type parameter, the generic type must be the declaring typer of the method." ); diff --git a/Core/src/Castle.Core/DynamicProxy/Generators/GeneratorUtil.cs b/Core/src/Castle.Core/DynamicProxy/Generators/GeneratorUtil.cs index 31cc7763435..ca71d8371a2 100644 --- a/Core/src/Castle.Core/DynamicProxy/Generators/GeneratorUtil.cs +++ b/Core/src/Castle.Core/DynamicProxy/Generators/GeneratorUtil.cs @@ -107,10 +107,9 @@ bool IsReadOnly(ParameterInfo parameter) if ( parameter .GetCustomAttributes(false) - .Any( - x => - x.GetType().FullName - == "System.Runtime.CompilerServices.IsReadOnlyAttribute" + .Any(x => + x.GetType().FullName + == "System.Runtime.CompilerServices.IsReadOnlyAttribute" ) ) { diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Benchmarks/SerializeComparisonBenchmarks.cs b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Benchmarks/SerializeComparisonBenchmarks.cs index df98599e7fe..2a75ba870c7 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Benchmarks/SerializeComparisonBenchmarks.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Benchmarks/SerializeComparisonBenchmarks.cs @@ -190,14 +190,11 @@ private string SerializeJsonNetLinq(TestClass c) new JProperty( "Addresses", new JArray( - c.Addresses.Select( - a => - new JObject( - new JProperty("Street", a.Street), - new JProperty("Phone", a.Phone), - new JProperty("Entered", a.Entered) - ) - ) + c.Addresses.Select(a => new JObject( + new JProperty("Street", a.Street), + new JProperty("Phone", a.Phone), + new JProperty("Entered", a.Entered) + )) ) ) ); diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/JsonPath/QueryJsonSelectTokenWithLinq.cs b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/JsonPath/QueryJsonSelectTokenWithLinq.cs index 6cabb81c9f1..b7f263e95a3 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/JsonPath/QueryJsonSelectTokenWithLinq.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/JsonPath/QueryJsonSelectTokenWithLinq.cs @@ -97,8 +97,8 @@ public void Example() Console.WriteLine(string.Join(", ", firstProductNames)); // Headlight Fluid - decimal totalPrice = o["Manufacturers"].Sum( - m => (decimal)m.SelectToken("Products[0].Price") + decimal totalPrice = o["Manufacturers"].Sum(m => + (decimal)m.SelectToken("Products[0].Price") ); Console.WriteLine(totalPrice); diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/Linq/SerializeWithLinq.cs b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/Linq/SerializeWithLinq.cs index 031c38e5a89..26ffd2789df 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/Linq/SerializeWithLinq.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Documentation/Samples/Linq/SerializeWithLinq.cs @@ -77,23 +77,16 @@ public void Example() }; JArray blogPostsArray = new JArray( - blogPosts.Select( - p => - new JObject - { - { "Title", p.Title }, - { - "Author", - new JObject - { - { "Name", p.AuthorName }, - { "Twitter", p.AuthorTwitter } - } - }, - { "Date", p.PostedDate }, - { "BodyHtml", HttpUtility.HtmlEncode(p.Body) }, - } - ) + blogPosts.Select(p => new JObject + { + { "Title", p.Title }, + { + "Author", + new JObject { { "Name", p.AuthorName }, { "Twitter", p.AuthorTwitter } } + }, + { "Date", p.PostedDate }, + { "BodyHtml", HttpUtility.HtmlEncode(p.Body) }, + }) ); Console.WriteLine(blogPostsArray.ToString()); diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs index c03122b8657..f4d787b6d77 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs @@ -980,8 +980,8 @@ public void WriteEndOnPropertyState() new ErrorPerson2 { FirstName = "Scott", LastName = "Guthrie" }, }; - Dictionary> dictionary = data.GroupBy( - person => person.FirstName + Dictionary> dictionary = data.GroupBy(person => + person.FirstName ) .ToDictionary(group => @group.Key, group => @group.Cast()); string output = JsonConvert.SerializeObject(dictionary, Formatting.None, settings); @@ -1005,8 +1005,8 @@ public void WriteEndOnPropertyState2() new ErrorPerson2 { FirstName = "James", LastName = "Newton-King" }, }; - Dictionary> dictionary = data.GroupBy( - person => person.FirstName + Dictionary> dictionary = data.GroupBy(person => + person.FirstName ) .ToDictionary(group => @group.Key, group => @group.Cast()); string output = JsonConvert.SerializeObject(dictionary, Formatting.None, settings); diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs index 363cb7d624b..c22e3c9bff2 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json.Tests/Serialization/ShouldSerializeTests.cs @@ -446,11 +446,10 @@ public void ShouldDeserialize_True() Assert.IsTrue( traceWriter .GetTraceMessages() - .Any( - m => - m.EndsWith( - "Verbose ShouldDeserialize result for property 'Name' on Newtonsoft.Json.Tests.Serialization.ShouldDeserializeTestClass: True. Path 'Name'." - ) + .Any(m => + m.EndsWith( + "Verbose ShouldDeserialize result for property 'Name' on Newtonsoft.Json.Tests.Serialization.ShouldDeserializeTestClass: True. Path 'Name'." + ) ) ); } @@ -479,11 +478,10 @@ public void ShouldDeserialize_False() Assert.IsTrue( traceWriter .GetTraceMessages() - .Any( - m => - m.EndsWith( - "Verbose ShouldDeserialize result for property 'Name' on Newtonsoft.Json.Tests.Serialization.ShouldDeserializeTestClass: False. Path 'Name'." - ) + .Any(m => + m.EndsWith( + "Verbose ShouldDeserialize result for property 'Name' on Newtonsoft.Json.Tests.Serialization.ShouldDeserializeTestClass: False. Path 'Name'." + ) ) ); } diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs b/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs index 1c7cb99c598..0e95dfa0f63 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json/Schema/JsonSchemaResolver.cs @@ -70,14 +70,14 @@ public JsonSchemaResolver() /// A for the specified reference. public virtual JsonSchema GetSchema(string reference) { - JsonSchema schema = LoadedSchemas.SingleOrDefault( - s => string.Equals(s.Id, reference, StringComparison.Ordinal) + JsonSchema schema = LoadedSchemas.SingleOrDefault(s => + string.Equals(s.Id, reference, StringComparison.Ordinal) ); if (schema == null) { - schema = LoadedSchemas.SingleOrDefault( - s => string.Equals(s.Location, reference, StringComparison.Ordinal) + schema = LoadedSchemas.SingleOrDefault(s => + string.Equals(s.Location, reference, StringComparison.Ordinal) ); } diff --git a/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs b/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs index 0fdbfdd3ef0..390d879ecf8 100644 --- a/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs +++ b/Newtonsoft.Json/Src/Newtonsoft.Json/Utilities/StringUtils.cs @@ -165,8 +165,8 @@ string testValue throw new ArgumentNullException(nameof(valueSelector)); } - IEnumerable caseInsensitiveResults = source.Where( - s => string.Equals(valueSelector(s), testValue, StringComparison.OrdinalIgnoreCase) + IEnumerable caseInsensitiveResults = source.Where(s => + string.Equals(valueSelector(s), testValue, StringComparison.OrdinalIgnoreCase) ); if (caseInsensitiveResults.Count() <= 1) { @@ -175,8 +175,8 @@ string testValue else { // multiple results returned. now filter using case sensitivity - IEnumerable caseSensitiveResults = source.Where( - s => string.Equals(valueSelector(s), testValue, StringComparison.Ordinal) + IEnumerable caseSensitiveResults = source.Where(s => + string.Equals(valueSelector(s), testValue, StringComparison.Ordinal) ); return caseSensitiveResults.SingleOrDefault(); } diff --git a/aspnetcore/src/Analyzers/Microsoft.AspNetCore.Analyzer.Testing/src/DiagnosticAnalyzerRunner.cs b/aspnetcore/src/Analyzers/Microsoft.AspNetCore.Analyzer.Testing/src/DiagnosticAnalyzerRunner.cs index a955ac116e3..1174756cfd1 100644 --- a/aspnetcore/src/Analyzers/Microsoft.AspNetCore.Analyzer.Testing/src/DiagnosticAnalyzerRunner.cs +++ b/aspnetcore/src/Analyzers/Microsoft.AspNetCore.Analyzer.Testing/src/DiagnosticAnalyzerRunner.cs @@ -86,10 +86,9 @@ protected async Task GetDiagnosticsAsync( // We want to KEEP errors because we might have written bad code. But sometimes we leave warnings in to make the // test code more convenient diags = diags - .Where( - d => - d.Severity == DiagnosticSeverity.Error - || analyzer.SupportedDiagnostics.Any(s => s.Id.Equals(d.Id)) + .Where(d => + d.Severity == DiagnosticSeverity.Error + || analyzer.SupportedDiagnostics.Any(s => s.Id.Equals(d.Id)) ) .ToImmutableArray(); diff --git a/aspnetcore/src/Antiforgery/src/Internal/DefaultClaimUidExtractor.cs b/aspnetcore/src/Antiforgery/src/Internal/DefaultClaimUidExtractor.cs index d58f19f0d63..3ce3b604d0e 100644 --- a/aspnetcore/src/Antiforgery/src/Internal/DefaultClaimUidExtractor.cs +++ b/aspnetcore/src/Antiforgery/src/Internal/DefaultClaimUidExtractor.cs @@ -54,17 +54,16 @@ IEnumerable claimsIdentities continue; } - var subClaim = identity.FindFirst( - claim => string.Equals("sub", claim.Type, StringComparison.Ordinal) + var subClaim = identity.FindFirst(claim => + string.Equals("sub", claim.Type, StringComparison.Ordinal) ); if (subClaim != null && !string.IsNullOrEmpty(subClaim.Value)) { return new string[] { subClaim.Type, subClaim.Value, subClaim.Issuer }; } - var nameIdentifierClaim = identity.FindFirst( - claim => - string.Equals(ClaimTypes.NameIdentifier, claim.Type, StringComparison.Ordinal) + var nameIdentifierClaim = identity.FindFirst(claim => + string.Equals(ClaimTypes.NameIdentifier, claim.Type, StringComparison.Ordinal) ); if (nameIdentifierClaim != null && !string.IsNullOrEmpty(nameIdentifierClaim.Value)) { @@ -76,8 +75,8 @@ IEnumerable claimsIdentities }; } - var upnClaim = identity.FindFirst( - claim => string.Equals(ClaimTypes.Upn, claim.Type, StringComparison.Ordinal) + var upnClaim = identity.FindFirst(claim => + string.Equals(ClaimTypes.Upn, claim.Type, StringComparison.Ordinal) ); if (upnClaim != null && !string.IsNullOrEmpty(upnClaim.Value)) { diff --git a/aspnetcore/src/Caching/SqlServer/test/SqlServerCacheServicesExtensionsTest.cs b/aspnetcore/src/Caching/SqlServer/test/SqlServerCacheServicesExtensionsTest.cs index a4c5a49453e..57538054b69 100644 --- a/aspnetcore/src/Caching/SqlServer/test/SqlServerCacheServicesExtensionsTest.cs +++ b/aspnetcore/src/Caching/SqlServer/test/SqlServerCacheServicesExtensionsTest.cs @@ -45,8 +45,8 @@ public void AddDistributedSqlServerCache_ReplacesPreviouslyUserRegisteredService // Assert var serviceProvider = services.BuildServiceProvider(); - var distributedCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IDistributedCache) + var distributedCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IDistributedCache) ); Assert.NotNull(distributedCache); diff --git a/aspnetcore/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs b/aspnetcore/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs index 18819624d67..5d9fb29229d 100644 --- a/aspnetcore/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs +++ b/aspnetcore/src/Components/Components/src/CascadingValueServiceCollectionExtensions.cs @@ -23,9 +23,10 @@ public static IServiceCollection AddCascadingValue( this IServiceCollection serviceCollection, Func initialValueFactory ) => - serviceCollection.AddScoped( - sp => new CascadingValueSource(() => initialValueFactory(sp), isFixed: true) - ); + serviceCollection.AddScoped(sp => new CascadingValueSource( + () => initialValueFactory(sp), + isFixed: true + )); /// /// Adds a cascading value to the . This is equivalent to having @@ -41,10 +42,11 @@ public static IServiceCollection AddCascadingValue( string name, Func initialValueFactory ) => - serviceCollection.AddScoped( - sp => - new CascadingValueSource(name, () => initialValueFactory(sp), isFixed: true) - ); + serviceCollection.AddScoped(sp => new CascadingValueSource( + name, + () => initialValueFactory(sp), + isFixed: true + )); /// /// Adds a cascading value to the . This is equivalent to having diff --git a/aspnetcore/src/Components/Components/test/CascadingParameterTest.cs b/aspnetcore/src/Components/Components/test/CascadingParameterTest.cs index 82946bed11b..a41aa76ec9e 100644 --- a/aspnetcore/src/Components/Components/test/CascadingParameterTest.cs +++ b/aspnetcore/src/Components/Components/test/CascadingParameterTest.cs @@ -641,9 +641,9 @@ public void PrefersComponentHierarchyCascadingValuesOverServiceProviderValues() { // Arrange var services = new ServiceCollection(); - services.AddCascadingValue( - _ => new MyParamType("Hello from services (this should be overridden)") - ); + services.AddCascadingValue(_ => new MyParamType( + "Hello from services (this should be overridden)" + )); var renderer = new TestRenderer(services.BuildServiceProvider()); var component = new TestComponent(builder => { @@ -969,15 +969,21 @@ public void CanUseTryAddPatternForCascadingValuesInServiceCollection_CascadingVa var services = new ServiceCollection(); // Act - services.TryAddCascadingValue( - _ => new CascadingValueSource("Name1", new Type1(), false) - ); - services.TryAddCascadingValue( - _ => new CascadingValueSource("Name2", new Type1(), false) - ); - services.TryAddCascadingValue( - _ => new CascadingValueSource("Name3", new Type2(), false) - ); + services.TryAddCascadingValue(_ => new CascadingValueSource( + "Name1", + new Type1(), + false + )); + services.TryAddCascadingValue(_ => new CascadingValueSource( + "Name2", + new Type1(), + false + )); + services.TryAddCascadingValue(_ => new CascadingValueSource( + "Name3", + new Type2(), + false + )); // Assert Assert.Equal(2, services.Count()); @@ -1023,8 +1029,8 @@ in CascadingParameterInfo parameterInfo private static T FindComponent(CapturedBatch batch, out int componentId) { - var componentFrame = batch.ReferenceFrames.Single( - frame => frame.FrameType == RenderTreeFrameType.Component && frame.Component is T + var componentFrame = batch.ReferenceFrames.Single(frame => + frame.FrameType == RenderTreeFrameType.Component && frame.Component is T ); componentId = componentFrame.ComponentId; return (T)componentFrame.Component; diff --git a/aspnetcore/src/Components/Components/test/Routing/RouterTest.cs b/aspnetcore/src/Components/Components/test/Routing/RouterTest.cs index 982e2221a3c..7e2490614de 100644 --- a/aspnetcore/src/Components/Components/test/Routing/RouterTest.cs +++ b/aspnetcore/src/Components/Components/test/Routing/RouterTest.cs @@ -310,8 +310,9 @@ public void NotifyLocationChanged(string uri, bool intercepted, string state = n internal sealed class TestNavigationInterception : INavigationInterception { - public static readonly TestNavigationInterception Instance = - new TestNavigationInterception(); + public static readonly TestNavigationInterception Instance = new TestNavigationInterception( + + ); public Task EnableNavigationInterceptionAsync() { diff --git a/aspnetcore/src/Components/Endpoints/src/Builder/RazorComponentsEndpointRouteBuilderExtensions.cs b/aspnetcore/src/Components/Endpoints/src/Builder/RazorComponentsEndpointRouteBuilderExtensions.cs index 35d9af6159e..d6715e64242 100644 --- a/aspnetcore/src/Components/Endpoints/src/Builder/RazorComponentsEndpointRouteBuilderExtensions.cs +++ b/aspnetcore/src/Components/Endpoints/src/Builder/RazorComponentsEndpointRouteBuilderExtensions.cs @@ -49,15 +49,14 @@ private static void AddBlazorWebJsEndpoint(IEndpointRouteBuilder endpoints) }; var app = endpoints.CreateApplicationBuilder(); - app.Use( - next => - context => - { - // Set endpoint to null so the static files middleware will handle the request. - context.SetEndpoint(null); + app.Use(next => + context => + { + // Set endpoint to null so the static files middleware will handle the request. + context.SetEndpoint(null); - return next(context); - } + return next(context); + } ); app.UseStaticFiles(options); @@ -89,7 +88,9 @@ private static RazorComponentEndpointDataSource GetOrCreateDataS // sources, once we figure out the exact scenarios for // https://github.com/dotnet/aspnetcore/issues/46992 var factory = - endpoints.ServiceProvider.GetRequiredService(); + endpoints.ServiceProvider.GetRequiredService( + + ); dataSource = factory.CreateDataSource(endpoints); endpoints.DataSources.Add(dataSource); } diff --git a/aspnetcore/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.PrerenderingState.cs b/aspnetcore/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.PrerenderingState.cs index 699f92c7d35..ffa4a76a574 100644 --- a/aspnetcore/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.PrerenderingState.cs +++ b/aspnetcore/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.PrerenderingState.cs @@ -47,7 +47,9 @@ public async ValueTask PrerenderPersistedStateAsync(HttpContext ht { InteractiveServerRenderMode => new ProtectedPrerenderComponentApplicationStore( - _httpContext.RequestServices.GetRequiredService() + _httpContext.RequestServices.GetRequiredService( + + ) ), InteractiveWebAssemblyRenderMode => new PrerenderComponentApplicationStore(), _ => throw new InvalidOperationException("Invalid configured render mode."), diff --git a/aspnetcore/src/Components/Endpoints/test/Binding/FormDataMapperTests.cs b/aspnetcore/src/Components/Endpoints/test/Binding/FormDataMapperTests.cs index a6b470b1d36..efd9248453b 100644 --- a/aspnetcore/src/Components/Endpoints/test/Binding/FormDataMapperTests.cs +++ b/aspnetcore/src/Components/Endpoints/test/Binding/FormDataMapperTests.cs @@ -501,13 +501,10 @@ public void Deserialize_Collections_HandlesComputedIndexesBoundaryCorrectly(int var data = new Dictionary( Enumerable .Range(0, size) - .Select( - i => - new KeyValuePair( - $"[{i.ToString(CultureInfo.InvariantCulture)}]", - (i + 10).ToString(CultureInfo.InvariantCulture) - ) - ) + .Select(i => new KeyValuePair( + $"[{i.ToString(CultureInfo.InvariantCulture)}]", + (i + 10).ToString(CultureInfo.InvariantCulture) + )) ); var reader = CreateFormDataReader(data, CultureInfo.InvariantCulture); @@ -536,13 +533,10 @@ public void Deserialize_Collections_PoolsArraysCorrectly(int size) var data = new Dictionary( Enumerable .Range(0, size) - .Select( - i => - new KeyValuePair( - $"[{i.ToString(CultureInfo.InvariantCulture)}]", - (i + 10).ToString(CultureInfo.InvariantCulture) - ) - ) + .Select(i => new KeyValuePair( + $"[{i.ToString(CultureInfo.InvariantCulture)}]", + (i + 10).ToString(CultureInfo.InvariantCulture) + )) ); var reader = CreateFormDataReader(data, CultureInfo.InvariantCulture); @@ -587,13 +581,10 @@ public void Deserialize_Collections_AlwaysReturnsBuffer(int size) var data = new Dictionary( Enumerable .Range(0, size) - .Select( - i => - new KeyValuePair( - $"[{i.ToString(CultureInfo.InvariantCulture)}]", - (i + 10).ToString(CultureInfo.InvariantCulture) - ) - ) + .Select(i => new KeyValuePair( + $"[{i.ToString(CultureInfo.InvariantCulture)}]", + (i + 10).ToString(CultureInfo.InvariantCulture) + )) ); var reader = CreateFormDataReader(data, CultureInfo.InvariantCulture); @@ -661,13 +652,10 @@ public void Deserialize_Collections_RespectsMaxCollectionSize(int size, int maxC var data = new Dictionary( Enumerable .Range(0, size) - .Select( - i => - new KeyValuePair( - $"[{i.ToString(CultureInfo.InvariantCulture)}]", - (i + 10).ToString(CultureInfo.InvariantCulture) - ) - ) + .Select(i => new KeyValuePair( + $"[{i.ToString(CultureInfo.InvariantCulture)}]", + (i + 10).ToString(CultureInfo.InvariantCulture) + )) ); var reader = CreateFormDataReader(data, CultureInfo.InvariantCulture); @@ -1338,13 +1326,10 @@ public void Deserialize_Dictionary_RespectsMaxCollectionSize(int size, int maxCo var data = new Dictionary( Enumerable .Range(0, size) - .Select( - i => - new KeyValuePair( - $"[{i.ToString(CultureInfo.InvariantCulture)}]", - (i + 10).ToString(CultureInfo.InvariantCulture) - ) - ) + .Select(i => new KeyValuePair( + $"[{i.ToString(CultureInfo.InvariantCulture)}]", + (i + 10).ToString(CultureInfo.InvariantCulture) + )) ); var reader = CreateFormDataReader(data, CultureInfo.InvariantCulture); diff --git a/aspnetcore/src/Components/Endpoints/test/HotReloadServiceTests.cs b/aspnetcore/src/Components/Endpoints/test/HotReloadServiceTests.cs index 078693fe572..dc1966fa4ef 100644 --- a/aspnetcore/src/Components/Endpoints/test/HotReloadServiceTests.cs +++ b/aspnetcore/src/Components/Endpoints/test/HotReloadServiceTests.cs @@ -155,15 +155,12 @@ private ComponentApplicationBuilder CreateBuilder(params Type[] types) "TestAssembly", Array.Empty(), types - .Select( - t => - new ComponentBuilder - { - AssemblyName = "TestAssembly", - ComponentType = t, - RenderMode = t.GetCustomAttribute() - } - ) + .Select(t => new ComponentBuilder + { + AssemblyName = "TestAssembly", + ComponentType = t, + RenderMode = t.GetCustomAttribute() + }) .ToArray() ) ); diff --git a/aspnetcore/src/Components/Endpoints/test/RazorComponentEndpointDataSourceTest.cs b/aspnetcore/src/Components/Endpoints/test/RazorComponentEndpointDataSourceTest.cs index b132de90687..22b112fb30f 100644 --- a/aspnetcore/src/Components/Endpoints/test/RazorComponentEndpointDataSourceTest.cs +++ b/aspnetcore/src/Components/Endpoints/test/RazorComponentEndpointDataSourceTest.cs @@ -213,15 +213,12 @@ private ComponentApplicationBuilder CreateBuilder(params Type[] types) "TestAssembly", Array.Empty(), types - .Select( - t => - new ComponentBuilder - { - AssemblyName = "TestAssembly", - ComponentType = t, - RenderMode = t.GetCustomAttribute() - } - ) + .Select(t => new ComponentBuilder + { + AssemblyName = "TestAssembly", + ComponentType = t, + RenderMode = t.GetCustomAttribute() + }) .ToArray() ) ); diff --git a/aspnetcore/src/Components/Endpoints/test/RazorComponentResultTest.cs b/aspnetcore/src/Components/Endpoints/test/RazorComponentResultTest.cs index 1a46739f120..d54648598c8 100644 --- a/aspnetcore/src/Components/Endpoints/test/RazorComponentResultTest.cs +++ b/aspnetcore/src/Components/Endpoints/test/RazorComponentResultTest.cs @@ -513,16 +513,16 @@ private static string GetStringContent(MemoryStream stream) public static DefaultHttpContext GetTestHttpContext(string environmentName = null) { - var mockWebHostEnvironment = Mock.Of( - x => x.EnvironmentName == (environmentName ?? Environments.Production) + var mockWebHostEnvironment = Mock.Of(x => + x.EnvironmentName == (environmentName ?? Environments.Production) ); var serviceCollection = new ServiceCollection() .AddAntiforgery() .AddSingleton(new DiagnosticListener("test")) .AddSingleton(mockWebHostEnvironment) .AddSingleton() - .AddSingleton( - services => services.GetRequiredService() + .AddSingleton(services => + services.GetRequiredService() ) .AddSingleton() .AddSingleton() @@ -530,8 +530,8 @@ public static DefaultHttpContext GetTestHttpContext(string environmentName = nul .AddSingleton() .AddSingleton() .AddSingleton() - .AddSingleton( - sp => sp.GetRequiredService().State + .AddSingleton(sp => + sp.GetRequiredService().State ) .AddSingleton() .AddLogging(); diff --git a/aspnetcore/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs b/aspnetcore/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs index 8c25288e686..7716527acb8 100644 --- a/aspnetcore/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs +++ b/aspnetcore/src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/Infrastructure/AsyncQueryExecutorSupplier.cs @@ -74,12 +74,11 @@ Type queryableProviderType ) => queryableProviderType .GetInterfaces() - .Any( - x => - string.Equals( - x.FullName, - "Microsoft.EntityFrameworkCore.Query.IAsyncQueryProvider", - StringComparison.Ordinal - ) + .Any(x => + string.Equals( + x.FullName, + "Microsoft.EntityFrameworkCore.Query.IAsyncQueryProvider", + StringComparison.Ordinal + ) ) == true; } diff --git a/aspnetcore/src/Components/Samples/BlazorServerApp/Data/WeatherForecastService.cs b/aspnetcore/src/Components/Samples/BlazorServerApp/Data/WeatherForecastService.cs index eb331945dac..b320feb254f 100644 --- a/aspnetcore/src/Components/Samples/BlazorServerApp/Data/WeatherForecastService.cs +++ b/aspnetcore/src/Components/Samples/BlazorServerApp/Data/WeatherForecastService.cs @@ -24,15 +24,12 @@ public Task GetForecastAsync(DateTime startDate) return Task.FromResult( Enumerable .Range(1, 5) - .Select( - index => - new WeatherForecast - { - Date = startDate.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - } - ) + .Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) .ToArray() ); } diff --git a/aspnetcore/src/Components/Server/src/Circuits/CircuitHost.cs b/aspnetcore/src/Components/Server/src/Circuits/CircuitHost.cs index ad26933cf62..d04ffaae266 100644 --- a/aspnetcore/src/Components/Server/src/Circuits/CircuitHost.cs +++ b/aspnetcore/src/Components/Server/src/Circuits/CircuitHost.cs @@ -950,7 +950,9 @@ CancellationToken cancellation // We only do this if we have no root components. Otherwise, the state would have been // provided during the start up process var appLifetime = - _scope.ServiceProvider.GetRequiredService(); + _scope.ServiceProvider.GetRequiredService( + + ); await appLifetime.RestoreStateAsync(store); } diff --git a/aspnetcore/src/Components/Server/test/Circuits/CircuitClientProxyTest.cs b/aspnetcore/src/Components/Server/test/Circuits/CircuitClientProxyTest.cs index df8bcf833e9..7aeb930d77b 100644 --- a/aspnetcore/src/Components/Server/test/Circuits/CircuitClientProxyTest.cs +++ b/aspnetcore/src/Components/Server/test/Circuits/CircuitClientProxyTest.cs @@ -15,13 +15,12 @@ public async Task SendCoreAsync_WithoutTransfer() bool? isCancelled = null; var clientProxy = new Mock(); clientProxy - .Setup( - c => - c.SendCoreAsync( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(c => + c.SendCoreAsync( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string _, object[] __, CancellationToken token) => @@ -44,13 +43,9 @@ public async Task SendCoreAsync_WithoutTransfer() public void Transfer_SetsConnected() { // Arrange - var clientProxy = Mock.Of( - c => - c.SendCoreAsync( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) == Task.CompletedTask + var clientProxy = Mock.Of(c => + c.SendCoreAsync(It.IsAny(), It.IsAny(), It.IsAny()) + == Task.CompletedTask ); var circuitClient = new CircuitClientProxy(clientProxy, "connection0"); circuitClient.SetDisconnected(); diff --git a/aspnetcore/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormServiceCollectionExtensions.cs b/aspnetcore/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormServiceCollectionExtensions.cs index 0b53130eeca..5421c848c43 100644 --- a/aspnetcore/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormServiceCollectionExtensions.cs +++ b/aspnetcore/src/Components/Web/src/Forms/Mapping/SupplyParameterFromFormServiceCollectionExtensions.cs @@ -21,16 +21,15 @@ this IServiceCollection serviceCollection ) { serviceCollection.TryAddEnumerable( - ServiceDescriptor.Scoped< - ICascadingValueSupplier, - SupplyParameterFromFormValueProvider - >(services => - { - return new SupplyParameterFromFormValueProvider( - services.GetRequiredService(), - mappingScopeName: "" - ); - }) + ServiceDescriptor.Scoped( + services => + { + return new SupplyParameterFromFormValueProvider( + services.GetRequiredService(), + mappingScopeName: "" + ); + } + ) ); return serviceCollection; diff --git a/aspnetcore/src/Components/Web/src/JSComponents/JSComponentInterop.cs b/aspnetcore/src/Components/Web/src/JSComponents/JSComponentInterop.cs index 57515a8ac7b..937c2b9b8d1 100644 --- a/aspnetcore/src/Components/Web/src/JSComponents/JSComponentInterop.cs +++ b/aspnetcore/src/Components/Web/src/JSComponents/JSComponentInterop.cs @@ -226,8 +226,8 @@ private static object CreateEventCallbackWithSingleParameter( { var callback = jsObjectReference is null ? null - : new Func( - value => jsObjectReference.InvokeVoidAsync(JSFunctionPropertyName, value).AsTask() + : new Func(value => + jsObjectReference.InvokeVoidAsync(JSFunctionPropertyName, value).AsTask() ); return Activator.CreateInstance(eventCallbackType, null, callback)!; } diff --git a/aspnetcore/src/Components/Web/test/Forms/EditFormTest.cs b/aspnetcore/src/Components/Web/test/Forms/EditFormTest.cs index cf4cb64ebde..85a08e46580 100644 --- a/aspnetcore/src/Components/Web/test/Forms/EditFormTest.cs +++ b/aspnetcore/src/Components/Web/test/Forms/EditFormTest.cs @@ -21,8 +21,8 @@ public EditFormTest() services.AddAntiforgery(); services.AddLogging(); services.AddSingleton(); - services.AddSingleton( - services => services.GetRequiredService().State + services.AddSingleton(services => + services.GetRequiredService().State ); services.AddSingleton(); _testRenderer = new(services.BuildServiceProvider()); diff --git a/aspnetcore/src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Client/Program.cs b/aspnetcore/src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Client/Program.cs index 4cb30e0ebff..4e469e4622d 100644 --- a/aspnetcore/src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Client/Program.cs +++ b/aspnetcore/src/Components/WebAssembly/Samples/HostedBlazorWebassemblyApp/Client/Program.cs @@ -21,9 +21,10 @@ public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); - builder.Services.AddScoped( - sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) } - ); + builder.Services.AddScoped(sp => new HttpClient + { + BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) + }); builder.Services.AddScoped(); await builder.Build().RunAsync(); diff --git a/aspnetcore/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs b/aspnetcore/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs index c64946cd59f..f8965c9d9f0 100644 --- a/aspnetcore/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs +++ b/aspnetcore/src/Components/WebAssembly/WebAssembly.Authentication/src/WebAssemblyAuthenticationServiceCollectionExtensions.cs @@ -78,10 +78,9 @@ private static void AddAuthenticationStateProvider< >(IServiceCollection services) where TRemoteAuthenticationState : RemoteAuthenticationState { - services.TryAddScoped( - static sp => - (IRemoteAuthenticationService) - sp.GetRequiredService() + services.TryAddScoped(static sp => + (IRemoteAuthenticationService) + sp.GetRequiredService() ); } diff --git a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs index 72896b0fa79..3a23cdae853 100644 --- a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs +++ b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Hosting/WebAssemblyHostBuilder.cs @@ -197,8 +197,8 @@ private WebAssemblyHostEnvironment InitializeEnvironment(IInternalJSImportMethod // Perf: Using this over AddJsonStream. This allows the linker to trim out the "File"-specific APIs and assemblies // for Configuration, of where there are several. - Configuration.Add( - s => s.Stream = new MemoryStream(appSettingsJson) + Configuration.Add(s => + s.Stream = new MemoryStream(appSettingsJson) ); } } @@ -294,8 +294,8 @@ internal void InitializeDefaultServices() Services.AddSingleton(new LazyAssemblyLoader(DefaultWebAssemblyJSRuntime.Instance)); Services.AddSingleton(_ => _rootComponentCache ?? new()); Services.AddSingleton(); - Services.AddSingleton( - sp => sp.GetRequiredService().State + Services.AddSingleton(sp => + sp.GetRequiredService().State ); Services.AddSingleton(); Services.AddSingleton(); diff --git a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs index 6dcca1b2258..e7277f82bec 100644 --- a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs +++ b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/HotReload/HotReloadAgent.cs @@ -285,9 +285,8 @@ private static Type[] GetMetadataUpdateTypes(IReadOnlyList deltas) { var assembly = AppDomain .CurrentDomain.GetAssemblies() - .FirstOrDefault( - assembly => - TryGetModuleId(assembly) is Guid moduleId && moduleId == delta.ModuleId + .FirstOrDefault(assembly => + TryGetModuleId(assembly) is Guid moduleId && moduleId == delta.ModuleId ); if (assembly is null) { diff --git a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs index 564d25d73b1..21bb2efc4fe 100644 --- a/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs +++ b/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Services/LazyAssemblyLoader.cs @@ -90,8 +90,8 @@ IEnumerable assembliesToLoad } var assemblyName = Path.GetFileNameWithoutExtension(newAssembliesToLoad[i]); - var assembly = AssemblyLoadContext.Default.Assemblies.FirstOrDefault( - a => a.GetName().Name == assemblyName + var assembly = AssemblyLoadContext.Default.Assemblies.FirstOrDefault(a => + a.GetName().Name == assemblyName ); if (assembly != null) { diff --git a/aspnetcore/src/Components/WebView/WebView/test/StaticContentProviderTests.cs b/aspnetcore/src/Components/WebView/WebView/test/StaticContentProviderTests.cs index 53ba1f5fdd1..3c363143c03 100644 --- a/aspnetcore/src/Components/WebView/WebView/test/StaticContentProviderTests.cs +++ b/aspnetcore/src/Components/WebView/WebView/test/StaticContentProviderTests.cs @@ -96,8 +96,8 @@ string subPath public IEnumerator GetEnumerator() { return _inMemoryFileProvider - .FilePathsAndContents.Where( - kvp => kvp.Key.StartsWith(_subPath, StringComparison.Ordinal) + .FilePathsAndContents.Where(kvp => + kvp.Key.StartsWith(_subPath, StringComparison.Ordinal) ) .Select(x => new InMemoryFileInfo(x.Key, x.Value)) .GetEnumerator(); diff --git a/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/BenchmarkResultsStartup.cs b/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/BenchmarkResultsStartup.cs index 888f009cfd0..98650d0cc20 100644 --- a/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/BenchmarkResultsStartup.cs +++ b/aspnetcore/src/Components/benchmarkapps/Wasm.Performance/Driver/BenchmarkResultsStartup.cs @@ -9,11 +9,9 @@ public class BenchmarkDriverStartup { public void ConfigureServices(IServiceCollection services) { - services.AddCors( - c => - c.AddDefaultPolicy( - builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin() - ) + services.AddCors(c => + c.AddDefaultPolicy(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin() + ) ); } diff --git a/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/MultipleRootComponentsTest.cs b/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/MultipleRootComponentsTest.cs index 8735f4ffbad..eee63e4af4c 100644 --- a/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/MultipleRootComponentsTest.cs +++ b/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/MultipleRootComponentsTest.cs @@ -52,8 +52,8 @@ public void DoesNotStartMultipleConnections() var logs = Browser.Manage().Logs.GetLog(LogType.Browser).ToArray(); var curatedLogs = logs.Where(l => l.Timestamp > LastLogTimeStamp); - return curatedLogs.Count( - e => e.Message.Contains("Starting up Blazor server-side application") + return curatedLogs.Count(e => + e.Message.Contains("Starting up Blazor server-side application") ) == 1; }); } @@ -120,12 +120,11 @@ public void CanRenderMultipleRootComponents() { content = content.Replace("\r\n", ""); var matches = Regex.Matches(content, MarkerPattern); - var markers = matches.Select( - s => - JsonSerializer.Deserialize( - s.Groups[1].Value, - ServerComponentSerializationSettings.JsonSerializationOptions - ) + var markers = matches.Select(s => + JsonSerializer.Deserialize( + s.Groups[1].Value, + ServerComponentSerializationSettings.JsonSerializationOptions + ) ); var prerenderMarkers = markers diff --git a/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/ServerReconnectionTest.cs b/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/ServerReconnectionTest.cs index 077e44ec04a..e18ae01dcb7 100644 --- a/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/ServerReconnectionTest.cs +++ b/aspnetcore/src/Components/test/E2ETest/ServerExecutionTests/ServerReconnectionTest.cs @@ -94,10 +94,8 @@ public void ErrorsStopTheRenderingProcess() Browser .Manage() .Logs.GetLog(LogType.Browser) - .Any( - l => - l.Level == LogLevel.Info - && l.Message.Contains("Connection disconnected.") + .Any(l => + l.Level == LogLevel.Info && l.Message.Contains("Connection disconnected.") ) ); } diff --git a/aspnetcore/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs b/aspnetcore/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs index 925f4b1c46b..2817d6d176a 100644 --- a/aspnetcore/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs +++ b/aspnetcore/src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs @@ -43,21 +43,20 @@ public void CachesResourcesAfterFirstLoad() WaitUntilLoaded(); var initialResourcesRequested = GetAndClearRequestedPaths(); Assert.NotEmpty( - initialResourcesRequested.Where( - path => path.EndsWith("/blazor.boot.json", StringComparison.Ordinal) + initialResourcesRequested.Where(path => + path.EndsWith("/blazor.boot.json", StringComparison.Ordinal) ) ); Assert.NotEmpty( - initialResourcesRequested.Where( - path => path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) + initialResourcesRequested.Where(path => + path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) ) ); Assert.NotEmpty( initialResourcesRequested.Where(path => path.EndsWith(".js", StringComparison.Ordinal)) ); Assert.NotEmpty( - initialResourcesRequested.Where( - path => path.EndsWith(".wasm", StringComparison.Ordinal) + initialResourcesRequested.Where(path => path.EndsWith(".wasm", StringComparison.Ordinal) ) ); @@ -69,25 +68,24 @@ public void CachesResourcesAfterFirstLoad() WaitUntilLoaded(); var subsequentResourcesRequested = GetAndClearRequestedPaths(); Assert.NotEmpty( - initialResourcesRequested.Where( - path => path.EndsWith("/blazor.boot.json", StringComparison.Ordinal) + initialResourcesRequested.Where(path => + path.EndsWith("/blazor.boot.json", StringComparison.Ordinal) ) ); Assert.Empty( - subsequentResourcesRequested.Where( - path => path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) + subsequentResourcesRequested.Where(path => + path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) ) ); Assert.NotEmpty( - subsequentResourcesRequested.Where( - path => path.EndsWith(".js", StringComparison.Ordinal) + subsequentResourcesRequested.Where(path => + path.EndsWith(".js", StringComparison.Ordinal) ) ); Assert.Empty( - subsequentResourcesRequested.Where( - path => - path.EndsWith(".wasm", StringComparison.Ordinal) - && !path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) + subsequentResourcesRequested.Where(path => + path.EndsWith(".wasm", StringComparison.Ordinal) + && !path.EndsWith("/dotnet.native.wasm", StringComparison.Ordinal) ) ); } @@ -99,11 +97,11 @@ public async Task IncrementallyUpdatesCache() Navigate("/"); WaitUntilLoaded(); var cacheEntryUrls1 = GetCacheEntryUrls(); - var cacheEntryForComponentsDll = cacheEntryUrls1.Single( - url => url.Contains("/Microsoft.AspNetCore.Components.wasm") + var cacheEntryForComponentsDll = cacheEntryUrls1.Single(url => + url.Contains("/Microsoft.AspNetCore.Components.wasm") ); - var cacheEntryForDotNetWasm = cacheEntryUrls1.Single( - url => url.Contains("/dotnet.native.wasm") + var cacheEntryForDotNetWasm = cacheEntryUrls1.Single(url => + url.Contains("/dotnet.native.wasm") ); var cacheEntryForDotNetWasmWithChangedHash = cacheEntryForDotNetWasm.Replace( ".sha256-", diff --git a/aspnetcore/src/Components/test/E2ETest/Tests/KeyTest.cs b/aspnetcore/src/Components/test/E2ETest/Tests/KeyTest.cs index c82623a1dea..18b824105ee 100644 --- a/aspnetcore/src/Components/test/E2ETest/Tests/KeyTest.cs +++ b/aspnetcore/src/Components/test/E2ETest/Tests/KeyTest.cs @@ -357,12 +357,11 @@ bool validatePreservation Assert.Collection( actualRootNode.Children, expectedRootNode - .Children.Select>( - expectedChild => - ( - actualChild => - AssertNodesEqual(expectedChild, actualChild, validatePreservation) - ) + .Children.Select>(expectedChild => + ( + actualChild => + AssertNodesEqual(expectedChild, actualChild, validatePreservation) + ) ) .ToArray() ); diff --git a/aspnetcore/src/Components/test/testassets/BasicTestApp/Program.cs b/aspnetcore/src/Components/test/testassets/BasicTestApp/Program.cs index 12cade14171..b08c70fa317 100644 --- a/aspnetcore/src/Components/test/testassets/BasicTestApp/Program.cs +++ b/aspnetcore/src/Components/test/testassets/BasicTestApp/Program.cs @@ -64,11 +64,10 @@ public static async Task Main(string[] args) builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging")); builder.Logging.Services.AddSingleton( - s => - new PrependMessageLoggerProvider( - builder.Configuration["Logging:PrependMessage:Message"], - s.GetService() - ) + s => new PrependMessageLoggerProvider( + builder.Configuration["Logging:PrependMessage:Message"], + s.GetService() + ) ); var host = builder.Build(); diff --git a/aspnetcore/src/Components/test/testassets/Components.TestServer/CorsStartup.cs b/aspnetcore/src/Components/test/testassets/Components.TestServer/CorsStartup.cs index 63102945ac3..0c9deacacf4 100644 --- a/aspnetcore/src/Components/test/testassets/Components.TestServer/CorsStartup.cs +++ b/aspnetcore/src/Components/test/testassets/Components.TestServer/CorsStartup.cs @@ -29,10 +29,9 @@ public void ConfigureServices(IServiceCollection services) "AllowAll", policy => policy - .SetIsOriginAllowed( - host => - host.StartsWith("http://localhost:", StringComparison.Ordinal) - || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal) + .SetIsOriginAllowed(host => + host.StartsWith("http://localhost:", StringComparison.Ordinal) + || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal) ) .AllowAnyHeader() .WithExposedHeaders("MyCustomHeader") diff --git a/aspnetcore/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs b/aspnetcore/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs index 9d38fad9d51..d68a391b351 100644 --- a/aspnetcore/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs +++ b/aspnetcore/src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs @@ -69,8 +69,8 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) .MapRazorComponents() .AddAdditionalAssemblies(Assembly.Load("Components.WasmMinimal")) .AddInteractiveServerRenderMode() - .AddInteractiveWebAssemblyRenderMode( - options => options.PathPrefix = "/WasmMinimal" + .AddInteractiveWebAssemblyRenderMode(options => + options.PathPrefix = "/WasmMinimal" ); NotEnabledStreamingRenderingComponent.MapEndpoints(endpoints); diff --git a/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/DefaultKeyResolver.cs b/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/DefaultKeyResolver.cs index fc53ba14606..02686fc18d9 100644 --- a/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/DefaultKeyResolver.cs +++ b/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/DefaultKeyResolver.cs @@ -119,12 +119,11 @@ select key // to the preferred default key's expiration date (allowing for skew) and that it will // remain valid one propagation cycle from now? If so, the caller doesn't need to add a // new key. - callerShouldGenerateNewKey = !allKeys.Any( - key => - key.ActivationDate - <= (preferredDefaultKey.ExpirationDate + _maxServerToServerClockSkew) - && !key.IsExpired(now + _keyPropagationWindow) - && !key.IsRevoked + callerShouldGenerateNewKey = !allKeys.Any(key => + key.ActivationDate + <= (preferredDefaultKey.ExpirationDate + _maxServerToServerClockSkew) + && !key.IsExpired(now + _keyPropagationWindow) + && !key.IsRevoked ); if (callerShouldGenerateNewKey) diff --git a/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs b/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs index 03cada4ebc0..ea98ed26d93 100644 --- a/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs +++ b/aspnetcore/src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs @@ -615,8 +615,9 @@ void IInternalXmlKeyManager.RevokeSingleKey( IXmlEncryptor? encryptor = null; // If we're running in Azure Web Sites, the key repository goes in the %HOME% directory. - var azureWebSitesKeysFolder = - _keyStorageDirectories.GetKeyStorageDirectoryForAzureWebSites(); + var azureWebSitesKeysFolder = _keyStorageDirectories.GetKeyStorageDirectoryForAzureWebSites( + + ); if (azureWebSitesKeysFolder != null) { _logger.UsingAzureAsKeyRepository(azureWebSitesKeysFolder.FullName); @@ -638,7 +639,9 @@ void IInternalXmlKeyManager.RevokeSingleKey( // If the user profile is available, we can protect using DPAPI. // Probe to see if protecting to local user is available, and use it as the default if so. encryptor = new DpapiXmlEncryptor( - protectToLocalMachine: !DpapiSecretSerializerHelper.CanProtectToCurrentUserAccount(), + protectToLocalMachine: !DpapiSecretSerializerHelper.CanProtectToCurrentUserAccount( + + ), loggerFactory: _loggerFactory ); } diff --git a/aspnetcore/src/DataProtection/DataProtection/src/Repositories/FileSystemXmlRepository.cs b/aspnetcore/src/DataProtection/DataProtection/src/Repositories/FileSystemXmlRepository.cs index e234caae8d0..9ac9c741021 100644 --- a/aspnetcore/src/DataProtection/DataProtection/src/Repositories/FileSystemXmlRepository.cs +++ b/aspnetcore/src/DataProtection/DataProtection/src/Repositories/FileSystemXmlRepository.cs @@ -98,13 +98,12 @@ private static bool IsSafeFilename(string filename) // Must be non-empty and contain only a-zA-Z0-9, hyphen, and underscore. return ( !String.IsNullOrEmpty(filename) - && filename.All( - c => - c == '-' - || c == '_' - || ('0' <= c && c <= '9') - || ('A' <= c && c <= 'Z') - || ('a' <= c && c <= 'z') + && filename.All(c => + c == '-' + || c == '_' + || ('0' <= c && c <= '9') + || ('A' <= c && c <= 'Z') + || ('a' <= c && c <= 'z') ) ); } diff --git a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs index 319a313b3db..e3bd204d313 100644 --- a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs +++ b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/CngCbcAuthenticatedEncryptorDescriptorDeserializerTests.cs @@ -39,10 +39,9 @@ public void ImportFromXml_CreatesAppropriateDescriptor() {masterKey} "; - var deserializedDescriptor = - new CngCbcAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml( - XElement.Parse(xml) - ); + var deserializedDescriptor = new CngCbcAuthenticatedEncryptorDescriptorDeserializer( + + ).ImportFromXml(XElement.Parse(xml)); var test = CreateEncryptorInstanceFromDescriptor( deserializedDescriptor as CngCbcAuthenticatedEncryptorDescriptor ); diff --git a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs index 678f4406ce8..8a6e0fbe220 100644 --- a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs +++ b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorDescriptorDeserializerTests.cs @@ -43,10 +43,9 @@ Type validationAlgorithmType {masterKey} "; - var deserializedDescriptor = - new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml( - XElement.Parse(xml) - ); + var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer( + + ).ImportFromXml(XElement.Parse(xml)); var test = CreateEncryptorInstanceFromDescriptor( deserializedDescriptor as ManagedAuthenticatedEncryptorDescriptor ); @@ -90,10 +89,9 @@ public void ImportFromXml_FullyQualifiedBuiltInTypes_CreatesAppropriateDescripto {masterKey} "; - var deserializedDescriptor = - new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml( - XElement.Parse(xml) - ); + var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer( + + ).ImportFromXml(XElement.Parse(xml)); var test = CreateEncryptorInstanceFromDescriptor( deserializedDescriptor as ManagedAuthenticatedEncryptorDescriptor ); @@ -129,10 +127,9 @@ public void ImportFromXml_CustomType_CreatesAppropriateDescriptor() "; // Act - var deserializedDescriptor = - new ManagedAuthenticatedEncryptorDescriptorDeserializer().ImportFromXml( - XElement.Parse(xml) - ); + var deserializedDescriptor = new ManagedAuthenticatedEncryptorDescriptorDeserializer( + + ).ImportFromXml(XElement.Parse(xml)); var managedDescriptor = (ManagedAuthenticatedEncryptorDescriptor)deserializedDescriptor; // Assert diff --git a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/HostingTests.cs b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/HostingTests.cs index 1f34037252b..2d13e919859 100644 --- a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/HostingTests.cs +++ b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/HostingTests.cs @@ -28,20 +28,19 @@ public async Task WebhostLoadsKeyRingBeforeServerStarts() var builder = new WebHostBuilder() .UseStartup() - .ConfigureServices( - s => - s.AddDataProtection() - .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) - .AddSingleton( - new FakeServer( - onStart: () => - tcs.TrySetException( - new InvalidOperationException( - "Server was started before key ring was initialized" - ) + .ConfigureServices(s => + s.AddDataProtection() + .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) + .AddSingleton( + new FakeServer( + onStart: () => + tcs.TrySetException( + new InvalidOperationException( + "Server was started before key ring was initialized" ) - ) + ) ) + ) ); using (var host = builder.Build()) @@ -64,20 +63,19 @@ public async Task GenericHostLoadsKeyRingBeforeServerStarts() .Callback(() => tcs.TrySetResult()); var builder = new HostBuilder() - .ConfigureServices( - s => - s.AddDataProtection() - .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) - .AddSingleton( - new FakeServer( - onStart: () => - tcs.TrySetException( - new InvalidOperationException( - "Server was started before key ring was initialized" - ) + .ConfigureServices(s => + s.AddDataProtection() + .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) + .AddSingleton( + new FakeServer( + onStart: () => + tcs.TrySetException( + new InvalidOperationException( + "Server was started before key ring was initialized" ) - ) + ) ) + ) ) .ConfigureWebHost(b => b.UseStartup()); @@ -107,11 +105,10 @@ public async Task StartupContinuesOnFailureToLoadKey() mockServer.Setup(m => m.Features).Returns(new FeatureCollection()); var builder = new HostBuilder() - .ConfigureServices( - s => - s.AddDataProtection() - .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) - .AddSingleton(mockServer.Object) + .ConfigureServices(s => + s.AddDataProtection() + .Services.Replace(ServiceDescriptor.Singleton(mockKeyRing.Object)) + .AddSingleton(mockServer.Object) ) .ConfigureWebHost(b => b.UseStartup()); diff --git a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/KeyManagement/XmlKeyManagerTests.cs b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/KeyManagement/XmlKeyManagerTests.cs index da4554419cd..c204d520010 100644 --- a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/KeyManagement/XmlKeyManagerTests.cs +++ b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/KeyManagement/XmlKeyManagerTests.cs @@ -349,14 +349,13 @@ public void CreateNewKey_CallsInternalManager() DateTimeOffset expirationDate = activationDate.AddMonths(1); var mockInternalKeyManager = new Mock(); mockInternalKeyManager - .Setup( - o => - o.CreateNewKey( - It.IsAny(), - It.IsAny(), - activationDate, - expirationDate - ) + .Setup(o => + o.CreateNewKey( + It.IsAny(), + It.IsAny(), + activationDate, + expirationDate + ) ) .Callback( (innerKeyId, innerCreationDate, innerActivationDate, innerExpirationDate) => @@ -864,13 +863,12 @@ public void RevokeKey_CallsInternalManager() DateTimeOffset? actualRevocationDate = null; var mockInternalKeyManager = new Mock(); mockInternalKeyManager - .Setup( - o => - o.RevokeSingleKey( - keyToRevoke, - It.IsAny(), - "Here's some reason text." - ) + .Setup(o => + o.RevokeSingleKey( + keyToRevoke, + It.IsAny(), + "Here's some reason text." + ) ) .Callback( (innerKeyId, innerRevocationDate, innerReason) => diff --git a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/RegistryPolicyResolverTests.cs b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/RegistryPolicyResolverTests.cs index 27b9f273c56..9438376bbbd 100644 --- a/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/RegistryPolicyResolverTests.cs +++ b/aspnetcore/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests/RegistryPolicyResolverTests.cs @@ -38,8 +38,8 @@ public void ResolvePolicy_KeyEscrowSinks() { ["KeyEscrowSinks"] = String.Join( " ;; ; ", - new Type[] { typeof(MyKeyEscrowSink1), typeof(MyKeyEscrowSink2) }.Select( - t => t.AssemblyQualifiedName + new Type[] { typeof(MyKeyEscrowSink1), typeof(MyKeyEscrowSink2) }.Select(t => + t.AssemblyQualifiedName ) ) }; diff --git a/aspnetcore/src/DataProtection/Extensions/test/DataProtectionProviderTests.cs b/aspnetcore/src/DataProtection/Extensions/test/DataProtectionProviderTests.cs index ac3e75a8cee..86d64450ad4 100644 --- a/aspnetcore/src/DataProtection/Extensions/test/DataProtectionProviderTests.cs +++ b/aspnetcore/src/DataProtection/Extensions/test/DataProtectionProviderTests.cs @@ -62,15 +62,12 @@ public void System_NoKeysDirectoryProvided_UsesDefaultKeysDirectory() setupAction: builder => { builder.SetApplicationName("TestApplication"); - builder.Services.AddSingleton( - s => - new XmlKeyManager( - s.GetRequiredService>(), - s.GetRequiredService(), - NullLoggerFactory.Instance, - mock.Object - ) - ); + builder.Services.AddSingleton(s => new XmlKeyManager( + s.GetRequiredService>(), + s.GetRequiredService(), + NullLoggerFactory.Instance, + mock.Object + )); } ); diff --git a/aspnetcore/src/DefaultBuilder/samples/SampleApp/Program.cs b/aspnetcore/src/DefaultBuilder/samples/SampleApp/Program.cs index 34e5553a456..cb10198fef4 100644 --- a/aspnetcore/src/DefaultBuilder/samples/SampleApp/Program.cs +++ b/aspnetcore/src/DefaultBuilder/samples/SampleApp/Program.cs @@ -51,28 +51,27 @@ private static void CustomRouter() { // Using a router using ( - WebHost.Start( - router => - router - .MapGet( - "hello/{name}", - (req, res, data) => res.WriteAsync($"Hello, {data.Values["name"]}") - ) - .MapGet( - "goodbye/{name}", - (req, res, data) => res.WriteAsync($"Goodbye, {data.Values["name"]}") - ) - .MapGet( - "throw/{message?}", - (req, res, data) => - throw new Exception((string)data.Values["message"] ?? "Uh oh!") - ) - .MapGet( - "{greeting}/{name}", - (req, res, data) => - res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}") - ) - .MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!")) + WebHost.Start(router => + router + .MapGet( + "hello/{name}", + (req, res, data) => res.WriteAsync($"Hello, {data.Values["name"]}") + ) + .MapGet( + "goodbye/{name}", + (req, res, data) => res.WriteAsync($"Goodbye, {data.Values["name"]}") + ) + .MapGet( + "throw/{message?}", + (req, res, data) => + throw new Exception((string)data.Values["message"] ?? "Uh oh!") + ) + .MapGet( + "{greeting}/{name}", + (req, res, data) => + res.WriteAsync($"{data.Values["greeting"]}, {data.Values["name"]}") + ) + .MapGet("", (req, res, data) => res.WriteAsync($"Hello, World!")) ) ) { diff --git a/aspnetcore/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs b/aspnetcore/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs index 239afe9d374..509eef36905 100644 --- a/aspnetcore/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs +++ b/aspnetcore/src/DefaultBuilder/test/Microsoft.AspNetCore.Tests/WebApplicationTests.cs @@ -1596,8 +1596,8 @@ CreateBuilderFunc createBuilder // services callbacks using var listener = new HostingListener(hostBuilder => { - hostBuilder.ConfigureAppConfiguration( - config => config.Add(new RandomConfigurationSource()) + hostBuilder.ConfigureAppConfiguration(config => + config.Add(new RandomConfigurationSource()) ); }); @@ -2066,30 +2066,27 @@ CreateBuilderFunc createBuilder var builder = createBuilder(); Assert.Single( - builder.Services.Where( - descriptor => - descriptor.ServiceType == typeof(IConfigureOptions) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IConfigureOptions) ) ); // IWebHostEnvironment is added by ConfigureWebHostDefaults Assert.Single( - builder.Services.Where( - descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IWebHostEnvironment) ) ); Assert.Single( - builder.Services.Where( - descriptor => - descriptor.ServiceType - == typeof(IOptionsChangeTokenSource) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IOptionsChangeTokenSource) ) ); Assert.Single( builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer)) ); Assert.Single( - builder.Services.Where( - descriptor => descriptor.ServiceType == typeof(EndpointDataSource) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(EndpointDataSource) ) ); @@ -2113,31 +2110,28 @@ public void EmptyWebApplicationBuilder_OnlyContainsMinimalServices() var builder = WebApplication.CreateEmptyBuilder(new()); Assert.Empty( - builder.Services.Where( - descriptor => - descriptor.ServiceType == typeof(IConfigureOptions) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IConfigureOptions) ) ); Assert.Empty( - builder.Services.Where( - descriptor => - descriptor.ServiceType - == typeof(IOptionsChangeTokenSource) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IOptionsChangeTokenSource) ) ); Assert.Empty( builder.Services.Where(descriptor => descriptor.ServiceType == typeof(IServer)) ); Assert.Empty( - builder.Services.Where( - descriptor => descriptor.ServiceType == typeof(EndpointDataSource) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(EndpointDataSource) ) ); // These services are still necessary Assert.Single( - builder.Services.Where( - descriptor => descriptor.ServiceType == typeof(IWebHostEnvironment) + builder.Services.Where(descriptor => + descriptor.ServiceType == typeof(IWebHostEnvironment) ) ); } diff --git a/aspnetcore/src/DefaultBuilder/testassets/CreateDefaultBuilderOfTApp/Program.cs b/aspnetcore/src/DefaultBuilder/testassets/CreateDefaultBuilderOfTApp/Program.cs index fe63836d53d..49a3879d422 100644 --- a/aspnetcore/src/DefaultBuilder/testassets/CreateDefaultBuilderOfTApp/Program.cs +++ b/aspnetcore/src/DefaultBuilder/testassets/CreateDefaultBuilderOfTApp/Program.cs @@ -25,54 +25,48 @@ static void Main(string[] args) (context, service) => responseMessage = responseMessage ?? GetResponseMessage(context) ) - .ConfigureKestrel( - options => - options - .Configure(options.ConfigurationLoader.Configuration) - .Endpoint( - "HTTP", - endpointOptions => - { - if ( - responseMessage == null - && !string.Equals( - "KestrelEndPointSettingValue", - endpointOptions.ConfigSection["KestrelEndPointSettingName"] - ) + .ConfigureKestrel(options => + options + .Configure(options.ConfigurationLoader.Configuration) + .Endpoint( + "HTTP", + endpointOptions => + { + if ( + responseMessage == null + && !string.Equals( + "KestrelEndPointSettingValue", + endpointOptions.ConfigSection["KestrelEndPointSettingName"] ) - { - responseMessage = "Default Kestrel configuration not read."; - } + ) + { + responseMessage = "Default Kestrel configuration not read."; } - ) + } + ) ) - .Configure( - app => - app.Run(context => + .Configure(app => + app.Run(context => + { + // Verify allowed hosts were loaded + var hostFilteringOptions = app.ApplicationServices.GetRequiredService< + IOptions + >(); + var hosts = string.Join(',', hostFilteringOptions.Value.AllowedHosts); + if ( + responseMessage == null + && !string.Equals("example.com,127.0.0.1", hosts, StringComparison.Ordinal) + ) { - // Verify allowed hosts were loaded - var hostFilteringOptions = app.ApplicationServices.GetRequiredService< - IOptions - >(); - var hosts = string.Join(',', hostFilteringOptions.Value.AllowedHosts); - if ( - responseMessage == null - && !string.Equals( - "example.com,127.0.0.1", - hosts, - StringComparison.Ordinal - ) - ) - { - responseMessage = "AllowedHosts not loaded into Options."; - } + responseMessage = "AllowedHosts not loaded into Options."; + } - var hostingEnvironment = - app.ApplicationServices.GetRequiredService(); - return context.Response.WriteAsync( - responseMessage ?? hostingEnvironment.ApplicationName - ); - }) + var hostingEnvironment = + app.ApplicationServices.GetRequiredService(); + return context.Response.WriteAsync( + responseMessage ?? hostingEnvironment.ApplicationName + ); + }) ) .Build() .Run(); diff --git a/aspnetcore/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs b/aspnetcore/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs index 8dda36111d2..566d0cedaa7 100644 --- a/aspnetcore/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs +++ b/aspnetcore/src/Features/JsonPatch/src/JsonPatchDocumentOfT.cs @@ -767,8 +767,8 @@ private string GetPropertyNameFromMemberExpression(MemberExpression memberExpres if (jsonObjectContract != null) { return jsonObjectContract - .Properties.First( - jsonProperty => jsonProperty.UnderlyingName == memberExpression.Member.Name + .Properties.First(jsonProperty => + jsonProperty.UnderlyingName == memberExpression.Member.Name ) .PropertyName; } diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/Authorization/AddAuthorizationBuilderAnalyzer.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/Authorization/AddAuthorizationBuilderAnalyzer.cs index ba3a7460259..b2709d5cef9 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/Authorization/AddAuthorizationBuilderAnalyzer.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/Authorization/AddAuthorizationBuilderAnalyzer.cs @@ -102,15 +102,11 @@ out var configureBlockOperation { // Ensure that the child operations of the configuration action passed to AddAuthorization are all related to AuthorizationOptions. var allOperationsInvolveAuthorizationOptions = configureBlockOperation - .ChildOperations.Where( - operation => operation is not IReturnOperation { IsImplicit: true } + .ChildOperations.Where(operation => + operation is not IReturnOperation { IsImplicit: true } ) - .All( - operation => - DoesOperationInvolveAuthorizationOptions( - operation, - authorizationOptionsTypes - ) + .All(operation => + DoesOperationInvolveAuthorizationOptions(operation, authorizationOptionsTypes) ); return allOperationsInvolveAuthorizationOptions @@ -257,10 +253,9 @@ AuthorizationOptionsTypes authorizationOptionsTypes { var usesAuthorizationOptionsSpecificAPIs = configureAction .Descendants() - .Any( - operation => - UsesAuthorizationOptionsSpecificGetters(operation, authorizationOptionsTypes) - || UsesAuthorizationOptionsGetPolicy(operation, authorizationOptionsTypes) + .Any(operation => + UsesAuthorizationOptionsSpecificGetters(operation, authorizationOptionsTypes) + || UsesAuthorizationOptionsGetPolicy(operation, authorizationOptionsTypes) ); return !usesAuthorizationOptionsSpecificAPIs; diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/RouteUsageDetector.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/RouteUsageDetector.cs index 7425f72b4a1..26f12e3a90f 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/RouteUsageDetector.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/Infrastructure/RouteUsageDetector.cs @@ -345,19 +345,18 @@ IMethodSymbol method // IEndpointRouteBuilder may be removed from symbol because the method is called as an extension method. // ReducedFrom includes the original IEndpointRouteBuilder parameter. if ( - !(method.ReducedFrom ?? method).Parameters.Any( - a => - SymbolEqualityComparer.Default.Equals( - a.Type, - wellKnownTypes.Get( - WellKnownType.Microsoft_AspNetCore_Routing_IEndpointRouteBuilder - ) + !(method.ReducedFrom ?? method).Parameters.Any(a => + SymbolEqualityComparer.Default.Equals( + a.Type, + wellKnownTypes.Get( + WellKnownType.Microsoft_AspNetCore_Routing_IEndpointRouteBuilder ) - || a.Type.Implements( - wellKnownTypes.Get( - WellKnownType.Microsoft_AspNetCore_Routing_IEndpointRouteBuilder - ) + ) + || a.Type.Implements( + wellKnownTypes.Get( + WellKnownType.Microsoft_AspNetCore_Routing_IEndpointRouteBuilder ) + ) ) ) { @@ -366,8 +365,8 @@ IMethodSymbol method // Method has a delegate parameter. Could be Delegate or something that inherits from it, e.g. RequestDelegate. var delegateSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_Delegate); - var delegateParameter = method.Parameters.FirstOrDefault( - p => delegateSymbol.IsAssignableFrom(p.Type) + var delegateParameter = method.Parameters.FirstOrDefault(p => + delegateSymbol.IsAssignableFrom(p.Type) ); if (delegateParameter == null) { @@ -381,11 +380,10 @@ IMethodSymbol method } var stringSymbol = semanticModel.Compilation.GetSpecialType(SpecialType.System_String); - var routeStringParameter = method.Parameters.FirstOrDefault( - p => - SymbolEqualityComparer.Default.Equals(stringSymbol, p.Type) - && RouteStringSyntaxDetector.HasMatchingStringSyntaxAttribute(p, out var identifer) - && identifer == "Route" + var routeStringParameter = method.Parameters.FirstOrDefault(p => + SymbolEqualityComparer.Default.Equals(stringSymbol, p.Type) + && RouteStringSyntaxDetector.HasMatchingStringSyntaxAttribute(p, out var identifer) + && identifer == "Route" ); if (routeStringParameter == null) { diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternAnalyzer.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternAnalyzer.cs index 6eb5f6e4231..3218788b8f0 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternAnalyzer.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternAnalyzer.cs @@ -179,13 +179,12 @@ ImmutableArray resolvedParameterSymbols continue; } - var parameterSymbol = resolvedParameterSymbols.FirstOrDefault( - s => - string.Equals( - s.RouteParameterName, - routeParameter.Name, - StringComparison.OrdinalIgnoreCase - ) + var parameterSymbol = resolvedParameterSymbols.FirstOrDefault(s => + string.Equals( + s.RouteParameterName, + routeParameter.Name, + StringComparison.OrdinalIgnoreCase + ) ); if (parameterSymbol.Symbol != null) { diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternHighlighter.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternHighlighter.cs index 892f031bd51..337423acd90 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternHighlighter.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteEmbeddedLanguage/RoutePatternHighlighter.cs @@ -71,13 +71,12 @@ CancellationToken cancellationToken // It's possible to match multiple parameters, either based on parameter name, or [FromRoute(Name = "XXX")] attribute. var parameterName = node.ParameterNameToken.Value!.ToString(); foreach ( - var matchingParameter in resolvedParameters.Where( - s => - string.Equals( - s.RouteParameterName, - parameterName, - StringComparison.OrdinalIgnoreCase - ) + var matchingParameter in resolvedParameters.Where(s => + string.Equals( + s.RouteParameterName, + parameterName, + StringComparison.OrdinalIgnoreCase + ) ) ) { @@ -134,13 +133,12 @@ CancellationToken cancellationToken .DescendantNodes() .OfType() .Where(i => i.Identifier.Text == matchingParameter.Name) - .Where( - i => - semanticModel.GetSymbolInfo(i) is var symbolInfo - && SymbolEqualityComparer.Default.Equals( - symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.FirstOrDefault(), - matchingParameter - ) + .Where(i => + semanticModel.GetSymbolInfo(i) is var symbolInfo + && SymbolEqualityComparer.Default.Equals( + symbolInfo.Symbol ?? symbolInfo.CandidateSymbols.FirstOrDefault(), + matchingParameter + ) ); foreach (var reference in parameterReferences) diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/AtMostOneFromBodyAttribute.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/AtMostOneFromBodyAttribute.cs index 47e99ca4a14..478b5152c20 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/AtMostOneFromBodyAttribute.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/AtMostOneFromBodyAttribute.cs @@ -27,8 +27,8 @@ IMethodSymbol methodSymbol WellKnownType.Microsoft_AspNetCore_Http_AsParametersAttribute ); - var asParametersDecoratedParameters = methodSymbol.Parameters.Where( - p => p.HasAttribute(asParametersAttributeType) + var asParametersDecoratedParameters = methodSymbol.Parameters.Where(p => + p.HasAttribute(asParametersAttributeType) ); foreach (var asParameterDecoratedParameter in asParametersDecoratedParameters) @@ -43,8 +43,8 @@ IMethodSymbol methodSymbol } } - var fromBodyMetadataInterfaceParameters = methodSymbol.Parameters.Where( - p => p.HasAttributeImplementingInterface(fromBodyMetadataInterfaceType) + var fromBodyMetadataInterfaceParameters = methodSymbol.Parameters.Where(p => + p.HasAttributeImplementingInterface(fromBodyMetadataInterfaceType) ); if (fromBodyMetadataInterfaceParameters.Count() >= 2) diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/WebApplicationBuilder/WebApplicationBuilderAnalyzer.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/WebApplicationBuilder/WebApplicationBuilderAnalyzer.cs index ddeb478189c..83eda065384 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/WebApplicationBuilder/WebApplicationBuilderAnalyzer.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/src/Analyzers/WebApplicationBuilder/WebApplicationBuilderAnalyzer.cs @@ -395,16 +395,14 @@ IInvocationOperation operation var methodName = operation .Syntax.DescendantNodes() .OfType() - .Where( - node => node is IdentifierNameSyntax || node is GenericNameSyntax + .Where(node => node is IdentifierNameSyntax || node is GenericNameSyntax ) - .Where( - node => - string.Equals( - node.Identifier.Value as string, - operation.TargetMethod.Name, - StringComparison.Ordinal - ) + .Where(node => + string.Equals( + node.Identifier.Value as string, + operation.TargetMethod.Name, + StringComparison.Ordinal + ) ) .FirstOrDefault(); diff --git a/aspnetcore/src/Framework/AspNetCoreAnalyzers/test/RouteEmbeddedLanguage/RoutePatternParserTests.cs b/aspnetcore/src/Framework/AspNetCoreAnalyzers/test/RouteEmbeddedLanguage/RoutePatternParserTests.cs index baf978cb76a..a3897ae2474 100644 --- a/aspnetcore/src/Framework/AspNetCoreAnalyzers/test/RouteEmbeddedLanguage/RoutePatternParserTests.cs +++ b/aspnetcore/src/Framework/AspNetCoreAnalyzers/test/RouteEmbeddedLanguage/RoutePatternParserTests.cs @@ -361,15 +361,12 @@ private static XElement CreateParameter(RouteParameter parameter) private static XElement CreateDiagnosticsElement(SourceText text, RoutePatternTree tree) => new XElement( "Diagnostics", - tree.Diagnostics.Select( - d => - new XElement( - "Diagnostic", - new XAttribute("Message", d.Message), - new XAttribute("Span", d.Span), - GetTextAttribute(text, d.Span) - ) - ) + tree.Diagnostics.Select(d => new XElement( + "Diagnostic", + new XAttribute("Message", d.Message), + new XAttribute("Span", d.Span), + GetTextAttribute(text, d.Span) + )) ); private static XAttribute GetTextAttribute(SourceText text, TextSpan span) => diff --git a/aspnetcore/src/Grpc/JsonTranscoding/test/testassets/IntegrationTestsWebsite/Infrastructure/DynamicEndpointDataSource.cs b/aspnetcore/src/Grpc/JsonTranscoding/test/testassets/IntegrationTestsWebsite/Infrastructure/DynamicEndpointDataSource.cs index cd96f1bdcea..e4e6989d023 100644 --- a/aspnetcore/src/Grpc/JsonTranscoding/test/testassets/IntegrationTestsWebsite/Infrastructure/DynamicEndpointDataSource.cs +++ b/aspnetcore/src/Grpc/JsonTranscoding/test/testassets/IntegrationTestsWebsite/Infrastructure/DynamicEndpointDataSource.cs @@ -40,8 +40,8 @@ public void AddEndpoints(IEnumerable endpoints) { var existingMatch = _endpoints .OfType() - .SingleOrDefault( - e => e.RoutePattern.RawText == routeEndpoint.RoutePattern.RawText + .SingleOrDefault(e => + e.RoutePattern.RawText == routeEndpoint.RoutePattern.RawText ); if (existingMatch != null) { diff --git a/aspnetcore/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs b/aspnetcore/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs index cd0d1d222d7..f6886923595 100644 --- a/aspnetcore/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs +++ b/aspnetcore/src/Hosting/Hosting/src/GenericHost/SlimWebHostBuilder.cs @@ -49,8 +49,8 @@ public SlimWebHostBuilder(IHostBuilder builder, WebHostBuilderOptions options) // REVIEW: This is bad since we don't own this type. Anybody could add one of these and it would mess things up // We need to flow this differently services.TryAddSingleton(sp => new DiagnosticListener("Microsoft.AspNetCore")); - services.TryAddSingleton( - sp => sp.GetRequiredService() + services.TryAddSingleton(sp => + sp.GetRequiredService() ); services.TryAddSingleton(sp => new ActivitySource("Microsoft.AspNetCore")); services.TryAddSingleton(DistributedContextPropagator.Current); diff --git a/aspnetcore/src/Hosting/Hosting/src/WebHostBuilder.cs b/aspnetcore/src/Hosting/Hosting/src/WebHostBuilder.cs index a7897786121..b01aacb7e70 100644 --- a/aspnetcore/src/Hosting/Hosting/src/WebHostBuilder.cs +++ b/aspnetcore/src/Hosting/Hosting/src/WebHostBuilder.cs @@ -309,8 +309,7 @@ var attribute in assembly.GetCustomAttributes() _context.Configuration = configuration; services.TryAddSingleton(sp => new DiagnosticListener("Microsoft.AspNetCore")); - services.TryAddSingleton( - sp => sp.GetRequiredService() + services.TryAddSingleton(sp => sp.GetRequiredService() ); services.TryAddSingleton(sp => new ActivitySource("Microsoft.AspNetCore")); services.TryAddSingleton(DistributedContextPropagator.Current); diff --git a/aspnetcore/src/Hosting/Hosting/test/StartupManagerTests.cs b/aspnetcore/src/Hosting/Hosting/test/StartupManagerTests.cs index e2b76143994..aca3224b77c 100644 --- a/aspnetcore/src/Hosting/Hosting/test/StartupManagerTests.cs +++ b/aspnetcore/src/Hosting/Hosting/test/StartupManagerTests.cs @@ -807,10 +807,9 @@ public void CustomServiceProviderFactoryFailsWithOverloadsInStartup() public void BadServiceProviderFactoryFailsThatReturnsNullServiceProviderOverriddenByDefault() { var serviceCollection = new ServiceCollection(); - serviceCollection.AddSingleton< - IServiceProviderFactory, - MyBadContainerFactory - >(); + serviceCollection.AddSingleton, MyBadContainerFactory>( + + ); var services = serviceCollection.BuildServiceProvider(); var startup = StartupLoader.LoadMethods( diff --git a/aspnetcore/src/Hosting/Hosting/test/WebHostTests.cs b/aspnetcore/src/Hosting/Hosting/test/WebHostTests.cs index 894ca2d5890..aaf8e1eb153 100644 --- a/aspnetcore/src/Hosting/Hosting/test/WebHostTests.cs +++ b/aspnetcore/src/Hosting/Hosting/test/WebHostTests.cs @@ -507,9 +507,11 @@ public async Task WebHostStopApplicationDoesNotFireStopOnHostedService() disposingCalls++; }; - services.AddSingleton( - _ => new DelegateHostedService(started, stopping, disposing) - ); + services.AddSingleton(_ => new DelegateHostedService( + started, + stopping, + disposing + )); }) .Build() ) @@ -605,9 +607,11 @@ public async Task WebHostStopApplicationFiresStopOnHostedService() disposingCalls++; }; - services.AddSingleton( - _ => new DelegateHostedService(started, stopping, disposing) - ); + services.AddSingleton(_ => new DelegateHostedService( + started, + stopping, + disposing + )); }) .Build() ) @@ -662,9 +666,11 @@ public async Task WebHostDisposeApplicationFiresStopOnHostedService() disposingCalls++; }; - services.AddSingleton( - _ => new DelegateHostedService(started, stopping, disposing) - ); + services.AddSingleton(_ => new DelegateHostedService( + started, + stopping, + disposing + )); }) .Build() ) @@ -784,22 +790,16 @@ public void ConfiguresStartupFiltersInCorrectOrder() .UseFakeServer() .ConfigureServices(services => { - services.AddTransient( - serviceProvider => - new TestFilter( - () => Assert.Equal(1, configureOrder++), - () => Assert.Equal(2, configureOrder++), - () => Assert.Equal(5, configureOrder++) - ) - ); - services.AddTransient( - serviceProvider => - new TestFilter( - () => Assert.Equal(0, configureOrder++), - () => Assert.Equal(3, configureOrder++), - () => Assert.Equal(4, configureOrder++) - ) - ); + services.AddTransient(serviceProvider => new TestFilter( + () => Assert.Equal(1, configureOrder++), + () => Assert.Equal(2, configureOrder++), + () => Assert.Equal(5, configureOrder++) + )); + services.AddTransient(serviceProvider => new TestFilter( + () => Assert.Equal(0, configureOrder++), + () => Assert.Equal(3, configureOrder++), + () => Assert.Equal(4, configureOrder++) + )); }) .Build() ) @@ -1517,8 +1517,8 @@ public static class TestServerWebHostExtensions { public static IWebHostBuilder UseFakeServer(this IWebHostBuilder builder) { - return builder.ConfigureServices( - services => services.AddSingleton() + return builder.ConfigureServices(services => + services.AddSingleton() ); } } diff --git a/aspnetcore/src/Hosting/Server.IntegrationTesting/src/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs b/aspnetcore/src/Hosting/Server.IntegrationTesting/src/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs index c2a04bcc78d..d7132c94b73 100644 --- a/aspnetcore/src/Hosting/Server.IntegrationTesting/src/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs +++ b/aspnetcore/src/Hosting/Server.IntegrationTesting/src/Deployers/RemoteWindowsDeployer/RemoteWindowsDeployer.cs @@ -328,8 +328,8 @@ private async Task RunScriptAsync(string serverAction) ); var environmentVariables = string.Join( "`,", - _deploymentParameters.EnvironmentVariables.Select( - envVariable => $"{envVariable.Key}={envVariable.Value}" + _deploymentParameters.EnvironmentVariables.Select(envVariable => + $"{envVariable.Key}={envVariable.Value}" ) ); parameterBuilder.Append( diff --git a/aspnetcore/src/Hosting/TestHost/src/RequestLifetimeFeature.cs b/aspnetcore/src/Hosting/TestHost/src/RequestLifetimeFeature.cs index cf4bd90de28..3fc90f5e42b 100644 --- a/aspnetcore/src/Hosting/TestHost/src/RequestLifetimeFeature.cs +++ b/aspnetcore/src/Hosting/TestHost/src/RequestLifetimeFeature.cs @@ -7,8 +7,9 @@ namespace Microsoft.AspNetCore.TestHost; internal sealed class RequestLifetimeFeature : IHttpRequestLifetimeFeature { - private readonly CancellationTokenSource _cancellationTokenSource = - new CancellationTokenSource(); + private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource( + + ); private readonly Action _abort; public RequestLifetimeFeature(Action abort) diff --git a/aspnetcore/src/Hosting/TestHost/src/WebHostBuilderExtensions.cs b/aspnetcore/src/Hosting/TestHost/src/WebHostBuilderExtensions.cs index 54f5305aa16..c46885b37c8 100644 --- a/aspnetcore/src/Hosting/TestHost/src/WebHostBuilderExtensions.cs +++ b/aspnetcore/src/Hosting/TestHost/src/WebHostBuilderExtensions.cs @@ -91,13 +91,10 @@ Action servicesConfiguration else { #pragma warning disable CS0612 // Type or member is obsolete - webHostBuilder.ConfigureServices( - s => - s.AddSingleton( - new ConfigureTestServicesStartupConfigureServicesFilter( - servicesConfiguration - ) - ) + webHostBuilder.ConfigureServices(s => + s.AddSingleton( + new ConfigureTestServicesStartupConfigureServicesFilter(servicesConfiguration) + ) ); #pragma warning restore CS0612 // Type or member is obsolete } @@ -121,13 +118,12 @@ Action servicesConfiguration ArgumentNullException.ThrowIfNull(servicesConfiguration); #pragma warning disable CS0612 // Type or member is obsolete - webHostBuilder.ConfigureServices( - s => - s.AddSingleton>( - new ConfigureTestServicesStartupConfigureContainerFilter( - servicesConfiguration - ) + webHostBuilder.ConfigureServices(s => + s.AddSingleton>( + new ConfigureTestServicesStartupConfigureContainerFilter( + servicesConfiguration ) + ) ); #pragma warning restore CS0612 // Type or member is obsolete diff --git a/aspnetcore/src/Hosting/TestHost/test/TestServerTests.cs b/aspnetcore/src/Hosting/TestHost/test/TestServerTests.cs index 56472a2801a..364ba0e4bf6 100644 --- a/aspnetcore/src/Hosting/TestHost/test/TestServerTests.cs +++ b/aspnetcore/src/Hosting/TestHost/test/TestServerTests.cs @@ -29,9 +29,9 @@ public async Task GenericRawCreateAndStartHost_GetTestServer() webBuilder .ConfigureServices(services => { - services.AddSingleton( - serviceProvider => new TestServer(serviceProvider) - ); + services.AddSingleton(serviceProvider => new TestServer( + serviceProvider + )); }) .Configure(app => { }); }) @@ -115,25 +115,20 @@ public void DoesNotCaptureStartupErrorsByDefault() public async Task ServicesCanBeOverridenForTestingAsync() { var builder = new WebHostBuilder() - .ConfigureServices( - s => - s.AddSingleton< - IServiceProviderFactory, - ThirdPartyContainerServiceProviderFactory - >() + .ConfigureServices(s => + s.AddSingleton< + IServiceProviderFactory, + ThirdPartyContainerServiceProviderFactory + >() ) .UseStartup() - .ConfigureTestServices( - services => - services.AddSingleton( - new SimpleService { Message = "OverridesConfigureServices" } - ) + .ConfigureTestServices(services => + services.AddSingleton(new SimpleService { Message = "OverridesConfigureServices" }) ) - .ConfigureTestContainer( - container => - container.Services.AddSingleton( - new TestService { Message = "OverridesConfigureContainer" } - ) + .ConfigureTestContainer(container => + container.Services.AddSingleton( + new TestService { Message = "OverridesConfigureContainer" } + ) ); var host = new TestServer(builder); @@ -152,11 +147,10 @@ public void ConfigureContainer(ThirdPartyContainer container) => container.Services.AddSingleton(new TestService { Message = "ConfigureContainer" }); public void Configure(IApplicationBuilder app) => - app.Run( - ctx => - ctx.Response.WriteAsync( - $"{ctx.RequestServices.GetRequiredService().Message}, {ctx.RequestServices.GetRequiredService().Message}" - ) + app.Run(ctx => + ctx.Response.WriteAsync( + $"{ctx.RequestServices.GetRequiredService().Message}, {ctx.RequestServices.GetRequiredService().Message}" + ) ); } @@ -615,8 +609,9 @@ public async Task CanAccessHttpContext() { app.Run(context => { - var accessor = - app.ApplicationServices.GetRequiredService(); + var accessor = app.ApplicationServices.GetRequiredService( + + ); return context.Response.WriteAsync( "HasContext:" + (accessor.HttpContext != null) ); diff --git a/aspnetcore/src/Http/Authentication.Core/src/AuthenticationService.cs b/aspnetcore/src/Http/Authentication.Core/src/AuthenticationService.cs index 0580adda279..a7264173bd0 100644 --- a/aspnetcore/src/Http/Authentication.Core/src/AuthenticationService.cs +++ b/aspnetcore/src/Http/Authentication.Core/src/AuthenticationService.cs @@ -309,8 +309,7 @@ private async Task GetAllSignInSchemeNames() return string.Join( ", ", (await Schemes.GetAllSchemesAsync()) - .Where( - sch => typeof(IAuthenticationSignInHandler).IsAssignableFrom(sch.HandlerType) + .Where(sch => typeof(IAuthenticationSignInHandler).IsAssignableFrom(sch.HandlerType) ) .Select(sch => sch.Name) ); @@ -365,8 +364,8 @@ private async Task GetAllSignOutSchemeNames() return string.Join( ", ", (await Schemes.GetAllSchemesAsync()) - .Where( - sch => typeof(IAuthenticationSignOutHandler).IsAssignableFrom(sch.HandlerType) + .Where(sch => + typeof(IAuthenticationSignOutHandler).IsAssignableFrom(sch.HandlerType) ) .Select(sch => sch.Name) ); diff --git a/aspnetcore/src/Http/Authentication.Core/test/TokenExtensionTests.cs b/aspnetcore/src/Http/Authentication.Core/test/TokenExtensionTests.cs index c05a20717b5..f4e6ae041fa 100644 --- a/aspnetcore/src/Http/Authentication.Core/test/TokenExtensionTests.cs +++ b/aspnetcore/src/Http/Authentication.Core/test/TokenExtensionTests.cs @@ -148,8 +148,8 @@ public async Task GetTokenWorksWithExplicitScheme() var context = new DefaultHttpContext(); var services = new ServiceCollection() .AddOptions() - .AddAuthenticationCore( - o => o.AddScheme("simple", s => s.HandlerType = typeof(SimpleAuth)) + .AddAuthenticationCore(o => + o.AddScheme("simple", s => s.HandlerType = typeof(SimpleAuth)) ); context.RequestServices = services.BuildServiceProvider(); diff --git a/aspnetcore/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs b/aspnetcore/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs index ca36fb9168c..203207a56d2 100644 --- a/aspnetcore/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs +++ b/aspnetcore/src/Http/Http.Extensions/gen/RequestDelegateGenerator.cs @@ -238,35 +238,31 @@ public void Initialize(IncrementalGeneratorInitializationContext context) .Select( (endpoints, _) => { - var hasJsonBodyOrService = endpoints.Any( - endpoint => endpoint.EmitterContext.HasJsonBodyOrService + var hasJsonBodyOrService = endpoints.Any(endpoint => + endpoint.EmitterContext.HasJsonBodyOrService ); - var hasJsonBodyOrQuery = endpoints.Any( - endpoint => endpoint.EmitterContext.HasJsonBodyOrQuery + var hasJsonBodyOrQuery = endpoints.Any(endpoint => + endpoint.EmitterContext.HasJsonBodyOrQuery ); - var hasJsonBody = endpoints.Any( - endpoint => endpoint.EmitterContext.HasJsonBody + var hasJsonBody = endpoints.Any(endpoint => endpoint.EmitterContext.HasJsonBody ); - var hasFormBody = endpoints.Any( - endpoint => endpoint.EmitterContext.HasFormBody + var hasFormBody = endpoints.Any(endpoint => endpoint.EmitterContext.HasFormBody ); - var hasRouteOrQuery = endpoints.Any( - endpoint => endpoint.EmitterContext.HasRouteOrQuery + var hasRouteOrQuery = endpoints.Any(endpoint => + endpoint.EmitterContext.HasRouteOrQuery ); - var hasBindAsync = endpoints.Any( - endpoint => endpoint.EmitterContext.HasBindAsync + var hasBindAsync = endpoints.Any(endpoint => + endpoint.EmitterContext.HasBindAsync ); - var hasParsable = endpoints.Any( - endpoint => endpoint.EmitterContext.HasParsable + var hasParsable = endpoints.Any(endpoint => endpoint.EmitterContext.HasParsable ); - var hasEndpointMetadataProvider = endpoints.Any( - endpoint => endpoint.EmitterContext.HasEndpointMetadataProvider + var hasEndpointMetadataProvider = endpoints.Any(endpoint => + endpoint.EmitterContext.HasEndpointMetadataProvider ); - var hasEndpointParameterMetadataProvider = endpoints.Any( - endpoint => endpoint.EmitterContext.HasEndpointParameterMetadataProvider + var hasEndpointParameterMetadataProvider = endpoints.Any(endpoint => + endpoint.EmitterContext.HasEndpointParameterMetadataProvider ); - var hasIResult = endpoints.Any( - endpoint => endpoint.Response?.IsIResult == true + var hasIResult = endpoints.Any(endpoint => endpoint.Response?.IsIResult == true ); using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -342,20 +338,18 @@ public void Initialize(IncrementalGeneratorInitializationContext context) .Select( (endpoints, _) => { - var hasFormBody = endpoints.Any( - endpoint => endpoint.EmitterContext.HasFormBody + var hasFormBody = endpoints.Any(endpoint => endpoint.EmitterContext.HasFormBody ); - var hasJsonBody = endpoints.Any( - endpoint => - endpoint.EmitterContext.HasJsonBody - || endpoint.EmitterContext.HasJsonBodyOrService - || endpoint.EmitterContext.HasJsonBodyOrQuery + var hasJsonBody = endpoints.Any(endpoint => + endpoint.EmitterContext.HasJsonBody + || endpoint.EmitterContext.HasJsonBodyOrService + || endpoint.EmitterContext.HasJsonBodyOrQuery ); - var hasResponseMetadata = endpoints.Any( - endpoint => endpoint.EmitterContext.HasResponseMetadata + var hasResponseMetadata = endpoints.Any(endpoint => + endpoint.EmitterContext.HasResponseMetadata ); - var requiresPropertyAsParameterInfo = endpoints.Any( - endpoint => endpoint.EmitterContext.RequiresPropertyAsParameterInfo + var requiresPropertyAsParameterInfo = endpoints.Any(endpoint => + endpoint.EmitterContext.RequiresPropertyAsParameterInfo ); using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); diff --git a/aspnetcore/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/EndpointParameter.cs b/aspnetcore/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/EndpointParameter.cs index bca272235b7..1d8f8c4cdd2 100644 --- a/aspnetcore/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/EndpointParameter.cs +++ b/aspnetcore/src/Http/Http.Extensions/gen/StaticRouteHandlerModel/EndpointParameter.cs @@ -306,15 +306,12 @@ out var matchedProperties } return; } - EndpointParameters = matchedProperties.Select( - matchedParameter => - new EndpointParameter( - endpoint, - matchedParameter.Property, - matchedParameter.Parameter, - wellKnownTypes - ) - ); + EndpointParameters = matchedProperties.Select(matchedParameter => new EndpointParameter( + endpoint, + matchedParameter.Property, + matchedParameter.Parameter, + wellKnownTypes + )); if (isDefaultConstructor == true) { var parameterList = string.Join( @@ -833,9 +830,8 @@ private static bool TryGetAsParametersConstructor( return false; } - var constructors = type.Constructors.Where( - constructor => - constructor.DeclaredAccessibility == Accessibility.Public && !constructor.IsStatic + var constructors = type.Constructors.Where(constructor => + constructor.DeclaredAccessibility == Accessibility.Public && !constructor.IsStatic ); var numOfConstructors = constructors.Count(); // When leveraging parameterless constructors, we want to ensure we only emit for writable @@ -860,9 +856,10 @@ private static bool TryGetAsParametersConstructor( if (parameters.Length == 0) { isDefaultConstructor = true; - matchedProperties = writableProperties.Select( - property => new ConstructorParameter(property, null) - ); + matchedProperties = writableProperties.Select(property => new ConstructorParameter( + property, + null + )); return true; } @@ -894,9 +891,10 @@ private static bool TryGetAsParametersConstructor( if (type.IsValueType) { isDefaultConstructor = true; - matchedProperties = writableProperties.Select( - property => new ConstructorParameter(property, null) - ); + matchedProperties = writableProperties.Select(property => new ConstructorParameter( + property, + null + )); return true; } diff --git a/aspnetcore/src/Http/Http.Extensions/src/RequestDelegateFactory.cs b/aspnetcore/src/Http/Http.Extensions/src/RequestDelegateFactory.cs index 7dcf6bef75e..afe44ab7464 100644 --- a/aspnetcore/src/Http/Http.Extensions/src/RequestDelegateFactory.cs +++ b/aspnetcore/src/Http/Http.Extensions/src/RequestDelegateFactory.cs @@ -1286,8 +1286,8 @@ factoryContext.RouteParameters is { } routeParams ); } else if ( - parameter.CustomAttributes.Any( - a => typeof(IFromServiceMetadata).IsAssignableFrom(a.AttributeType) + parameter.CustomAttributes.Any(a => + typeof(IFromServiceMetadata).IsAssignableFrom(a.AttributeType) ) ) { diff --git a/aspnetcore/src/Http/Http.Extensions/test/ProblemDetailsServiceCollectionExtensionsTest.cs b/aspnetcore/src/Http/Http.Extensions/test/ProblemDetailsServiceCollectionExtensionsTest.cs index 633d7bc7188..9dc3c92bdb6 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/ProblemDetailsServiceCollectionExtensionsTest.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/ProblemDetailsServiceCollectionExtensionsTest.cs @@ -91,8 +91,8 @@ public void AddProblemDetails_AllowMultipleWritersRegistration() collection.AddProblemDetails(); // Assert - var serviceDescriptors = collection.Where( - serviceDescriptor => serviceDescriptor.ServiceType == typeof(IProblemDetailsWriter) + var serviceDescriptors = collection.Where(serviceDescriptor => + serviceDescriptor.ServiceType == typeof(IProblemDetailsWriter) ); Assert.True( (expectedCount == serviceDescriptors.Count()), @@ -126,8 +126,8 @@ public void AddProblemDetails_CombinesProblemDetailsContext() // Arrange var collection = new ServiceCollection(); collection.AddOptions(); - collection.ConfigureAll( - options => options.SerializerOptions.TypeInfoResolver = new TestExtensionsJsonContext() + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolver = new TestExtensionsJsonContext() ); // Act @@ -196,28 +196,25 @@ CustomContextBehavior behavior if (behavior == CustomContextBehavior.Prepend) { - collection.ConfigureAll( - options => - options.SerializerOptions.TypeInfoResolverChain.Insert( - 0, - TestExtensionsJsonContext.Default - ) + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolverChain.Insert( + 0, + TestExtensionsJsonContext.Default + ) ); } else if (behavior == CustomContextBehavior.Append) { - collection.ConfigureAll( - options => - options.SerializerOptions.TypeInfoResolverChain.Add( - TestExtensionsJsonContext.Default - ) + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolverChain.Add( + TestExtensionsJsonContext.Default + ) ); } else { - collection.ConfigureAll( - options => - options.SerializerOptions.TypeInfoResolver = TestExtensionsJsonContext.Default + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolver = TestExtensionsJsonContext.Default ); } @@ -250,8 +247,8 @@ public void AddProblemDetails_CombinesProblemDetailsContext_EvenWhenNullTypeInfo // Arrange var collection = new ServiceCollection(); collection.AddOptions(); - collection.ConfigureAll( - options => options.SerializerOptions.TypeInfoResolver = null + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolver = null ); // Act @@ -277,9 +274,8 @@ public void AddProblemDetails_CombineProblemDetailsContext_WhenDefaultTypeInfoRe // Arrange var collection = new ServiceCollection(); collection.AddOptions(); - collection.ConfigureAll( - options => - options.SerializerOptions.TypeInfoResolver = new DefaultJsonTypeInfoResolver() + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolver = new DefaultJsonTypeInfoResolver() ); // Act @@ -320,12 +316,8 @@ public void AddProblemDetails_CanHaveCustomJsonTypeInfo() // add any custom ProblemDetails TypeInfoResolvers after calling AddProblemDetails() var customProblemDetailsResolver = new CustomProblemDetailsTypeInfoResolver(); - collection.ConfigureAll( - options => - options.SerializerOptions.TypeInfoResolverChain.Insert( - 0, - customProblemDetailsResolver - ) + collection.ConfigureAll(options => + options.SerializerOptions.TypeInfoResolverChain.Insert(0, customProblemDetailsResolver) ); // Assert diff --git a/aspnetcore/src/Http/Http.Extensions/test/PropertyAsParameterInfoTests.cs b/aspnetcore/src/Http/Http.Extensions/test/PropertyAsParameterInfoTests.cs index ad70bb9296b..e3d5d39b168 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/PropertyAsParameterInfoTests.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/PropertyAsParameterInfoTests.cs @@ -212,8 +212,8 @@ private static ParameterInfo GetParameter(string methodName, string parameterNam { var methodInfo = typeof(ArgumentList).GetMethod(methodName); var parameters = methodInfo.GetParameters(); - return parameters.Single( - p => p.Name.Equals(parameterName, StringComparison.OrdinalIgnoreCase) + return parameters.Single(p => + p.Name.Equals(parameterName, StringComparison.OrdinalIgnoreCase) ); } diff --git a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs index 0b822195ef8..85233fb3088 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs @@ -1879,8 +1879,8 @@ public void CreateDelegateThrows_WhenGetJsonTypeInfoFail() var httpContext = CreateHttpContext(); httpContext.RequestServices = new ServiceCollection() .AddSingleton(LoggerFactory) - .ConfigureHttpJsonOptions( - o => o.SerializerOptions.TypeInfoResolver = TestJsonContext.Default + .ConfigureHttpJsonOptions(o => + o.SerializerOptions.TypeInfoResolver = TestJsonContext.Default ) .BuildServiceProvider(); diff --git a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTestBase.cs b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTestBase.cs index 2c83d9b9ffe..5b90ec77a6d 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTestBase.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTestBase.cs @@ -118,11 +118,10 @@ string stepName { return staticEndpointSteps .SelectMany(step => step.Outputs) - .Select( - output => - Assert.IsType( - output.Value - ) + .Select(output => + Assert.IsType( + output.Value + ) ) .ToArray(); } diff --git a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Forms.cs b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Forms.cs index fa871645baf..c043e27aa27 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Forms.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Forms.cs @@ -1039,8 +1039,8 @@ void TestAction(HttpContext httpContext, IFormFile file) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = throwOnBadRequests + serviceCollection.Configure(options => + options.ThrowOnBadRequest = throwOnBadRequests ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -1119,8 +1119,8 @@ void TestAction(HttpContext httpContext, IFormFile file) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); diff --git a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.JsonBodyOrService.cs b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.JsonBodyOrService.cs index b614a9089fd..e0896131285 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.JsonBodyOrService.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.JsonBodyOrService.cs @@ -324,8 +324,8 @@ string innerSource var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -357,8 +357,8 @@ public async Task SupportsResolvingImplicitServiceWithJsonSupportOn() var serviceProvider = CreateServiceProvider( (serviceCollection) => { - serviceCollection.ConfigureHttpJsonOptions( - o => o.SerializerOptions.TypeInfoResolver = SharedTestJsonContext.Default + serviceCollection.ConfigureHttpJsonOptions(o => + o.SerializerOptions.TypeInfoResolver = SharedTestJsonContext.Default ); serviceCollection.AddSingleton(new TestService()); } diff --git a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Logging.cs b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Logging.cs index 04fb83cbd38..dbc776be02d 100644 --- a/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Logging.cs +++ b/aspnetcore/src/Http/Http.Extensions/test/RequestDelegateGenerator/RequestDelegateCreationTests.Logging.cs @@ -170,8 +170,8 @@ void TestAction(HttpContext httpContext, [FromRoute] int tryParsable, [FromRoute var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -214,8 +214,8 @@ void TestAction(HttpContext httpContext, [FromQuery] int[] values) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -317,8 +317,8 @@ void TestAction(HttpContext httpContext, MyBindAsyncRecord myBindAsyncParam1, My var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -414,8 +414,8 @@ void TestAction(HttpContext httpContext, MySimpleBindAsyncRecord mySimpleBindAsy var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -458,8 +458,8 @@ void TestAction(HttpContext httpContext, Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = shouldThrow + serviceCollection.Configure(options => + options.ThrowOnBadRequest = shouldThrow ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -516,8 +516,8 @@ void TestAction(HttpContext httpContext, Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = shouldThrow + serviceCollection.Configure(options => + options.ThrowOnBadRequest = shouldThrow ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -574,8 +574,8 @@ void TestAction(HttpContext httpContext, [FromBody] Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = throwOnBadRequests + serviceCollection.Configure(options => + options.ThrowOnBadRequest = throwOnBadRequests ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -615,8 +615,8 @@ void TestAction(HttpContext httpContext, [FromBody] Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = false + serviceCollection.Configure(options => + options.ThrowOnBadRequest = false ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -665,8 +665,8 @@ void TestAction(HttpContext httpContext, [FromBody] Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -714,8 +714,8 @@ void TestAction(HttpContext httpContext, [FromBody] Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = false + serviceCollection.Configure(options => + options.ThrowOnBadRequest = false ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); @@ -763,8 +763,8 @@ void TestAction(HttpContext httpContext, [FromBody] Todo todo) var (_, compilation) = await RunGeneratorAsync(source); var serviceProvider = CreateServiceProvider(serviceCollection => { - serviceCollection.Configure( - options => options.ThrowOnBadRequest = true + serviceCollection.Configure(options => + options.ThrowOnBadRequest = true ); }); var endpoint = GetEndpointFromCompilation(compilation, serviceProvider: serviceProvider); diff --git a/aspnetcore/src/Http/Http.Results/test/ProblemResultTests.cs b/aspnetcore/src/Http/Http.Results/test/ProblemResultTests.cs index e3613dbc814..b1c2a5af383 100644 --- a/aspnetcore/src/Http/Http.Results/test/ProblemResultTests.cs +++ b/aspnetcore/src/Http/Http.Results/test/ProblemResultTests.cs @@ -51,8 +51,8 @@ public async Task ExecuteAsync_UsesDefaultsFromProblemDetailsServoce_ForProblemD var result = new ProblemHttpResult(details); var stream = new MemoryStream(); var services = CreateServiceCollection() - .AddProblemDetails( - options => options.CustomizeProblemDetails = x => x.ProblemDetails.Type = null + .AddProblemDetails(options => + options.CustomizeProblemDetails = x => x.ProblemDetails.Type = null ) .BuildServiceProvider(); var httpContext = new DefaultHttpContext() diff --git a/aspnetcore/src/Http/Http/src/Features/HttpRequestIdentifierFeature.cs b/aspnetcore/src/Http/Http/src/Features/HttpRequestIdentifierFeature.cs index fbba3cbabc0..73f2057f7bb 100644 --- a/aspnetcore/src/Http/Http/src/Features/HttpRequestIdentifierFeature.cs +++ b/aspnetcore/src/Http/Http/src/Features/HttpRequestIdentifierFeature.cs @@ -9,8 +9,9 @@ namespace Microsoft.AspNetCore.Http.Features; public class HttpRequestIdentifierFeature : IHttpRequestIdentifierFeature { // Base32 encoding - in ascii sort order for easy text based sorting - private static readonly char[] s_encode32Chars = - "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray(); + private static readonly char[] s_encode32Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray( + + ); // Seed the _requestId for this application instance with // the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 diff --git a/aspnetcore/src/Http/Http/src/Internal/DefaultHttpRequest.cs b/aspnetcore/src/Http/Http/src/Internal/DefaultHttpRequest.cs index 6c0e9aad992..6ff726fe9b0 100644 --- a/aspnetcore/src/Http/Http/src/Internal/DefaultHttpRequest.cs +++ b/aspnetcore/src/Http/Http/src/Internal/DefaultHttpRequest.cs @@ -15,10 +15,14 @@ internal sealed class DefaultHttpRequest : HttpRequest // Lambdas hoisted to static readonly fields to improve inlining https://github.com/dotnet/roslyn/issues/13624 private static readonly Func _nullRequestFeature = f => null; - private static readonly Func _newQueryFeature = f => - new QueryFeature(f); - private static readonly Func _newFormFeature = r => - new FormFeature(r, r._context.FormOptions ?? FormOptions.Default, r._context.GetEndpoint()); + private static readonly Func _newQueryFeature = + f => new QueryFeature(f); + private static readonly Func _newFormFeature = + r => new FormFeature( + r, + r._context.FormOptions ?? FormOptions.Default, + r._context.GetEndpoint() + ); private static readonly Func< IFeatureCollection, IRequestCookiesFeature diff --git a/aspnetcore/src/Http/Http/test/DefaultHttpContextTests.cs b/aspnetcore/src/Http/Http/test/DefaultHttpContextTests.cs index c42310273f4..4e0aeee17bb 100644 --- a/aspnetcore/src/Http/Http/test/DefaultHttpContextTests.cs +++ b/aspnetcore/src/Http/Http/test/DefaultHttpContextTests.cs @@ -337,10 +337,9 @@ void TestCachedFeaturesAreNull(object value, IFeatureCollection features) var type = value.GetType(); var field = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance) - .Single( - f => - f.FieldType.GetTypeInfo().IsGenericType - && f.FieldType.GetGenericTypeDefinition() == typeof(FeatureReferences<>) + .Single(f => + f.FieldType.GetTypeInfo().IsGenericType + && f.FieldType.GetGenericTypeDefinition() == typeof(FeatureReferences<>) ); var boxedExpectedStruct = @@ -374,10 +373,9 @@ void TestCachedFeaturesAreSet(object value, IFeatureCollection features) TestFeatureProperties(value, features, properties); var fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance) - .Where( - f => - f.FieldType.GetTypeInfo().IsInterface - && f.GetCustomAttribute() == null + .Where(f => + f.FieldType.GetTypeInfo().IsInterface + && f.GetCustomAttribute() == null ); foreach (var field in fields) diff --git a/aspnetcore/src/Http/Owin/test/OwinExtensionTests.cs b/aspnetcore/src/Http/Owin/test/OwinExtensionTests.cs index d8801192f68..ba866a29eed 100644 --- a/aspnetcore/src/Http/Owin/test/OwinExtensionTests.cs +++ b/aspnetcore/src/Http/Owin/test/OwinExtensionTests.cs @@ -18,11 +18,10 @@ namespace Microsoft.AspNetCore.Owin; public class OwinExtensionTests { - static readonly AppFunc notFound = env => - new Task(() => - { - env["owin.ResponseStatusCode"] = 404; - }); + static readonly AppFunc notFound = env => new Task(() => + { + env["owin.ResponseStatusCode"] = 404; + }); [Fact] public async Task OwinConfigureServiceProviderAddsServices() diff --git a/aspnetcore/src/Http/Routing/test/FunctionalTests/RouteHandlerTest.cs b/aspnetcore/src/Http/Routing/test/FunctionalTests/RouteHandlerTest.cs index a4388f5458a..60799a14725 100644 --- a/aspnetcore/src/Http/Routing/test/FunctionalTests/RouteHandlerTest.cs +++ b/aspnetcore/src/Http/Routing/test/FunctionalTests/RouteHandlerTest.cs @@ -28,12 +28,11 @@ public async Task MapPost_FromBodyWorksWithJsonPayload() .Configure(app => { app.UseRouting(); - app.UseEndpoints( - b => - b.MapPost( - "/EchoTodo/{id}", - (int id, Todo todo) => todo with { Id = id } - ) + app.UseEndpoints(b => + b.MapPost( + "/EchoTodo/{id}", + (int id, Todo todo) => todo with { Id = id } + ) ); }) .UseTestServer(); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkGeneratorProcessTemplateTest.cs b/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkGeneratorProcessTemplateTest.cs index 8904012b8e5..f80878d052f 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkGeneratorProcessTemplateTest.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkGeneratorProcessTemplateTest.cs @@ -815,15 +815,14 @@ public void GetLinkWithNonParameterConstraintReturnsUrlWithoutQueryString() // Arrange var target = new Mock(); target - .Setup( - e => - e.Match( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(e => + e.Match( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(true) .Verifiable(); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkParserTest.cs b/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkParserTest.cs index df1bb84c63e..e0b5dfdba1a 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkParserTest.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/DefaultLinkParserTest.cs @@ -260,8 +260,8 @@ public IntAddressScheme(EndpointDataSource dataSource) public IEnumerable FindEndpoints(int address) { - return _dataSource.Endpoints.Where( - e => e.Metadata.GetMetadata().Value == address + return _dataSource.Endpoints.Where(e => + e.Metadata.GetMetadata().Value == address ); } } diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/InlineRouteParameterParserTests.cs b/aspnetcore/src/Http/Routing/test/UnitTests/InlineRouteParameterParserTests.cs index 9c135044914..2bce721aae9 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/InlineRouteParameterParserTests.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/InlineRouteParameterParserTests.cs @@ -981,8 +981,8 @@ private static RouteTemplate ParseRouteTemplate(string template) private static IInlineConstraintResolver GetConstraintResolver() { var services = new ServiceCollection().AddOptions(); - services.Configure( - options => options.ConstraintMap.Add("test", typeof(TestRouteConstraint)) + services.Configure(options => + options.ConstraintMap.Add("test", typeof(TestRouteConstraint)) ); var serviceProvider = services.BuildServiceProvider(); var accessor = serviceProvider.GetRequiredService>(); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/Matching/BarebonesMatcherBuilder.cs b/aspnetcore/src/Http/Routing/test/UnitTests/Matching/BarebonesMatcherBuilder.cs index cd96851c7d6..6d0c400c1a2 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/Matching/BarebonesMatcherBuilder.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/Matching/BarebonesMatcherBuilder.cs @@ -22,11 +22,10 @@ public override Matcher Build() { var endpoint = _endpoints[i]; var pathSegments = endpoint - .RoutePattern.PathSegments.Select( - s => - s.IsSimple && s.Parts[0] is RoutePatternLiteralPart literalPart - ? literalPart.Content - : null + .RoutePattern.PathSegments.Select(s => + s.IsSimple && s.Parts[0] is RoutePatternLiteralPart literalPart + ? literalPart.Content + : null ) .ToArray(); matchers[i] = new InnerMatcher(pathSegments, _endpoints[i]); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs b/aspnetcore/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs index a6d012c1e67..5388b9d8ff0 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/RouteCollectionTest.cs @@ -689,8 +689,8 @@ private static INamedRouter CreateNamedRoute( var target = new Mock(MockBehavior.Strict); target .Setup(e => e.GetVirtualPath(It.IsAny())) - .Returns( - c => c.RouteName == name ? new VirtualPathData(target.Object, matchValue) : null + .Returns(c => + c.RouteName == name ? new VirtualPathData(target.Object, matchValue) : null ) .Verifiable(); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/RouteOptionsTests.cs b/aspnetcore/src/Http/Routing/test/UnitTests/RouteOptionsTests.cs index 80455ddddd2..fce05db2c88 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/RouteOptionsTests.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/RouteOptionsTests.cs @@ -17,8 +17,7 @@ public void ConfigureRouting_ConfiguresOptionsProperly() services.AddOptions(); // Act - services.AddRouting( - options => options.ConstraintMap.Add("foo", typeof(TestRouteConstraint)) + services.AddRouting(options => options.ConstraintMap.Add("foo", typeof(TestRouteConstraint)) ); var serviceProvider = services.BuildServiceProvider(); diff --git a/aspnetcore/src/Http/Routing/test/UnitTests/RouteTest.cs b/aspnetcore/src/Http/Routing/test/UnitTests/RouteTest.cs index a11cc6e9f6f..1da67f431c9 100644 --- a/aspnetcore/src/Http/Routing/test/UnitTests/RouteTest.cs +++ b/aspnetcore/src/Http/Routing/test/UnitTests/RouteTest.cs @@ -1001,15 +1001,14 @@ public void GetVirtualPathWithNonParameterConstraintReturnsUrlWithoutQueryString var target = new Mock(); target - .Setup( - e => - e.Match( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(e => + e.Match( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(true) .Verifiable(); diff --git a/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/Framework/FrameworkEndpointRouteBuilderExtensions.cs b/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/Framework/FrameworkEndpointRouteBuilderExtensions.cs index 14873e196cf..000fb04d945 100644 --- a/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/Framework/FrameworkEndpointRouteBuilderExtensions.cs +++ b/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/Framework/FrameworkEndpointRouteBuilderExtensions.cs @@ -13,8 +13,9 @@ Action configure ArgumentNullException.ThrowIfNull(endpoints); ArgumentNullException.ThrowIfNull(configure); - var dataSource = - endpoints.ServiceProvider.GetRequiredService(); + var dataSource = endpoints.ServiceProvider.GetRequiredService( + + ); var configurationBuilder = new FrameworkConfigurationBuilder(dataSource); configure(configurationBuilder); diff --git a/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/UseEndpointRoutingStartup.cs b/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/UseEndpointRoutingStartup.cs index 8d3d9046cb7..b2e6f41578e 100644 --- a/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/UseEndpointRoutingStartup.cs +++ b/aspnetcore/src/Http/Routing/test/testassets/RoutingSandbox/UseEndpointRoutingStartup.cs @@ -87,7 +87,9 @@ var endpoint in dataSource var graphWriter = httpContext.RequestServices.GetRequiredService(); var dataSource = - httpContext.RequestServices.GetRequiredService(); + httpContext.RequestServices.GetRequiredService( + + ); graphWriter.Write(dataSource, writer); } diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/src/RoleStore.cs b/aspnetcore/src/Identity/EntityFrameworkCore/src/RoleStore.cs index 8a01ece7d97..379b823cfdd 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/src/RoleStore.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/src/RoleStore.cs @@ -424,11 +424,10 @@ public virtual async Task RemoveClaimAsync( ArgumentNullException.ThrowIfNull(role); ArgumentNullException.ThrowIfNull(claim); var claims = await RoleClaims - .Where( - rc => - rc.RoleId.Equals(role.Id) - && rc.ClaimValue == claim.Value - && rc.ClaimType == claim.Type + .Where(rc => + rc.RoleId.Equals(role.Id) + && rc.ClaimValue == claim.Value + && rc.ClaimType == claim.Type ) .ToListAsync(cancellationToken); foreach (var c in claims) diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/src/UserStore.cs b/aspnetcore/src/Identity/EntityFrameworkCore/src/UserStore.cs index 97c2a616cd2..31de4f6e5f8 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/src/UserStore.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/src/UserStore.cs @@ -589,11 +589,10 @@ public override async Task ReplaceClaimAsync( ArgumentNullException.ThrowIfNull(newClaim); var matchedClaims = await UserClaims - .Where( - uc => - uc.UserId.Equals(user.Id) - && uc.ClaimValue == claim.Value - && uc.ClaimType == claim.Type + .Where(uc => + uc.UserId.Equals(user.Id) + && uc.ClaimValue == claim.Value + && uc.ClaimType == claim.Type ) .ToListAsync(cancellationToken); foreach (var matchedClaim in matchedClaims) @@ -622,11 +621,10 @@ public override async Task RemoveClaimsAsync( foreach (var claim in claims) { var matchedClaims = await UserClaims - .Where( - uc => - uc.UserId.Equals(user.Id) - && uc.ClaimValue == claim.Value - && uc.ClaimType == claim.Type + .Where(uc => + uc.UserId.Equals(user.Id) + && uc.ClaimValue == claim.Value + && uc.ClaimType == claim.Type ) .ToListAsync(cancellationToken); foreach (var c in matchedClaims) diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/CustomSchemaTest.cs b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/CustomSchemaTest.cs index c982d5b57a7..c687ceecfa7 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/CustomSchemaTest.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/CustomSchemaTest.cs @@ -20,12 +20,9 @@ public CustomSchemaTest(ScratchDatabaseFixture fixture) services .AddLogging() .AddSingleton(new ConfigurationBuilder().Build()) - .AddDbContext( - o => - o.UseSqlite(fixture.Connection) - .ConfigureWarnings( - b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) - ) + .AddDbContext(o => + o.UseSqlite(fixture.Connection) + .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) ) .AddIdentity(o => { diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs index 2a72126dfee..95397f95349 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/DefaultPocoTest.cs @@ -21,12 +21,9 @@ public DefaultPocoTest(ScratchDatabaseFixture fixture) services .AddSingleton(new ConfigurationBuilder().Build()) - .AddDbContext( - o => - o.UseSqlite(fixture.Connection) - .ConfigureWarnings( - b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) - ) + .AddDbContext(o => + o.UseSqlite(fixture.Connection) + .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) ) .AddIdentity() .AddEntityFrameworkStores(); diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs index 956a177a2e1..b93d83c51ff 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/MaxKeyLengthSchemaTest.cs @@ -21,12 +21,9 @@ public MaxKeyLengthSchemaTest(ScratchDatabaseFixture fixture) services .AddSingleton(new ConfigurationBuilder().Build()) - .AddDbContext( - o => - o.UseSqlite(fixture.Connection) - .ConfigureWarnings( - b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) - ) + .AddDbContext(o => + o.UseSqlite(fixture.Connection) + .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) ) .AddIdentity(o => o.Stores.MaxLengthForKeys = 128) .AddEntityFrameworkStores(); diff --git a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs index 5f659ac3904..bc4efe78002 100644 --- a/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs +++ b/aspnetcore/src/Identity/EntityFrameworkCore/test/EF.Test/UserOnlyTest.cs @@ -27,12 +27,9 @@ public UserOnlyTest(ScratchDatabaseFixture fixture) services .AddSingleton(new ConfigurationBuilder().Build()) - .AddDbContext( - o => - o.UseSqlite(fixture.Connection) - .ConfigureWarnings( - b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) - ) + .AddDbContext(o => + o.UseSqlite(fixture.Connection) + .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) ) .AddIdentityCore(o => { }) .AddEntityFrameworkStores(); diff --git a/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs b/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs index 2e1a57c9ef6..dca7dd83df0 100644 --- a/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs +++ b/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Data/Migrations/20190411154115_CreateIdentitySchema.cs @@ -12,14 +12,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", - columns: table => - new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 256, nullable: true), + NormalizedName = table.Column(maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); @@ -28,27 +27,26 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUsers", - columns: table => - new - { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false), - Name = table.Column(nullable: true), - Age = table.Column(nullable: false) - }, + columns: table => new + { + Id = table.Column(nullable: false), + UserName = table.Column(maxLength: 256, nullable: true), + NormalizedUserName = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false), + PasswordHash = table.Column(nullable: true), + SecurityStamp = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + PhoneNumber = table.Column(nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false), + TwoFactorEnabled = table.Column(nullable: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false), + AccessFailedCount = table.Column(nullable: false), + Name = table.Column(nullable: true), + Age = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); @@ -57,19 +55,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetRoleClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + RoleId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); @@ -85,19 +82,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + UserId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); @@ -113,14 +109,13 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserLogins", - columns: table => - new - { - LoginProvider = table.Column(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, + columns: table => new + { + LoginProvider = table.Column(maxLength: 128, nullable: false), + ProviderKey = table.Column(maxLength: 128, nullable: false), + ProviderDisplayName = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey( @@ -139,12 +134,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserRoles", - columns: table => - new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); @@ -167,25 +161,23 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserTokens", - columns: table => - new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(nullable: true) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 128, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey( "PK_AspNetUserTokens", - x => - new - { - x.UserId, - x.LoginProvider, - x.Name - } + x => new + { + x.UserId, + x.LoginProvider, + x.Name + } ); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", diff --git a/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs b/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs index 673282db98c..12fd6f6c509 100644 --- a/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs +++ b/aspnetcore/src/Identity/samples/IdentitySample.DefaultUI/Startup.cs @@ -35,14 +35,13 @@ public Startup(IWebHostEnvironment env) public void ConfigureServices(IServiceCollection services) { // Add framework services. - services.AddDbContext( - options => - options - .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) - .UseSqlServer( - Configuration.GetConnectionString("DefaultConnection"), - x => x.MigrationsAssembly("IdentitySample.DefaultUI") - ) + services.AddDbContext(options => + options + .ConfigureWarnings(b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning)) + .UseSqlServer( + Configuration.GetConnectionString("DefaultConnection"), + x => x.MigrationsAssembly("IdentitySample.DefaultUI") + ) ); services.AddMvc().AddNewtonsoftJson(); diff --git a/aspnetcore/src/Identity/test/Identity.FunctionalTests/Infrastructure/FunctionalTestsServiceCollectionExtensions.cs b/aspnetcore/src/Identity/test/Identity.FunctionalTests/Infrastructure/FunctionalTestsServiceCollectionExtensions.cs index a6f37dc7ceb..da1ddbc9414 100644 --- a/aspnetcore/src/Identity/test/Identity.FunctionalTests/Infrastructure/FunctionalTestsServiceCollectionExtensions.cs +++ b/aspnetcore/src/Identity/test/Identity.FunctionalTests/Infrastructure/FunctionalTestsServiceCollectionExtensions.cs @@ -23,25 +23,24 @@ DbConnection connection ) where TContext : DbContext { - var descriptor = services.SingleOrDefault( - d => d.ServiceType == typeof(DbContextOptions) + var descriptor = services.SingleOrDefault(d => + d.ServiceType == typeof(DbContextOptions) ); if (descriptor != null) { services.Remove(descriptor); } - services.AddScoped( - p => - DbContextOptionsFactory( - p, - (sp, options) => - options - .ConfigureWarnings( - b => b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) - ) - .UseSqlite(connection) - ) + services.AddScoped(p => + DbContextOptionsFactory( + p, + (sp, options) => + options + .ConfigureWarnings(b => + b.Log(CoreEventId.ManyServiceProvidersCreatedWarning) + ) + .UseSqlite(connection) + ) ); return services; diff --git a/aspnetcore/src/Identity/test/Identity.FunctionalTests/ManagementTests.cs b/aspnetcore/src/Identity/test/Identity.FunctionalTests/ManagementTests.cs index a2e49c06400..b46520634e3 100644 --- a/aspnetcore/src/Identity/test/Identity.FunctionalTests/ManagementTests.cs +++ b/aspnetcore/src/Identity/test/Identity.FunctionalTests/ManagementTests.cs @@ -60,8 +60,8 @@ public async Task CanConfirmEmail() void ConfigureTestServices(IServiceCollection services) => services.SetupTestEmailSender(emails); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureServices(ConfigureTestServices) ); var client = server.CreateClient(); @@ -85,8 +85,8 @@ public async Task CanChangeEmail() void ConfigureTestServices(IServiceCollection services) => services.SetupTestEmailSender(emails); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureServices(ConfigureTestServices) ); var client = server.CreateClient(); var newClient = server.CreateClient(); @@ -119,8 +119,8 @@ void ConfigureTestServices(IServiceCollection services) => IdentityConstants.ApplicationScheme ); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureTestServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureTestServices(ConfigureTestServices) ); var client = server.CreateClient(); @@ -160,8 +160,8 @@ void ConfigureTestServices(IServiceCollection services) => IdentityConstants.ApplicationScheme ); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureTestServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureTestServices(ConfigureTestServices) ); var client = server.CreateClient(); @@ -213,8 +213,8 @@ void ConfigureTestServices(IServiceCollection services) => IdentityConstants.ApplicationScheme ); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureTestServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureTestServices(ConfigureTestServices) ); var client = server.CreateClient(); @@ -239,8 +239,8 @@ public async Task CanSeeExternalLoginProviderDisplayName() void ConfigureTestServices(IServiceCollection services) => services.SetupTestThirdPartyLogin(); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureTestServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureTestServices(ConfigureTestServices) ); var client = server.CreateClient(); @@ -269,8 +269,8 @@ void ConfigureTestServices(IServiceCollection services) => IdentityConstants.ApplicationScheme ); - var server = ServerFactory.WithWebHostBuilder( - whb => whb.ConfigureTestServices(ConfigureTestServices) + var server = ServerFactory.WithWebHostBuilder(whb => + whb.ConfigureTestServices(ConfigureTestServices) ); var client = server.CreateClient(); diff --git a/aspnetcore/src/Identity/test/Identity.Test/IdentityOptionsTest.cs b/aspnetcore/src/Identity/test/Identity.Test/IdentityOptionsTest.cs index 4efc8a00aec..14676150e91 100644 --- a/aspnetcore/src/Identity/test/Identity.Test/IdentityOptionsTest.cs +++ b/aspnetcore/src/Identity/test/Identity.Test/IdentityOptionsTest.cs @@ -43,8 +43,8 @@ public void VerifyDefaultOptions() [Fact] public void CanCustomizeIdentityOptions() { - var services = new ServiceCollection().Configure( - options => options.Password.RequiredLength = -1 + var services = new ServiceCollection().Configure(options => + options.Password.RequiredLength = -1 ); services.AddIdentity(); var serviceProvider = services.BuildServiceProvider(); diff --git a/aspnetcore/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs b/aspnetcore/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs index b02acd125fe..66d6417f714 100644 --- a/aspnetcore/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs +++ b/aspnetcore/src/Identity/test/Identity.Test/IdentityUIScriptsTest.cs @@ -141,9 +141,8 @@ private static List GetScriptTags(string cshtmlFile) var scriptTags = new List(); foreach (var scriptElement in htmlDocument.Scripts) { - var fallbackSrcAttribute = scriptElement.Attributes.FirstOrDefault( - attr => - string.Equals("asp-fallback-src", attr.Name, StringComparison.OrdinalIgnoreCase) + var fallbackSrcAttribute = scriptElement.Attributes.FirstOrDefault(attr => + string.Equals("asp-fallback-src", attr.Name, StringComparison.OrdinalIgnoreCase) ); scriptTags.Add( diff --git a/aspnetcore/src/Identity/test/Identity.Test/SignInManagerTest.cs b/aspnetcore/src/Identity/test/Identity.Test/SignInManagerTest.cs index f812c3b83e1..90bbfe4f14a 100644 --- a/aspnetcore/src/Identity/test/Identity.Test/SignInManagerTest.cs +++ b/aspnetcore/src/Identity/test/Identity.Test/SignInManagerTest.cs @@ -314,8 +314,8 @@ bool tfaRemembered { var id = new ClaimsIdentity(IdentityConstants.TwoFactorRememberMeScheme); id.AddClaim(new Claim(ClaimTypes.Name, user.Id)); - auth.Setup( - a => a.AuthenticateAsync(context, IdentityConstants.TwoFactorRememberMeScheme) + auth.Setup(a => + a.AuthenticateAsync(context, IdentityConstants.TwoFactorRememberMeScheme) ) .ReturnsAsync( AuthenticateResult.Success( @@ -416,14 +416,13 @@ public async Task PasswordSignInRequiresVerification(bool supportsLockout) var context = new DefaultHttpContext(); var helper = SetupSignInManager(manager.Object, context); var auth = MockAuth(context); - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.TwoFactorUserIdScheme, - It.Is(id => id.FindFirstValue(ClaimTypes.Name) == user.Id), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.TwoFactorUserIdScheme, + It.Is(id => id.FindFirstValue(ClaimTypes.Name) == user.Id), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -479,16 +478,13 @@ public async Task ExternalSignInRequiresVerificationIfNotBypassed(bool bypass) } else { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.TwoFactorUserIdScheme, - It.Is( - id => id.FindFirstValue(ClaimTypes.Name) == user.Id - ), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.TwoFactorUserIdScheme, + It.Is(id => id.FindFirstValue(ClaimTypes.Name) == user.Id), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -539,13 +535,12 @@ bool rememberClient var manager = SetupUserManager(user); manager.Setup(m => m.SupportsUserLockout).Returns(true).Verifiable(); manager - .Setup( - m => - m.VerifyTwoFactorTokenAsync( - user, - providerName ?? TokenOptions.DefaultAuthenticatorProvider, - code - ) + .Setup(m => + m.VerifyTwoFactorTokenAsync( + user, + providerName ?? TokenOptions.DefaultAuthenticatorProvider, + code + ) ) .ReturnsAsync(true) .Verifiable(); @@ -573,19 +568,17 @@ bool rememberClient .Verifiable(); if (rememberClient) { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.TwoFactorRememberMeScheme, - It.Is( - i => - i.FindFirstValue(ClaimTypes.Name) == user.Id - && i.Identities.First().AuthenticationType - == IdentityConstants.TwoFactorRememberMeScheme - ), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.TwoFactorRememberMeScheme, + It.Is(i => + i.FindFirstValue(ClaimTypes.Name) == user.Id + && i.Identities.First().AuthenticationType + == IdentityConstants.TwoFactorRememberMeScheme + ), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -614,13 +607,12 @@ public async Task TwoFactorAuthenticatorSignInFailWithoutLockout() var manager = SetupUserManager(user); manager.Setup(m => m.SupportsUserLockout).Returns(false).Verifiable(); manager - .Setup( - m => - m.VerifyTwoFactorTokenAsync( - user, - providerName ?? TokenOptions.DefaultAuthenticatorProvider, - code - ) + .Setup(m => + m.VerifyTwoFactorTokenAsync( + user, + providerName ?? TokenOptions.DefaultAuthenticatorProvider, + code + ) ) .ReturnsAsync(false) .Verifiable(); @@ -677,13 +669,12 @@ public async Task TwoFactorAuthenticatorSignInAsyncReturnsLockedOut() .Verifiable(); manager.Setup(m => m.SupportsUserLockout).Returns(true).Verifiable(); manager - .Setup( - m => - m.VerifyTwoFactorTokenAsync( - user, - providerName ?? TokenOptions.DefaultAuthenticatorProvider, - code - ) + .Setup(m => + m.VerifyTwoFactorTokenAsync( + user, + providerName ?? TokenOptions.DefaultAuthenticatorProvider, + code + ) ) .ReturnsAsync(false) .Verifiable(); @@ -806,39 +797,34 @@ public async Task CanTwoFactorRecoveryCodeSignIn(bool supportsLockout, bool exte ); if (externalLogin) { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.ApplicationScheme, - It.Is( - i => - i.FindFirstValue(ClaimTypes.AuthenticationMethod) - == loginProvider - && i.FindFirstValue(ClaimTypes.NameIdentifier) == user.Id - ), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.ApplicationScheme, + It.Is(i => + i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider + && i.FindFirstValue(ClaimTypes.NameIdentifier) == user.Id + ), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.ExternalScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.ExternalScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.TwoFactorUserIdScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.TwoFactorUserIdScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -949,13 +935,12 @@ public async Task CanResignIn( //signInManager.Setup(s => s.SignInAsync(user, It.Is(p => p.IsPersistent == isPersistent), //externalLogin? loginProvider : null)).Returns(Task.FromResult(0)).Verifiable(); signInManager - .Setup( - s => - s.SignInWithClaimsAsync( - user, - It.IsAny(), - It.IsAny>() - ) + .Setup(s => + s.SignInWithClaimsAsync( + user, + It.IsAny(), + It.IsAny>() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1022,42 +1007,37 @@ bool rememberClient ); if (externalLogin) { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.ApplicationScheme, - It.Is( - i => - i.FindFirstValue(ClaimTypes.AuthenticationMethod) - == loginProvider - && i.FindFirstValue("amr") == "mfa" - && i.FindFirstValue(ClaimTypes.NameIdentifier) == user.Id - ), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.ApplicationScheme, + It.Is(i => + i.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider + && i.FindFirstValue("amr") == "mfa" + && i.FindFirstValue(ClaimTypes.NameIdentifier) == user.Id + ), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); // REVIEW: restore ability to test is persistent //It.Is(v => v.IsPersistent == isPersistent))).Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.ExternalScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.ExternalScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.TwoFactorUserIdScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.TwoFactorUserIdScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1068,19 +1048,17 @@ bool rememberClient } if (rememberClient) { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.TwoFactorRememberMeScheme, - It.Is( - i => - i.FindFirstValue(ClaimTypes.Name) == user.Id - && i.Identities.First().AuthenticationType - == IdentityConstants.TwoFactorRememberMeScheme - ), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.TwoFactorRememberMeScheme, + It.Is(i => + i.FindFirstValue(ClaimTypes.Name) == user.Id + && i.Identities.First().AuthenticationType + == IdentityConstants.TwoFactorRememberMeScheme + ), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1168,19 +1146,17 @@ public async Task RememberClientStoresUserId() var context = new DefaultHttpContext(); var auth = MockAuth(context); var helper = SetupSignInManager(manager.Object, context); - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.TwoFactorRememberMeScheme, - It.Is( - i => - i.FindFirstValue(ClaimTypes.Name) == user.Id - && i.Identities.First().AuthenticationType - == IdentityConstants.TwoFactorRememberMeScheme - ), - It.Is(v => v.IsPersistent == true) - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.TwoFactorRememberMeScheme, + It.Is(i => + i.FindFirstValue(ClaimTypes.Name) == user.Id + && i.Identities.First().AuthenticationType + == IdentityConstants.TwoFactorRememberMeScheme + ), + It.Is(v => v.IsPersistent == true) + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1263,33 +1239,30 @@ public async Task SignOutCallsContextResponseSignOut() var manager = MockHelpers.TestUserManager(); var context = new DefaultHttpContext(); var auth = MockAuth(context); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.ApplicationScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.ApplicationScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.TwoFactorUserIdScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.TwoFactorUserIdScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); - auth.Setup( - a => - a.SignOutAsync( - context, - IdentityConstants.ExternalScheme, - It.IsAny() - ) + auth.Setup(a => + a.SignOutAsync( + context, + IdentityConstants.ExternalScheme, + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1505,28 +1478,22 @@ private static void SetupSignIn( string amr = null ) { - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.ApplicationScheme, - It.Is( - id => - ( - userId == null - || id.FindFirstValue(ClaimTypes.NameIdentifier) == userId - ) - && ( - loginProvider == null - || id.FindFirstValue(ClaimTypes.AuthenticationMethod) - == loginProvider - ) - && (amr == null || id.FindFirstValue("amr") == amr) - ), - It.Is( - v => isPersistent == null || v.IsPersistent == isPersistent + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.ApplicationScheme, + It.Is(id => + (userId == null || id.FindFirstValue(ClaimTypes.NameIdentifier) == userId) + && ( + loginProvider == null + || id.FindFirstValue(ClaimTypes.AuthenticationMethod) == loginProvider ) + && (amr == null || id.FindFirstValue("amr") == amr) + ), + It.Is(v => + isPersistent == null || v.IsPersistent == isPersistent ) + ) ) .Returns(Task.FromResult(0)) .Verifiable(); diff --git a/aspnetcore/src/Identity/test/Identity.Test/UserManagerTest.cs b/aspnetcore/src/Identity/test/Identity.Test/UserManagerTest.cs index 81073f8ffb8..659b7787cf4 100644 --- a/aspnetcore/src/Identity/test/Identity.Test/UserManagerTest.cs +++ b/aspnetcore/src/Identity/test/Identity.Test/UserManagerTest.cs @@ -90,13 +90,12 @@ public async Task CreateCallsStore() .Returns(Task.FromResult(user.UserName)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedUserNameAsync( - user, - normalizer.NormalizeName(user.UserName), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedUserNameAsync( + user, + normalizer.NormalizeName(user.UserName), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -158,24 +157,22 @@ public async Task CreateCallsUpdateEmailStore() .Returns(Task.FromResult(user.Email)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedEmailAsync( - user, - normalizer.NormalizeEmail(user.Email), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedEmailAsync( + user, + normalizer.NormalizeEmail(user.Email), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedUserNameAsync( - user, - normalizer.NormalizeName(user.UserName), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedUserNameAsync( + user, + normalizer.NormalizeName(user.UserName), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -221,13 +218,12 @@ public async Task UpdateCallsStore() .Returns(Task.FromResult(user.UserName)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedUserNameAsync( - user, - normalizer.NormalizeName(user.UserName), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedUserNameAsync( + user, + normalizer.NormalizeName(user.UserName), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -261,24 +257,22 @@ public async Task UpdateWillUpdateNormalizedEmail() .Returns(Task.FromResult(user.Email)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedUserNameAsync( - user, - normalizer.NormalizeName(user.UserName), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedUserNameAsync( + user, + normalizer.NormalizeName(user.UserName), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => - s.SetNormalizedEmailAsync( - user, - normalizer.NormalizeEmail(user.Email), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedEmailAsync( + user, + normalizer.NormalizeEmail(user.Email), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -312,13 +306,12 @@ public async Task SetUserNameCallsStore() .Returns(Task.FromResult("foo")) .Verifiable(); store - .Setup( - s => - s.SetNormalizedUserNameAsync( - user, - normalizer.NormalizeName("foo"), - CancellationToken.None - ) + .Setup(s => + s.SetNormalizedUserNameAsync( + user, + normalizer.NormalizeName("foo"), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -364,12 +357,8 @@ public async Task FindByNameCallsStoreWithNormalizedName() var store = new Mock>(); var user = new PocoUser { UserName = "Foo" }; store - .Setup( - s => - s.FindByNameAsync( - normalizer.NormalizeName(user.UserName), - CancellationToken.None - ) + .Setup(s => + s.FindByNameAsync(normalizer.NormalizeName(user.UserName), CancellationToken.None) ) .Returns(Task.FromResult(user)) .Verifiable(); @@ -412,12 +401,8 @@ public async Task FindByEmailCallsStoreWithNormalizedEmail() var store = new Mock>(); var user = new PocoUser { Email = "Foo" }; store - .Setup( - s => - s.FindByEmailAsync( - normalizer.NormalizeEmail(user.Email), - CancellationToken.None - ) + .Setup(s => + s.FindByEmailAsync(normalizer.NormalizeEmail(user.Email), CancellationToken.None) ) .Returns(Task.FromResult(user)) .Verifiable(); @@ -510,20 +495,20 @@ public async Task AddToRolesCallsStore() var user = new PocoUser { UserName = "Foo" }; var roles = new string[] { "A", "B", "C", "C" }; store - .Setup( - s => s.AddToRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) + .Setup(s => + s.AddToRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => s.AddToRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) + .Setup(s => + s.AddToRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => s.AddToRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) + .Setup(s => + s.AddToRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -533,20 +518,17 @@ public async Task AddToRolesCallsStore() .ReturnsAsync(IdentityResult.Success) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(false)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(false)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) ) .Returns(Task.FromResult(false)) .Verifiable(); @@ -621,14 +603,13 @@ public async Task AddToRolesFailsIfUserInRole() var user = new PocoUser { UserName = "Foo" }; var roles = new[] { "A", "B", "C" }; store - .Setup( - s => s.AddToRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) + .Setup(s => + s.AddToRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(true)) .Verifiable(); @@ -651,35 +632,20 @@ public async Task RemoveFromRolesCallsStore() var user = new PocoUser { UserName = "Foo" }; var roles = new[] { "A", "B", "C" }; store - .Setup( - s => - s.RemoveFromRoleAsync( - user, - normalizer.NormalizeName("A"), - CancellationToken.None - ) + .Setup(s => + s.RemoveFromRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => - s.RemoveFromRoleAsync( - user, - normalizer.NormalizeName("B"), - CancellationToken.None - ) + .Setup(s => + s.RemoveFromRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => - s.RemoveFromRoleAsync( - user, - normalizer.NormalizeName("C"), - CancellationToken.None - ) + .Setup(s => + s.RemoveFromRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -688,20 +654,17 @@ public async Task RemoveFromRolesCallsStore() .ReturnsAsync(IdentityResult.Success) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(true)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(true)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("C"), CancellationToken.None) ) .Returns(Task.FromResult(true)) .Verifiable(); @@ -724,25 +687,18 @@ public async Task RemoveFromRolesFailsIfNotInRole() var user = new PocoUser { UserName = "Foo" }; var roles = new string[] { "A", "B", "C" }; store - .Setup( - s => - s.RemoveFromRoleAsync( - user, - normalizer.NormalizeName("A"), - CancellationToken.None - ) + .Setup(s => + s.RemoveFromRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("A"), CancellationToken.None) ) .Returns(Task.FromResult(true)) .Verifiable(); store - .Setup( - s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) + .Setup(s => s.IsInRoleAsync(user, normalizer.NormalizeName("B"), CancellationToken.None) ) .Returns(Task.FromResult(false)) .Verifiable(); @@ -789,8 +745,8 @@ public async Task AddClaimCallsStore() var user = new PocoUser { UserName = "Foo" }; var claim = new Claim("1", "1"); store - .Setup( - s => s.AddClaimsAsync(user, It.IsAny>(), CancellationToken.None) + .Setup(s => + s.AddClaimsAsync(user, It.IsAny>(), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -817,14 +773,13 @@ public async Task UpdateClaimCallsStore() var claim = new Claim("1", "1"); var newClaim = new Claim("1", "2"); store - .Setup( - s => - s.ReplaceClaimAsync( - user, - It.IsAny(), - It.IsAny(), - CancellationToken.None - ) + .Setup(s => + s.ReplaceClaimAsync( + user, + It.IsAny(), + It.IsAny(), + CancellationToken.None + ) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -959,13 +914,8 @@ public async Task RemoveClaimCallsStore() var user = new PocoUser { UserName = "Foo" }; var claim = new Claim("1", "1"); store - .Setup( - s => - s.RemoveClaimsAsync( - user, - It.IsAny>(), - CancellationToken.None - ) + .Setup(s => + s.RemoveClaimsAsync(user, It.IsAny>(), CancellationToken.None) ) .Returns(Task.FromResult(0)) .Verifiable(); @@ -1155,15 +1105,14 @@ public void UserManagerWillUseTokenProviderInstance() var services = new ServiceCollection().AddSingleton(config).AddLogging(); services - .AddIdentity( - o => - o.Tokens.ProviderMap.Add( - "A", - new TokenProviderDescriptor(typeof(ATokenProvider)) - { - ProviderInstance = provider - } - ) + .AddIdentity(o => + o.Tokens.ProviderMap.Add( + "A", + new TokenProviderDescriptor(typeof(ATokenProvider)) + { + ProviderInstance = provider + } + ) ) .AddUserStore(); var manager = services.BuildServiceProvider().GetService>(); @@ -1278,15 +1227,14 @@ public void UserManagerWillUseTokenProviderInstanceOverDefaults() var services = new ServiceCollection().AddSingleton(config).AddLogging(); services - .AddIdentity( - o => - o.Tokens.ProviderMap.Add( - TokenOptions.DefaultProvider, - new TokenProviderDescriptor(typeof(ATokenProvider)) - { - ProviderInstance = provider - } - ) + .AddIdentity(o => + o.Tokens.ProviderMap.Add( + TokenOptions.DefaultProvider, + new TokenProviderDescriptor(typeof(ATokenProvider)) + { + ProviderInstance = provider + } + ) ) .AddUserStore() .AddDefaultTokenProviders(); diff --git a/aspnetcore/src/Identity/test/InMemory.Test/ControllerTest.cs b/aspnetcore/src/Identity/test/InMemory.Test/ControllerTest.cs index c79f1ca8105..79ce2826a4e 100644 --- a/aspnetcore/src/Identity/test/InMemory.Test/ControllerTest.cs +++ b/aspnetcore/src/Identity/test/InMemory.Test/ControllerTest.cs @@ -21,14 +21,13 @@ public async Task VerifyAccountControllerSignIn(bool isPersistent) { var context = new DefaultHttpContext(); var auth = MockAuth(context); - auth.Setup( - a => - a.SignInAsync( - context, - IdentityConstants.ApplicationScheme, - It.IsAny(), - It.IsAny() - ) + auth.Setup(a => + a.SignInAsync( + context, + IdentityConstants.ApplicationScheme, + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.FromResult(0)) .Verifiable(); diff --git a/aspnetcore/src/Identity/test/InMemory.Test/InMemoryStore.cs b/aspnetcore/src/Identity/test/InMemory.Test/InMemoryStore.cs index a6bfa121dd7..f65f66998b2 100644 --- a/aspnetcore/src/Identity/test/InMemory.Test/InMemoryStore.cs +++ b/aspnetcore/src/Identity/test/InMemory.Test/InMemoryStore.cs @@ -164,8 +164,8 @@ CancellationToken cancellationToken ) { return Task.FromResult( - Roles.SingleOrDefault( - r => String.Equals(r.NormalizedName, roleName, StringComparison.OrdinalIgnoreCase) + Roles.SingleOrDefault(r => + String.Equals(r.NormalizedName, roleName, StringComparison.OrdinalIgnoreCase) ) ); } @@ -202,8 +202,8 @@ public Task RemoveClaimAsync( CancellationToken cancellationToken = default(CancellationToken) ) { - var entity = role.Claims.FirstOrDefault( - ur => ur.RoleId == role.Id && ur.ClaimType == claim.Type && ur.ClaimValue == claim.Value + var entity = role.Claims.FirstOrDefault(ur => + ur.RoleId == role.Id && ur.ClaimType == claim.Type && ur.ClaimValue == claim.Value ); if (entity != null) { diff --git a/aspnetcore/src/Identity/test/InMemory.Test/InMemoryUserStore.cs b/aspnetcore/src/Identity/test/InMemory.Test/InMemoryUserStore.cs index 743f4535470..3fe333adf10 100644 --- a/aspnetcore/src/Identity/test/InMemory.Test/InMemoryUserStore.cs +++ b/aspnetcore/src/Identity/test/InMemory.Test/InMemoryUserStore.cs @@ -66,8 +66,8 @@ public Task ReplaceClaimAsync( CancellationToken cancellationToken = default(CancellationToken) ) { - var matchedClaims = user.Claims.Where( - uc => uc.ClaimValue == claim.Value && uc.ClaimType == claim.Type + var matchedClaims = user.Claims.Where(uc => + uc.ClaimValue == claim.Value && uc.ClaimType == claim.Type ) .ToList(); foreach (var matchedClaim in matchedClaims) @@ -86,11 +86,8 @@ public Task RemoveClaimsAsync( { foreach (var claim in claims) { - var entity = user.Claims.FirstOrDefault( - uc => - uc.UserId == user.Id - && uc.ClaimType == claim.Type - && uc.ClaimValue == claim.Value + var entity = user.Claims.FirstOrDefault(uc => + uc.UserId == user.Id && uc.ClaimType == claim.Type && uc.ClaimValue == claim.Value ); if (entity != null) { @@ -255,11 +252,8 @@ public Task RemoveLoginAsync( CancellationToken cancellationToken = default(CancellationToken) ) { - var loginEntity = user.Logins.SingleOrDefault( - l => - l.ProviderKey == providerKey - && l.LoginProvider == loginProvider - && l.UserId == user.Id + var loginEntity = user.Logins.SingleOrDefault(l => + l.ProviderKey == providerKey && l.LoginProvider == loginProvider && l.UserId == user.Id ); if (loginEntity != null) { @@ -274,9 +268,11 @@ public Task> GetLoginsAsync( CancellationToken cancellationToken = default(CancellationToken) ) { - IList result = user.Logins.Select( - l => new UserLoginInfo(l.LoginProvider, l.ProviderKey, l.ProviderDisplayName) - ) + IList result = user.Logins.Select(l => new UserLoginInfo( + l.LoginProvider, + l.ProviderKey, + l.ProviderDisplayName + )) .ToList(); return Task.FromResult(result); } @@ -515,8 +511,8 @@ public Task SetTokenAsync( CancellationToken cancellationToken ) { - var tokenEntity = user.Tokens.SingleOrDefault( - l => l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id + var tokenEntity = user.Tokens.SingleOrDefault(l => + l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id ); if (tokenEntity != null) { @@ -544,8 +540,8 @@ public Task RemoveTokenAsync( CancellationToken cancellationToken ) { - var tokenEntity = user.Tokens.SingleOrDefault( - l => l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id + var tokenEntity = user.Tokens.SingleOrDefault(l => + l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id ); if (tokenEntity != null) { @@ -561,8 +557,8 @@ public Task GetTokenAsync( CancellationToken cancellationToken ) { - var tokenEntity = user.Tokens.SingleOrDefault( - l => l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id + var tokenEntity = user.Tokens.SingleOrDefault(l => + l.TokenName == name && l.LoginProvider == loginProvider && l.UserId == user.Id ); return Task.FromResult(tokenEntity?.TokenValue); } diff --git a/aspnetcore/src/Identity/test/Shared/ApiConsistencyTestBase.cs b/aspnetcore/src/Identity/test/Shared/ApiConsistencyTestBase.cs index a7b1a806d1b..2a32e7333d4 100644 --- a/aspnetcore/src/Identity/test/Shared/ApiConsistencyTestBase.cs +++ b/aspnetcore/src/Identity/test/Shared/ApiConsistencyTestBase.cs @@ -15,8 +15,8 @@ from type in GetAllTypes(TargetAssembly.DefinedTypes) where type.IsVisible && !type.IsSealed - && type.DeclaredConstructors.Any( - c => c.IsPublic || c.IsFamily || c.IsFamilyOrAssembly + && type.DeclaredConstructors.Any(c => + c.IsPublic || c.IsFamily || c.IsFamilyOrAssembly ) && type.Namespace != null && !type.Namespace.EndsWith(".Compiled", StringComparison.Ordinal) diff --git a/aspnetcore/src/Logging.AzureAppServices/src/BlobLoggerProvider.cs b/aspnetcore/src/Logging.AzureAppServices/src/BlobLoggerProvider.cs index 4e7ba76bcbb..a7c5d471d10 100644 --- a/aspnetcore/src/Logging.AzureAppServices/src/BlobLoggerProvider.cs +++ b/aspnetcore/src/Logging.AzureAppServices/src/BlobLoggerProvider.cs @@ -35,8 +35,11 @@ public class BlobLoggerProvider : BatchingLoggerProvider public BlobLoggerProvider(IOptionsMonitor options) : this(options, null) { - _blobReferenceFactory = name => - new BlobAppendReferenceWrapper(options.CurrentValue.ContainerUrl, name, _httpClient); + _blobReferenceFactory = name => new BlobAppendReferenceWrapper( + options.CurrentValue.ContainerUrl, + name, + _httpClient + ); } /// diff --git a/aspnetcore/src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs b/aspnetcore/src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs index d4f6178b8c6..2136f3d7162 100644 --- a/aspnetcore/src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs +++ b/aspnetcore/src/Logging.AzureAppServices/test/AzureBlobSinkTests.cs @@ -21,8 +21,7 @@ public async Task WritesMessagesInBatches() { var blob = new Mock(); var buffers = new List(); - blob.Setup( - b => b.AppendAsync(It.IsAny>(), It.IsAny()) + blob.Setup(b => b.AppendAsync(It.IsAny>(), It.IsAny()) ) .Callback((ArraySegment s, CancellationToken ct) => buffers.Add(ToArray(s))) .Returns(Task.CompletedTask); @@ -70,8 +69,7 @@ public async Task GroupsByHour() var buffers = new List(); var names = new List(); - blob.Setup( - b => b.AppendAsync(It.IsAny>(), It.IsAny()) + blob.Setup(b => b.AppendAsync(It.IsAny>(), It.IsAny()) ) .Callback((ArraySegment s, CancellationToken ct) => buffers.Add(ToArray(s))) .Returns(Task.CompletedTask); diff --git a/aspnetcore/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/MigrationsEndPointMiddlewareTest.cs b/aspnetcore/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/MigrationsEndPointMiddlewareTest.cs index f165d0fc88e..736f7fbd3e1 100644 --- a/aspnetcore/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/MigrationsEndPointMiddlewareTest.cs +++ b/aspnetcore/src/Middleware/Diagnostics.EntityFrameworkCore/test/FunctionalTests/MigrationsEndPointMiddlewareTest.cs @@ -28,8 +28,7 @@ public async Task Non_migration_requests_pass_thru() { webHostBuilder .UseTestServer() - .Configure( - app => app.UseMigrationsEndPoint().UseMiddleware() + .Configure(app => app.UseMigrationsEndPoint().UseMiddleware() ); }) .Build(); @@ -291,12 +290,16 @@ public async Task Exception_while_applying_migrations() .Configure(app => app.UseMigrationsEndPoint()) .ConfigureServices(services => { - services.AddDbContext(optionsBuilder => - { - optionsBuilder.UseSqlite(database.ConnectionString); - }); - }); - }) + services.AddDbContext( + optionsBuilder => + { + optionsBuilder.UseSqlite(database.ConnectionString); + } + ); + } + ); + } + ) .Build(); await host.StartAsync(); diff --git a/aspnetcore/src/Middleware/Diagnostics/test/testassets/DatabaseErrorPageSample/Startup.cs b/aspnetcore/src/Middleware/Diagnostics/test/testassets/DatabaseErrorPageSample/Startup.cs index 52d43ff8169..07fc5e07211 100644 --- a/aspnetcore/src/Middleware/Diagnostics/test/testassets/DatabaseErrorPageSample/Startup.cs +++ b/aspnetcore/src/Middleware/Diagnostics/test/testassets/DatabaseErrorPageSample/Startup.cs @@ -9,8 +9,8 @@ public class Startup { public void ConfigureServices(IServiceCollection services) { - services.AddDbContext( - options => options.UseSqlite($"Data Source = DatabaseErrorPageSample.db") + services.AddDbContext(options => + options.UseSqlite($"Data Source = DatabaseErrorPageSample.db") ); } diff --git a/aspnetcore/src/Middleware/HealthChecks.EntityFrameworkCore/test/DbContextHealthCheckTest.cs b/aspnetcore/src/Middleware/HealthChecks.EntityFrameworkCore/test/DbContextHealthCheckTest.cs index d15ef939c89..7acde96d725 100644 --- a/aspnetcore/src/Middleware/HealthChecks.EntityFrameworkCore/test/DbContextHealthCheckTest.cs +++ b/aspnetcore/src/Middleware/HealthChecks.EntityFrameworkCore/test/DbContextHealthCheckTest.cs @@ -149,8 +149,8 @@ private static IServiceProvider CreateServices( ) { var serviceCollection = new ServiceCollection(); - serviceCollection.AddDbContext( - o => o.UseInMemoryDatabase("Test" + Interlocked.Increment(ref _testDbCounter)) + serviceCollection.AddDbContext(o => + o.UseInMemoryDatabase("Test" + Interlocked.Increment(ref _testDbCounter)) ); var builder = serviceCollection.AddHealthChecks(); diff --git a/aspnetcore/src/Middleware/HealthChecks/test/UnitTests/HealthCheckMiddlewareTests.cs b/aspnetcore/src/Middleware/HealthChecks/test/UnitTests/HealthCheckMiddlewareTests.cs index 1e2e1124708..08c5a15d6fe 100644 --- a/aspnetcore/src/Middleware/HealthChecks/test/UnitTests/HealthCheckMiddlewareTests.cs +++ b/aspnetcore/src/Middleware/HealthChecks/test/UnitTests/HealthCheckMiddlewareTests.cs @@ -785,15 +785,14 @@ public async Task CanListenOnPort_AcceptsRequest_OnSpecifiedPort() .UseTestServer() .Configure(app => { - app.Use( - next => - async (context) => - { - // Need to fake setting the connection info. TestServer doesn't - // do that, because it doesn't have a connection. - context.Connection.LocalPort = context.Request.Host.Port.Value; - await next(context); - } + app.Use(next => + async (context) => + { + // Need to fake setting the connection info. TestServer doesn't + // do that, because it doesn't have a connection. + context.Connection.LocalPort = context.Request.Host.Port.Value; + await next(context); + } ); app.UseHealthChecks("/health", port: 5001); @@ -827,15 +826,14 @@ public async Task CanListenOnPortWithoutPath_AcceptsRequest_OnSpecifiedPort() .UseTestServer() .Configure(app => { - app.Use( - next => - async (context) => - { - // Need to fake setting the connection info. TestServer doesn't - // do that, because it doesn't have a connection. - context.Connection.LocalPort = context.Request.Host.Port.Value; - await next(context); - } + app.Use(next => + async (context) => + { + // Need to fake setting the connection info. TestServer doesn't + // do that, because it doesn't have a connection. + context.Connection.LocalPort = context.Request.Host.Port.Value; + await next(context); + } ); app.UseHealthChecks(default, port: 5001); @@ -869,15 +867,14 @@ public async Task CanListenOnPort_RejectsRequest_OnOtherPort() .UseTestServer() .Configure(app => { - app.Use( - next => - async (context) => - { - // Need to fake setting the connection info. TestServer doesn't - // do that, because it doesn't have a connection. - context.Connection.LocalPort = context.Request.Host.Port.Value; - await next(context); - } + app.Use(next => + async (context) => + { + // Need to fake setting the connection info. TestServer doesn't + // do that, because it doesn't have a connection. + context.Connection.LocalPort = context.Request.Host.Port.Value; + await next(context); + } ); app.UseHealthChecks("/health", port: 5001); @@ -909,15 +906,14 @@ public async Task CanListenOnPort_MultipleMiddleware() .UseTestServer() .Configure(app => { - app.Use( - next => - async (context) => - { - // Need to fake setting the connection info. TestServer doesn't - // do that, because it doesn't have a connection. - context.Connection.LocalPort = context.Request.Host.Port.Value; - await next(context); - } + app.Use(next => + async (context) => + { + // Need to fake setting the connection info. TestServer doesn't + // do that, because it doesn't have a connection. + context.Connection.LocalPort = context.Request.Host.Port.Value; + await next(context); + } ); // Throws if used @@ -958,15 +954,14 @@ public async Task CanListenOnPort_MultipleMiddleware_DifferentPorts() .UseTestServer() .Configure(app => { - app.Use( - next => - async (context) => - { - // Need to fake setting the connection info. TestServer doesn't - // do that, because it doesn't have a connection. - context.Connection.LocalPort = context.Request.Host.Port.Value; - await next(context); - } + app.Use(next => + async (context) => + { + // Need to fake setting the connection info. TestServer doesn't + // do that, because it doesn't have a connection. + context.Connection.LocalPort = context.Request.Host.Port.Value; + await next(context); + } ); // Throws if used diff --git a/aspnetcore/src/Middleware/HttpLogging/test/HttpLoggingMiddlewareTests.cs b/aspnetcore/src/Middleware/HttpLogging/test/HttpLoggingMiddlewareTests.cs index 0299e57ebb3..5aff8c9ecec 100644 --- a/aspnetcore/src/Middleware/HttpLogging/test/HttpLoggingMiddlewareTests.cs +++ b/aspnetcore/src/Middleware/HttpLogging/test/HttpLoggingMiddlewareTests.cs @@ -2155,8 +2155,8 @@ private static DefaultHttpContext CreateRequest() private IOptionsMonitor CreateOptionsAccessor() { var options = new HttpLoggingOptions(); - var optionsAccessor = Mock.Of>( - o => o.CurrentValue == options + var optionsAccessor = Mock.Of>(o => + o.CurrentValue == options ); return optionsAccessor; } diff --git a/aspnetcore/src/Middleware/HttpOverrides/test/CertificateForwardingTest.cs b/aspnetcore/src/Middleware/HttpOverrides/test/CertificateForwardingTest.cs index 8e05466331e..9f2e5a5e1dd 100644 --- a/aspnetcore/src/Middleware/HttpOverrides/test/CertificateForwardingTest.cs +++ b/aspnetcore/src/Middleware/HttpOverrides/test/CertificateForwardingTest.cs @@ -146,8 +146,8 @@ public async Task VerifySettingTheAzureHeaderOnTheForwarderOptionsWorks() .UseTestServer() .ConfigureServices(services => { - services.AddCertificateForwarding( - options => options.CertificateHeader = "X-ARR-ClientCert" + services.AddCertificateForwarding(options => + options.CertificateHeader = "X-ARR-ClientCert" ); }) .Configure(app => @@ -196,8 +196,8 @@ public async Task VerifyACustomHeaderFailsIfTheHeaderIsNotPresent() .UseTestServer() .ConfigureServices(services => { - services.AddCertificateForwarding( - options => options.CertificateHeader = "some-random-header" + services.AddCertificateForwarding(options => + options.CertificateHeader = "some-random-header" ); }) .Configure(app => diff --git a/aspnetcore/src/Middleware/Localization/sample/Startup.cs b/aspnetcore/src/Middleware/Localization/sample/Startup.cs index 1e48c31fedd..784e536dbe2 100644 --- a/aspnetcore/src/Middleware/Localization/sample/Startup.cs +++ b/aspnetcore/src/Middleware/Localization/sample/Startup.cs @@ -27,12 +27,11 @@ public void Configure(IApplicationBuilder app, IStringLocalizer SR) "zh", "zh-CN" }; - app.UseRequestLocalization( - options => - options - .AddSupportedCultures(supportedCultures) - .AddSupportedUICultures(supportedCultures) - .SetDefaultCulture(supportedCultures[0]) + app.UseRequestLocalization(options => + options + .AddSupportedCultures(supportedCultures) + .AddSupportedUICultures(supportedCultures) + .SetDefaultCulture(supportedCultures[0]) // Optionally create an app-specific provider with just a delegate, e.g. look up user preference from DB. //.AddRequestCultureProvider(new CustomRequestCultureProvider(async context => //{ diff --git a/aspnetcore/src/Middleware/Localization/test/UnitTests/RequestLocalizationOptionsExtensionsTest.cs b/aspnetcore/src/Middleware/Localization/test/UnitTests/RequestLocalizationOptionsExtensionsTest.cs index df052faa91e..6aafd150548 100644 --- a/aspnetcore/src/Middleware/Localization/test/UnitTests/RequestLocalizationOptionsExtensionsTest.cs +++ b/aspnetcore/src/Middleware/Localization/test/UnitTests/RequestLocalizationOptionsExtensionsTest.cs @@ -12,8 +12,8 @@ public void AddInitialRequestCultureProvider_ShouldBeInsertedAtFirstPostion() { // Arrange var options = new RequestLocalizationOptions(); - var provider = new CustomRequestCultureProvider( - context => Task.FromResult(new ProviderCultureResult("ar-YE")) + var provider = new CustomRequestCultureProvider(context => + Task.FromResult(new ProviderCultureResult("ar-YE")) ); // Act diff --git a/aspnetcore/src/Middleware/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis/test/OutputCacheServiceExtensionsTests.cs b/aspnetcore/src/Middleware/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis/test/OutputCacheServiceExtensionsTests.cs index 2ddeb5b515f..4826c69fabf 100644 --- a/aspnetcore/src/Middleware/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis/test/OutputCacheServiceExtensionsTests.cs +++ b/aspnetcore/src/Middleware/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis/test/OutputCacheServiceExtensionsTests.cs @@ -20,8 +20,8 @@ public void AddStackExchangeRedisOutputCache_RegistersOutputCacheStoreAsSingleto services.AddStackExchangeRedisOutputCache(options => { }); // Assert - var outputCacheStore = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IOutputCacheStore) + var outputCacheStore = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IOutputCacheStore) ); Assert.NotNull(outputCacheStore); @@ -41,8 +41,8 @@ public void AddStackExchangeRedisOutputCache_ReplacesPreviouslyUserRegisteredSer // Assert var serviceProvider = services.BuildServiceProvider(); - var distributedCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IOutputCacheStore) + var distributedCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IOutputCacheStore) ); Assert.NotNull(distributedCache); @@ -116,8 +116,8 @@ public void AddStackExchangeRedisOutputCache_UsesLoggerFactoryAlreadyRegisteredW // Assert var serviceProvider = services.BuildServiceProvider(); - var distributedCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IOutputCacheStore) + var distributedCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IOutputCacheStore) ); Assert.NotNull(distributedCache); diff --git a/aspnetcore/src/Middleware/OutputCaching/samples/OutputCachingSample/Startup.cs b/aspnetcore/src/Middleware/OutputCaching/samples/OutputCachingSample/Startup.cs index 54cc3cc9613..1ceee367ed0 100644 --- a/aspnetcore/src/Middleware/OutputCaching/samples/OutputCachingSample/Startup.cs +++ b/aspnetcore/src/Middleware/OutputCaching/samples/OutputCachingSample/Startup.cs @@ -9,14 +9,13 @@ builder.Services.AddOutputCache(options => { // Define policies for all requests which are not configured per endpoint or per request - options.AddBasePolicy( - builder => - builder - .With(c => c.HttpContext.Request.Path.StartsWithSegments("/js")) - .Expire(TimeSpan.FromDays(1)) + options.AddBasePolicy(builder => + builder + .With(c => c.HttpContext.Request.Path.StartsWithSegments("/js")) + .Expire(TimeSpan.FromDays(1)) ); - options.AddBasePolicy( - builder => builder.With(c => c.HttpContext.Request.Path.StartsWithSegments("/js")).NoCache() + options.AddBasePolicy(builder => + builder.With(c => c.HttpContext.Request.Path.StartsWithSegments("/js")).NoCache() ); options.AddPolicy("NoCache", b => b.NoCache()); @@ -58,15 +57,14 @@ app.MapGet("/query", Gravatar.WriteGravatar).CacheOutput(p => p.SetVaryByQuery("culture")); app.MapGet("/vary", Gravatar.WriteGravatar) - .CacheOutput( - c => - c.VaryByValue( - (context) => - new KeyValuePair( - "time", - (DateTime.Now.Second % 2).ToString(CultureInfo.InvariantCulture) - ) - ) + .CacheOutput(c => + c.VaryByValue( + (context) => + new KeyValuePair( + "time", + (DateTime.Now.Second % 2).ToString(CultureInfo.InvariantCulture) + ) + ) ); long requests = 0; diff --git a/aspnetcore/src/Middleware/RateLimiting/samples/RateLimitingSample/SampleRateLimiterPolicy.cs b/aspnetcore/src/Middleware/RateLimiting/samples/RateLimitingSample/SampleRateLimiterPolicy.cs index 1e957ac07f6..fba483c67b5 100644 --- a/aspnetcore/src/Middleware/RateLimiting/samples/RateLimitingSample/SampleRateLimiterPolicy.cs +++ b/aspnetcore/src/Middleware/RateLimiting/samples/RateLimitingSample/SampleRateLimiterPolicy.cs @@ -30,15 +30,14 @@ public RateLimitPartition GetPartition(HttpContext httpContext) { return RateLimitPartition.GetSlidingWindowLimiter( string.Empty, - key => - new SlidingWindowRateLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.OldestFirst, - QueueLimit = 1, - Window = TimeSpan.FromSeconds(5), - SegmentsPerWindow = 1 - } + key => new SlidingWindowRateLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.OldestFirst, + QueueLimit = 1, + Window = TimeSpan.FromSeconds(5), + SegmentsPerWindow = 1 + } ); } } diff --git a/aspnetcore/src/Middleware/ResponseCaching/src/FastGuid.cs b/aspnetcore/src/Middleware/ResponseCaching/src/FastGuid.cs index a66b2a3c905..749ce3a60d1 100644 --- a/aspnetcore/src/Middleware/ResponseCaching/src/FastGuid.cs +++ b/aspnetcore/src/Middleware/ResponseCaching/src/FastGuid.cs @@ -6,8 +6,9 @@ namespace Microsoft.AspNetCore.ResponseCaching; internal sealed class FastGuid { // Base32 encoding - in ascii sort order for easy text based sorting - private static readonly char[] s_encode32Chars = - "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray(); + private static readonly char[] s_encode32Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray( + + ); // Global ID private static long NextId = InitializeNextId(); diff --git a/aspnetcore/src/Middleware/ResponseCaching/test/ResponseCachingTests.cs b/aspnetcore/src/Middleware/ResponseCaching/test/ResponseCachingTests.cs index 1d9b50a2820..f0aa0248bac 100644 --- a/aspnetcore/src/Middleware/ResponseCaching/test/ResponseCachingTests.cs +++ b/aspnetcore/src/Middleware/ResponseCaching/test/ResponseCachingTests.cs @@ -298,8 +298,8 @@ public async Task ServesFreshContent_If_Authorization_HeaderExists(string method [Fact] public async Task ServesCachedContent_IfVaryHeader_Matches() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.Vary = HeaderNames.From + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.Vary = HeaderNames.From ); foreach (var builder in builders) @@ -323,8 +323,8 @@ public async Task ServesCachedContent_IfVaryHeader_Matches() [Fact] public async Task ServesFreshContent_IfVaryHeader_Mismatches() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.Vary = HeaderNames.From + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.Vary = HeaderNames.From ); foreach (var builder in builders) @@ -349,9 +349,8 @@ public async Task ServesFreshContent_IfVaryHeader_Mismatches() [Fact] public async Task ServesCachedContent_IfVaryQueryKeys_Matches() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] { "query" } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] { "query" } ); foreach (var builder in builders) @@ -374,13 +373,12 @@ public async Task ServesCachedContent_IfVaryQueryKeys_Matches() [Fact] public async Task ServesCachedContent_IfVaryQueryKeysExplicit_Matches_QueryKeyCaseInsensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] - { - "QueryA", - "queryb" - } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] + { + "QueryA", + "queryb" + } ); foreach (var builder in builders) @@ -403,9 +401,8 @@ public async Task ServesCachedContent_IfVaryQueryKeysExplicit_Matches_QueryKeyCa [Fact] public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_QueryKeyCaseInsensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] { "*" } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] { "*" } ); foreach (var builder in builders) @@ -428,13 +425,12 @@ public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_QueryKeyCaseIns [Fact] public async Task ServesCachedContent_IfVaryQueryKeyExplicit_Matches_OrderInsensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] - { - "QueryB", - "QueryA" - } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] + { + "QueryB", + "QueryA" + } ); foreach (var builder in builders) @@ -457,9 +453,8 @@ public async Task ServesCachedContent_IfVaryQueryKeyExplicit_Matches_OrderInsens [Fact] public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_OrderInsensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] { "*" } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] { "*" } ); foreach (var builder in builders) @@ -482,9 +477,8 @@ public async Task ServesCachedContent_IfVaryQueryKeyStar_Matches_OrderInsensitiv [Fact] public async Task ServesFreshContent_IfVaryQueryKey_Mismatches() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] { "query" } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] { "query" } ); foreach (var builder in builders) @@ -507,13 +501,12 @@ public async Task ServesFreshContent_IfVaryQueryKey_Mismatches() [Fact] public async Task ServesFreshContent_IfVaryQueryKeyExplicit_Mismatch_QueryKeyCaseSensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] - { - "QueryA", - "QueryB" - } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] + { + "QueryA", + "QueryB" + } ); foreach (var builder in builders) @@ -536,9 +529,8 @@ public async Task ServesFreshContent_IfVaryQueryKeyExplicit_Mismatch_QueryKeyCas [Fact] public async Task ServesFreshContent_IfVaryQueryKeyStar_Mismatch_QueryKeyValueCaseSensitive() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Features.Get().VaryByQueryKeys = new[] { "*" } + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Features.Get().VaryByQueryKeys = new[] { "*" } ); foreach (var builder in builders) @@ -616,8 +608,8 @@ public async Task Serves504_IfOnlyIfCachedHeader_IsSpecified() [Fact] public async Task ServesFreshContent_IfSetCookie_IsSpecified() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.SetCookie = "cookieName=cookieValue" + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.SetCookie = "cookieName=cookieValue" ); foreach (var builder in builders) @@ -688,9 +680,8 @@ public async Task ServesFreshContent_IfInitialRequestContainsNoStore() [Fact] public async Task ServesFreshContent_IfInitialResponseContainsNoStore() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.CacheControl = CacheControlHeaderValue.NoStoreString ); foreach (var builder in builders) @@ -798,9 +789,8 @@ public async Task Serves304_IfIfNoneMatch_Satisfied() [Fact] public async Task ServesCachedContent_IfIfNoneMatch_NotSatisfied() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => - context.Response.GetTypedHeaders().ETag = new EntityTagHeaderValue("\"E1\"") + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.GetTypedHeaders().ETag = new EntityTagHeaderValue("\"E1\"") ); foreach (var builder in builders) @@ -898,8 +888,8 @@ public async Task ServesFreshContent_CaseSensitivePaths_IsNotCacheable() [Fact] public async Task ServesCachedContent_WithoutReplacingCachedVaryBy_OnCacheMiss() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.Vary = HeaderNames.From + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.Vary = HeaderNames.From ); foreach (var builder in builders) @@ -926,8 +916,8 @@ public async Task ServesCachedContent_WithoutReplacingCachedVaryBy_OnCacheMiss() [Fact] public async Task ServesFreshContent_IfCachedVaryByUpdated_OnCacheMiss() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.Vary = context.Request.Headers.Pragma + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.Vary = context.Request.Headers.Pragma ); foreach (var builder in builders) @@ -969,8 +959,8 @@ public async Task ServesFreshContent_IfCachedVaryByUpdated_OnCacheMiss() [Fact] public async Task ServesCachedContent_IfCachedVaryByNotUpdated_OnCacheMiss() { - var builders = TestUtils.CreateBuildersWithResponseCaching( - contextAction: context => context.Response.Headers.Vary = context.Request.Headers.Pragma + var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => + context.Response.Headers.Vary = context.Request.Headers.Pragma ); foreach (var builder in builders) diff --git a/aspnetcore/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs b/aspnetcore/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs index 72315ad1900..726a7e88380 100644 --- a/aspnetcore/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs +++ b/aspnetcore/src/Middleware/Rewrite/test/IISUrlRewrite/MiddleWareTests.cs @@ -38,9 +38,8 @@ public async Task Invoke_RedirectPathToPathAndQuery() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync(context.Response.Headers.Location) + app.Run(context => + context.Response.WriteAsync(context.Response.Headers.Location) ); }); }) @@ -78,11 +77,10 @@ public async Task Invoke_RewritePathToPathAndQuery() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) @@ -124,11 +122,10 @@ public async Task Invoke_RewriteBasedOnQueryStringParameters() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) @@ -166,9 +163,8 @@ public async Task Invoke_RedirectToLowerCase() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync(context.Response.Headers.Location) + app.Run(context => + context.Response.WriteAsync(context.Response.Headers.Location) ); }); }) @@ -328,15 +324,14 @@ public async Task Invoke_RewriteToHttps() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -374,15 +369,14 @@ public async Task Invoke_ReverseProxyToAnotherSite() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -420,15 +414,14 @@ public async Task Invoke_CaptureEmptyStringInRegexAssertRedirectLocationHasForwa .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -466,11 +459,10 @@ public async Task Invoke_CaptureEmptyStringInRegexAssertRewriteLocationHasForwar .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) @@ -508,11 +500,10 @@ public async Task Invoke_CaptureEmptyStringInRegexAssertLocationHeaderContainsPa .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) @@ -731,8 +722,8 @@ public async Task Invoke_GlobalRuleConditionMatchesAgainstFullUri_ParsedRule() .Configure(app => { app.UseRewriter(options); - app.Run( - context => context.Response.WriteAsync(context.Request.GetEncodedUrl()) + app.Run(context => + context.Response.WriteAsync(context.Request.GetEncodedUrl()) ); }); }) @@ -788,8 +779,8 @@ string expectedRewrittenUri .Configure(app => { app.UseRewriter(options); - app.Run( - context => context.Response.WriteAsync(context.Request.GetEncodedUrl()) + app.Run(context => + context.Response.WriteAsync(context.Request.GetEncodedUrl()) ); }); }) @@ -885,8 +876,8 @@ int uriMatchPart .Configure(app => { app.UseRewriter(options); - app.Run( - context => context.Response.WriteAsync(context.Request.GetEncodedUrl()) + app.Run(context => + context.Response.WriteAsync(context.Request.GetEncodedUrl()) ); }); }) diff --git a/aspnetcore/src/Middleware/Rewrite/test/MiddlewareTests.cs b/aspnetcore/src/Middleware/Rewrite/test/MiddlewareTests.cs index d4713dfe340..2d61dbbd6ab 100644 --- a/aspnetcore/src/Middleware/Rewrite/test/MiddlewareTests.cs +++ b/aspnetcore/src/Middleware/Rewrite/test/MiddlewareTests.cs @@ -29,15 +29,14 @@ public async Task CheckRewritePath() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -68,15 +67,14 @@ public async Task CheckRewritePathWithSkipRemaining() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -105,15 +103,14 @@ public async Task CheckRewritePath_MultipleRulesWithSkipRemaining() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -142,15 +139,14 @@ public async Task CheckRewritePath_MultipleRules() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Scheme - + "://" - + context.Request.Host - + context.Request.Path - + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Scheme + + "://" + + context.Request.Host + + context.Request.Path + + context.Request.QueryString + ) ); }); }) @@ -801,11 +797,10 @@ public async Task CheckIfEmptyStringRewriteCorrectly() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) @@ -832,11 +827,10 @@ public async Task SettingPathBase() .Configure(app => { app.UseRewriter(options); - app.Run( - context => - context.Response.WriteAsync( - context.Request.Path + context.Request.QueryString - ) + app.Run(context => + context.Response.WriteAsync( + context.Request.Path + context.Request.QueryString + ) ); }); }) diff --git a/aspnetcore/src/Middleware/Spa/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs b/aspnetcore/src/Middleware/Spa/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs index dd8f86e689f..d986f4fbe3d 100644 --- a/aspnetcore/src/Middleware/Spa/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs +++ b/aspnetcore/src/Middleware/Spa/SpaServices.Extensions/src/AngularCli/AngularCliBuilder.cs @@ -55,8 +55,9 @@ public async Task Build(ISpaBuilder spaBuilder) .ApplicationServices.GetRequiredService() .ApplicationStopping; var logger = LoggerFinder.GetOrCreateLogger(appBuilder, nameof(AngularCliBuilder)); - var diagnosticSource = - appBuilder.ApplicationServices.GetRequiredService(); + var diagnosticSource = appBuilder.ApplicationServices.GetRequiredService( + + ); var scriptRunner = new NodeScriptRunner( sourcePath, _scriptName, diff --git a/aspnetcore/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs b/aspnetcore/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs index be14cb5c9ca..228842b0b5c 100644 --- a/aspnetcore/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs +++ b/aspnetcore/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs @@ -62,26 +62,23 @@ public async Task Endpoint_PassesThrough() // Routing first => static files noops app.UseRouting(); - app.Use( - next => - context => - { - // Assign an endpoint, this will make the default files noop. - context.SetEndpoint( - new Endpoint( - (c) => - { - return context.Response.WriteAsync( - "Hi from endpoint." - ); - }, - new EndpointMetadataCollection(), - "test" - ) - ); - - return next(context); - } + app.Use(next => + context => + { + // Assign an endpoint, this will make the default files noop. + context.SetEndpoint( + new Endpoint( + (c) => + { + return context.Response.WriteAsync("Hi from endpoint."); + }, + new EndpointMetadataCollection(), + "test" + ) + ); + + return next(context); + } ); app.UseStaticFiles(); @@ -169,11 +166,10 @@ private async Task FoundFile_Served(string baseUrl, string baseDir, string reque .UseKestrel() .UseUrls(TestUrlHelper.GetTestUrl(ServerType.Kestrel)) .UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir)) - .Configure( - app => - app.UseStaticFiles( - new StaticFileOptions { RequestPath = new PathString(baseUrl), } - ) + .Configure(app => + app.UseStaticFiles( + new StaticFileOptions { RequestPath = new PathString(baseUrl), } + ) ); }) .Build(); @@ -220,11 +216,10 @@ string requestUrl .UseKestrel() .UseUrls(TestUrlHelper.GetTestUrl(ServerType.Kestrel)) .UseWebRoot(Path.Combine(AppContext.BaseDirectory, baseDir)) - .Configure( - app => - app.UseStaticFiles( - new StaticFileOptions { RequestPath = new PathString(baseUrl), } - ) + .Configure(app => + app.UseStaticFiles( + new StaticFileOptions { RequestPath = new PathString(baseUrl), } + ) ); }) .Build(); diff --git a/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/DirectoryBrowserMiddlewareTests.cs b/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/DirectoryBrowserMiddlewareTests.cs index 8150cb2a27b..1912a9aecff 100644 --- a/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/DirectoryBrowserMiddlewareTests.cs +++ b/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/DirectoryBrowserMiddlewareTests.cs @@ -131,26 +131,24 @@ public async Task Endpoint_With_RequestDelegate_PassesThrough() { app.UseRouting(); - app.Use( - next => - context => - { - // Assign an endpoint, this will make the directory browser noop - context.SetEndpoint( - new Endpoint( - (c) => - { - c.Response.StatusCode = (int) - HttpStatusCode.NotAcceptable; - return c.Response.WriteAsync("Hi from endpoint."); - }, - new EndpointMetadataCollection(), - "test" - ) - ); - - return next(context); - } + app.Use(next => + context => + { + // Assign an endpoint, this will make the directory browser noop + context.SetEndpoint( + new Endpoint( + (c) => + { + c.Response.StatusCode = (int)HttpStatusCode.NotAcceptable; + return c.Response.WriteAsync("Hi from endpoint."); + }, + new EndpointMetadataCollection(), + "test" + ) + ); + + return next(context); + } ); app.UseDirectoryBrowser( @@ -189,21 +187,20 @@ public async Task Endpoint_With_Null_RequestDelegate_Does_Not_PassThrough() { app.UseRouting(); - app.Use( - next => - context => - { - // Assign an endpoint with a null RequestDelegate, the directory browser should still run - context.SetEndpoint( - new Endpoint( - requestDelegate: null, - new EndpointMetadataCollection(), - "test" - ) - ); - - return next(context); - } + app.Use(next => + context => + { + // Assign an endpoint with a null RequestDelegate, the directory browser should still run + context.SetEndpoint( + new Endpoint( + requestDelegate: null, + new EndpointMetadataCollection(), + "test" + ) + ); + + return next(context); + } ); app.UseDirectoryBrowser( diff --git a/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/StaticFileMiddlewareTests.cs b/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/StaticFileMiddlewareTests.cs index fc239d97793..41766c36e22 100644 --- a/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/StaticFileMiddlewareTests.cs +++ b/aspnetcore/src/Middleware/StaticFiles/test/UnitTests/StaticFileMiddlewareTests.cs @@ -64,11 +64,10 @@ public async Task ReturnsNotFoundForBrokenSymlink() { webHostBuilder .UseTestServer() - .Configure( - app => - app.UseStaticFiles( - new StaticFileOptions { ServeUnknownFileTypes = true } - ) + .Configure(app => + app.UseStaticFiles( + new StaticFileOptions { ServeUnknownFileTypes = true } + ) ) .UseWebRoot(AppContext.BaseDirectory); }) @@ -94,14 +93,13 @@ public async Task ReturnsNotFoundIfSendFileThrows() { var mockSendFile = new Mock(); mockSendFile - .Setup( - m => - m.SendFileAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.SendFileAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .ThrowsAsync(new FileNotFoundException()); mockSendFile.Setup(m => m.Stream).Returns(Stream.Null); @@ -141,8 +139,8 @@ public async Task FoundFile_LastModifiedTrimsSeconds() { using (var fileProvider = new PhysicalFileProvider(AppContext.BaseDirectory)) { - using var host = await StaticFilesTestServer.Create( - app => app.UseStaticFiles(new StaticFileOptions { FileProvider = fileProvider }) + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles(new StaticFileOptions { FileProvider = fileProvider }) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo("TestDocument.txt"); @@ -168,21 +166,20 @@ public async Task NullArguments() { // No exception, default provided using ( - await StaticFilesTestServer.Create( - app => app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = null }) + await StaticFilesTestServer.Create(app => + app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = null }) ) ) { } // No exception, default provided using ( - await StaticFilesTestServer.Create( - app => app.UseStaticFiles(new StaticFileOptions { FileProvider = null }) + await StaticFilesTestServer.Create(app => + app.UseStaticFiles(new StaticFileOptions { FileProvider = null }) ) ) { } // PathString(null) is OK. - using var host = await StaticFilesTestServer.Create( - app => app.UseStaticFiles((string)null) + using var host = await StaticFilesTestServer.Create(app => app.UseStaticFiles((string)null) ); using var server = host.GetTestServer(); var response = await server.CreateClient().GetAsync("/"); @@ -216,15 +213,14 @@ private async Task FoundFile_Served(string baseUrl, string baseDir, string reque ) ) { - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions - { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider - } - ) + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider + } + ) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(requestUrl)); @@ -258,19 +254,18 @@ public async Task OnPrepareResponse_Executed_Test() using var fileProvider = new PhysicalFileProvider( Path.Combine(AppContext.BaseDirectory, baseDir) ); - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider, + OnPrepareResponse = context => { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider, - OnPrepareResponse = context => - { - onPrepareResponseExecuted = true; - } + onPrepareResponseExecuted = true; } - ) + } + ) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(requestUrl)); @@ -305,21 +300,20 @@ public async Task OnPrepareResponseAsync_Executed_Test() using var fileProvider = new PhysicalFileProvider( Path.Combine(AppContext.BaseDirectory, baseDir) ); - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider, + OnPrepareResponseAsync = context => { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider, - OnPrepareResponseAsync = context => - { - onPrepareResponseExecuted = true; + onPrepareResponseExecuted = true; - return Task.CompletedTask; - } + return Task.CompletedTask; } - ) + } + ) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(requestUrl)); @@ -355,28 +349,27 @@ public async Task OnPrepareResponse_Execution_Order_Test() using var fileProvider = new PhysicalFileProvider( Path.Combine(AppContext.BaseDirectory, baseDir) ); - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider, + OnPrepareResponse = context => { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider, - OnPrepareResponse = context => - { - Assert.False(syncCallbackInvoked); - Assert.False(asyncCallbackInvoked); - syncCallbackInvoked = true; - }, - OnPrepareResponseAsync = context => - { - Assert.True(syncCallbackInvoked); - Assert.False(asyncCallbackInvoked); - asyncCallbackInvoked = true; - return Task.CompletedTask; - } + Assert.False(syncCallbackInvoked); + Assert.False(asyncCallbackInvoked); + syncCallbackInvoked = true; + }, + OnPrepareResponseAsync = context => + { + Assert.True(syncCallbackInvoked); + Assert.False(asyncCallbackInvoked); + asyncCallbackInvoked = true; + return Task.CompletedTask; } - ) + } + ) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(requestUrl)); @@ -518,13 +511,12 @@ public async Task OverrideDefaultStatusCode() { using var host = await StaticFilesTestServer.Create(app => { - app.Use( - next => - context => - { - context.Response.StatusCode = StatusCodes.Status200OK; - return next(context); - } + app.Use(next => + context => + { + context.Response.StatusCode = StatusCodes.Status200OK; + return next(context); + } ); app.UseStaticFiles(); }); @@ -549,13 +541,12 @@ public async Task DontOverrideNonDefaultStatusCode() using var host = await StaticFilesTestServer.Create(app => { - app.Use( - next => - context => - { - context.Response.StatusCode = (int)errorCode; - return next(context); - } + app.Use(next => + context => + { + context.Response.StatusCode = (int)errorCode; + return next(context); + } ); app.UseStaticFiles( @@ -586,15 +577,14 @@ string requestUrl ) ) { - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions - { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider - } - ) + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider + } + ) ); using var server = host.GetTestServer(); var fileInfo = fileProvider.GetFileInfo(Path.GetFileName(requestUrl)); @@ -678,15 +668,14 @@ string requestUrl ) ) { - using var host = await StaticFilesTestServer.Create( - app => - app.UseStaticFiles( - new StaticFileOptions - { - RequestPath = new PathString(baseUrl), - FileProvider = fileProvider - } - ) + using var host = await StaticFilesTestServer.Create(app => + app.UseStaticFiles( + new StaticFileOptions + { + RequestPath = new PathString(baseUrl), + FileProvider = fileProvider + } + ) ); using var server = host.GetTestServer(); var response = await server.CreateRequest(requestUrl).SendAsync(method); diff --git a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/AddResponseTypeAttributeCodeFixAction.cs b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/AddResponseTypeAttributeCodeFixAction.cs index 6b7e20457e8..7cfa4c21d22 100644 --- a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/AddResponseTypeAttributeCodeFixAction.cs +++ b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/AddResponseTypeAttributeCodeFixAction.cs @@ -112,10 +112,9 @@ out addUsing } if ( - !declaredResponseMetadata.Any( - m => - m.IsDefault - && SymbolEqualityComparer.Default.Equals(m.AttributeSource, context.Method) + !declaredResponseMetadata.Any(m => + m.IsDefault + && SymbolEqualityComparer.Default.Equals(m.AttributeSource, context.Method) ) ) { diff --git a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/ApiConventionAnalyzer.cs b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/ApiConventionAnalyzer.cs index 9d9a9237d91..09bba55f9e9 100644 --- a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/ApiConventionAnalyzer.cs +++ b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/src/ApiConventionAnalyzer.cs @@ -65,8 +65,9 @@ out var actualResponseMetadata var hasUndocumentedStatusCodes = false; foreach (var actualMetadata in actualResponseMetadata) { - var location = - actualMetadata.ReturnOperation.ReturnedValue.Syntax.GetLocation(); + var location = actualMetadata.ReturnOperation.ReturnedValue.Syntax.GetLocation( + + ); if ( !DeclaredApiResponseMetadata.Contains( diff --git a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs index 94e315732b2..dd5a484b90c 100644 --- a/aspnetcore/src/Mvc/Mvc.Api.Analyzers/test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs +++ b/aspnetcore/src/Mvc/Mvc.Api.Analyzers/test/TestFiles/ApiConventionAnalyzerIntegrationTest/DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentation.cs @@ -22,7 +22,9 @@ public async Task< } return /*MM*/ - new DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentationModel(); + new DiagnosticsAreReturned_IfMethodWithAttributeAsynchronouslyReturnsValue_WithoutDocumentationModel( + + ); } } diff --git a/aspnetcore/src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs b/aspnetcore/src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs index 14913db1ee8..a3b8d0bbd07 100644 --- a/aspnetcore/src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ApiExplorer/test/EndpointMetadataApiDescriptionProviderTest.cs @@ -102,13 +102,15 @@ public void AddsMultipleRequestFormatsFromMetadata() [Fact] public void AddsMultipleRequestFormatsFromMetadataWithRequestTypeAndOptionalBodyParameter() { - var apiDescription = GetApiDescription([Consumes( - typeof(InferredJsonClass), - "application/custom0", - "application/custom1", - IsOptional = true - )] - () => { }); + var apiDescription = GetApiDescription( + [Consumes( + typeof(InferredJsonClass), + "application/custom0", + "application/custom1", + IsOptional = true + )] + () => { } + ); Assert.Equal(2, apiDescription.SupportedRequestFormats.Count); diff --git a/aspnetcore/src/Mvc/Mvc.Core/src/ApplicationParts/ApplicationPartFactory.cs b/aspnetcore/src/Mvc/Mvc.Core/src/ApplicationParts/ApplicationPartFactory.cs index f0ec241e44e..3e6a57073d9 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/src/ApplicationParts/ApplicationPartFactory.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/src/ApplicationParts/ApplicationPartFactory.cs @@ -36,8 +36,9 @@ public static ApplicationPartFactory GetApplicationPartFactory(Assembly assembly { ArgumentNullException.ThrowIfNull(assembly); - var provideAttribute = - assembly.GetCustomAttribute(); + var provideAttribute = assembly.GetCustomAttribute( + + ); if (provideAttribute == null) { return DefaultApplicationPartFactory.Instance; diff --git a/aspnetcore/src/Mvc/Mvc.Core/src/Authorization/AuthorizeFilter.cs b/aspnetcore/src/Mvc/Mvc.Core/src/Authorization/AuthorizeFilter.cs index c91fd17b83e..117c042ffc1 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/src/Authorization/AuthorizeFilter.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/src/Authorization/AuthorizeFilter.cs @@ -147,7 +147,9 @@ AuthorizationFilterContext context // and produce a policy using this. This would mean we would have effectively run some auth twice, but it maintains compat. var policyProvider = PolicyProvider - ?? context.HttpContext.RequestServices.GetRequiredService(); + ?? context.HttpContext.RequestServices.GetRequiredService( + + ); var endpointAuthorizeData = endpoint.Metadata.GetOrderedMetadata() ?? Array.Empty(); diff --git a/aspnetcore/src/Mvc/Mvc.Core/src/Builder/ControllerEndpointRouteBuilderExtensions.cs b/aspnetcore/src/Mvc/Mvc.Core/src/Builder/ControllerEndpointRouteBuilderExtensions.cs index 13dbea2311e..0200154ecc9 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/src/Builder/ControllerEndpointRouteBuilderExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/src/Builder/ControllerEndpointRouteBuilderExtensions.cs @@ -572,9 +572,13 @@ IEndpointRouteBuilder endpoints if (dataSource == null) { var orderProvider = - endpoints.ServiceProvider.GetRequiredService(); + endpoints.ServiceProvider.GetRequiredService( + + ); var factory = - endpoints.ServiceProvider.GetRequiredService(); + endpoints.ServiceProvider.GetRequiredService( + + ); dataSource = factory.Create( orderProvider.GetOrCreateOrderedEndpointsSequenceProvider(endpoints) ); diff --git a/aspnetcore/src/Mvc/Mvc.Core/src/DependencyInjection/MvcCoreServiceCollectionExtensions.cs b/aspnetcore/src/Mvc/Mvc.Core/src/DependencyInjection/MvcCoreServiceCollectionExtensions.cs index 0a1deff3faf..d765c6fc521 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/src/DependencyInjection/MvcCoreServiceCollectionExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/src/DependencyInjection/MvcCoreServiceCollectionExtensions.cs @@ -155,10 +155,9 @@ internal static void AddMvcCoreServices(IServiceCollection services) // These are consumed only when creating action descriptors, then they can be deallocated services.TryAddSingleton(); services.TryAddEnumerable( - ServiceDescriptor.Transient< - IApplicationModelProvider, - DefaultApplicationModelProvider - >() + ServiceDescriptor.Transient( + + ) ); services.TryAddEnumerable( ServiceDescriptor.Transient< @@ -186,10 +185,9 @@ internal static void AddMvcCoreServices(IServiceCollection services) // Will be cached by the DefaultActionSelector services.TryAddEnumerable( - ServiceDescriptor.Transient< - IActionConstraintProvider, - DefaultActionConstraintProvider - >() + ServiceDescriptor.Transient( + + ) ); // Policies for Endpoints @@ -292,10 +290,9 @@ internal static void AddMvcCoreServices(IServiceCollection services) IActionResultExecutor, VirtualFileResultExecutor >(); - services.TryAddSingleton< - IActionResultExecutor, - FileStreamResultExecutor - >(); + services.TryAddSingleton, FileStreamResultExecutor>( + + ); services.TryAddSingleton< IActionResultExecutor, FileContentResultExecutor diff --git a/aspnetcore/src/Mvc/Mvc.Core/src/Routing/AttributeRoute.cs b/aspnetcore/src/Mvc/Mvc.Core/src/Routing/AttributeRoute.cs index dcebd914588..599aa9c69f0 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/src/Routing/AttributeRoute.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/src/Routing/AttributeRoute.cs @@ -168,13 +168,12 @@ private static List GetRouteInfos(IReadOnlyList act { var allErrors = string.Join( Environment.NewLine + Environment.NewLine, - errors.Select( - e => - Resources.FormatAttributeRoute_IndividualErrorMessage( - e.ActionDescriptor.DisplayName, - Environment.NewLine, - e.ErrorMessage - ) + errors.Select(e => + Resources.FormatAttributeRoute_IndividualErrorMessage( + e.ActionDescriptor.DisplayName, + Environment.NewLine, + e.ErrorMessage + ) ) ); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs index 573feae79b5..7ba6ca4045d 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ApiBehaviorApplicationModelProviderTest.cs @@ -192,7 +192,9 @@ public void Constructor_DoesNotAddConsumesConstraintForFormFileParameterConventi // Act & Assert Assert.Empty( - provider.ActionModelConventions.OfType() + provider.ActionModelConventions.OfType( + + ) ); } diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ControllerActionDescriptorProviderTests.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ControllerActionDescriptorProviderTests.cs index be85baba40b..ee381eece6f 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ControllerActionDescriptorProviderTests.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/ControllerActionDescriptorProviderTests.cs @@ -42,8 +42,8 @@ public void GetDescriptors_DisplayNameIncludesAssemblyName() // Act var descriptors = provider.GetDescriptors(); - var descriptor = descriptors.Single( - ad => ad.ActionName == nameof(PersonController.GetPerson) + var descriptor = descriptors.Single(ad => + ad.ActionName == nameof(PersonController.GetPerson) ); // Assert @@ -341,10 +341,8 @@ public void GetDescriptors_ActionWithMultipleHttpMethods_LastHttpMethodMetadata( // Assert var actions = descriptors .OfType() - .Where( - d => - d.ActionName - == nameof(NonDuplicatedAttributeRouteController.DifferentHttpMethods) + .Where(d => + d.ActionName == nameof(NonDuplicatedAttributeRouteController.DifferentHttpMethods) ); Assert.Collection( @@ -532,8 +530,8 @@ public void AttributeRouting_AcceptVerbsOnAction_CreatesActionPerControllerAttri var descriptors = provider.GetDescriptors(); // Assert - var actions = descriptors.Where( - d => d.ActionName == nameof(MultiRouteAttributesController.AcceptVerbs) + var actions = descriptors.Where(d => + d.ActionName == nameof(MultiRouteAttributesController.AcceptVerbs) ); Assert.Equal(2, actions.Count()); @@ -605,22 +603,18 @@ public void AttributeRouting_AcceptVerbsOnAction_WithoutTemplate_MergesVerb() Assert.Equal(4, constrainedActions.Count()); // Actions generated by PutAttribute - var putActions = constrainedActions.Where( - a => - a.ActionConstraints.OfType() - .Single() - .HttpMethods.Single() == "PUT" + var putActions = constrainedActions.Where(a => + a.ActionConstraints.OfType().Single().HttpMethods.Single() + == "PUT" ); Assert.Equal(2, putActions.Count()); Assert.Single(putActions, a => a.AttributeRouteInfo.Template.Equals("v1/All")); Assert.Single(putActions, a => a.AttributeRouteInfo.Template.Equals("v2/All")); // Actions generated by RouteAttribute - var routeActions = actions.Where( - a => - a.ActionConstraints.OfType() - .Single() - .HttpMethods.Single() == "POST" + var routeActions = actions.Where(a => + a.ActionConstraints.OfType().Single().HttpMethods.Single() + == "POST" ); Assert.Equal(2, routeActions.Count()); Assert.Single(routeActions, a => a.AttributeRouteInfo.Template.Equals("v1/List")); @@ -637,8 +631,8 @@ public void AttributeRouting_AcceptVerbsOnAction_WithTemplate_DoesNotMergeVerb() var descriptors = provider.GetDescriptors(); // Assert - var actions = descriptors.Where( - d => d.ActionName == "AcceptVerbsRouteAttributeWithTemplateAndHttpPut" + var actions = descriptors.Where(d => + d.ActionName == "AcceptVerbsRouteAttributeWithTemplateAndHttpPut" ); Assert.Equal(6, actions.Count()); @@ -654,22 +648,18 @@ public void AttributeRouting_AcceptVerbsOnAction_WithTemplate_DoesNotMergeVerb() Assert.Equal(4, constrainedActions.Count()); // Actions generated by AcceptVerbs - var postActions = constrainedActions.Where( - a => - a.ActionConstraints.OfType() - .Single() - .HttpMethods.Single() == "POST" + var postActions = constrainedActions.Where(a => + a.ActionConstraints.OfType().Single().HttpMethods.Single() + == "POST" ); Assert.Equal(2, postActions.Count()); Assert.Single(postActions, a => a.AttributeRouteInfo.Template.Equals("v1")); Assert.Single(postActions, a => a.AttributeRouteInfo.Template.Equals("v2")); // Actions generated by PutAttribute - var putActions = constrainedActions.Where( - a => - a.ActionConstraints.OfType() - .Single() - .HttpMethods.Single() == "PUT" + var putActions = constrainedActions.Where(a => + a.ActionConstraints.OfType().Single().HttpMethods.Single() + == "PUT" ); Assert.Equal(2, putActions.Count()); Assert.Single(putActions, a => a.AttributeRouteInfo.Template.Equals("v1/All")); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/DefaultApplicationModelProviderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/DefaultApplicationModelProviderTest.cs index ede6cb4efc2..0ad6ac48dd0 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/DefaultApplicationModelProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/DefaultApplicationModelProviderTest.cs @@ -1407,7 +1407,9 @@ public void ControllerDispose_ExplicitlyImplemented_IDisposableMethods_AreTreate // Arrange var builder = new TestApplicationModelProvider(); var typeInfo = - typeof(DerivedFromControllerAndExplicitIDisposableImplementationController).GetTypeInfo(); + typeof(DerivedFromControllerAndExplicitIDisposableImplementationController).GetTypeInfo( + + ); var context = new ApplicationModelProviderContext(new[] { typeInfo }); // Act @@ -1423,8 +1425,9 @@ public void ControllerDispose_MethodsNamedDispose_AreTreatedAsActions() { // Arrange var builder = new TestApplicationModelProvider(); - var typeInfo = - typeof(DerivedFromControllerAndHidesBaseDisposeMethodController).GetTypeInfo(); + var typeInfo = typeof(DerivedFromControllerAndHidesBaseDisposeMethodController).GetTypeInfo( + + ); var context = new ApplicationModelProviderContext(new[] { typeInfo }); // Act diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/InferParameterBindingInfoConventionTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/InferParameterBindingInfoConventionTest.cs index 7be1a470406..a5f226bb0da 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/InferParameterBindingInfoConventionTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ApplicationModels/InferParameterBindingInfoConventionTest.cs @@ -661,8 +661,8 @@ public void InferBindingSourceForParameter_ReturnsServicesForComplexTypesRegiste var actionName = nameof(ParameterBindingController.ServiceParameter); var parameter = GetParameterModel(typeof(ParameterBindingController), actionName); // Using any built-in type defined in the Test action - var serviceProvider = Mock.Of( - s => s.IsService(typeof(IApplicationModelProvider)) == true + var serviceProvider = Mock.Of(s => + s.IsService(typeof(IApplicationModelProvider)) == true ); var convention = GetConvention(serviceProviderIsService: serviceProvider); @@ -681,8 +681,8 @@ public void InferBindingSourceForParameter_ReturnsServicesForIEnumerableOfComple var actionName = nameof(ParameterBindingController.IEnumerableServiceParameter); var parameter = GetParameterModel(typeof(ParameterBindingController), actionName); // Using any built-in type defined in the Test action - var serviceProvider = Mock.Of( - s => s.IsService(typeof(IApplicationModelProvider)) == true + var serviceProvider = Mock.Of(s => + s.IsService(typeof(IApplicationModelProvider)) == true ); var convention = GetConvention(serviceProviderIsService: serviceProvider); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/Controllers/ControllerBinderDelegateProviderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/Controllers/ControllerBinderDelegateProviderTest.cs index da7a4c18103..401ba5a4679 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/Controllers/ControllerBinderDelegateProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/Controllers/ControllerBinderDelegateProviderTest.cs @@ -311,8 +311,8 @@ public async Task CreateBinderDelegate_Delegate_GetsMetadataFromParameter() mockBinder.Verify( o => o.BindModelAsync( - It.Is( - context => context.ModelMetadata == modelMetadata.Object + It.Is(context => + context.ModelMetadata == modelMetadata.Object ) ), Times.Once() @@ -360,8 +360,8 @@ public async Task CreateBinderDelegate_Delegate_GetsMetadataFromType_IsMetadataP mockBinder.Verify( o => o.BindModelAsync( - It.Is( - context => context.ModelMetadata == modelMetadata.Object + It.Is(context => + context.ModelMetadata == modelMetadata.Object ) ), Times.Once() @@ -545,14 +545,13 @@ public async Task DoesNotValidate_ForControllerProperties_IfObjectValidatorDoesN var factory = GetModelBinderFactory("Hello"); var modelMetadataProvider = TestModelMetadataProvider.CreateDefaultProvider(); var mockValidator = new Mock(MockBehavior.Strict); - mockValidator.Setup( - o => - o.Validate( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mockValidator.Setup(o => + o.Validate( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ); var parameterBinder = new ParameterBinder( @@ -1170,17 +1169,16 @@ public async Task MultipleActionParameter_ValidModelState(List - p.BindModelAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - null, - null - ) + .Setup(p => + p.BindModelAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + null, + null + ) ) .Returns( ( diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs index 5f22cfb627a..6eb1a2c2f01 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/ApiBehaviorOptionsSetupTest.cs @@ -78,8 +78,8 @@ public void ProblemDetailsInvalidModelStateResponse_UsesUserConfiguredLink() var link = "http://mylink"; var actionContext = GetActionContext(); - var factory = GetProblemDetailsFactory( - options => options.ClientErrorMapping[400].Link = link + var factory = GetProblemDetailsFactory(options => + options.ClientErrorMapping[400].Link = link ); // Act @@ -106,17 +106,16 @@ public void ProblemDetailsInvalidModelStateResponse_UsesProblemDetailsFactory() { // Arrange var actionContext = GetActionContext(); - var factory = Mock.Of( - m => - m.CreateValidationProblemDetails( - It.IsAny(), - It.IsAny(), - null, - null, - null, - null, - null - ) == new ValidationProblemDetails { Status = 422, } + var factory = Mock.Of(m => + m.CreateValidationProblemDetails( + It.IsAny(), + It.IsAny(), + null, + null, + null, + null, + null + ) == new ValidationProblemDetails { Status = 422, } ); // Act diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs index 77add8474c5..e7265c3d2d6 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/DependencyInjection/MvcCoreServiceCollectionExtensionsTest.cs @@ -318,8 +318,8 @@ private void AssertServiceCountEquals( int expectedServiceRegistrationCount ) { - var serviceDescriptors = services.Where( - serviceDescriptor => serviceDescriptor.ServiceType == serviceType + var serviceDescriptors = services.Where(serviceDescriptor => + serviceDescriptor.ServiceType == serviceType ); var actual = serviceDescriptors.Count(); @@ -337,8 +337,8 @@ Type implementationType ) { var matches = services - .Where( - sd => sd.ServiceType == serviceType && sd.ImplementationType == implementationType + .Where(sd => + sd.ServiceType == serviceType && sd.ImplementationType == implementationType ) .ToArray(); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ActionSelectorTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ActionSelectorTest.cs index 12695b9d9f9..5cff8dff2ce 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ActionSelectorTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ActionSelectorTest.cs @@ -1069,20 +1069,16 @@ string action var comparer = new RouteValueEqualityComparer(); return actions - .Where( - a => a.RouteValues.Any(kvp => kvp.Key == "area" && comparer.Equals(kvp.Value, area)) + .Where(a => + a.RouteValues.Any(kvp => kvp.Key == "area" && comparer.Equals(kvp.Value, area)) ) - .Where( - a => - a.RouteValues.Any( - kvp => kvp.Key == "controller" && comparer.Equals(kvp.Value, controller) - ) + .Where(a => + a.RouteValues.Any(kvp => + kvp.Key == "controller" && comparer.Equals(kvp.Value, controller) + ) ) - .Where( - a => - a.RouteValues.Any( - kvp => kvp.Key == "action" && comparer.Equals(kvp.Value, action) - ) + .Where(a => + a.RouteValues.Any(kvp => kvp.Key == "action" && comparer.Equals(kvp.Value, action)) ); } diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ClientErrorResultFilterTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ClientErrorResultFilterTest.cs index 25015a39986..96c933aafe4 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ClientErrorResultFilterTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/Infrastructure/ClientErrorResultFilterTest.cs @@ -37,12 +37,8 @@ public void OnResultExecuting_DoesNothing_IfTransformedValueIsNull() var context = GetContext(actionResult); var factory = new Mock(); factory - .Setup( - f => - f.GetClientError( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.GetClientError(It.IsAny(), It.IsAny()) ) .Returns((IActionResult)null) .Verifiable(); @@ -113,10 +109,9 @@ public void OnResultExecuting_DoesNotTransformStatusCodesLessThan400(int statusC private static ClientErrorResultFilter GetFilter() { - var factory = Mock.Of( - f => - f.GetClientError(It.IsAny(), It.IsAny()) - == Result + var factory = Mock.Of(f => + f.GetClientError(It.IsAny(), It.IsAny()) + == Result ); return new ClientErrorResultFilter(factory, NullLogger.Instance); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/BodyModelBinderTests.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/BodyModelBinderTests.cs index de549dced5c..ec32c673b01 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/BodyModelBinderTests.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/BodyModelBinderTests.cs @@ -187,9 +187,8 @@ bool treatEmptyInputAsDefaultValueOption mockInputFormatter.Verify( formatter => formatter.ReadAsync( - It.Is( - ctx => - ctx.TreatEmptyInputAsDefaultValue == treatEmptyInputAsDefaultValueOption + It.Is(ctx => + ctx.TreatEmptyInputAsDefaultValue == treatEmptyInputAsDefaultValueOption ) ), Times.Once diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexObjectModelBinderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexObjectModelBinderTest.cs index 1847f43dd9a..1f700de55c2 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexObjectModelBinderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexObjectModelBinderTest.cs @@ -254,8 +254,8 @@ int expectedCanCreate originalValueProvider .Setup(o => o.Filter(It.IsAny())) - .Returns( - source => source == BindingSource.Query ? originalValueProvider.Object : null + .Returns(source => + source == BindingSource.Query ? originalValueProvider.Object : null ); var bindingContext = CreateContext(GetMetadataForType(modelType)); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs index 63d65360043..bec7768e854 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Binders/ComplexTypeModelBinderTest.cs @@ -253,8 +253,8 @@ int expectedCanCreate originalValueProvider .Setup(o => o.Filter(It.IsAny())) - .Returns( - source => source == BindingSource.Query ? originalValueProvider.Object : null + .Returns(source => + source == BindingSource.Query ? originalValueProvider.Object : null ); var bindingContext = CreateContext(GetMetadataForType(modelType)); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Metadata/HasValidatorsValidationMetadataProviderTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Metadata/HasValidatorsValidationMetadataProviderTest.cs index fe19cca7344..b7ee0a93ddf 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Metadata/HasValidatorsValidationMetadataProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Metadata/HasValidatorsValidationMetadataProviderTest.cs @@ -81,8 +81,8 @@ public void CreateValidationMetadata_SetsHasValidatorsToTrue_IfProviderReturnsTr public void CreateValidationMetadata_SetsHasValidatorsToFalse_IfNoProviderReturnsTrue() { // Arrange - var provider = Mock.Of( - p => p.HasValidators(typeof(object), It.IsAny>()) == false + var provider = Mock.Of(p => + p.HasValidators(typeof(object), It.IsAny>()) == false ); var validationProviders = new IModelValidatorProvider[] { @@ -106,8 +106,8 @@ public void CreateValidationMetadata_SetsHasValidatorsToFalse_IfNoProviderReturn public void CreateValidationMetadata_DoesNotOverrideExistingHasValidatorsValue() { // Arrange - var provider = Mock.Of( - p => p.HasValidators(typeof(object), It.IsAny>()) == false + var provider = Mock.Of(p => + p.HasValidators(typeof(object), It.IsAny>()) == false ); var validationProviders = new IModelValidatorProvider[] { diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ClientValidatorCacheTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ClientValidatorCacheTest.cs index 0311c26b4ba..f4acd812bd9 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ClientValidatorCacheTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ClientValidatorCacheTest.cs @@ -81,8 +81,8 @@ public void GetValidators_ReadsValidatorsFromCorrespondingRecordTypeParameter() var modelMetadataProvider = new TestModelMetadataProvider(); var metadata = modelMetadataProvider.GetMetadataForType(typeof(TestRecordType)); var property = metadata.Properties[nameof(TestRecordType.Property1)]; - var parameter = metadata.BoundConstructor.BoundConstructorParameters.First( - f => f.Name == nameof(TestRecordType.Property1) + var parameter = metadata.BoundConstructor.BoundConstructorParameters.First(f => + f.Name == nameof(TestRecordType.Property1) ); var validatorProvider = new ProviderWithNonReusableValidators(); diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ValidatorCacheTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ValidatorCacheTest.cs index b3b9bc75601..cf47e95269d 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ValidatorCacheTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/ModelBinding/Validation/ValidatorCacheTest.cs @@ -65,14 +65,14 @@ public void GetValidators_DoesNotCacheValidatorsWithIsReusableFalse() Assert.NotSame(validators1, validators2); var requiredValidator = Assert.Single( - validators2.Where( - v => (v as DataAnnotationsModelValidator).Attribute is RequiredAttribute + validators2.Where(v => + (v as DataAnnotationsModelValidator).Attribute is RequiredAttribute ) ); Assert.Contains(requiredValidator, validators1); // cached var stringLengthValidator = Assert.Single( - validators2.Where( - v => (v as DataAnnotationsModelValidator).Attribute is StringLengthAttribute + validators2.Where(v => + (v as DataAnnotationsModelValidator).Attribute is StringLengthAttribute ) ); Assert.DoesNotContain(stringLengthValidator, validators1); // not cached diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/RedirectToRouteResultTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/RedirectToRouteResultTest.cs index ae452525fe4..a74e08c737c 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/RedirectToRouteResultTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/RedirectToRouteResultTest.cs @@ -111,13 +111,12 @@ public async Task ExecuteResultAsync_UsesRouteName_ToGenerateLocationHeader() await result.ExecuteResultAsync(actionContext); // Assert - urlHelper.Verify( - uh => - uh.RouteUrl( - It.Is( - routeContext => string.Equals(routeName, routeContext.RouteName) - ) + urlHelper.Verify(uh => + uh.RouteUrl( + It.Is(routeContext => + string.Equals(routeName, routeContext.RouteName) ) + ) ); Assert.True( httpContext.Response.Headers.ContainsKey("Location"), diff --git a/aspnetcore/src/Mvc/Mvc.Core/test/VirtualFileResultTest.cs b/aspnetcore/src/Mvc/Mvc.Core/test/VirtualFileResultTest.cs index b46392d5650..c2d7621f85a 100644 --- a/aspnetcore/src/Mvc/Mvc.Core/test/VirtualFileResultTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Core/test/VirtualFileResultTest.cs @@ -50,8 +50,8 @@ public void GetFileProvider_ReturnsFileProviderFromWebHostEnvironment() { // Arrange var webHostFileProvider = Mock.Of(); - var webHostEnvironment = Mock.Of( - e => e.WebRootFileProvider == webHostFileProvider + var webHostEnvironment = Mock.Of(e => + e.WebRootFileProvider == webHostFileProvider ); var result = new VirtualFileResult("some-path", "text/plain"); @@ -69,8 +69,8 @@ public void GetFileProvider_ReturnsFileProviderFromResult() // Arrange var webHostFileProvider = Mock.Of(); var fileProvider = Mock.Of(); - var webHostEnvironment = Mock.Of( - e => e.WebRootFileProvider == webHostFileProvider + var webHostEnvironment = Mock.Of(e => + e.WebRootFileProvider == webHostFileProvider ); var result = new VirtualFileResult("some-path", "text/plain") diff --git a/aspnetcore/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs b/aspnetcore/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs index a7c178d4e64..2d49484a263 100644 --- a/aspnetcore/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs +++ b/aspnetcore/src/Mvc/Mvc.DataAnnotations/src/DataAnnotationsMetadataProvider.cs @@ -204,10 +204,8 @@ public void CreateDisplayMetadata(DisplayMetadataProviderContext context) var enumFields = Enum.GetNames(underlyingType) .Select(name => underlyingType.GetField(name)!) - .OrderBy( - field => - field.GetCustomAttribute(inherit: false)?.GetOrder() - ?? 1000 + .OrderBy(field => + field.GetCustomAttribute(inherit: false)?.GetOrder() ?? 1000 ); foreach (var field in enumFields) diff --git a/aspnetcore/src/Mvc/Mvc.DataAnnotations/test/NumericClientModelValidatorTest.cs b/aspnetcore/src/Mvc/Mvc.DataAnnotations/test/NumericClientModelValidatorTest.cs index 8942b69d009..b9ca24d500a 100644 --- a/aspnetcore/src/Mvc/Mvc.DataAnnotations/test/NumericClientModelValidatorTest.cs +++ b/aspnetcore/src/Mvc/Mvc.DataAnnotations/test/NumericClientModelValidatorTest.cs @@ -59,8 +59,8 @@ public void AddValidation_CorrectValidationTypeAndOverriddenErrorMessage() .ForProperty(typeof(TypeWithNumericProperty), nameof(TypeWithNumericProperty.Id)) .BindingDetails(d => { - d.ModelBindingMessageProvider.SetValueMustBeANumberAccessor( - name => $"Error message about '{name}' from override." + d.ModelBindingMessageProvider.SetValueMustBeANumberAccessor(name => + $"Error message about '{name}' from override." ); }); var metadata = provider.GetMetadataForProperty( @@ -112,8 +112,8 @@ public void AddValidation_CorrectValidationTypeAndOverriddenErrorMessage_WithPar .ForParameter(parameter) .BindingDetails(d => { - d.ModelBindingMessageProvider.SetValueMustBeANumberAccessor( - name => $"Error message about '{name}' from override." + d.ModelBindingMessageProvider.SetValueMustBeANumberAccessor(name => + $"Error message about '{name}' from override." ); }); var metadata = provider.GetMetadataForParameter(parameter); @@ -154,11 +154,10 @@ public void AddValidation_CorrectValidationTypeAndOverriddenErrorMessage_WithTyp var provider = new TestModelMetadataProvider(); provider .ForType(typeof(int)) - .BindingDetails( - d => - d.ModelBindingMessageProvider.SetNonPropertyValueMustBeANumberAccessor( - () => $"Error message from override." - ) + .BindingDetails(d => + d.ModelBindingMessageProvider.SetNonPropertyValueMustBeANumberAccessor( + () => $"Error message from override." + ) ); var metadata = provider.GetMetadataForType(typeof(int)); diff --git a/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationMvcBuilderExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationMvcBuilderExtensionsTest.cs index 976cb8429a1..28aa99f44f5 100644 --- a/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationMvcBuilderExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationMvcBuilderExtensionsTest.cs @@ -23,8 +23,8 @@ public static TheoryData MvcBuilderExtensionsData() builder2.AddMvcLocalization(LanguageViewLocationExpanderFormat.SubFolder); var builder3 = new TestMvcBuilder(); - builder3.AddMvcLocalization( - localizationOptionsSetupAction: l => l.ResourcesPath = "Resources" + builder3.AddMvcLocalization(localizationOptionsSetupAction: l => + l.ResourcesPath = "Resources" ); var builder4 = new TestMvcBuilder(); @@ -43,8 +43,8 @@ public void AddsRequiredServices(IMvcBuilder mvcBuilder) // Assert var services = mvcBuilder.Services; // Base localization services - var service = services.FirstOrDefault( - sd => sd.ServiceType == typeof(IStringLocalizerFactory) + var service = services.FirstOrDefault(sd => + sd.ServiceType == typeof(IStringLocalizerFactory) ); Assert.NotNull(service); Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); @@ -56,14 +56,14 @@ public void AddsRequiredServices(IMvcBuilder mvcBuilder) Assert.Equal(typeof(StringLocalizer<>), service.ImplementationType); // View localization services - service = services.FirstOrDefault( - sd => sd.ServiceType == typeof(IConfigureOptions) + service = services.FirstOrDefault(sd => + sd.ServiceType == typeof(IConfigureOptions) ); Assert.NotNull(service); Assert.Equal(ServiceLifetime.Transient, service.Lifetime); - service = services.FirstOrDefault( - sd => sd.ServiceType == typeof(IConfigureOptions) + service = services.FirstOrDefault(sd => + sd.ServiceType == typeof(IConfigureOptions) ); Assert.NotNull(service); Assert.Equal(ServiceLifetime.Singleton, service.Lifetime); @@ -91,8 +91,8 @@ public void SetsLocalizationOptions_AsExpected() var builder = new TestMvcBuilder(); // Act - builder.AddMvcLocalization( - localizationOptionsSetupAction: options => options.ResourcesPath = "TestResources" + builder.AddMvcLocalization(localizationOptionsSetupAction: options => + options.ResourcesPath = "TestResources" ); // Assert @@ -121,9 +121,8 @@ public void SetsDataAnnotationsOptions_AsExpected() ); // Act - builder.AddMvcLocalization( - dataAnnotationsLocalizationOptionsSetupAction: options => - options.DataAnnotationLocalizerProvider = dataAnnotationLocalizerProvider + builder.AddMvcLocalization(dataAnnotationsLocalizationOptionsSetupAction: options => + options.DataAnnotationLocalizerProvider = dataAnnotationLocalizerProvider ); // Assert diff --git a/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationServiceCollectionExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationServiceCollectionExtensionsTest.cs index f772531a6b5..fc4ab6c26fb 100644 --- a/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationServiceCollectionExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Localization/test/MvcLocalizationServiceCollectionExtensionsTest.cs @@ -74,8 +74,8 @@ Type implementationType ) { var matches = services - .Where( - sd => sd.ServiceType == serviceType && sd.ImplementationType == implementationType + .Where(sd => + sd.ServiceType == serviceType && sd.ImplementationType == implementationType ) .ToArray(); diff --git a/aspnetcore/src/Mvc/Mvc.Localization/test/ViewLocalizerTest.cs b/aspnetcore/src/Mvc/Mvc.Localization/test/ViewLocalizerTest.cs index 486e0011b92..168f5786a84 100644 --- a/aspnetcore/src/Mvc/Mvc.Localization/test/ViewLocalizerTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Localization/test/ViewLocalizerTest.cs @@ -99,12 +99,11 @@ string expectedBaseName viewLocalizer.Contextualize(viewContext); // Assert - htmlLocalizerFactory.Verify( - h => - h.Create( - It.Is(baseName => baseName == expectedBaseName), - It.Is(location => location == appName) - ) + htmlLocalizerFactory.Verify(h => + h.Create( + It.Is(baseName => baseName == expectedBaseName), + It.Is(location => location == appName) + ) ); } diff --git a/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/src/JsonSerializerSettingsProvider.cs b/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/src/JsonSerializerSettingsProvider.cs index 15085a05fbf..cfd93b5f72e 100644 --- a/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/src/JsonSerializerSettingsProvider.cs +++ b/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/src/JsonSerializerSettingsProvider.cs @@ -19,8 +19,9 @@ public static class JsonSerializerSettingsProvider // return shared resolver by default for perf so slow reflection logic is cached once // developers can set their own resolver after the settings are returned if desired - private static readonly DefaultContractResolver SharedContractResolver = - CreateContractResolver(); + private static readonly DefaultContractResolver SharedContractResolver = CreateContractResolver( + + ); /// /// Creates default . diff --git a/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/test/NewtonsoftJsonPatchInputFormatterTest.cs b/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/test/NewtonsoftJsonPatchInputFormatterTest.cs index 19e6b68700d..715a10726f4 100644 --- a/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/test/NewtonsoftJsonPatchInputFormatterTest.cs +++ b/aspnetcore/src/Mvc/Mvc.NewtonsoftJson/test/NewtonsoftJsonPatchInputFormatterTest.cs @@ -17,10 +17,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters; public class NewtonsoftJsonPatchInputFormatterTest { - private static readonly ObjectPoolProvider _objectPoolProvider = - new DefaultObjectPoolProvider(); - private static readonly JsonSerializerSettings _serializerSettings = - new JsonSerializerSettings(); + private static readonly ObjectPoolProvider _objectPoolProvider = new DefaultObjectPoolProvider( + + ); + private static readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings( + + ); [Fact] public async Task Constructor_BuffersRequestBody_ByDefault() diff --git a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/AssemblyPartExtensions.cs b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/AssemblyPartExtensions.cs index 29792e08ced..ac15b2c64fa 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/AssemblyPartExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/AssemblyPartExtensions.cs @@ -27,8 +27,8 @@ public static IEnumerable GetReferencePaths(this AssemblyPart assemblyPa var dependencyContext = DependencyContext.Load(assembly); if (dependencyContext != null) { - return dependencyContext.CompileLibraries.SelectMany( - library => library.ResolveReferencePaths() + return dependencyContext.CompileLibraries.SelectMany(library => + library.ResolveReferencePaths() ); } diff --git a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcCoreBuilderExtensions.cs b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcCoreBuilderExtensions.cs index 758b985e450..7cd27aeba0b 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcCoreBuilderExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/DependencyInjection/RazorRuntimeCompilationMvcCoreBuilderExtensions.cs @@ -64,12 +64,11 @@ internal static void AddServices(IServiceCollection services) >() ); - var compilerProvider = services.FirstOrDefault( - f => - f.ServiceType == typeof(IViewCompilerProvider) - && f.ImplementationType?.Assembly == typeof(IViewCompilerProvider).Assembly - && f.ImplementationType.FullName - == "Microsoft.AspNetCore.Mvc.Razor.Compilation.DefaultViewCompilerProvider" + var compilerProvider = services.FirstOrDefault(f => + f.ServiceType == typeof(IViewCompilerProvider) + && f.ImplementationType?.Assembly == typeof(IViewCompilerProvider).Assembly + && f.ImplementationType.FullName + == "Microsoft.AspNetCore.Mvc.Razor.Compilation.DefaultViewCompilerProvider" ); if (compilerProvider != null) @@ -80,10 +79,9 @@ internal static void AddServices(IServiceCollection services) services.TryAddSingleton(); - var actionDescriptorProvider = services.FirstOrDefault( - f => - f.ServiceType == typeof(IActionDescriptorProvider) - && f.ImplementationType == typeof(CompiledPageActionDescriptorProvider) + var actionDescriptorProvider = services.FirstOrDefault(f => + f.ServiceType == typeof(IActionDescriptorProvider) + && f.ImplementationType == typeof(CompiledPageActionDescriptorProvider) ); if (actionDescriptorProvider != null) diff --git a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/RazorProjectPageRouteModelProvider.cs b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/RazorProjectPageRouteModelProvider.cs index 30c97a7a0ad..8ff7d1f910d 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/RazorProjectPageRouteModelProvider.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/src/RazorProjectPageRouteModelProvider.cs @@ -53,13 +53,8 @@ private void AddPageModels(PageRouteModelProviderContext context) { var relativePath = item.CombinedPath; if ( - context.RouteModels.Any( - m => - string.Equals( - relativePath, - m.RelativePath, - StringComparison.OrdinalIgnoreCase - ) + context.RouteModels.Any(m => + string.Equals(relativePath, m.RelativePath, StringComparison.OrdinalIgnoreCase) ) ) { @@ -91,13 +86,8 @@ private void AddAreaPageModels(PageRouteModelProviderContext context) { var relativePath = item.CombinedPath; if ( - context.RouteModels.Any( - m => - string.Equals( - relativePath, - m.RelativePath, - StringComparison.OrdinalIgnoreCase - ) + context.RouteModels.Any(m => + string.Equals(relativePath, m.RelativePath, StringComparison.OrdinalIgnoreCase) ) ) { diff --git a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/test/RuntimeViewCompilerTest.cs b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/test/RuntimeViewCompilerTest.cs index 2fe6816a63c..ca11ca7dba8 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/test/RuntimeViewCompilerTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor.RuntimeCompilation/test/RuntimeViewCompilerTest.cs @@ -1001,8 +1001,11 @@ public TestRazorViewCompiler( Compile = compile; if (Compile == null) { - Compile = path => - new CompiledViewDescriptor { RelativePath = path, Item = CreateForView(path), }; + Compile = path => new CompiledViewDescriptor + { + RelativePath = path, + Item = CreateForView(path), + }; } } diff --git a/aspnetcore/src/Mvc/Mvc.Razor/test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs b/aspnetcore/src/Mvc/Mvc.Razor/test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs index a6aaf929405..b2a7163d366 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor/test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor/test/ApplicationParts/RazorCompiledItemFeatureProviderTest.cs @@ -14,11 +14,11 @@ public class RazorCompiledItemFeatureProviderTest public void PopulateFeature_AddsItemsFromProviderTypes() { // Arrange - var item1 = Mock.Of( - i => i.Identifier == "Item1" && i.Type == typeof(TestView) + var item1 = Mock.Of(i => + i.Identifier == "Item1" && i.Type == typeof(TestView) ); - var item2 = Mock.Of( - i => i.Identifier == "Item2" && i.Type == typeof(TestPage) + var item2 = Mock.Of(i => + i.Identifier == "Item2" && i.Type == typeof(TestPage) ); var part1 = new AssemblyPart(typeof(RazorCompiledItemFeatureProviderTest).Assembly); var part2 = new Mock(); @@ -40,11 +40,11 @@ public void PopulateFeature_AddsItemsFromProviderTypes() public void PopulateFeature_PopulatesRazorCompiledItemsFromTypeAssembly() { // Arrange - var item1 = Mock.Of( - i => i.Identifier == "Item1" && i.Type == typeof(TestView) + var item1 = Mock.Of(i => + i.Identifier == "Item1" && i.Type == typeof(TestView) ); - var item2 = Mock.Of( - i => i.Identifier == "Item2" && i.Type == typeof(TestPage) + var item2 = Mock.Of(i => + i.Identifier == "Item2" && i.Type == typeof(TestPage) ); var assembly = new TestAssembly( @@ -75,11 +75,11 @@ public void PopulateFeature_PopulatesRazorCompiledItemsFromTypeAssembly() public void PopulateFeature_AllowsDuplicateItemsFromMultipleParts() { // Arrange - var item1 = Mock.Of( - i => i.Identifier == "Item" && i.Type == typeof(TestView) + var item1 = Mock.Of(i => + i.Identifier == "Item" && i.Type == typeof(TestView) ); - var item2 = Mock.Of( - i => i.Identifier == "Item" && i.Type == typeof(TestPage) + var item2 = Mock.Of(i => + i.Identifier == "Item" && i.Type == typeof(TestPage) ); var part1 = new Mock(); part1 @@ -133,14 +133,11 @@ public void PopulateFeature_ThrowsIfTwoItemsFromSamePart_OnlyDifferInCase() public void PopulateFeature_ReplacesWithHotRelaodedItems() { // Arrange - var item1 = Mock.Of( - i => i.Identifier == "Item1" && i.Type == typeof(TestView) + var item1 = Mock.Of(i => + i.Identifier == "Item1" && i.Type == typeof(TestView) ); - var item2 = Mock.Of( - i => - i.Identifier == "Item2" - && i.Type == typeof(TestPage) - && i.Kind == "mvc.1.0.razor-page" + var item2 = Mock.Of(i => + i.Identifier == "Item2" && i.Type == typeof(TestPage) && i.Kind == "mvc.1.0.razor-page" ); var applicationPart = new TestRazorCompiledItemProvider diff --git a/aspnetcore/src/Mvc/Mvc.Razor/test/RazorViewEngineTest.cs b/aspnetcore/src/Mvc/Mvc.Razor/test/RazorViewEngineTest.cs index c95f8f65d78..96edff713a1 100644 --- a/aspnetcore/src/Mvc/Mvc.Razor/test/RazorViewEngineTest.cs +++ b/aspnetcore/src/Mvc/Mvc.Razor/test/RazorViewEngineTest.cs @@ -713,12 +713,11 @@ public void FindView_UsesViewLocationExpandersToLocateViews() ) .Verifiable(); expander1 - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Callback( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -732,12 +731,11 @@ public void FindView_UsesViewLocationExpandersToLocateViews() var expander2 = new Mock(); expander2 - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Callback( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -796,12 +794,11 @@ public void FindView_UsesViewLocationExpandersToLocateViews_ForAreas() ) .Verifiable(); expander1 - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Callback( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -815,12 +812,11 @@ public void FindView_UsesViewLocationExpandersToLocateViews_ForAreas() var expander2 = new Mock(); expander2 - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Callback( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -860,12 +856,11 @@ public void FindView_NormalizesPaths_ReturnedByViewLocationExpanders() var expander = new Mock(); expander - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns(new[] { @"Views\Home\Index.cshtml" }); @@ -1025,12 +1020,11 @@ public void FindView_DoesNotInvokeViewLocationExpanders_IfChangeTokenHasNotExpir ) .Verifiable(); expander - .Setup( - v => - v.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(v => + v.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns(expandedLocations) .Verifiable(); @@ -1089,12 +1083,11 @@ public void FindView_InvokesViewLocationExpanders_IfChangeTokenExpires() ) .Verifiable(); expander - .Setup( - v => - v.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(v => + v.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns(expandedLocations) .Verifiable(); @@ -1235,12 +1228,11 @@ public void FindPage_UsesViewLocationExpander_ToExpandPaths() ) .Verifiable(); expander - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -1300,12 +1292,11 @@ public void FindPage_UsesViewLocationExpander_ToExpandPaths_ForAreas() ) .Verifiable(); expander - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns( (ViewLocationExpanderContext c, IEnumerable seeds) => @@ -1921,12 +1912,11 @@ public void ViewEngine_DoesNotSetPageValue_IfItIsNotSpecifiedInRouteValues() .Verifiable(); expander - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns(expected); @@ -1959,12 +1949,11 @@ public void ViewEngine_SetsPageValue_IfItIsSpecifiedInRouteValues() .Verifiable(); expander - .Setup( - e => - e.ExpandViewLocations( - It.IsAny(), - It.IsAny>() - ) + .Setup(e => + e.ExpandViewLocations( + It.IsAny(), + It.IsAny>() + ) ) .Returns(expected); diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/src/Builder/RazorPagesEndpointRouteBuilderExtensions.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/src/Builder/RazorPagesEndpointRouteBuilderExtensions.cs index 0091956bac9..e3e36fae9b0 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/src/Builder/RazorPagesEndpointRouteBuilderExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/src/Builder/RazorPagesEndpointRouteBuilderExtensions.cs @@ -401,7 +401,9 @@ IEndpointRouteBuilder endpoints if (dataSource == null) { var orderProviderCache = - endpoints.ServiceProvider.GetRequiredService(); + endpoints.ServiceProvider.GetRequiredService( + + ); var factory = endpoints.ServiceProvider.GetRequiredService(); dataSource = factory.Create( diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs index 07f83054bcf..bf1d7548d6d 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/src/DependencyInjection/MvcRazorPagesMvcCoreBuilderExtensions.cs @@ -86,8 +86,8 @@ string rootDirectory ); } - builder.Services.Configure( - options => options.RootDirectory = rootDirectory + builder.Services.Configure(options => + options.RootDirectory = rootDirectory ); return builder; } @@ -118,10 +118,9 @@ internal static void AddRazorPagesServices(IServiceCollection services) services.TryAddSingleton(); // Action description and invocation - var actionDescriptorProvider = services.FirstOrDefault( - f => - f.ServiceType == typeof(IActionDescriptorProvider) - && f.ImplementationType == typeof(PageActionDescriptorProvider) + var actionDescriptorProvider = services.FirstOrDefault(f => + f.ServiceType == typeof(IActionDescriptorProvider) + && f.ImplementationType == typeof(PageActionDescriptorProvider) ); if (actionDescriptorProvider is null) diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/test/ApplicationModels/DefaultPageApplicationModelProviderTest.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/test/ApplicationModels/DefaultPageApplicationModelProviderTest.cs index 64edb48276c..419ae60d93b 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/test/ApplicationModels/DefaultPageApplicationModelProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/test/ApplicationModels/DefaultPageApplicationModelProviderTest.cs @@ -154,8 +154,8 @@ public void OnProvidersExecuting_DiscoversPropertiesFromPage_IfModelTypeDoesNotH // Assert Assert.NotNull(context.PageApplicationModel); - var propertiesOnPage = context.PageApplicationModel.HandlerProperties.Where( - p => p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo + var propertiesOnPage = context.PageApplicationModel.HandlerProperties.Where(p => + p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo ); Assert.Collection( propertiesOnPage.OrderBy(p => p.PropertyName), @@ -694,8 +694,8 @@ public void OnProvidersExecuting_FindsHandlerMethodOnPage_WhenModelIsNotAnnotate // Assert var pageModel = context.PageApplicationModel; - var propertiesOnPage = pageModel.HandlerProperties.Where( - p => p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo + var propertiesOnPage = pageModel.HandlerProperties.Where(p => + p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo ); Assert.Collection( propertiesOnPage.OrderBy(p => p.PropertyName), diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageLoaderTest.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageLoaderTest.cs index 4fa11aae95f..74200eecd7e 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageLoaderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DefaultPageLoaderTest.cs @@ -28,8 +28,8 @@ public class DefaultPageLoaderTest public DefaultPageLoaderTest() { var actionDescriptors = new ActionDescriptorCollection(Array.Empty(), 1); - ActionDescriptorCollectionProvider = Mock.Of( - v => v.ActionDescriptors == actionDescriptors + ActionDescriptorCollectionProvider = Mock.Of(v => + v.ActionDescriptors == actionDescriptors ); } diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DynamicPageEndpointMatcherPolicyTest.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DynamicPageEndpointMatcherPolicyTest.cs index b5b521adbc0..2f7d82565aa 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DynamicPageEndpointMatcherPolicyTest.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/DynamicPageEndpointMatcherPolicyTest.cs @@ -92,12 +92,11 @@ public DynamicPageEndpointMatcherPolicyTest() var loader = new Mock(); loader - .Setup( - l => - l.LoadAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LoadAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (PageActionDescriptor descriptor, EndpointMetadataCollection endpoint) => diff --git a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerProviderTest.cs b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerProviderTest.cs index fe8a1052f56..6220c77c83c 100644 --- a/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.RazorPages/test/Infrastructure/PageActionInvokerProviderTest.cs @@ -427,12 +427,11 @@ public void GetViewStartFactories_FindsFullHierarchy() var loader = new Mock(); loader - .Setup( - l => - l.LoadAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LoadAsync( + It.IsAny(), + It.IsAny() + ) ) .ReturnsAsync(compiledPageDescriptor); @@ -479,12 +478,11 @@ public void GetViewStartFactories_ReturnsFactoriesForFilesThatDoNotExistInProjec var loader = new Mock(); loader - .Setup( - l => - l.LoadAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(l => + l.LoadAsync( + It.IsAny(), + It.IsAny() + ) ) .ReturnsAsync(CreateCompiledPageActionDescriptor(descriptor, typeof(TestPageModel))); diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/src/TagHelperOutputExtensions.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/src/TagHelperOutputExtensions.cs index ece652f9c62..68cb2b95114 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/src/TagHelperOutputExtensions.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/src/TagHelperOutputExtensions.cs @@ -205,12 +205,8 @@ out TagHelperAttribute classAttribute var arrayOfClasses = currentClassValue .Split(SpaceChars, StringSplitOptions.RemoveEmptyEntries) - .SelectMany( - perhapsEncoded => - perhapsEncoded.Split( - encodedSpaceChars, - StringSplitOptions.RemoveEmptyEntries - ) + .SelectMany(perhapsEncoded => + perhapsEncoded.Split(encodedSpaceChars, StringSplitOptions.RemoveEmptyEntries) ) .ToArray(); @@ -292,9 +288,8 @@ out TagHelperAttribute classAttribute var listOfClasses = currentClassValue .Split(SpaceChars, StringSplitOptions.RemoveEmptyEntries) - .SelectMany( - perhapsEncoded => - perhapsEncoded.Split(encodedSpaceChars, StringSplitOptions.RemoveEmptyEntries) + .SelectMany(perhapsEncoded => + perhapsEncoded.Split(encodedSpaceChars, StringSplitOptions.RemoveEmptyEntries) ) .ToList(); diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/AnchorTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/AnchorTagHelperTest.cs index 3019ad1dddf..58ac6f15299 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/AnchorTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/AnchorTagHelperTest.cs @@ -104,18 +104,17 @@ public async Task ProcessAsync_CallsIntoRouteLinkWithExpectedParameters() var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateRouteLink( - It.IsAny(), - string.Empty, - "Default", - "http", - "contoso.com", - "hello=world", - It.IsAny>(), - null - ) + .Setup(mock => + mock.GenerateRouteLink( + It.IsAny(), + string.Empty, + "Default", + "http", + "contoso.com", + "hello=world", + It.IsAny>(), + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -159,19 +158,18 @@ public async Task ProcessAsync_CallsIntoActionLinkWithExpectedParameters() var generator = new Mock(); generator - .Setup( - mock => - mock.GenerateActionLink( - It.IsAny(), - string.Empty, - "Index", - "Home", - "http", - "contoso.com", - "hello=world", - It.IsAny>(), - null - ) + .Setup(mock => + mock.GenerateActionLink( + It.IsAny(), + string.Empty, + "Index", + "Home", + "http", + "contoso.com", + "hello=world", + It.IsAny>(), + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -218,19 +216,18 @@ public async Task ProcessAsync_AddsAreaToRouteValuesAndCallsIntoActionLinkWithEx var expectedRouteValues = new Dictionary { { "area", "Admin" } }; generator - .Setup( - mock => - mock.GenerateActionLink( - It.IsAny(), - string.Empty, - "Index", - "Home", - "http", - "contoso.com", - "hello=world", - expectedRouteValues, - null - ) + .Setup(mock => + mock.GenerateActionLink( + It.IsAny(), + string.Empty, + "Index", + "Home", + "http", + "contoso.com", + "hello=world", + expectedRouteValues, + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -281,19 +278,18 @@ public async Task ProcessAsync_AspAreaOverridesAspRouteArea() var expectedRouteValues = new Dictionary { { "area", "Admin" } }; generator - .Setup( - mock => - mock.GenerateActionLink( - It.IsAny(), - string.Empty, - "Index", - "Home", - "http", - "contoso.com", - "hello=world", - expectedRouteValues, - null - ) + .Setup(mock => + mock.GenerateActionLink( + It.IsAny(), + string.Empty, + "Index", + "Home", + "http", + "contoso.com", + "hello=world", + expectedRouteValues, + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -345,19 +341,18 @@ public async Task ProcessAsync_EmptyStringOnAspAreaIsPassedThroughToRouteValues( var expectedRouteValues = new Dictionary { { "area", string.Empty } }; generator - .Setup( - mock => - mock.GenerateActionLink( - It.IsAny(), - string.Empty, - "Index", - "Home", - "http", - "contoso.com", - "hello=world", - expectedRouteValues, - null - ) + .Setup(mock => + mock.GenerateActionLink( + It.IsAny(), + string.Empty, + "Index", + "Home", + "http", + "contoso.com", + "hello=world", + expectedRouteValues, + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -406,19 +401,18 @@ public async Task ProcessAsync_AddsPageToRouteValuesAndCallsPageLinkWithExpected var generator = new Mock(); generator - .Setup( - mock => - mock.GeneratePageLink( - It.IsAny(), - string.Empty, - "/User/Home/Index", - "page-handler", - "http", - "contoso.com", - "hello=world", - It.IsAny(), - null - ) + .Setup(mock => + mock.GeneratePageLink( + It.IsAny(), + string.Empty, + "/User/Home/Index", + "page-handler", + "http", + "contoso.com", + "hello=world", + It.IsAny(), + null + ) ) .Returns(new TagBuilder("a")) .Verifiable(); @@ -462,19 +456,18 @@ public async Task ProcessAsync_AddsAreaToRouteValuesAndCallsPageLinkWithExpected var generator = new Mock(); generator - .Setup( - mock => - mock.GeneratePageLink( - It.IsAny(), - string.Empty, - "/User/Home/Index", - "page-handler", - "http", - "contoso.com", - "hello=world", - It.IsAny(), - null - ) + .Setup(mock => + mock.GeneratePageLink( + It.IsAny(), + string.Empty, + "/User/Home/Index", + "page-handler", + "http", + "contoso.com", + "hello=world", + It.IsAny(), + null + ) ) .Callback( ( diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs index 3001082c8f2..99078c067c4 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/CacheTagHelperTest.cs @@ -33,11 +33,10 @@ public async Task ProcessAsync_DoesNotCache_IfDisabled() var value = new Mock(); value.Setup(c => c.Value).Returns(new DefaultTagHelperContent().SetContent("ok")); cache - .Setup( - c => - c.CreateEntry( - /*key*/It.IsAny() - ) + .Setup(c => + c.CreateEntry( + /*key*/It.IsAny() + ) ) .Returns((object key) => value.Object) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ComponentTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ComponentTagHelperTest.cs index 9507c8b3d47..d1b11af5b2a 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ComponentTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ComponentTagHelperTest.cs @@ -92,11 +92,10 @@ private ViewContext GetViewContext() RequestServices = new ServiceCollection() .AddScoped() .AddScoped() - .AddScoped( - _ => - Mock.Of( - x => x.CreateProtector(It.IsAny()) == Mock.Of() - ) + .AddScoped(_ => + Mock.Of(x => + x.CreateProtector(It.IsAny()) == Mock.Of() + ) ) .AddLogging() .AddScoped() diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/DefaultTagHelperActivatorTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/DefaultTagHelperActivatorTest.cs index 3656a1c7d20..86b7ac3ab2e 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/DefaultTagHelperActivatorTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/DefaultTagHelperActivatorTest.cs @@ -18,8 +18,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal; // Tests to verify that script, link and image tag helper use the size limited instance of MemoryCache. public class DefaultTagHelperActivatorTest { - private readonly TagHelperMemoryCacheProvider CacheProvider = - new TagHelperMemoryCacheProvider(); + private readonly TagHelperMemoryCacheProvider CacheProvider = new TagHelperMemoryCacheProvider( + + ); private readonly IMemoryCache MemoryCache = new MemoryCache(new MemoryCacheOptions()); private readonly IWebHostEnvironment HostingEnvironment = Mock.Of(); private readonly IFileVersionProvider FileVersionProvider = Mock.Of(); diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/FormTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/FormTagHelperTest.cs index 1ebe6d17574..de1d1d20ba7 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/FormTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/FormTagHelperTest.cs @@ -45,9 +45,8 @@ public async Task ProcessAsync_InvokesGeneratePageForm_WithOnlyPageHandler() ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GeneratePageForm(viewContext, null, "page-handler", null, null, null, null) + .Setup(mock => + mock.GeneratePageForm(viewContext, null, "page-handler", null, null, null, null) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -397,16 +396,15 @@ string expectedPostContent ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(mock => + mock.GenerateForm( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(new TagBuilder("form")); @@ -460,16 +458,15 @@ public async Task ProcessAsync_BindsRouteValues() var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(mock => + mock.GenerateForm( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (viewContext, actionName, controllerName, routeValues, method, htmlAttributes) => @@ -537,16 +534,15 @@ public async Task ProcessAsync_CallsIntoGenerateFormWithExpectedParameters() ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm( - viewContext, - "Index", - "Home", - It.IsAny>(), - null, - null - ) + .Setup(mock => + mock.GenerateForm( + viewContext, + "Index", + "Home", + It.IsAny>(), + null, + null + ) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -659,9 +655,8 @@ public async Task ProcessAsync_AspAreaAddsAreaToRouteValues() var expectedRouteValues = new Dictionary { { "area", "Admin" } }; var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) + .Setup(mock => + mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -714,9 +709,8 @@ public async Task ProcessAsync_EmptyStringOnAspAreaIsPassedThroughToRouteValues( var expectedRouteValues = new Dictionary { { "area", string.Empty } }; var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) + .Setup(mock => + mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -769,9 +763,8 @@ public async Task ProcessAsync_AspAreaOverridesAspRouteArea() var expectedRouteValues = new Dictionary { { "area", "Admin" } }; var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) + .Setup(mock => + mock.GenerateForm(viewContext, "Index", "Home", expectedRouteValues, null, null) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -823,15 +816,14 @@ public async Task ProcessAsync_CallsIntoGenerateRouteFormWithExpectedParameters( ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateRouteForm( - viewContext, - "Default", - It.Is(m => string.Equals(m["name"], "value")), - null, - null - ) + .Setup(mock => + mock.GenerateRouteForm( + viewContext, + "Default", + It.Is(m => string.Equals(m["name"], "value")), + null, + null + ) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -880,17 +872,16 @@ public async Task ProcessAsync_InvokesGeneratePageForm() ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GeneratePageForm( - viewContext, - "/Home/Admin/Post", - "page-handler", - null, - "hello-world", - null, - null - ) + .Setup(mock => + mock.GeneratePageForm( + viewContext, + "/Home/Admin/Post", + "page-handler", + null, + "hello-world", + null, + null + ) ) .Returns(new TagBuilder("form")) .Verifiable(); @@ -931,17 +922,16 @@ public async Task ProcessAsync_WithPageAndArea_InvokesGeneratePageForm() ); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GeneratePageForm( - viewContext, - "/Home/Admin/Post", - "page-handler", - It.IsAny(), - "hello-world", - null, - null - ) + .Setup(mock => + mock.GeneratePageForm( + viewContext, + "/Home/Admin/Post", + "page-handler", + It.IsAny(), + "hello-world", + null, + null + ) ) .Callback( ( diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/SelectTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/SelectTagHelperTest.cs index 8ecb2b9d95d..6d358571abf 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/SelectTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/SelectTagHelperTest.cs @@ -657,30 +657,28 @@ IEnumerable expectedItems var currentValues = new string[0]; htmlGenerator - .Setup( - real => - real.GetCurrentValues( - viewContext, - modelExplorer, - string.Empty, // expression - false - ) + .Setup(real => + real.GetCurrentValues( + viewContext, + modelExplorer, + string.Empty, // expression + false + ) ) // allowMultiple .Returns(currentValues) .Verifiable(); htmlGenerator - .Setup( - real => - real.GenerateSelect( - viewContext, - modelExplorer, - null, // optionLabel - string.Empty, // expression - expectedItems, - currentValues, - false, // allowMultiple - null - ) + .Setup(real => + real.GenerateSelect( + viewContext, + modelExplorer, + null, // optionLabel + string.Empty, // expression + expectedItems, + currentValues, + false, // allowMultiple + null + ) ) // htmlAttributes .Returns((TagBuilder)null) .Verifiable(); @@ -749,30 +747,28 @@ bool allowMultiple ); var currentValues = new string[0]; htmlGenerator - .Setup( - real => - real.GetCurrentValues( - viewContext, - modelExplorer, - propertyName, // expression - allowMultiple - ) + .Setup(real => + real.GetCurrentValues( + viewContext, + modelExplorer, + propertyName, // expression + allowMultiple + ) ) .Returns(currentValues) .Verifiable(); htmlGenerator - .Setup( - real => - real.GenerateSelect( - viewContext, - modelExplorer, - null, // optionLabel - propertyName, // expression - It.IsAny>(), - currentValues, - allowMultiple, - null - ) + .Setup(real => + real.GenerateSelect( + viewContext, + modelExplorer, + null, // optionLabel + propertyName, // expression + It.IsAny>(), + currentValues, + allowMultiple, + null + ) ) // htmlAttributes .Returns((TagBuilder)null) .Verifiable(); @@ -898,12 +894,11 @@ public void Process_PassesNameThrough_EvenIfNullFor() var selectList = Array.Empty(); var generator = new Mock(MockBehavior.Strict); generator - .Setup( - gen => - gen.GenerateGroupsAndOptions( /* optionLabel: */ - null, - selectList - ) + .Setup(gen => + gen.GenerateGroupsAndOptions( /* optionLabel: */ + null, + selectList + ) ) .Returns(HtmlString.Empty) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/TagHelperOutputExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/TagHelperOutputExtensionsTest.cs index 2fb40706f92..7ff89db27fc 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/TagHelperOutputExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/TagHelperOutputExtensionsTest.cs @@ -530,8 +530,8 @@ public void RemoveRange_RemovesProvidedAttributes_WithArrayInput() tagHelperOutput.Attributes.Add(expectedAttribute); var attributes = tagHelperOutput - .Attributes.Where( - item => item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) + .Attributes.Where(item => + item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) ) .ToList(); @@ -559,8 +559,8 @@ public void RemoveRange_RemovesProvidedAttributes_WithCollectionInput() ); var expectedAttribute = new TagHelperAttribute("type", "btn"); tagHelperOutput.Attributes.Add(expectedAttribute); - var attributes = tagHelperOutput.Attributes.Where( - item => item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) + var attributes = tagHelperOutput.Attributes.Where(item => + item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) ); // Act @@ -588,8 +588,8 @@ public void FindPrefixedAttributes_ReturnsEmpty_AttributeListIfNoAttributesPrefi var expectedAttribute = new TagHelperAttribute("type", "btn"); tagHelperOutput.Attributes.Add(expectedAttribute); - var attributes = tagHelperOutput.Attributes.Where( - item => item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) + var attributes = tagHelperOutput.Attributes.Where(item => + item.Name.StartsWith("route-", StringComparison.OrdinalIgnoreCase) ); // Act diff --git a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ValidationSummaryTagHelperTest.cs b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ValidationSummaryTagHelperTest.cs index 3ec5ac8bd36..050c9962693 100644 --- a/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ValidationSummaryTagHelperTest.cs +++ b/aspnetcore/src/Mvc/Mvc.TagHelpers/test/ValidationSummaryTagHelperTest.cs @@ -379,15 +379,14 @@ bool expectedExcludePropertyErrors var generator = new Mock(); generator - .Setup( - mock => - mock.GenerateValidationSummary( - expectedViewContext, - expectedExcludePropertyErrors, - null, // message - null, // headerTag - null - ) + .Setup(mock => + mock.GenerateValidationSummary( + expectedViewContext, + expectedExcludePropertyErrors, + null, // message + null, // headerTag + null + ) ) // htmlAttributes .Returns(new TagBuilder("div")) .Verifiable(); @@ -442,15 +441,14 @@ public async Task ProcessAsync_MergesTagBuilderFromGenerateValidationSummary() var generator = new Mock(MockBehavior.Strict); generator - .Setup( - mock => - mock.GenerateValidationSummary( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(mock => + mock.GenerateValidationSummary( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(tagBuilder); @@ -567,15 +565,14 @@ ValidationSummary validationSummary var generator = new Mock(); generator - .Setup( - mock => - mock.GenerateValidationSummary( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(mock => + mock.GenerateValidationSummary( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns(tagBuilder) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs b/aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs index 22dc257ddef..faa136e54ff 100644 --- a/aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs +++ b/aspnetcore/src/Mvc/Mvc.Testing/src/WebApplicationFactory.cs @@ -325,18 +325,13 @@ string tEntryPointAssemblyName var testAssembly = GetTestAssemblies(); var metadataAttributes = testAssembly .SelectMany(a => a.GetCustomAttributes()) - .Where( - a => - string.Equals( - a.Key, - tEntryPointAssemblyFullName, - StringComparison.OrdinalIgnoreCase - ) - || string.Equals( - a.Key, - tEntryPointAssemblyName, - StringComparison.OrdinalIgnoreCase - ) + .Where(a => + string.Equals( + a.Key, + tEntryPointAssemblyFullName, + StringComparison.OrdinalIgnoreCase + ) + || string.Equals(a.Key, tEntryPointAssemblyName, StringComparison.OrdinalIgnoreCase) ) .OrderBy(a => a.Priority) .ToArray(); @@ -375,11 +370,10 @@ protected virtual IEnumerable GetTestAssemblies() var entryPointAssemblyName = typeof(TEntryPoint).Assembly.GetName().Name; // Find the list of projects referencing TEntryPoint. - var candidates = context.CompileLibraries.Where( - library => - library.Dependencies.Any( - d => string.Equals(d.Name, entryPointAssemblyName, StringComparison.Ordinal) - ) + var candidates = context.CompileLibraries.Where(library => + library.Dependencies.Any(d => + string.Equals(d.Name, entryPointAssemblyName, StringComparison.Ordinal) + ) ); var testAssemblies = new List(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/AutoValidateAntiforgeryTokenAttribute.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/AutoValidateAntiforgeryTokenAttribute.cs index 54a7c1e44a1..457c815d012 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/AutoValidateAntiforgeryTokenAttribute.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/AutoValidateAntiforgeryTokenAttribute.cs @@ -50,6 +50,8 @@ public class AutoValidateAntiforgeryTokenAttribute : Attribute, IFilterFactory, /// public IFilterMetadata CreateInstance(IServiceProvider serviceProvider) { - return serviceProvider.GetRequiredService(); + return serviceProvider.GetRequiredService( + + ); } } diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/DefaultViewComponentDescriptorProvider.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/DefaultViewComponentDescriptorProvider.cs index 5b05c5916d0..4a3bef69070 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/DefaultViewComponentDescriptorProvider.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/src/ViewComponents/DefaultViewComponentDescriptorProvider.cs @@ -65,10 +65,9 @@ private static MethodInfo FindMethod(Type componentType) var componentName = componentType.FullName; var methods = componentType .GetMethods(BindingFlags.Public | BindingFlags.Instance) - .Where( - method => - string.Equals(method.Name, AsyncMethodName, StringComparison.Ordinal) - || string.Equals(method.Name, SyncMethodName, StringComparison.Ordinal) + .Where(method => + string.Equals(method.Name, AsyncMethodName, StringComparison.Ordinal) + || string.Equals(method.Name, SyncMethodName, StringComparison.Ordinal) ) .ToArray(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ControllerTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ControllerTest.cs index fb361dcea87..12c67a77301 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ControllerTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ControllerTest.cs @@ -23,11 +23,10 @@ public static IEnumerable PublicNormalMethodsFromController { return typeof(Controller) .GetTypeInfo() - .DeclaredMethods.Where( - method => - method.IsPublic - && !method.IsSpecialName - && !method.Name.Equals("Dispose", StringComparison.OrdinalIgnoreCase) + .DeclaredMethods.Where(method => + method.IsPublic + && !method.IsSpecialName + && !method.Name.Equals("Dispose", StringComparison.OrdinalIgnoreCase) ) .Select(method => new[] { method }); } diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultEditorTemplatesTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultEditorTemplatesTest.cs index 1e9f84f7424..ba195afaca5 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultEditorTemplatesTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultEditorTemplatesTest.cs @@ -103,8 +103,8 @@ public static TheoryData ObjectTemplate_ChecksWriteTo_NotT // Similar to HtmlString.Empty today. var noopContentWithEmptyToString = new Mock(MockBehavior.Strict); noopContentWithEmptyToString.Setup(c => c.ToString()).Returns(string.Empty); - noopContentWithEmptyToString.Setup( - c => c.WriteTo(It.IsAny(), It.IsAny()) + noopContentWithEmptyToString.Setup(c => + c.WriteTo(It.IsAny(), It.IsAny()) ); // Similar to an empty StringHtmlContent today. @@ -112,8 +112,8 @@ public static TheoryData ObjectTemplate_ChecksWriteTo_NotT noopContentWithNonEmptyToString .Setup(c => c.ToString()) .Returns(typeof(StringHtmlContent).FullName); - noopContentWithNonEmptyToString.Setup( - c => c.WriteTo(It.IsAny(), It.IsAny()) + noopContentWithNonEmptyToString.Setup(c => + c.WriteTo(It.IsAny(), It.IsAny()) ); // Makes noop calls on the TextWriter. @@ -283,32 +283,28 @@ string expectedLabel helperMock.SetupGet(h => h.ViewContext).Returns(helperToCopy.ViewContext); helperMock.SetupGet(h => h.ViewData).Returns(helperToCopy.ViewData); helperMock - .Setup( - h => - h.Label( - It.Is( - s => - string.Equals("Property1", s, StringComparison.Ordinal) - || string.Equals("Property2", s, StringComparison.Ordinal) - ), - null, // labelText - null - ) + .Setup(h => + h.Label( + It.Is(s => + string.Equals("Property1", s, StringComparison.Ordinal) + || string.Equals("Property2", s, StringComparison.Ordinal) + ), + null, // labelText + null + ) ) // htmlAttributes .Returns(labelContent); helperMock - .Setup( - h => - h.ValidationMessage( - It.Is( - s => - string.Equals("Property1", s, StringComparison.Ordinal) - || string.Equals("Property2", s, StringComparison.Ordinal) - ), - null, // message - null, // htmlAttributes - null - ) + .Setup(h => + h.ValidationMessage( + It.Is(s => + string.Equals("Property1", s, StringComparison.Ordinal) + || string.Equals("Property2", s, StringComparison.Ordinal) + ), + null, // message + null, // htmlAttributes + null + ) ) // tag .Returns(HtmlString.Empty); @@ -405,23 +401,21 @@ public void ObjectTemplate_IgnoresPropertiesWith_ScaffoldColumnFalse() var model = new DefaultTemplatesUtilities.ObjectWithScaffoldColumn(); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("", Enumerable.Empty())); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -654,23 +648,21 @@ public void Editor_CallsExpectedHtmlHelper(string templateName, string expectedR var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper( @@ -703,23 +695,21 @@ public void EditorFor_CallsExpectedHtmlHelper(string templateName, string expect var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper( @@ -754,23 +744,21 @@ string expectedResult var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -818,23 +806,21 @@ string expectedResult var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -881,23 +867,21 @@ string expectedResult var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -945,23 +929,21 @@ string expectedResult var model = new DefaultTemplatesUtilities.ObjectTemplateModel { Property1 = "True" }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1007,23 +989,21 @@ public void Editor_FindsViewDataMember() }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -1062,23 +1042,21 @@ public void Editor_InputTypeDateTime_RendersAsDateTime() ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1149,23 +1127,21 @@ string expectedType ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1241,23 +1217,21 @@ string expectedType ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1333,23 +1307,21 @@ string expectedType ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1423,23 +1395,21 @@ string expectedType ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1512,23 +1482,21 @@ string expectedType ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); @@ -1569,23 +1537,21 @@ public void EditorFor_FindsModel() }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -1611,23 +1577,21 @@ public void Editor_FindsModel_IfNoViewDataMember() }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -1654,23 +1618,21 @@ public void EditorFor_FindsModel_EvenIfNullOrEmpty(string propertyValue) }; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -1705,23 +1667,21 @@ public void EditorFor_DoesNotWrapExceptionThrowsDuringViewRendering() ); var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("test-view", view.Object)); var helper = DefaultTemplatesUtilities.GetHtmlHelper(model, viewEngine.Object); @@ -1738,23 +1698,21 @@ public void EditorForModel_CallsFindView_WithExpectedPath() // Arrange var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(string.Empty, Enumerable.Empty())); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "EditorTemplates/String", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "EditorTemplates/String", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found(string.Empty, new Mock().Object)) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultValidationHtmlAttributeProviderTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultValidationHtmlAttributeProviderTest.cs index 9288b999384..be48179dd3c 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultValidationHtmlAttributeProviderTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/DefaultValidationHtmlAttributeProviderTest.cs @@ -124,13 +124,12 @@ public void AddAndTrackValidationAttributes_DoesNotCallAddMethod_IfClientSideVal var attributeProviderMock = new Mock() { CallBase = true }; attributeProviderMock - .Setup( - p => - p.AddValidationAttributes( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(p => + p.AddValidationAttributes( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Verifiable(); var attributeProvider = attributeProviderMock.Object; @@ -205,13 +204,12 @@ public void AddAndTrackValidationAttributes_DoesNotCallAddMethod_IfPropertyAlrea var attributeProviderMock = new Mock() { CallBase = true }; attributeProviderMock - .Setup( - p => - p.AddValidationAttributes( - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(p => + p.AddValidationAttributes( + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Verifiable(); var attributeProvider = attributeProviderMock.Object; diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PageRemoteAttributeTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PageRemoteAttributeTest.cs index 46eb30dd2bb..e3b7e2d8916 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PageRemoteAttributeTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PageRemoteAttributeTest.cs @@ -181,11 +181,10 @@ private static ServiceCollection GetServiceCollection() serviceCollection.AddRouting(); serviceCollection.AddSingleton( - provider => - new DefaultInlineConstraintResolver( - provider.GetRequiredService>(), - provider - ) + provider => new DefaultInlineConstraintResolver( + provider.GetRequiredService>(), + provider + ) ); return serviceCollection; diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PartialViewResultTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PartialViewResultTest.cs index dcab7e94338..afd328dfbd5 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PartialViewResultTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/PartialViewResultTest.cs @@ -78,25 +78,23 @@ public async Task ExecuteResultAsync_Throws_IfViewCouldNotBeFound_MessageUsesGet var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, new[] { "Location1", "Location2" })) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, Enumerable.Empty())) .Verifiable(); @@ -132,25 +130,23 @@ public async Task ExecuteResultAsync_Throws_IfViewCouldNotBeFound_MessageUsesFin var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, new[] { "Location1", "Location2" })) .Verifiable(); @@ -188,25 +184,23 @@ public async Task ExecuteResultAsync_Throws_IfViewCouldNotBeFound_MessageUsesAll var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, new[] { "Location1", "Location2" })) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, new[] { "Location3", "Location4" })) .Verifiable(); @@ -246,25 +240,23 @@ public async Task ExecuteResultAsync_FindsAndExecutesView() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound(viewName, Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found(viewName, view.Object)) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/RemoteAttributeTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/RemoteAttributeTest.cs index d43733b7c9f..e0a80676014 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/RemoteAttributeTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/RemoteAttributeTest.cs @@ -504,11 +504,10 @@ private static ServiceCollection GetServiceCollection() serviceCollection.AddRouting(); serviceCollection.AddSingleton( - provider => - new DefaultInlineConstraintResolver( - provider.GetRequiredService>(), - provider - ) + provider => new DefaultInlineConstraintResolver( + provider.GetRequiredService>(), + provider + ) ); return serviceCollection; diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperFormExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperFormExtensionsTest.cs index b43293d3823..2c248b11650 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperFormExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperFormExtensionsTest.cs @@ -292,16 +292,15 @@ public void BeginFormWithNoParameters_CallsHtmlGeneratorWithExpectedValues() var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -333,16 +332,15 @@ public void BeginForm_WithAntiforgery_CallsHtmlGeneratorWithExpectedValues() var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -374,16 +372,15 @@ public void BeginForm_SuppressAntiforgery_CallsHtmlGeneratorWithExpectedValues() var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -412,16 +409,15 @@ public void BeginFormWithMethodParameter_CallsHtmlGeneratorWithExpectedValues(Fo var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - method.ToString().ToLowerInvariant(), - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + method.ToString().ToLowerInvariant(), + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -461,16 +457,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -510,16 +505,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -559,16 +553,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -603,16 +596,15 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - null, // actionName - null, // controllerName - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + null, // actionName + null, // controllerName + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -648,16 +640,15 @@ string controllerName var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -694,16 +685,15 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -740,16 +730,15 @@ FormMethod method var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - null, // routeValues - method.ToString().ToLowerInvariant(), - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + null, // routeValues + method.ToString().ToLowerInvariant(), + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -791,16 +780,15 @@ FormMethod method var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - routeValues, - method.ToString().ToLowerInvariant(), - null - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + routeValues, + method.ToString().ToLowerInvariant(), + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -842,16 +830,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -893,16 +880,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -947,16 +933,15 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateForm( - htmlHelper.ViewContext, - actionName, - controllerName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateForm( + htmlHelper.ViewContext, + actionName, + controllerName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -994,15 +979,14 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - null, // routeName - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + null, // routeName + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1037,15 +1021,14 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - null, // routeName - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + null, // routeName + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1080,15 +1063,14 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - null, // routeName - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + null, // routeName + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1119,15 +1101,14 @@ string routeName var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1162,15 +1143,14 @@ string routeName var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1205,15 +1185,14 @@ string routeName var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1245,15 +1224,14 @@ object routeValues var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - routeValues, - "post", // method - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + routeValues, + "post", // method + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1289,15 +1267,14 @@ FormMethod method var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - method.ToString().ToLowerInvariant(), - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + method.ToString().ToLowerInvariant(), + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1338,15 +1315,14 @@ FormMethod method var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - routeValues, - method.ToString().ToLowerInvariant(), - null - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + routeValues, + method.ToString().ToLowerInvariant(), + null + ) ) // htmlAttributes .Returns(tagBuilder) .Verifiable(); @@ -1387,15 +1363,14 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -1436,15 +1411,14 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); @@ -1487,15 +1461,14 @@ object htmlAttributes var htmlGenerator = new Mock(MockBehavior.Strict); var htmlHelper = DefaultTemplatesUtilities.GetHtmlHelper(htmlGenerator.Object); htmlGenerator - .Setup( - g => - g.GenerateRouteForm( - htmlHelper.ViewContext, - routeName, - null, // routeValues - method.ToString().ToLowerInvariant(), - htmlAttributes - ) + .Setup(g => + g.GenerateRouteForm( + htmlHelper.ViewContext, + routeName, + null, // routeValues + method.ToString().ToLowerInvariant(), + htmlAttributes + ) ) .Returns(tagBuilder) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperLinkGenerationTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperLinkGenerationTest.cs index b8562af0ac3..273b478e2f8 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperLinkGenerationTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/Rendering/HtmlHelperLinkGenerationTest.cs @@ -227,14 +227,13 @@ private string GetRouteValuesAsString(object routeValues) var dict = PropertyHelper.ObjectToDictionary(routeValues); return string.Join( string.Empty, - dict.Select( - kvp => - string.Format( - CultureInfo.InvariantCulture, - "{0}={1}", - kvp.Key, - kvp.Value.ToString() - ) + dict.Select(kvp => + string.Format( + CultureInfo.InvariantCulture, + "{0}={1}", + kvp.Key, + kvp.Value.ToString() + ) ) ); } @@ -244,14 +243,13 @@ private string GetHtmlAttributesAsString(object routeValues) var dict = PropertyHelper.ObjectToDictionary(routeValues); return string.Join( string.Empty, - dict.Select( - kvp => - string.Format( - CultureInfo.InvariantCulture, - " {0}=\"HtmlEncode[[{1}]]\"", - kvp.Key, - kvp.Value.ToString() - ) + dict.Select(kvp => + string.Format( + CultureInfo.InvariantCulture, + " {0}=\"HtmlEncode[[{1}]]\"", + kvp.Key, + kvp.Value.ToString() + ) ) ); } diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs index f063c999ca7..c70d64bef8f 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/TemplateRendererTest.cs @@ -75,8 +75,8 @@ public void GetTypeNames_ReturnsExpectedResults(Type fieldType, string[] expecte var typeNames = TemplateRenderer.GetTypeNames(metadata, fieldType); // Assert - var collectionAssertions = expectedResult.Select>( - expected => actual => Assert.Equal(expected, actual) + var collectionAssertions = expectedResult.Select>(expected => + actual => Assert.Equal(expected, actual) ); Assert.Collection(typeNames, collectionAssertions.ToArray()); } diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs index 5319f99a599..c8e37c5942b 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponentResultTest.cs @@ -419,8 +419,8 @@ public async Task ExecuteResultAsync_WithCustomViewComponentHelper() }; var result = Task.FromResult(new HtmlContentBuilder().AppendHtml(expected)); - var helper = Mock.Of( - h => h.InvokeAsync(It.IsAny(), It.IsAny()) == result + var helper = Mock.Of(h => + h.InvokeAsync(It.IsAny(), It.IsAny()) == result ); var httpContext = new DefaultHttpContext(); @@ -463,8 +463,8 @@ public async Task ExecuteResultAsync_WithCustomViewComponentHelper_ForLargeText( }; var result = Task.FromResult(new HtmlContentBuilder().AppendHtml(expected)); - var helper = Mock.Of( - h => h.InvokeAsync(It.IsAny(), It.IsAny()) == result + var helper = Mock.Of(h => + h.InvokeAsync(It.IsAny(), It.IsAny()) == result ); var httpContext = new DefaultHttpContext(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs index 0614813ade6..aaee96b6ee2 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewComponents/ViewViewComponentResultTest.cs @@ -35,24 +35,22 @@ public void Execute_RendersPartialViews() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/some-view", view.Object)) .Verifiable(); @@ -88,13 +86,12 @@ public void Execute_ResolvesView_WithDefaultAsViewName() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/Default", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/Default", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/Default", view.Object)) .Verifiable(); @@ -129,13 +126,12 @@ public void Execute_ResolvesView_AndWritesDiagnosticListener() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/Default", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/Default", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/Default", view.Object)) .Verifiable(); @@ -183,24 +179,22 @@ public void Execute_ThrowsIfPartialViewCannotBeFound_MessageUsesGetViewLocations var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", new[] { "location1", "location2" })) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns( ViewEngineResult.NotFound("Components/Invoke/some-view", Enumerable.Empty()) @@ -241,24 +235,22 @@ public void Execute_ThrowsIfPartialViewCannotBeFound_MessageUsesFindViewLocation var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns( ViewEngineResult.NotFound( @@ -304,24 +296,22 @@ public void Execute_ThrowsIfPartialViewCannotBeFound_MessageUsesAllLocations() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", new[] { "location1", "location2" })) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns( ViewEngineResult.NotFound( @@ -361,24 +351,22 @@ public void Execute_DoesNotWrapThrownExceptionsInAggregateExceptions() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/some-view", view.Object)) .Verifiable(); @@ -411,24 +399,22 @@ public async Task ExecuteAsync_RendersPartialViews() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/some-view", view)) .Verifiable(); @@ -460,24 +446,22 @@ public async Task ExecuteAsync_ResolvesViewEngineFromServiceProvider_IfNoViewEng var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.NotFound("some-view", Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found("Components/Invoke/some-view", view)) .Verifiable(); @@ -527,26 +511,24 @@ public async Task ExecuteAsync_ThrowsIfPartialViewCannotBeFound() var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - "some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + "some-view", /*isMainPage*/ + false + ) ) .Returns( ViewEngineResult.NotFound("some-view", new[] { "view-location1", "view-location2" }) ) .Verifiable(); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - "Components/Invoke/some-view", /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + "Components/Invoke/some-view", /*isMainPage*/ + false + ) ) .Returns( ViewEngineResult.NotFound( @@ -619,13 +601,12 @@ public void Execute_CallsFindView_WithExpectedPath_WhenViewNameIsNullOrEmpty(str var expectedViewName = $"Components/{shortName}/Default"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.FindView( - It.IsAny(), - expectedViewName, /*isMainPage*/ - false - ) + .Setup(v => + v.FindView( + It.IsAny(), + expectedViewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found(expectedViewName, new Mock().Object)) .Verifiable(); @@ -650,13 +631,12 @@ public void Execute_CallsFindView_WithExpectedPath_WhenViewNameIsSpecified(strin // Arrange var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - v => - v.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - false - ) + .Setup(v => + v.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + false + ) ) .Returns(ViewEngineResult.Found(viewName, new Mock().Object)) .Verifiable(); diff --git a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewResultExecutorTest.cs b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewResultExecutorTest.cs index a2430286d5a..47c82678b9b 100644 --- a/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewResultExecutorTest.cs +++ b/aspnetcore/src/Mvc/Mvc.ViewFeatures/test/ViewResultExecutorTest.cs @@ -27,24 +27,22 @@ public void FindView_UsesViewEngine_FromViewResult() var viewName = "my-view"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - viewName, /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + viewName, /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound(viewName, Enumerable.Empty())) .Verifiable(); viewEngine - .Setup( - e => - e.FindView( - context, - viewName, /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + context, + viewName, /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.Found(viewName, Mock.Of())) .Verifiable(); @@ -129,23 +127,21 @@ public void FindView_ReturnsExpectedNotFoundResult_WithGetViewLocations() var viewName = "myview"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", expectedLocations)); viewEngine - .Setup( - e => - e.FindView( - context, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + context, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", Enumerable.Empty())); @@ -177,23 +173,21 @@ public void FindView_ReturnsExpectedNotFoundResult_WithFindViewLocations() var viewName = "myview"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", Enumerable.Empty())); viewEngine - .Setup( - e => - e.FindView( - context, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + context, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", expectedLocations)); @@ -225,23 +219,21 @@ public void FindView_ReturnsExpectedNotFoundResult_WithAllLocations() var viewName = "myview"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", new[] { "location1", "location2" })); viewEngine - .Setup( - e => - e.FindView( - context, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + context, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", new[] { "location3", "location4" })); @@ -309,23 +301,21 @@ public void FindView_WritesDiagnostic_ViewNotFound() var viewName = "myview"; var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", Enumerable.Empty())); viewEngine - .Setup( - e => - e.FindView( - context, - "myview", /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + context, + "myview", /*isMainPage*/ + true + ) ) .Returns(ViewEngineResult.NotFound("myview", new string[] { "location/myview" })); @@ -419,25 +409,23 @@ private ViewResultExecutor GetViewExecutor(DiagnosticListener diagnosticListener var viewEngine = new Mock(MockBehavior.Strict); viewEngine - .Setup( - e => - e.GetView( /*executingFilePath*/ - null, - It.IsAny(), /*isMainPage*/ - true - ) + .Setup(e => + e.GetView( /*executingFilePath*/ + null, + It.IsAny(), /*isMainPage*/ + true + ) ) .Returns( (path, name, partial) => ViewEngineResult.NotFound(name, Enumerable.Empty()) ); viewEngine - .Setup( - e => - e.FindView( - It.IsAny(), - It.IsAny(), /*isMainPage*/ - true - ) + .Setup(e => + e.FindView( + It.IsAny(), + It.IsAny(), /*isMainPage*/ + true + ) ) .Returns( (context, name, partial) => ViewEngineResult.Found(name, Mock.Of()) diff --git a/aspnetcore/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs b/aspnetcore/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs index 5b483fe0d9b..768e550b1ce 100644 --- a/aspnetcore/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs +++ b/aspnetcore/src/Mvc/Mvc/test/MvcServiceCollectionExtensionsTest.cs @@ -276,10 +276,9 @@ public void AddControllersWithViews_AddsDocumentedServices() // No Razor Pages Assert.Empty( - services.Where( - s => - s.ServiceType == typeof(IActionInvokerProvider) - && s.ImplementationType == typeof(PageActionInvokerProvider) + services.Where(s => + s.ServiceType == typeof(IActionInvokerProvider) + && s.ImplementationType == typeof(PageActionInvokerProvider) ) ); } @@ -659,8 +658,8 @@ private void AssertServiceCountEquals( int expectedServiceRegistrationCount ) { - var serviceDescriptors = services.Where( - serviceDescriptor => serviceDescriptor.ServiceType == serviceType + var serviceDescriptors = services.Where(serviceDescriptor => + serviceDescriptor.ServiceType == serviceType ); var actual = serviceDescriptors.Count(); @@ -682,8 +681,8 @@ Type implementationType ) { var matches = services - .Where( - sd => sd.ServiceType == serviceType && sd.ImplementationType == implementationType + .Where(sd => + sd.ServiceType == serviceType && sd.ImplementationType == implementationType ) .ToArray(); diff --git a/aspnetcore/src/Mvc/perf/Microbenchmarks/Microsoft.AspNetCore.Mvc/PreserveComponentStateBenchmark.cs b/aspnetcore/src/Mvc/perf/Microbenchmarks/Microsoft.AspNetCore.Mvc/PreserveComponentStateBenchmark.cs index bba85600c39..6a93468c96f 100644 --- a/aspnetcore/src/Mvc/perf/Microbenchmarks/Microsoft.AspNetCore.Mvc/PreserveComponentStateBenchmark.cs +++ b/aspnetcore/src/Mvc/perf/Microbenchmarks/Microsoft.AspNetCore.Mvc/PreserveComponentStateBenchmark.cs @@ -76,7 +76,9 @@ public async Task PersistComponentStateTagHelperWebAssemblyAsync() { _tagHelper.ViewContext = GetViewContext(); var state = - _tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService(); + _tagHelper.ViewContext.HttpContext.RequestServices.GetRequiredService( + + ); foreach (var (key, value) in _entries) { state.PersistAsJson(key, value); diff --git a/aspnetcore/src/Mvc/perf/benchmarkapps/BasicApi/Startup.cs b/aspnetcore/src/Mvc/perf/benchmarkapps/BasicApi/Startup.cs index 63bf81c9cc9..bd58528b6d5 100644 --- a/aspnetcore/src/Mvc/perf/benchmarkapps/BasicApi/Startup.cs +++ b/aspnetcore/src/Mvc/perf/benchmarkapps/BasicApi/Startup.cs @@ -72,8 +72,8 @@ public void ConfigureServices(IServiceCollection services) case "MYSQL": services .AddEntityFrameworkMySql() - .AddDbContextPool( - options => options.UseMySql(connectionString) + .AddDbContextPool(options => + options.UseMySql(connectionString) ); break; #endif @@ -93,8 +93,8 @@ public void ConfigureServices(IServiceCollection services) services .AddEntityFrameworkNpgsql() - .AddDbContextPool( - options => options.UseNpgsql(connectionString) + .AddDbContextPool(options => + options.UseNpgsql(connectionString) ); break; @@ -102,16 +102,16 @@ public void ConfigureServices(IServiceCollection services) _isSQLite = true; services .AddEntityFrameworkSqlite() - .AddDbContextPool( - options => options.UseSqlite("Data Source=BasicApi.db;Cache=Shared") + .AddDbContextPool(options => + options.UseSqlite("Data Source=BasicApi.db;Cache=Shared") ); break; case "SQLSERVER": services .AddEntityFrameworkSqlServer() - .AddDbContextPool( - options => options.UseSqlServer(connectionString) + .AddDbContextPool(options => + options.UseSqlServer(connectionString) ); break; @@ -145,10 +145,9 @@ public void ConfigureServices(IServiceCollection services) services .AddMvcCore() .AddAuthorization() - .AddNewtonsoftJson( - options => - options.SerializerSettings.ContractResolver = - new CamelCasePropertyNamesContractResolver() + .AddNewtonsoftJson(options => + options.SerializerSettings.ContractResolver = + new CamelCasePropertyNamesContractResolver() ) .AddDataAnnotations(); } @@ -166,20 +165,19 @@ public void Configure(IApplicationBuilder app, IApplicationLifetime lifetime) lifetime.ApplicationStopping.Register(() => DropDatabaseTables(services)); } - app.Use( - next => - async context => + app.Use(next => + async context => + { + try + { + await next(context); + } + catch (Exception ex) { - try - { - await next(context); - } - catch (Exception ex) - { - Console.WriteLine(ex); - throw; - } + Console.WriteLine(ex); + throw; } + } ); app.UseRouting(); diff --git a/aspnetcore/src/Mvc/perf/benchmarkapps/BasicViews/Migrations/20180609000611_InitialCreate.cs b/aspnetcore/src/Mvc/perf/benchmarkapps/BasicViews/Migrations/20180609000611_InitialCreate.cs index 3cb560a5cdc..0cc071fa43e 100644 --- a/aspnetcore/src/Mvc/perf/benchmarkapps/BasicViews/Migrations/20180609000611_InitialCreate.cs +++ b/aspnetcore/src/Mvc/perf/benchmarkapps/BasicViews/Migrations/20180609000611_InitialCreate.cs @@ -11,30 +11,29 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "People", - columns: table => - new - { - Id = table - .Column(nullable: false) + columns: table => new + { + Id = table + .Column(nullable: false) #if !NETFRAMEWORK - .Annotation( - "MySql:ValueGenerationStrategy", - MySqlValueGenerationStrategy.IdentityColumn - ) + .Annotation( + "MySql:ValueGenerationStrategy", + MySqlValueGenerationStrategy.IdentityColumn + ) #endif - .Annotation( - "Npgsql:ValueGenerationStrategy", - NpgsqlValueGenerationStrategy.SerialColumn - ) - .Annotation("Sqlite:Autoincrement", true) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - Name = table.Column(maxLength: 27, nullable: true), - Age = table.Column(nullable: false), - BirthDate = table.Column(nullable: false) - }, + .Annotation( + "Npgsql:ValueGenerationStrategy", + NpgsqlValueGenerationStrategy.SerialColumn + ) + .Annotation("Sqlite:Autoincrement", true) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + Name = table.Column(maxLength: 27, nullable: true), + Age = table.Column(nullable: false), + BirthDate = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_People", x => x.Id); diff --git a/aspnetcore/src/Mvc/shared/Mvc.Core.TestCommon/CommonResourceInvokerTest.cs b/aspnetcore/src/Mvc/shared/Mvc.Core.TestCommon/CommonResourceInvokerTest.cs index 977c85ca6c8..baa31628c92 100644 --- a/aspnetcore/src/Mvc/shared/Mvc.Core.TestCommon/CommonResourceInvokerTest.cs +++ b/aspnetcore/src/Mvc/shared/Mvc.Core.TestCommon/CommonResourceInvokerTest.cs @@ -802,12 +802,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter() // Arrange var filter = new Mock(MockBehavior.Strict); filter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (context, next) => await next() @@ -887,12 +886,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter_ShortCircuit_WithCancel( var filter2 = new Mock(MockBehavior.Strict); filter2 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -946,12 +944,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter_ShortCircuit_WithoutCanc var filter2 = new Mock(MockBehavior.Strict); filter2 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -995,12 +992,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter_ShortCircuit_WithoutCanc // Arrange var filter = new Mock(MockBehavior.Strict); filter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1115,12 +1111,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter_WithExceptionThrownByRes var filter = new Mock(MockBehavior.Strict); filter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1226,12 +1221,11 @@ public async Task InvokeAction_InvokesAsyncResultFilter_WithExceptionThrownByRes var resultFilter1 = new Mock(MockBehavior.Strict); resultFilter1 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1289,12 +1283,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter() // Arrange var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1355,12 +1348,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_WithActionResult_FromA ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1397,12 +1389,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_WithActionResult_FromE ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1454,12 +1445,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_WithActionResult_FromR ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1506,12 +1496,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_HandleException_FromAc ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1553,12 +1542,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_HandlesException_FromR ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1607,12 +1595,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_HandleException_BySett ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1655,12 +1642,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ThrowsUnhandledExcepti ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1672,12 +1658,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ThrowsUnhandledExcepti var resourceFilter2 = new Mock(MockBehavior.Strict); resourceFilter2 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -1710,12 +1695,11 @@ public async Task InvokeAction_InvokesResourceFilter_OnResourceExecuting_ThrowsU ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1759,12 +1743,11 @@ public async Task InvokeAction_InvokesResourceFilter_OnResourceExecuted_ThrowsUn ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1812,12 +1795,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ShortCircuit() ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1829,12 +1811,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ShortCircuit() var resourceFilter2 = new Mock(MockBehavior.Strict); resourceFilter2 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -1878,12 +1859,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ShortCircuit_WithoutRe ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -1895,12 +1875,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_ShortCircuit_WithoutRe var resourceFilter2 = new Mock(MockBehavior.Strict); resourceFilter2 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -1948,12 +1927,11 @@ public async Task InvokeAction_InvokesResourceFilter_ShortCircuit() ResourceExecutedContext context = null; var resourceFilter1 = new Mock(MockBehavior.Strict); resourceFilter1 - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -2008,12 +1986,11 @@ public async Task InvokeAction_InvokesAsyncResourceFilter_InvalidShortCircuit() ResourceExecutedContext context = null; var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -2039,12 +2016,11 @@ public async Task InvokeAction_AuthorizationFilter_ChallengePreventsResourceFilt // Arrange var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( async (c, next) => @@ -2124,12 +2100,11 @@ public async Task InvokeAction_AuthorizationFilterShortCircuit_InvokesAsyncAlway // Arrange var resultFilter = new Mock(MockBehavior.Strict); resultFilter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -2170,22 +2145,20 @@ public async Task InvokeAction_AuthorizationFilterShortCircuit_DoesNotRunResultF resultFilter1.Setup(f => f.OnResultExecuted(It.IsAny())); var resultFilter2 = new Mock(MockBehavior.Strict); - resultFilter2.Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + resultFilter2.Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ); var resultFilter3 = new Mock(MockBehavior.Strict); resultFilter3 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.CompletedTask); @@ -2255,12 +2228,11 @@ public async Task InvokeAction_ResourceFilterShortCircuit_InvokesAlwaysRunResult var resourceFilter = new Mock(MockBehavior.Strict); resourceFilter - .Setup( - f => - f.OnResourceExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResourceExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -2287,12 +2259,11 @@ public async Task InvokeAction_ResourceFilterShortCircuit_InvokesAsyncAlwaysRunR // Arrange var resultFilter = new Mock(MockBehavior.Strict); resultFilter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -2328,22 +2299,20 @@ public async Task InvokeAction_ResourceFilterShortCircuit_DoesNotRunResultFilter resultFilter1.Setup(f => f.OnResultExecuted(It.IsAny())); var resultFilter2 = new Mock(MockBehavior.Strict); - resultFilter2.Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + resultFilter2.Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ); var resultFilter3 = new Mock(MockBehavior.Strict); resultFilter3 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.CompletedTask); @@ -2433,12 +2402,11 @@ public async Task InvokeAction_ExceptionFilterShortCircuit_InvokesAsyncAlwaysRun // Arrange var resultFilter = new Mock(MockBehavior.Strict); resultFilter - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns( (c, next) => @@ -2475,22 +2443,20 @@ public async Task InvokeAction_ExceptionFilterShortCircuit_DoesNotRunResultFilte resultFilter1.Setup(f => f.OnResultExecuted(It.IsAny())); var resultFilter2 = new Mock(MockBehavior.Strict); - resultFilter2.Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + resultFilter2.Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ); var resultFilter3 = new Mock(MockBehavior.Strict); resultFilter3 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns(Task.CompletedTask); @@ -2562,24 +2528,22 @@ public async Task InvokeAction_AlwaysRunResultFiltersAndRunWithResultFilters() var resultFilter3 = new Mock(MockBehavior.Strict); resultFilter3 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns((c, next) => next()) .Verifiable(); var resultFilter4 = new Mock(MockBehavior.Strict); resultFilter4 - .Setup( - f => - f.OnResultExecutionAsync( - It.IsAny(), - It.IsAny() - ) + .Setup(f => + f.OnResultExecutionAsync( + It.IsAny(), + It.IsAny() + ) ) .Returns((c, next) => next()) .Verifiable(); diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs index 212c3412e55..beeed0db361 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs @@ -41,11 +41,10 @@ ITestOutputHelper testOutputHelper fixture.Factories.FirstOrDefault() ?? fixture.WithWebHostBuilder(b => b.UseStartup()); Client = factory - .WithWebHostBuilder( - builder => - builder.ConfigureLogging( - l => l.Services.AddSingleton(loggerProvider) - ) + .WithWebHostBuilder(builder => + builder.ConfigureLogging(l => + l.Services.AddSingleton(loggerProvider) + ) ) .CreateDefaultClient(); // These tests want to verify runtime compilation and formatting in the HTML of the error page @@ -63,14 +62,12 @@ public async Task CompilationFailuresAreListedByErrorPageMiddleware() var factory = _fixture.Factories.FirstOrDefault() ?? _fixture.WithWebHostBuilder(b => b.UseStartup()); - factory = factory.WithWebHostBuilder( - b => - b.ConfigureTestServices( - serviceCollection => - serviceCollection.Configure( - ConfigureRuntimeCompilationOptions - ) + factory = factory.WithWebHostBuilder(b => + b.ConfigureTestServices(serviceCollection => + serviceCollection.Configure( + ConfigureRuntimeCompilationOptions ) + ) ); var client = factory.CreateDefaultClient(); diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs index e472a6c2cdb..51b718ba782 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationWithCultureTest.cs @@ -27,8 +27,8 @@ MvcTestFixture fixture ) : base(testOutputHelper) { - Factory = fixture.WithWebHostBuilder( - builder => builder.UseStartup() + Factory = fixture.WithWebHostBuilder(builder => + builder.UseStartup() ); Client = Factory.CreateDefaultClient(); } @@ -147,11 +147,10 @@ public async Task CacheTagHelper_VaryByCultureComposesWithOtherVaryByOptions() { // Arrange var client = Factory - .WithWebHostBuilder( - builder => - builder - .UseStartup() - .ConfigureTestServices(services => services.AddSingleton(LoggerFactory)) + .WithWebHostBuilder(builder => + builder + .UseStartup() + .ConfigureTestServices(services => services.AddSingleton(LoggerFactory)) ) .CreateDefaultClient(); string culture; diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/JsonResultWithNewtonsoftJsonTest.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/JsonResultWithNewtonsoftJsonTest.cs index 710158bd791..dd42eedbcf6 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/JsonResultWithNewtonsoftJsonTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/JsonResultWithNewtonsoftJsonTest.cs @@ -20,12 +20,11 @@ public JsonResultWithNewtonsoftJsonTest( { var factory = fixture.Factories.FirstOrDefault() - ?? fixture.WithWebHostBuilder( - b => b.UseStartup() + ?? fixture.WithWebHostBuilder(b => + b.UseStartup() ); - factory = factory.WithWebHostBuilder( - b => - b.ConfigureTestServices(serviceCollection => _serviceCollection = serviceCollection) + factory = factory.WithWebHostBuilder(b => + b.ConfigureTestServices(serviceCollection => _serviceCollection = serviceCollection) ); Client = factory.CreateDefaultClient(); diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RazorBuildTest.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RazorBuildTest.cs index b0258a539ab..4ca4b4dd0ae 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RazorBuildTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RazorBuildTest.cs @@ -17,14 +17,12 @@ public RazorBuildTest(MvcTestFixture fixture) var factory = fixture.Factories.FirstOrDefault() ?? fixture.WithWebHostBuilder(b => b.UseStartup()); - factory = factory.WithWebHostBuilder( - b => - b.ConfigureTestServices( - serviceCollection => - serviceCollection.Configure( - ConfigureRuntimeCompilationOptions - ) + factory = factory.WithWebHostBuilder(b => + b.ConfigureTestServices(serviceCollection => + serviceCollection.Configure( + ConfigureRuntimeCompilationOptions ) + ) ); Client = factory.CreateDefaultClient(); diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RoutingDynamicOrderTest.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RoutingDynamicOrderTest.cs index 29d05461a2b..7783631e719 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RoutingDynamicOrderTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/RoutingDynamicOrderTest.cs @@ -28,15 +28,14 @@ private static void ConfigureWebHostBuilder(IWebHostBuilder builder) => [Fact] public async Task PrefersAttributeRoutesOverDynamicControllerRoutes() { - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite - .StartupForDynamicOrder - .DynamicOrderScenarios - .AttributeRouteDynamicRoute - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite + .StartupForDynamicOrder + .DynamicOrderScenarios + .AttributeRouteDynamicRoute + ) ); var client = factory.CreateClient(); @@ -61,12 +60,11 @@ public async Task DynamicRoutesAreMatchedInDefinitionOrderOverPrecedence() "Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior", isEnabled: true ); - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite.StartupForDynamicOrder.DynamicOrderScenarios.MultipleDynamicRoute - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite.StartupForDynamicOrder.DynamicOrderScenarios.MultipleDynamicRoute + ) ); var client = factory.CreateClient(); @@ -92,15 +90,14 @@ public async Task ConventionalRoutesDefinedEarlierWinOverDynamicControllerRoutes "Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior", isEnabled: true ); - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite - .StartupForDynamicOrder - .DynamicOrderScenarios - .ConventionalRouteDynamicRoute - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite + .StartupForDynamicOrder + .DynamicOrderScenarios + .ConventionalRouteDynamicRoute + ) ); var client = factory.CreateClient(); @@ -125,15 +122,14 @@ public async Task ConventionalRoutesDefinedLaterLooseToDynamicControllerRoutes() "Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior", isEnabled: true ); - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite - .StartupForDynamicOrder - .DynamicOrderScenarios - .ConventionalRouteDynamicRoute - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite + .StartupForDynamicOrder + .DynamicOrderScenarios + .ConventionalRouteDynamicRoute + ) ); var client = factory.CreateClient(); @@ -159,15 +155,14 @@ public async Task DynamicPagesDefinedEarlierWinOverDynamicControllers() "Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior", isEnabled: true ); - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite - .StartupForDynamicOrder - .DynamicOrderScenarios - .DynamicControllerAndPages - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite + .StartupForDynamicOrder + .DynamicOrderScenarios + .DynamicControllerAndPages + ) ); var client = factory.CreateClient(); @@ -191,15 +186,14 @@ public async Task DynamicPagesDefinedLaterLooseOverDynamicControllers() "Microsoft.AspNetCore.Routing.UseCorrectCatchAllBehavior", isEnabled: true ); - var factory = Factory.WithWebHostBuilder( - b => - b.UseSetting( - "Scenario", - RoutingWebSite - .StartupForDynamicOrder - .DynamicOrderScenarios - .DynamicControllerAndPages - ) + var factory = Factory.WithWebHostBuilder(b => + b.UseSetting( + "Scenario", + RoutingWebSite + .StartupForDynamicOrder + .DynamicOrderScenarios + .DynamicControllerAndPages + ) ); var client = factory.CreateClient(); diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/SimpleWithWebApplicationBuilderTests.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/SimpleWithWebApplicationBuilderTests.cs index e899bdbd99e..dd67136520b 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/SimpleWithWebApplicationBuilderTests.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/SimpleWithWebApplicationBuilderTests.cs @@ -141,7 +141,9 @@ public async Task DefaultEnvironment_Is_Development() // Arrange var expected = "Development"; using var client = - new WebApplicationFactory().CreateClient(); + new WebApplicationFactory( + + ).CreateClient(); // Act var content = await client.GetStringAsync("http://localhost/environment"); @@ -266,9 +268,9 @@ public async Task FileUpload_Works_WithAntiforgeryToken() using var client = _fixture.CreateDefaultClient(); var antiforgery = _fixture.Services.GetRequiredService(); - var antiforgeryOptions = _fixture.Services.GetRequiredService< - IOptions - >(); + var antiforgeryOptions = _fixture.Services.GetRequiredService>( + + ); var tokens = antiforgery.GetAndStoreTokens(new DefaultHttpContext()); client.DefaultRequestHeaders.Add( "Cookie", diff --git a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs index 3078451ebde..59bba701bbd 100644 --- a/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs +++ b/aspnetcore/src/Mvc/test/Mvc.FunctionalTests/TestingInfrastructureInheritanceTests.cs @@ -20,8 +20,8 @@ public void TestingInfrastructure_WebHost_WithWebHostBuilderRespectsCustomizatio using var factory = new CustomizedFactory(); using var customized = factory .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) - .WithWebHostBuilder( - builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization") + .WithWebHostBuilder(builder => + factory.ConfigureWebHostCalled.Add("FurtherCustomization") ); var client = customized.CreateClient(); @@ -45,8 +45,8 @@ public void TestingInfrastructure_GenericHost_WithWithHostBuilderRespectsCustomi using var factory = new CustomizedFactory(); using var customized = factory .WithWebHostBuilder(builder => factory.ConfigureWebHostCalled.Add("Customization")) - .WithWebHostBuilder( - builder => factory.ConfigureWebHostCalled.Add("FurtherCustomization") + .WithWebHostBuilder(builder => + factory.ConfigureWebHostCalled.Add("FurtherCustomization") ); var client = customized.CreateClient(); diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeIntegrationTestBase.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeIntegrationTestBase.cs index 58daa1e745c..bdb0362fd78 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeIntegrationTestBase.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ComplexTypeIntegrationTestBase.cs @@ -2902,8 +2902,8 @@ public async Task ModelNameOnPropertyType_WithData_Succeeds(BindingInfo bindingI ParameterType = typeof(Person12), }; - var testContext = GetTestContext( - request => request.QueryString = new QueryString("?HomeAddress.Street=someStreet") + var testContext = GetTestContext(request => + request.QueryString = new QueryString("?HomeAddress.Street=someStreet") ); var modelState = testContext.ModelState; @@ -2954,8 +2954,8 @@ public async Task ModelNameOnParameterType_WithData_Succeeds(BindingInfo binding ParameterType = typeof(Address12), }; - var testContext = GetTestContext( - request => request.QueryString = new QueryString("?HomeAddress.Street=someStreet") + var testContext = GetTestContext(request => + request.QueryString = new QueryString("?HomeAddress.Street=someStreet") ); var modelState = testContext.ModelState; @@ -3024,11 +3024,10 @@ public async Task BindAttributeOnPropertyType_WithData_Succeeds(BindingInfo bind ParameterType = typeof(Person13), }; - var testContext = GetTestContext( - request => - request.QueryString = new QueryString( - "?Address.Number=23&Address.Street=someStreet&Address.City=Redmond&Address.State=WA" - ) + var testContext = GetTestContext(request => + request.QueryString = new QueryString( + "?Address.Number=23&Address.Street=someStreet&Address.City=Redmond&Address.State=WA" + ) ); var modelState = testContext.ModelState; @@ -3084,11 +3083,10 @@ public async Task BindAttributeOnParameterType_WithData_Succeeds(BindingInfo bin ParameterType = typeof(Address13), }; - var testContext = GetTestContext( - request => - request.QueryString = new QueryString( - "?Number=23&Street=someStreet&City=Redmond&State=WA" - ) + var testContext = GetTestContext(request => + request.QueryString = new QueryString( + "?Number=23&Street=someStreet&City=Redmond&State=WA" + ) ); var modelState = testContext.ModelState; @@ -3696,8 +3694,8 @@ public async Task ModelBindingSystem_BindsWith3Binders() ParameterType = typeof(ThreeDeepModel), }; - var testContext = GetTestContext( - updateOptions: options => options.MaxModelBindingRecursionDepth = 3 + var testContext = GetTestContext(updateOptions: options => + options.MaxModelBindingRecursionDepth = 3 ); var modelState = testContext.ModelState; @@ -3745,8 +3743,8 @@ public async Task ModelBindingSystem_ThrowsOn4Binders() ParameterType = typeof(FourDeepModel), }; - var testContext = GetTestContext( - updateOptions: options => options.MaxModelBindingRecursionDepth = 3 + var testContext = GetTestContext(updateOptions: options => + options.MaxModelBindingRecursionDepth = 3 ); var modelState = testContext.ModelState; diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/DictionaryModelBinderIntegrationTest.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/DictionaryModelBinderIntegrationTest.cs index 1aa5b075703..2dfa07cf2cf 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/DictionaryModelBinderIntegrationTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/DictionaryModelBinderIntegrationTest.cs @@ -1029,8 +1029,8 @@ string queryString ParameterType = typeof(Dictionary) }; - var testContext = ModelBindingTestHelper.GetTestContext( - request => request.QueryString = new QueryString(queryString) + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString(queryString) ); var modelState = testContext.ModelState; diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/GenericModelBinderIntegrationTest.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/GenericModelBinderIntegrationTest.cs index 7d23c90bea9..6b5004896da 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/GenericModelBinderIntegrationTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/GenericModelBinderIntegrationTest.cs @@ -188,8 +188,8 @@ public async Task GenericModelBinder_BindsCollection_ElementTypeUsesGreedyModelB { // Arrange // Need to have a key here so that the GenericModelBinder will recurse to bind elements. - var testContext = ModelBindingTestHelper.GetTestContext( - request => request.QueryString = new QueryString("?parameter.index=0") + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString("?parameter.index=0") ); var modelState = testContext.ModelState; @@ -233,8 +233,8 @@ public async Task GenericModelBinder_BindsCollection_ElementTypeUsesGreedyBindin }; // Need to have a key here so that the GenericModelBinder will recurse to bind elements. - var testContext = ModelBindingTestHelper.GetTestContext( - request => request.QueryString = new QueryString("?parameter.index=0") + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString("?parameter.index=0") ); var modelState = testContext.ModelState; diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/HeaderModelBinderIntegrationTest.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/HeaderModelBinderIntegrationTest.cs index e9aabb2d21e..2d19105eaea 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/HeaderModelBinderIntegrationTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/HeaderModelBinderIntegrationTest.cs @@ -73,8 +73,8 @@ public async Task BindPropertyFromHeader_WithPrefix_GetsBound() ParameterType = typeof(Person) }; - var testContext = GetModelBindingTestContext( - request => request.Headers.Add("Header", new[] { "someValue" }) + var testContext = GetModelBindingTestContext(request => + request.Headers.Add("Header", new[] { "someValue" }) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder( testContext.HttpContext.RequestServices @@ -118,8 +118,8 @@ public async Task BindPropertyFromHeader_WithData_WithEmptyPrefix_GetsBound() ParameterType = typeof(Person) }; - var testContext = GetModelBindingTestContext( - request => request.Headers.Add("Header", new[] { "someValue" }) + var testContext = GetModelBindingTestContext(request => + request.Headers.Add("Header", new[] { "someValue" }) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder( testContext.HttpContext.RequestServices @@ -167,8 +167,8 @@ public async Task BindCollectionPropertyFromHeader_WithData_IsBound() ParameterType = typeof(ListContainer1), }; - var testContext = GetModelBindingTestContext( - request => request.Headers.Add("Header", new[] { "someValue" }) + var testContext = GetModelBindingTestContext(request => + request.Headers.Add("Header", new[] { "someValue" }) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder( testContext.HttpContext.RequestServices @@ -217,8 +217,8 @@ public async Task BindReadOnlyCollectionPropertyFromHeader_WithData_IsBound() ParameterType = typeof(ListContainer2), }; - var testContext = GetModelBindingTestContext( - request => request.Headers.Add("Header", new[] { "someValue" }) + var testContext = GetModelBindingTestContext(request => + request.Headers.Add("Header", new[] { "someValue" }) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder( testContext.HttpContext.RequestServices diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/SimpleTypeModelBinderIntegrationTest.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/SimpleTypeModelBinderIntegrationTest.cs index 074aafa5ee8..cb4fcd9f649 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/SimpleTypeModelBinderIntegrationTest.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/SimpleTypeModelBinderIntegrationTest.cs @@ -514,8 +514,8 @@ Type parameterType .BindingDetails(binding => { // A real details provider could customize message based on BindingMetadataProviderContext. - binding.ModelBindingMessageProvider.SetValueMustNotBeNullAccessor( - value => $"Hurts when '{value}' is provided." + binding.ModelBindingMessageProvider.SetValueMustNotBeNullAccessor(value => + $"Hurts when '{value}' is provided." ); }); diff --git a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs index 5473dd6a182..daadf74073f 100644 --- a/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs +++ b/aspnetcore/src/Mvc/test/Mvc.IntegrationTests/ValidationWithRecordIntegrationTests.cs @@ -1200,11 +1200,10 @@ public async Task IValidatableObject_IsValidated() ParameterType = typeof(ValidateSomeProperties), }; - var testContext = ModelBindingTestHelper.GetTestContext( - request => - request.QueryString = new QueryString( - $"?{nameof(ValidateSomeProperties.NeverValidBecauseType)}.{nameof(NeverValid.NeverValidProperty)}=1" - ) + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString( + $"?{nameof(ValidateSomeProperties.NeverValidBecauseType)}.{nameof(NeverValid.NeverValidProperty)}=1" + ) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(); @@ -1255,11 +1254,10 @@ public async Task CustomValidationAttribute_IsValidated() ParameterType = typeof(ValidateSomeProperties), }; - var testContext = ModelBindingTestHelper.GetTestContext( - request => - request.QueryString = new QueryString( - $"?{nameof(ValidateSomeProperties.NeverValidBecauseAttribute)}=1" - ) + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString( + $"?{nameof(ValidateSomeProperties.NeverValidBecauseAttribute)}=1" + ) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(); @@ -1298,11 +1296,10 @@ public async Task ValidateNeverProperty_IsSkipped() ParameterType = typeof(ValidateSomeProperties), }; - var testContext = ModelBindingTestHelper.GetTestContext( - request => - request.QueryString = new QueryString( - $"?{nameof(ValidateSomeProperties.ValidateNever)}=1" - ) + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString( + $"?{nameof(ValidateSomeProperties.ValidateNever)}=1" + ) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(); @@ -1438,11 +1435,10 @@ public async Task PropertyToSometimesSkip_IsValidated_IfControlIsNotNull() ParameterType = typeof(ValidateSomePropertiesSometimes), }; - var testContext = ModelBindingTestHelper.GetTestContext( - request => - request.QueryString = new QueryString( - $"?{nameof(ValidateSomePropertiesSometimes.Control)}=1" - ) + var testContext = ModelBindingTestHelper.GetTestContext(request => + request.QueryString = new QueryString( + $"?{nameof(ValidateSomePropertiesSometimes.Control)}=1" + ) ); var parameterBinder = ModelBindingTestHelper.GetParameterBinder(); diff --git a/aspnetcore/src/Mvc/test/WebSites/ApplicationModelWebSite/Controllers/HomeController.cs b/aspnetcore/src/Mvc/test/WebSites/ApplicationModelWebSite/Controllers/HomeController.cs index 3958739693a..029b7129435 100644 --- a/aspnetcore/src/Mvc/test/WebSites/ApplicationModelWebSite/Controllers/HomeController.cs +++ b/aspnetcore/src/Mvc/test/WebSites/ApplicationModelWebSite/Controllers/HomeController.cs @@ -45,8 +45,8 @@ private class SuppressPatchMatchingConvention : Attribute, IActionModelConventio { public void Apply(ActionModel model) { - var selector = model.Selectors.First( - f => f.AttributeRouteModel.Template == "Home/CannotBeRouted" + var selector = model.Selectors.First(f => + f.AttributeRouteModel.Template == "Home/CannotBeRouted" ); selector.AttributeRouteModel.SuppressPathMatching = true; } diff --git a/aspnetcore/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs b/aspnetcore/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs index 100e068fbb4..c0f34e4d9d4 100644 --- a/aspnetcore/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs +++ b/aspnetcore/src/Mvc/test/WebSites/Common/TestResponseGenerator.cs @@ -28,11 +28,8 @@ public ActionResult Generate(params string[] expectedUrls) if (query.ContainsKey("link")) { var values = query - .Where( - kvp => - kvp.Key != "link" - && kvp.Key != "link_action" - && kvp.Key != "link_controller" + .Where(kvp => + kvp.Key != "link" && kvp.Key != "link_action" && kvp.Key != "link_controller" ) .ToDictionary( kvp => kvp.Key.Substring("link_".Length), diff --git a/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/StartupWithComplexParentValidation.cs b/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/StartupWithComplexParentValidation.cs index efb24446649..16da0761e8e 100644 --- a/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/StartupWithComplexParentValidation.cs +++ b/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/StartupWithComplexParentValidation.cs @@ -9,8 +9,8 @@ public void ConfigureServices(IServiceCollection services) { services .AddControllers(options => options.ValidateComplexTypesIfChildValidationFails = true) - .AddNewtonsoftJson( - options => options.SerializerSettings.Converters.Insert(0, new IModelConverter()) + .AddNewtonsoftJson(options => + options.SerializerSettings.Converters.Insert(0, new IModelConverter()) ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/ValidateBodyParameterAttribute.cs b/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/ValidateBodyParameterAttribute.cs index a25be5c6600..bb9621c1243 100644 --- a/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/ValidateBodyParameterAttribute.cs +++ b/aspnetcore/src/Mvc/test/WebSites/FormatterWebSite/ValidateBodyParameterAttribute.cs @@ -14,8 +14,8 @@ public override void OnActionExecuting(ActionExecutingContext context) { if (!context.ModelState.IsValid) { - var bodyParameter = context.ActionDescriptor.Parameters.FirstOrDefault( - parameter => IsBodyBindingSource(parameter.BindingInfo?.BindingSource) + var bodyParameter = context.ActionDescriptor.Parameters.FirstOrDefault(parameter => + IsBodyBindingSource(parameter.BindingInfo?.BindingSource) ); if (bodyParameter != null) { diff --git a/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/ModelWithPageFilter.cs b/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/ModelWithPageFilter.cs index 0c7c4399088..668b07dc84b 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/ModelWithPageFilter.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/ModelWithPageFilter.cs @@ -27,8 +27,7 @@ public class HandlerChangingPageFilterAttribute : Attribute, IPageFilter { public void OnPageHandlerSelected(PageHandlerSelectedContext context) { - context.HandlerMethod = context.ActionDescriptor.HandlerMethods.First( - m => m.Name == "Edit" + context.HandlerMethod = context.ActionDescriptor.HandlerMethods.First(m => m.Name == "Edit" ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/StartupWithClientValidationDisabled.cs b/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/StartupWithClientValidationDisabled.cs index f04ec71b625..ffd6a116753 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/StartupWithClientValidationDisabled.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RazorPagesWebSite/StartupWithClientValidationDisabled.cs @@ -19,8 +19,7 @@ public void ConfigureServices(IServiceCollection services) options.Conventions.AuthorizeFolder("/Admin"); }); - services.Configure( - o => o.HtmlHelperOptions.ClientValidationEnabled = false + services.Configure(o => o.HtmlHelperOptions.ClientValidationEnabled = false ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/RemoveControllerActionDescriptorProvider.cs b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/RemoveControllerActionDescriptorProvider.cs index f808a4200da..0d8db71a914 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/RemoveControllerActionDescriptorProvider.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/RemoveControllerActionDescriptorProvider.cs @@ -25,8 +25,8 @@ public void OnProvidersExecuting(ActionDescriptorProviderContext context) { if (item is ControllerActionDescriptor controllerActionDescriptor) { - var controllerToRemove = _controllerTypes.SingleOrDefault( - c => c.ControllerType == controllerActionDescriptor.ControllerTypeInfo + var controllerToRemove = _controllerTypes.SingleOrDefault(c => + c.ControllerType == controllerActionDescriptor.ControllerTypeInfo ); if (controllerToRemove != null) { diff --git a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs index 4f0124c60c0..dde8541ef63 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamic.cs @@ -19,8 +19,8 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(); // Used by some controllers defined in this project. - services.Configure( - options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) + services.Configure(options => + options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs index de10bcd8a57..d6ae78830f8 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForDynamicOrder.cs @@ -34,8 +34,8 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(); // Used by some controllers defined in this project. - services.Configure( - options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) + services.Configure(options => + options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs index 97af342b97f..7231b9e1c6f 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupForFallback.cs @@ -17,8 +17,8 @@ public void ConfigureServices(IServiceCollection services) services.AddSingleton(); // Used by some controllers defined in this project. - services.Configure( - options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) + services.Configure(options => + options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) ); } diff --git a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs index f9796b59926..00a37a0c1b6 100644 --- a/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs +++ b/aspnetcore/src/Mvc/test/WebSites/RoutingWebSite/StartupRoutingDifferentBranches.cs @@ -107,8 +107,8 @@ protected virtual void ConfigureMvcOptions(MvcOptions options) protected virtual void ConfigureRoutingServices(IServiceCollection services) { - services.AddRouting( - options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) + services.AddRouting(options => + options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer) ); } } diff --git a/aspnetcore/src/OpenApi/src/OpenApiEndpointConventionBuilderExtensions.cs b/aspnetcore/src/OpenApi/src/OpenApiEndpointConventionBuilderExtensions.cs index 89dba672869..cd1e8ea1b7f 100644 --- a/aspnetcore/src/OpenApi/src/OpenApiEndpointConventionBuilderExtensions.cs +++ b/aspnetcore/src/OpenApi/src/OpenApiEndpointConventionBuilderExtensions.cs @@ -43,9 +43,8 @@ Func configureOperation ) where TBuilder : IEndpointConventionBuilder { - builder.Finally( - endpointBuilder => - AddAndConfigureOperationForEndpoint(endpointBuilder, configureOperation) + builder.Finally(endpointBuilder => + AddAndConfigureOperationForEndpoint(endpointBuilder, configureOperation) ); return builder; } diff --git a/aspnetcore/src/OpenApi/test/OpenApiGeneratorTests.cs b/aspnetcore/src/OpenApi/test/OpenApiGeneratorTests.cs index 5139f2f9f8b..275364c2f79 100644 --- a/aspnetcore/src/OpenApi/test/OpenApiGeneratorTests.cs +++ b/aspnetcore/src/OpenApi/test/OpenApiGeneratorTests.cs @@ -125,13 +125,15 @@ public void AddsMultipleRequestFormatsFromMetadata() [Fact] public void AddsMultipleRequestFormatsFromMetadataWithRequestTypeAndOptionalBodyParameter() { - var operation = GetOpenApiOperation([Consumes( - typeof(InferredJsonClass), - "application/custom0", - "application/custom1", - IsOptional = true - )] - () => { }); + var operation = GetOpenApiOperation( + [Consumes( + typeof(InferredJsonClass), + "application/custom0", + "application/custom1", + IsOptional = true + )] + () => { } + ); var request = operation.RequestBody; Assert.NotNull(request); Assert.Equal(2, request.Content.Count); diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs index b7a48bfc717..22014d350fe 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs @@ -13,18 +13,17 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", - columns: table => - new - { - Id = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedName = table.Column( - type: "TEXT", - maxLength: 256, - nullable: true - ), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) - }, + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedName = table.Column( + type: "TEXT", + maxLength: 256, + nullable: true + ), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); @@ -33,37 +32,32 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUsers", - columns: table => - new - { - Id = table.Column(type: "TEXT", nullable: false), - UserName = table.Column( - type: "TEXT", - maxLength: 256, - nullable: true - ), - NormalizedUserName = table.Column( - type: "TEXT", - maxLength: 256, - nullable: true - ), - Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), - NormalizedEmail = table.Column( - type: "TEXT", - maxLength: 256, - nullable: true - ), - EmailConfirmed = table.Column(type: "INTEGER", nullable: false), - PasswordHash = table.Column(type: "TEXT", nullable: true), - SecurityStamp = table.Column(type: "TEXT", nullable: true), - ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), - PhoneNumber = table.Column(type: "TEXT", nullable: true), - PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), - TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), - LockoutEnd = table.Column(type: "TEXT", nullable: true), - LockoutEnabled = table.Column(type: "INTEGER", nullable: false), - AccessFailedCount = table.Column(type: "INTEGER", nullable: false) - }, + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedUserName = table.Column( + type: "TEXT", + maxLength: 256, + nullable: true + ), + Email = table.Column(type: "TEXT", maxLength: 256, nullable: true), + NormalizedEmail = table.Column( + type: "TEXT", + maxLength: 256, + nullable: true + ), + EmailConfirmed = table.Column(type: "INTEGER", nullable: false), + PasswordHash = table.Column(type: "TEXT", nullable: true), + SecurityStamp = table.Column(type: "TEXT", nullable: true), + ConcurrencyStamp = table.Column(type: "TEXT", nullable: true), + PhoneNumber = table.Column(type: "TEXT", nullable: true), + PhoneNumberConfirmed = table.Column(type: "INTEGER", nullable: false), + TwoFactorEnabled = table.Column(type: "INTEGER", nullable: false), + LockoutEnd = table.Column(type: "TEXT", nullable: true), + LockoutEnabled = table.Column(type: "INTEGER", nullable: false), + AccessFailedCount = table.Column(type: "INTEGER", nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); @@ -72,16 +66,15 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetRoleClaims", - columns: table => - new - { - Id = table - .Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, + columns: table => new + { + Id = table + .Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); @@ -97,16 +90,15 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserClaims", - columns: table => - new - { - Id = table - .Column(type: "INTEGER", nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(type: "TEXT", nullable: false), - ClaimType = table.Column(type: "TEXT", nullable: true), - ClaimValue = table.Column(type: "TEXT", nullable: true) - }, + columns: table => new + { + Id = table + .Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(type: "TEXT", nullable: false), + ClaimType = table.Column(type: "TEXT", nullable: true), + ClaimValue = table.Column(type: "TEXT", nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); @@ -122,14 +114,13 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserLogins", - columns: table => - new - { - LoginProvider = table.Column(type: "TEXT", nullable: false), - ProviderKey = table.Column(type: "TEXT", nullable: false), - ProviderDisplayName = table.Column(type: "TEXT", nullable: true), - UserId = table.Column(type: "TEXT", nullable: false) - }, + columns: table => new + { + LoginProvider = table.Column(type: "TEXT", nullable: false), + ProviderKey = table.Column(type: "TEXT", nullable: false), + ProviderDisplayName = table.Column(type: "TEXT", nullable: true), + UserId = table.Column(type: "TEXT", nullable: false) + }, constraints: table => { table.PrimaryKey( @@ -148,12 +139,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserRoles", - columns: table => - new - { - UserId = table.Column(type: "TEXT", nullable: false), - RoleId = table.Column(type: "TEXT", nullable: false) - }, + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + RoleId = table.Column(type: "TEXT", nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); @@ -176,25 +166,23 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserTokens", - columns: table => - new - { - UserId = table.Column(type: "TEXT", nullable: false), - LoginProvider = table.Column(type: "TEXT", nullable: false), - Name = table.Column(type: "TEXT", nullable: false), - Value = table.Column(type: "TEXT", nullable: true) - }, + columns: table => new + { + UserId = table.Column(type: "TEXT", nullable: false), + LoginProvider = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Value = table.Column(type: "TEXT", nullable: true) + }, constraints: table => { table.PrimaryKey( "PK_AspNetUserTokens", - x => - new - { - x.UserId, - x.LoginProvider, - x.Name - } + x => new + { + x.UserId, + x.LoginProvider, + x.Name + } ); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.cs index 5954ff39ea6..82d961ebaae 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.cs @@ -72,16 +72,16 @@ ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); builder.Services.AddDbContext(options => #if (UseLocalDB) - options.UseSqlServer(connectionString) + options.UseSqlServer(connectionString) ); #else - options.UseSqlite(connectionString)); + options.UseSqlite(connectionString)); #endif builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder - .Services.AddIdentityCore( - options => options.SignIn.RequireConfirmedAccount = true + .Services.AddIdentityCore(options => + options.SignIn.RequireConfirmedAccount = true ) .AddEntityFrameworkStores() .AddSignInManager() diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Program.Main.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Program.Main.cs index 7848e230f2d..77c78edc29b 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Program.Main.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/ComponentsWebAssembly-CSharp/Program.Main.cs @@ -11,9 +11,10 @@ public static async Task Main(string[] args) builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); - builder.Services.AddScoped( - sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) } - ); + builder.Services.AddScoped(sp => new HttpClient + { + BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) + }); #if(!NoAuth) #endif diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.cs index da467123651..41bcc3e1bd3 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Data/SqlServer/00000000000000_CreateIdentitySchema.cs @@ -10,14 +10,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", - columns: table => - new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 256, nullable: true), + NormalizedName = table.Column(maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); @@ -26,25 +25,24 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUsers", - columns: table => - new - { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false) - }, + columns: table => new + { + Id = table.Column(nullable: false), + UserName = table.Column(maxLength: 256, nullable: true), + NormalizedUserName = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false), + PasswordHash = table.Column(nullable: true), + SecurityStamp = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + PhoneNumber = table.Column(nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false), + TwoFactorEnabled = table.Column(nullable: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false), + AccessFailedCount = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); @@ -53,19 +51,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetRoleClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + RoleId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); @@ -81,19 +78,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + UserId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); @@ -109,14 +105,13 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserLogins", - columns: table => - new - { - LoginProvider = table.Column(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, + columns: table => new + { + LoginProvider = table.Column(maxLength: 128, nullable: false), + ProviderKey = table.Column(maxLength: 128, nullable: false), + ProviderDisplayName = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey( @@ -135,12 +130,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserRoles", - columns: table => - new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); @@ -163,25 +157,23 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserTokens", - columns: table => - new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(nullable: true) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 128, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey( "PK_AspNetUserTokens", - x => - new - { - x.UserId, - x.LoginProvider, - x.Name - } + x => new + { + x.UserId, + x.LoginProvider, + x.Name + } ); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs index 43e791d7289..31cfb1f819b 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Program.cs @@ -38,19 +38,18 @@ var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); -builder.Services.AddDbContext( - options => +builder.Services.AddDbContext(options => #if (UseLocalDB) - options.UseSqlServer(connectionString) + options.UseSqlServer(connectionString) ); #else - options.UseSqlite(connectionString)); + options.UseSqlite(connectionString)); #endif builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder - .Services.AddDefaultIdentity( - options => options.SignIn.RequireConfirmedAccount = true + .Services.AddDefaultIdentity(options => + options.SignIn.RequireConfirmedAccount = true ) .AddEntityFrameworkStores(); #elif (OrganizationalAuth) diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs index 0c79b2f2894..f083fddd9ee 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Data/SqlLite/00000000000000_CreateIdentitySchema.cs @@ -9,14 +9,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", - columns: table => - new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(nullable: true) - }, + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 256, nullable: true), + NormalizedName = table.Column(maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); @@ -25,25 +24,24 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUsers", - columns: table => - new - { - Id = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - SecurityStamp = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - TwoFactorEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false) - }, + columns: table => new + { + Id = table.Column(nullable: false), + UserName = table.Column(maxLength: 256, nullable: true), + NormalizedUserName = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false), + PasswordHash = table.Column(nullable: true), + SecurityStamp = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + PhoneNumber = table.Column(nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false), + TwoFactorEnabled = table.Column(nullable: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false), + AccessFailedCount = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); @@ -52,16 +50,15 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetRoleClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - RoleId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + RoleId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); @@ -77,16 +74,15 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - UserId = table.Column(nullable: false), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + UserId = table.Column(nullable: false), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); @@ -102,14 +98,13 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserLogins", - columns: table => - new - { - LoginProvider = table.Column(maxLength: 128, nullable: false), - ProviderKey = table.Column(maxLength: 128, nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, + columns: table => new + { + LoginProvider = table.Column(maxLength: 128, nullable: false), + ProviderKey = table.Column(maxLength: 128, nullable: false), + ProviderDisplayName = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey( @@ -128,12 +123,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserRoles", - columns: table => - new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); @@ -156,25 +150,23 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserTokens", - columns: table => - new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 128, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(nullable: true) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 128, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey( "PK_AspNetUserTokens", - x => - new - { - x.UserId, - x.LoginProvider, - x.Name - } + x => new + { + x.UserId, + x.LoginProvider, + x.Name + } ); table.ForeignKey( name: "FK_AspNetUserTokens_AspNetUsers_UserId", diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs index f0f3774094e..8a1955b82b0 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/StarterWeb-CSharp/Program.cs @@ -38,19 +38,18 @@ var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found."); -builder.Services.AddDbContext( - options => +builder.Services.AddDbContext(options => #if (UseLocalDB) - options.UseSqlServer(connectionString) + options.UseSqlServer(connectionString) ); #else - options.UseSqlite(connectionString)); + options.UseSqlite(connectionString)); #endif builder.Services.AddDatabaseDeveloperPageExceptionFilter(); builder - .Services.AddDefaultIdentity( - options => options.SignIn.RequireConfirmedAccount = true + .Services.AddDefaultIdentity(options => + options.SignIn.RequireConfirmedAccount = true ) .AddEntityFrameworkStores(); #elif (OrganizationalAuth) diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs index c97d8be625b..72c8f5f000f 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.Main.cs @@ -140,15 +140,12 @@ public static void Main(string[] args) var forecast = Enumerable .Range(1, 5) - .Select( - index => - new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = summaries[Random.Shared.Next(summaries.Length)] - } - ) + .Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }) .ToArray(); return forecast; @@ -163,15 +160,12 @@ public static void Main(string[] args) var forecast = Enumerable .Range(1, 5) - .Select( - index => - new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = summaries[Random.Shared.Next(summaries.Length)] - } - ) + .Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }) .ToArray(); return forecast; @@ -186,15 +180,12 @@ public static void Main(string[] args) #endif var forecast = Enumerable .Range(1, 5) - .Select( - index => - new WeatherForecast - { - Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = summaries[Random.Shared.Next(summaries.Length)] - } - ) + .Select(index => new WeatherForecast + { + Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }) .ToArray(); return forecast; #endif diff --git a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.WindowsOrNoAuth.cs b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.WindowsOrNoAuth.cs index d507a3b3ca9..8a66cf5d405 100644 --- a/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.WindowsOrNoAuth.cs +++ b/aspnetcore/src/ProjectTemplates/Web.ProjectTemplates/content/WebApi-CSharp/Program.MinimalAPIs.WindowsOrNoAuth.cs @@ -55,14 +55,11 @@ { var forecast = Enumerable .Range(1, 5) - .Select( - index => - new WeatherForecast( - DateOnly.FromDateTime(DateTime.Now.AddDays(index)), - Random.Shared.Next(-20, 55), - summaries[Random.Shared.Next(summaries.Length)] - ) - ) + .Select(index => new WeatherForecast( + DateOnly.FromDateTime(DateTime.Now.AddDays(index)), + Random.Shared.Next(-20, 55), + summaries[Random.Shared.Next(summaries.Length)] + )) .ToArray(); return forecast; #if (EnableOpenAPI) diff --git a/aspnetcore/src/ProjectTemplates/test/Templates.Tests/BaselineTest.cs b/aspnetcore/src/ProjectTemplates/test/Templates.Tests/BaselineTest.cs index eb28927c269..df54375b768 100644 --- a/aspnetcore/src/ProjectTemplates/test/Templates.Tests/BaselineTest.cs +++ b/aspnetcore/src/ProjectTemplates/test/Templates.Tests/BaselineTest.cs @@ -126,9 +126,8 @@ string[] expectedFiles { var namespaceDeclarationPrefix = "namespace "; var namespaceDeclaration = File.ReadLines(file) - .SingleOrDefault( - line => - line.StartsWith(namespaceDeclarationPrefix, StringComparison.Ordinal) + .SingleOrDefault(line => + line.StartsWith(namespaceDeclarationPrefix, StringComparison.Ordinal) ) ?.Substring(namespaceDeclarationPrefix.Length); diff --git a/aspnetcore/src/Security/Authentication/JwtBearer/samples/MinimalJwtBearerSample/Program.cs b/aspnetcore/src/Security/Authentication/JwtBearer/samples/MinimalJwtBearerSample/Program.cs index 4ad88ec9b61..815c359eddc 100644 --- a/aspnetcore/src/Security/Authentication/JwtBearer/samples/MinimalJwtBearerSample/Program.cs +++ b/aspnetcore/src/Security/Authentication/JwtBearer/samples/MinimalJwtBearerSample/Program.cs @@ -11,16 +11,15 @@ .AddJwtBearer("ClaimedDetails") .AddJwtBearer("InvalidScheme"); -builder.Services.AddAuthorization( - options => - options.AddPolicy( - "is_admin", - policy => - { - policy.RequireAuthenticatedUser(); - policy.RequireClaim("is_admin", "true"); - } - ) +builder.Services.AddAuthorization(options => + options.AddPolicy( + "is_admin", + policy => + { + policy.RequireAuthenticatedUser(); + policy.RequireClaim("is_admin", "true"); + } + ) ); var app = builder.Build(); diff --git a/aspnetcore/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs b/aspnetcore/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs index a5b679c5b1e..8d4a6a0bd4b 100644 --- a/aspnetcore/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs +++ b/aspnetcore/src/Security/Authentication/Negotiate/test/Negotiate.Test/EventTests.cs @@ -451,16 +451,15 @@ private static async Task CreateHostAsync( ) { var builder = new HostBuilder() - .ConfigureServices( - services => - services - .AddRouting() - .AddAuthentication() - .AddNegotiate(options => - { - options.StateFactory = new TestNegotiateStateFactory(); - configureOptions?.Invoke(options); - }) + .ConfigureServices(services => + services + .AddRouting() + .AddAuthentication() + .AddNegotiate(options => + { + options.StateFactory = new TestNegotiateStateFactory(); + configureOptions?.Invoke(options); + }) ) .ConfigureWebHost(webHostBuilder => { diff --git a/aspnetcore/src/Security/Authentication/OAuth/src/ClaimActionCollection.cs b/aspnetcore/src/Security/Authentication/OAuth/src/ClaimActionCollection.cs index 596ab1ddc84..b7e9dd70260 100644 --- a/aspnetcore/src/Security/Authentication/OAuth/src/ClaimActionCollection.cs +++ b/aspnetcore/src/Security/Authentication/OAuth/src/ClaimActionCollection.cs @@ -25,8 +25,8 @@ public class ClaimActionCollection : IEnumerable public void Remove(string claimType) { var itemsToRemove = Actions - .Where( - map => string.Equals(claimType, map.ClaimType, StringComparison.OrdinalIgnoreCase) + .Where(map => + string.Equals(claimType, map.ClaimType, StringComparison.OrdinalIgnoreCase) ) .ToList(); itemsToRemove.ForEach(map => Actions.Remove(map)); diff --git a/aspnetcore/src/Security/Authentication/OAuth/src/MapAllClaimsAction.cs b/aspnetcore/src/Security/Authentication/OAuth/src/MapAllClaimsAction.cs index b56617e8092..cac462a4b3c 100644 --- a/aspnetcore/src/Security/Authentication/OAuth/src/MapAllClaimsAction.cs +++ b/aspnetcore/src/Security/Authentication/OAuth/src/MapAllClaimsAction.cs @@ -28,10 +28,9 @@ public override void Run(JsonElement userData, ClaimsIdentity identity, string i // Avoid adding a claim if there's a duplicate name and value. This often happens in OIDC when claims are // retrieved both from the id_token and from the user-info endpoint. var duplicate = - identity.FindFirst( - c => - string.Equals(c.Type, pair.Name, StringComparison.OrdinalIgnoreCase) - && string.Equals(c.Value, claimValue, StringComparison.Ordinal) + identity.FindFirst(c => + string.Equals(c.Type, pair.Name, StringComparison.OrdinalIgnoreCase) + && string.Equals(c.Value, claimValue, StringComparison.Ordinal) ) != null; if (!duplicate) diff --git a/aspnetcore/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectHandler.cs b/aspnetcore/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectHandler.cs index d2f8ea9e6c8..68381816a88 100644 --- a/aspnetcore/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectHandler.cs +++ b/aspnetcore/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectHandler.cs @@ -127,9 +127,10 @@ protected virtual async Task HandleRemoteSignOutAsync() // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements. #pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. message = new OpenIdConnectMessage( - Request.Query.Select( - pair => new KeyValuePair(pair.Key, pair.Value.ToArray()) - ) + Request.Query.Select(pair => new KeyValuePair( + pair.Key, + pair.Value.ToArray() + )) ); #pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. } @@ -150,9 +151,10 @@ protected virtual async Task HandleRemoteSignOutAsync() // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements. #pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. message = new OpenIdConnectMessage( - form.Select( - pair => new KeyValuePair(pair.Key, pair.Value.ToArray()) - ) + form.Select(pair => new KeyValuePair( + pair.Key, + pair.Value.ToArray() + )) ); #pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. } @@ -354,9 +356,10 @@ protected virtual async Task HandleSignOutCallbackAsync() // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements. #pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. var message = new OpenIdConnectMessage( - Request.Query.Select( - pair => new KeyValuePair(pair.Key, pair.Value.ToArray()) - ) + Request.Query.Select(pair => new KeyValuePair( + pair.Key, + pair.Value.ToArray() + )) ); #pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. @@ -605,9 +608,10 @@ protected override async Task HandleRemoteAuthenticateAsync // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements. #pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. authorizationResponse = new OpenIdConnectMessage( - Request.Query.Select( - pair => new KeyValuePair(pair.Key, pair.Value.ToArray()) - ) + Request.Query.Select(pair => new KeyValuePair( + pair.Key, + pair.Value.ToArray() + )) ); #pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. @@ -644,9 +648,10 @@ protected override async Task HandleRemoteAuthenticateAsync // ToArray handles the StringValues.IsNullOrEmpty case. We assume non-empty Value does not contain null elements. #pragma warning disable CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. authorizationResponse = new OpenIdConnectMessage( - form.Select( - pair => new KeyValuePair(pair.Key, pair.Value.ToArray()) - ) + form.Select(pair => new KeyValuePair( + pair.Key, + pair.Value.ToArray() + )) ); #pragma warning restore CS8620 // Argument cannot be used for parameter due to differences in the nullability of reference types. } diff --git a/aspnetcore/src/Security/Authentication/OpenIdConnect/src/UniqueJsonKeyClaimAction.cs b/aspnetcore/src/Security/Authentication/OpenIdConnect/src/UniqueJsonKeyClaimAction.cs index 67f099f415b..17cedd36b8c 100644 --- a/aspnetcore/src/Security/Authentication/OpenIdConnect/src/UniqueJsonKeyClaimAction.cs +++ b/aspnetcore/src/Security/Authentication/OpenIdConnect/src/UniqueJsonKeyClaimAction.cs @@ -34,8 +34,8 @@ public override void Run(JsonElement userData, ClaimsIdentity identity, string i return; } - var claim = identity.FindFirst( - c => string.Equals(c.Type, ClaimType, StringComparison.OrdinalIgnoreCase) + var claim = identity.FindFirst(c => + string.Equals(c.Type, ClaimType, StringComparison.OrdinalIgnoreCase) ); if (claim != null && string.Equals(claim.Value, value, StringComparison.Ordinal)) { diff --git a/aspnetcore/src/Security/Authentication/test/AuthenticationMiddlewareTests.cs b/aspnetcore/src/Security/Authentication/test/AuthenticationMiddlewareTests.cs index 9ed4f648946..a2061328876 100644 --- a/aspnetcore/src/Security/Authentication/test/AuthenticationMiddlewareTests.cs +++ b/aspnetcore/src/Security/Authentication/test/AuthenticationMiddlewareTests.cs @@ -22,50 +22,48 @@ public class AuthenticationMiddlewareTests public async Task OnlyInvokesCanHandleRequestHandlers() { using var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + }) + .ConfigureServices(services => + services.AddAuthentication(o => { - app.UseAuthentication(); - }) - .ConfigureServices( - services => - services.AddAuthentication(o => + o.AddScheme( + "Skip", + s => + { + s.HandlerType = typeof(SkipHandler); + } + ); + // Won't get hit since CanHandleRequests is false + o.AddScheme( + "throws", + s => + { + s.HandlerType = typeof(ThrowsHandler); + } + ); + o.AddScheme( + "607", + s => { - o.AddScheme( - "Skip", - s => - { - s.HandlerType = typeof(SkipHandler); - } - ); - // Won't get hit since CanHandleRequests is false - o.AddScheme( - "throws", - s => - { - s.HandlerType = typeof(ThrowsHandler); - } - ); - o.AddScheme( - "607", - s => - { - s.HandlerType = typeof(SixOhSevenHandler); - } - ); - // Won't get run since 607 will finish - o.AddScheme( - "305", - s => - { - s.HandlerType = typeof(ThreeOhFiveHandler); - } - ); - }) - ) + s.HandlerType = typeof(SixOhSevenHandler); + } + ); + // Won't get run since 607 will finish + o.AddScheme( + "305", + s => + { + s.HandlerType = typeof(ThreeOhFiveHandler); + } + ); + }) + ) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/DynamicSchemeTests.cs b/aspnetcore/src/Security/Authentication/test/DynamicSchemeTests.cs index 63aa7d7b783..0d1aafc1698 100644 --- a/aspnetcore/src/Security/Authentication/test/DynamicSchemeTests.cs +++ b/aspnetcore/src/Security/Authentication/test/DynamicSchemeTests.cs @@ -156,73 +156,76 @@ protected override Task HandleAuthenticateAsync() private static async Task CreateHost(Action configureServices = null) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => - { - var req = context.Request; - var res = context.Response; - if ( - req.Path.StartsWithSegments( - new PathString("/add"), - out var remainder - ) + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + var req = context.Request; + var res = context.Response; + if ( + req.Path.StartsWithSegments( + new PathString("/add"), + out var remainder ) - { - var name = remainder.Value.Substring(1); - var auth = - context.RequestServices.GetRequiredService(); - var scheme = new AuthenticationScheme( - name, - name, - typeof(TestHandler) + ) + { + var name = remainder.Value.Substring(1); + var auth = + context.RequestServices.GetRequiredService( + ); - auth.AddScheme(scheme); - } - else if ( - req.Path.StartsWithSegments( - new PathString("/auth"), - out remainder - ) + var scheme = new AuthenticationScheme( + name, + name, + typeof(TestHandler) + ); + auth.AddScheme(scheme); + } + else if ( + req.Path.StartsWithSegments( + new PathString("/auth"), + out remainder ) - { - var name = - (remainder.Value.Length > 0) - ? remainder.Value.Substring(1) - : null; - var result = await context.AuthenticateAsync(name); - await res.DescribeAsync(result?.Ticket?.Principal); - } - else if ( - req.Path.StartsWithSegments( - new PathString("/remove"), - out remainder - ) + ) + { + var name = + (remainder.Value.Length > 0) + ? remainder.Value.Substring(1) + : null; + var result = await context.AuthenticateAsync(name); + await res.DescribeAsync(result?.Ticket?.Principal); + } + else if ( + req.Path.StartsWithSegments( + new PathString("/remove"), + out remainder ) - { - var name = remainder.Value.Substring(1); - var auth = - context.RequestServices.GetRequiredService(); - auth.RemoveScheme(name); - } - else - { - await next(context); - } + ) + { + var name = remainder.Value.Substring(1); + var auth = + context.RequestServices.GetRequiredService( + + ); + auth.RemoveScheme(name); + } + else + { + await next(context); } - ); - }) - .ConfigureServices(services => - { - configureServices?.Invoke(services); - services.AddAuthentication(); - }) + } + ); + }) + .ConfigureServices(services => + { + configureServices?.Invoke(services); + services.AddAuthentication(); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/GoogleTests.cs b/aspnetcore/src/Security/Authentication/test/GoogleTests.cs index 5cc34ba3add..42ff8ef0a74 100644 --- a/aspnetcore/src/Security/Authentication/test/GoogleTests.cs +++ b/aspnetcore/src/Security/Authentication/test/GoogleTests.cs @@ -1409,116 +1409,114 @@ private static async Task CreateHost( ) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + var req = context.Request; + var res = context.Response; + if (req.Path == new PathString("/challenge")) { - var req = context.Request; - var res = context.Response; - if (req.Path == new PathString("/challenge")) - { - await context.ChallengeAsync(); - } - else if (req.Path == new PathString("/challengeFacebook")) - { - await context.ChallengeAsync("Facebook"); - } - else if (req.Path == new PathString("/tokens")) - { - var result = await context.AuthenticateAsync( - TestExtensions.CookieAuthenticationScheme - ); - var tokens = result.Properties.GetTokens(); - await res.DescribeAsync(tokens); - } - else if (req.Path == new PathString("/me")) - { - await res.DescribeAsync(context.User); - } - else if (req.Path == new PathString("/authenticate")) - { - var result = await context.AuthenticateAsync( - TestExtensions.CookieAuthenticationScheme - ); - await res.DescribeAsync(result.Principal); - } - else if (req.Path == new PathString("/authenticateGoogle")) - { - var result = await context.AuthenticateAsync("Google"); - await res.DescribeAsync(result?.Principal); - } - else if (req.Path == new PathString("/authenticateFacebook")) - { - var result = await context.AuthenticateAsync("Facebook"); - await res.DescribeAsync(result?.Principal); - } - else if (req.Path == new PathString("/unauthorized")) - { - // Simulate Authorization failure - var result = await context.AuthenticateAsync("Google"); - await context.ChallengeAsync("Google"); - } - else if (req.Path == new PathString("/unauthorizedAuto")) - { - var result = await context.AuthenticateAsync("Google"); - await context.ChallengeAsync("Google"); - } - else if (req.Path == new PathString("/401")) - { - res.StatusCode = 401; - } - else if (req.Path == new PathString("/signIn")) - { - await Assert.ThrowsAsync( - () => - context.SignInAsync("Google", new ClaimsPrincipal()) - ); - } - else if (req.Path == new PathString("/signOut")) - { - await Assert.ThrowsAsync( - () => context.SignOutAsync("Google") - ); - } - else if (req.Path == new PathString("/forbid")) - { - await Assert.ThrowsAsync( - () => context.ForbidAsync("Google") - ); - } - else if (testpath != null) - { - await testpath(context); - } - else - { - await next(context); - } + await context.ChallengeAsync(); } - ); - }) - .ConfigureServices(services => - { - services.AddTransient(); - services - .AddAuthentication(TestExtensions.CookieAuthenticationScheme) - .AddCookie( - TestExtensions.CookieAuthenticationScheme, - o => o.ForwardChallenge = GoogleDefaults.AuthenticationScheme - ) - .AddGoogle(configureOptions) - .AddFacebook(o => + else if (req.Path == new PathString("/challengeFacebook")) + { + await context.ChallengeAsync("Facebook"); + } + else if (req.Path == new PathString("/tokens")) + { + var result = await context.AuthenticateAsync( + TestExtensions.CookieAuthenticationScheme + ); + var tokens = result.Properties.GetTokens(); + await res.DescribeAsync(tokens); + } + else if (req.Path == new PathString("/me")) + { + await res.DescribeAsync(context.User); + } + else if (req.Path == new PathString("/authenticate")) + { + var result = await context.AuthenticateAsync( + TestExtensions.CookieAuthenticationScheme + ); + await res.DescribeAsync(result.Principal); + } + else if (req.Path == new PathString("/authenticateGoogle")) + { + var result = await context.AuthenticateAsync("Google"); + await res.DescribeAsync(result?.Principal); + } + else if (req.Path == new PathString("/authenticateFacebook")) + { + var result = await context.AuthenticateAsync("Facebook"); + await res.DescribeAsync(result?.Principal); + } + else if (req.Path == new PathString("/unauthorized")) + { + // Simulate Authorization failure + var result = await context.AuthenticateAsync("Google"); + await context.ChallengeAsync("Google"); + } + else if (req.Path == new PathString("/unauthorizedAuto")) + { + var result = await context.AuthenticateAsync("Google"); + await context.ChallengeAsync("Google"); + } + else if (req.Path == new PathString("/401")) + { + res.StatusCode = 401; + } + else if (req.Path == new PathString("/signIn")) + { + await Assert.ThrowsAsync( + () => context.SignInAsync("Google", new ClaimsPrincipal()) + ); + } + else if (req.Path == new PathString("/signOut")) + { + await Assert.ThrowsAsync( + () => context.SignOutAsync("Google") + ); + } + else if (req.Path == new PathString("/forbid")) { - o.ClientId = "Test ClientId"; - o.ClientSecret = "Test AppSecrent"; - }); - }) + await Assert.ThrowsAsync( + () => context.ForbidAsync("Google") + ); + } + else if (testpath != null) + { + await testpath(context); + } + else + { + await next(context); + } + } + ); + }) + .ConfigureServices(services => + { + services.AddTransient(); + services + .AddAuthentication(TestExtensions.CookieAuthenticationScheme) + .AddCookie( + TestExtensions.CookieAuthenticationScheme, + o => o.ForwardChallenge = GoogleDefaults.AuthenticationScheme + ) + .AddGoogle(configureOptions) + .AddFacebook(o => + { + o.ClientId = "Test ClientId"; + o.ClientSecret = "Test AppSecrent"; + }); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/JwtBearerTests.cs b/aspnetcore/src/Security/Authentication/test/JwtBearerTests.cs index 26830a2efee..c43809b357b 100644 --- a/aspnetcore/src/Security/Authentication/test/JwtBearerTests.cs +++ b/aspnetcore/src/Security/Authentication/test/JwtBearerTests.cs @@ -966,43 +966,42 @@ public async Task EventOnForbidden_ResponseForMultipleAuthenticationSchemas() }; using var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Run( - async (context) => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Run( + async (context) => + { + // Simulate Forbidden By Multiple Authentication Schemas + await context.ForbidAsync("JwtAuthSchemaOne"); + await context.ForbidAsync("JwtAuthSchemaTwo"); + } + ); + }) + .ConfigureServices(services => + { + services + .AddAuthentication() + .AddJwtBearer( + "JwtAuthSchemaOne", + o => { - // Simulate Forbidden By Multiple Authentication Schemas - await context.ForbidAsync("JwtAuthSchemaOne"); - await context.ForbidAsync("JwtAuthSchemaTwo"); + o.Events = jwtBearerEvents; + o.UseSecurityTokenValidators = true; + } + ) + .AddJwtBearer( + "JwtAuthSchemaTwo", + o => + { + o.Events = jwtBearerEvents; + o.UseSecurityTokenValidators = true; } ); - }) - .ConfigureServices(services => - { - services - .AddAuthentication() - .AddJwtBearer( - "JwtAuthSchemaOne", - o => - { - o.Events = jwtBearerEvents; - o.UseSecurityTokenValidators = true; - } - ) - .AddJwtBearer( - "JwtAuthSchemaTwo", - o => - { - o.Events = jwtBearerEvents; - o.UseSecurityTokenValidators = true; - } - ); - }) + }) ) .Build(); @@ -1425,133 +1424,127 @@ private static async Task CreateHost( ) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + if (handlerBeforeAuth != null) { - if (handlerBeforeAuth != null) - { - app.Use(handlerBeforeAuth); - } + app.Use(handlerBeforeAuth); + } - app.UseAuthentication(); - app.Use( - async (context, next) => + app.UseAuthentication(); + app.Use( + async (context, next) => + { + if (context.Request.Path == new PathString("/checkforerrors")) { - if (context.Request.Path == new PathString("/checkforerrors")) + var result = await context.AuthenticateAsync( + JwtBearerDefaults.AuthenticationScheme + ); // this used to be "Automatic" + if (result.Failure != null) { - var result = await context.AuthenticateAsync( - JwtBearerDefaults.AuthenticationScheme - ); // this used to be "Automatic" - if (result.Failure != null) - { - throw new Exception( - "Failed to authenticate", - result.Failure - ); - } - return; - } - else if (context.Request.Path == new PathString("/oauth")) - { - if ( - context.User == null - || context.User.Identity == null - || !context.User.Identity.IsAuthenticated - ) - { - context.Response.StatusCode = 401; - // REVIEW: no more automatic challenge - await context.ChallengeAsync( - JwtBearerDefaults.AuthenticationScheme - ); - return; - } - - var identifier = context.User.FindFirst( - ClaimTypes.NameIdentifier + throw new Exception( + "Failed to authenticate", + result.Failure ); - if (identifier == null) - { - context.Response.StatusCode = 500; - return; - } - - await context.Response.WriteAsync(identifier.Value); - } - else if (context.Request.Path == new PathString("/token")) - { - var token = await context.GetTokenAsync("access_token"); - await context.Response.WriteAsync(token); } - else if ( - context.Request.Path == new PathString("/unauthorized") + return; + } + else if (context.Request.Path == new PathString("/oauth")) + { + if ( + context.User == null + || context.User.Identity == null + || !context.User.Identity.IsAuthenticated ) { - // Simulate Authorization failure - var result = await context.AuthenticateAsync( - JwtBearerDefaults.AuthenticationScheme - ); + context.Response.StatusCode = 401; + // REVIEW: no more automatic challenge await context.ChallengeAsync( JwtBearerDefaults.AuthenticationScheme ); + return; } - else if (context.Request.Path == new PathString("/forbidden")) - { - // Simulate Forbidden - await context.ForbidAsync( - JwtBearerDefaults.AuthenticationScheme - ); - } - else if (context.Request.Path == new PathString("/signIn")) - { - await Assert.ThrowsAsync( - () => - context.SignInAsync( - JwtBearerDefaults.AuthenticationScheme, - new ClaimsPrincipal() - ) - ); - } - else if (context.Request.Path == new PathString("/signOut")) - { - await Assert.ThrowsAsync( - () => - context.SignOutAsync( - JwtBearerDefaults.AuthenticationScheme - ) - ); - } - else if (context.Request.Path == new PathString("/expiration")) - { - var authenticationResult = await context.AuthenticateAsync( - JwtBearerDefaults.AuthenticationScheme - ); - await context.Response.WriteAsJsonAsync( - new - { - Expires = authenticationResult - .Properties - ?.ExpiresUtc, - Issued = authenticationResult.Properties?.IssuedUtc - } - ); - } - else + + var identifier = context.User.FindFirst( + ClaimTypes.NameIdentifier + ); + if (identifier == null) { - await next(context); + context.Response.StatusCode = 500; + return; } + + await context.Response.WriteAsync(identifier.Value); } - ); - }) - .ConfigureServices( - services => - services - .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options) - ) + else if (context.Request.Path == new PathString("/token")) + { + var token = await context.GetTokenAsync("access_token"); + await context.Response.WriteAsync(token); + } + else if (context.Request.Path == new PathString("/unauthorized")) + { + // Simulate Authorization failure + var result = await context.AuthenticateAsync( + JwtBearerDefaults.AuthenticationScheme + ); + await context.ChallengeAsync( + JwtBearerDefaults.AuthenticationScheme + ); + } + else if (context.Request.Path == new PathString("/forbidden")) + { + // Simulate Forbidden + await context.ForbidAsync( + JwtBearerDefaults.AuthenticationScheme + ); + } + else if (context.Request.Path == new PathString("/signIn")) + { + await Assert.ThrowsAsync( + () => + context.SignInAsync( + JwtBearerDefaults.AuthenticationScheme, + new ClaimsPrincipal() + ) + ); + } + else if (context.Request.Path == new PathString("/signOut")) + { + await Assert.ThrowsAsync( + () => + context.SignOutAsync( + JwtBearerDefaults.AuthenticationScheme + ) + ); + } + else if (context.Request.Path == new PathString("/expiration")) + { + var authenticationResult = await context.AuthenticateAsync( + JwtBearerDefaults.AuthenticationScheme + ); + await context.Response.WriteAsJsonAsync( + new + { + Expires = authenticationResult.Properties?.ExpiresUtc, + Issued = authenticationResult.Properties?.IssuedUtc + } + ); + } + else + { + await next(context); + } + } + ); + }) + .ConfigureServices(services => + services + .AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + .AddJwtBearer(options) + ) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/MicrosoftAccountTests.cs b/aspnetcore/src/Security/Authentication/test/MicrosoftAccountTests.cs index 37414131528..33543991560 100644 --- a/aspnetcore/src/Security/Authentication/test/MicrosoftAccountTests.cs +++ b/aspnetcore/src/Security/Authentication/test/MicrosoftAccountTests.cs @@ -426,94 +426,90 @@ public async Task PkceSentToTokenEndpoint() private static async Task CreateHost(Action configureOptions) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + var req = context.Request; + var res = context.Response; + if (req.Path == new PathString("/challenge")) { - var req = context.Request; - var res = context.Response; - if (req.Path == new PathString("/challenge")) - { - await context.ChallengeAsync( - "Microsoft", - new MicrosoftChallengeProperties - { - Prompt = "select_account", - LoginHint = "username", - DomainHint = "consumers", + await context.ChallengeAsync( + "Microsoft", + new MicrosoftChallengeProperties + { + Prompt = "select_account", + LoginHint = "username", + DomainHint = "consumers", #pragma warning disable CS0618 // Type or member is obsolete - ResponseMode = "query", + ResponseMode = "query", #pragma warning restore CS0618 // Type or member is obsolete - RedirectUri = "/me" - } - ); - } - else if (req.Path == new PathString("/challengeWithOtherScope")) - { - var properties = new OAuthChallengeProperties(); - properties.SetScope("baz", "qux"); - await context.ChallengeAsync("Microsoft", properties); - } - else if ( - req.Path - == new PathString( - "/challengeWithOtherScopeWithBaseAuthenticationProperties" - ) + RedirectUri = "/me" + } + ); + } + else if (req.Path == new PathString("/challengeWithOtherScope")) + { + var properties = new OAuthChallengeProperties(); + properties.SetScope("baz", "qux"); + await context.ChallengeAsync("Microsoft", properties); + } + else if ( + req.Path + == new PathString( + "/challengeWithOtherScopeWithBaseAuthenticationProperties" ) - { - var properties = new AuthenticationProperties(); - properties.SetParameter( - OAuthChallengeProperties.ScopeKey, - new string[] { "baz", "qux" } - ); - await context.ChallengeAsync("Microsoft", properties); - } - else if (req.Path == new PathString("/me")) - { - await res.DescribeAsync(context.User); - } - else if (req.Path == new PathString("/signIn")) - { - await Assert.ThrowsAsync( - () => - context.SignInAsync( - "Microsoft", - new ClaimsPrincipal() - ) - ); - } - else if (req.Path == new PathString("/signOut")) - { - await Assert.ThrowsAsync( - () => context.SignOutAsync("Microsoft") - ); - } - else if (req.Path == new PathString("/forbid")) - { - await Assert.ThrowsAsync( - () => context.ForbidAsync("Microsoft") - ); - } - else - { - await next(context); - } + ) + { + var properties = new AuthenticationProperties(); + properties.SetParameter( + OAuthChallengeProperties.ScopeKey, + new string[] { "baz", "qux" } + ); + await context.ChallengeAsync("Microsoft", properties); + } + else if (req.Path == new PathString("/me")) + { + await res.DescribeAsync(context.User); + } + else if (req.Path == new PathString("/signIn")) + { + await Assert.ThrowsAsync( + () => + context.SignInAsync("Microsoft", new ClaimsPrincipal()) + ); + } + else if (req.Path == new PathString("/signOut")) + { + await Assert.ThrowsAsync( + () => context.SignOutAsync("Microsoft") + ); + } + else if (req.Path == new PathString("/forbid")) + { + await Assert.ThrowsAsync( + () => context.ForbidAsync("Microsoft") + ); } - ); - }) - .ConfigureServices(services => - { - services - .AddAuthentication(TestExtensions.CookieAuthenticationScheme) - .AddCookie(TestExtensions.CookieAuthenticationScheme, o => { }) - .AddMicrosoftAccount(configureOptions); - }) + else + { + await next(context); + } + } + ); + }) + .ConfigureServices(services => + { + services + .AddAuthentication(TestExtensions.CookieAuthenticationScheme) + .AddCookie(TestExtensions.CookieAuthenticationScheme, o => { }) + .AddMicrosoftAccount(configureOptions); + }) ) .Build(); await host.StartAsync(); diff --git a/aspnetcore/src/Security/Authentication/test/OAuthTests.cs b/aspnetcore/src/Security/Authentication/test/OAuthTests.cs index 84a32b1d8dd..24dec1492a8 100644 --- a/aspnetcore/src/Security/Authentication/test/OAuthTests.cs +++ b/aspnetcore/src/Security/Authentication/test/OAuthTests.cs @@ -46,21 +46,20 @@ Action configure [Fact] public async Task ThrowsIfClientIdMissing() { - using var host = await CreateHost( - services => - services - .AddAuthentication() - .AddOAuth( - "weeblie", - o => - { - o.SignInScheme = "whatever"; - o.CallbackPath = "/"; - o.ClientSecret = "whatever"; - o.TokenEndpoint = "/"; - o.AuthorizationEndpoint = "/"; - } - ) + using var host = await CreateHost(services => + services + .AddAuthentication() + .AddOAuth( + "weeblie", + o => + { + o.SignInScheme = "whatever"; + o.CallbackPath = "/"; + o.ClientSecret = "whatever"; + o.TokenEndpoint = "/"; + o.AuthorizationEndpoint = "/"; + } + ) ); using var server = host.GetTestServer(); await Assert.ThrowsAsync( @@ -72,21 +71,20 @@ await Assert.ThrowsAsync( [Fact] public async Task ThrowsIfClientSecretMissing() { - using var host = await CreateHost( - services => - services - .AddAuthentication() - .AddOAuth( - "weeblie", - o => - { - o.SignInScheme = "whatever"; - o.ClientId = "Whatever;"; - o.CallbackPath = "/"; - o.TokenEndpoint = "/"; - o.AuthorizationEndpoint = "/"; - } - ) + using var host = await CreateHost(services => + services + .AddAuthentication() + .AddOAuth( + "weeblie", + o => + { + o.SignInScheme = "whatever"; + o.ClientId = "Whatever;"; + o.CallbackPath = "/"; + o.TokenEndpoint = "/"; + o.AuthorizationEndpoint = "/"; + } + ) ); using var server = host.GetTestServer(); await Assert.ThrowsAsync( @@ -98,21 +96,20 @@ await Assert.ThrowsAsync( [Fact] public async Task ThrowsIfCallbackPathMissing() { - using var host = await CreateHost( - services => - services - .AddAuthentication() - .AddOAuth( - "weeblie", - o => - { - o.ClientId = "Whatever;"; - o.ClientSecret = "Whatever;"; - o.TokenEndpoint = "/"; - o.AuthorizationEndpoint = "/"; - o.SignInScheme = "eh"; - } - ) + using var host = await CreateHost(services => + services + .AddAuthentication() + .AddOAuth( + "weeblie", + o => + { + o.ClientId = "Whatever;"; + o.ClientSecret = "Whatever;"; + o.TokenEndpoint = "/"; + o.AuthorizationEndpoint = "/"; + o.SignInScheme = "eh"; + } + ) ); using var server = host.GetTestServer(); await Assert.ThrowsAsync( @@ -124,21 +121,20 @@ await Assert.ThrowsAsync( [Fact] public async Task ThrowsIfTokenEndpointMissing() { - using var host = await CreateHost( - services => - services - .AddAuthentication() - .AddOAuth( - "weeblie", - o => - { - o.ClientId = "Whatever;"; - o.ClientSecret = "Whatever;"; - o.CallbackPath = "/"; - o.AuthorizationEndpoint = "/"; - o.SignInScheme = "eh"; - } - ) + using var host = await CreateHost(services => + services + .AddAuthentication() + .AddOAuth( + "weeblie", + o => + { + o.ClientId = "Whatever;"; + o.ClientSecret = "Whatever;"; + o.CallbackPath = "/"; + o.AuthorizationEndpoint = "/"; + o.SignInScheme = "eh"; + } + ) ); using var server = host.GetTestServer(); await Assert.ThrowsAsync( @@ -150,21 +146,20 @@ await Assert.ThrowsAsync( [Fact] public async Task ThrowsIfAuthorizationEndpointMissing() { - using var host = await CreateHost( - services => - services - .AddAuthentication() - .AddOAuth( - "weeblie", - o => - { - o.ClientId = "Whatever;"; - o.ClientSecret = "Whatever;"; - o.CallbackPath = "/"; - o.TokenEndpoint = "/"; - o.SignInScheme = "eh"; - } - ) + using var host = await CreateHost(services => + services + .AddAuthentication() + .AddOAuth( + "weeblie", + o => + { + o.ClientId = "Whatever;"; + o.ClientSecret = "Whatever;"; + o.CallbackPath = "/"; + o.TokenEndpoint = "/"; + o.SignInScheme = "eh"; + } + ) ); using var server = host.GetTestServer(); await Assert.ThrowsAsync( @@ -355,27 +350,24 @@ protected override void ConfigureDefaults(OAuthOptions o) [Fact] public async Task HandleRequestAsync_RedirectsToAccessDeniedPathWhenExplicitlySet() { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => - { - opt.ClientId = "Test Id"; - opt.ClientSecret = "secret"; - opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - opt.AuthorizationEndpoint = "https://example.com/provider/login"; - opt.TokenEndpoint = "https://example.com/provider/token"; - opt.CallbackPath = "/oauth-callback"; - opt.AccessDeniedPath = "/access-denied"; - opt.StateDataFormat = new TestStateDataFormat(); - opt.Events.OnRemoteFailure = context => - throw new InvalidOperationException( - "This event should not be called." - ); - } - ) + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + opt.ClientId = "Test Id"; + opt.ClientSecret = "secret"; + opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + opt.AuthorizationEndpoint = "https://example.com/provider/login"; + opt.TokenEndpoint = "https://example.com/provider/token"; + opt.CallbackPath = "/oauth-callback"; + opt.AccessDeniedPath = "/access-denied"; + opt.StateDataFormat = new TestStateDataFormat(); + opt.Events.OnRemoteFailure = context => + throw new InvalidOperationException("This event should not be called."); + } + ) ); using var server = host.GetTestServer(); @@ -394,33 +386,31 @@ public async Task HandleRequestAsync_RedirectsToAccessDeniedPathWhenExplicitlySe [Fact] public async Task HandleRequestAsync_InvokesAccessDeniedEvent() { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + opt.ClientId = "Test Id"; + opt.ClientSecret = "secret"; + opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + opt.AuthorizationEndpoint = "https://example.com/provider/login"; + opt.TokenEndpoint = "https://example.com/provider/token"; + opt.CallbackPath = "/oauth-callback"; + opt.StateDataFormat = new TestStateDataFormat(); + opt.Events = new OAuthEvents() { - opt.ClientId = "Test Id"; - opt.ClientSecret = "secret"; - opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - opt.AuthorizationEndpoint = "https://example.com/provider/login"; - opt.TokenEndpoint = "https://example.com/provider/token"; - opt.CallbackPath = "/oauth-callback"; - opt.StateDataFormat = new TestStateDataFormat(); - opt.Events = new OAuthEvents() + OnAccessDenied = context => { - OnAccessDenied = context => - { - Assert.Equal("testvalue", context.Properties.Items["testkey"]); - context.Response.StatusCode = - StatusCodes.Status406NotAcceptable; - context.HandleResponse(); - return Task.CompletedTask; - } - }; - } - ) + Assert.Equal("testvalue", context.Properties.Items["testkey"]); + context.Response.StatusCode = StatusCodes.Status406NotAcceptable; + context.HandleResponse(); + return Task.CompletedTask; + } + }; + } + ) ); using var server = host.GetTestServer(); @@ -436,37 +426,35 @@ public async Task HandleRequestAsync_InvokesAccessDeniedEvent() [Fact] public async Task HandleRequestAsync_InvokesRemoteFailureEventWhenAccessDeniedPathIsNotExplicitlySet() { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + opt.ClientId = "Test Id"; + opt.ClientSecret = "secret"; + opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + opt.AuthorizationEndpoint = "https://example.com/provider/login"; + opt.TokenEndpoint = "https://example.com/provider/token"; + opt.CallbackPath = "/oauth-callback"; + opt.StateDataFormat = new TestStateDataFormat(); + opt.Events = new OAuthEvents() { - opt.ClientId = "Test Id"; - opt.ClientSecret = "secret"; - opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - opt.AuthorizationEndpoint = "https://example.com/provider/login"; - opt.TokenEndpoint = "https://example.com/provider/token"; - opt.CallbackPath = "/oauth-callback"; - opt.StateDataFormat = new TestStateDataFormat(); - opt.Events = new OAuthEvents() + OnRemoteFailure = context => { - OnRemoteFailure = context => - { - Assert.Equal( - "Access was denied by the resource owner or by the remote server.", - context.Failure.Message - ); - Assert.Equal("testvalue", context.Properties.Items["testkey"]); - context.Response.StatusCode = - StatusCodes.Status406NotAcceptable; - context.HandleResponse(); - return Task.CompletedTask; - } - }; - } - ) + Assert.Equal( + "Access was denied by the resource owner or by the remote server.", + context.Failure.Message + ); + Assert.Equal("testvalue", context.Properties.Items["testkey"]); + context.Response.StatusCode = StatusCodes.Status406NotAcceptable; + context.HandleResponse(); + return Task.CompletedTask; + } + }; + } + ) ); using var server = host.GetTestServer(); @@ -482,34 +470,32 @@ public async Task HandleRequestAsync_InvokesRemoteFailureEventWhenAccessDeniedPa [Fact] public async Task RemoteAuthenticationFailed_OAuthError_IncludesProperties() { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + opt.ClientId = "Test Id"; + opt.ClientSecret = "secret"; + opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; + opt.AuthorizationEndpoint = "https://example.com/provider/login"; + opt.TokenEndpoint = "https://example.com/provider/token"; + opt.CallbackPath = "/oauth-callback"; + opt.StateDataFormat = new TestStateDataFormat(); + opt.Events = new OAuthEvents() { - opt.ClientId = "Test Id"; - opt.ClientSecret = "secret"; - opt.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; - opt.AuthorizationEndpoint = "https://example.com/provider/login"; - opt.TokenEndpoint = "https://example.com/provider/token"; - opt.CallbackPath = "/oauth-callback"; - opt.StateDataFormat = new TestStateDataFormat(); - opt.Events = new OAuthEvents() + OnRemoteFailure = context => { - OnRemoteFailure = context => - { - Assert.Contains("custom_error", context.Failure.Message); - Assert.Equal("testvalue", context.Properties.Items["testkey"]); - context.Response.StatusCode = - StatusCodes.Status406NotAcceptable; - context.HandleResponse(); - return Task.CompletedTask; - } - }; - } - ) + Assert.Contains("custom_error", context.Failure.Message); + Assert.Equal("testvalue", context.Properties.Items["testkey"]); + context.Response.StatusCode = StatusCodes.Status406NotAcceptable; + context.HandleResponse(); + return Task.CompletedTask; + } + }; + } + ) ); using var server = host.GetTestServer(); @@ -527,59 +513,58 @@ public async Task RemoteAuthenticationFailed_OAuthError_IncludesProperties() [InlineData(HttpStatusCode.BadRequest)] public async Task ExchangeCodeAsync_ChecksForErrorInformation(HttpStatusCode httpStatusCode) { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + ConfigureDefaults(opt); + opt.StateDataFormat = new TestStateDataFormat(); + opt.BackchannelHttpHandler = new TestHttpMessageHandler { - ConfigureDefaults(opt); - opt.StateDataFormat = new TestStateDataFormat(); - opt.BackchannelHttpHandler = new TestHttpMessageHandler + Sender = req => { - Sender = req => + if ( + req.RequestUri.AbsoluteUri + == "https://example.com/provider/token" + ) { - if ( - req.RequestUri.AbsoluteUri - == "https://example.com/provider/token" - ) - { - return ReturnJsonResponse( - new - { - error = "incorrect_client_credentials", - error_description = "The client_id and/or client_secret passed are incorrect.", - error_uri = "https://example.com/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials", - }, - httpStatusCode - ); - } - - return null; - } - }; - opt.Events = new OAuthEvents() - { - OnRemoteFailure = context => - { - Assert.Equal( - "incorrect_client_credentials", - context.Failure.Data["error"] + return ReturnJsonResponse( + new + { + error = "incorrect_client_credentials", + error_description = "The client_id and/or client_secret passed are incorrect.", + error_uri = "https://example.com/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials", + }, + httpStatusCode ); - Assert.Equal( - "The client_id and/or client_secret passed are incorrect.", - context.Failure.Data["error_description"] - ); - Assert.Equal( - "https://example.com/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials", - context.Failure.Data["error_uri"] - ); - return Task.CompletedTask; } - }; - } - ) + + return null; + } + }; + opt.Events = new OAuthEvents() + { + OnRemoteFailure = context => + { + Assert.Equal( + "incorrect_client_credentials", + context.Failure.Data["error"] + ); + Assert.Equal( + "The client_id and/or client_secret passed are incorrect.", + context.Failure.Data["error_description"] + ); + Assert.Equal( + "https://example.com/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials", + context.Failure.Data["error_uri"] + ); + return Task.CompletedTask; + } + }; + } + ) ); using var server = host.GetTestServer(); @@ -595,50 +580,49 @@ public async Task ExchangeCodeAsync_ChecksForErrorInformation(HttpStatusCode htt [Fact] public async Task ExchangeCodeAsync_FallbackToBasicErrorReporting_WhenErrorInformationIsNotPresent() { - using var host = await CreateHost( - s => - s.AddAuthentication() - .AddOAuth( - "Weblie", - opt => + using var host = await CreateHost(s => + s.AddAuthentication() + .AddOAuth( + "Weblie", + opt => + { + ConfigureDefaults(opt); + opt.StateDataFormat = new TestStateDataFormat(); + opt.BackchannelHttpHandler = new TestHttpMessageHandler { - ConfigureDefaults(opt); - opt.StateDataFormat = new TestStateDataFormat(); - opt.BackchannelHttpHandler = new TestHttpMessageHandler - { - Sender = req => - { - if ( - req.RequestUri.AbsoluteUri - == "https://example.com/provider/token" - ) - { - return ReturnJsonResponse( - new - { - ErrorCode = "ThisIsCustomErrorCode", - ErrorDescription = "ThisIsCustomErrorDescription" - }, - HttpStatusCode.BadRequest - ); - } - - return null; - } - }; - opt.Events = new OAuthEvents() + Sender = req => { - OnRemoteFailure = context => + if ( + req.RequestUri.AbsoluteUri + == "https://example.com/provider/token" + ) { - Assert.StartsWith( - "OAuth token endpoint failure:", - context.Failure.Message + return ReturnJsonResponse( + new + { + ErrorCode = "ThisIsCustomErrorCode", + ErrorDescription = "ThisIsCustomErrorDescription" + }, + HttpStatusCode.BadRequest ); - return Task.CompletedTask; } - }; - } - ) + + return null; + } + }; + opt.Events = new OAuthEvents() + { + OnRemoteFailure = context => + { + Assert.StartsWith( + "OAuth token endpoint failure:", + context.Failure.Message + ); + return Task.CompletedTask; + } + }; + } + ) ); using var server = host.GetTestServer(); @@ -657,24 +641,23 @@ private static async Task CreateHost( ) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + if (handler == null || !await handler(context)) { - if (handler == null || !await handler(context)) - { - await next(context); - } + await next(context); } - ); - }) - .ConfigureServices(configureServices) + } + ); + }) + .ConfigureServices(configureServices) ) .Build(); await host.StartAsync(); diff --git a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectConfigurationTests.cs b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectConfigurationTests.cs index cd3e3ba7154..32c833e155d 100644 --- a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectConfigurationTests.cs +++ b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectConfigurationTests.cs @@ -459,7 +459,9 @@ public async Task MetadataAddressIsGeneratedFromAuthorityWhenMissing() app.Run(async context => { var resolver = - context.RequestServices.GetRequiredService(); + context.RequestServices.GetRequiredService( + + ); var handler = await resolver.GetHandlerAsync( context, @@ -596,15 +598,14 @@ public Task ThrowsWhenMaxAgeIsNegative() private TestServer BuildTestServer(Action options) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .ConfigureServices(services => - { - services.AddAuthentication().AddCookie().AddOpenIdConnect(options); - }) - .Configure(app => app.UseAuthentication()) + .ConfigureWebHost(builder => + builder + .UseTestServer() + .ConfigureServices(services => + { + services.AddAuthentication().AddCookie().AddOpenIdConnect(options); + }) + .Configure(app => app.UseAuthentication()) ) .Build(); host.Start(); diff --git a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectEventTests_Handler.cs b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectEventTests_Handler.cs index 6bcc838fbca..6b9d5828fda 100644 --- a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectEventTests_Handler.cs +++ b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/OpenIdConnectEventTests_Handler.cs @@ -1388,44 +1388,43 @@ public void ValidateExpectations() private TestServer CreateServer(OpenIdConnectEvents events, RequestDelegate appCode) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .ConfigureServices(services => - { - services - .AddAuthentication(auth => - { - auth.DefaultScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - auth.DefaultChallengeScheme = - OpenIdConnectDefaults.AuthenticationScheme; - }) - .AddCookie() - .AddOpenIdConnect(o => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .ConfigureServices(services => + { + services + .AddAuthentication(auth => + { + auth.DefaultScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + auth.DefaultChallengeScheme = + OpenIdConnectDefaults.AuthenticationScheme; + }) + .AddCookie() + .AddOpenIdConnect(o => + { + o.Events = events; + o.ClientId = "ClientId"; + o.GetClaimsFromUserInfoEndpoint = true; + o.Configuration = new OpenIdConnectConfiguration() { - o.Events = events; - o.ClientId = "ClientId"; - o.GetClaimsFromUserInfoEndpoint = true; - o.Configuration = new OpenIdConnectConfiguration() - { - TokenEndpoint = "http://testhost/tokens", - UserInfoEndpoint = "http://testhost/user", - EndSessionEndpoint = "http://testhost/end" - }; - o.StateDataFormat = new TestStateDataFormat(); - o.UseSecurityTokenValidator = false; - o.TokenHandler = new TestTokenHandler(); - o.ProtocolValidator = new TestProtocolValidator(); - o.BackchannelHttpHandler = new TestBackchannel(); - }); - }) - .Configure(app => - { - app.UseAuthentication(); - app.Run(appCode); - }) + TokenEndpoint = "http://testhost/tokens", + UserInfoEndpoint = "http://testhost/user", + EndSessionEndpoint = "http://testhost/end" + }; + o.StateDataFormat = new TestStateDataFormat(); + o.UseSecurityTokenValidator = false; + o.TokenHandler = new TestTokenHandler(); + o.ProtocolValidator = new TestProtocolValidator(); + o.BackchannelHttpHandler = new TestBackchannel(); + }); + }) + .Configure(app => + { + app.UseAuthentication(); + app.Run(appCode); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/TestServerBuilder.cs b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/TestServerBuilder.cs index 5b83c62a95d..5ac66036437 100644 --- a/aspnetcore/src/Security/Authentication/test/OpenIdConnect/TestServerBuilder.cs +++ b/aspnetcore/src/Security/Authentication/test/OpenIdConnect/TestServerBuilder.cs @@ -67,83 +67,80 @@ AuthenticationProperties properties ) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => - { - var req = context.Request; - var res = context.Response; + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + var req = context.Request; + var res = context.Response; - if (req.Path == new PathString(Challenge)) - { - await context.ChallengeAsync( - OpenIdConnectDefaults.AuthenticationScheme - ); - } - else if (req.Path == new PathString(ChallengeWithProperties)) - { - await context.ChallengeAsync( - OpenIdConnectDefaults.AuthenticationScheme, - properties - ); - } - else if (req.Path == new PathString(ChallengeWithOutContext)) - { - res.StatusCode = 401; - } - else if (req.Path == new PathString(Signin)) - { - await context.SignInAsync( - OpenIdConnectDefaults.AuthenticationScheme, - new ClaimsPrincipal() - ); - } - else if (req.Path == new PathString(Signout)) - { - await context.SignOutAsync( - OpenIdConnectDefaults.AuthenticationScheme - ); - } - else if ( - req.Path - == new PathString("/signout_with_specific_redirect_uri") - ) - { - await context.SignOutAsync( - OpenIdConnectDefaults.AuthenticationScheme, - new AuthenticationProperties() - { - RedirectUri = - "http://www.example.com/specific_redirect_uri" - } - ); - } - else if (handler != null) - { - await handler(context); - } - else - { - await next(context); - } + if (req.Path == new PathString(Challenge)) + { + await context.ChallengeAsync( + OpenIdConnectDefaults.AuthenticationScheme + ); + } + else if (req.Path == new PathString(ChallengeWithProperties)) + { + await context.ChallengeAsync( + OpenIdConnectDefaults.AuthenticationScheme, + properties + ); + } + else if (req.Path == new PathString(ChallengeWithOutContext)) + { + res.StatusCode = 401; + } + else if (req.Path == new PathString(Signin)) + { + await context.SignInAsync( + OpenIdConnectDefaults.AuthenticationScheme, + new ClaimsPrincipal() + ); } - ); - }) - .ConfigureServices(services => - { - services - .AddAuthentication( - CookieAuthenticationDefaults.AuthenticationScheme + else if (req.Path == new PathString(Signout)) + { + await context.SignOutAsync( + OpenIdConnectDefaults.AuthenticationScheme + ); + } + else if ( + req.Path + == new PathString("/signout_with_specific_redirect_uri") ) - .AddCookie() - .AddOpenIdConnect(options); - }) + { + await context.SignOutAsync( + OpenIdConnectDefaults.AuthenticationScheme, + new AuthenticationProperties() + { + RedirectUri = + "http://www.example.com/specific_redirect_uri" + } + ); + } + else if (handler != null) + { + await handler(context); + } + else + { + await next(context); + } + } + ); + }) + .ConfigureServices(services => + { + services + .AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) + .AddCookie() + .AddOpenIdConnect(options); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/RemoteAuthenticationTests.cs b/aspnetcore/src/Security/Authentication/test/RemoteAuthenticationTests.cs index 51b0b5ba78c..444a6c25368 100644 --- a/aspnetcore/src/Security/Authentication/test/RemoteAuthenticationTests.cs +++ b/aspnetcore/src/Security/Authentication/test/RemoteAuthenticationTests.cs @@ -48,24 +48,23 @@ protected virtual async Task CreateHostWithServices( ) { var host = new HostBuilder() - .ConfigureWebHost( - webHostBuilder => - webHostBuilder - .UseTestServer() - .Configure(app => - { - app.Use( - async (context, next) => + .ConfigureWebHost(webHostBuilder => + webHostBuilder + .UseTestServer() + .Configure(app => + { + app.Use( + async (context, next) => + { + if (testpath != null) { - if (testpath != null) - { - await testpath(context); - } - await next(context); + await testpath(context); } - ); - }) - .ConfigureServices(configureServices) + await next(context); + } + ); + }) + .ConfigureServices(configureServices) ) .Build(); await host.StartAsync(); @@ -113,8 +112,7 @@ public async Task VerifySignInSchemeCannotBeSetToSelfUsingDefaultSignInScheme() using var host = await CreateHostWithServices( services => { - var builder = services.AddAuthentication( - o => o.DefaultSignInScheme = DefaultScheme + var builder = services.AddAuthentication(o => o.DefaultSignInScheme = DefaultScheme ); RegisterAuth(builder, o => o.SignInScheme = null); }, diff --git a/aspnetcore/src/Security/Authentication/test/TwitterTests.cs b/aspnetcore/src/Security/Authentication/test/TwitterTests.cs index d2db69b975b..90e8c6c1266 100644 --- a/aspnetcore/src/Security/Authentication/test/TwitterTests.cs +++ b/aspnetcore/src/Security/Authentication/test/TwitterTests.cs @@ -631,74 +631,69 @@ private static async Task CreateHost( ) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(app => - { - app.UseAuthentication(); - app.Use( - async (context, next) => + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(app => + { + app.UseAuthentication(); + app.Use( + async (context, next) => + { + var req = context.Request; + var res = context.Response; + if (req.Path == new PathString("/signIn")) + { + await Assert.ThrowsAsync( + () => context.SignInAsync("Twitter", new ClaimsPrincipal()) + ); + } + else if (req.Path == new PathString("/signOut")) + { + await Assert.ThrowsAsync( + () => context.SignOutAsync("Twitter") + ); + } + else if (req.Path == new PathString("/forbid")) + { + await Assert.ThrowsAsync( + () => context.ForbidAsync("Twitter") + ); + } + else if (req.Path == new PathString("/me")) { - var req = context.Request; - var res = context.Response; - if (req.Path == new PathString("/signIn")) - { - await Assert.ThrowsAsync( - () => - context.SignInAsync( - "Twitter", - new ClaimsPrincipal() - ) - ); - } - else if (req.Path == new PathString("/signOut")) - { - await Assert.ThrowsAsync( - () => context.SignOutAsync("Twitter") - ); - } - else if (req.Path == new PathString("/forbid")) - { - await Assert.ThrowsAsync( - () => context.ForbidAsync("Twitter") - ); - } - else if (req.Path == new PathString("/me")) - { - await res.DescribeAsync(context.User); - } - else if (req.Path == new PathString("/tokens")) - { - var result = await context.AuthenticateAsync( - TestExtensions.CookieAuthenticationScheme - ); - var tokens = result.Properties.GetTokens(); - await res.DescribeAsync(tokens); - } - else if (handler == null || !await handler(context)) - { - await next(context); - } + await res.DescribeAsync(context.User); } - ); - }) - .ConfigureServices(services => + else if (req.Path == new PathString("/tokens")) + { + var result = await context.AuthenticateAsync( + TestExtensions.CookieAuthenticationScheme + ); + var tokens = result.Properties.GetTokens(); + await res.DescribeAsync(tokens); + } + else if (handler == null || !await handler(context)) + { + await next(context); + } + } + ); + }) + .ConfigureServices(services => + { + Action wrapOptions = o => { - Action wrapOptions = o => - { - o.SignInScheme = "External"; - options(o); - }; - services - .AddAuthentication(TestExtensions.CookieAuthenticationScheme) - .AddCookie( - TestExtensions.CookieAuthenticationScheme, - o => o.ForwardChallenge = TwitterDefaults.AuthenticationScheme - ) - .AddTwitter(wrapOptions); - }) + o.SignInScheme = "External"; + options(o); + }; + services + .AddAuthentication(TestExtensions.CookieAuthenticationScheme) + .AddCookie( + TestExtensions.CookieAuthenticationScheme, + o => o.ForwardChallenge = TwitterDefaults.AuthenticationScheme + ) + .AddTwitter(wrapOptions); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authentication/test/WsFederation/WsFederationTest.cs b/aspnetcore/src/Security/Authentication/test/WsFederation/WsFederationTest.cs index 413a35ec703..e2211503516 100644 --- a/aspnetcore/src/Security/Authentication/test/WsFederation/WsFederationTest.cs +++ b/aspnetcore/src/Security/Authentication/test/WsFederation/WsFederationTest.cs @@ -41,26 +41,25 @@ public async Task VerifySchemeDefaults() public async Task MissingConfigurationThrows() { using var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(ConfigureApp) - .ConfigureServices(services => - { - services - .AddAuthentication(sharedOptions => - { - sharedOptions.DefaultScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultSignInScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultChallengeScheme = - WsFederationDefaults.AuthenticationScheme; - }) - .AddCookie() - .AddWsFederation(); - }) + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(ConfigureApp) + .ConfigureServices(services => + { + services + .AddAuthentication(sharedOptions => + { + sharedOptions.DefaultScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultSignInScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultChallengeScheme = + WsFederationDefaults.AuthenticationScheme; + }) + .AddCookie() + .AddWsFederation(); + }) ) .Build(); @@ -245,38 +244,36 @@ public async Task RemoteSignoutRequestTriggersSignout() public async Task EventsResolvedFromDI() { using var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .ConfigureServices(services => - { - services.AddSingleton(); - services - .AddAuthentication(sharedOptions => - { - sharedOptions.DefaultScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultSignInScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultChallengeScheme = - WsFederationDefaults.AuthenticationScheme; - }) - .AddCookie() - .AddWsFederation(options => - { - options.Wtrealm = "http://Automation1"; - options.MetadataAddress = - "https://login.windows.net/4afbc689-805b-48cf-a24c-d4aa3248a248/federationmetadata/2007-06/federationmetadata.xml"; - options.BackchannelHttpHandler = - new WaadMetadataDocumentHandler(); - options.EventsType = typeof(MyWsFedEvents); - }); - }) - .Configure(app => - { - app.Run(context => context.ChallengeAsync()); - }) + .ConfigureWebHost(builder => + builder + .UseTestServer() + .ConfigureServices(services => + { + services.AddSingleton(); + services + .AddAuthentication(sharedOptions => + { + sharedOptions.DefaultScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultSignInScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultChallengeScheme = + WsFederationDefaults.AuthenticationScheme; + }) + .AddCookie() + .AddWsFederation(options => + { + options.Wtrealm = "http://Automation1"; + options.MetadataAddress = + "https://login.windows.net/4afbc689-805b-48cf-a24c-d4aa3248a248/federationmetadata/2007-06/federationmetadata.xml"; + options.BackchannelHttpHandler = new WaadMetadataDocumentHandler(); + options.EventsType = typeof(MyWsFedEvents); + }); + }) + .Configure(app => + { + app.Run(context => context.ChallengeAsync()); + }) ) .Build(); @@ -336,134 +333,119 @@ private void CopyCookies(HttpResponseMessage response, HttpRequestMessage reques private async Task CreateClient(bool allowUnsolicited = false) { var host = new HostBuilder() - .ConfigureWebHost( - builder => - builder - .UseTestServer() - .Configure(ConfigureApp) - .ConfigureServices(services => - { - services - .AddAuthentication(sharedOptions => - { - sharedOptions.DefaultScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultSignInScheme = - CookieAuthenticationDefaults.AuthenticationScheme; - sharedOptions.DefaultChallengeScheme = - WsFederationDefaults.AuthenticationScheme; - }) - .AddCookie() - .AddWsFederation(options => - { - options.UseSecurityTokenHandlers = true; - options.Wtrealm = "http://Automation1"; - options.MetadataAddress = - "https://login.windows.net/4afbc689-805b-48cf-a24c-d4aa3248a248/federationmetadata/2007-06/federationmetadata.xml"; - options.BackchannelHttpHandler = - new WaadMetadataDocumentHandler(); - options.StateDataFormat = new CustomStateDataFormat(); + .ConfigureWebHost(builder => + builder + .UseTestServer() + .Configure(ConfigureApp) + .ConfigureServices(services => + { + services + .AddAuthentication(sharedOptions => + { + sharedOptions.DefaultScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultSignInScheme = + CookieAuthenticationDefaults.AuthenticationScheme; + sharedOptions.DefaultChallengeScheme = + WsFederationDefaults.AuthenticationScheme; + }) + .AddCookie() + .AddWsFederation(options => + { + options.UseSecurityTokenHandlers = true; + options.Wtrealm = "http://Automation1"; + options.MetadataAddress = + "https://login.windows.net/4afbc689-805b-48cf-a24c-d4aa3248a248/federationmetadata/2007-06/federationmetadata.xml"; + options.BackchannelHttpHandler = new WaadMetadataDocumentHandler(); + options.StateDataFormat = new CustomStateDataFormat(); #pragma warning disable CS0618 // Type or member is obsolete - options.SecurityTokenHandlers = - new List() - { - new TestSecurityTokenValidator() - }; + options.SecurityTokenHandlers = new List() + { + new TestSecurityTokenValidator() + }; #pragma warning restore CS0618 // Type or member is obsolete - options.UseTokenLifetime = false; - options.AllowUnsolicitedLogins = allowUnsolicited; - options.Events = new WsFederationEvents() + options.UseTokenLifetime = false; + options.AllowUnsolicitedLogins = allowUnsolicited; + options.Events = new WsFederationEvents() + { + OnMessageReceived = context => { - OnMessageReceived = context => - { - if ( - !context.ProtocolMessage.Parameters.TryGetValue( - "suppressWctx", - out var suppress - ) + if ( + !context.ProtocolMessage.Parameters.TryGetValue( + "suppressWctx", + out var suppress ) - { - Assert.True( - context.ProtocolMessage.Wctx.Equals( - "customValue" - ), - "wctx is not my custom value" - ); - } - context.HttpContext.Items["MessageReceived"] = true; - return Task.FromResult(0); - }, - OnRedirectToIdentityProvider = context => - { - if (context.ProtocolMessage.IsSignInMessage) - { - // Sign in message - context.ProtocolMessage.Wctx = "customValue"; - } - - return Task.FromResult(0); - }, - OnSecurityTokenReceived = context => + ) { - context.HttpContext.Items["SecurityTokenReceived"] = - true; - return Task.FromResult(0); - }, - OnSecurityTokenValidated = context => - { - Assert.True( - (bool)context.HttpContext.Items["MessageReceived"], - "MessageReceived notification not invoked" - ); Assert.True( - (bool) - context.HttpContext.Items[ - "SecurityTokenReceived" - ], - "SecurityTokenReceived notification not invoked" + context.ProtocolMessage.Wctx.Equals("customValue"), + "wctx is not my custom value" ); + } + context.HttpContext.Items["MessageReceived"] = true; + return Task.FromResult(0); + }, + OnRedirectToIdentityProvider = context => + { + if (context.ProtocolMessage.IsSignInMessage) + { + // Sign in message + context.ProtocolMessage.Wctx = "customValue"; + } - if (context.Principal != null) - { - var identity = - context.Principal.Identities.Single(); - identity.AddClaim( - new Claim("ReturnEndpoint", "true") - ); - identity.AddClaim( - new Claim("Authenticated", "true") - ); - identity.AddClaim( - new Claim( - identity.RoleClaimType, - "Guest", - ClaimValueTypes.String - ) - ); - } - - return Task.FromResult(0); - }, - OnAuthenticationFailed = context => + return Task.FromResult(0); + }, + OnSecurityTokenReceived = context => + { + context.HttpContext.Items["SecurityTokenReceived"] = true; + return Task.FromResult(0); + }, + OnSecurityTokenValidated = context => + { + Assert.True( + (bool)context.HttpContext.Items["MessageReceived"], + "MessageReceived notification not invoked" + ); + Assert.True( + (bool) + context.HttpContext.Items["SecurityTokenReceived"], + "SecurityTokenReceived notification not invoked" + ); + + if (context.Principal != null) { - context.HttpContext.Items["AuthenticationFailed"] = - true; - //Change the request url to something different and skip Wsfed. This new url will handle the request and let us know if this notification was invoked. - context.HttpContext.Request.Path = new PathString( - "/AuthenticationFailed" + var identity = context.Principal.Identities.Single(); + identity.AddClaim(new Claim("ReturnEndpoint", "true")); + identity.AddClaim(new Claim("Authenticated", "true")); + identity.AddClaim( + new Claim( + identity.RoleClaimType, + "Guest", + ClaimValueTypes.String + ) ); - context.SkipHandler(); - return Task.FromResult(0); - }, - OnRemoteSignOut = context => - { - context.Response.Headers["EventHeader"] = - "OnRemoteSignOut"; - return Task.FromResult(0); } - }; - }); - }) + + return Task.FromResult(0); + }, + OnAuthenticationFailed = context => + { + context.HttpContext.Items["AuthenticationFailed"] = true; + //Change the request url to something different and skip Wsfed. This new url will handle the request and let us know if this notification was invoked. + context.HttpContext.Request.Path = new PathString( + "/AuthenticationFailed" + ); + context.SkipHandler(); + return Task.FromResult(0); + }, + OnRemoteSignOut = context => + { + context.Response.Headers["EventHeader"] = "OnRemoteSignOut"; + return Task.FromResult(0); + } + }; + }); + }) ) .Build(); diff --git a/aspnetcore/src/Security/Authorization/test/AuthorizationMiddlewareTests.cs b/aspnetcore/src/Security/Authorization/test/AuthorizationMiddlewareTests.cs index 1fe6a6aca93..a0143e216fa 100644 --- a/aspnetcore/src/Security/Authorization/test/AuthorizationMiddlewareTests.cs +++ b/aspnetcore/src/Security/Authorization/test/AuthorizationMiddlewareTests.cs @@ -1019,8 +1019,7 @@ public async Task IAuthenticateResultFeature_ContainsLowestExpiration() var res = AuthenticateResult.Success( new AuthenticationTicket( new ClaimsPrincipal( - c.User.Identities.FirstOrDefault( - i => i.AuthenticationType == scheme + c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme ) ), scheme @@ -1038,8 +1037,7 @@ public async Task IAuthenticateResultFeature_ContainsLowestExpiration() var res = AuthenticateResult.Success( new AuthenticationTicket( new ClaimsPrincipal( - c.User.Identities.FirstOrDefault( - i => i.AuthenticationType == scheme + c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme ) ), scheme @@ -1152,8 +1150,7 @@ public async Task IAuthenticateResultFeature_UsesExistingFeature_WithScheme() var res = AuthenticateResult.Success( new AuthenticationTicket( new ClaimsPrincipal( - c.User.Identities.FirstOrDefault( - i => i.AuthenticationType == scheme + c.User.Identities.FirstOrDefault(i => i.AuthenticationType == scheme ) ), scheme diff --git a/aspnetcore/src/Security/samples/CustomAuthorizationFailureResponse/Authorization/SampleAuthorizationMiddlewareResultHandler.cs b/aspnetcore/src/Security/samples/CustomAuthorizationFailureResponse/Authorization/SampleAuthorizationMiddlewareResultHandler.cs index 3aba07727e5..151d70433de 100644 --- a/aspnetcore/src/Security/samples/CustomAuthorizationFailureResponse/Authorization/SampleAuthorizationMiddlewareResultHandler.cs +++ b/aspnetcore/src/Security/samples/CustomAuthorizationFailureResponse/Authorization/SampleAuthorizationMiddlewareResultHandler.cs @@ -47,8 +47,8 @@ await httpContext.Response.WriteAsync( // as an example, let's return 404 if specific requirement has failed if ( - policyAuthorizationResult.AuthorizationFailure.FailedRequirements.Any( - requirement => requirement is SampleRequirement + policyAuthorizationResult.AuthorizationFailure.FailedRequirements.Any(requirement => + requirement is SampleRequirement ) ) { @@ -59,8 +59,8 @@ await httpContext.Response.WriteAsync( return; } else if ( - policyAuthorizationResult.AuthorizationFailure.FailedRequirements.Any( - requirement => requirement is SampleWithCustomMessageRequirement + policyAuthorizationResult.AuthorizationFailure.FailedRequirements.Any(requirement => + requirement is SampleWithCustomMessageRequirement ) ) { diff --git a/aspnetcore/src/Security/samples/Identity.ExternalClaims/Data/Migrations/00000000000000_CreateIdentitySchema.cs b/aspnetcore/src/Security/samples/Identity.ExternalClaims/Data/Migrations/00000000000000_CreateIdentitySchema.cs index 7bbac24c5ff..1adf5df2410 100644 --- a/aspnetcore/src/Security/samples/Identity.ExternalClaims/Data/Migrations/00000000000000_CreateIdentitySchema.cs +++ b/aspnetcore/src/Security/samples/Identity.ExternalClaims/Data/Migrations/00000000000000_CreateIdentitySchema.cs @@ -16,14 +16,13 @@ protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AspNetRoles", - columns: table => - new - { - Id = table.Column(nullable: false), - ConcurrencyStamp = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: true), - NormalizedName = table.Column(maxLength: 256, nullable: true) - }, + columns: table => new + { + Id = table.Column(nullable: false), + ConcurrencyStamp = table.Column(nullable: true), + Name = table.Column(maxLength: 256, nullable: true), + NormalizedName = table.Column(maxLength: 256, nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoles", x => x.Id); @@ -32,50 +31,47 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserTokens", - columns: table => - new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(nullable: false), - Name = table.Column(nullable: false), - Value = table.Column(nullable: true) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(nullable: false), + Name = table.Column(nullable: false), + Value = table.Column(nullable: true) + }, constraints: table => { table.PrimaryKey( "PK_AspNetUserTokens", - x => - new - { - x.UserId, - x.LoginProvider, - x.Name - } + x => new + { + x.UserId, + x.LoginProvider, + x.Name + } ); } ); migrationBuilder.CreateTable( name: "AspNetUsers", - columns: table => - new - { - Id = table.Column(nullable: false), - AccessFailedCount = table.Column(nullable: false), - ConcurrencyStamp = table.Column(nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false), - LockoutEnabled = table.Column(nullable: false), - LockoutEnd = table.Column(nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - NormalizedUserName = table.Column(maxLength: 256, nullable: true), - PasswordHash = table.Column(nullable: true), - PhoneNumber = table.Column(nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false), - SecurityStamp = table.Column(nullable: true), - TwoFactorEnabled = table.Column(nullable: false), - UserName = table.Column(maxLength: 256, nullable: true) - }, + columns: table => new + { + Id = table.Column(nullable: false), + AccessFailedCount = table.Column(nullable: false), + ConcurrencyStamp = table.Column(nullable: true), + Email = table.Column(maxLength: 256, nullable: true), + EmailConfirmed = table.Column(nullable: false), + LockoutEnabled = table.Column(nullable: false), + LockoutEnd = table.Column(nullable: true), + NormalizedEmail = table.Column(maxLength: 256, nullable: true), + NormalizedUserName = table.Column(maxLength: 256, nullable: true), + PasswordHash = table.Column(nullable: true), + PhoneNumber = table.Column(nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false), + SecurityStamp = table.Column(nullable: true), + TwoFactorEnabled = table.Column(nullable: false), + UserName = table.Column(maxLength: 256, nullable: true) + }, constraints: table => { table.PrimaryKey("PK_AspNetUsers", x => x.Id); @@ -84,19 +80,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetRoleClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true), - RoleId = table.Column(nullable: false) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true), + RoleId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id); @@ -112,19 +107,18 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserClaims", - columns: table => - new - { - Id = table - .Column(nullable: false) - .Annotation( - "SqlServer:ValueGenerationStrategy", - SqlServerValueGenerationStrategy.IdentityColumn - ), - ClaimType = table.Column(nullable: true), - ClaimValue = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, + columns: table => new + { + Id = table + .Column(nullable: false) + .Annotation( + "SqlServer:ValueGenerationStrategy", + SqlServerValueGenerationStrategy.IdentityColumn + ), + ClaimType = table.Column(nullable: true), + ClaimValue = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserClaims", x => x.Id); @@ -140,14 +134,13 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserLogins", - columns: table => - new - { - LoginProvider = table.Column(nullable: false), - ProviderKey = table.Column(nullable: false), - ProviderDisplayName = table.Column(nullable: true), - UserId = table.Column(nullable: false) - }, + columns: table => new + { + LoginProvider = table.Column(nullable: false), + ProviderKey = table.Column(nullable: false), + ProviderDisplayName = table.Column(nullable: true), + UserId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey( @@ -166,12 +159,11 @@ protected override void Up(MigrationBuilder migrationBuilder) migrationBuilder.CreateTable( name: "AspNetUserRoles", - columns: table => - new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) - }, + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false) + }, constraints: table => { table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId }); diff --git a/aspnetcore/src/Security/samples/Identity.ExternalClaims/Startup.cs b/aspnetcore/src/Security/samples/Identity.ExternalClaims/Startup.cs index 09f690a85a6..1edae442977 100644 --- a/aspnetcore/src/Security/samples/Identity.ExternalClaims/Startup.cs +++ b/aspnetcore/src/Security/samples/Identity.ExternalClaims/Startup.cs @@ -33,11 +33,10 @@ public Startup(IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddDbContext( - options => - options.UseSqlServer( - "Server=(localdb)\\mssqllocaldb;Database=aspnet-Identity.ExternalClaims-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" - ) + services.AddDbContext(options => + options.UseSqlServer( + "Server=(localdb)\\mssqllocaldb;Database=aspnet-Identity.ExternalClaims-53bc9b9d-9d6a-45d4-8429-2a2761773502;Trusted_Connection=True;MultipleActiveResultSets=true" + ) ); services diff --git a/aspnetcore/src/Servers/HttpSys/src/WebHostBuilderHttpSysExtensions.cs b/aspnetcore/src/Servers/HttpSys/src/WebHostBuilderHttpSysExtensions.cs index 482eb76de2c..dbbd0b0a23a 100644 --- a/aspnetcore/src/Servers/HttpSys/src/WebHostBuilderHttpSysExtensions.cs +++ b/aspnetcore/src/Servers/HttpSys/src/WebHostBuilderHttpSysExtensions.cs @@ -32,8 +32,8 @@ public static IWebHostBuilder UseHttpSys(this IWebHostBuilder hostBuilder) services.AddSingleton(services => services.GetRequiredService()); if (HttpApi.SupportsDelegation) { - services.AddSingleton( - services => services.GetRequiredService() + services.AddSingleton(services => + services.GetRequiredService() ); } services.AddTransient(); diff --git a/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs b/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs index c0d5bad8c5b..725cc16d284 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/GlobalVersionTests.cs @@ -249,14 +249,13 @@ private static void CopyShimToOutput(IISDeploymentParameters parameters) var moduleNodes = config .DescendantNodesAndSelf() .OfType() - .Where( - element => - element.Name == "add" - && element - .Attribute("name") - ?.Value - .StartsWith("AspNetCoreModule", StringComparison.Ordinal) == true - && element.Attribute("image") != null + .Where(element => + element.Name == "add" + && element + .Attribute("name") + ?.Value + .StartsWith("AspNetCoreModule", StringComparison.Ordinal) == true + && element.Attribute("image") != null ); var sourceDirectory = new DirectoryInfo( diff --git a/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs b/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs index 2748f19a218..4dfc34c6c50 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/Common.FunctionalTests/LoggingTests.cs @@ -365,14 +365,11 @@ public async Task LogsContainTimestampAndPID() StopServer(); - var aspnetcorev2Log = TestSink.Writes.First( - w => w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:") + var aspnetcorev2Log = TestSink.Writes.First(w => + w.Message.Contains("Description: IIS ASP.NET Core Module V2. Commit:") ); - var aspnetcoreHandlerLog = TestSink.Writes.First( - w => - w.Message.Contains( - "Description: IIS ASP.NET Core Module V2 Request Handler. Commit:" - ) + var aspnetcoreHandlerLog = TestSink.Writes.First(w => + w.Message.Contains("Description: IIS ASP.NET Core Module V2 Request Handler. Commit:") ); var processIdPattern = new Regex("Process Id: (\\d+)\\.", RegexOptions.Singleline); diff --git a/aspnetcore/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs b/aspnetcore/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs index 354ea096344..99bbc696c6d 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs @@ -532,13 +532,12 @@ public async Task OutOfProcessToInProcessHostingModelSwitchWorks() await deploymentResult.AssertStarts(); - deploymentResult.ModifyWebConfig( - element => - element - .Descendants("system.webServer") - .Single() - .GetOrAdd("aspNetCore") - .SetAttributeValue("hostingModel", "inprocess") + deploymentResult.ModifyWebConfig(element => + element + .Descendants("system.webServer") + .Single() + .GetOrAdd("aspNetCore") + .SetAttributeValue("hostingModel", "inprocess") ); // Have to retry here to allow ANCM to receive notification and react to it diff --git a/aspnetcore/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs b/aspnetcore/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs index 836bf617fee..3e6507d88f4 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/IISExpress.FunctionalTests/UpgradeFeatureDetectionTests.cs @@ -75,9 +75,8 @@ HostingModel hostingModel if (disableWebSocket) { // For IIS, we need to modify the apphost.config file - deploymentParameters.AddServerConfigAction( - element => - element.Descendants("webSocket").Single().SetAttributeValue("enabled", "false") + deploymentParameters.AddServerConfigAction(element => + element.Descendants("webSocket").Single().SetAttributeValue("enabled", "false") ); } diff --git a/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs b/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs index 18e33d71037..e7116dd2bac 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.WebSockets.cs @@ -60,10 +60,13 @@ private void WebSocketEcho(IApplicationBuilder app) var ws = await Upgrade(context); #if FORWARDCOMPAT var appLifetime = - app.ApplicationServices.GetRequiredService(); + app.ApplicationServices.GetRequiredService( + + ); #else - var appLifetime = - app.ApplicationServices.GetRequiredService(); + var appLifetime = app.ApplicationServices.GetRequiredService( + + ); #endif await Echo(ws, appLifetime.ApplicationStopping); diff --git a/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.cs b/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.cs index 45db9e51303..b7f1f3ff1d9 100644 --- a/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.cs +++ b/aspnetcore/src/Servers/IIS/IIS/test/testassets/InProcessWebSite/Startup.cs @@ -57,12 +57,16 @@ public void ConfigureServices(IServiceCollection serviceCollection) #if FORWARDCOMPAT private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync( - ctx.RequestServices.GetService().ContentRootPath + ctx.RequestServices.GetService( + + ).ContentRootPath ); private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync( - ctx.RequestServices.GetService().WebRootPath + ctx.RequestServices.GetService( + + ).WebRootPath ); #else private async Task ContentRootPath(HttpContext ctx) => diff --git a/aspnetcore/src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs b/aspnetcore/src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs index d36dbc53e66..9b732a644a2 100644 --- a/aspnetcore/src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs +++ b/aspnetcore/src/Servers/Kestrel/Core/src/Internal/Http3/Http3ControlStream.cs @@ -49,8 +49,9 @@ public Http3ControlStream(Http3StreamContext context, long? headerType) _context = context; _serverPeerSettings = context.ServerPeerSettings; _streamIdFeature = context.ConnectionFeatures.GetRequiredFeature(); - _streamClosedFeature = - context.ConnectionFeatures.GetRequiredFeature(); + _streamClosedFeature = context.ConnectionFeatures.GetRequiredFeature( + + ); _errorCodeFeature = context.ConnectionFeatures.GetRequiredFeature(); _headerType = headerType ?? -1; diff --git a/aspnetcore/src/Servers/Kestrel/Core/src/Middleware/ListenOptionsConnectionLoggingExtensions.cs b/aspnetcore/src/Servers/Kestrel/Core/src/Middleware/ListenOptionsConnectionLoggingExtensions.cs index f91d323bd00..d0f745ac70d 100644 --- a/aspnetcore/src/Servers/Kestrel/Core/src/Middleware/ListenOptionsConnectionLoggingExtensions.cs +++ b/aspnetcore/src/Servers/Kestrel/Core/src/Middleware/ListenOptionsConnectionLoggingExtensions.cs @@ -37,7 +37,9 @@ public static ListenOptions UseConnectionLogging( ) { var loggerFactory = - listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService(); + listenOptions.KestrelServerOptions.ApplicationServices.GetRequiredService( + + ); var logger = loggerName == null ? loggerFactory.CreateLogger() @@ -46,8 +48,8 @@ public static ListenOptions UseConnectionLogging( listenOptions.Use(next => new LoggingConnectionMiddleware(next, logger).OnConnectionAsync); IMultiplexedConnectionBuilder multiplexedConnectionBuilder = listenOptions; - multiplexedConnectionBuilder.Use( - next => new LoggingMultiplexedConnectionMiddleware(next, logger).OnConnectionAsync + multiplexedConnectionBuilder.Use(next => + new LoggingMultiplexedConnectionMiddleware(next, logger).OnConnectionAsync ); return listenOptions; diff --git a/aspnetcore/src/Servers/Kestrel/Core/test/Http1/Http1ConnectionTests.cs b/aspnetcore/src/Servers/Kestrel/Core/test/Http1/Http1ConnectionTests.cs index 454f7e27da1..c96470bea40 100644 --- a/aspnetcore/src/Servers/Kestrel/Core/test/Http1/Http1ConnectionTests.cs +++ b/aspnetcore/src/Servers/Kestrel/Core/test/Http1/Http1ConnectionTests.cs @@ -511,12 +511,11 @@ public async Task ParseRequestStartsRequestHeadersTimeoutOnFirstByteAvailable() ParseRequest((await _transport.Input.ReadAsync()).Buffer, out _consumed, out _examined); _transport.Input.AdvanceTo(_consumed, _examined); - _timeoutControl.Verify( - cc => - cc.ResetTimeout( - _serviceContext.ServerOptions.Limits.RequestHeadersTimeout, - TimeoutReason.RequestHeaders - ) + _timeoutControl.Verify(cc => + cc.ResetTimeout( + _serviceContext.ServerOptions.Limits.RequestHeadersTimeout, + TimeoutReason.RequestHeaders + ) ); } @@ -666,8 +665,8 @@ public async Task ProcessRequestsAsyncEnablesKeepAliveTimeout() var requestProcessingTask = _http1Connection.ProcessRequestsAsync(null); var expectedKeepAliveTimeout = _serviceContext.ServerOptions.Limits.KeepAliveTimeout; - _timeoutControl.Verify( - cc => cc.SetTimeout(expectedKeepAliveTimeout, TimeoutReason.KeepAlive) + _timeoutControl.Verify(cc => + cc.SetTimeout(expectedKeepAliveTimeout, TimeoutReason.KeepAlive) ); _http1Connection.StopProcessingNextRequest(); diff --git a/aspnetcore/src/Servers/Kestrel/Core/test/KestrelServerTests.cs b/aspnetcore/src/Servers/Kestrel/Core/test/KestrelServerTests.cs index e5d3116069c..d12913692ff 100644 --- a/aspnetcore/src/Servers/Kestrel/Core/test/KestrelServerTests.cs +++ b/aspnetcore/src/Servers/Kestrel/Core/test/KestrelServerTests.cs @@ -303,8 +303,8 @@ public void LoggerCategoryNameIsKestrelServerNamespace() new MockTransportFactory(), mockLoggerFactory.Object ); - mockLoggerFactory.Verify( - factory => factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel") + mockLoggerFactory.Verify(factory => + factory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel") ); } @@ -681,9 +681,8 @@ public async Task StopAsyncCallsCompleteWhenFirstCallCompletes() var mockTransport = new Mock(); var mockTransportFactory = new Mock(); mockTransportFactory - .Setup( - transportFactory => - transportFactory.BindAsync(It.IsAny(), It.IsAny()) + .Setup(transportFactory => + transportFactory.BindAsync(It.IsAny(), It.IsAny()) ) .Returns( (e, token) => @@ -746,9 +745,8 @@ public async Task StopAsyncCallsCompleteWithThrownException() var mockTransport = new Mock(); var mockTransportFactory = new Mock(); mockTransportFactory - .Setup( - transportFactory => - transportFactory.BindAsync(It.IsAny(), It.IsAny()) + .Setup(transportFactory => + transportFactory.BindAsync(It.IsAny(), It.IsAny()) ) .Returns( (e, token) => @@ -830,9 +828,8 @@ public async Task StopAsyncDispatchesSubsequentStopAsyncContinuations() var mockTransport = new Mock(); var mockTransportFactory = new Mock(); mockTransportFactory - .Setup( - transportFactory => - transportFactory.BindAsync(It.IsAny(), It.IsAny()) + .Setup(transportFactory => + transportFactory.BindAsync(It.IsAny(), It.IsAny()) ) .Returns( (e, token) => @@ -1001,9 +998,8 @@ public async Task ReloadsOnConfigurationChangeWhenOptedIn() var mockTransports = new List>(); var mockTransportFactory = new Mock(); mockTransportFactory - .Setup( - transportFactory => - transportFactory.BindAsync(It.IsAny(), It.IsAny()) + .Setup(transportFactory => + transportFactory.BindAsync(It.IsAny(), It.IsAny()) ) .Returns( (e, token) => @@ -1216,9 +1212,8 @@ public async Task DoesNotReloadOnConfigurationChangeByDefault() var mockTransports = new List>(); var mockTransportFactory = new Mock(); mockTransportFactory - .Setup( - transportFactory => - transportFactory.BindAsync(It.IsAny(), It.IsAny()) + .Setup(transportFactory => + transportFactory.BindAsync(It.IsAny(), It.IsAny()) ) .Returns( (e, token) => diff --git a/aspnetcore/src/Servers/Kestrel/shared/CorrelationIdGenerator.cs b/aspnetcore/src/Servers/Kestrel/shared/CorrelationIdGenerator.cs index 2b7c1f72205..b002a2136ac 100644 --- a/aspnetcore/src/Servers/Kestrel/shared/CorrelationIdGenerator.cs +++ b/aspnetcore/src/Servers/Kestrel/shared/CorrelationIdGenerator.cs @@ -6,8 +6,9 @@ namespace Microsoft.AspNetCore.Connections; internal static class CorrelationIdGenerator { // Base32 encoding - in ascii sort order for easy text based sorting - private static readonly char[] s_encode32Chars = - "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray(); + private static readonly char[] s_encode32Chars = "0123456789ABCDEFGHIJKLMNOPQRSTUV".ToCharArray( + + ); // Seed the _lastConnectionId for this application instance with // the number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001 diff --git a/aspnetcore/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs b/aspnetcore/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs index 9f1e8b22fb1..0406842a9a1 100644 --- a/aspnetcore/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/BindTests/AddressRegistrationTests.cs @@ -221,8 +221,8 @@ private async Task RegisterAddresses_Success( host.Start(); foreach ( - var testUrl in testUrls.Select( - testUrl => $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" + var testUrl in testUrls.Select(testUrl => + $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" ) ) { @@ -252,8 +252,8 @@ private Task RegisterAddresses_Success(string addressInput, string testUrl, int RegisterAddresses_Success(addressInput, new[] { testUrl }, testPort); private Task RegisterAddresses_StaticPort_Success(string addressInput, string[] testUrls) => - RunTestWithStaticPort( - port => RegisterAddresses_Success($"{addressInput}:{port}", testUrls, port) + RunTestWithStaticPort(port => + RegisterAddresses_Success($"{addressInput}:{port}", testUrls, port) ); [Fact] @@ -388,8 +388,8 @@ private async Task RegisterIPEndPoint_Success( } private Task RegisterIPEndPoint_StaticPort_Success(IPAddress address, string testUrl) => - RunTestWithStaticPort( - port => RegisterIPEndPoint_Success(new IPEndPoint(address, port), testUrl, port) + RunTestWithStaticPort(port => + RegisterIPEndPoint_Success(new IPEndPoint(address, port), testUrl, port) ); [Fact] @@ -434,8 +434,8 @@ private async Task ListenAnyIP_Success(string[] testUrls, int testPort = 0) await host.StartAsync(); foreach ( - var testUrl in testUrls.Select( - testUrl => $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" + var testUrl in testUrls.Select(testUrl => + $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" ) ) { @@ -491,8 +491,8 @@ private async Task ListenLocalhost_Success(string[] testUrls, int testPort = 0) await host.StartAsync(); foreach ( - var testUrl in testUrls.Select( - testUrl => $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" + var testUrl in testUrls.Select(testUrl => + $"{testUrl}:{(testPort == 0 ? host.GetPort() : testPort)}" ) ) { @@ -658,11 +658,10 @@ public async Task ThrowsWhenBindingToIPv4AddressInUse() Assert.Equal(expectedMessage, exception.Message); Assert.Equal( 0, - LogMessages.Count( - log => - log.LogLevel == LogLevel.Critical - && log.Exception is null - && log.Message.EndsWith(expectedMessage, StringComparison.Ordinal) + LogMessages.Count(log => + log.LogLevel == LogLevel.Critical + && log.Exception is null + && log.Message.EndsWith(expectedMessage, StringComparison.Ordinal) ) ); await host.StopAsync(); @@ -708,11 +707,10 @@ public async Task ThrowsWhenBindingToIPv6AddressInUse() Assert.Equal(expectedMessage, exception.Message); Assert.Equal( 0, - LogMessages.Count( - log => - log.LogLevel == LogLevel.Critical - && log.Exception is null - && log.Message.EndsWith(expectedMessage, StringComparison.Ordinal) + LogMessages.Count(log => + log.LogLevel == LogLevel.Critical + && log.Exception is null + && log.Message.EndsWith(expectedMessage, StringComparison.Ordinal) ) ); @@ -1201,14 +1199,13 @@ private void ThrowsWhenBindingLocalhostToAddressInUse(AddressFamily addressFamil ); Assert.Equal( 0, - LogMessages.Count( - log => - log.LogLevel == LogLevel.Critical - && log.Exception is null - && log.Message.EndsWith( - CoreStrings.FormatEndpointAlreadyInUse(thisAddressString), - StringComparison.Ordinal - ) + LogMessages.Count(log => + log.LogLevel == LogLevel.Critical + && log.Exception is null + && log.Message.EndsWith( + CoreStrings.FormatEndpointAlreadyInUse(thisAddressString), + StringComparison.Ordinal + ) ) ); break; diff --git a/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/MaxRequestBufferSizeTests.cs b/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/MaxRequestBufferSizeTests.cs index cba32d0c58c..17e93411cd3 100644 --- a/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/MaxRequestBufferSizeTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/MaxRequestBufferSizeTests.cs @@ -382,42 +382,41 @@ private async Task StartHost( options.Limits.MaxRequestBodySize = _dataLength; }) .UseContentRoot(Directory.GetCurrentDirectory()) - .Configure( - app => - app.Run(async context => + .Configure(app => + app.Run(async context => + { + await startReadingRequestBody.Task.TimeoutAfter( + TimeSpan.FromSeconds(120) + ); + + var buffer = new byte[expectedBody.Length]; + var bytesRead = 0; + while (bytesRead < buffer.Length) { - await startReadingRequestBody.Task.TimeoutAfter( - TimeSpan.FromSeconds(120) + bytesRead += await context.Request.Body.ReadAsync( + buffer, + bytesRead, + buffer.Length - bytesRead ); + } - var buffer = new byte[expectedBody.Length]; - var bytesRead = 0; - while (bytesRead < buffer.Length) - { - bytesRead += await context.Request.Body.ReadAsync( - buffer, - bytesRead, - buffer.Length - bytesRead - ); - } + await clientFinishedSendingRequestBody.Task.TimeoutAfter( + TimeSpan.FromSeconds(120) + ); - await clientFinishedSendingRequestBody.Task.TimeoutAfter( - TimeSpan.FromSeconds(120) + // Verify client didn't send extra bytes + if (await context.Request.Body.ReadAsync(new byte[1], 0, 1) != 0) + { + context.Response.StatusCode = + StatusCodes.Status500InternalServerError; + await context.Response.WriteAsync( + "Client sent more bytes than expectedBody.Length" ); + return; + } - // Verify client didn't send extra bytes - if (await context.Request.Body.ReadAsync(new byte[1], 0, 1) != 0) - { - context.Response.StatusCode = - StatusCodes.Status500InternalServerError; - await context.Response.WriteAsync( - "Client sent more bytes than expectedBody.Length" - ); - return; - } - - await context.Response.WriteAsync($"bytesRead: {bytesRead}"); - }) + await context.Response.WriteAsync($"bytesRead: {bytesRead}"); + }) ); }) .ConfigureServices(AddTestLogging) diff --git a/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs b/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs index cc6a040b03b..5477af41b27 100644 --- a/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs @@ -457,13 +457,12 @@ await context.Response.Body.WriteAsync( // After the RequestAborted token is tripped, the connection reset should be logged. // On Linux and macOS, the connection close is still sometimes observed as a FIN despite the LingerState. - var presShutdownTransportLogs = TestSink.Writes.Where( - w => w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" + var presShutdownTransportLogs = TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" ); - var connectionResetLogs = presShutdownTransportLogs.Where( - w => - w.EventId == connectionResetEventId - || (!TestPlatformHelper.IsWindows && w.EventId == connectionFinEventId) + var connectionResetLogs = presShutdownTransportLogs.Where(w => + w.EventId == connectionResetEventId + || (!TestPlatformHelper.IsWindows && w.EventId == connectionFinEventId) ); Assert.NotEmpty(connectionResetLogs); @@ -472,15 +471,14 @@ await context.Response.Body.WriteAsync( await appCompletedTcs.Task.DefaultTimeout(); } - var coreLogs = TestSink.Writes.Where( - w => w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Connections" + var coreLogs = TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Connections" ); Assert.Single(coreLogs.Where(w => w.EventId == connectionStopEventId)); - var transportLogs = TestSink.Writes.Where( - w => - w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel" - || w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" + var transportLogs = TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel" + || w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" ); Assert.Empty(transportLogs.Where(w => w.LogLevel > LogLevel.Debug)); @@ -517,14 +515,14 @@ ListenOptions listenOptions } } - var transportLogs = TestSink.Writes.Where( - w => w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" + var transportLogs = TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" ); // The "Microsoft.AspNetCore.Server.Kestrel" logger may contain info level logs because resetting the connection can cause // partial headers to be read leading to a bad request. - var coreLogs = TestSink.Writes.Where( - w => w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel" + var coreLogs = TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.Server.Kestrel" ); Assert.Empty(transportLogs.Where(w => w.LogLevel > LogLevel.Debug)); diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionMiddlewareTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionMiddlewareTests.cs index 5368b5d49b3..0aadc1b47fe 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionMiddlewareTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/ConnectionMiddlewareTests.cs @@ -73,8 +73,7 @@ public async Task CanReadAndWriteWithAsyncConnectionMiddleware(RequestDelegate r listenOptions => { listenOptions.UseConnectionLogging(); - listenOptions.Use( - next => new AsyncConnectionMiddleware(next).OnConnectionAsync + listenOptions.Use(next => new AsyncConnectionMiddleware(next).OnConnectionAsync ); listenOptions.UseConnectionLogging(); } @@ -244,13 +243,12 @@ RequestDelegate requestDelegate { var connectionId = ""; var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)); - listenOptions.Use( - next => - context => - { - connectionId = context.ConnectionId; - throw new InvalidOperationException(); - } + listenOptions.Use(next => + context => + { + connectionId = context.ConnectionId; + throw new InvalidOperationException(); + } ); var serviceContext = new TestServiceContext(LoggerFactory); @@ -274,9 +272,9 @@ RequestDelegate requestDelegate [Fact] public async Task CanFlushAsyncWithConnectionMiddleware() { - var listenOptions = new ListenOptions( - new IPEndPoint(IPAddress.Loopback, 0) - ).UsePassThrough(); + var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)).UsePassThrough( + + ); var serviceContext = new TestServiceContext(LoggerFactory); @@ -310,9 +308,9 @@ await connection.ReceiveEnd( [Fact] public async Task CanFlushAsyncWithConnectionMiddlewarePipeWriter() { - var listenOptions = new ListenOptions( - new IPEndPoint(IPAddress.Loopback, 0) - ).UsePassThrough(); + var listenOptions = new ListenOptions(new IPEndPoint(IPAddress.Loopback, 0)).UsePassThrough( + + ); var serviceContext = new TestServiceContext(LoggerFactory); diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs index bfd9216d9a0..e6fd91a6329 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2TimeoutTests.cs @@ -240,8 +240,8 @@ public async Task HEADERS_ReceivedWithoutAllCONTINUATIONs_WithinRequestHeadersTi _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestHeadersTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestHeadersTimeout ) ), Times.Once @@ -282,10 +282,9 @@ public async Task ResponseDrain_SlowerThanMinimumDataRate_AbortsConnection() _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -469,10 +468,9 @@ await ExpectAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -543,10 +541,9 @@ await ExpectAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -612,10 +609,9 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -682,10 +678,9 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -768,10 +763,9 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => - e.Message - == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied + It.Is(e => + e.Message + == CoreStrings.ConnectionTimedBecauseResponseMininumDataRateNotSatisfied ) ), Times.Once @@ -832,8 +826,8 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestBodyTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestBodyTimeout ) ), Times.Once @@ -896,8 +890,8 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestBodyTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestBodyTimeout ) ), Times.Once @@ -980,8 +974,8 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestBodyTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestBodyTimeout ) ), Times.Once @@ -1067,8 +1061,8 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestBodyTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestBodyTimeout ) ), Times.Once @@ -1246,8 +1240,8 @@ await WaitForConnectionErrorAsync( _mockConnectionContext.Verify( c => c.Abort( - It.Is( - e => e.Message == CoreStrings.BadRequest_RequestBodyTimeout + It.Is(e => + e.Message == CoreStrings.BadRequest_RequestBodyTimeout ) ), Times.Once diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs index b37be42947f..8e5dd337bb8 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/Http3ConnectionTests.cs @@ -351,7 +351,9 @@ public async Task GOAWAY_TriggersLifetimeNotification_ConnectionClosedRequested( var controlStream = await Http3Api.CreateControlStream(id: 0); await controlStream.SendSettingsAsync(new List()); var lifetime = - Http3Api.MultiplexedConnectionContext.Features.Get(); + Http3Api.MultiplexedConnectionContext.Features.Get( + + ); lifetime.ConnectionClosedRequested.Register(() => completionSource.TrySetResult()); Assert.False(lifetime.ConnectionClosedRequested.IsCancellationRequested); diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/WebTransport/WebTransportHandshakeTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/WebTransport/WebTransportHandshakeTests.cs index 0f99f956a18..72105c21b73 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/WebTransport/WebTransportHandshakeTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http3/WebTransport/WebTransportHandshakeTests.cs @@ -30,8 +30,9 @@ await Http3Api.InitializeConnectionAsync(async context => var success = true; #pragma warning disable CA2252 // WebTransport is a preview feature - var webTransportFeature = - context.Features.GetRequiredFeature(); + var webTransportFeature = context.Features.GetRequiredFeature( + + ); success &= webTransportFeature.IsWebTransportRequest; diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/MaxRequestBodySizeTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/MaxRequestBodySizeTests.cs index 976316c9d7a..42f8a21073b 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/MaxRequestBodySizeTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/MaxRequestBodySizeTests.cs @@ -505,8 +505,8 @@ public async Task ChunkFramingAndExtensionsCountTowardsRequestBodySize() { var buffer = new byte[11]; #pragma warning disable CS0618 // Type or member is obsolete - requestRejectedEx = - await Assert.ThrowsAsync(async () => + requestRejectedEx = await Assert.ThrowsAsync( + async () => #pragma warning restore CS0618 // Type or member is obsolete { var count = 0; @@ -514,7 +514,8 @@ await Assert.ThrowsAsync(async () => { count = await context.Request.Body.ReadAsync(buffer, 0, 11); } while (count != 0); - }); + } + ); throw requestRejectedEx; }, @@ -639,15 +640,16 @@ public async Task PerRequestMaxRequestBodySizeGetsReset() else { #pragma warning disable CS0618 // Type or member is obsolete - requestRejectedEx = - await Assert.ThrowsAsync(async () => + requestRejectedEx = await Assert.ThrowsAsync( + async () => #pragma warning restore CS0618 // Type or member is obsolete { do { count = await context.Request.Body.ReadAsync(buffer, 0, 11); } while (count != 0); - }); + } + ); throw requestRejectedEx; } diff --git a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs index 5d1d9cbc0fd..fb7d1b6e22a 100644 --- a/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs +++ b/aspnetcore/src/Servers/Kestrel/test/InMemory.FunctionalTests/RequestTests.cs @@ -110,9 +110,8 @@ public async Task RequestBodyPipeReaderDoesZeroByteReads() mockStream.Setup(s => s.CanRead).Returns(true); mockStream - .Setup( - s => - s.ReadAsync(It.IsAny>(), It.IsAny()) + .Setup(s => + s.ReadAsync(It.IsAny>(), It.IsAny()) ) .Returns, CancellationToken>( (buffer, token) => diff --git a/aspnetcore/src/Shared/PropertyAsParameterInfo.cs b/aspnetcore/src/Shared/PropertyAsParameterInfo.cs index 0455e30d925..a3ca2ab5eb8 100644 --- a/aspnetcore/src/Shared/PropertyAsParameterInfo.cs +++ b/aspnetcore/src/Shared/PropertyAsParameterInfo.cs @@ -92,8 +92,8 @@ ParameterBindingMethodCache cache } if ( - parameters[i].CustomAttributes.Any( - a => a.AttributeType == typeof(AsParametersAttribute) + parameters[i].CustomAttributes.Any(a => + a.AttributeType == typeof(AsParametersAttribute) ) ) { diff --git a/aspnetcore/src/Shared/ResultsTests/VirtualFileResultTestBase.cs b/aspnetcore/src/Shared/ResultsTests/VirtualFileResultTestBase.cs index 8a635006021..cb0d365076d 100644 --- a/aspnetcore/src/Shared/ResultsTests/VirtualFileResultTestBase.cs +++ b/aspnetcore/src/Shared/ResultsTests/VirtualFileResultTestBase.cs @@ -505,8 +505,8 @@ private static IServiceCollection CreateServices(IFileProvider webRootFileProvid { var services = new ServiceCollection(); - var hostingEnvironment = Mock.Of( - e => e.WebRootFileProvider == webRootFileProvider + var hostingEnvironment = Mock.Of(e => + e.WebRootFileProvider == webRootFileProvider ); services.AddSingleton(hostingEnvironment); diff --git a/aspnetcore/src/Shared/RoslynUtils/SymbolExtensions.cs b/aspnetcore/src/Shared/RoslynUtils/SymbolExtensions.cs index 53c13cedfe0..0127635d923 100644 --- a/aspnetcore/src/Shared/RoslynUtils/SymbolExtensions.cs +++ b/aspnetcore/src/Shared/RoslynUtils/SymbolExtensions.cs @@ -262,8 +262,8 @@ public static string GetParameterInfoFromConstructorCode(this IParameterSymbol p if (parameterSymbol is { ContainingSymbol: IMethodSymbol constructor }) { var constructedType = $"typeof({parameterSymbol.ContainingType.ToDisplayString()})"; - var parameterTypes = constructor.Parameters.Select( - parameter => $"typeof({parameter.Type.ToDisplayString()})" + var parameterTypes = constructor.Parameters.Select(parameter => + $"typeof({parameter.Type.ToDisplayString()})" ); var parameterTypesString = string.Join(", ", parameterTypes); var getConstructorParameters = $$"""new[] { {{parameterTypesString}} }"""; diff --git a/aspnetcore/src/Shared/SignalR/InProcessTestServer.cs b/aspnetcore/src/Shared/SignalR/InProcessTestServer.cs index 7d404c48976..da9e43291a6 100644 --- a/aspnetcore/src/Shared/SignalR/InProcessTestServer.cs +++ b/aspnetcore/src/Shared/SignalR/InProcessTestServer.cs @@ -113,11 +113,10 @@ private async Task StartServerInner() .ConfigureWebHost(webHostBuilder => { webHostBuilder - .ConfigureLogging( - builder => - builder - .SetMinimumLevel(LogLevel.Trace) - .AddProvider(new ForwardingLoggerProvider(_loggerFactory)) + .ConfigureLogging(builder => + builder + .SetMinimumLevel(LogLevel.Trace) + .AddProvider(new ForwardingLoggerProvider(_loggerFactory)) ) .UseStartup(typeof(TStartup)) .UseKestrel(o => _configureKestrelServerOptions?.Invoke(o)) diff --git a/aspnetcore/src/SignalR/clients/csharp/Client.Core/src/HubConnectionBuilderExtensions.cs b/aspnetcore/src/SignalR/clients/csharp/Client.Core/src/HubConnectionBuilderExtensions.cs index 65229abca42..52e88264360 100644 --- a/aspnetcore/src/SignalR/clients/csharp/Client.Core/src/HubConnectionBuilderExtensions.cs +++ b/aspnetcore/src/SignalR/clients/csharp/Client.Core/src/HubConnectionBuilderExtensions.cs @@ -88,8 +88,7 @@ public static IHubConnectionBuilder WithServerTimeout( TimeSpan timeout ) { - hubConnectionBuilder.Services.Configure( - o => o.ServerTimeout = timeout + hubConnectionBuilder.Services.Configure(o => o.ServerTimeout = timeout ); return hubConnectionBuilder; } @@ -105,8 +104,8 @@ public static IHubConnectionBuilder WithKeepAliveInterval( TimeSpan interval ) { - hubConnectionBuilder.Services.Configure( - o => o.KeepAliveInterval = interval + hubConnectionBuilder.Services.Configure(o => + o.KeepAliveInterval = interval ); return hubConnectionBuilder; } diff --git a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.ConnectionLifecycle.cs b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.ConnectionLifecycle.cs index d3501469fbd..c5a3c085928 100644 --- a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.ConnectionLifecycle.cs +++ b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.ConnectionLifecycle.cs @@ -330,8 +330,8 @@ bool ExpectedErrors(WriteContext writeContext) }); return longPollResult.Task; }); - httpHandler.OnLongPollDelete( - cancellationToken => ResponseUtils.CreateResponse(HttpStatusCode.NoContent) + httpHandler.OnLongPollDelete(cancellationToken => + ResponseUtils.CreateResponse(HttpStatusCode.NoContent) ); httpHandler.OnSocketSend( diff --git a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Transport.cs b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Transport.cs index 21c8a8934b7..edf97e9e0fb 100644 --- a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Transport.cs +++ b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HttpConnectionTests.Transport.cs @@ -133,8 +133,9 @@ await WithConnectionAsync( { await connection.StartAsync().DefaultTimeout(); - var feature = - connection.Features.Get(); + var feature = connection.Features.Get( + + ); Assert.NotNull(feature); Assert.Equal(expectedValue, feature.HasInherentKeepAlive); } @@ -170,7 +171,9 @@ public async Task HttpConnectionSetsUserAgentOnAllRequests(HttpTransportType tra // user agent version should come from version embedded in assembly metadata var assemblyVersion = - typeof(Constants).Assembly.GetCustomAttribute(); + typeof(Constants).Assembly.GetCustomAttribute( + + ); Assert.Contains(assemblyVersion.InformationalVersion, userAgentHeader); diff --git a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubConnectionTests.ConnectionLifecycle.cs b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubConnectionTests.ConnectionLifecycle.cs index 54817341a99..b05b8d8d7ad 100644 --- a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubConnectionTests.ConnectionLifecycle.cs +++ b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubConnectionTests.ConnectionLifecycle.cs @@ -717,8 +717,8 @@ public async Task HubConnectionClosesWithErrorIfTerminatedWithPartialMessage() var builder = new HubConnectionBuilder().WithUrl("http://example.com"); var innerConnection = new TestConnection(); - var delegateConnectionFactory = new DelegateConnectionFactory( - endPoint => innerConnection.StartAsync() + var delegateConnectionFactory = new DelegateConnectionFactory(endPoint => + innerConnection.StartAsync() ); builder.Services.AddSingleton(delegateConnectionFactory); diff --git a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubServerProxyGeneratorTests.cs b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubServerProxyGeneratorTests.cs index a77989057ac..90d0e569f35 100644 --- a/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubServerProxyGeneratorTests.cs +++ b/aspnetcore/src/SignalR/clients/csharp/Client/test/UnitTests/HubServerProxyGeneratorTests.cs @@ -61,14 +61,13 @@ public async Task GetNothing() // Arrange var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.GetNothing), - typeof(object), - Array.Empty(), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.GetNothing), + typeof(object), + Array.Empty(), + default + ) ) .Returns(Task.FromResult(default(object))); var conn = mockConn.Object; @@ -87,14 +86,13 @@ public async Task GetScalar() // Arrange var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.GetScalar), - typeof(int), - Array.Empty(), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.GetScalar), + typeof(int), + Array.Empty(), + default + ) ) .Returns(Task.FromResult((object)10)); var conn = mockConn.Object; @@ -114,14 +112,13 @@ public async Task GetCollection() // Arrange var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.GetCollection), - typeof(List), - Array.Empty(), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.GetCollection), + typeof(List), + Array.Empty(), + default + ) ) .Returns(Task.FromResult((object)new List { 10 })); var conn = mockConn.Object; @@ -144,14 +141,13 @@ public async Task SetScalar() // Arrange var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.SetScalar), - typeof(int), - It.Is(y => ((object[])y).Any(z => (int)z == 20)), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.SetScalar), + typeof(int), + It.Is(y => ((object[])y).Any(z => (int)z == 20)), + default + ) ) .Returns(Task.FromResult((object)10)); var conn = mockConn.Object; @@ -172,14 +168,13 @@ public async Task SetCollection() var arg = new List() { 20 }; var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.SetCollection), - typeof(List), - It.Is(y => ((object[])y).Any(z => (List)z == arg)), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.SetCollection), + typeof(List), + It.Is(y => ((object[])y).Any(z => (List)z == arg)), + default + ) ) .Returns(Task.FromResult((object)new List { 10 })); var conn = mockConn.Object; @@ -205,35 +200,32 @@ public async Task StreamToClient() var token = cts.Token; var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.StreamAsChannelCoreAsync( - nameof(IMyHub.StreamToClientViaChannel), - typeof(int), - Array.Empty(), - default - ) + .Setup(x => + x.StreamAsChannelCoreAsync( + nameof(IMyHub.StreamToClientViaChannel), + typeof(int), + Array.Empty(), + default + ) ) .Returns(Task.FromResult(channel.Reader)); mockConn - .Setup( - x => - x.StreamAsChannelCoreAsync( - nameof(IMyHub.StreamToClientViaChannelWithToken), - typeof(int), - Array.Empty(), - token - ) + .Setup(x => + x.StreamAsChannelCoreAsync( + nameof(IMyHub.StreamToClientViaChannelWithToken), + typeof(int), + Array.Empty(), + token + ) ) .Returns(Task.FromResult(channel.Reader)); mockConn - .Setup( - x => - x.StreamAsyncCore( - nameof(IMyHub.StreamToClientViaEnumerableWithToken), - Array.Empty(), - token - ) + .Setup(x => + x.StreamAsyncCore( + nameof(IMyHub.StreamToClientViaEnumerableWithToken), + Array.Empty(), + token + ) ) .Returns(asyncEnumerable); var conn = mockConn.Object; @@ -258,40 +250,37 @@ public async Task StreamFromClient() var asyncEnumerable = channelForEnumerable.Reader.ReadAllAsync(); var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.SendCoreAsync( - nameof(IMyHub.StreamFromClientViaChannel), - It.Is( - y => ((object[])y).Any(z => (ChannelReader)z == channelReader) - ), - default - ) + .Setup(x => + x.SendCoreAsync( + nameof(IMyHub.StreamFromClientViaChannel), + It.Is(y => + ((object[])y).Any(z => (ChannelReader)z == channelReader) + ), + default + ) ) .Returns(Task.CompletedTask); mockConn - .Setup( - x => - x.SendCoreAsync( - nameof(IMyHub.StreamFromClientViaEnumerable), - It.Is( - y => ((object[])y).Any(z => (IAsyncEnumerable)z == asyncEnumerable) - ), - default - ) + .Setup(x => + x.SendCoreAsync( + nameof(IMyHub.StreamFromClientViaEnumerable), + It.Is(y => + ((object[])y).Any(z => (IAsyncEnumerable)z == asyncEnumerable) + ), + default + ) ) .Returns(Task.CompletedTask); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.StreamFromClientButAlsoReturnValue), - typeof(int), - It.Is( - y => ((object[])y).Any(z => (ChannelReader)z == channelReader) - ), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.StreamFromClientButAlsoReturnValue), + typeof(int), + It.Is(y => + ((object[])y).Any(z => (ChannelReader)z == channelReader) + ), + default + ) ) .Returns(Task.FromResult((object)6)); var conn = mockConn.Object; @@ -322,45 +311,41 @@ public async Task BidirectionalStream() var token = cts.Token; var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.StreamAsChannelCoreAsync( - nameof(IMyHub.StreamBidirectionalViaChannel), - typeof(int), - It.Is(y => ((object[])y).Any(z => z is ChannelReader)), - default - ) + .Setup(x => + x.StreamAsChannelCoreAsync( + nameof(IMyHub.StreamBidirectionalViaChannel), + typeof(int), + It.Is(y => ((object[])y).Any(z => z is ChannelReader)), + default + ) ) .Returns(Task.FromResult(retChannelReader)); mockConn - .Setup( - x => - x.StreamAsChannelCoreAsync( - nameof(IMyHub.StreamBidirectionalViaChannelWithToken), - typeof(int), - It.Is(y => ((object[])y).Any(z => z is ChannelReader)), - token - ) + .Setup(x => + x.StreamAsChannelCoreAsync( + nameof(IMyHub.StreamBidirectionalViaChannelWithToken), + typeof(int), + It.Is(y => ((object[])y).Any(z => z is ChannelReader)), + token + ) ) .Returns(Task.FromResult(retChannelReader)); mockConn - .Setup( - x => - x.StreamAsyncCore( - nameof(IMyHub.StreamBidirectionalViaEnumerable), - It.Is(y => ((object[])y).Any(z => z is IAsyncEnumerable)), - default - ) + .Setup(x => + x.StreamAsyncCore( + nameof(IMyHub.StreamBidirectionalViaEnumerable), + It.Is(y => ((object[])y).Any(z => z is IAsyncEnumerable)), + default + ) ) .Returns(retEnumerable); mockConn - .Setup( - x => - x.StreamAsyncCore( - nameof(IMyHub.StreamBidirectionalViaEnumerableWithToken), - It.Is(y => ((object[])y).Any(z => z is IAsyncEnumerable)), - token - ) + .Setup(x => + x.StreamAsyncCore( + nameof(IMyHub.StreamBidirectionalViaEnumerableWithToken), + It.Is(y => ((object[])y).Any(z => z is IAsyncEnumerable)), + token + ) ) .Returns(retEnumerable); var conn = mockConn.Object; @@ -382,25 +367,23 @@ public async Task ReturnValueTask() // Arrange var mockConn = MockHubConnection.Get(); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.ReturnValueTask), - typeof(object), - Array.Empty(), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.ReturnValueTask), + typeof(object), + Array.Empty(), + default + ) ) .Returns(Task.FromResult(default(object))); mockConn - .Setup( - x => - x.InvokeCoreAsync( - nameof(IMyHub.ReturnGenericValueTask), - typeof(int), - Array.Empty(), - default - ) + .Setup(x => + x.InvokeCoreAsync( + nameof(IMyHub.ReturnGenericValueTask), + typeof(int), + Array.Empty(), + default + ) ) .Returns(Task.FromResult((object)10)); var conn = mockConn.Object; diff --git a/aspnetcore/src/SignalR/clients/ts/FunctionalTests/Startup.cs b/aspnetcore/src/SignalR/clients/ts/FunctionalTests/Startup.cs index 0dadc2f0e3b..50946a3293a 100644 --- a/aspnetcore/src/SignalR/clients/ts/FunctionalTests/Startup.cs +++ b/aspnetcore/src/SignalR/clients/ts/FunctionalTests/Startup.cs @@ -247,12 +247,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILogger< app.UseCors(policy => { policy - .SetIsOriginAllowed( - host => - host.StartsWith("http://localhost:", StringComparison.Ordinal) - || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal) - || host.StartsWith("https://localhost:", StringComparison.Ordinal) - || host.StartsWith("https://127.0.0.1:", StringComparison.Ordinal) + .SetIsOriginAllowed(host => + host.StartsWith("http://localhost:", StringComparison.Ordinal) + || host.StartsWith("http://127.0.0.1:", StringComparison.Ordinal) + || host.StartsWith("https://localhost:", StringComparison.Ordinal) + || host.StartsWith("https://127.0.0.1:", StringComparison.Ordinal) ) .AllowAnyHeader() .AllowAnyMethod() diff --git a/aspnetcore/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs b/aspnetcore/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs index 63cca810b71..a016c6b1e59 100644 --- a/aspnetcore/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs +++ b/aspnetcore/src/SignalR/common/Http.Connections/test/HttpConnectionDispatcherTests.cs @@ -987,13 +987,12 @@ HttpTransportType transportType var mockStream = new Mock(); mockStream - .Setup( - m => - m.CopyToAsync( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(m => + m.CopyToAsync( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws(new IOException()); @@ -3952,8 +3951,10 @@ public async Task RequestTimeoutDisabledWhenConnected(HttpTransportType transpor Url = new Uri(url + "/foo"), Transports = transportType, DefaultTransferFormat = TransferFormat.Text, - HttpMessageHandlerFactory = handler => - new GetNegotiateHttpHandler(handler, stream) + HttpMessageHandlerFactory = handler => new GetNegotiateHttpHandler( + handler, + stream + ) }, LoggerFactory ); diff --git a/aspnetcore/src/SignalR/common/testassets/Tests.Utils/HubProtocolHelpers.cs b/aspnetcore/src/SignalR/common/testassets/Tests.Utils/HubProtocolHelpers.cs index 2867a34dac7..f072ea6ec86 100644 --- a/aspnetcore/src/SignalR/common/testassets/Tests.Utils/HubProtocolHelpers.cs +++ b/aspnetcore/src/SignalR/common/testassets/Tests.Utils/HubProtocolHelpers.cs @@ -7,8 +7,9 @@ namespace Microsoft.AspNetCore.SignalR.Tests; public static class HubProtocolHelpers { - private static readonly IHubProtocol NewtonsoftJsonHubProtocol = - new NewtonsoftJsonHubProtocol(); + private static readonly IHubProtocol NewtonsoftJsonHubProtocol = new NewtonsoftJsonHubProtocol( + + ); private static readonly IHubProtocol MessagePackHubProtocol = new MessagePackHubProtocol(); diff --git a/aspnetcore/src/SignalR/server/Core/src/HubOptionsSetup.cs b/aspnetcore/src/SignalR/server/Core/src/HubOptionsSetup.cs index 5bf5d48d7a2..971dba4993f 100644 --- a/aspnetcore/src/SignalR/server/Core/src/HubOptionsSetup.cs +++ b/aspnetcore/src/SignalR/server/Core/src/HubOptionsSetup.cs @@ -35,10 +35,9 @@ public HubOptionsSetup(IEnumerable protocols) if ( hubProtocol .GetType() - .CustomAttributes.Where( - a => - a.AttributeType.FullName - == "Microsoft.AspNetCore.SignalR.Internal.NonDefaultHubProtocolAttribute" + .CustomAttributes.Where(a => + a.AttributeType.FullName + == "Microsoft.AspNetCore.SignalR.Internal.NonDefaultHubProtocolAttribute" ) .Any() ) diff --git a/aspnetcore/src/SignalR/server/Core/src/Internal/HubMethodDescriptor.cs b/aspnetcore/src/SignalR/server/Core/src/Internal/HubMethodDescriptor.cs index 83c62632d60..9c9142c39bd 100644 --- a/aspnetcore/src/SignalR/server/Core/src/Internal/HubMethodDescriptor.cs +++ b/aspnetcore/src/SignalR/server/Core/src/Internal/HubMethodDescriptor.cs @@ -17,19 +17,17 @@ internal sealed class HubMethodDescriptor private static readonly MethodInfo MakeCancelableAsyncEnumeratorMethod = typeof(AsyncEnumerableAdapters) .GetRuntimeMethods() - .Single( - m => - m.Name.Equals(nameof(AsyncEnumerableAdapters.MakeCancelableAsyncEnumerator)) - && m.IsGenericMethod + .Single(m => + m.Name.Equals(nameof(AsyncEnumerableAdapters.MakeCancelableAsyncEnumerator)) + && m.IsGenericMethod ); private static readonly MethodInfo MakeAsyncEnumeratorFromChannelMethod = typeof(AsyncEnumerableAdapters) .GetRuntimeMethods() - .Single( - m => - m.Name.Equals(nameof(AsyncEnumerableAdapters.MakeAsyncEnumeratorFromChannel)) - && m.IsGenericMethod + .Single(m => + m.Name.Equals(nameof(AsyncEnumerableAdapters.MakeAsyncEnumeratorFromChannel)) + && m.IsGenericMethod ); private readonly MethodInfo? _makeCancelableEnumeratorMethodInfo; diff --git a/aspnetcore/src/SignalR/server/SignalR/test/ClientProxyTests.cs b/aspnetcore/src/SignalR/server/SignalR/test/ClientProxyTests.cs index be3047ba46f..52b2c2d6fa1 100644 --- a/aspnetcore/src/SignalR/server/SignalR/test/ClientProxyTests.cs +++ b/aspnetcore/src/SignalR/server/SignalR/test/ClientProxyTests.cs @@ -22,14 +22,13 @@ public async Task UserProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendUserAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendUserAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (userId, methodName, args, _) => @@ -56,14 +55,13 @@ public async Task MultipleUserProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendUsersAsync( - It.IsAny>(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendUsersAsync( + It.IsAny>(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback, string, object[], CancellationToken>( (userIds, methodName, args, _) => @@ -90,14 +88,13 @@ public async Task GroupProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendGroupAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendGroupAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (groupName, methodName, args, _) => @@ -124,14 +121,13 @@ public async Task MultipleGroupProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendGroupsAsync( - It.IsAny>(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendGroupsAsync( + It.IsAny>(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback, string, object[], CancellationToken>( (groupNames, methodName, args, _) => @@ -158,15 +154,14 @@ public async Task GroupExceptProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendGroupExceptAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + o.Setup(m => + m.SendGroupExceptAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Callback, CancellationToken>( (groupName, methodName, args, excludedConnectionIds, _) => @@ -193,13 +188,12 @@ public async Task AllClientProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendAllAsync( - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendAllAsync( + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (methodName, args, _) => @@ -226,14 +220,13 @@ public async Task AllClientsExceptProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendAllExceptAsync( - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + o.Setup(m => + m.SendAllExceptAsync( + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Callback, CancellationToken>( (methodName, args, excludedConnectionIds, _) => @@ -260,14 +253,13 @@ public async Task SingleClientProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendConnectionAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendConnectionAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (connectionId, methodName, args, _) => @@ -294,14 +286,13 @@ public async Task MultipleClientProxy_SendAsync_ArrayArgumentNotExpanded() object[] resultArgs = null; var o = new Mock>(); - o.Setup( - m => - m.SendConnectionsAsync( - It.IsAny>(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + o.Setup(m => + m.SendConnectionsAsync( + It.IsAny>(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback, string, object[], CancellationToken>( (connectionIds, methodName, args, _) => diff --git a/aspnetcore/src/SignalR/server/SignalR/test/HttpHeaderConnectionHandler.cs b/aspnetcore/src/SignalR/server/SignalR/test/HttpHeaderConnectionHandler.cs index 6d6db39b598..c94e3e3df39 100644 --- a/aspnetcore/src/SignalR/server/SignalR/test/HttpHeaderConnectionHandler.cs +++ b/aspnetcore/src/SignalR/server/SignalR/test/HttpHeaderConnectionHandler.cs @@ -26,8 +26,8 @@ public override async Task OnConnectedAsync(ConnectionContext connection) var headerName = Encoding.UTF8.GetString(buffer.ToArray()); var headerValues = headers - .FirstOrDefault( - h => string.Equals(h.Key, headerName, StringComparison.OrdinalIgnoreCase) + .FirstOrDefault(h => + string.Equals(h.Key, headerName, StringComparison.OrdinalIgnoreCase) ) .Value.ToArray(); diff --git a/aspnetcore/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs b/aspnetcore/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs index 27409856fbf..59172fbff03 100644 --- a/aspnetcore/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs +++ b/aspnetcore/src/SignalR/server/SignalR/test/HubConnectionHandlerTests.cs @@ -593,10 +593,9 @@ public async Task HubMessageOverTheMaxMessageSizeThrows() } } - var exceptionLog = TestSink.Writes.Where( - w => - string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") - && (w.Exception is InvalidDataException ide) + var exceptionLog = TestSink.Writes.Where(w => + string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") + && (w.Exception is InvalidDataException ide) ); Assert.Single(exceptionLog); Assert.Equal( @@ -641,10 +640,9 @@ await client.Connection.Application.Output.WriteAsync( } } - var exceptionLog = TestSink.Writes.Where( - w => - string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") - && (w.Exception is InvalidDataException ide) + var exceptionLog = TestSink.Writes.Where(w => + string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") + && (w.Exception is InvalidDataException ide) ); Assert.Single(exceptionLog); Assert.Equal( @@ -712,10 +710,9 @@ public async Task ManyHubMessagesOneOverTheMaxMessageSizeThrows() } } - var exceptionLog = TestSink.Writes.Where( - w => - string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") - && (w.Exception is InvalidDataException ide) + var exceptionLog = TestSink.Writes.Where(w => + string.Equals(w.LoggerName, "Microsoft.AspNetCore.SignalR.HubConnectionHandler") + && (w.Exception is InvalidDataException ide) ); Assert.Single(exceptionLog); Assert.Equal( @@ -1350,9 +1347,9 @@ public async Task HubMethodNameAttributeIsInherited() LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -1457,9 +1454,9 @@ public async Task CanCallInheritedHubMethodFromInheritingHub() LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -1491,9 +1488,9 @@ public async Task CanCallOverridenVirtualHubMethod() LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -2568,9 +2565,9 @@ public async Task HubsCanStreamResponses(string method, string protocolName) null, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); var invocationBinder = new Mock(); invocationBinder .Setup(b => b.GetStreamItemType(It.IsAny())) @@ -2630,9 +2627,9 @@ public async Task NonErrorCompletionSentWhenStreamCanceledFromClient() null, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -2707,9 +2704,9 @@ bool ExpectedErrors(WriteContext writeContext) }), LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -3439,8 +3436,8 @@ public async Task DoesNotWritePingMessagesIfSufficientOtherMessagesAreSent() { var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider( services => - services.Configure( - options => options.KeepAliveInterval = TimeSpan.FromMilliseconds(100) + services.Configure(options => + options.KeepAliveInterval = TimeSpan.FromMilliseconds(100) ), LoggerFactory ); @@ -3556,8 +3553,8 @@ public async Task ConnectionNotTimedOutIfClientNeverPings() var timeProvider = new FakeTimeProvider(); var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider( services => - services.Configure( - options => options.ClientTimeoutInterval = timeout + services.Configure(options => + options.ClientTimeoutInterval = timeout ), LoggerFactory ); @@ -3598,8 +3595,8 @@ public async Task ConnectionTimesOutIfInitialPingAndThenNoMessages() var timeProvider = new FakeTimeProvider(); var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider( services => - services.Configure( - options => options.ClientTimeoutInterval = timeout + services.Configure(options => + options.ClientTimeoutInterval = timeout ), LoggerFactory ); @@ -3631,8 +3628,8 @@ public async Task OnDisconnectedAsyncReceivesExceptionOnPingTimeout() var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider( services => { - services.Configure( - options => options.ClientTimeoutInterval = timeout + services.Configure(options => + options.ClientTimeoutInterval = timeout ); services.AddSingleton(state); @@ -3674,8 +3671,8 @@ public async Task ReceivingMessagesPreventsConnectionTimeoutFromOccuring() var timeProvider = new FakeTimeProvider(); var serviceProvider = HubConnectionHandlerTestUtils.CreateServiceProvider( services => - services.Configure( - options => options.ClientTimeoutInterval = timeout + services.Configure(options => + options.ClientTimeoutInterval = timeout ), LoggerFactory ); @@ -3990,9 +3987,9 @@ public async Task StreamingInvocationsDoNotBlockOtherInvocations() }, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient(new NewtonsoftJsonHubProtocol())) { @@ -4043,9 +4040,9 @@ bool ExpectedErrors(WriteContext writeContext) }, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -4085,9 +4082,9 @@ public async Task StreamMethodThatReturnsNullWillCleanup() }, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -4127,9 +4124,9 @@ public async Task StreamMethodWithDuplicateIdFails() }, LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -5031,10 +5028,9 @@ await client } Assert.Single( - TestSink.Writes.Where( - w => - w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" - && w.EventId.Name == "ClosingStreamWithBindingError" + TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" + && w.EventId.Name == "ClosingStreamWithBindingError" ) ); } @@ -5068,10 +5064,9 @@ await client } Assert.Single( - TestSink.Writes.Where( - w => - w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" - && w.EventId.Name == "UnexpectedCompletion" + TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" + && w.EventId.Name == "UnexpectedCompletion" ) ); } @@ -5334,10 +5329,9 @@ await client } Assert.Single( - TestSink.Writes.Where( - w => - w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" - && w.EventId.Name == "ClosingStreamWithBindingError" + TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" + && w.EventId.Name == "ClosingStreamWithBindingError" ) ); } @@ -5390,10 +5384,9 @@ await client } Assert.Single( - TestSink.Writes.Where( - w => - w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" - && w.EventId.Name == "ClosingStreamWithBindingError" + TestSink.Writes.Where(w => + w.LoggerName == "Microsoft.AspNetCore.SignalR.Internal.DefaultHubDispatcher" + && w.EventId.Name == "ClosingStreamWithBindingError" ) ); } @@ -5766,16 +5759,14 @@ public async Task CanPassDerivedParameterToStreamHubMethod(string method) services => services .AddSignalR() - .AddNewtonsoftJsonProtocol( - o => - o.PayloadSerializerSettings = - protocolOptions.PayloadSerializerSettings + .AddNewtonsoftJsonProtocol(o => + o.PayloadSerializerSettings = protocolOptions.PayloadSerializerSettings ), LoggerFactory ); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); var invocationBinder = new Mock(); invocationBinder .Setup(b => b.GetStreamItemType(It.IsAny())) @@ -5820,9 +5811,9 @@ public async Task ClientsCallerPropertyCanBeUsedOutsideOfHub() { services.AddSingleton(callerService); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (StartVerifiableLog()) { @@ -6341,9 +6332,9 @@ public async Task KeyedServiceResolvedIfInDI() provider.AddKeyedScoped("service1"); provider.AddKeyedScoped("service2"); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -6370,9 +6361,9 @@ public async Task HubMethodCanInjectKeyedServiceWithOtherParameters() provider.AddKeyedScoped("service1"); provider.AddKeyedScoped("service2"); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -6400,9 +6391,9 @@ public async Task HubMethodCanInjectKeyedServiceWithNonKeyedService() provider.AddKeyedScoped("service2"); provider.AddScoped(); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -6429,9 +6420,9 @@ public async Task MultipleKeyedServicesResolved() provider.AddKeyedScoped("service1"); provider.AddKeyedScoped("service2"); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { @@ -6458,9 +6449,9 @@ public async Task MultipleKeyedServicesWithSameNameResolved() provider.AddKeyedScoped("service1"); provider.AddKeyedScoped("service2"); }); - var connectionHandler = serviceProvider.GetService< - HubConnectionHandler - >(); + var connectionHandler = serviceProvider.GetService>( + + ); using (var client = new TestClient()) { diff --git a/aspnetcore/src/SignalR/server/SignalR/test/TestAuthHandler.cs b/aspnetcore/src/SignalR/server/SignalR/test/TestAuthHandler.cs index cc83ad1a512..04782036bb6 100644 --- a/aspnetcore/src/SignalR/server/SignalR/test/TestAuthHandler.cs +++ b/aspnetcore/src/SignalR/server/SignalR/test/TestAuthHandler.cs @@ -16,8 +16,8 @@ public Task HandleAsync(AuthorizationHandlerContext context) context.Succeed(req); } - var hasClaim = context.User.HasClaim( - o => o.Type == ClaimTypes.NameIdentifier && !string.IsNullOrEmpty(o.Value) + var hasClaim = context.User.HasClaim(o => + o.Type == ClaimTypes.NameIdentifier && !string.IsNullOrEmpty(o.Value) ); if (!hasClaim) diff --git a/aspnetcore/src/SignalR/server/SignalR/test/WebSocketsTransportTests.cs b/aspnetcore/src/SignalR/server/SignalR/test/WebSocketsTransportTests.cs index d997826b78f..ba803e217e7 100644 --- a/aspnetcore/src/SignalR/server/SignalR/test/WebSocketsTransportTests.cs +++ b/aspnetcore/src/SignalR/server/SignalR/test/WebSocketsTransportTests.cs @@ -77,9 +77,8 @@ public async Task HttpOptionsWebSocketFactoryIsUsed() .Setup(socket => socket.CloseStatus) .Returns(WebSocketCloseStatus.NormalClosure); webSocketMock - .Setup( - socket => - socket.ReceiveAsync(It.IsAny>(), It.IsAny()) + .Setup(socket => + socket.ReceiveAsync(It.IsAny>(), It.IsAny()) ) .ReturnsAsync(new ValueWebSocketReceiveResult(0, WebSocketMessageType.Close, true)); @@ -155,7 +154,9 @@ await webSocketsTransport // user agent version should come from version embedded in assembly metadata var assemblyVersion = - typeof(Constants).Assembly.GetCustomAttribute(); + typeof(Constants).Assembly.GetCustomAttribute( + + ); var majorVersion = typeof(HttpConnection).Assembly.GetName().Version.Major; var minorVersion = typeof(HttpConnection).Assembly.GetName().Version.Minor; diff --git a/aspnetcore/src/SignalR/server/StackExchangeRedis/test/DefaultHubMessageSerializerTests.cs b/aspnetcore/src/SignalR/server/StackExchangeRedis/test/DefaultHubMessageSerializerTests.cs index 165d39459c6..90e54f719ee 100644 --- a/aspnetcore/src/SignalR/server/StackExchangeRedis/test/DefaultHubMessageSerializerTests.cs +++ b/aspnetcore/src/SignalR/server/StackExchangeRedis/test/DefaultHubMessageSerializerTests.cs @@ -196,8 +196,8 @@ private IHubProtocolResolver CreateHubProtocolResolver(List hubPro new ProtocolTestData("No protocols", new List(), 0) }.ToDictionary(t => t.Name); - public static IEnumerable InvocationTestData = _invocationTestData.Keys.Select( - k => new object[] { k } + public static IEnumerable InvocationTestData = _invocationTestData.Keys.Select(k => + new object[] { k } ); public class ProtocolTestData diff --git a/aspnetcore/src/SignalR/server/StackExchangeRedis/test/RedisProtocolTests.cs b/aspnetcore/src/SignalR/server/StackExchangeRedis/test/RedisProtocolTests.cs index eda5ec9b099..33a25926480 100644 --- a/aspnetcore/src/SignalR/server/StackExchangeRedis/test/RedisProtocolTests.cs +++ b/aspnetcore/src/SignalR/server/StackExchangeRedis/test/RedisProtocolTests.cs @@ -28,8 +28,8 @@ public class RedisProtocolTests CreateTestData("Uint32", 70_000, 0x91, 0xCE, 0x00, 0x01, 0x11, 0x70), }.ToDictionary(t => t.Name); - public static IEnumerable AckTestData = _ackTestData.Keys.Select( - k => new object[] { k } + public static IEnumerable AckTestData = _ackTestData.Keys.Select(k => + new object[] { k } ); [Theory] @@ -210,8 +210,8 @@ private static readonly Dictionary< ), }.ToDictionary(t => t.Name); - public static IEnumerable InvocationTestData = _invocationTestData.Keys.Select( - k => new object[] { k } + public static IEnumerable InvocationTestData = _invocationTestData.Keys.Select(k => + new object[] { k } ); [Theory] diff --git a/aspnetcore/src/Testing/src/xunit/SkipOnAlpineAttribute.cs b/aspnetcore/src/Testing/src/xunit/SkipOnAlpineAttribute.cs index 856a54629ba..c94abf0aa5f 100644 --- a/aspnetcore/src/Testing/src/xunit/SkipOnAlpineAttribute.cs +++ b/aspnetcore/src/Testing/src/xunit/SkipOnAlpineAttribute.cs @@ -30,9 +30,8 @@ public SkipOnAlpineAttribute(string issueUrl = "") RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && File.Exists("/etc/os-release") && File.ReadAllLines("/etc/os-release") - .Any( - line => - line.StartsWith("ID=", StringComparison.Ordinal) - && line.Substring(3).Trim('"', '\'') == "alpine" + .Any(line => + line.StartsWith("ID=", StringComparison.Ordinal) + && line.Substring(3).Trim('"', '\'') == "alpine" ); } diff --git a/aspnetcore/src/Testing/test/XunitLoggerProviderTest.cs b/aspnetcore/src/Testing/test/XunitLoggerProviderTest.cs index 89b812106ae..87acd7c9635 100644 --- a/aspnetcore/src/Testing/test/XunitLoggerProviderTest.cs +++ b/aspnetcore/src/Testing/test/XunitLoggerProviderTest.cs @@ -15,8 +15,8 @@ public void LoggerProviderWritesToTestOutputHelper() { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = CreateTestLogger( - builder => builder.SetMinimumLevel(LogLevel.Trace).AddXunit(testTestOutputHelper) + var loggerFactory = CreateTestLogger(builder => + builder.SetMinimumLevel(LogLevel.Trace).AddXunit(testTestOutputHelper) ); var logger = loggerFactory.CreateLogger("TestCategory"); @@ -36,8 +36,8 @@ public void LoggerProviderWritesToTestOutputHelper() public void LoggerProviderDoesNotWriteLogMessagesBelowMinimumLevel() { var testTestOutputHelper = new TestTestOutputHelper(); - var loggerFactory = CreateTestLogger( - builder => builder.AddXunit(testTestOutputHelper, LogLevel.Warning) + var loggerFactory = CreateTestLogger(builder => + builder.AddXunit(testTestOutputHelper, LogLevel.Warning) ); var logger = loggerFactory.CreateLogger("TestCategory"); diff --git a/aspnetcore/src/Tools/Shared/TestHelpers/TestConsole.cs b/aspnetcore/src/Tools/Shared/TestHelpers/TestConsole.cs index 243c1389d59..9d2110b9864 100644 --- a/aspnetcore/src/Tools/Shared/TestHelpers/TestConsole.cs +++ b/aspnetcore/src/Tools/Shared/TestHelpers/TestConsole.cs @@ -48,8 +48,8 @@ public ConsoleCancelEventArgs ConsoleCancelKey() { var ctor = typeof(ConsoleCancelEventArgs) .GetTypeInfo() - .DeclaredConstructors.Single( - c => c.GetParameters().First().ParameterType == typeof(ConsoleSpecialKey) + .DeclaredConstructors.Single(c => + c.GetParameters().First().ParameterType == typeof(ConsoleSpecialKey) ); var args = (ConsoleCancelEventArgs)ctor.Invoke(new object[] { ConsoleSpecialKey.ControlC }); _cancelKeyPress.Invoke(this, args); diff --git a/command-line-api/samples/RenderingPlayground/DirectoryTableView.cs b/command-line-api/samples/RenderingPlayground/DirectoryTableView.cs index 4b2a246faa0..822bb681216 100644 --- a/command-line-api/samples/RenderingPlayground/DirectoryTableView.cs +++ b/command-line-api/samples/RenderingPlayground/DirectoryTableView.cs @@ -43,8 +43,8 @@ public DirectoryTableView(DirectoryInfo directory) Add(tableView); - Formatter.AddFormatter( - d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}{ForegroundColorSpan.Reset()}" + Formatter.AddFormatter(d => + $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}{ForegroundColorSpan.Reset()}" ); } diff --git a/command-line-api/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Options_With_Arguments.cs b/command-line-api/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Options_With_Arguments.cs index db4a511422a..4672c7e8c07 100644 --- a/command-line-api/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Options_With_Arguments.cs +++ b/command-line-api/src/System.CommandLine.Benchmarks/CommandLine/Perf_Parser_Options_With_Arguments.cs @@ -21,14 +21,11 @@ public class Perf_Parser_Options_With_Arguments private IEnumerable GenerateTestOptions(int count, ArgumentArity arity) => Enumerable .Range(0, count) - .Select( - i => - new CliOption($"-option{i}") - { - Arity = arity, - Description = $"Description for -option {i} ...." - } - ); + .Select(i => new CliOption($"-option{i}") + { + Arity = arity, + Description = $"Description for -option {i} ...." + }); /// /// For optionsCount: 5, argumentsCount: 5 will return: diff --git a/command-line-api/src/System.CommandLine.Benchmarks/Program.cs b/command-line-api/src/System.CommandLine.Benchmarks/Program.cs index a1183ecead6..935697dc07c 100644 --- a/command-line-api/src/System.CommandLine.Benchmarks/Program.cs +++ b/command-line-api/src/System.CommandLine.Benchmarks/Program.cs @@ -41,13 +41,11 @@ static int Main(string[] args) // if anything has failed, it's an error if ( - result.Any( - summary => - summary.HasCriticalValidationErrors - || summary.Reports.Any( - report => - !report.BuildResult.IsBuildSuccess || !report.ExecuteResults.Any() - ) + result.Any(summary => + summary.HasCriticalValidationErrors + || summary.Reports.Any(report => + !report.BuildResult.IsBuildSuccess || !report.ExecuteResults.Any() + ) ) ) return 1; diff --git a/command-line-api/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs b/command-line-api/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs index e732f6e7447..fe963c4f673 100644 --- a/command-line-api/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs +++ b/command-line-api/src/System.CommandLine.DragonFruit.Tests/ConfigureFromMethodTests.cs @@ -223,8 +223,8 @@ Type type options .Should() - .NotContain( - o => o.GetType().IsAssignableTo(typeof(CliOption<>).MakeGenericType(type)) + .NotContain(o => + o.GetType().IsAssignableTo(typeof(CliOption<>).MakeGenericType(type)) ); } diff --git a/command-line-api/src/System.CommandLine.DragonFruit/XmlDocReader.cs b/command-line-api/src/System.CommandLine.DragonFruit/XmlDocReader.cs index 3f17da1b4ef..f5b1fa53463 100644 --- a/command-line-api/src/System.CommandLine.DragonFruit/XmlDocReader.cs +++ b/command-line-api/src/System.CommandLine.DragonFruit/XmlDocReader.cs @@ -105,14 +105,13 @@ out CommandHelpMetadata commandHelpMetadata string.Empty, element .Elements() - .Select( - e => - e.Value - + ( - e.Name.ToString().ToLower() == "para" - ? Environment.NewLine - : string.Empty - ) + .Select(e => + e.Value + + ( + e.Name.ToString().ToLower() == "para" + ? Environment.NewLine + : string.Empty + ) ) ); commandHelpMetadata.Description = val.TrimEnd( diff --git a/command-line-api/src/System.CommandLine.NamingConventionBinder/ModelBindingCommandHandler.cs b/command-line-api/src/System.CommandLine.NamingConventionBinder/ModelBindingCommandHandler.cs index 2576abdd3c8..0e26144a80f 100644 --- a/command-line-api/src/System.CommandLine.NamingConventionBinder/ModelBindingCommandHandler.cs +++ b/command-line-api/src/System.CommandLine.NamingConventionBinder/ModelBindingCommandHandler.cs @@ -135,7 +135,7 @@ private void BindValueSource(ParameterInfo param, IValueSource valueSource) private ParameterDescriptor? FindParameterDescriptor(ParameterInfo? param) => param is null ? null - : _methodDescriptor.ParameterDescriptors.FirstOrDefault( - x => x.ValueName == param.Name && x.ValueType == param.ParameterType + : _methodDescriptor.ParameterDescriptors.FirstOrDefault(x => + x.ValueName == param.Name && x.ValueType == param.ParameterType ); } diff --git a/command-line-api/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs b/command-line-api/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs index 2e928ef1a85..3f8b71a3153 100644 --- a/command-line-api/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs +++ b/command-line-api/src/System.CommandLine.Rendering.Tests/ConsoleRendererTests.cs @@ -275,8 +275,7 @@ public DirectoryView(DirectoryInfo directory) } var formatter = new TextSpanFormatter(); - formatter.AddFormatter( - d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}" + formatter.AddFormatter(d => $"{d:d} {ForegroundColorSpan.DarkGray()}{d:t}" ); Add(new ContentView("")); diff --git a/command-line-api/src/System.CommandLine.Rendering.Tests/OutputFormattingTests.cs b/command-line-api/src/System.CommandLine.Rendering.Tests/OutputFormattingTests.cs index 35087b61705..14b76489920 100644 --- a/command-line-api/src/System.CommandLine.Rendering.Tests/OutputFormattingTests.cs +++ b/command-line-api/src/System.CommandLine.Rendering.Tests/OutputFormattingTests.cs @@ -57,9 +57,8 @@ public void Type_formatters_apply_to_table_cells() [Fact] public void FormattableString_can_contain_format_strings_that_reformat_the_input_value() { - _renderer.Formatter.AddFormatter( - d => - $"{d:d} {Color.Foreground.DarkGray.EscapeSequence}{d:t}{Color.Foreground.Default.EscapeSequence}" + _renderer.Formatter.AddFormatter(d => + $"{d:d} {Color.Foreground.DarkGray.EscapeSequence}{d:t}{Color.Foreground.Default.EscapeSequence}" ); var dateTime = DateTime.Parse("8/2/2018 6pm"); diff --git a/command-line-api/src/System.CommandLine.Rendering.Tests/TestTerminalTests.cs b/command-line-api/src/System.CommandLine.Rendering.Tests/TestTerminalTests.cs index cec87d507d2..67cb6467f79 100644 --- a/command-line-api/src/System.CommandLine.Rendering.Tests/TestTerminalTests.cs +++ b/command-line-api/src/System.CommandLine.Rendering.Tests/TestTerminalTests.cs @@ -149,10 +149,9 @@ public void When_in_ANSI_mode_then_ContentWritten_events_do_not_include_escape_s terminal .Events.Should() - .Contain( - e => - e is TestTerminal.ContentWritten - && ((TestTerminal.ContentWritten)e).Content == "text" + .Contain(e => + e is TestTerminal.ContentWritten + && ((TestTerminal.ContentWritten)e).Content == "text" ); } } diff --git a/command-line-api/src/System.CommandLine.Suggest/GlobalToolsSuggestionRegistration.cs b/command-line-api/src/System.CommandLine.Suggest/GlobalToolsSuggestionRegistration.cs index 974fe511ef7..26127c406bc 100644 --- a/command-line-api/src/System.CommandLine.Suggest/GlobalToolsSuggestionRegistration.cs +++ b/command-line-api/src/System.CommandLine.Suggest/GlobalToolsSuggestionRegistration.cs @@ -41,9 +41,9 @@ public IEnumerable FindAllRegistrations() return Array.Empty(); } - return _filesNameWithoutExtensionUnderDotnetProfileTools.Select( - p => new Registration(Path.Combine(_nullableToolsShimPath, p)) - ); + return _filesNameWithoutExtensionUnderDotnetProfileTools.Select(p => new Registration( + Path.Combine(_nullableToolsShimPath, p) + )); } public Registration FindRegistration(FileInfo soughtExecutable) diff --git a/command-line-api/src/System.CommandLine.Tests/CustomParsingTests.cs b/command-line-api/src/System.CommandLine.Tests/CustomParsingTests.cs index 9312a197850..03c117f0e25 100644 --- a/command-line-api/src/System.CommandLine.Tests/CustomParsingTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/CustomParsingTests.cs @@ -393,10 +393,9 @@ public void Custom_parser_can_check_another_option_result_for_custom_errors(stri var parseResult = command.Parse(commandLine); parseResult - .Errors.Single( - e => - e.SymbolResult is OptionResult optResult - && optResult.Option == optionThatDependsOnOptionWithError + .Errors.Single(e => + e.SymbolResult is OptionResult optResult + && optResult.Option == optionThatDependsOnOptionWithError ) .Message.Should() .Be("one two"); diff --git a/command-line-api/src/System.CommandLine.Tests/OptionTests.cs b/command-line-api/src/System.CommandLine.Tests/OptionTests.cs index 27984c17239..9ce8bca9376 100644 --- a/command-line-api/src/System.CommandLine.Tests/OptionTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/OptionTests.cs @@ -256,15 +256,14 @@ public void Option_T_default_value_factory_can_be_set_after_instantiation() public void Option_T_default_value_is_validated() { var option = new CliOption("-x") { DefaultValueFactory = (_) => 123 }; - option.Validators.Add( - symbol => - symbol.AddError( - symbol - .Tokens.Select(t => t.Value) - .Where(v => v == "123") - .Select(_ => "ERR") - .First() - ) + option.Validators.Add(symbol => + symbol.AddError( + symbol + .Tokens.Select(t => t.Value) + .Where(v => v == "123") + .Select(_ => "ERR") + .First() + ) ); new CliRootCommand { option } diff --git a/command-line-api/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs b/command-line-api/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs index e5ec1e6644c..256c7ec43ae 100644 --- a/command-line-api/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs +++ b/command-line-api/src/System.CommandLine.Tests/ParserTests.RootCommandAndArg0.cs @@ -41,12 +41,11 @@ public void When_parsing_a_string_array_input_then_a_full_path_to_an_executable_ ); parserResult .Errors.Should() - .ContainSingle( - e => - e.Message - == LocalizationResources.UnrecognizedCommandOrArgument( - CliRootCommand.ExecutablePath - ) + .ContainSingle(e => + e.Message + == LocalizationResources.UnrecognizedCommandOrArgument( + CliRootCommand.ExecutablePath + ) ); } diff --git a/command-line-api/src/System.CommandLine.Tests/ParserTests.cs b/command-line-api/src/System.CommandLine.Tests/ParserTests.cs index 3b989aae1d8..d317ad5a8ef 100644 --- a/command-line-api/src/System.CommandLine.Tests/ParserTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/ParserTests.cs @@ -346,17 +346,15 @@ public void Command_with_multiple_options_is_parsed_correctly() result .CommandResult.Children.Should() - .ContainSingle( - o => - ((OptionResult)o).Option.Name == "--inner1" - && o.Tokens.Single().Value == "argument1" + .ContainSingle(o => + ((OptionResult)o).Option.Name == "--inner1" + && o.Tokens.Single().Value == "argument1" ); result .CommandResult.Children.Should() - .ContainSingle( - o => - ((OptionResult)o).Option.Name == "--inner2" - && o.Tokens.Single().Value == "argument2" + .ContainSingle(o => + ((OptionResult)o).Option.Name == "--inner2" + && o.Tokens.Single().Value == "argument2" ); } diff --git a/command-line-api/src/System.CommandLine.Tests/ParsingValidationTests.cs b/command-line-api/src/System.CommandLine.Tests/ParsingValidationTests.cs index 29545feff4a..e1b8bfb0fe2 100644 --- a/command-line-api/src/System.CommandLine.Tests/ParsingValidationTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/ParsingValidationTests.cs @@ -318,12 +318,11 @@ public void A_custom_validator_can_be_added_to_a_command() command.Validators.Add(commandResult => { if ( - commandResult.Children.Any( - sr => - ((OptionResult)sr).Option.Name == "--one" - && commandResult.Children.Any( - sr => ((OptionResult)sr).Option.Name == "--two" - ) + commandResult.Children.Any(sr => + ((OptionResult)sr).Option.Name == "--one" + && commandResult.Children.Any(sr => + ((OptionResult)sr).Option.Name == "--two" + ) ) ) { @@ -551,11 +550,9 @@ public void LegalFilePathsOnly_rejects_command_arguments_containing_invalid_path result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() - && e.Message - == $"Character not allowed in a path: '{invalidCharacter}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() + && e.Message == $"Character not allowed in a path: '{invalidCharacter}'." ); } @@ -573,11 +570,9 @@ public void LegalFilePathsOnly_rejects_option_arguments_containing_invalid_path_ result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "-x" - && e.Message - == $"Character not allowed in a path: '{invalidCharacter}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "-x" + && e.Message == $"Character not allowed in a path: '{invalidCharacter}'." ); } @@ -640,11 +635,10 @@ public void LegalFileNamesOnly_rejects_command_arguments_containing_invalid_file result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() - && e.Message - == $"Character not allowed in a file name: '{invalidCharacter}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() + && e.Message + == $"Character not allowed in a file name: '{invalidCharacter}'." ); } @@ -663,11 +657,10 @@ public void LegalFileNamesOnly_rejects_option_arguments_containing_invalid_file_ result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "-x" - && e.Message - == $"Character not allowed in a file name: '{invalidCharacter}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "-x" + && e.Message + == $"Character not allowed in a file name: '{invalidCharacter}'." ); } @@ -724,10 +717,9 @@ public void A_command_argument_can_be_invalid_based_on_file_existence() result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"File does not exist: '{path}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"File does not exist: '{path}'." ); } @@ -745,10 +737,9 @@ public void An_option_argument_can_be_invalid_based_on_file_existence() result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"File does not exist: '{path}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"File does not exist: '{path}'." ); } @@ -766,10 +757,9 @@ public void A_command_argument_can_be_invalid_based_on_directory_existence() result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"Directory does not exist: '{path}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"Directory does not exist: '{path}'." ); } @@ -787,10 +777,9 @@ public void An_option_argument_can_be_invalid_based_on_directory_existence() result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"Directory does not exist: '{path}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"Directory does not exist: '{path}'." ); } @@ -808,10 +797,9 @@ public void A_command_argument_can_be_invalid_based_on_file_or_directory_existen result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() - && e.Message == $"File or directory does not exist: '{path}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument == command.Arguments.First() + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -829,10 +817,9 @@ public void An_option_argument_can_be_invalid_based_on_file_or_directory_existen result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"File or directory does not exist: '{path}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -850,10 +837,9 @@ public void A_command_argument_with_multiple_files_can_be_invalid_based_on_file_ result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"File does not exist: '{path}'." + .And.Contain(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"File does not exist: '{path}'." ); } @@ -871,10 +857,9 @@ public void An_option_argument_with_multiple_files_can_be_invalid_based_on_file_ result .Errors.Should() .HaveCount(1) - .And.Contain( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"File does not exist: '{path}'." + .And.Contain(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"File does not exist: '{path}'." ); } @@ -892,10 +877,9 @@ public void A_command_argument_with_multiple_directories_can_be_invalid_based_on result .Errors.Should() .HaveCount(1) - .And.ContainSingle( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"Directory does not exist: '{path}'." + .And.ContainSingle(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"Directory does not exist: '{path}'." ); } @@ -913,10 +897,9 @@ public void An_option_argument_with_multiple_directories_can_be_invalid_based_on result .Errors.Should() .HaveCount(1) - .And.ContainSingle( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"Directory does not exist: '{path}'." + .And.ContainSingle(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"Directory does not exist: '{path}'." ); } @@ -937,10 +920,9 @@ public void A_command_argument_with_multiple_FileSystemInfos_can_be_invalid_base result .Errors.Should() - .ContainSingle( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"File or directory does not exist: '{path}'." + .ContainSingle(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -957,10 +939,9 @@ public void An_option_argument_with_multiple_FileSystemInfos_can_be_invalid_base result .Errors.Should() - .ContainSingle( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"File or directory does not exist: '{path}'." + .ContainSingle(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -978,10 +959,9 @@ public void A_command_argument_with_multiple_FileSystemInfos_can_be_invalid_base result .Errors.Should() .HaveCount(1) - .And.ContainSingle( - e => - ((ArgumentResult)e.SymbolResult).Argument.Name == "to" - && e.Message == $"File or directory does not exist: '{path}'." + .And.ContainSingle(e => + ((ArgumentResult)e.SymbolResult).Argument.Name == "to" + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -999,10 +979,9 @@ public void An_option_argument_with_multiple_FileSystemInfos_can_be_invalid_base result .Errors.Should() .HaveCount(1) - .And.ContainSingle( - e => - ((OptionResult)e.SymbolResult).Option.Name == "--to" - && e.Message == $"File or directory does not exist: '{path}'." + .And.ContainSingle(e => + ((OptionResult)e.SymbolResult).Option.Name == "--to" + && e.Message == $"File or directory does not exist: '{path}'." ); } @@ -1090,10 +1069,9 @@ public void A_command_with_subcommands_is_invalid_to_invoke_if_it_has_no_handler result .Errors.Should() - .ContainSingle( - e => - e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) - && ((CommandResult)e.SymbolResult).Command.Name.Equals("inner") + .ContainSingle(e => + e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) + && ((CommandResult)e.SymbolResult).Command.Name.Equals("inner") ); } @@ -1108,10 +1086,9 @@ public void A_root_command_with_subcommands_is_invalid_to_invoke_if_it_has_no_ha result .Errors.Should() - .ContainSingle( - e => - e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) - && ((CommandResult)e.SymbolResult).Command == rootCommand + .ContainSingle(e => + e.Message.Equals(LocalizationResources.RequiredCommandWasNotProvided()) + && ((CommandResult)e.SymbolResult).Command == rootCommand ); } diff --git a/command-line-api/src/System.CommandLine.Tests/SuggestDirectiveTests.cs b/command-line-api/src/System.CommandLine.Tests/SuggestDirectiveTests.cs index b2667344673..60b2f6defb6 100644 --- a/command-line-api/src/System.CommandLine.Tests/SuggestDirectiveTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/SuggestDirectiveTests.cs @@ -25,8 +25,7 @@ public SuggestDirectiveTests() _fruitOption.CompletionSources.Add("apple", "banana", "cherry"); _vegetableOption = new CliOption("--vegetable"); - _vegetableOption.CompletionSources.Add( - _ => new[] { "asparagus", "broccoli", "carrot" } + _vegetableOption.CompletionSources.Add(_ => new[] { "asparagus", "broccoli", "carrot" } ); _eatCommand = new CliCommand("eat") { _fruitOption, _vegetableOption }; diff --git a/command-line-api/src/System.CommandLine.Tests/Utility/AssertionExtensions.cs b/command-line-api/src/System.CommandLine.Tests/Utility/AssertionExtensions.cs index aaaa00467e4..6809264fd4a 100644 --- a/command-line-api/src/System.CommandLine.Tests/Utility/AssertionExtensions.cs +++ b/command-line-api/src/System.CommandLine.Tests/Utility/AssertionExtensions.cs @@ -28,10 +28,8 @@ params object[] expectedValues foreach ( var tuple in actualValues .Zip(expectedValues, (actual, expected) => (actual, expected)) - .Where( - t => - (t.expected == null) - || (t.expected.GetType().GetProperties().Length > 0) + .Where(t => + (t.expected == null) || (t.expected.GetType().GetProperties().Length > 0) ) ) { diff --git a/command-line-api/src/System.CommandLine.Tests/VersionOptionTests.cs b/command-line-api/src/System.CommandLine.Tests/VersionOptionTests.cs index 80c2c5664c8..df1f729fee3 100644 --- a/command-line-api/src/System.CommandLine.Tests/VersionOptionTests.cs +++ b/command-line-api/src/System.CommandLine.Tests/VersionOptionTests.cs @@ -105,8 +105,8 @@ public void Version_is_not_valid_with_other_tokens(string commandLine) result .Errors.Should() - .Contain( - e => e.Message == "--version option cannot be combined with other arguments." + .Contain(e => + e.Message == "--version option cannot be combined with other arguments." ); } @@ -165,8 +165,8 @@ public void Version_is_not_valid_with_other_tokens_uses_custom_alias() result .Errors.Should() - .ContainSingle( - e => e.Message == "-v option cannot be combined with other arguments." + .ContainSingle(e => + e.Message == "-v option cannot be combined with other arguments." ); } } diff --git a/command-line-api/src/System.CommandLine/ParseResult.cs b/command-line-api/src/System.CommandLine/ParseResult.cs index bd8e215c736..d505dab75bc 100644 --- a/command-line-api/src/System.CommandLine/ParseResult.cs +++ b/command-line-api/src/System.CommandLine/ParseResult.cs @@ -207,8 +207,8 @@ is CommandResult commandResult ? OptionsWithArgumentLimitReached(commandResult) : Array.Empty(); - completions = completions.Where( - item => optionsWithArgumentLimitReached.All(s => s != item.Label) + completions = completions.Where(item => + optionsWithArgumentLimitReached.All(s => s != item.Label) ); return completions; @@ -334,8 +334,8 @@ OptionResult optionResult if (textCompletionContext.WordToComplete.Length > 0) { - var tokenToComplete = parseResult.Tokens.Last( - t => t.Value == textCompletionContext.WordToComplete + var tokenToComplete = parseResult.Tokens.Last(t => + t.Value == textCompletionContext.WordToComplete ); return optionResult.Tokens.Contains(tokenToComplete); diff --git a/command-line-api/src/System.CommandLine/Parsing/SymbolResultExtensions.cs b/command-line-api/src/System.CommandLine/Parsing/SymbolResultExtensions.cs index fa02e5d11ea..54aae362100 100644 --- a/command-line-api/src/System.CommandLine/Parsing/SymbolResultExtensions.cs +++ b/command-line-api/src/System.CommandLine/Parsing/SymbolResultExtensions.cs @@ -12,8 +12,8 @@ internal static IEnumerable AllSymbolResults(this CommandResult co yield return commandResult; foreach ( - var item in commandResult.Children.FlattenBreadthFirst( - o => o.SymbolResultTree.GetChildren(o) + var item in commandResult.Children.FlattenBreadthFirst(o => + o.SymbolResultTree.GetChildren(o) ) ) { diff --git a/efcore/benchmark/EFCore.Benchmarks/Models/AdventureWorks/AdventureWorksContextBase.cs b/efcore/benchmark/EFCore.Benchmarks/Models/AdventureWorks/AdventureWorksContextBase.cs index 21293690f75..5e2ac600860 100644 --- a/efcore/benchmark/EFCore.Benchmarks/Models/AdventureWorks/AdventureWorksContextBase.cs +++ b/efcore/benchmark/EFCore.Benchmarks/Models/AdventureWorks/AdventureWorksContextBase.cs @@ -156,15 +156,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.BusinessEntityID, - e.AddressID, - e.AddressTypeID - } - ); + entity.HasKey(e => new + { + e.BusinessEntityID, + e.AddressID, + e.AddressTypeID + }); entity.ToTable("BusinessEntityAddress", "Person"); @@ -190,15 +187,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.BusinessEntityID, - e.PersonID, - e.ContactTypeID - } - ); + entity.HasKey(e => new + { + e.BusinessEntityID, + e.PersonID, + e.ContactTypeID + }); entity.ToTable("BusinessEntityContact", "Person"); @@ -400,16 +394,13 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.BusinessEntityID, - e.StartDate, - e.DepartmentID, - e.ShiftID - } - ); + entity.HasKey(e => new + { + e.BusinessEntityID, + e.StartDate, + e.DepartmentID, + e.ShiftID + }); entity.ToTable("EmployeeDepartmentHistory", "HumanResources"); @@ -547,15 +538,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.BusinessEntityID, - e.PhoneNumber, - e.PhoneNumberTypeID - } - ); + entity.HasKey(e => new + { + e.BusinessEntityID, + e.PhoneNumber, + e.PhoneNumberTypeID + }); entity.ToTable("PersonPhone", "Person"); @@ -741,15 +729,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.ProductModelID, - e.ProductDescriptionID, - e.CultureID - } - ); + entity.HasKey(e => new + { + e.ProductModelID, + e.ProductDescriptionID, + e.CultureID + }); entity.ToTable("ProductModelProductDescriptionCulture", "Production"); @@ -1149,15 +1134,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.BusinessEntityID, - e.StartDate, - e.TerritoryID - } - ); + entity.HasKey(e => new + { + e.BusinessEntityID, + e.StartDate, + e.TerritoryID + }); entity.ToTable("SalesTerritoryHistory", "Sales"); @@ -1404,15 +1386,12 @@ public static void ConfigureModel(ModelBuilder modelBuilder) modelBuilder.Entity(entity => { - entity.HasKey( - e => - new - { - e.WorkOrderID, - e.ProductID, - e.OperationSequence - } - ); + entity.HasKey(e => new + { + e.WorkOrderID, + e.ProductID, + e.OperationSequence + }); entity.ToTable("WorkOrderRouting", "Production"); diff --git a/efcore/src/EFCore.Analyzers/InternalUsageDiagnosticAnalyzer.cs b/efcore/src/EFCore.Analyzers/InternalUsageDiagnosticAnalyzer.cs index e742c4d52dc..b799b45a113 100644 --- a/efcore/src/EFCore.Analyzers/InternalUsageDiagnosticAnalyzer.cs +++ b/efcore/src/EFCore.Analyzers/InternalUsageDiagnosticAnalyzer.cs @@ -361,10 +361,9 @@ private static bool IsInternal(OperationAnalysisContext context, ITypeSymbol sym private static bool HasInternalAttribute(ISymbol symbol) => symbol .GetAttributes() - .Any( - a => - a.AttributeClass!.ToDisplayString() - == "Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternalAttribute" + .Any(a => + a.AttributeClass!.ToDisplayString() + == "Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkInternalAttribute" ); private static bool IsInInternalNamespace(ISymbol symbol) diff --git a/efcore/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs b/efcore/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs index 3ae467a9db3..ed74ebb7875 100644 --- a/efcore/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs +++ b/efcore/src/EFCore.Cosmos/Infrastructure/Internal/CosmosModelValidator.cs @@ -249,8 +249,8 @@ protected virtual void ValidateSharedContainerCompatibility( } else if (analyticalTtl != currentAnalyticalTtl) { - var conflictingEntityType = mappedTypes.First( - et => et.GetAnalyticalStoreTimeToLive() != null + var conflictingEntityType = mappedTypes.First(et => + et.GetAnalyticalStoreTimeToLive() != null ); throw new InvalidOperationException( CosmosStrings.AnalyticalTTLMismatch( @@ -273,8 +273,8 @@ protected virtual void ValidateSharedContainerCompatibility( } else if (defaultTtl != currentDefaultTtl) { - var conflictingEntityType = mappedTypes.First( - et => et.GetDefaultTimeToLive() != null + var conflictingEntityType = mappedTypes.First(et => + et.GetDefaultTimeToLive() != null ); throw new InvalidOperationException( CosmosStrings.DefaultTTLMismatch( @@ -405,8 +405,8 @@ protected virtual void ValidateKeys( var idProperty = entityType .GetProperties() - .FirstOrDefault( - p => p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName + .FirstOrDefault(p => + p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName ); if (idProperty == null) { @@ -491,8 +491,8 @@ protected override void ValidateNoMutableKeys( { foreach (var key in entityType.GetDeclaredKeys()) { - var mutableProperty = key.Properties.FirstOrDefault( - p => p.ValueGenerated.HasFlag(ValueGenerated.OnUpdate) + var mutableProperty = key.Properties.FirstOrDefault(p => + p.ValueGenerated.HasFlag(ValueGenerated.OnUpdate) ); if (mutableProperty != null && !mutableProperty.IsOrdinalKeyProperty()) { diff --git a/efcore/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs b/efcore/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs index cf237f28293..3956251e52c 100644 --- a/efcore/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs +++ b/efcore/src/EFCore.Cosmos/Metadata/Conventions/StoreKeyConvention.cs @@ -248,8 +248,8 @@ IConventionContext context ) || ( previousPrimaryKey != null - && previousPrimaryKey.Properties.Any( - p => p.GetJsonPropertyName() == IdPropertyJsonName + && previousPrimaryKey.Properties.Any(p => + p.GetJsonPropertyName() == IdPropertyJsonName ) ) ) diff --git a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosMathTranslator.cs b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosMathTranslator.cs index 1c8282960ec..2eb09b82cde 100644 --- a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosMathTranslator.cs +++ b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosMathTranslator.cs @@ -222,8 +222,8 @@ public CosmosMathTranslator(ISqlExpressionFactory sqlExpressionFactory) ? ExpressionExtensions.InferTypeMapping(arguments[0]) : ExpressionExtensions.InferTypeMapping(arguments[0], arguments[1]); - var newArguments = arguments.Select( - e => _sqlExpressionFactory.ApplyTypeMapping(e, typeMapping!) + var newArguments = arguments.Select(e => + _sqlExpressionFactory.ApplyTypeMapping(e, typeMapping!) ); return _sqlExpressionFactory.Function( diff --git a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs index dd009b95879..c449506e1c2 100644 --- a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs +++ b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosQueryableMethodTranslatingExpressionVisitor.cs @@ -134,10 +134,8 @@ queryRootMethodCallExpression.Arguments[1] is UnaryExpression .Properties; var idProperty = entityType .GetProperties() - .First( - p => - p.GetJsonPropertyName() - == StoreKeyConvention.IdPropertyJsonName + .First(p => + p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName ); if ( diff --git a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs index b0f5770d871..8ce7c9de89b 100644 --- a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs +++ b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.CosmosProjectionBindingRemovingExpressionVisitorBase.cs @@ -19,9 +19,8 @@ private abstract class CosmosProjectionBindingRemovingExpressionVisitorBase : Ex { private static readonly MethodInfo GetItemMethodInfo = typeof(JObject) .GetRuntimeProperties() - .Single( - pi => - pi.Name == "Item" && pi.GetIndexParameters()[0].ParameterType == typeof(string) + .Single(pi => + pi.Name == "Item" && pi.GetIndexParameters()[0].ParameterType == typeof(string) ) .GetMethod; @@ -31,11 +30,10 @@ private abstract class CosmosProjectionBindingRemovingExpressionVisitorBase : Ex private static readonly MethodInfo JTokenToObjectWithSerializerMethodInfo = typeof(JToken) .GetRuntimeMethods() - .Single( - mi => - mi.Name == nameof(JToken.ToObject) - && mi.GetParameters().Length == 1 - && mi.IsGenericMethodDefinition + .Single(mi => + mi.Name == nameof(JToken.ToObject) + && mi.GetParameters().Length == 1 + && mi.IsGenericMethodDefinition ); private static readonly MethodInfo CollectionAccessorAddMethodInfo = @@ -478,8 +476,8 @@ Expression instanceVariable : (Expression)Constant(null, typeof(InternalEntityEntry)); #pragma warning restore EF1001 // Internal EF Core API usage. - var concreteEntityTypeVariable = shaperBlock.Variables.Single( - v => v.Type == typeof(IEntityType) + var concreteEntityTypeVariable = shaperBlock.Variables.Single(v => + v.Type == typeof(IEntityType) ); var inverseNavigation = navigation.Inverse; var fixup = GenerateFixup( diff --git a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs index fff56ee4955..8f961c12289 100644 --- a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs +++ b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosShapedQueryCompilingExpressionVisitor.ReadItemQueryingEnumerable.cs @@ -94,8 +94,8 @@ private bool TryGetResourceId(out string resourceId) { var idProperty = _readItemExpression .EntityType.GetProperties() - .FirstOrDefault( - p => p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName + .FirstOrDefault(p => + p.GetJsonPropertyName() == StoreKeyConvention.IdPropertyJsonName ); if (TryGetParameterValue(idProperty, out var value)) diff --git a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs index 2657ce63b00..0ef7f4b77ea 100644 --- a/efcore/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs +++ b/efcore/src/EFCore.Cosmos/Query/Internal/CosmosSqlTranslatingExpressionVisitor.cs @@ -896,8 +896,7 @@ is SqlExpression discriminatorColumn : _sqlExpressionFactory.In( discriminatorColumn, concreteEntityTypes - .Select( - et => _sqlExpressionFactory.Constant(et.GetDiscriminatorValue()) + .Select(et => _sqlExpressionFactory.Constant(et.GetDiscriminatorValue()) ) .ToArray() ); @@ -1123,13 +1122,12 @@ out Expression result result = Visit( primaryKeyProperties1 - .Select( - p => - Expression.MakeBinary( - nodeType, - CreatePropertyAccessExpression(nonNullEntityReference, p), - Expression.Constant(null, p.ClrType.MakeNullable()) - ) + .Select(p => + Expression.MakeBinary( + nodeType, + CreatePropertyAccessExpression(nonNullEntityReference, p), + Expression.Constant(null, p.ClrType.MakeNullable()) + ) ) .Aggregate( (l, r) => @@ -1180,13 +1178,12 @@ out Expression result result = Visit( primaryKeyProperties - .Select( - p => - Expression.MakeBinary( - nodeType, - CreatePropertyAccessExpression(left, p), - CreatePropertyAccessExpression(right, p) - ) + .Select(p => + Expression.MakeBinary( + nodeType, + CreatePropertyAccessExpression(left, p), + CreatePropertyAccessExpression(right, p) + ) ) .Aggregate( (l, r) => @@ -1233,8 +1230,8 @@ when sqlParameterExpression.Name.StartsWith( return _queryCompilationContext.RegisterRuntimeParameter(newParameterName, lambda); case MemberInitExpression memberInitExpression - when memberInitExpression.Bindings.SingleOrDefault( - mb => mb.Member.Name == property.Name + when memberInitExpression.Bindings.SingleOrDefault(mb => + mb.Member.Name == property.Name ) is MemberAssignment memberAssignment: return memberAssignment.Expression; @@ -1308,10 +1305,9 @@ private static bool CanEvaluate(Expression expression) => NewArrayExpression e => e.Expressions.All(CanEvaluate), MemberInitExpression e => CanEvaluate(e.NewExpression) - && e.Bindings.All( - mb => - mb is MemberAssignment memberAssignment - && CanEvaluate(memberAssignment.Expression) + && e.Bindings.All(mb => + mb is MemberAssignment memberAssignment + && CanEvaluate(memberAssignment.Expression) ), _ => false }; diff --git a/efcore/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs b/efcore/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs index 7283036ae3e..36550500db2 100644 --- a/efcore/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs +++ b/efcore/src/EFCore.Cosmos/Update/Internal/DocumentSource.cs @@ -355,8 +355,8 @@ object embeddedValue private static IProperty? FindOrdinalKeyProperty(IEntityType entityType) => entityType .FindPrimaryKey()! - .Properties.FirstOrDefault( - p => p.GetJsonPropertyName().Length == 0 && p.IsOrdinalKeyProperty() + .Properties.FirstOrDefault(p => + p.GetJsonPropertyName().Length == 0 && p.IsOrdinalKeyProperty() ); /// diff --git a/efcore/src/EFCore.Design/Design/FluentApiCodeFragment.cs b/efcore/src/EFCore.Design/Design/FluentApiCodeFragment.cs index 189390a06b4..89c7b8d7a44 100644 --- a/efcore/src/EFCore.Design/Design/FluentApiCodeFragment.cs +++ b/efcore/src/EFCore.Design/Design/FluentApiCodeFragment.cs @@ -118,12 +118,11 @@ public virtual IEnumerable GetRequiredUsings() foreach ( var argumentNamespace in current - .Arguments.Where( - a => - a - is not null - and not NestedClosureCodeFragment - and not PropertyAccessorCodeFragment + .Arguments.Where(a => + a + is not null + and not NestedClosureCodeFragment + and not PropertyAccessorCodeFragment ) .SelectMany(a => a!.GetType().GetNamespaces()) ) diff --git a/efcore/src/EFCore.Design/Design/Internal/DbContextOperations.cs b/efcore/src/EFCore.Design/Design/Internal/DbContextOperations.cs index a3881a76b36..67e3d23fb83 100644 --- a/efcore/src/EFCore.Design/Design/Internal/DbContextOperations.cs +++ b/efcore/src/EFCore.Design/Design/Internal/DbContextOperations.cs @@ -532,11 +532,10 @@ private static IDictionary> FilterTypes( : StringComparison.Ordinal; return types - .Where( - t => - string.Equals(t.Key.Name, name, comparisonType) - || string.Equals(t.Key.FullName, name, comparisonType) - || string.Equals(t.Key.AssemblyQualifiedName, name, comparisonType) + .Where(t => + string.Equals(t.Key.Name, name, comparisonType) + || string.Equals(t.Key.FullName, name, comparisonType) + || string.Equals(t.Key.AssemblyQualifiedName, name, comparisonType) ) .ToDictionary(); } diff --git a/efcore/src/EFCore.Design/Migrations/Design/MigrationsCodeGenerator.cs b/efcore/src/EFCore.Design/Migrations/Design/MigrationsCodeGenerator.cs index f984b5786f8..62726bbad75 100644 --- a/efcore/src/EFCore.Design/Migrations/Design/MigrationsCodeGenerator.cs +++ b/efcore/src/EFCore.Design/Migrations/Design/MigrationsCodeGenerator.cs @@ -194,14 +194,13 @@ IEnumerable operations protected virtual IEnumerable GetNamespaces(IModel model) => model .GetEntityTypes() - .SelectMany( - e => - GetNamespaces(e) - .Concat( - e.GetDeclaredComplexProperties().Any() - ? Model.DefaultPropertyBagType.GetNamespaces() - : Enumerable.Empty() - ) + .SelectMany(e => + GetNamespaces(e) + .Concat( + e.GetDeclaredComplexProperties().Any() + ? Model.DefaultPropertyBagType.GetNamespaces() + : Enumerable.Empty() + ) ) .Concat(GetAnnotationNamespaces(GetAnnotatables(model))); @@ -246,17 +245,14 @@ private static IEnumerable GetAnnotatables(IModel model) } private IEnumerable GetAnnotationNamespaces(IEnumerable items) => - items.SelectMany( - i => - Dependencies - .AnnotationCodeGenerator.FilterIgnoredAnnotations(i.GetAnnotations()) - .Where(a => a.Value != null) - .Select(a => new { Annotatable = i, Annotation = a }) - .SelectMany( - a => - GetProviderType(a.Annotatable, a.Annotation.Value!.GetType()) - .GetNamespaces() - ) + items.SelectMany(i => + Dependencies + .AnnotationCodeGenerator.FilterIgnoredAnnotations(i.GetAnnotations()) + .Where(a => a.Value != null) + .Select(a => new { Annotatable = i, Annotation = a }) + .SelectMany(a => + GetProviderType(a.Annotatable, a.Annotation.Value!.GetType()).GetNamespaces() + ) ); private ValueConverter? FindValueConverter(IProperty property) => diff --git a/efcore/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs b/efcore/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs index 51a07069afb..073e146eac5 100644 --- a/efcore/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs +++ b/efcore/src/EFCore.Design/Migrations/Design/MigrationsScaffolder.cs @@ -271,8 +271,8 @@ public virtual MigrationFiles RemoveMigration( IModel? model = null; var migrations = Dependencies - .MigrationsAssembly.Migrations.Select( - m => Dependencies.MigrationsAssembly.CreateMigration(m.Value, _activeProvider) + .MigrationsAssembly.Migrations.Select(m => + Dependencies.MigrationsAssembly.CreateMigration(m.Value, _activeProvider) ) .ToList(); if (migrations.Count != 0) @@ -294,12 +294,11 @@ public virtual MigrationFiles RemoveMigration( { applied = Dependencies .HistoryRepository.GetAppliedMigrations() - .Any( - e => - e.MigrationId.Equals( - migration.GetId(), - StringComparison.OrdinalIgnoreCase - ) + .Any(e => + e.MigrationId.Equals( + migration.GetId(), + StringComparison.OrdinalIgnoreCase + ) ); } catch (Exception ex) when (force) diff --git a/efcore/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs b/efcore/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs index 2fc5e3c78f6..b9e5ee51f69 100644 --- a/efcore/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs +++ b/efcore/src/EFCore.Design/Query/Internal/LinqToCSharpSyntaxTranslator.cs @@ -656,10 +656,9 @@ ExpressionSyntax e // already been taken care of and removed from the list. // But there may still be variables that get assigned inside nested blocks or other situations; prepare declarations for those // and either add them to the block, or lift them if we're an expression block. - var unassignedVariableDeclarations = unassignedVariables.Select( - v => - (LocalDeclarationStatementSyntax) - _g.LocalDeclarationStatement(Translate(v.Type), LookupVariableName(v)) + var unassignedVariableDeclarations = unassignedVariables.Select(v => + (LocalDeclarationStatementSyntax) + _g.LocalDeclarationStatement(Translate(v.Type), LookupVariableName(v)) ); if (blockContext == ExpressionContext.Expression) @@ -1477,10 +1476,9 @@ protected override Expression VisitLambda(Expression lambda) Result = ParenthesizedLambdaExpression( ParameterList( SeparatedList( - lambda.Parameters.Select( - p => - Parameter(Identifier(LookupVariableName(p))) - .WithType(p.Type.IsAnonymousType() ? null : Translate(p.Type)) + lambda.Parameters.Select(p => + Parameter(Identifier(LookupVariableName(p))) + .WithType(p.Type.IsAnonymousType() ? null : Translate(p.Type)) ) ) ), @@ -1862,17 +1860,15 @@ protected override Expression VisitNew(NewExpression node) // TODO: Currently matching attributes by name since we target .NET 6.0. If/when we target .NET 7.0 and above, match the type. if ( node.Type.GetCustomAttributes(inherit: true) - .Any( - a => - a.GetType().FullName - == "System.Runtime.CompilerServices.RequiredMemberAttribute" + .Any(a => + a.GetType().FullName + == "System.Runtime.CompilerServices.RequiredMemberAttribute" ) && node.Constructor is not null && node.Constructor.GetCustomAttributes() - .Any( - a => - a.GetType().FullName - == "System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute" + .Any(a => + a.GetType().FullName + == "System.Diagnostics.CodeAnalysis.SetsRequiredMembersAttribute" ) != true ) { @@ -1992,29 +1988,25 @@ protected virtual CSharpSyntaxNode TranslateSwitch( ); var cases = List( - switchNode.Cases.Select( - c => - SwitchSection( - labels: List( - c.TestValues.Select( - tv => CaseSwitchLabel(Translate(tv)) - ) - ), - statements: ProcessArmBody(c.Body) - ) + switchNode.Cases.Select(c => + SwitchSection( + labels: List( + c.TestValues.Select(tv => + CaseSwitchLabel(Translate(tv)) + ) + ), + statements: ProcessArmBody(c.Body) + ) ) ); // LINQ SwitchExpression supports non-literal labels, which C# does not support. This rewrites the switch as a series of // nested ConditionalExpressions. if ( - cases.Any( - c => - c.Labels.Any( - l => - l is CaseSwitchLabelSyntax l2 - && !_constantDetector.IsConstant(l2.Value) - ) + cases.Any(c => + c.Labels.Any(l => + l is CaseSwitchLabelSyntax l2 && !_constantDetector.IsConstant(l2.Value) + ) ) ) { @@ -2098,10 +2090,9 @@ ExpressionSyntax e // LINQ SwitchExpression supports non-literal labels, which C# does not support. This rewrites the switch as a series of // nested ConditionalExpressions. if ( - arms.Any( - a => - a.Pattern is ConstantPatternSyntax cp - && !_constantDetector.IsConstant(cp.Expression) + arms.Any(a => + a.Pattern is ConstantPatternSyntax cp + && !_constantDetector.IsConstant(cp.Expression) ) ) { @@ -2145,19 +2136,15 @@ a.Pattern is ConstantPatternSyntax cp var cases = List( switchNode - .Cases.Select( - c => - SwitchSection( - labels: List( - c.TestValues.Select( - tv => - CaseSwitchLabel( - Translate(tv) - ) - ) - ), - statements: ProcessArmBody(c.Body) - ) + .Cases.Select(c => + SwitchSection( + labels: List( + c.TestValues.Select(tv => + CaseSwitchLabel(Translate(tv)) + ) + ), + statements: ProcessArmBody(c.Body) + ) ) .Append( SwitchSection( @@ -2445,8 +2432,8 @@ protected override Expression VisitMemberInit(MemberInitExpression memberInit) binding is MemberListBinding listBinding && ( !listBinding.Member.GetMemberType().IsAssignableTo(typeof(IEnumerable)) - || listBinding.Initializers.Any( - e => e.AddMethod.Name != "Add" || e.Arguments.Count != 1 + || listBinding.Initializers.Any(e => + e.AddMethod.Name != "Add" || e.Arguments.Count != 1 ) ) ) @@ -2500,8 +2487,8 @@ protected override Expression VisitListInit(ListInitExpression listInit) // methods. Skip these, we'll add them later outside the initializer if ( !listInit.NewExpression.Type.IsAssignableTo(typeof(IEnumerable)) - || listInit.Initializers.Any( - e => e.AddMethod.Name != "Add" || e.Arguments.Count != 1 + || listInit.Initializers.Any(e => + e.AddMethod.Name != "Add" || e.Arguments.Count != 1 ) ) { diff --git a/efcore/src/EFCore.Design/Scaffolding/Internal/ModelCodeGeneratorSelector.cs b/efcore/src/EFCore.Design/Scaffolding/Internal/ModelCodeGeneratorSelector.cs index 60ddf2bfcf5..13060bfd442 100644 --- a/efcore/src/EFCore.Design/Scaffolding/Internal/ModelCodeGeneratorSelector.cs +++ b/efcore/src/EFCore.Design/Scaffolding/Internal/ModelCodeGeneratorSelector.cs @@ -31,7 +31,7 @@ public ModelCodeGeneratorSelector(IEnumerable services) /// public virtual IModelCodeGenerator Select(ModelCodeGenerationOptions options) => - _templatedModelGenerators.LastOrDefault( - g => options.ProjectDir != null && g.HasTemplates(options.ProjectDir) + _templatedModelGenerators.LastOrDefault(g => + options.ProjectDir != null && g.HasTemplates(options.ProjectDir) ) ?? Select(options.Language); } diff --git a/efcore/src/EFCore.Design/Scaffolding/Internal/TextTemplatingEngineHost.cs b/efcore/src/EFCore.Design/Scaffolding/Internal/TextTemplatingEngineHost.cs index 4cbd18bb932..c70219eec01 100644 --- a/efcore/src/EFCore.Design/Scaffolding/Internal/TextTemplatingEngineHost.cs +++ b/efcore/src/EFCore.Design/Scaffolding/Internal/TextTemplatingEngineHost.cs @@ -192,8 +192,8 @@ public virtual string ResolveAssemblyReference(string assemblyReference) var path = DependencyContext .Default?.CompileLibraries - .FirstOrDefault( - l => l.Assemblies.Any(a => Path.GetFileNameWithoutExtension(a) == assemblyReference) + .FirstOrDefault(l => + l.Assemblies.Any(a => Path.GetFileNameWithoutExtension(a) == assemblyReference) ) ?.ResolveReferencePaths() .First(p => Path.GetFileNameWithoutExtension(p) == assemblyReference); diff --git a/efcore/src/EFCore.InMemory/Extensions/InMemoryServiceCollectionExtensions.cs b/efcore/src/EFCore.InMemory/Extensions/InMemoryServiceCollectionExtensions.cs index c3022a9c07f..c2914eb773c 100644 --- a/efcore/src/EFCore.InMemory/Extensions/InMemoryServiceCollectionExtensions.cs +++ b/efcore/src/EFCore.InMemory/Extensions/InMemoryServiceCollectionExtensions.cs @@ -60,15 +60,14 @@ this IServiceCollection serviceCollection IQueryTranslationPreprocessorFactory, InMemoryQueryTranslationPreprocessorFactory >() - .TryAdd( - p => p.GetRequiredService() + .TryAdd(p => + p.GetRequiredService() ) - .TryAddProviderSpecificServices( - b => - b.TryAddSingleton() - .TryAddSingleton() - .TryAddSingleton() - .TryAddScoped() + .TryAddProviderSpecificServices(b => + b.TryAddSingleton() + .TryAddSingleton() + .TryAddSingleton() + .TryAddScoped() ); builder.TryAddCoreServices(); diff --git a/efcore/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs b/efcore/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs index 5aa60615f9a..b0ce8521b7d 100644 --- a/efcore/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs +++ b/efcore/src/EFCore.InMemory/Query/Internal/InMemoryProjectionBindingExpressionVisitor.cs @@ -154,7 +154,9 @@ or IncludeExpression ), subquery.ShaperExpression, materializeCollectionNavigationExpression.Navigation, - materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType() + materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType( + + ) ); } diff --git a/efcore/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs b/efcore/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs index 567ba2473c2..1c5cd8e34dc 100644 --- a/efcore/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs +++ b/efcore/src/EFCore.InMemory/Storage/Internal/InMemoryTable.cs @@ -474,11 +474,10 @@ protected virtual void ThrowUpdateConcurrencyException( "{" + string.Join( ", ", - concurrencyConflicts.Select( - c => - c.Key.Name - + ": " - + Convert.ToString(c.Value, CultureInfo.InvariantCulture) + concurrencyConflicts.Select(c => + c.Key.Name + + ": " + + Convert.ToString(c.Value, CultureInfo.InvariantCulture) ) ) + "}" diff --git a/efcore/src/EFCore.Proxies/Proxies/Internal/ProxyBindingRewriter.cs b/efcore/src/EFCore.Proxies/Proxies/Internal/ProxyBindingRewriter.cs index 8c0a370709f..38277461e84 100644 --- a/efcore/src/EFCore.Proxies/Proxies/Internal/ProxyBindingRewriter.cs +++ b/efcore/src/EFCore.Proxies/Proxies/Internal/ProxyBindingRewriter.cs @@ -161,10 +161,9 @@ var navigationBase in entityType foreach ( var conflictingProperty in entityType .GetDerivedTypes() - .SelectMany( - e => - e.GetDeclaredServiceProperties() - .Where(p => p.ClrType == typeof(ILazyLoader)) + .SelectMany(e => + e.GetDeclaredServiceProperties() + .Where(p => p.ClrType == typeof(ILazyLoader)) ) .ToList() ) diff --git a/efcore/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs b/efcore/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs index dc365f874db..fdba2f93284 100644 --- a/efcore/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs +++ b/efcore/src/EFCore.Relational/Design/AnnotationCodeGenerator.cs @@ -58,12 +58,11 @@ public AnnotationCodeGenerator(AnnotationCodeGeneratorDependencies dependencies) public virtual IEnumerable FilterIgnoredAnnotations( IEnumerable annotations ) => - annotations.Where( - a => - !( - CoreAnnotationNames.AllNames.Contains(a.Name) - || IgnoredRelationalAnnotations.Contains(a.Name) - ) + annotations.Where(a => + !( + CoreAnnotationNames.AllNames.Contains(a.Name) + || IgnoredRelationalAnnotations.Contains(a.Name) + ) ); /// diff --git a/efcore/src/EFCore.Relational/Infrastructure/RelationalDbContextOptionsBuilder.cs b/efcore/src/EFCore.Relational/Infrastructure/RelationalDbContextOptionsBuilder.cs index 97c496d3a94..d6349ea35b6 100644 --- a/efcore/src/EFCore.Relational/Infrastructure/RelationalDbContextOptionsBuilder.cs +++ b/efcore/src/EFCore.Relational/Infrastructure/RelationalDbContextOptionsBuilder.cs @@ -95,12 +95,9 @@ public virtual TBuilder CommandTimeout(int? commandTimeout) => /// The name of the assembly. /// The same builder instance so that multiple calls can be chained. public virtual TBuilder MigrationsAssembly(string? assemblyName) => - WithOption( - e => - (TExtension) - e.WithMigrationsAssembly( - Check.NullButNotEmpty(assemblyName, nameof(assemblyName)) - ) + WithOption(e => + (TExtension) + e.WithMigrationsAssembly(Check.NullButNotEmpty(assemblyName, nameof(assemblyName))) ); /// @@ -117,11 +114,9 @@ public virtual TBuilder MigrationsHistoryTable(string tableName, string? schema Check.NotEmpty(tableName, nameof(tableName)); Check.NullButNotEmpty(schema, nameof(schema)); - return WithOption( - e => - (TExtension) - e.WithMigrationsHistoryTableName(tableName) - .WithMigrationsHistoryTableSchema(schema) + return WithOption(e => + (TExtension) + e.WithMigrationsHistoryTableName(tableName).WithMigrationsHistoryTableSchema(schema) ); } @@ -159,12 +154,11 @@ QuerySplittingBehavior querySplittingBehavior public virtual TBuilder ExecutionStrategy( Func getExecutionStrategy ) => - WithOption( - e => - (TExtension) - e.WithExecutionStrategyFactory( - Check.NotNull(getExecutionStrategy, nameof(getExecutionStrategy)) - ) + WithOption(e => + (TExtension) + e.WithExecutionStrategyFactory( + Check.NotNull(getExecutionStrategy, nameof(getExecutionStrategy)) + ) ); /// diff --git a/efcore/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs b/efcore/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs index 33ff1caffc1..5e83b67459c 100644 --- a/efcore/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs +++ b/efcore/src/EFCore.Relational/Infrastructure/RelationalModelValidator.cs @@ -659,11 +659,10 @@ out property ) { if ( - sproc.Parameters.Any( - p => - p.PropertyName == property.Name - && p.ForOriginalValue != parameter.ForOriginalValue - && p.Direction != ParameterDirection.Input + sproc.Parameters.Any(p => + p.PropertyName == property.Name + && p.ForOriginalValue != parameter.ForOriginalValue + && p.Direction != ParameterDirection.Input ) ) { @@ -936,8 +935,8 @@ protected override void ValidateNoMutableKeys( { foreach (var key in entityType.GetDeclaredKeys()) { - var mutableProperty = key.Properties.FirstOrDefault( - p => p.ValueGenerated.HasFlag(ValueGenerated.OnUpdate) + var mutableProperty = key.Properties.FirstOrDefault(p => + p.ValueGenerated.HasFlag(ValueGenerated.OnUpdate) ); if (mutableProperty != null && !mutableProperty.IsOrdinalKeyProperty()) { @@ -1137,11 +1136,10 @@ protected virtual void ValidateSharedTableCompatibility( && ( mappedType .FindForeignKeys(primaryKey.Properties) - .FirstOrDefault( - fk => - fk.PrincipalKey.IsPrimaryKey() - && !fk.PrincipalEntityType.IsAssignableFrom(fk.DeclaringEntityType) - && unvalidatedTypes.Contains(fk.PrincipalEntityType) + .FirstOrDefault(fk => + fk.PrincipalKey.IsPrimaryKey() + && !fk.PrincipalEntityType.IsAssignableFrom(fk.DeclaringEntityType) + && unvalidatedTypes.Contains(fk.PrincipalEntityType) ) is { } linkingFK ) @@ -1187,10 +1185,9 @@ protected virtual void ValidateSharedTableCompatibility( var comment = entityType.GetComment(); var isExcluded = entityType.IsTableExcludedFromMigrations(storeObject); var typesToValidateLeft = typesToValidate.Count; - var directlyConnectedTypes = unvalidatedTypes.Where( - unvalidatedType => - entityType.IsAssignableFrom(unvalidatedType) - || IsIdentifyingPrincipal(unvalidatedType, entityType) + var directlyConnectedTypes = unvalidatedTypes.Where(unvalidatedType => + entityType.IsAssignableFrom(unvalidatedType) + || IsIdentifyingPrincipal(unvalidatedType, entityType) ); foreach (var nextEntityType in directlyConnectedTypes) @@ -1345,10 +1342,9 @@ protected virtual void ValidateSharedViewCompatibility( mappedType.FindPrimaryKey() != null && mappedType .FindForeignKeys(mappedType.FindPrimaryKey()!.Properties) - .Any( - fk => - fk.PrincipalKey.IsPrimaryKey() - && unvalidatedTypes.Contains(fk.PrincipalEntityType) + .Any(fk => + fk.PrincipalKey.IsPrimaryKey() + && unvalidatedTypes.Contains(fk.PrincipalEntityType) ) ) { @@ -1356,10 +1352,9 @@ protected virtual void ValidateSharedViewCompatibility( { var principalType = mappedType .FindForeignKeys(mappedType.FindPrimaryKey()!.Properties) - .First( - fk => - fk.PrincipalKey.IsPrimaryKey() - && unvalidatedTypes.Contains(fk.PrincipalEntityType) + .First(fk => + fk.PrincipalKey.IsPrimaryKey() + && unvalidatedTypes.Contains(fk.PrincipalEntityType) ) .PrincipalEntityType; throw new InvalidOperationException( @@ -1397,10 +1392,9 @@ protected virtual void ValidateSharedViewCompatibility( { var entityType = typesToValidate.Dequeue(); var typesToValidateLeft = typesToValidate.Count; - var directlyConnectedTypes = unvalidatedTypes.Where( - unvalidatedType => - entityType.IsAssignableFrom(unvalidatedType) - || IsIdentifyingPrincipal(unvalidatedType, entityType) + var directlyConnectedTypes = unvalidatedTypes.Where(unvalidatedType => + entityType.IsAssignableFrom(unvalidatedType) + || IsIdentifyingPrincipal(unvalidatedType, entityType) ); foreach (var nextEntityType in directlyConnectedTypes) @@ -1438,9 +1432,8 @@ IEntityType principalEntityType ) => dependentEntityType .FindForeignKeys(dependentEntityType.FindPrimaryKey()!.Properties) - .Any( - fk => - fk.PrincipalKey.IsPrimaryKey() && fk.PrincipalEntityType == principalEntityType + .Any(fk => + fk.PrincipalKey.IsPrimaryKey() && fk.PrincipalEntityType == principalEntityType ); /// @@ -2357,8 +2350,8 @@ protected virtual void ValidateValueGeneration( ) { foreach ( - var storeGeneratedProperty in key.Properties.Where( - p => (p.ValueGenerated & ValueGenerated.OnAdd) != 0 + var storeGeneratedProperty in key.Properties.Where(p => + (p.ValueGenerated & ValueGenerated.OnAdd) != 0 ) ) { @@ -2407,21 +2400,19 @@ StoreObjectType storeObjectType .GetReferencingForeignKeys() .Where(fk => fk.IsOwnership) .Select(fk => fk.DeclaringEntityType) - .FirstOrDefault( - owned => - StoreObjectIdentifier.Create(owned, storeObjectType) == null - && ((IConventionEntityType)owned).GetStoreObjectConfigurationSource( - storeObjectType - ) == null - && !owned.IsMappedToJson() + .FirstOrDefault(owned => + StoreObjectIdentifier.Create(owned, storeObjectType) == null + && ((IConventionEntityType)owned).GetStoreObjectConfigurationSource( + storeObjectType + ) == null + && !owned.IsMappedToJson() ); if ( unmappedOwnedType != null && entityType .GetDerivedTypes() - .Any( - derived => - StoreObjectIdentifier.Create(derived, storeObjectType) != null + .Any(derived => + StoreObjectIdentifier.Create(derived, storeObjectType) != null ) ) { @@ -3122,10 +3113,9 @@ entityType.BaseType is not null (trigger.GetTableName() != tableName || trigger.GetTableSchema() != tableSchema) && entityType .GetMappingFragments(StoreObjectType.Table) - .All( - f => - trigger.GetTableName() != f.StoreObject.Name - || trigger.GetTableSchema() != f.StoreObject.Schema + .All(f => + trigger.GetTableName() != f.StoreObject.Name + || trigger.GetTableSchema() != f.StoreObject.Schema ) ) { @@ -3206,10 +3196,9 @@ protected virtual void ValidateJsonEntities( var rootType = distinctRootTypes[0]; var jsonEntitiesMappedToSameJsonColumn = mappedTypes - .Where( - x => - x.FindOwnership() is IForeignKey ownership - && !ownership.PrincipalEntityType.IsOwned() + .Where(x => + x.FindOwnership() is IForeignKey ownership + && !ownership.PrincipalEntityType.IsOwned() ) .GroupBy(x => x.GetContainerColumnName()) .Where(x => x.Key is not null) @@ -3248,11 +3237,10 @@ is string jsonEntityMappedToSameJsonColumn private void ValidateJsonEntitiesNotMappedToTableOrView(IEnumerable entityTypes) { - var entitiesNotMappedToTableOrView = entityTypes.Where( - x => - !x.IsMappedToJson() - && x.GetSchemaQualifiedTableName() == null - && x.GetSchemaQualifiedViewName() == null + var entitiesNotMappedToTableOrView = entityTypes.Where(x => + !x.IsMappedToJson() + && x.GetSchemaQualifiedTableName() == null + && x.GetSchemaQualifiedViewName() == null ); foreach (var entityNotMappedToTableOrView in entitiesNotMappedToTableOrView) diff --git a/efcore/src/EFCore.Relational/Metadata/Conventions/EntityTypeHierarchyMappingConvention.cs b/efcore/src/EFCore.Relational/Metadata/Conventions/EntityTypeHierarchyMappingConvention.cs index 6f833629067..4a851a31555 100644 --- a/efcore/src/EFCore.Relational/Metadata/Conventions/EntityTypeHierarchyMappingConvention.cs +++ b/efcore/src/EFCore.Relational/Metadata/Conventions/EntityTypeHierarchyMappingConvention.cs @@ -98,11 +98,10 @@ IConventionContext context pk != null && !entityType .FindDeclaredForeignKeys(pk.Properties) - .Any( - fk => - fk.PrincipalKey.IsPrimaryKey() - && fk.PrincipalEntityType.IsAssignableFrom(entityType) - && fk.PrincipalEntityType != entityType + .Any(fk => + fk.PrincipalKey.IsPrimaryKey() + && fk.PrincipalEntityType.IsAssignableFrom(entityType) + && fk.PrincipalEntityType != entityType ) ) { diff --git a/efcore/src/EFCore.Relational/Metadata/ITableIndex.cs b/efcore/src/EFCore.Relational/Metadata/ITableIndex.cs index 77ec3f3ba73..7d837c04478 100644 --- a/efcore/src/EFCore.Relational/Metadata/ITableIndex.cs +++ b/efcore/src/EFCore.Relational/Metadata/ITableIndex.cs @@ -82,9 +82,8 @@ string ToDebugString( ", ", Enumerable .Range(0, Columns.Count) - .Select( - i => - $@"'{Columns[i].Name}'{( + .Select(i => + $@"'{Columns[i].Name}'{( MappedIndexes.First() is not RuntimeIndex && IsDescending is not null && (IsDescending.Count == 0 || IsDescending[i]) diff --git a/efcore/src/EFCore.Relational/Metadata/Internal/RelationalForeignKeyExtensions.cs b/efcore/src/EFCore.Relational/Metadata/Internal/RelationalForeignKeyExtensions.cs index 2caa860e9ae..19f521164a9 100644 --- a/efcore/src/EFCore.Relational/Metadata/Internal/RelationalForeignKeyExtensions.cs +++ b/efcore/src/EFCore.Relational/Metadata/Internal/RelationalForeignKeyExtensions.cs @@ -251,8 +251,8 @@ is not { } duplicatePrincipalColumns .Where(t => t != null); if ( foreignKey.GetConstraintName() != null - && derivedTables.All( - t => foreignKey.GetConstraintName(t!.Value, principalTable) == null + && derivedTables.All(t => + foreignKey.GetConstraintName(t!.Value, principalTable) == null ) ) { diff --git a/efcore/src/EFCore.Relational/Metadata/Internal/RelationalKeyExtensions.cs b/efcore/src/EFCore.Relational/Metadata/Internal/RelationalKeyExtensions.cs index af6b1b33d2e..b82c91561fd 100644 --- a/efcore/src/EFCore.Relational/Metadata/Internal/RelationalKeyExtensions.cs +++ b/efcore/src/EFCore.Relational/Metadata/Internal/RelationalKeyExtensions.cs @@ -176,10 +176,9 @@ bool shouldThrow var table = storeObject; if ( key.DeclaringEntityType.GetMappingFragments(StoreObjectType.Table) - .Any( - t => - t.StoreObject != table - && key.Properties.GetColumnNames(t.StoreObject) != null + .Any(t => + t.StoreObject != table + && key.Properties.GetColumnNames(t.StoreObject) != null ) ) { diff --git a/efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs b/efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs index fb69ab1a299..9d7f2ce5b2e 100644 --- a/efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs +++ b/efcore/src/EFCore.Relational/Migrations/Internal/MigrationsModelDiffer.cs @@ -287,10 +287,9 @@ DiffContext diffContext continue; } - var principalCreateTableOperation = createTableOperations.FirstOrDefault( - o => - o.Name == addForeignKeyOperation.PrincipalTable - && o.Schema == addForeignKeyOperation.PrincipalSchema + var principalCreateTableOperation = createTableOperations.FirstOrDefault(o => + o.Name == addForeignKeyOperation.PrincipalTable + && o.Schema == addForeignKeyOperation.PrincipalSchema ); if (principalCreateTableOperation != null) { @@ -613,16 +612,14 @@ DiffContext diffContext StringComparison.OrdinalIgnoreCase ), (s, t, _) => - s.EntityTypeMappings.Any( - se => - t.EntityTypeMappings.Any( - te => - string.Equals( - se.TypeBase.Name, - te.TypeBase.Name, - StringComparison.OrdinalIgnoreCase - ) + s.EntityTypeMappings.Any(se => + t.EntityTypeMappings.Any(te => + string.Equals( + se.TypeBase.Name, + te.TypeBase.Name, + StringComparison.OrdinalIgnoreCase ) + ) ) ); @@ -933,8 +930,8 @@ var linkingForeignKey in table.GetReferencingRowInternalForeignKeys(entityType) var sortedPropertyInfos = graph.TopologicalSort().SelectMany(e => types[e].Values).ToList(); return sortedPropertyInfos - .Select( - pi => primaryKeyPropertyGroups.ContainsKey(pi) ? primaryKeyPropertyGroups[pi] : null + .Select(pi => + primaryKeyPropertyGroups.ContainsKey(pi) ? primaryKeyPropertyGroups[pi] : null ) // ReSharper disable once RedundantEnumerableCastCall .Where(e => e != null) @@ -942,10 +939,9 @@ var linkingForeignKey in table.GetReferencingRowInternalForeignKeys(entityType) .Concat(leastPriorityPrimaryKeyProperties) .Concat( sortedPropertyInfos - .Where( - pi => - !primaryKeyPropertyGroups.ContainsKey(pi) - && entityType.ClrType.IsAssignableFrom(pi.DeclaringType) + .Where(pi => + !primaryKeyPropertyGroups.ContainsKey(pi) + && entityType.ClrType.IsAssignableFrom(pi.DeclaringType) ) .SelectMany(p => groups[p]) ) @@ -957,10 +953,9 @@ var linkingForeignKey in table.GetReferencingRowInternalForeignKeys(entityType) ) .Concat( sortedPropertyInfos - .Where( - pi => - !primaryKeyPropertyGroups.ContainsKey(pi) - && !entityType.ClrType.IsAssignableFrom(pi.DeclaringType) + .Where(pi => + !primaryKeyPropertyGroups.ContainsKey(pi) + && !entityType.ClrType.IsAssignableFrom(pi.DeclaringType) ) .SelectMany(p => groups[p]) ); @@ -1017,51 +1012,45 @@ DiffContext diffContext Remove, (s, t, _) => string.Equals(s.Name, t.Name, StringComparison.OrdinalIgnoreCase), (s, t, c) => - s.PropertyMappings.Any( - sm => - t.PropertyMappings.Any( - tm => - string.Equals( - sm.Property.Name, - tm.Property.Name, - StringComparison.OrdinalIgnoreCase - ) - && EntityTypePathEquals( - sm.Property.DeclaringType, - tm.Property.DeclaringType, - c - ) + s.PropertyMappings.Any(sm => + t.PropertyMappings.Any(tm => + string.Equals( + sm.Property.Name, + tm.Property.Name, + StringComparison.OrdinalIgnoreCase ) + && EntityTypePathEquals( + sm.Property.DeclaringType, + tm.Property.DeclaringType, + c + ) + ) ), (s, t, _) => - s.PropertyMappings.Any( - sm => - t.PropertyMappings.Any( - tm => - string.Equals( - sm.Property.Name, - tm.Property.Name, - StringComparison.OrdinalIgnoreCase - ) + s.PropertyMappings.Any(sm => + t.PropertyMappings.Any(tm => + string.Equals( + sm.Property.Name, + tm.Property.Name, + StringComparison.OrdinalIgnoreCase ) + ) ), (s, t, c) => ColumnStructureEquals(s, t) - && s.PropertyMappings.Any( - sm => - t.PropertyMappings.Any( - tm => - string.Equals( - sm.Property.Name, - tm.Property.Name, - StringComparison.OrdinalIgnoreCase - ) - && EntityTypePathEquals( - sm.Property.DeclaringType, - tm.Property.DeclaringType, - c - ) + && s.PropertyMappings.Any(sm => + t.PropertyMappings.Any(tm => + string.Equals( + sm.Property.Name, + tm.Property.Name, + StringComparison.OrdinalIgnoreCase ) + && EntityTypePathEquals( + sm.Property.DeclaringType, + tm.Property.DeclaringType, + c + ) + ) ), (s, t, _) => ColumnStructureEquals(s, t) && ColumnAnnotationsEqual(s, t, matchValues: true), @@ -2257,8 +2246,8 @@ property.DeclaringType as IEntityType } } - var existingColumnModification = command.ColumnModifications.FirstOrDefault( - c => c.ColumnName == column.Name + var existingColumnModification = command.ColumnModifications.FirstOrDefault(c => + c.ColumnName == column.Name ); if (existingColumnModification != null) { @@ -2445,8 +2434,8 @@ out var foundSourceIdentityMap { for (var i = 0; i < keyValues.Length; i++) { - var modification = targetRow.ColumnModifications.First( - m => m.ColumnName == key.Columns[i].Name + var modification = targetRow.ColumnModifications.First(m => + m.ColumnName == key.Columns[i].Name ); keyValues[i] = modification.Value; } @@ -2508,8 +2497,8 @@ out var foundSourceIdentityMap continue; } - var sourceColumnModification = sourceRow.ColumnModifications.FirstOrDefault( - m => m.ColumnName == sourceColumn.Name + var sourceColumnModification = sourceRow.ColumnModifications.FirstOrDefault(m => + m.ColumnName == sourceColumn.Name ); if (sourceColumnModification == null) { @@ -2615,13 +2604,9 @@ DiffContext diffContext var commands = identityMaps .Values.SelectMany(m => m.Rows) - .Where( - r => - r.EntityState is EntityState.Added or EntityState.Modified - || ( - r.EntityState is EntityState.Deleted - && diffContext.FindDrop(r.Table!) == null - ) + .Where(r => + r.EntityState is EntityState.Added or EntityState.Modified + || (r.EntityState is EntityState.Deleted && diffContext.FindDrop(r.Table!) == null) ); var commandSets = new CommandBatchPreparer( @@ -2736,8 +2721,8 @@ r.EntityState is EntityState.Deleted var keyColumns = command .ColumnModifications.Where(col => col.IsKey) .Select(c => (IColumn)c.Column!); - var anyKeyColumnDropped = keyColumns.Any( - c => diffContext.FindDrop(c) != null + var anyKeyColumnDropped = keyColumns.Any(c => + diffContext.FindDrop(c) != null ); yield return new DeleteDataOperation @@ -2858,13 +2843,12 @@ IEnumerable target var unmatched = new List(target); foreach (var annotation in source) { - var index = unmatched.FindIndex( - a => - a.Name == annotation.Name - && StructuralComparisons.StructuralEqualityComparer.Equals( - a.Value, - annotation.Value - ) + var index = unmatched.FindIndex(a => + a.Name == annotation.Name + && StructuralComparisons.StructuralEqualityComparer.Equals( + a.Value, + annotation.Value + ) ); if (index == -1) { @@ -2957,8 +2941,8 @@ private static string BuildValuesString(object?[] values) => "{" + string.Join( ", ", - values.Select( - p => p == null ? "" : Convert.ToString(p, CultureInfo.InvariantCulture) + values.Select(p => + p == null ? "" : Convert.ToString(p, CultureInfo.InvariantCulture) ) ) + "}"; diff --git a/efcore/src/EFCore.Relational/Query/Internal/RelationalProjectionBindingExpressionVisitor.cs b/efcore/src/EFCore.Relational/Query/Internal/RelationalProjectionBindingExpressionVisitor.cs index c96a2c4fef6..c530df7864d 100644 --- a/efcore/src/EFCore.Relational/Query/Internal/RelationalProjectionBindingExpressionVisitor.cs +++ b/efcore/src/EFCore.Relational/Query/Internal/RelationalProjectionBindingExpressionVisitor.cs @@ -158,7 +158,9 @@ SqlExpression mappedSqlExpression case MaterializeCollectionNavigationExpression materializeCollectionNavigationExpression: if ( - materializeCollectionNavigationExpression.Navigation.TargetEntityType.IsMappedToJson() + materializeCollectionNavigationExpression.Navigation.TargetEntityType.IsMappedToJson( + + ) ) { var subquery = materializeCollectionNavigationExpression.Subquery; @@ -206,7 +208,9 @@ is MethodCallExpression selectSourceMethod jsonQueryExpression.Type ), materializeCollectionNavigationExpression.Navigation, - materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType() + materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType( + + ) ); } } @@ -225,7 +229,9 @@ is MethodCallExpression selectSourceMethod expression.Type ), materializeCollectionNavigationExpression.Navigation, - materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType() + materializeCollectionNavigationExpression.Navigation.ClrType.GetSequenceType( + + ) ); } diff --git a/efcore/src/EFCore.Relational/Query/Internal/SelectExpressionPruningExpressionVisitor.cs b/efcore/src/EFCore.Relational/Query/Internal/SelectExpressionPruningExpressionVisitor.cs index 79a9dfe4981..dcd5f0fa702 100644 --- a/efcore/src/EFCore.Relational/Query/Internal/SelectExpressionPruningExpressionVisitor.cs +++ b/efcore/src/EFCore.Relational/Query/Internal/SelectExpressionPruningExpressionVisitor.cs @@ -46,9 +46,10 @@ public class SelectExpressionPruningExpressionVisitor : ExpressionVisitor return updateExpression.Update( updateExpression.SelectExpression.Prune(), updateExpression - .ColumnValueSetters.Select( - e => new ColumnValueSetter(e.Column, (SqlExpression)Visit(e.Value)) - ) + .ColumnValueSetters.Select(e => new ColumnValueSetter( + e.Column, + (SqlExpression)Visit(e.Value) + )) .ToList() ); diff --git a/efcore/src/EFCore.Relational/Query/Internal/SqlExpressionSimplifyingExpressionVisitor.cs b/efcore/src/EFCore.Relational/Query/Internal/SqlExpressionSimplifyingExpressionVisitor.cs index 102d5a6dd42..aca146d404c 100644 --- a/efcore/src/EFCore.Relational/Query/Internal/SqlExpressionSimplifyingExpressionVisitor.cs +++ b/efcore/src/EFCore.Relational/Query/Internal/SqlExpressionSimplifyingExpressionVisitor.cs @@ -120,21 +120,17 @@ private static bool IsCompareTo([NotNullWhen(true)] CaseExpression? caseExpressi { if ( caseExpression is { Operand: null, ElseResult: null, WhenClauses.Count: 3 } - && caseExpression.WhenClauses.All( - c => - c is { Test: SqlBinaryExpression, Result: SqlConstantExpression { Value: int } } + && caseExpression.WhenClauses.All(c => + c is { Test: SqlBinaryExpression, Result: SqlConstantExpression { Value: int } } ) ) { var whenClauses = caseExpression - .WhenClauses.Select( - c => - new - { - Test = (SqlBinaryExpression)c.Test, - ResultValue = (int)((SqlConstantExpression)c.Result).Value! - } - ) + .WhenClauses.Select(c => new + { + Test = (SqlBinaryExpression)c.Test, + ResultValue = (int)((SqlConstantExpression)c.Result).Value! + }) .ToList(); if ( @@ -261,8 +257,8 @@ sqlBinaryExpression.Left as CaseExpression && caseComponent is { Operand: null, ElseResult: null } ) { - var matchingCaseBlock = caseComponent.WhenClauses.FirstOrDefault( - wc => sqlConstantComponent.Equals(wc.Result) + var matchingCaseBlock = caseComponent.WhenClauses.FirstOrDefault(wc => + sqlConstantComponent.Equals(wc.Result) ); if (matchingCaseBlock != null) { diff --git a/efcore/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs b/efcore/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs index 5f99ac0e275..cb9181bf2b5 100644 --- a/efcore/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs +++ b/efcore/src/EFCore.Relational/Query/RelationalMethodCallTranslatorProvider.cs @@ -81,8 +81,8 @@ RelationalMethodCallTranslatorProviderDependencies dependencies return translation; } - var argumentsPropagateNullability = dbFunction.Parameters.Select( - p => p.PropagatesNullability + var argumentsPropagateNullability = dbFunction.Parameters.Select(p => + p.PropagatesNullability ); return dbFunction.IsBuiltIn diff --git a/efcore/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs b/efcore/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs index 09a096c76f1..517878c5e08 100644 --- a/efcore/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs +++ b/efcore/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs @@ -3696,11 +3696,10 @@ out var typeMapping return ApplyTypeMappingsOnValuesExpression( valuesExpression, stripOrdering: _currentSelectExpression is { Limit: null, Offset: null } - && !_currentSelectExpression.Projection.Any( - p => - p.Expression - is ColumnExpression { Name: ValuesOrderingColumnName } c - && c.Table == valuesExpression + && !_currentSelectExpression.Projection.Any(p => + p.Expression + is ColumnExpression { Name: ValuesOrderingColumnName } c + && c.Table == valuesExpression ) ); diff --git a/efcore/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs b/efcore/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs index 5778c7c4d52..2787c3c265f 100644 --- a/efcore/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs +++ b/efcore/src/EFCore.Relational/Query/RelationalSqlTranslatingExpressionVisitor.cs @@ -1462,11 +1462,10 @@ is CaseExpression caseExpression ) { var matchingCaseWhenClauses = caseExpression - .WhenClauses.Where( - wc => - discriminatorValues.Contains( - (string)((SqlConstantExpression)wc.Result).Value! - ) + .WhenClauses.Where(wc => + discriminatorValues.Contains( + (string)((SqlConstantExpression)wc.Result).Value! + ) ) .ToList(); @@ -1509,8 +1508,7 @@ is CaseExpression caseExpression : _sqlExpressionFactory.In( discriminatorColumn, concreteEntityTypes - .Select( - et => _sqlExpressionFactory.Constant(et.GetDiscriminatorValue()) + .Select(et => _sqlExpressionFactory.Constant(et.GetDiscriminatorValue()) ) .ToArray() ); @@ -1710,13 +1708,12 @@ typeReference.StructuralType is not IEntityType entityType { condition = allRequiredNonPkProperties .Select(p => projection.BindProperty(p)) - .Select( - c => - (SqlExpression) - _sqlExpressionFactory.NotEqual( - c, - _sqlExpressionFactory.Constant(null) - ) + .Select(c => + (SqlExpression) + _sqlExpressionFactory.NotEqual( + c, + _sqlExpressionFactory.Constant(null) + ) ) .Aggregate((a, b) => _sqlExpressionFactory.AndAlso(a, b)); } @@ -1730,13 +1727,12 @@ typeReference.StructuralType is not IEntityType entityType var atLeastOneNonNullValueInNullableColumnsCondition = nonPrincipalSharedNonPkProperties .Select(p => projection.BindProperty(p)) - .Select( - c => - (SqlExpression) - _sqlExpressionFactory.NotEqual( - c, - _sqlExpressionFactory.Constant(null) - ) + .Select(c => + (SqlExpression) + _sqlExpressionFactory.NotEqual( + c, + _sqlExpressionFactory.Constant(null) + ) ) .Aggregate((a, b) => _sqlExpressionFactory.OrElse(a, b)); @@ -2374,16 +2370,12 @@ nonNullEntityReference is if (requiredNonPkProperties.Count > 0) { condition = requiredNonPkProperties - .Select( - p => - Infrastructure.ExpressionExtensions.CreateEqualsExpression( - CreatePropertyAccessExpression( - nonNullEntityReference, - p - ), - Expression.Constant(null, p.ClrType.MakeNullable()), - nodeType != ExpressionType.Equal - ) + .Select(p => + Infrastructure.ExpressionExtensions.CreateEqualsExpression( + CreatePropertyAccessExpression(nonNullEntityReference, p), + Expression.Constant(null, p.ClrType.MakeNullable()), + nodeType != ExpressionType.Equal + ) ) .Aggregate( (l, r) => @@ -2406,16 +2398,12 @@ nonNullEntityReference is // - if entity is to be null, all the properties must be null // - if the entity is to be not null, at least one property must be not null var optionalPropertiesCondition = allNonPrincipalSharedNonPkProperties - .Select( - p => - Infrastructure.ExpressionExtensions.CreateEqualsExpression( - CreatePropertyAccessExpression( - nonNullEntityReference, - p - ), - Expression.Constant(null, p.ClrType.MakeNullable()), - nodeType != ExpressionType.Equal - ) + .Select(p => + Infrastructure.ExpressionExtensions.CreateEqualsExpression( + CreatePropertyAccessExpression(nonNullEntityReference, p), + Expression.Constant(null, p.ClrType.MakeNullable()), + nodeType != ExpressionType.Equal + ) ) .Aggregate( (l, r) => @@ -2448,13 +2436,12 @@ nonNullEntityReference is result = Visit( nullComparedEntityTypePrimaryKeyProperties - .Select( - p => - Infrastructure.ExpressionExtensions.CreateEqualsExpression( - CreatePropertyAccessExpression(nonNullEntityReference, p), - Expression.Constant(null, p.ClrType.MakeNullable()), - nodeType != ExpressionType.Equal - ) + .Select(p => + Infrastructure.ExpressionExtensions.CreateEqualsExpression( + CreatePropertyAccessExpression(nonNullEntityReference, p), + Expression.Constant(null, p.ClrType.MakeNullable()), + nodeType != ExpressionType.Equal + ) ) .Aggregate( (l, r) => @@ -2524,13 +2511,12 @@ nonNullEntityReference is result = Visit( primaryKeyProperties - .Select( - p => - Infrastructure.ExpressionExtensions.CreateEqualsExpression( - CreatePropertyAccessExpression(left, p), - CreatePropertyAccessExpression(right, p), - nodeType != ExpressionType.Equal - ) + .Select(p => + Infrastructure.ExpressionExtensions.CreateEqualsExpression( + CreatePropertyAccessExpression(left, p), + CreatePropertyAccessExpression(right, p), + nodeType != ExpressionType.Equal + ) ) .Aggregate( (l, r) => @@ -2712,8 +2698,8 @@ when sqlParameterExpression.Name.StartsWith( } case MemberInitExpression memberInitExpression - when memberInitExpression.Bindings.SingleOrDefault( - mb => mb.Member.Name == property.Name + when memberInitExpression.Bindings.SingleOrDefault(mb => + mb.Member.Name == property.Name ) is MemberAssignment memberAssignment: return memberAssignment.Expression; @@ -2748,8 +2734,8 @@ when sqlParameterExpression.Name.StartsWith( ), MemberInitExpression memberInitExpression - when memberInitExpression.Bindings.SingleOrDefault( - mb => mb.Member.Name == complexProperty.Name + when memberInitExpression.Bindings.SingleOrDefault(mb => + mb.Member.Name == complexProperty.Name ) is MemberAssignment memberAssignment => memberAssignment.Expression, @@ -2829,10 +2815,9 @@ private static bool CanEvaluate(Expression expression) => NewArrayExpression e => e.Expressions.All(CanEvaluate), MemberInitExpression e => CanEvaluate(e.NewExpression) - && e.Bindings.All( - mb => - mb is MemberAssignment memberAssignment - && CanEvaluate(memberAssignment.Expression) + && e.Bindings.All(mb => + mb is MemberAssignment memberAssignment + && CanEvaluate(memberAssignment.Expression) ), _ => false }; diff --git a/efcore/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs b/efcore/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs index 552adcf608e..d4bc124c4ef 100644 --- a/efcore/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs +++ b/efcore/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.Helper.cs @@ -895,9 +895,10 @@ private sealed class CloningExpressionVisitor : ExpressionVisitor // In other cases (like VisitChildren), we just reuse the same table references and update the SelectExpression inside it. // We initially assign old SelectExpression in table references and later update it once we construct clone var newTableReferences = selectExpression - ._tableReferences.Select( - e => new TableReferenceExpression(selectExpression, e.Alias) - ) + ._tableReferences.Select(e => new TableReferenceExpression( + selectExpression, + e.Alias + )) .ToList(); Check.DebugAssert( newTables @@ -1144,13 +1145,12 @@ expression is SelectExpression var identityMap = true; for (var i = 0; i < selectExpression.Projection.Count; i++) { - var newIndex = innerProjections.FindIndex( - e => - string.Equals( - e, - selectExpression.Projection[i].Alias, - StringComparison.Ordinal - ) + var newIndex = innerProjections.FindIndex(e => + string.Equals( + e, + selectExpression.Projection[i].Alias, + StringComparison.Ordinal + ) ); if (newIndex == -1) { @@ -1233,8 +1233,8 @@ expression is SelectExpression { result.Alias = tpcTablesExpression.Alias; - var tableIndex = selectExpression._tables.FindIndex( - teb => ReferenceEquals(UnwrapJoinExpression(teb), tpcTablesExpression) + var tableIndex = selectExpression._tables.FindIndex(teb => + ReferenceEquals(UnwrapJoinExpression(teb), tpcTablesExpression) ); var table = selectExpression._tables[tableIndex]; selectExpression._tables[tableIndex] = (TableExpressionBase) diff --git a/efcore/src/EFCore.Relational/Query/SqlNullabilityProcessor.cs b/efcore/src/EFCore.Relational/Query/SqlNullabilityProcessor.cs index c720933e260..f6e8fb77ed3 100644 --- a/efcore/src/EFCore.Relational/Query/SqlNullabilityProcessor.cs +++ b/efcore/src/EFCore.Relational/Query/SqlNullabilityProcessor.cs @@ -2373,17 +2373,16 @@ bool operandNullable // (a ?? b ?? c) == null -> a == null && b == null && c == null // (a ?? b ?? c) != null -> a != null || b != null || c != null return sqlFunctionExpression - .Arguments.Select( - a => - ProcessNullNotNull( - _sqlExpressionFactory.MakeUnary( - sqlUnaryExpression.OperatorType, - a, - typeof(bool), - sqlUnaryExpression.TypeMapping - )!, - operandNullable - ) + .Arguments.Select(a => + ProcessNullNotNull( + _sqlExpressionFactory.MakeUnary( + sqlUnaryExpression.OperatorType, + a, + typeof(bool), + sqlUnaryExpression.TypeMapping + )!, + operandNullable + ) ) .Aggregate( (l, r) => @@ -2440,17 +2439,16 @@ sqlFunctionExpression is if (nullabilityPropagationElements.Count > 0) { var result = nullabilityPropagationElements - .Select( - e => - ProcessNullNotNull( - _sqlExpressionFactory.MakeUnary( - sqlUnaryExpression.OperatorType, - e, - sqlUnaryExpression.Type, - sqlUnaryExpression.TypeMapping - )!, - operandNullable - ) + .Select(e => + ProcessNullNotNull( + _sqlExpressionFactory.MakeUnary( + sqlUnaryExpression.OperatorType, + e, + sqlUnaryExpression.Type, + sqlUnaryExpression.TypeMapping + )!, + operandNullable + ) ) .Aggregate( (r, e) => diff --git a/efcore/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs b/efcore/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs index c0b49540d75..c519f5bb2be 100644 --- a/efcore/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs +++ b/efcore/src/EFCore.Relational/Update/Internal/ColumnAccessorsFactory.cs @@ -72,8 +72,7 @@ private static Func< return (value, valueFound); } - var modification = c.ColumnModifications.FirstOrDefault( - m => m.ColumnName == column.Name + var modification = c.ColumnModifications.FirstOrDefault(m => m.ColumnName == column.Name ); return modification == null ? (default, false) @@ -123,8 +122,7 @@ private static Func< return (value, valueFound); } - var modification = c.ColumnModifications.FirstOrDefault( - m => m.ColumnName == column.Name + var modification = c.ColumnModifications.FirstOrDefault(m => m.ColumnName == column.Name ); return modification == null ? (default!, false) diff --git a/efcore/src/EFCore.Relational/Update/Internal/CompositeRowValueFactory.cs b/efcore/src/EFCore.Relational/Update/Internal/CompositeRowValueFactory.cs index 5f33092b52f..498686a2995 100644 --- a/efcore/src/EFCore.Relational/Update/Internal/CompositeRowValueFactory.cs +++ b/efcore/src/EFCore.Relational/Update/Internal/CompositeRowValueFactory.cs @@ -225,8 +225,8 @@ out bool hasNullValue } else { - var modification = command.ColumnModifications.FirstOrDefault( - m => m.ColumnName == column.Name + var modification = command.ColumnModifications.FirstOrDefault(m => + m.ColumnName == column.Name ); if (modification == null) { diff --git a/efcore/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs b/efcore/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs index 5d0d7352529..338c5a3a458 100644 --- a/efcore/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs +++ b/efcore/src/EFCore.Relational/Update/ReaderModificationCommandBatch.cs @@ -295,8 +295,8 @@ public override void Complete(bool moreBatchesExpected) protected virtual void AddParameters(IReadOnlyModificationCommand modificationCommand) { Check.DebugAssert( - !modificationCommand.ColumnModifications.Any( - m => m.Column is IStoreStoredProcedureReturnValue + !modificationCommand.ColumnModifications.Any(m => + m.Column is IStoreStoredProcedureReturnValue ) || modificationCommand.ColumnModifications[0].Column is IStoreStoredProcedureReturnValue, @@ -305,8 +305,8 @@ protected virtual void AddParameters(IReadOnlyModificationCommand modificationCo var modifications = modificationCommand.StoreStoredProcedure is null ? modificationCommand.ColumnModifications - : modificationCommand.ColumnModifications.Where( - c => c.Column is IStoreStoredProcedureParameter or IStoreStoredProcedureReturnValue + : modificationCommand.ColumnModifications.Where(c => + c.Column is IStoreStoredProcedureParameter or IStoreStoredProcedureReturnValue ); foreach (var columnModification in modifications) diff --git a/efcore/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs b/efcore/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs index 01afa19b211..40260a46b14 100644 --- a/efcore/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs +++ b/efcore/src/EFCore.SqlServer/Extensions/SqlServerPropertyExtensions.cs @@ -874,17 +874,16 @@ internal static SqlServerValueGenerationStrategy GetValueGenerationStrategy( && table.StoreObjectType == StoreObjectType.Table && !property .GetContainingForeignKeys() - .Any( - fk => - !fk.IsBaseLinking() - || ( - StoreObjectIdentifier.Create( - fk.PrincipalEntityType, - StoreObjectType.Table - ) - is StoreObjectIdentifier principal - && fk.GetConstraintName(table, principal) != null + .Any(fk => + !fk.IsBaseLinking() + || ( + StoreObjectIdentifier.Create( + fk.PrincipalEntityType, + StoreObjectType.Table ) + is StoreObjectIdentifier principal + && fk.GetConstraintName(table, principal) != null + ) ) ? SqlServerValueGenerationStrategy.IdentityColumn : SqlServerValueGenerationStrategy.None; @@ -898,17 +897,13 @@ is StoreObjectIdentifier principal || property.GetComputedColumnSql(storeObject) != null || property .GetContainingForeignKeys() - .Any( - fk => - !fk.IsBaseLinking() - || ( - StoreObjectIdentifier.Create( - fk.PrincipalEntityType, - StoreObjectType.Table - ) - is StoreObjectIdentifier principal - && fk.GetConstraintName(table, principal) != null - ) + .Any(fk => + !fk.IsBaseLinking() + || ( + StoreObjectIdentifier.Create(fk.PrincipalEntityType, StoreObjectType.Table) + is StoreObjectIdentifier principal + && fk.GetConstraintName(table, principal) != null + ) ) ) { diff --git a/efcore/src/EFCore.SqlServer/Metadata/Conventions/SqlServerOutputClauseConvention.cs b/efcore/src/EFCore.SqlServer/Metadata/Conventions/SqlServerOutputClauseConvention.cs index 1cde65624fc..1964fae9b09 100644 --- a/efcore/src/EFCore.SqlServer/Metadata/Conventions/SqlServerOutputClauseConvention.cs +++ b/efcore/src/EFCore.SqlServer/Metadata/Conventions/SqlServerOutputClauseConvention.cs @@ -71,10 +71,9 @@ IConventionContext context if ( !entityType .GetDeclaredTriggers() - .Any( - t => - t.GetTableName() == trigger.GetTableName() - && t.GetTableSchema() == trigger.GetTableSchema() + .Any(t => + t.GetTableName() == trigger.GetTableName() + && t.GetTableSchema() == trigger.GetTableSchema() ) ) { diff --git a/efcore/src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationProvider.cs b/efcore/src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationProvider.cs index 95636bcf183..cf09d4ae77a 100644 --- a/efcore/src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationProvider.cs +++ b/efcore/src/EFCore.SqlServer/Metadata/Internal/SqlServerAnnotationProvider.cs @@ -72,10 +72,9 @@ public override IEnumerable For(IRelationalModel model, bool design } if ( - model.Tables.Any( - t => - !t.IsExcludedFromMigrations - && (t[SqlServerAnnotationNames.MemoryOptimized] as bool? == true) + model.Tables.Any(t => + !t.IsExcludedFromMigrations + && (t[SqlServerAnnotationNames.MemoryOptimized] as bool? == true) ) ) { @@ -206,11 +205,10 @@ public override IEnumerable For(ITableIndex index, bool designTime) if (modelIndex.GetIncludeProperties(table) is IReadOnlyList includeProperties) { var includeColumns = includeProperties - .Select( - p => - modelIndex - .DeclaringEntityType.FindProperty(p)! - .GetColumnName(StoreObjectIdentifier.Table(table.Name, table.Schema)) + .Select(p => + modelIndex + .DeclaringEntityType.FindProperty(p)! + .GetColumnName(StoreObjectIdentifier.Table(table.Name, table.Schema)) ) .ToArray(); @@ -257,10 +255,9 @@ public override IEnumerable For(IColumn column, bool designTime) var table = StoreObjectIdentifier.Table(column.Table.Name, column.Table.Schema); var identityProperty = column .PropertyMappings.Select(m => m.Property) - .FirstOrDefault( - p => - p.GetValueGenerationStrategy(table) - == SqlServerValueGenerationStrategy.IdentityColumn + .FirstOrDefault(p => + p.GetValueGenerationStrategy(table) + == SqlServerValueGenerationStrategy.IdentityColumn ); if (identityProperty != null) { diff --git a/efcore/src/EFCore.SqlServer/Query/Internal/SqlServerJsonPostprocessor.cs b/efcore/src/EFCore.SqlServer/Query/Internal/SqlServerJsonPostprocessor.cs index b1efab2ac2a..8237edbead3 100644 --- a/efcore/src/EFCore.SqlServer/Query/Internal/SqlServerJsonPostprocessor.cs +++ b/efcore/src/EFCore.SqlServer/Query/Internal/SqlServerJsonPostprocessor.cs @@ -102,8 +102,8 @@ is SqlServerOpenJsonExpression .Any(x => IsKeyColumn(x, table)) || // Condition 2: a column type in the WITH clause is a SQL Server "CLR type" (e.g. hierarchy id). - openJsonExpression.ColumnInfos.Any( - c => c.TypeMapping.StoreType is "hierarchyid" + openJsonExpression.ColumnInfos.Any(c => + c.TypeMapping.StoreType is "hierarchyid" ) ) ) diff --git a/efcore/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs b/efcore/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs index e65ced74e0d..529d508344c 100644 --- a/efcore/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs +++ b/efcore/src/EFCore.SqlServer/Storage/Internal/SqlServerTypeMappingSource.cs @@ -467,8 +467,8 @@ ref scale if ( size.HasValue - && NameBasesUsingPrecision.Any( - n => storeTypeName.StartsWith(n, StringComparison.OrdinalIgnoreCase) + && NameBasesUsingPrecision.Any(n => + storeTypeName.StartsWith(n, StringComparison.OrdinalIgnoreCase) ) ) { diff --git a/efcore/src/EFCore.Sqlite.Core/Migrations/SqliteMigrationsSqlGenerator.cs b/efcore/src/EFCore.Sqlite.Core/Migrations/SqliteMigrationsSqlGenerator.cs index eb82846a137..57e20524718 100644 --- a/efcore/src/EFCore.Sqlite.Core/Migrations/SqliteMigrationsSqlGenerator.cs +++ b/efcore/src/EFCore.Sqlite.Core/Migrations/SqliteMigrationsSqlGenerator.cs @@ -767,8 +767,8 @@ protected override void Generate( // This handles the quirks of creating integer primary keys using autoincrement, not default rowid behavior. if (operation.PrimaryKey?.Columns.Length == 1) { - var columnOp = operation.Columns.FirstOrDefault( - o => o.Name == operation.PrimaryKey.Columns[0] + var columnOp = operation.Columns.FirstOrDefault(o => + o.Name == operation.PrimaryKey.Columns[0] ); if (columnOp != null) { diff --git a/efcore/src/EFCore.Sqlite.Core/Query/Internal/SqliteQueryTranslationPostprocessor.cs b/efcore/src/EFCore.Sqlite.Core/Query/Internal/SqliteQueryTranslationPostprocessor.cs index d581d5be66f..3d5e78782fd 100644 --- a/efcore/src/EFCore.Sqlite.Core/Query/Internal/SqliteQueryTranslationPostprocessor.cs +++ b/efcore/src/EFCore.Sqlite.Core/Query/Internal/SqliteQueryTranslationPostprocessor.cs @@ -57,8 +57,8 @@ protected override Expression VisitExtension(Expression extensionExpression) if ( extensionExpression is SelectExpression selectExpression - && selectExpression.Tables.Any( - t => t is CrossApplyExpression or OuterApplyExpression + && selectExpression.Tables.Any(t => + t is CrossApplyExpression or OuterApplyExpression ) ) { diff --git a/efcore/src/EFCore.Sqlite.Core/Scaffolding/Internal/SqliteDatabaseModelFactory.cs b/efcore/src/EFCore.Sqlite.Core/Scaffolding/Internal/SqliteDatabaseModelFactory.cs index 5175c841afc..16a4f183183 100644 --- a/efcore/src/EFCore.Sqlite.Core/Scaffolding/Internal/SqliteDatabaseModelFactory.cs +++ b/efcore/src/EFCore.Sqlite.Core/Scaffolding/Internal/SqliteDatabaseModelFactory.cs @@ -933,8 +933,8 @@ ORDER BY "seqno" var columnName = reader.GetString(0); var column = table.Columns.FirstOrDefault(c => c.Name == columnName) - ?? table.Columns.FirstOrDefault( - c => c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) + ?? table.Columns.FirstOrDefault(c => + c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) ); Check.DebugAssert(column != null, "column is null."); @@ -967,8 +967,8 @@ FROM pragma_table_info(@table) var columnName = reader.GetString(0); var column = table.Columns.FirstOrDefault(c => c.Name == columnName) - ?? table.Columns.FirstOrDefault( - c => c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) + ?? table.Columns.FirstOrDefault(c => + c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) ); Check.DebugAssert(column != null, "column is null."); @@ -1030,8 +1030,8 @@ ORDER BY "seqno" var columnName = reader2.GetString(0); var column = table.Columns.FirstOrDefault(c => c.Name == columnName) - ?? table.Columns.FirstOrDefault( - c => c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) + ?? table.Columns.FirstOrDefault(c => + c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) ); Check.DebugAssert(column != null, "column is null."); @@ -1090,8 +1090,8 @@ ORDER BY "seqno" var name = reader2.GetString(0); var column = table.Columns.FirstOrDefault(c => c.Name == name) - ?? table.Columns.FirstOrDefault( - c => c.Name.Equals(name, StringComparison.Ordinal) + ?? table.Columns.FirstOrDefault(c => + c.Name.Equals(name, StringComparison.Ordinal) ); Check.DebugAssert(column != null, "column is null."); @@ -1130,8 +1130,8 @@ ORDER BY "id" var onDelete = reader1.GetString(2); var principalTable = tables.FirstOrDefault(t => t.Name == principalTableName) - ?? tables.FirstOrDefault( - t => t.Name.Equals(principalTableName, StringComparison.OrdinalIgnoreCase) + ?? tables.FirstOrDefault(t => + t.Name.Equals(principalTableName, StringComparison.OrdinalIgnoreCase) ); _logger.ForeignKeyFound(table.Name, id, principalTableName, onDelete); @@ -1181,8 +1181,8 @@ ORDER BY "seq" var columnName = reader2.GetString(1); var column = table.Columns.FirstOrDefault(c => c.Name == columnName) - ?? table.Columns.FirstOrDefault( - c => c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) + ?? table.Columns.FirstOrDefault(c => + c.Name.Equals(columnName, StringComparison.OrdinalIgnoreCase) ); Check.DebugAssert(column != null, "column is null."); @@ -1191,15 +1191,14 @@ ORDER BY "seq" if (principalColumnName != null) { principalColumn = - foreignKey.PrincipalTable.Columns.FirstOrDefault( - c => c.Name == principalColumnName + foreignKey.PrincipalTable.Columns.FirstOrDefault(c => + c.Name == principalColumnName ) - ?? foreignKey.PrincipalTable.Columns.FirstOrDefault( - c => - c.Name.Equals( - principalColumnName, - StringComparison.OrdinalIgnoreCase - ) + ?? foreignKey.PrincipalTable.Columns.FirstOrDefault(c => + c.Name.Equals( + principalColumnName, + StringComparison.OrdinalIgnoreCase + ) ); } else if (principalTable?.PrimaryKey != null) diff --git a/efcore/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs b/efcore/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs index 64bc668145b..70908ba7e0b 100644 --- a/efcore/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs +++ b/efcore/src/EFCore/ChangeTracking/Internal/InternalEntityEntry.cs @@ -1572,15 +1572,14 @@ CurrentValueType valueType !asProperty.ClrType.IsNullableType() || asProperty .GetContainingForeignKeys() - .Any( - fk => - fk - is { - IsRequired: true, - DeleteBehavior: DeleteBehavior.Cascade - or DeleteBehavior.ClientCascade - } - && fk.DeclaringEntityType.IsAssignableFrom(EntityType) + .Any(fk => + fk + is { + IsRequired: true, + DeleteBehavior: DeleteBehavior.Cascade + or DeleteBehavior.ClientCascade + } + && fk.DeclaringEntityType.IsAssignableFrom(EntityType) ) ) ) @@ -1970,8 +1969,8 @@ bool isCascadeDelete } } - var cascadeFk = fks.FirstOrDefault( - fk => fk.DeleteBehavior is DeleteBehavior.Cascade or DeleteBehavior.ClientCascade + var cascadeFk = fks.FirstOrDefault(fk => + fk.DeleteBehavior is DeleteBehavior.Cascade or DeleteBehavior.ClientCascade ); if ( cascadeFk != null @@ -2029,10 +2028,9 @@ bool isCascadeDelete { var property = EntityType .GetFlattenedProperties() - .FirstOrDefault( - p => - (EntityState != EntityState.Modified || IsModified(p)) - && _stateData.IsPropertyFlagged(p.GetIndex(), PropertyFlag.Null) + .FirstOrDefault(p => + (EntityState != EntityState.Modified || IsModified(p)) + && _stateData.IsPropertyFlagged(p.GetIndex(), PropertyFlag.Null) ); if (property != null) diff --git a/efcore/src/EFCore/ChangeTracking/Internal/NavigationFixer.cs b/efcore/src/EFCore/ChangeTracking/Internal/NavigationFixer.cs index 6e9571a3c03..4c5476fbc9c 100644 --- a/efcore/src/EFCore/ChangeTracking/Internal/NavigationFixer.cs +++ b/efcore/src/EFCore/ChangeTracking/Internal/NavigationFixer.cs @@ -249,10 +249,9 @@ public virtual void NavigationReferenceChanged( && ( entry .EntityType.GetNavigations() - .All( - n => - n == navigation - || !ReferenceEquals(oldTargetEntry.Entity, entry[n]) + .All(n => + n == navigation + || !ReferenceEquals(oldTargetEntry.Entity, entry[n]) ) ) ) diff --git a/efcore/src/EFCore/ChangeTracking/ValueComparer`.cs b/efcore/src/EFCore/ChangeTracking/ValueComparer`.cs index 848560e8660..9d4ff7461fb 100644 --- a/efcore/src/EFCore/ChangeTracking/ValueComparer`.cs +++ b/efcore/src/EFCore/ChangeTracking/ValueComparer`.cs @@ -134,13 +134,12 @@ Expression> snapshotExpression } var typedEquals = type.GetRuntimeMethods() - .FirstOrDefault( - m => - m.ReturnType == typeof(bool) - && !m.IsStatic - && nameof(object.Equals).Equals(m.Name, StringComparison.Ordinal) - && m.GetParameters().Length == 1 - && m.GetParameters()[0].ParameterType == typeof(T) + .FirstOrDefault(m => + m.ReturnType == typeof(bool) + && !m.IsStatic + && nameof(object.Equals).Equals(m.Name, StringComparison.Ordinal) + && m.GetParameters().Length == 1 + && m.GetParameters()[0].ParameterType == typeof(T) ); if (typedEquals != null) @@ -169,14 +168,13 @@ Expression> snapshotExpression while (typedEquals == null && type != null) { var declaredMethods = type.GetTypeInfo().DeclaredMethods; - typedEquals = declaredMethods.FirstOrDefault( - m => - m.IsStatic - && m.ReturnType == typeof(bool) - && "op_Equality".Equals(m.Name, StringComparison.Ordinal) - && m.GetParameters().Length == 2 - && m.GetParameters()[0].ParameterType == typeof(T) - && m.GetParameters()[1].ParameterType == typeof(T) + typedEquals = declaredMethods.FirstOrDefault(m => + m.IsStatic + && m.ReturnType == typeof(bool) + && "op_Equality".Equals(m.Name, StringComparison.Ordinal) + && m.GetParameters().Length == 2 + && m.GetParameters()[0].ParameterType == typeof(T) + && m.GetParameters()[1].ParameterType == typeof(T) ); type = type.BaseType; diff --git a/efcore/src/EFCore/DbContextOptionsBuilder.cs b/efcore/src/EFCore/DbContextOptionsBuilder.cs index 4c2a459f92f..a34b18d265d 100644 --- a/efcore/src/EFCore/DbContextOptionsBuilder.cs +++ b/efcore/src/EFCore/DbContextOptionsBuilder.cs @@ -683,13 +683,12 @@ public virtual DbContextOptionsBuilder ReplaceService< >() where TCurrentImplementation : TService where TNewImplementation : TService => - WithOption( - e => - e.WithReplacedService( - typeof(TService), - typeof(TNewImplementation), - typeof(TCurrentImplementation) - ) + WithOption(e => + e.WithReplacedService( + typeof(TService), + typeof(TNewImplementation), + typeof(TCurrentImplementation) + ) ); /// diff --git a/efcore/src/EFCore/Diagnostics/UpdatingIdentityResolutionInterceptor.cs b/efcore/src/EFCore/Diagnostics/UpdatingIdentityResolutionInterceptor.cs index e6eed16902c..ae5f22d689d 100644 --- a/efcore/src/EFCore/Diagnostics/UpdatingIdentityResolutionInterceptor.cs +++ b/efcore/src/EFCore/Diagnostics/UpdatingIdentityResolutionInterceptor.cs @@ -51,8 +51,8 @@ object newEntity if (existingEntry.State == EntityState.Added) { foreach ( - var propertyEntry in tempEntry.Properties.Where( - e => e.Metadata.GetBeforeSaveBehavior() != PropertySaveBehavior.Throw + var propertyEntry in tempEntry.Properties.Where(e => + e.Metadata.GetBeforeSaveBehavior() != PropertySaveBehavior.Throw ) ) { @@ -63,8 +63,8 @@ var propertyEntry in tempEntry.Properties.Where( else { foreach ( - var propertyEntry in tempEntry.Properties.Where( - e => e.Metadata.GetAfterSaveBehavior() != PropertySaveBehavior.Throw + var propertyEntry in tempEntry.Properties.Where(e => + e.Metadata.GetAfterSaveBehavior() != PropertySaveBehavior.Throw ) ) { diff --git a/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs b/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs index d27950a426a..dab9725293a 100644 --- a/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs +++ b/efcore/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs @@ -2682,30 +2682,24 @@ public static async Task ToArrayAsync( typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(Include)) - .Single( - mi => - mi.GetGenericArguments().Length == 2 - && mi.GetParameters() - .Any( - pi => - pi.Name == "navigationPropertyPath" - && pi.ParameterType != typeof(string) - ) + .Single(mi => + mi.GetGenericArguments().Length == 2 + && mi.GetParameters() + .Any(pi => + pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string) + ) ); internal static readonly MethodInfo NotQuiteIncludeMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(NotQuiteInclude)) - .Single( - mi => - mi.GetGenericArguments().Length == 2 - && mi.GetParameters() - .Any( - pi => - pi.Name == "navigationPropertyPath" - && pi.ParameterType != typeof(string) - ) + .Single(mi => + mi.GetGenericArguments().Length == 2 + && mi.GetParameters() + .Any(pi => + pi.Name == "navigationPropertyPath" && pi.ParameterType != typeof(string) + ) ); /// @@ -2799,12 +2793,9 @@ source.Provider is EntityQueryProvider typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(ThenInclude)) - .Single( - mi => - mi.GetGenericArguments().Length == 3 - && mi.GetParameters()[0] - .ParameterType.GenericTypeArguments[1] - .IsGenericParameter + .Single(mi => + mi.GetGenericArguments().Length == 3 + && mi.GetParameters()[0].ParameterType.GenericTypeArguments[1].IsGenericParameter ); /// @@ -2925,14 +2916,11 @@ public IAsyncEnumerator GetAsyncEnumerator( typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(Include)) - .Single( - mi => - mi.GetParameters() - .Any( - pi => - pi.Name == "navigationPropertyPath" - && pi.ParameterType == typeof(string) - ) + .Single(mi => + mi.GetParameters() + .Any(pi => + pi.Name == "navigationPropertyPath" && pi.ParameterType == typeof(string) + ) ); /// diff --git a/efcore/src/EFCore/Extensions/Internal/TypeExtensions.cs b/efcore/src/EFCore/Extensions/Internal/TypeExtensions.cs index 888b75a5533..6ee12ff2888 100644 --- a/efcore/src/EFCore/Extensions/Internal/TypeExtensions.cs +++ b/efcore/src/EFCore/Extensions/Internal/TypeExtensions.cs @@ -72,12 +72,11 @@ this Type type return defaultPropertyAttribute == null ? null : type.GetRuntimeProperties() - .FirstOrDefault( - pi => - pi.Name == defaultPropertyAttribute.MemberName - && pi.IsIndexerProperty() - && pi.SetMethod?.GetParameters() is { Length: 2 } parameters - && parameters[0].ParameterType == typeof(string) + .FirstOrDefault(pi => + pi.Name == defaultPropertyAttribute.MemberName + && pi.IsIndexerProperty() + && pi.SetMethod?.GetParameters() is { Length: 2 } parameters + && parameters[0].ParameterType == typeof(string) ); } } diff --git a/efcore/src/EFCore/Extensions/PropertyBaseExtensions.cs b/efcore/src/EFCore/Extensions/PropertyBaseExtensions.cs index 9762308bcfd..343afa7efae 100644 --- a/efcore/src/EFCore/Extensions/PropertyBaseExtensions.cs +++ b/efcore/src/EFCore/Extensions/PropertyBaseExtensions.cs @@ -24,12 +24,11 @@ public static string Format( "{" + string.Join( ", ", - properties.Select( - p => - "'" - + p.Name - + "'" - + (includeTypes ? " : " + p.ClrType.DisplayName(fullName: false) : "") + properties.Select(p => + "'" + + p.Name + + "'" + + (includeTypes ? " : " + p.ClrType.DisplayName(fullName: false) : "") ) ) + "}"; diff --git a/efcore/src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.cs b/efcore/src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.cs index 51a0f48d416..b542aa75a9e 100644 --- a/efcore/src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.cs +++ b/efcore/src/EFCore/Infrastructure/EntityFrameworkServicesBuilder.cs @@ -370,19 +370,19 @@ public virtual EntityFrameworkServicesBuilder TryAddCoreServices() TryAdd(); TryAdd(); TryAdd(p => p.GetRequiredService()); - TryAdd( - p => p.GetRequiredService() + TryAdd(p => + p.GetRequiredService() ); TryAdd(p => GetContextServices(p).Model); TryAdd(p => new DesignTimeModel(GetContextServices(p))); TryAdd(p => GetContextServices(p).CurrentContext); TryAdd(p => GetContextServices(p).ContextOptions); - TryAdd( - p => p.GetRequiredService() + TryAdd(p => + p.GetRequiredService() ); TryAdd(p => p.GetRequiredService()); - TryAdd( - p => p.GetRequiredService() + TryAdd(p => + p.GetRequiredService() ); TryAdd(); TryAdd(); @@ -405,17 +405,16 @@ public virtual EntityFrameworkServicesBuilder TryAddCoreServices() TryAdd(); TryAdd(); - TryAdd( - p => - p.GetService() - ?.FindExtension() - ?.DbContextLogger ?? new NullDbContextLogger() + TryAdd(p => + p.GetService() + ?.FindExtension() + ?.DbContextLogger ?? new NullDbContextLogger() ); // This has to be lazy to avoid creating instances that are not disposed - ServiceCollectionMap.TryAddSingleton( - _ => new DiagnosticListener(DbLoggerCategory.Name) - ); + ServiceCollectionMap.TryAddSingleton(_ => new DiagnosticListener( + DbLoggerCategory.Name + )); ServiceCollectionMap .GetInfrastructure() diff --git a/efcore/src/EFCore/Metadata/Conventions/ForeignKeyAttributeConvention.cs b/efcore/src/EFCore/Metadata/Conventions/ForeignKeyAttributeConvention.cs index 5962c8aea64..d73dae95b27 100644 --- a/efcore/src/EFCore/Metadata/Conventions/ForeignKeyAttributeConvention.cs +++ b/efcore/src/EFCore/Metadata/Conventions/ForeignKeyAttributeConvention.cs @@ -93,11 +93,11 @@ var candidatePair in Dependencies.MemberClassifier.GetNavigationCandidates( foreach (var inverse in inverses) { - unconfiguredNavigations.RemoveAll( - n => string.Equals(n.GetSimpleMemberName(), inverse, StringComparison.Ordinal) + unconfiguredNavigations.RemoveAll(n => + string.Equals(n.GetSimpleMemberName(), inverse, StringComparison.Ordinal) ); - foreignKeyNavigations.RemoveAll( - n => string.Equals(n.GetSimpleMemberName(), inverse, StringComparison.Ordinal) + foreignKeyNavigations.RemoveAll(n => + string.Equals(n.GetSimpleMemberName(), inverse, StringComparison.Ordinal) ); } @@ -376,13 +376,12 @@ IConventionContext context { var conflictingFk = foreignKey .DeclaringEntityType.FindForeignKeys(existingProperties) - .FirstOrDefault( - fk => - fk != foreignKey - && fk.PrincipalEntityType == foreignKey.PrincipalEntityType - && fk.GetConfigurationSource() == ConfigurationSource.DataAnnotation - && fk.GetPropertiesConfigurationSource() - == ConfigurationSource.DataAnnotation + .FirstOrDefault(fk => + fk != foreignKey + && fk.PrincipalEntityType == foreignKey.PrincipalEntityType + && fk.GetConfigurationSource() == ConfigurationSource.DataAnnotation + && fk.GetPropertiesConfigurationSource() + == ConfigurationSource.DataAnnotation ); if (conflictingFk != null) { @@ -571,10 +570,9 @@ bool pointsToPrincipal var otherNavigations = navigation .DeclaringEntityType.GetRuntimeProperties() - .Values.Where( - p => - p.PropertyType == navigationPropertyTargetType - && p.GetSimpleMemberName() != navigation.Name + .Values.Where(p => + p.PropertyType == navigationPropertyTargetType + && p.GetSimpleMemberName() != navigation.Name ) .OrderBy(p => p.GetSimpleMemberName()); diff --git a/efcore/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs b/efcore/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs index 1e5f8c15e29..9a4a5502798 100644 --- a/efcore/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs +++ b/efcore/src/EFCore/Metadata/Conventions/ForeignKeyPropertyDiscoveryConvention.cs @@ -362,10 +362,9 @@ invertedRelationshipBuilder is not null out foreignKeyProperties ) && foreignKeyProperties != null - && foreignKeyProperties.Any( - p => - !dependentPk.Properties.Contains(p) - || p.Name.Equals("Id", StringComparison.OrdinalIgnoreCase) + && foreignKeyProperties.Any(p => + !dependentPk.Properties.Contains(p) + || p.Name.Equals("Id", StringComparison.OrdinalIgnoreCase) ) ) { @@ -571,10 +570,9 @@ out IReadOnlyList? match if ( matchFound && foreignKeyProperties.Length != 1 - && foreignKeyProperties.All( - p => - p.IsImplicitlyCreated() - && ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) + && foreignKeyProperties.All(p => + p.IsImplicitlyCreated() + && ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) ) ) { @@ -613,10 +611,9 @@ out IReadOnlyList? match ) { if ( - propertiesToReference.All( - p => - !p.IsImplicitlyCreated() - || p.GetConfigurationSource().Overrides(ConfigurationSource.DataAnnotation) + propertiesToReference.All(p => + !p.IsImplicitlyCreated() + || p.GetConfigurationSource().Overrides(ConfigurationSource.DataAnnotation) ) ) { @@ -865,8 +862,8 @@ public virtual void ProcessForeignKeyRequirednessChanged( var isRequired = relationshipBuilder.Metadata.IsRequired; using var batch = context.DelayConventions(); foreach ( - var property in relationshipBuilder.Metadata.Properties.Where( - p => p.ClrType.IsNullableType() + var property in relationshipBuilder.Metadata.Properties.Where(p => + p.ClrType.IsNullableType() ) ) { @@ -1097,12 +1094,11 @@ var foreignKey in entityType .DeclaringEntityType.GetDerivedTypes() .SelectMany(et => et.FindDeclaredForeignKeys(foreignKeyProperties)) ) - .FirstOrDefault( - fk => - fk != foreignKey - && ConfigurationSource.Convention.Overrides( - fk.GetPropertiesConfigurationSource() - ) + .FirstOrDefault(fk => + fk != foreignKey + && ConfigurationSource.Convention.Overrides( + fk.GetPropertiesConfigurationSource() + ) ); if (conflictingForeignKey != null) { @@ -1147,12 +1143,10 @@ var foreignKey in entityType { var conflictingFk = entityType .GetDeclaredForeignKeys() - .FirstOrDefault( - otherForeignKey => - otherForeignKey != foreignKey - && otherForeignKey.PrincipalEntityType - == foreignKey.PrincipalEntityType - && otherForeignKey.GetPropertiesConfigurationSource() == null + .FirstOrDefault(otherForeignKey => + otherForeignKey != foreignKey + && otherForeignKey.PrincipalEntityType == foreignKey.PrincipalEntityType + && otherForeignKey.GetPropertiesConfigurationSource() == null ); if (conflictingFk != null) { diff --git a/efcore/src/EFCore/Metadata/Conventions/InversePropertyAttributeConvention.cs b/efcore/src/EFCore/Metadata/Conventions/InversePropertyAttributeConvention.cs index d6a3d80233b..5ee53db657b 100644 --- a/efcore/src/EFCore/Metadata/Conventions/InversePropertyAttributeConvention.cs +++ b/efcore/src/EFCore/Metadata/Conventions/InversePropertyAttributeConvention.cs @@ -92,23 +92,21 @@ InversePropertyAttribute attribute var inverseNavigationPropertyInfo = targetEntityType .GetRuntimeProperties() - .Values.FirstOrDefault( - p => - string.Equals( - p.GetSimpleMemberName(), - attribute.Property, - StringComparison.Ordinal - ) && navigationCandidates.ContainsKey(p) + .Values.FirstOrDefault(p => + string.Equals( + p.GetSimpleMemberName(), + attribute.Property, + StringComparison.Ordinal + ) && navigationCandidates.ContainsKey(p) ) ?? targetEntityType .GetRuntimeProperties() - .Values.FirstOrDefault( - p => - string.Equals( - p.GetSimpleMemberName(), - attribute.Property, - StringComparison.OrdinalIgnoreCase - ) && navigationCandidates.ContainsKey(p) + .Values.FirstOrDefault(p => + string.Equals( + p.GetSimpleMemberName(), + attribute.Property, + StringComparison.OrdinalIgnoreCase + ) && navigationCandidates.ContainsKey(p) ); if ( diff --git a/efcore/src/EFCore/Metadata/Conventions/KeyDiscoveryConvention.cs b/efcore/src/EFCore/Metadata/Conventions/KeyDiscoveryConvention.cs index 891f154ed43..2ab1f6ee036 100644 --- a/efcore/src/EFCore/Metadata/Conventions/KeyDiscoveryConvention.cs +++ b/efcore/src/EFCore/Metadata/Conventions/KeyDiscoveryConvention.cs @@ -85,10 +85,9 @@ protected virtual void TryConfigurePrimaryKey(IConventionEntityTypeBuilder entit { var candidateProperties = entityType .GetProperties() - .Where( - p => - !p.IsImplicitlyCreated() - || !ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) + .Where(p => + !p.IsImplicitlyCreated() + || !ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) ); keyProperties = DiscoverKeyProperties(entityType, candidateProperties).ToList(); if (keyProperties.Count > 1) @@ -188,17 +187,16 @@ IEnumerable candidateProperties Check.NotNull(entityType, nameof(entityType)); // ReSharper disable PossibleMultipleEnumeration - var keyProperties = candidateProperties.Where( - p => string.Equals(p.Name, KeySuffix, StringComparison.OrdinalIgnoreCase) + var keyProperties = candidateProperties.Where(p => + string.Equals(p.Name, KeySuffix, StringComparison.OrdinalIgnoreCase) ); if (!keyProperties.Any()) { var entityTypeName = entityType.ShortName(); - keyProperties = candidateProperties.Where( - p => - p.Name.Length == entityTypeName.Length + KeySuffix.Length - && p.Name.StartsWith(entityTypeName, StringComparison.OrdinalIgnoreCase) - && p.Name.EndsWith(KeySuffix, StringComparison.OrdinalIgnoreCase) + keyProperties = candidateProperties.Where(p => + p.Name.Length == entityTypeName.Length + KeySuffix.Length + && p.Name.StartsWith(entityTypeName, StringComparison.OrdinalIgnoreCase) + && p.Name.EndsWith(KeySuffix, StringComparison.OrdinalIgnoreCase) ); } diff --git a/efcore/src/EFCore/Metadata/Conventions/RelationshipDiscoveryConvention.cs b/efcore/src/EFCore/Metadata/Conventions/RelationshipDiscoveryConvention.cs index 835e0f6ab37..66daef81015 100644 --- a/efcore/src/EFCore/Metadata/Conventions/RelationshipDiscoveryConvention.cs +++ b/efcore/src/EFCore/Metadata/Conventions/RelationshipDiscoveryConvention.cs @@ -692,10 +692,8 @@ var inverseProperty in relationshipCandidate.InverseProperties.ToList() } else if ( IsImplicitlyCreatedUnusedType(relationshipCandidate.TargetTypeBuilder.Metadata) - && filteredRelationshipCandidates.All( - c => - c.TargetTypeBuilder.Metadata - != relationshipCandidate.TargetTypeBuilder.Metadata + && filteredRelationshipCandidates.All(c => + c.TargetTypeBuilder.Metadata != relationshipCandidate.TargetTypeBuilder.Metadata ) ) { @@ -848,17 +846,16 @@ HashSet filteredRelationshipCandidates var inverseCandidate = relationshipCandidate.InverseProperties.FirstOrDefault(); if (inverseCandidate != null) { - var relationshipsToDerivedTypes = relationshipCandidatesHierarchy.Where( - r => - r.TargetTypeBuilder != relationshipCandidate.TargetTypeBuilder - && relationshipCandidate.TargetTypeBuilder.Metadata.IsAssignableFrom( - r.TargetTypeBuilder.Metadata - ) + var relationshipsToDerivedTypes = relationshipCandidatesHierarchy.Where(r => + r.TargetTypeBuilder != relationshipCandidate.TargetTypeBuilder + && relationshipCandidate.TargetTypeBuilder.Metadata.IsAssignableFrom( + r.TargetTypeBuilder.Metadata + ) ); foreach (var relationshipToDerivedType in relationshipsToDerivedTypes) { - relationshipToDerivedType.InverseProperties.RemoveAll( - i => i.GetSimpleMemberName() == inverseCandidate.GetSimpleMemberName() + relationshipToDerivedType.InverseProperties.RemoveAll(i => + i.GetSimpleMemberName() == inverseCandidate.GetSimpleMemberName() ); if (!filteredRelationshipCandidates.Contains(relationshipToDerivedType)) @@ -911,10 +908,8 @@ IConventionEntityTypeBuilder entityTypeBuilder } else if ( IsImplicitlyCreatedUnusedType(relationshipCandidate.TargetTypeBuilder.Metadata) - && filteredRelationshipCandidates.All( - c => - c.TargetTypeBuilder.Metadata - != relationshipCandidate.TargetTypeBuilder.Metadata + && filteredRelationshipCandidates.All(c => + c.TargetTypeBuilder.Metadata != relationshipCandidate.TargetTypeBuilder.Metadata ) ) { @@ -1150,10 +1145,9 @@ RelationshipCandidate relationshipCandidate } } - relationshipCandidate.NavigationProperties.RemoveAll( - p => - p.GetMemberType().IsAssignableFrom(mostDerivedType) - && p.GetMemberType() != mostDerivedType + relationshipCandidate.NavigationProperties.RemoveAll(p => + p.GetMemberType().IsAssignableFrom(mostDerivedType) + && p.GetMemberType() != mostDerivedType ); } @@ -1176,10 +1170,9 @@ RelationshipCandidate relationshipCandidate } } - relationshipCandidate.InverseProperties.RemoveAll( - p => - p.GetMemberType().IsAssignableFrom(mostDerivedType) - && p.GetMemberType() != mostDerivedType + relationshipCandidate.InverseProperties.RemoveAll(p => + p.GetMemberType().IsAssignableFrom(mostDerivedType) + && p.GetMemberType() != mostDerivedType ); } } @@ -1234,14 +1227,16 @@ RelationshipCandidate relationshipCandidate Dependencies.Logger.MultipleNavigationProperties( relationshipCandidate.NavigationProperties.Count == 0 ? new[] { new Tuple(null, targetEntityType.ClrType) } - : relationshipCandidate.NavigationProperties.Select( - n => new Tuple(n, entityType.ClrType) - ), + : relationshipCandidate.NavigationProperties.Select(n => new Tuple< + MemberInfo?, + Type + >(n, entityType.ClrType)), relationshipCandidate.InverseProperties.Count == 0 ? new[] { new Tuple(null, targetEntityType.ClrType) } - : relationshipCandidate.InverseProperties.Select( - n => new Tuple(n, targetEntityType.ClrType) - ) + : relationshipCandidate.InverseProperties.Select(n => new Tuple< + MemberInfo?, + Type + >(n, targetEntityType.ClrType)) ); } diff --git a/efcore/src/EFCore/Metadata/DependencyInjectionMethodParameterBinding.cs b/efcore/src/EFCore/Metadata/DependencyInjectionMethodParameterBinding.cs index b49568f6f0b..a3da38b715b 100644 --- a/efcore/src/EFCore/Metadata/DependencyInjectionMethodParameterBinding.cs +++ b/efcore/src/EFCore/Metadata/DependencyInjectionMethodParameterBinding.cs @@ -68,8 +68,7 @@ params IPropertyBase[]? serviceProperties /// The expression tree. public override Expression BindToParameter(ParameterBindingInfo bindingInfo) { - var serviceInstance = bindingInfo.ServiceInstances.FirstOrDefault( - e => e.Type == ServiceType + var serviceInstance = bindingInfo.ServiceInstances.FirstOrDefault(e => e.Type == ServiceType ); if (serviceInstance != null) { @@ -136,10 +135,8 @@ object entity var entityType = (IEntityType)b.ConsumedProperties.First().DeclaringType; var serviceStateProperty = entityType .GetServiceProperties() - .FirstOrDefault( - p => - p.ParameterBinding != b - && p.ParameterBinding.ServiceType == b.ServiceType + .FirstOrDefault(p => + p.ParameterBinding != b && p.ParameterBinding.ServiceType == b.ServiceType ); var serviceVariable = Expression.Variable(b.ServiceType, "service"); diff --git a/efcore/src/EFCore/Metadata/IReadOnlyEntityType.cs b/efcore/src/EFCore/Metadata/IReadOnlyEntityType.cs index 3868d7fbd24..89e7d28b14f 100644 --- a/efcore/src/EFCore/Metadata/IReadOnlyEntityType.cs +++ b/efcore/src/EFCore/Metadata/IReadOnlyEntityType.cs @@ -220,8 +220,8 @@ bool IsAssignableFrom(IReadOnlyEntityType derivedType) } return GetAllBaseTypesInclusiveAscending() - .FirstOrDefault( - i => otherEntityType.GetAllBaseTypesInclusiveAscending().Any(j => j == i) + .FirstOrDefault(i => + otherEntityType.GetAllBaseTypesInclusiveAscending().Any(j => j == i) ); } diff --git a/efcore/src/EFCore/Metadata/IReadOnlyIndex.cs b/efcore/src/EFCore/Metadata/IReadOnlyIndex.cs index 94d202d4b0e..66e3e802051 100644 --- a/efcore/src/EFCore/Metadata/IReadOnlyIndex.cs +++ b/efcore/src/EFCore/Metadata/IReadOnlyIndex.cs @@ -78,11 +78,10 @@ string ToDebugString( builder.AppendJoin( ", ", - Properties.Select( - p => - singleLine - ? p.DeclaringType.DisplayName(omitSharedType: true) + "." + p.Name - : p.Name + Properties.Select(p => + singleLine + ? p.DeclaringType.DisplayName(omitSharedType: true) + "." + p.Name + : p.Name ) ); diff --git a/efcore/src/EFCore/Metadata/Internal/ComplexPropertySnapshot.cs b/efcore/src/EFCore/Metadata/Internal/ComplexPropertySnapshot.cs index a9a309a947c..2557f9e348d 100644 --- a/efcore/src/EFCore/Metadata/Internal/ComplexPropertySnapshot.cs +++ b/efcore/src/EFCore/Metadata/Internal/ComplexPropertySnapshot.cs @@ -237,10 +237,9 @@ ComplexType complexType ) => parameterBinding.With( parameterBinding - .ConsumedProperties.Select( - property => - (IPropertyBase?)complexType.FindProperty(property.Name) - ?? complexType.FindComplexProperty(property.Name)! + .ConsumedProperties.Select(property => + (IPropertyBase?)complexType.FindProperty(property.Name) + ?? complexType.FindComplexProperty(property.Name)! ) .ToArray() ); diff --git a/efcore/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs b/efcore/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs index c2ab3be9fbe..008d84cf39c 100644 --- a/efcore/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs +++ b/efcore/src/EFCore/Metadata/Internal/InternalForeignKeyBuilder.cs @@ -810,16 +810,15 @@ out var resolvableRelationships conflictingNavigationsFound = compatibleRelationship != null - || resolvableRelationships.Any( - r => - ( - r.Resolution - & ( - Resolution.ResetToDependent - | Resolution.ResetToPrincipal - | Resolution.Remove - ) - ) != 0 + || resolvableRelationships.Any(r => + ( + r.Resolution + & ( + Resolution.ResetToDependent + | Resolution.ResetToPrincipal + | Resolution.Remove + ) + ) != 0 ); if ( @@ -1232,16 +1231,14 @@ ConfigurationSource configurationSource .SingleOrDefault(fk => fk.IsOwnership); var invertedOwnerships = declaringType .GetDeclaredReferencingForeignKeys() - .Where( - fk => - fk.IsOwnership - && fk.DeclaringEntityType.ClrType == Metadata.PrincipalEntityType.ClrType + .Where(fk => + fk.IsOwnership + && fk.DeclaringEntityType.ClrType == Metadata.PrincipalEntityType.ClrType ) .ToList(); if ( - invertedOwnerships.Any( - fk => !configurationSource.Overrides(fk.GetConfigurationSource()) + invertedOwnerships.Any(fk => !configurationSource.Overrides(fk.GetConfigurationSource()) ) ) { @@ -1976,21 +1973,17 @@ public virtual bool CanInvert( using var batch = Metadata.DeclaringEntityType.Model.DelayConventions(); var temporaryProperties = Metadata - .Properties.Where( - p => - (p.IsShadowProperty() || p.DeclaringType.IsPropertyBag && p.IsIndexerProperty()) - && ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) + .Properties.Where(p => + (p.IsShadowProperty() || p.DeclaringType.IsPropertyBag && p.IsIndexerProperty()) + && ConfigurationSource.Convention.Overrides(p.GetConfigurationSource()) ) .ToList(); var keysToDetach = temporaryProperties - .SelectMany( - p => - p.GetContainingKeys() - .Where( - k => - ConfigurationSource.Convention.Overrides(k.GetConfigurationSource()) - ) + .SelectMany(p => + p.GetContainingKeys() + .Where(k => ConfigurationSource.Convention.Overrides(k.GetConfigurationSource()) + ) ) .Distinct() .ToList(); @@ -2330,8 +2323,8 @@ private bool CanSetForeignKey( dependentEntityType.BaseType != null && !principalEntityType.IsAssignableFrom(dependentEntityType) && configurationSource != ConfigurationSource.Explicit // let it throw for explicit - && properties.Any( - p => p.GetContainingKeys().Any(k => k.DeclaringEntityType != dependentEntityType) + && properties.Any(p => + p.GetContainingKeys().Any(k => k.DeclaringEntityType != dependentEntityType) ) ) { @@ -2572,10 +2565,9 @@ out IReadOnlyList? oldNameDependentProperties Metadata .GetPropertiesConfigurationSource() .Overrides(ConfigurationSource.DataAnnotation) - && Metadata.Properties.All( - p => - ConfigurationSource.Convention.Overrides(p.GetTypeConfigurationSource()) - && (p.IsShadowProperty() || p.IsIndexerProperty()) + && Metadata.Properties.All(p => + ConfigurationSource.Convention.Overrides(p.GetTypeConfigurationSource()) + && (p.IsShadowProperty() || p.IsIndexerProperty()) ) ) { @@ -2886,12 +2878,8 @@ ConfigurationSource configurationSource using var batch = Metadata.DeclaringEntityType.Model.DelayConventions(); var referencingSkipNavigations = Metadata - .ReferencingSkipNavigations?.Select( - n => - ( - Navigation: n, - ConfigurationSource: n.GetForeignKeyConfigurationSource()!.Value - ) + .ReferencingSkipNavigations?.Select(n => + (Navigation: n, ConfigurationSource: n.GetForeignKeyConfigurationSource()!.Value) ) .ToList(); @@ -3608,10 +3596,9 @@ out var resolvableRelationships // this should be replaced with reference counting // Issue #15898 var temporaryProperties = dependentProperties - ?.Where( - p => - p.GetConfigurationSource() == ConfigurationSource.Convention - && ((IConventionProperty)p).IsImplicitlyCreated() + ?.Where(p => + p.GetConfigurationSource() == ConfigurationSource.Convention + && ((IConventionProperty)p).IsImplicitlyCreated() ) .ToList(); var tempIndex = @@ -3623,10 +3610,9 @@ out var resolvableRelationships : null; var temporaryKeyProperties = principalProperties - ?.Where( - p => - p.GetConfigurationSource() == ConfigurationSource.Convention - && ((IConventionProperty)p).IsImplicitlyCreated() + ?.Where(p => + p.GetConfigurationSource() == ConfigurationSource.Convention + && ((IConventionProperty)p).IsImplicitlyCreated() ) .ToList(); var keyTempIndex = @@ -3774,11 +3760,9 @@ out var resolvableRelationships dependentEntityType, shouldThrow: false ) - && dependentProperties.All( - p => - ConfigurationSource.Convention.Overrides( - p.GetTypeConfigurationSource() - ) && (p.IsShadowProperty() || p.IsIndexerProperty()) + && dependentProperties.All(p => + ConfigurationSource.Convention.Overrides(p.GetTypeConfigurationSource()) + && (p.IsShadowProperty() || p.IsIndexerProperty()) ) ) ) diff --git a/efcore/src/EFCore/Metadata/Internal/Model.cs b/efcore/src/EFCore/Metadata/Internal/Model.cs index 3c3f82f7d2c..e70a9d2ffd2 100644 --- a/efcore/src/EFCore/Metadata/Internal/Model.cs +++ b/efcore/src/EFCore/Metadata/Internal/Model.cs @@ -238,8 +238,8 @@ ConfigurationSource configurationSource if (entityType.HasSharedClrType) { if ( - _entityTypes.Any( - et => !et.Value.HasSharedClrType && et.Value.ClrType == entityType.ClrType + _entityTypes.Any(et => + !et.Value.HasSharedClrType && et.Value.ClrType == entityType.ClrType ) ) { diff --git a/efcore/src/EFCore/Metadata/Internal/Property.cs b/efcore/src/EFCore/Metadata/Internal/Property.cs index 503d441a8ed..9d902b75c18 100644 --- a/efcore/src/EFCore/Metadata/Internal/Property.cs +++ b/efcore/src/EFCore/Metadata/Internal/Property.cs @@ -132,23 +132,22 @@ public virtual void SetRemovedFromModel() /// doing so can result in application failures when updating to a new Entity Framework Core release. /// public static bool AreCompatible(IReadOnlyList properties, EntityType entityType) => - properties.All( - property => - property.IsShadowProperty() - || ( - property.IsIndexerProperty() - ? property.PropertyInfo == entityType.FindIndexerPropertyInfo() - : ( - ( - property.PropertyInfo != null - && entityType.GetRuntimeProperties().ContainsKey(property.Name) - ) - || ( - property.FieldInfo != null - && entityType.GetRuntimeFields().ContainsKey(property.Name) - ) + properties.All(property => + property.IsShadowProperty() + || ( + property.IsIndexerProperty() + ? property.PropertyInfo == entityType.FindIndexerPropertyInfo() + : ( + ( + property.PropertyInfo != null + && entityType.GetRuntimeProperties().ContainsKey(property.Name) ) - ) + || ( + property.FieldInfo != null + && entityType.GetRuntimeFields().ContainsKey(property.Name) + ) + ) + ) ); /// diff --git a/efcore/src/EFCore/Metadata/RuntimeTypeBase.cs b/efcore/src/EFCore/Metadata/RuntimeTypeBase.cs index 50f531a9928..af934414078 100644 --- a/efcore/src/EFCore/Metadata/RuntimeTypeBase.cs +++ b/efcore/src/EFCore/Metadata/RuntimeTypeBase.cs @@ -570,7 +570,9 @@ static IEnumerable Create(RuntimeTypeBase type) yield return complexProperty; foreach ( - var nestedComplexProperty in complexProperty.ComplexType.GetFlattenedComplexProperties() + var nestedComplexProperty in complexProperty.ComplexType.GetFlattenedComplexProperties( + + ) ) { yield return nestedComplexProperty; diff --git a/efcore/src/EFCore/Metadata/ServiceParameterBinding.cs b/efcore/src/EFCore/Metadata/ServiceParameterBinding.cs index 3db344ea92c..dd231b665a6 100644 --- a/efcore/src/EFCore/Metadata/ServiceParameterBinding.cs +++ b/efcore/src/EFCore/Metadata/ServiceParameterBinding.cs @@ -49,8 +49,7 @@ params IPropertyBase[]? serviceProperties /// The expression tree. public override Expression BindToParameter(ParameterBindingInfo bindingInfo) { - var serviceInstance = bindingInfo.ServiceInstances.FirstOrDefault( - e => e.Type == ServiceType + var serviceInstance = bindingInfo.ServiceInstances.FirstOrDefault(e => e.Type == ServiceType ); if (serviceInstance != null) { diff --git a/efcore/src/EFCore/ModelBuilder.cs b/efcore/src/EFCore/ModelBuilder.cs index 21e8ce1a894..113929b2c0e 100644 --- a/efcore/src/EFCore/ModelBuilder.cs +++ b/efcore/src/EFCore/ModelBuilder.cs @@ -538,11 +538,10 @@ public virtual ModelBuilder ApplyConfigurationsFromAssembly( { var applyEntityConfigurationMethod = typeof(ModelBuilder) .GetMethods() - .Single( - e => - e is { Name: nameof(ApplyConfiguration), ContainsGenericParameters: true } - && e.GetParameters().SingleOrDefault()?.ParameterType.GetGenericTypeDefinition() - == typeof(IEntityTypeConfiguration<>) + .Single(e => + e is { Name: nameof(ApplyConfiguration), ContainsGenericParameters: true } + && e.GetParameters().SingleOrDefault()?.ParameterType.GetGenericTypeDefinition() + == typeof(IEntityTypeConfiguration<>) ); foreach (var type in assembly.GetConstructibleTypes().OrderBy(t => t.FullName)) diff --git a/efcore/src/EFCore/Query/QueryCompilationContext.cs b/efcore/src/EFCore/Query/QueryCompilationContext.cs index edde666d7fc..faec52a3b3d 100644 --- a/efcore/src/EFCore/Query/QueryCompilationContext.cs +++ b/efcore/src/EFCore/Query/QueryCompilationContext.cs @@ -230,17 +230,16 @@ private Expression InsertRuntimeParameters(Expression query) => ? query : Expression.Block( _runtimeParameters - .Select( - kv => - Expression.Call( - QueryContextParameter, - QueryContextAddParameterMethodInfo, - Expression.Constant(kv.Key), - Expression.Convert( - Expression.Invoke(kv.Value, QueryContextParameter), - typeof(object) - ) + .Select(kv => + Expression.Call( + QueryContextParameter, + QueryContextAddParameterMethodInfo, + Expression.Constant(kv.Key), + Expression.Convert( + Expression.Invoke(kv.Value, QueryContextParameter), + typeof(object) ) + ) ) .Append(query) ); diff --git a/efcore/src/EFCore/Query/ReplacingExpressionVisitor.cs b/efcore/src/EFCore/Query/ReplacingExpressionVisitor.cs index 1917d851fc9..36269f62576 100644 --- a/efcore/src/EFCore/Query/ReplacingExpressionVisitor.cs +++ b/efcore/src/EFCore/Query/ReplacingExpressionVisitor.cs @@ -103,8 +103,8 @@ innerExpression is GroupByShaperExpression groupByShaperExpression var mayBeMemberInitExpression = innerExpression.UnwrapTypeConversion(out _); if ( mayBeMemberInitExpression is MemberInitExpression memberInitExpression - && memberInitExpression.Bindings.SingleOrDefault( - mb => mb.Member.IsSameAs(memberExpression.Member) + && memberInitExpression.Bindings.SingleOrDefault(mb => + mb.Member.IsSameAs(memberExpression.Member) ) is MemberAssignment memberAssignment ) @@ -138,8 +138,8 @@ out var propertyName var mayBeMemberInitExpression = newEntityExpression.UnwrapTypeConversion(out _); if ( mayBeMemberInitExpression is MemberInitExpression memberInitExpression - && memberInitExpression.Bindings.SingleOrDefault( - mb => mb.Member.Name == propertyName + && memberInitExpression.Bindings.SingleOrDefault(mb => + mb.Member.Name == propertyName ) is MemberAssignment memberAssignment ) diff --git a/efcore/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs b/efcore/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs index 658a7916f0c..e38dae85634 100644 --- a/efcore/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs +++ b/efcore/src/EFCore/Query/ShapedQueryCompilingExpressionVisitor.cs @@ -454,13 +454,12 @@ private Expression ProcessEntityShaper(StructuralTypeShaperExpression shaper) Constant(primaryKey), NewArrayInit( typeof(object), - primaryKey.Properties.Select( - p => - valueBufferExpression.CreateValueBufferReadValueExpression( - typeof(object), - p.GetIndex(), - p - ) + primaryKey.Properties.Select(p => + valueBufferExpression.CreateValueBufferReadValueExpression( + typeof(object), + p.GetIndex(), + p + ) ) ), Constant(!shaper.IsNullable), @@ -507,16 +506,15 @@ private Expression ProcessEntityShaper(StructuralTypeShaperExpression shaper) expressions.Add( IfThen( primaryKey - .Properties.Select( - p => - NotEqual( - valueBufferExpression.CreateValueBufferReadValueExpression( - typeof(object), - p.GetIndex(), - p - ), - Constant(null) - ) + .Properties.Select(p => + NotEqual( + valueBufferExpression.CreateValueBufferReadValueExpression( + typeof(object), + p.GetIndex(), + p + ), + Constant(null) + ) ) .Aggregate(AndAlso), MaterializeEntity( @@ -538,16 +536,15 @@ private Expression ProcessEntityShaper(StructuralTypeShaperExpression shaper) expressions.Add( IfThenElse( primaryKey - .Properties.Select( - p => - NotEqual( - valueBufferExpression.CreateValueBufferReadValueExpression( - typeof(object), - p.GetIndex(), - p - ), - Constant(null) - ) + .Properties.Select(p => + NotEqual( + valueBufferExpression.CreateValueBufferReadValueExpression( + typeof(object), + p.GetIndex(), + p + ), + Constant(null) + ) ) .Aggregate(AndAlso), MaterializeEntity( @@ -563,13 +560,12 @@ private Expression ProcessEntityShaper(StructuralTypeShaperExpression shaper) keyValuesVariable, NewArrayInit( typeof(object), - primaryKey.Properties.Select( - p => - valueBufferExpression.CreateValueBufferReadValueExpression( - typeof(object), - p.GetIndex(), - p - ) + primaryKey.Properties.Select(p => + valueBufferExpression.CreateValueBufferReadValueExpression( + typeof(object), + p.GetIndex(), + p + ) ) ) ), @@ -759,16 +755,15 @@ ParameterExpression ShadowValuesVariable runtimeEntityType, NewArrayInit( typeof(object), - shadowProperties.Select( - p => - Convert( - valueBufferExpression.CreateValueBufferReadValueExpression( - p.ClrType, - p.GetIndex(), - p - ), - typeof(object) - ) + shadowProperties.Select(p => + Convert( + valueBufferExpression.CreateValueBufferReadValueExpression( + p.ClrType, + p.GetIndex(), + p + ), + typeof(object) + ) ) ) ) diff --git a/efcore/src/EFCore/Storage/ValueConversion/ValueConverterSelector.cs b/efcore/src/EFCore/Storage/ValueConversion/ValueConverterSelector.cs index 9849aece182..e64bdb361f3 100644 --- a/efcore/src/EFCore/Storage/ValueConversion/ValueConverterSelector.cs +++ b/efcore/src/EFCore/Storage/ValueConversion/ValueConverterSelector.cs @@ -151,16 +151,15 @@ var converterInfo in FindNumericConventions( { yield return _converters.GetOrAdd( (modelClrType, typeof(byte[])), - static k => - new ValueConverterInfo( - k.ModelClrType, - typeof(byte[]), - _ => - new BoolToZeroOneConverter().ComposeWith( - NumberToBytesConverter.DefaultInfo.Create() - ), - new ConverterMappingHints(size: 1) - ) + static k => new ValueConverterInfo( + k.ModelClrType, + typeof(byte[]), + _ => + new BoolToZeroOneConverter().ComposeWith( + NumberToBytesConverter.DefaultInfo.Create() + ), + new ConverterMappingHints(size: 1) + ) ); } } @@ -352,22 +351,19 @@ var converterInfo in FindNumericConventions( ) : _converters.GetOrAdd( (modelClrType, typeof(byte[])), - static k => - new ValueConverterInfo( - k.ModelClrType, - typeof(byte[]), - i => - ( - i.ModelClrType == typeof(DateTime) - ? DateTimeToBinaryConverter.DefaultInfo.Create() - : i.ModelClrType == typeof(TimeSpan) - ? TimeSpanToTicksConverter.DefaultInfo.Create() - : TimeOnlyToTicksConverter.DefaultInfo.Create() - ).ComposeWith( - NumberToBytesConverter.DefaultInfo.Create() - ), - NumberToBytesConverter.DefaultInfo.MappingHints - ) + static k => new ValueConverterInfo( + k.ModelClrType, + typeof(byte[]), + i => + ( + i.ModelClrType == typeof(DateTime) + ? DateTimeToBinaryConverter.DefaultInfo.Create() + : i.ModelClrType == typeof(TimeSpan) + ? TimeSpanToTicksConverter.DefaultInfo.Create() + : TimeOnlyToTicksConverter.DefaultInfo.Create() + ).ComposeWith(NumberToBytesConverter.DefaultInfo.Create()), + NumberToBytesConverter.DefaultInfo.MappingHints + ) ); } } @@ -385,16 +381,15 @@ var converterInfo in FindNumericConventions( { yield return _converters.GetOrAdd( (modelClrType, typeof(byte[])), - static k => - new ValueConverterInfo( - k.ModelClrType, - typeof(byte[]), - _ => - new DateOnlyToStringConverter().ComposeWith( - StringToBytesConverter.DefaultInfo.Create() - ), - StringToBytesConverter.DefaultInfo.MappingHints - ) + static k => new ValueConverterInfo( + k.ModelClrType, + typeof(byte[]), + _ => + new DateOnlyToStringConverter().ComposeWith( + StringToBytesConverter.DefaultInfo.Create() + ), + StringToBytesConverter.DefaultInfo.MappingHints + ) ); } } diff --git a/efcore/src/Shared/MethodInfoExtensions.cs b/efcore/src/Shared/MethodInfoExtensions.cs index 7f46eef4daa..a7763762612 100644 --- a/efcore/src/Shared/MethodInfoExtensions.cs +++ b/efcore/src/Shared/MethodInfoExtensions.cs @@ -13,17 +13,16 @@ public static bool IsContainsMethod(this MethodInfo method) => && method .DeclaringType.GetInterfaces() .Append(method.DeclaringType) - .Any( - t => - t == typeof(IList) - || ( - t.IsGenericType - && t.GetGenericTypeDefinition() is Type genericType - && ( - genericType == typeof(ICollection<>) - || genericType == typeof(IReadOnlySet<>) - || genericType == typeof(IImmutableSet<>) - ) + .Any(t => + t == typeof(IList) + || ( + t.IsGenericType + && t.GetGenericTypeDefinition() is Type genericType + && ( + genericType == typeof(ICollection<>) + || genericType == typeof(IReadOnlySet<>) + || genericType == typeof(IImmutableSet<>) ) + ) ); } diff --git a/efcore/src/Shared/SharedTypeExtensions.cs b/efcore/src/Shared/SharedTypeExtensions.cs index 95072561048..8216bc22ee8 100644 --- a/efcore/src/Shared/SharedTypeExtensions.cs +++ b/efcore/src/Shared/SharedTypeExtensions.cs @@ -62,10 +62,9 @@ public static bool IsPropertyBagType( } var types = GetGenericTypeImplementations(type, typeof(IDictionary<,>)); - return types.Any( - t => - t.GetGenericArguments()[0] == typeof(string) - && t.GetGenericArguments()[1] == typeof(object) + return types.Any(t => + t.GetGenericArguments()[0] == typeof(string) + && t.GetGenericArguments()[1] == typeof(object) ); } @@ -333,10 +332,8 @@ public static IEnumerable GetDeclaredInterfaces( types ??= Array.Empty(); return type.GetTypeInfo() - .DeclaredConstructors.SingleOrDefault( - c => - !c.IsStatic - && c.GetParameters().Select(p => p.ParameterType).SequenceEqual(types) + .DeclaredConstructors.SingleOrDefault(c => + !c.IsStatic && c.GetParameters().Select(p => p.ParameterType).SequenceEqual(types) )!; } diff --git a/efcore/src/dotnet-ef/RootCommand.cs b/efcore/src/dotnet-ef/RootCommand.cs index 32616a976f1..6ea0be8d043 100644 --- a/efcore/src/dotnet-ef/RootCommand.cs +++ b/efcore/src/dotnet-ef/RootCommand.cs @@ -330,13 +330,8 @@ private static List ResolveProjects(string? path) var projectFiles = Directory .EnumerateFiles(path, "*.*proj", SearchOption.TopDirectoryOnly) - .Where( - f => - !string.Equals( - Path.GetExtension(f), - ".xproj", - StringComparison.OrdinalIgnoreCase - ) + .Where(f => + !string.Equals(Path.GetExtension(f), ".xproj", StringComparison.OrdinalIgnoreCase) ) .Take(2) .ToList(); diff --git a/efcore/src/ef/CommandLineUtils/CommandLineApplication.cs b/efcore/src/ef/CommandLineUtils/CommandLineApplication.cs index eabf7eb9f2a..0f63e80275c 100644 --- a/efcore/src/ef/CommandLineUtils/CommandLineApplication.cs +++ b/efcore/src/ef/CommandLineUtils/CommandLineApplication.cs @@ -217,18 +217,18 @@ out CommandOption? option if (isLongOption) { - option = command.Options.SingleOrDefault( - opt => string.Equals(opt.LongName, optionName, StringComparison.Ordinal) + option = command.Options.SingleOrDefault(opt => + string.Equals(opt.LongName, optionName, StringComparison.Ordinal) ); } else { option = - command.Options.SingleOrDefault( - opt => string.Equals(opt.ShortName, optionName, StringComparison.Ordinal) + command.Options.SingleOrDefault(opt => + string.Equals(opt.ShortName, optionName, StringComparison.Ordinal) ) - ?? command.Options.SingleOrDefault( - opt => string.Equals(opt.SymbolName, optionName, StringComparison.Ordinal) + ?? command.Options.SingleOrDefault(opt => + string.Equals(opt.SymbolName, optionName, StringComparison.Ordinal) ); } @@ -390,8 +390,8 @@ public void ShowHelp(string? commandName = null) } else { - target = Commands.SingleOrDefault( - cmd => string.Equals(cmd.Name, commandName, StringComparison.OrdinalIgnoreCase) + target = Commands.SingleOrDefault(cmd => + string.Equals(cmd.Name, commandName, StringComparison.OrdinalIgnoreCase) ); if (target != null) diff --git a/efcore/test/EFCore.AspNet.Specification.Tests/AspNetIdentityTestBase.cs b/efcore/test/EFCore.AspNet.Specification.Tests/AspNetIdentityTestBase.cs index ff90c89a8d8..867ca676142 100644 --- a/efcore/test/EFCore.AspNet.Specification.Tests/AspNetIdentityTestBase.cs +++ b/efcore/test/EFCore.AspNet.Specification.Tests/AspNetIdentityTestBase.cs @@ -696,11 +696,10 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build base.AddOptions(builder) .EnableDetailedErrors() .EnableSensitiveDataLogging() - .ConfigureWarnings( - b => - b.Default(WarningBehavior.Throw) - .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) - .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) + .ConfigureWarnings(b => + b.Default(WarningBehavior.Throw) + .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) + .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) ); } diff --git a/efcore/test/EFCore.AspNet.Specification.Tests/PersistedGrantDbContextTestBase.cs b/efcore/test/EFCore.AspNet.Specification.Tests/PersistedGrantDbContextTestBase.cs index da74e47badf..9dca0a264c7 100644 --- a/efcore/test/EFCore.AspNet.Specification.Tests/PersistedGrantDbContextTestBase.cs +++ b/efcore/test/EFCore.AspNet.Specification.Tests/PersistedGrantDbContextTestBase.cs @@ -373,11 +373,10 @@ public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder build base.AddOptions(builder) .EnableDetailedErrors() .EnableSensitiveDataLogging() - .ConfigureWarnings( - b => - b.Default(WarningBehavior.Throw) - .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) - .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) + .ConfigureWarnings(b => + b.Default(WarningBehavior.Throw) + .Log(CoreEventId.SensitiveDataLoggingEnabledWarning) + .Log(CoreEventId.PossibleUnintendedReferenceComparisonWarning) ); protected override bool UsePooling => false; // The IdentityServer ConfigurationDbContext has additional service dependencies diff --git a/efcore/test/EFCore.Cosmos.FunctionalTests/CosmosConcurrencyTest.cs b/efcore/test/EFCore.Cosmos.FunctionalTests/CosmosConcurrencyTest.cs index 943e9a68d8d..ac21d842503 100644 --- a/efcore/test/EFCore.Cosmos.FunctionalTests/CosmosConcurrencyTest.cs +++ b/efcore/test/EFCore.Cosmos.FunctionalTests/CosmosConcurrencyTest.cs @@ -16,8 +16,8 @@ public CosmosConcurrencyTest(CosmosFixture fixture) [ConditionalFact] public virtual Task Adding_the_same_entity_twice_results_in_DbUpdateException() => - ConcurrencyTestAsync( - ctx => ctx.Customers.Add(new Customer { Id = "1", Name = "CreatedTwice", }) + ConcurrencyTestAsync(ctx => + ctx.Customers.Add(new Customer { Id = "1", Name = "CreatedTwice", }) ); [ConditionalFact] diff --git a/efcore/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs b/efcore/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs index 9716669cec3..5b02e023c64 100644 --- a/efcore/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs +++ b/efcore/test/EFCore.Cosmos.FunctionalTests/EmbeddedDocumentsTest.cs @@ -463,15 +463,14 @@ public virtual async Task Can_use_non_int_keys_for_embedded_entities() var options = Fixture.CreateOptions( modelBuilder => { - modelBuilder.Entity( - eb => - eb.OwnsMany( - v => v.Addresses, - b => - { - b.Property("Id"); - } - ) + modelBuilder.Entity(eb => + eb.OwnsMany( + v => v.Addresses, + b => + { + b.Property("Id"); + } + ) ); }, seed: false @@ -614,8 +613,8 @@ public virtual async Task Can_change_nested_instance_non_derived() var options = Fixture.CreateOptions(); using (var context = new EmbeddedTransportationContext(options)) { - var bike = await context.Vehicles.SingleAsync( - v => v.Name == "Trek Pro Fit Madone 6 Series" + var bike = await context.Vehicles.SingleAsync(v => + v.Name == "Trek Pro Fit Madone 6 Series" ); bike.Operator = new Operator { Name = "Chris Horner" }; @@ -630,8 +629,8 @@ public virtual async Task Can_change_nested_instance_non_derived() using (var context = new EmbeddedTransportationContext(options)) { - var bike = await context.Vehicles.SingleAsync( - v => v.Name == "Trek Pro Fit Madone 6 Series" + var bike = await context.Vehicles.SingleAsync(v => + v.Name == "Trek Pro Fit Madone 6 Series" ); Assert.Equal("repairman", bike.Operator.Name); } @@ -643,8 +642,8 @@ public virtual async Task Can_change_principal_instance_non_derived() var options = Fixture.CreateOptions(); using (var context = new EmbeddedTransportationContext(options)) { - var bike = await context.Vehicles.SingleAsync( - v => v.Name == "Trek Pro Fit Madone 6 Series" + var bike = await context.Vehicles.SingleAsync(v => + v.Name == "Trek Pro Fit Madone 6 Series" ); var newBike = new Vehicle @@ -663,8 +662,8 @@ public virtual async Task Can_change_principal_instance_non_derived() using (var context = new EmbeddedTransportationContext(options)) { - var bike = await context.Vehicles.SingleAsync( - v => v.Name == "Trek Pro Fit Madone 6 Series" + var bike = await context.Vehicles.SingleAsync(v => + v.Name == "Trek Pro Fit Madone 6 Series" ); Assert.Equal(2, bike.SeatingCapacity); @@ -769,19 +768,18 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Ignore(); modelBuilder.Entity(); - modelBuilder.Entity( - eb => - eb.OwnsMany( - v => v.Addresses, - b => - { - b.ToJsonProperty("Stored Addresses"); - b.OwnsOne(a => a.AddressTitle) - .Property(a => a.Title) - .HasValueGenerator() - .IsRequired(); - } - ) + modelBuilder.Entity(eb => + eb.OwnsMany( + v => v.Addresses, + b => + { + b.ToJsonProperty("Stored Addresses"); + b.OwnsOne(a => a.AddressTitle) + .Property(a => a.Title) + .HasValueGenerator() + .IsRequired(); + } + ) ); } } diff --git a/efcore/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs b/efcore/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs index 04703d82060..a848972f9a9 100644 --- a/efcore/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs +++ b/efcore/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindFunctionsQueryCosmosTest.cs @@ -1646,8 +1646,8 @@ await AssertQuery( async, ss => ss.Set() - .Where( - o => Regex.IsMatch(o.CustomerID, "^T", RegexOptions.IgnorePatternWhitespace) + .Where(o => + Regex.IsMatch(o.CustomerID, "^T", RegexOptions.IgnorePatternWhitespace) ) ); @@ -1670,13 +1670,12 @@ await AssertQuery( async, ss => ss.Set() - .Where( - o => - Regex.IsMatch( - o.CustomerID, - "^T", - RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace - ) + .Where(o => + Regex.IsMatch( + o.CustomerID, + "^T", + RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace + ) ) ); @@ -1711,13 +1710,12 @@ public virtual Task Regex_IsMatch_MethodCall_With_Any_Unsupported_Option(bool as async, ss => ss.Set() - .Where( - o => - Regex.IsMatch( - o.CustomerID, - "^T", - RegexOptions.IgnoreCase | RegexOptions.RightToLeft - ) + .Where(o => + Regex.IsMatch( + o.CustomerID, + "^T", + RegexOptions.IgnoreCase | RegexOptions.RightToLeft + ) ) ) ); @@ -1750,9 +1748,8 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - string.Equals(c.CustomerID, "alFkI", StringComparison.OrdinalIgnoreCase) + .Where(c => + string.Equals(c.CustomerID, "alFkI", StringComparison.OrdinalIgnoreCase) ) ); diff --git a/efcore/test/EFCore.Cosmos.Tests/ModelBuilding/CosmosModelBuilderGenericTest.cs b/efcore/test/EFCore.Cosmos.Tests/ModelBuilding/CosmosModelBuilderGenericTest.cs index 9393a7dc173..0ccb14ced21 100644 --- a/efcore/test/EFCore.Cosmos.Tests/ModelBuilding/CosmosModelBuilderGenericTest.cs +++ b/efcore/test/EFCore.Cosmos.Tests/ModelBuilding/CosmosModelBuilderGenericTest.cs @@ -25,7 +25,9 @@ public override void Can_set_composite_key_for_primitive_collection_on_an_entity Assert .Throws( () => - base.Can_set_composite_key_for_primitive_collection_on_an_entity_with_fields() + base.Can_set_composite_key_for_primitive_collection_on_an_entity_with_fields( + + ) ) .Message ); @@ -36,7 +38,9 @@ public override void Access_mode_can_be_overridden_at_entity_and_primitive_colle Assert .Throws( () => - base.Access_mode_can_be_overridden_at_entity_and_primitive_collection_levels() + base.Access_mode_can_be_overridden_at_entity_and_primitive_collection_levels( + + ) ) .Message ); @@ -235,7 +239,9 @@ public override void Primitive_collections_are_required_by_default_only_if_CLR_t Assert .Throws( () => - base.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable() + base.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable( + + ) ) .Message ); @@ -306,7 +312,9 @@ public override void Primitive_collections_specified_by_string_are_shadow_proper Assert .Throws( () => - base.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties() + base.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties( + + ) ) .Message ); @@ -341,8 +349,8 @@ public override void Properties_can_be_made_concurrency_tokens() => public override void Properties_can_have_provider_type_set_for_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveConversion() + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveConversion() ); modelBuilder.Entity(b => @@ -708,7 +716,9 @@ public override void Primitive_collections_are_required_by_default_only_if_CLR_t Assert .Throws( () => - base.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable() + base.Primitive_collections_are_required_by_default_only_if_CLR_type_is_nullable( + + ) ) .Message ); @@ -769,7 +779,9 @@ public override void Primitive_collections_specified_by_string_are_shadow_proper Assert .Throws( () => - base.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties() + base.Primitive_collections_specified_by_string_are_shadow_properties_unless_already_known_to_be_CLR_properties( + + ) ) .Message ); @@ -822,8 +834,8 @@ public override void Can_set_complex_property_annotation() public override void Properties_can_have_provider_type_set_for_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveConversion() + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveConversion() ); modelBuilder @@ -1424,11 +1436,10 @@ public override void AssertEqual( bool compareAnnotations = false ) { - expectedProperties = expectedProperties.Where( - p => p.Name != "__jObject" && p.Name != "__id" + expectedProperties = expectedProperties.Where(p => + p.Name != "__jObject" && p.Name != "__id" ); - actualProperties = actualProperties.Where( - p => p.Name != "__jObject" && p.Name != "__id" + actualProperties = actualProperties.Where(p => p.Name != "__jObject" && p.Name != "__id" ); base.AssertEqual(expectedProperties, actualProperties, assertOrder, compareAnnotations); diff --git a/efcore/test/EFCore.Design.Tests/Design/Internal/CSharpHelperTest.cs b/efcore/test/EFCore.Design.Tests/Design/Internal/CSharpHelperTest.cs index 0f62e1d44a3..b7cb04f37ef 100644 --- a/efcore/test/EFCore.Design.Tests/Design/Internal/CSharpHelperTest.cs +++ b/efcore/test/EFCore.Design.Tests/Design/Internal/CSharpHelperTest.cs @@ -615,8 +615,8 @@ public void Really_unknown_literal_with_no_mapping_support() [ConditionalFact] public void Literal_with_parameterless_constructor() { - var typeMapping = CreateTypeMappingSource( - v => Expression.New(typeof(SimpleTestType)) + var typeMapping = CreateTypeMappingSource(v => + Expression.New(typeof(SimpleTestType)) ); Assert.Equal( @@ -628,12 +628,11 @@ public void Literal_with_parameterless_constructor() [ConditionalFact] public void Literal_with_one_parameter_constructor() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.New( - typeof(SimpleTestType).GetConstructor(new[] { typeof(string) })!, - Expression.Constant(v.Arg1, typeof(string)) - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.New( + typeof(SimpleTestType).GetConstructor(new[] { typeof(string) })!, + Expression.Constant(v.Arg1, typeof(string)) + ) ); Assert.Equal( @@ -645,13 +644,12 @@ public void Literal_with_one_parameter_constructor() [ConditionalFact] public void Literal_with_two_parameter_constructor() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.New( - typeof(SimpleTestType).GetConstructor(new[] { typeof(string), typeof(int?) })!, - Expression.Constant(v.Arg1, typeof(string)), - Expression.Constant(v.Arg2, typeof(int?)) - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.New( + typeof(SimpleTestType).GetConstructor(new[] { typeof(string), typeof(int?) })!, + Expression.Constant(v.Arg1, typeof(string)), + Expression.Constant(v.Arg2, typeof(int?)) + ) ); Assert.Equal( @@ -663,14 +661,13 @@ public void Literal_with_two_parameter_constructor() [ConditionalFact] public void Literal_with_parameterless_static_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Call( - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.StaticCreate), - Type.EmptyTypes - )! - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Call( + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.StaticCreate), + Type.EmptyTypes + )! + ) ); Assert.Equal( @@ -682,15 +679,14 @@ public void Literal_with_parameterless_static_factory() [ConditionalFact] public void Literal_with_one_parameter_static_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Call( - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.StaticCreate), - new[] { typeof(string) } - )!, - Expression.Constant(v.Arg1, typeof(string)) - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Call( + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.StaticCreate), + new[] { typeof(string) } + )!, + Expression.Constant(v.Arg1, typeof(string)) + ) ); Assert.Equal( @@ -702,16 +698,15 @@ public void Literal_with_one_parameter_static_factory() [ConditionalFact] public void Literal_with_two_parameter_static_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Call( - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.StaticCreate), - new[] { typeof(string), typeof(int?) } - )!, - Expression.Constant(v.Arg1, typeof(string)), - Expression.Constant(v.Arg2, typeof(int?)) - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Call( + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.StaticCreate), + new[] { typeof(string), typeof(int?) } + )!, + Expression.Constant(v.Arg1, typeof(string)), + Expression.Constant(v.Arg2, typeof(int?)) + ) ); Assert.Equal( @@ -723,15 +718,14 @@ public void Literal_with_two_parameter_static_factory() [ConditionalFact] public void Literal_with_parameterless_instance_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Call( - Expression.New(typeof(SimpleTestTypeFactory)), - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.Create), - new Type[0] - )! - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Call( + Expression.New(typeof(SimpleTestTypeFactory)), + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.Create), + new Type[0] + )! + ) ); Assert.Equal( @@ -743,19 +737,18 @@ public void Literal_with_parameterless_instance_factory() [ConditionalFact] public void Literal_with_one_parameter_instance_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Convert( - Expression.Call( - Expression.New(typeof(SimpleTestTypeFactory)), - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.Create), - new[] { typeof(string) } - )!, - Expression.Constant(v.Arg1, typeof(string)) - ), - typeof(SimpleTestType) - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Convert( + Expression.Call( + Expression.New(typeof(SimpleTestTypeFactory)), + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.Create), + new[] { typeof(string) } + )!, + Expression.Constant(v.Arg1, typeof(string)) + ), + typeof(SimpleTestType) + ) ); Assert.Equal( @@ -767,23 +760,22 @@ public void Literal_with_one_parameter_instance_factory() [ConditionalFact] public void Literal_with_two_parameter_instance_factory() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Convert( - Expression.Call( - Expression.New( - typeof(SimpleTestTypeFactory).GetConstructor(new[] { typeof(string) })!, - Expression.Constant("4096", typeof(string)) - ), - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.Create), - new[] { typeof(string), typeof(int?) } - )!, - Expression.Constant(v.Arg1, typeof(string)), - Expression.Constant(v.Arg2, typeof(int?)) + var typeMapping = CreateTypeMappingSource(v => + Expression.Convert( + Expression.Call( + Expression.New( + typeof(SimpleTestTypeFactory).GetConstructor(new[] { typeof(string) })!, + Expression.Constant("4096", typeof(string)) ), - typeof(SimpleTestType) - ) + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.Create), + new[] { typeof(string), typeof(int?) } + )!, + Expression.Constant(v.Arg1, typeof(string)), + Expression.Constant(v.Arg2, typeof(int?)) + ), + typeof(SimpleTestType) + ) ); Assert.Equal( @@ -795,23 +787,22 @@ public void Literal_with_two_parameter_instance_factory() [ConditionalFact] public void Literal_with_two_parameter_instance_factory_and_internal_cast() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Convert( - Expression.Call( - Expression.New( - typeof(SimpleTestTypeFactory).GetConstructor(new[] { typeof(string) })!, - Expression.Constant("4096", typeof(string)) - ), - typeof(SimpleTestTypeFactory).GetMethod( - nameof(SimpleTestTypeFactory.Create), - new[] { typeof(string), typeof(int?) } - )!, - Expression.Constant(v.Arg1, typeof(string)), - Expression.Convert(Expression.Constant(v.Arg2, typeof(int)), typeof(int?)) + var typeMapping = CreateTypeMappingSource(v => + Expression.Convert( + Expression.Call( + Expression.New( + typeof(SimpleTestTypeFactory).GetConstructor(new[] { typeof(string) })!, + Expression.Constant("4096", typeof(string)) ), - typeof(SimpleTestType) - ) + typeof(SimpleTestTypeFactory).GetMethod( + nameof(SimpleTestTypeFactory.Create), + new[] { typeof(string), typeof(int?) } + )!, + Expression.Constant(v.Arg1, typeof(string)), + Expression.Convert(Expression.Constant(v.Arg2, typeof(int)), typeof(int?)) + ), + typeof(SimpleTestType) + ) ); Assert.Equal( @@ -823,12 +814,11 @@ public void Literal_with_two_parameter_instance_factory_and_internal_cast() [ConditionalFact] public void Literal_with_static_field() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Field( - null, - typeof(SimpleTestType).GetField(nameof(SimpleTestType.SomeStaticField))! - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Field( + null, + typeof(SimpleTestType).GetField(nameof(SimpleTestType.SomeStaticField))! + ) ); Assert.Equal( @@ -840,12 +830,11 @@ public void Literal_with_static_field() [ConditionalFact] public void Literal_with_static_property() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Property( - null, - typeof(SimpleTestType).GetProperty(nameof(SimpleTestType.SomeStaticProperty))! - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Property( + null, + typeof(SimpleTestType).GetProperty(nameof(SimpleTestType.SomeStaticProperty))! + ) ); Assert.Equal( @@ -857,12 +846,11 @@ public void Literal_with_static_property() [ConditionalFact] public void Literal_with_instance_property() { - var typeMapping = CreateTypeMappingSource( - v => - Expression.Property( - Expression.New(typeof(SimpleTestType)), - typeof(SimpleTestType).GetProperty(nameof(SimpleTestType.SomeInstanceProperty))! - ) + var typeMapping = CreateTypeMappingSource(v => + Expression.Property( + Expression.New(typeof(SimpleTestType)), + typeof(SimpleTestType).GetProperty(nameof(SimpleTestType.SomeInstanceProperty))! + ) ); Assert.Equal( @@ -874,8 +862,8 @@ public void Literal_with_instance_property() [ConditionalFact] public void Literal_with_add() { - var typeMapping = CreateTypeMappingSource( - v => Expression.Add(Expression.Constant(10), Expression.Constant(10)) + var typeMapping = CreateTypeMappingSource(v => + Expression.Add(Expression.Constant(10), Expression.Constant(10)) ); Assert.Equal("10 + 10", new CSharpHelper(typeMapping).UnknownLiteral(new SimpleTestType())); @@ -884,8 +872,8 @@ public void Literal_with_add() [ConditionalFact] public void Literal_with_unsupported_node_throws() { - var typeMapping = CreateTypeMappingSource( - v => Expression.Multiply(Expression.Constant(10), Expression.Constant(10)) + var typeMapping = CreateTypeMappingSource(v => + Expression.Multiply(Expression.Constant(10), Expression.Constant(10)) ); Assert.Equal( diff --git a/efcore/test/EFCore.Design.Tests/Design/Internal/DbContextOperationsTest.cs b/efcore/test/EFCore.Design.Tests/Design/Internal/DbContextOperationsTest.cs index 94871df2f11..2271e60d273 100644 --- a/efcore/test/EFCore.Design.Tests/Design/Internal/DbContextOperationsTest.cs +++ b/efcore/test/EFCore.Design.Tests/Design/Internal/DbContextOperationsTest.cs @@ -162,8 +162,8 @@ private static class TestProgramWithContextFactory private static TestWebHost BuildWebHost(string[] args) => new( new ServiceCollection() - .AddDbContextFactory( - b => b.UseInMemoryDatabase("In-memory test database") + .AddDbContextFactory(b => + b.UseInMemoryDatabase("In-memory test database") ) .BuildServiceProvider(validateScopes: true) ); @@ -172,11 +172,8 @@ private static TestWebHost BuildWebHost(string[] args) => private static class TestProgramRelational { private static TestWebHost BuildWebHost(string[] args) => - CreateWebHost( - b => - b.UseSqlServer( - @"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0" - ) + CreateWebHost(b => + b.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Test;ConnectRetryCount=0") ); } @@ -207,8 +204,8 @@ Func configureProvider ) => new( new ServiceCollection() - .AddDbContext( - b => configureProvider(b.EnableServiceProviderCaching(false)) + .AddDbContext(b => + configureProvider(b.EnableServiceProviderCaching(false)) ) .BuildServiceProvider(validateScopes: true) ); diff --git a/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs b/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs index ab26faf3b40..33c70f2b5d1 100644 --- a/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs +++ b/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationOperationGeneratorTest.cs @@ -19,7 +19,9 @@ public void Generate_separates_operations_by_a_blank_line() new CSharpHelper( new SqlServerTypeMappingSource( TestServiceFactory.Instance.Create(), - TestServiceFactory.Instance.Create() + TestServiceFactory.Instance.Create( + + ) ) ) ) diff --git a/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs b/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs index 40a4362a419..ade40bd4c3c 100644 --- a/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs +++ b/efcore/test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs @@ -2034,11 +2034,10 @@ public virtual void CheckConstraint_is_stored_in_snapshot_as_fluent_api() => { builder .Entity() - .ToTable( - tb => - tb.HasCheckConstraint("AlternateId", "AlternateId > Id") - .HasName("CK_Customer_AlternateId") - .HasAnnotation("foo", "bar") + .ToTable(tb => + tb.HasCheckConstraint("AlternateId", "AlternateId > Id") + .HasName("CK_Customer_AlternateId") + .HasAnnotation("foo", "bar") ); builder.Ignore(); }, @@ -2082,8 +2081,8 @@ public virtual void CheckConstraint_is_only_stored_in_snapshot_once_for_TPH() => { builder .Entity() - .ToTable( - tb => tb.HasCheckConstraint("CK_BaseEntity_AlternateId", "AlternateId > Id") + .ToTable(tb => + tb.HasCheckConstraint("CK_BaseEntity_AlternateId", "AlternateId > Id") ); builder.Entity(); }, @@ -2144,11 +2143,10 @@ public virtual void Trigger_is_stored_in_snapshot() => { builder .Entity() - .ToTable( - tb => - tb.HasTrigger("SomeTrigger") - .HasAnnotation("foo", "bar") - .HasDatabaseName("SomeTrg") + .ToTable(tb => + tb.HasTrigger("SomeTrigger") + .HasAnnotation("foo", "bar") + .HasDatabaseName("SomeTrg") ); builder.Ignore(); }, @@ -3660,14 +3658,13 @@ public virtual void Temporal_table_information_is_stored_in_snapshot() => builder => builder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); + }) ), AddBoilerPlate( GetHeading() @@ -3849,16 +3846,15 @@ public virtual void Owned_types_are_stored_in_snapshot() => b.HasData(new EntityWithOneProperty { Id = 1 }); }); - builder.Entity( - b => - b.OwnsMany( - es => es.Properties, - es => - { - es.HasKey(e => e.Id); - es.HasOne(e => e.EntityWithOneProperty).WithOne(); - } - ) + builder.Entity(b => + b.OwnsMany( + es => es.Properties, + es => + { + es.HasKey(e => e.Id); + es.HasOne(e => e.EntityWithOneProperty).WithOne(); + } + ) ); }, AddBoilerPlate( @@ -4618,12 +4614,11 @@ public virtual void Snapshot_with_OwnedNavigationBuilder_HasCheckConstraint_comp .OwnsMany( o => o.OwnedEntities, ownee => - ownee.ToTable( - tb => - tb.HasCheckConstraint( - "CK_TestOwnee_TestEnum_Enum_Constraint", - "[TestEnum] IN (0, 1, 2)" - ) + ownee.ToTable(tb => + tb.HasCheckConstraint( + "CK_TestOwnee_TestEnum_Enum_Constraint", + "[TestEnum] IN (0, 1, 2)" + ) ) ); }, @@ -5484,8 +5479,8 @@ public virtual void Property_column_name_is_stored_in_snapshot_when_DefaultColum modelBuilder => modelBuilder .Entity(b => b.HasBaseType()) - .Entity>( - b => b.HasOne(x => x.Bar).WithOne().HasForeignKey() + .Entity>(b => + b.HasOne(x => x.Bar).WithOne().HasForeignKey() ), AddBoilerPlate( """ @@ -6956,56 +6951,51 @@ public virtual void Index_IsDescending_is_stored_in_snapshot() => builder.Entity(e => { e.HasIndex( - t => - new + t => new + { + t.X, + t.Y, + t.Z + }, + "IX_unspecified" + ); + e.HasIndex( + t => new { t.X, t.Y, t.Z }, - "IX_unspecified" - ); - e.HasIndex( - t => - new - { - t.X, - t.Y, - t.Z - }, "IX_empty" ) .IsDescending(); e.HasIndex( - t => - new - { - t.X, - t.Y, - t.Z - }, + t => new + { + t.X, + t.Y, + t.Z + }, "IX_all_ascending" ) .IsDescending(false, false, false); e.HasIndex( - t => - new - { - t.X, - t.Y, - t.Z - }, + t => new + { + t.X, + t.Y, + t.Z + }, "IX_all_descending" ) .IsDescending(true, true, true); e.HasIndex( - t => - new - { - t.X, - t.Y, - t.Z - }, + t => new + { + t.X, + t.Y, + t.Z + }, "IX_mixed" ) .IsDescending(false, true, false); diff --git a/efcore/test/EFCore.Design.Tests/Migrations/Design/MigrationScaffolderTest.cs b/efcore/test/EFCore.Design.Tests/Migrations/Design/MigrationScaffolderTest.cs index ed3b17d70f2..96b14e2b0ec 100644 --- a/efcore/test/EFCore.Design.Tests/Migrations/Design/MigrationScaffolderTest.cs +++ b/efcore/test/EFCore.Design.Tests/Migrations/Design/MigrationScaffolderTest.cs @@ -97,7 +97,9 @@ private IMigrationsScaffolder CreateMigrationScaffolder() new MigrationsModelDiffer( new TestRelationalTypeMappingSource( TestServiceFactory.Instance.Create(), - TestServiceFactory.Instance.Create() + TestServiceFactory.Instance.Create( + + ) ), new MigrationsAnnotationProvider( new MigrationsAnnotationProviderDependencies() diff --git a/efcore/test/EFCore.Design.Tests/Scaffolding/Internal/RelationalScaffoldingModelFactoryTest.cs b/efcore/test/EFCore.Design.Tests/Scaffolding/Internal/RelationalScaffoldingModelFactoryTest.cs index b8e9088dae3..150a3eeab49 100644 --- a/efcore/test/EFCore.Design.Tests/Scaffolding/Internal/RelationalScaffoldingModelFactoryTest.cs +++ b/efcore/test/EFCore.Design.Tests/Scaffolding/Internal/RelationalScaffoldingModelFactoryTest.cs @@ -531,15 +531,12 @@ public void Primary_key(string[] keyProps, int length) } }; foreach ( - var column in keyProps.Select( - k => - new DatabaseColumn - { - Table = Table, - Name = k, - StoreType = "int" - } - ) + var column in keyProps.Select(k => new DatabaseColumn + { + Table = Table, + Name = k, + StoreType = "int" + }) ) { info.Tables[0].Columns.Add(column); diff --git a/efcore/test/EFCore.Design.Tests/TestUtilities/FakeScaffoldingModelFactory.cs b/efcore/test/EFCore.Design.Tests/TestUtilities/FakeScaffoldingModelFactory.cs index 4e2d8c15cf9..24730b0d4fa 100644 --- a/efcore/test/EFCore.Design.Tests/TestUtilities/FakeScaffoldingModelFactory.cs +++ b/efcore/test/EFCore.Design.Tests/TestUtilities/FakeScaffoldingModelFactory.cs @@ -67,8 +67,8 @@ public override IModel Create(DatabaseModel databaseModel, ModelReverseEngineerO if (foreignKey.PrincipalTable is DatabaseTableRef tableRef) { - foreignKey.PrincipalTable = databaseModel.Tables.First( - t => t.Name == tableRef.Name && t.Schema == tableRef.Schema + foreignKey.PrincipalTable = databaseModel.Tables.First(t => + t.Name == tableRef.Name && t.Schema == tableRef.Schema ); } diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/CompositeKeyEndToEndTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/CompositeKeyEndToEndTest.cs index 96cbb4014fa..9a1ced2c8cd 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/CompositeKeyEndToEndTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/CompositeKeyEndToEndTest.cs @@ -89,8 +89,8 @@ public async Task Can_use_generated_values_in_composite_key_end_to_end() using (var context = new BronieContext(serviceProvider)) { - var unicorn = context.Unicorns.Single( - e => (e.Id1 == id1) && (e.Id2 == id2) && (e.Id3 == id3) + var unicorn = context.Unicorns.Single(e => + (e.Id1 == id1) && (e.Id2 == id2) && (e.Id3 == id3) ); unicorn.Name = "Bad Hair Day"; @@ -100,8 +100,8 @@ public async Task Can_use_generated_values_in_composite_key_end_to_end() using (var context = new BronieContext(serviceProvider)) { - var unicorn = context.Unicorns.Single( - e => (e.Id1 == id1) && (e.Id2 == id2) && (e.Id3 == id3) + var unicorn = context.Unicorns.Single(e => + (e.Id1 == id1) && (e.Id2 == id2) && (e.Id3 == id3) ); Assert.Equal("Bad Hair Day", unicorn.Name); diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/DatabaseErrorLogStateTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/DatabaseErrorLogStateTest.cs index cb04fa6837e..5057afa73b3 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/DatabaseErrorLogStateTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/DatabaseErrorLogStateTest.cs @@ -68,14 +68,14 @@ public Task Query_logs_DatabaseErrorLogState_during_DbSet_enumeration_async() => [ConditionalFact] public Task Query_logs_DatabaseErrorLogState_during_LINQ_enumeration() => - Query_logs_DatabaseErrorLogState_test( - c => c.Blogs.OrderBy(b => b.Name).Where(b => b.Url.StartsWith("http://")).ToList() + Query_logs_DatabaseErrorLogState_test(c => + c.Blogs.OrderBy(b => b.Name).Where(b => b.Url.StartsWith("http://")).ToList() ); [ConditionalFact] public Task Query_logs_DatabaseErrorLogState_during_LINQ_enumeration_async() => - Query_logs_DatabaseErrorLogState_test( - c => c.Blogs.OrderBy(b => b.Name).Where(b => b.Url.StartsWith("http://")).ToListAsync() + Query_logs_DatabaseErrorLogState_test(c => + c.Blogs.OrderBy(b => b.Name).Where(b => b.Url.StartsWith("http://")).ToListAsync() ); [ConditionalFact] diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/GlobalDatabaseTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/GlobalDatabaseTest.cs index a58cfa1c380..8b192139107 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/GlobalDatabaseTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/GlobalDatabaseTest.cs @@ -143,10 +143,9 @@ public void Global_store_can_be_used_when_AddDbContext_force_different_internal_ } var serviceProvider = new ServiceCollection() - .AddDbContext( - b => - b.UseInMemoryDatabase(nameof(BooFooContext), _databaseRoot) - .EnableServiceProviderCaching(false) + .AddDbContext(b => + b.UseInMemoryDatabase(nameof(BooFooContext), _databaseRoot) + .EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true); diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/NullabilityCheckInMemoryTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/NullabilityCheckInMemoryTest.cs index 3bfdd13015d..19405191604 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/NullabilityCheckInMemoryTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/NullabilityCheckInMemoryTest.cs @@ -26,8 +26,7 @@ public void IsRequired_for_property_throws_while_inserting_null_value() => .Throws(() => { var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder(); - modelBuilder.Entity( - eb => eb.Property(p => p.Property).IsRequired() + modelBuilder.Entity(eb => eb.Property(p => p.Property).IsRequired() ); var optionsBuilder = new DbContextOptionsBuilder() @@ -57,8 +56,7 @@ public void IsRequired_for_property_throws_while_inserting_null_value_sensitive( .Throws(() => { var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder(); - modelBuilder.Entity( - eb => eb.Property(p => p.Property).IsRequired() + modelBuilder.Entity(eb => eb.Property(p => p.Property).IsRequired() ); var optionsBuilder = new DbContextOptionsBuilder() @@ -154,8 +152,8 @@ public void RequiredAttribute_And_IsRequired_for_properties_throws_while_inserti .Throws(() => { var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder(); - modelBuilder.Entity( - eb => eb.Property(p => p.Property).IsRequired() + modelBuilder.Entity(eb => + eb.Property(p => p.Property).IsRequired() ); var optionsBuilder = new DbContextOptionsBuilder() @@ -216,8 +214,8 @@ public void Can_insert_null_value_with_RequiredAttribute_for_property_if_nullabi public void Can_insert_null_values_with_RequiredAttribute_and_IsRequired_for_properties_if_nullability_check_is_disabled() { var modelBuilder = InMemoryTestHelpers.Instance.CreateConventionBuilder(); - modelBuilder.Entity( - eb => eb.Property(p => p.Property).IsRequired() + modelBuilder.Entity(eb => + eb.Property(p => p.Property).IsRequired() ); var optionsBuilder = new DbContextOptionsBuilder() diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/Query/QueryBugsInMemoryTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/Query/QueryBugsInMemoryTest.cs index eb00658e550..da1d4f7d659 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/Query/QueryBugsInMemoryTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/Query/QueryBugsInMemoryTest.cs @@ -853,17 +853,17 @@ public virtual void Using_explicit_interface_implementation_as_navigation_works( using (CreateScratch(t => { }, "21768")) { using var context = new MyContext21768(); - Expression> projection = b => - new BookViewModel21768 + Expression> projection = + b => new BookViewModel21768 { FirstPage = - b.FrontCover.Illustrations.FirstOrDefault( - i => i.State >= IllustrationState21768.Approved + b.FrontCover.Illustrations.FirstOrDefault(i => + i.State >= IllustrationState21768.Approved ) != null ? new PageViewModel21768 { - Uri = b.FrontCover.Illustrations.FirstOrDefault( - i => i.State >= IllustrationState21768.Approved + Uri = b.FrontCover.Illustrations.FirstOrDefault(i => + i.State >= IllustrationState21768.Approved ).Uri } : null, @@ -1032,22 +1032,19 @@ public virtual void Multiple_owned_references_at_same_level_maintains_valueBuffe var query = context .Set() - .Select( - dtoOwner => - new + .Select(dtoOwner => new + { + dtoOwner.Id, + Owned2 = dtoOwner.Owned2 == null + ? null + : new { - dtoOwner.Id, - Owned2 = dtoOwner.Owned2 == null + Other = dtoOwner.Owned2.Other == null ? null - : new - { - Other = dtoOwner.Owned2.Other == null - ? null - : new { dtoOwner.Owned2.Other.Id } - }, - Owned1 = dtoOwner.Owned1 == null ? null : new { dtoOwner.Owned1.Value } - } - ) + : new { dtoOwner.Owned2.Other.Id } + }, + Owned1 = dtoOwner.Owned1 == null ? null : new { dtoOwner.Owned1.Value } + }) .ToList(); var owner = Assert.Single(query); @@ -1653,17 +1650,14 @@ public virtual void Shared_owned_property_on_multiple_level_in_Select() using var context = new MyContext18435(); var result = context - .TestEntities.Select( - x => - new - { - x.Value, - A = x.Owned.First, - B = x.Owned.Second, - C = x.Child.Owned.First, - D = x.Child.Owned.Second - } - ) + .TestEntities.Select(x => new + { + x.Value, + A = x.Owned.First, + B = x.Owned.Second, + C = x.Child.Owned.First, + D = x.Child.Owned.Second + }) .FirstOrDefault(); Assert.Equal("test", result.Value); @@ -1946,25 +1940,19 @@ public virtual void Union_with_different_property_name_using_same_anonymous_type { using var context = new MyContext23360(); - var userQuery = context.User.Select( - u => - new CommonSelectType23360 - { - // 1. FirstName, 2. LastName - FirstName = u.Forename, - LastName = u.Surname, - } - ); + var userQuery = context.User.Select(u => new CommonSelectType23360 + { + // 1. FirstName, 2. LastName + FirstName = u.Forename, + LastName = u.Surname, + }); - var customerQuery = context.Customer.Select( - c => - new CommonSelectType23360 - { - // 1. LastName, 2. FirstName - LastName = c.FamilyName, - FirstName = c.GivenName, - } - ); + var customerQuery = context.Customer.Select(c => new CommonSelectType23360 + { + // 1. LastName, 2. FirstName + LastName = c.FamilyName, + FirstName = c.GivenName, + }); var result = userQuery.Union(customerQuery).ToList(); @@ -2032,24 +2020,23 @@ public virtual void Ordering_of_collection_result_is_correct() var myA = context .As.Where(x => x.Id == 1) - .Select( - x => - new ADto18394 - { - Id = x.Id, - PropertyB = - (x.PropertyB == null) - ? null - : new BDto18394 - { - Id = x.PropertyB.Id, - PropertyCList = x.PropertyB.PropertyCList.Select( - y => new CDto18394 { Id = y.Id, SomeText = y.SomeText } - ) - .ToList() - } - } - ) + .Select(x => new ADto18394 + { + Id = x.Id, + PropertyB = + (x.PropertyB == null) + ? null + : new BDto18394 + { + Id = x.PropertyB.Id, + PropertyCList = x.PropertyB.PropertyCList.Select(y => new CDto18394 + { + Id = y.Id, + SomeText = y.SomeText + }) + .ToList() + } + }) .FirstOrDefault(); Assert.Equal("TestText", myA.PropertyB.PropertyCList.First().SomeText); diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/Query/WarningsTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/Query/WarningsTest.cs index f1bf40c055c..7bc7e5961bb 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/Query/WarningsTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/Query/WarningsTest.cs @@ -143,12 +143,11 @@ public void Lazy_load_with_disposed_context_can_be_configured_to_log() Assert.Null(entity.Nav); - var log = loggerFactory.Log.Single( - l => - l.Message - == CoreResources - .LogLazyLoadOnDisposedContext(new TestLogger()) - .GenerateMessage("WarningAsErrorEntity", "Nav") + var log = loggerFactory.Log.Single(l => + l.Message + == CoreResources + .LogLazyLoadOnDisposedContext(new TestLogger()) + .GenerateMessage("WarningAsErrorEntity", "Nav") ); Assert.Equal(LogLevel.Warning, log.Level); @@ -191,12 +190,11 @@ public void Lazy_load_with_disposed_context_can_be_configured_to_log_at_debug_le Assert.Null(entity.Nav); - var log = loggerFactory.Log.Single( - l => - l.Message - == CoreResources - .LogLazyLoadOnDisposedContext(new TestLogger()) - .GenerateMessage("WarningAsErrorEntity", "Nav") + var log = loggerFactory.Log.Single(l => + l.Message + == CoreResources + .LogLazyLoadOnDisposedContext(new TestLogger()) + .GenerateMessage("WarningAsErrorEntity", "Nav") ); Assert.Equal(LogLevel.Debug, log.Level); diff --git a/efcore/test/EFCore.InMemory.FunctionalTests/ValueConvertersEndToEndInMemoryTest.cs b/efcore/test/EFCore.InMemory.FunctionalTests/ValueConvertersEndToEndInMemoryTest.cs index cdef8f7a3b5..8bc96dc04a2 100644 --- a/efcore/test/EFCore.InMemory.FunctionalTests/ValueConvertersEndToEndInMemoryTest.cs +++ b/efcore/test/EFCore.InMemory.FunctionalTests/ValueConvertersEndToEndInMemoryTest.cs @@ -23,11 +23,11 @@ public virtual async Task Query_with_converter_and_null_check(bool async) // Iss if (async) { - await set.CountAsync( - p => p.NullableListOfInt != nullList && p.NullableListOfInt!.Count > 0 + await set.CountAsync(p => + p.NullableListOfInt != nullList && p.NullableListOfInt!.Count > 0 ); - await set.CountAsync( - p => p.NullableListOfInt != null && p.NullableListOfInt.Count > 0 + await set.CountAsync(p => + p.NullableListOfInt != null && p.NullableListOfInt.Count > 0 ); } else diff --git a/efcore/test/EFCore.InMemory.Tests/Storage/InMemoryDatabaseTest.cs b/efcore/test/EFCore.InMemory.Tests/Storage/InMemoryDatabaseTest.cs index a7f7e36559d..3dc4dae7dcd 100644 --- a/efcore/test/EFCore.InMemory.Tests/Storage/InMemoryDatabaseTest.cs +++ b/efcore/test/EFCore.InMemory.Tests/Storage/InMemoryDatabaseTest.cs @@ -167,8 +167,8 @@ public async Task Should_log_writes() await inMemoryDatabase.SaveChangesAsync(new[] { entityEntry }); - var (Level, _, Message, _, _) = loggerFactory.Log.Single( - t => t.Id.Id == InMemoryEventId.ChangesSaved.Id + var (Level, _, Message, _, _) = loggerFactory.Log.Single(t => + t.Id.Id == InMemoryEventId.ChangesSaved.Id ); Assert.Equal(LogLevel.Information, Level); diff --git a/efcore/test/EFCore.OData.FunctionalTests/Query/NorthwindControllers.cs b/efcore/test/EFCore.OData.FunctionalTests/Query/NorthwindControllers.cs index b83a4f97711..ef9668244cc 100644 --- a/efcore/test/EFCore.OData.FunctionalTests/Query/NorthwindControllers.cs +++ b/efcore/test/EFCore.OData.FunctionalTests/Query/NorthwindControllers.cs @@ -75,8 +75,8 @@ public OrderDetailsController(NorthwindODataContext context) [EnableQuery] public ITestActionResult Get([FromODataUri] int keyOrderId, [FromODataUri] int keyProductId) { - var result = _context.OrderDetails.FirstOrDefault( - e => e.OrderID == keyOrderId && e.ProductID == keyProductId + var result = _context.OrderDetails.FirstOrDefault(e => + e.OrderID == keyOrderId && e.ProductID == keyProductId ); return result == null ? NotFound() : Ok(result); diff --git a/efcore/test/EFCore.Proxies.Tests/ChangeDetectionProxyTests.cs b/efcore/test/EFCore.Proxies.Tests/ChangeDetectionProxyTests.cs index 32e727a7898..83a69e50390 100644 --- a/efcore/test/EFCore.Proxies.Tests/ChangeDetectionProxyTests.cs +++ b/efcore/test/EFCore.Proxies.Tests/ChangeDetectionProxyTests.cs @@ -34,8 +34,8 @@ public void Throws_if_non_virtual_property() [ConditionalFact] public void Throws_if_non_virtual_indexer_property() { - using var context = new ChangeContext( - entityBuilderAction: b => b.IndexerProperty("Snoopy") + using var context = new ChangeContext(entityBuilderAction: b => + b.IndexerProperty("Snoopy") ); Assert.Equal( ProxiesStrings.NonVirtualIndexerProperty(nameof(ChangeNonVirtualIndexer)), @@ -65,8 +65,8 @@ public void Does_not_throw_if_dictionary_type_with_only_PKs() [ConditionalFact] public void Throws_if_dictionary_type_with_additional_properties() { - using var context = new SharedChangeContext>( - b => b.IndexerProperty("Snoopy") + using var context = new SharedChangeContext>(b => + b.IndexerProperty("Snoopy") ); Assert.Equal( diff --git a/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs index 3e695ca5a6a..80493443c41 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/ComplexTypeBulkUpdatesTestBase.cs @@ -93,15 +93,12 @@ public virtual Task Update_multiple_projected_complex_types_via_anonymous_type(b async, ss => ss.Set() - .Select( - c => - new - { - c.ShippingAddress, - c.BillingAddress, - Customer = c - } - ), + .Select(c => new + { + c.ShippingAddress, + c.BillingAddress, + Customer = c + }), x => x.Customer, s => s.SetProperty(x => x.ShippingAddress.ZipCode, x => x.BillingAddress.ZipCode) diff --git a/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs index 980941c98ef..5d0a1403004 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/BulkUpdates/InheritanceBulkUpdatesTestBase.cs @@ -83,14 +83,13 @@ public virtual Task Delete_GroupBy_Where_Select_First_2(bool async) => async, ss => ss.Set() - .Where( - e => - e - == ss.Set() - .GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3) - .Select(g => g.First()) - .FirstOrDefault() + .Where(e => + e + == ss.Set() + .GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3) + .Select(g => g.First()) + .FirstOrDefault() ), rowsAffectedCount: 2 ); @@ -102,13 +101,12 @@ public virtual Task Delete_GroupBy_Where_Select_First_3(bool async) => async, ss => ss.Set() - .Where( - e => - ss.Set() - .GroupBy(e => e.CountryId) - .Where(g => g.Count() < 3) - .Select(g => g.First()) - .Any(i => i == e) + .Where(e => + ss.Set() + .GroupBy(e => e.CountryId) + .Where(g => g.Count() < 3) + .Select(g => g.First()) + .Any(i => i == e) ), rowsAffectedCount: 2 ); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/ConcurrencyDetectorDisabledRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/ConcurrencyDetectorDisabledRelationalTestBase.cs index 5b1392e3f93..d9140eb53c4 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/ConcurrencyDetectorDisabledRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/ConcurrencyDetectorDisabledRelationalTestBase.cs @@ -18,16 +18,13 @@ protected string NormalizeDelimitersInRawString(string sql) => [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task FromSql(bool async) => - ConcurrencyDetectorTest( - async c => - async - ? await c.Products.FromSqlRaw( - NormalizeDelimitersInRawString("select * from [Products]") - ) - .ToListAsync() - : c.Products.FromSqlRaw( - NormalizeDelimitersInRawString("select * from [Products]") - ) - .ToList() + ConcurrencyDetectorTest(async c => + async + ? await c.Products.FromSqlRaw( + NormalizeDelimitersInRawString("select * from [Products]") + ) + .ToListAsync() + : c.Products.FromSqlRaw(NormalizeDelimitersInRawString("select * from [Products]")) + .ToList() ); } diff --git a/efcore/test/EFCore.Relational.Specification.Tests/LoggingRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/LoggingRelationalTestBase.cs index d9d98949a15..f5875e1d967 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/LoggingRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/LoggingRelationalTestBase.cs @@ -50,8 +50,8 @@ public void Logs_context_initialization_migrations_history_table() => public void Logs_context_initialization_migrations_history_table_schema() => Assert.Equal( ExpectedMessage("MigrationsHistoryTable=mySchema.MyHistory " + DefaultOptions), - ActualMessage( - s => CreateOptionsBuilder(s, b => b.MigrationsHistoryTable("MyHistory", "mySchema")) + ActualMessage(s => + CreateOptionsBuilder(s, b => b.MigrationsHistoryTable("MyHistory", "mySchema")) ) ); @@ -145,20 +145,19 @@ public virtual void ForeignKeyPropertiesMappedToUnrelatedTables_throws_by_defaul Assert.Equal( CoreStrings.WarningAsErrorTemplate( RelationalEventId.ForeignKeyPropertiesMappedToUnrelatedTables.ToString(), - definition.GenerateMessage( - l => - l.Log( - definition.Level, - definition.EventId, - definition.MessageFormat, - "{'FavoritePersonId'}", - nameof(Cat), - nameof(Person), - "{'FavoritePersonId'}", - nameof(Cat), - "{'Id'}", - nameof(Person) - ) + definition.GenerateMessage(l => + l.Log( + definition.Level, + definition.EventId, + definition.MessageFormat, + "{'FavoritePersonId'}", + nameof(Cat), + nameof(Person), + "{'FavoritePersonId'}", + nameof(Cat), + "{'Id'}", + nameof(Person) + ) ), "RelationalEventId.ForeignKeyPropertiesMappedToUnrelatedTables" ), diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs index 698e0873cd3..53e72a6081b 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Migrations/MigrationsTestBase.cs @@ -1232,12 +1232,11 @@ public virtual Task Add_column_with_check_constraint() => e => { e.Property("DriverLicense"); - e.ToTable( - tb => - tb.HasCheckConstraint( - "CK_People_Foo", - $"{DelimitIdentifier("DriverLicense")} > 0" - ) + e.ToTable(tb => + tb.HasCheckConstraint( + "CK_People_Foo", + $"{DelimitIdentifier("DriverLicense")} > 0" + ) ); } ), @@ -3000,12 +2999,11 @@ public virtual Task Add_check_constraint_with_name() => builder => builder .Entity("People") - .ToTable( - tb => - tb.HasCheckConstraint( - "CK_People_Foo", - $"{DelimitIdentifier("DriverLicense")} > 0" - ) + .ToTable(tb => + tb.HasCheckConstraint( + "CK_People_Foo", + $"{DelimitIdentifier("DriverLicense")} > 0" + ) ), model => { @@ -3028,22 +3026,20 @@ public virtual Task Alter_check_constraint() => builder => builder .Entity("People") - .ToTable( - tb => - tb.HasCheckConstraint( - "CK_People_Foo", - $"{DelimitIdentifier("DriverLicense")} > 0" - ) + .ToTable(tb => + tb.HasCheckConstraint( + "CK_People_Foo", + $"{DelimitIdentifier("DriverLicense")} > 0" + ) ), builder => builder .Entity("People") - .ToTable( - tb => - tb.HasCheckConstraint( - "CK_People_Foo", - $"{DelimitIdentifier("DriverLicense")} > 1" - ) + .ToTable(tb => + tb.HasCheckConstraint( + "CK_People_Foo", + $"{DelimitIdentifier("DriverLicense")} > 1" + ) ), model => { @@ -3066,12 +3062,11 @@ public virtual Task Drop_check_constraint() => builder => builder .Entity("People") - .ToTable( - tb => - tb.HasCheckConstraint( - "CK_People_Foo", - $"{DelimitIdentifier("DriverLicense")} > 0" - ) + .ToTable(tb => + tb.HasCheckConstraint( + "CK_People_Foo", + $"{DelimitIdentifier("DriverLicense")} > 0" + ) ), builder => { }, model => diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/EntitySplittingQueryTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/EntitySplittingQueryTestBase.cs index 1cd81d1ebe4..47c447fbb3b 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/EntitySplittingQueryTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/EntitySplittingQueryTestBase.cs @@ -100,15 +100,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.Id, - e.IntValue1, - e.StringValue1 - } - ), + .Select(e => new + { + e.Id, + e.IntValue1, + e.StringValue1 + }), elementSorter: e => e.Id ); } @@ -147,15 +144,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.Id, - e.IntValue3, - e.StringValue3 - } - ), + .Select(e => new + { + e.Id, + e.IntValue3, + e.StringValue3 + }), elementSorter: e => e.Id ); } @@ -194,15 +188,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.Id, - e.IntValue4, - e.StringValue4 - } - ), + .Select(e => new + { + e.Id, + e.IntValue4, + e.StringValue4 + }), elementSorter: e => e.Id ); } @@ -470,15 +461,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.IntValue1, - e.IntValue3, - e.EntityThree - } - ), + .Select(e => new + { + e.IntValue1, + e.IntValue3, + e.EntityThree + }), elementSorter: e => e.IntValue1, elementAsserter: (e, a) => { @@ -577,15 +565,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.Id, - e.OwnedReference.OwnedIntValue4, - e.OwnedReference.OwnedStringValue4 - } - ), + .Select(e => new + { + e.Id, + e.OwnedReference.OwnedIntValue4, + e.OwnedReference.OwnedStringValue4 + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -690,15 +675,12 @@ await AssertQuery( async, ss => ss.Set() - .Select( - e => - new - { - e.Id, - e.OwnedReference.OwnedIntValue4, - e.OwnedReference.OwnedStringValue4 - } - ), + .Select(e => new + { + e.Id, + e.OwnedReference.OwnedIntValue4, + e.OwnedReference.OwnedStringValue4 + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -2830,10 +2812,9 @@ bool assertOrder expectedType.IsGenericType && expectedType .GetTypeInfo() - .ImplementedInterfaces.Any( - i => - i.IsConstructedGenericType - && i.GetGenericTypeDefinition() == typeof(IEnumerable<>) + .ImplementedInterfaces.Any(i => + i.IsConstructedGenericType + && i.GetGenericTypeDefinition() == typeof(IEnumerable<>) ) ) { diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/FromSqlSprocQueryTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/FromSqlSprocQueryTestBase.cs index 5d0c838fc8b..e8c1c08bc45 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/FromSqlSprocQueryTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/FromSqlSprocQueryTestBase.cs @@ -154,14 +154,11 @@ public virtual async Task From_sql_queryable_stored_procedure_re_projection(bool var query = context .Set() .FromSqlRaw(TenMostExpensiveProductsSproc, GetTenMostExpensiveProductsParameters()) - .Select( - mep => - new MostExpensiveProduct - { - TenMostExpensiveProducts = "Foo", - UnitPrice = mep.UnitPrice - } - ); + .Select(mep => new MostExpensiveProduct + { + TenMostExpensiveProducts = "Foo", + UnitPrice = mep.UnitPrice + }); Assert.Equal( RelationalStrings.FromSqlNonComposable, @@ -188,14 +185,11 @@ bool async .FromSqlRaw(TenMostExpensiveProductsSproc, GetTenMostExpensiveProductsParameters()); var actual = (async ? await query.ToListAsync() : query.ToList()) - .Select( - mep => - new MostExpensiveProduct - { - TenMostExpensiveProducts = "Foo", - UnitPrice = mep.UnitPrice - } - ) + .Select(mep => new MostExpensiveProduct + { + TenMostExpensiveProducts = "Foo", + UnitPrice = mep.UnitPrice + }) .ToArray(); Assert.Equal(10, actual.Length); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryAdHocTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryAdHocTestBase.cs index dbdd0678353..8f6d4018b51 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryAdHocTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryAdHocTestBase.cs @@ -16,8 +16,7 @@ public virtual async Task Contains_on_nested_collection_with_init_only_navigatio var contextFactory = await InitializeAsync(seed: Seed32310); await using var context = contextFactory.CreateContext(); - var query = context.Pubs.Where( - u => u.Visits.DaysVisited.Contains(new DateOnly(2023, 1, 1)) + var query = context.Pubs.Where(u => u.Visits.DaysVisited.Contains(new DateOnly(2023, 1, 1)) ); var result = async ? await query.FirstOrDefaultAsync()! : query.FirstOrDefault()!; @@ -236,19 +235,16 @@ public virtual async Task Missing_navigation_works_with_deduplication(bool async { var result = context .Entities.OrderBy(x => x.Id) - .Select( - x => - new - { - x, - x.Json, - x.Json.OptionalReference, - x.Json.RequiredReference, - NestedOptional = x.Json.OptionalReference.Nested, - NestedRequired = x.Json.RequiredReference.Nested, - x.Json.Collection, - } - ) + .Select(x => new + { + x, + x.Json, + x.Json.OptionalReference, + x.Json.RequiredReference, + NestedOptional = x.Json.OptionalReference.Nested, + NestedRequired = x.Json.RequiredReference.Nested, + x.Json.Collection, + }) .AsNoTracking() .ToList(); @@ -343,14 +339,11 @@ public virtual async Task Project_element_of_json_array_of_primitives(bool async { var query = context .Entities.OrderBy(x => x.Id) - .Select( - x => - new - { - ArrayElement = x.Reference.IntArray[0], - ListElement = x.Reference.ListOfString[1] - } - ); + .Select(x => new + { + ArrayElement = x.Reference.IntArray[0], + ListElement = x.Reference.ListOfString[1] + }); var result = async ? await query.ToListAsync() : query.ToList(); } @@ -405,10 +398,9 @@ public virtual async Task Predicate_based_on_element_of_json_array_of_primitives using (var context = contextFactory.CreateContext()) { var query = context - .Entities.Where( - x => - x.Reference.IntArray.AsQueryable().ElementAt(0) == 1 - || x.Reference.ListOfString.AsQueryable().ElementAt(1) == "Bar" + .Entities.Where(x => + x.Reference.IntArray.AsQueryable().ElementAt(0) == 1 + || x.Reference.ListOfString.AsQueryable().ElementAt(1) == "Bar" ) .OrderBy(e => e.Id); @@ -816,14 +808,11 @@ public virtual async Task Project_shadow_properties_from_json_entity(bool async) using (var context = contextFactory.CreateContext()) { - var query = context.Entities.Select( - x => - new - { - ShadowString = EF.Property(x.Reference, "ShadowString"), - ShadowInt = EF.Property(x.ReferenceWithCtor, "Shadow_Int"), - } - ); + var query = context.Entities.Select(x => new + { + ShadowString = EF.Property(x.Reference, "ShadowString"), + ShadowInt = EF.Property(x.ReferenceWithCtor, "Shadow_Int"), + }); var result = async ? await query.ToListAsync() : query.ToList(); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryTestBase.cs index 2caf566a178..de2d8b64732 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/JsonQueryTestBase.cs @@ -138,15 +138,12 @@ await Assert.ThrowsAsync( async, ss => ss.Set() - .Select( - x => - new - { - x, - x.OwnedReferenceRoot, - x.OwnedCollectionRoot - } - ) + .Select(x => new + { + x, + x.OwnedReferenceRoot, + x.OwnedCollectionRoot + }) ) ) ).Message; @@ -175,20 +172,13 @@ public virtual Task Basic_json_projection_owned_reference_duplicated2(bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Root1 = x.OwnedReferenceRoot, - Leaf1 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf, - Root2 = x.OwnedReferenceRoot, - Leaf2 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf, - } - ) + .Select(x => new + { + Root1 = x.OwnedReferenceRoot, + Leaf1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + Root2 = x.OwnedReferenceRoot, + Leaf2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -208,16 +198,13 @@ public virtual Task Basic_json_projection_owned_reference_duplicated(bool async) ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Root1 = x.OwnedReferenceRoot, - Branch1 = x.OwnedReferenceRoot.OwnedReferenceBranch, - Root2 = x.OwnedReferenceRoot, - Branch2 = x.OwnedReferenceRoot.OwnedReferenceBranch, - } - ) + .Select(x => new + { + Root1 = x.OwnedReferenceRoot, + Branch1 = x.OwnedReferenceRoot.OwnedReferenceBranch, + Root2 = x.OwnedReferenceRoot, + Branch2 = x.OwnedReferenceRoot.OwnedReferenceBranch, + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -339,21 +326,18 @@ public virtual Task Json_projection_with_deduplication(bool async) => async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - x.OwnedReferenceRoot.OwnedReferenceBranch, - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, - x.OwnedReferenceRoot.OwnedCollectionBranch, - x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf - .SomethingSomething - } - ) + .Select(x => new + { + x.Id, + x.OwnedReferenceRoot.OwnedReferenceBranch, + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, + x.OwnedReferenceRoot.OwnedCollectionBranch, + x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedReferenceLeaf + .SomethingSomething + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -374,15 +358,12 @@ public virtual Task Json_projection_with_deduplication_reverse_order(bool async) async, ss => ss.Set() - .Select( - x => - new - { - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - x.OwnedReferenceRoot, - x - } - ) + .Select(x => new + { + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + x.OwnedReferenceRoot, + x + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -411,12 +392,11 @@ public virtual Task Json_subquery_property_pushdown_length(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf - .SomethingSomething + .Select(x => + x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedReferenceLeaf + .SomethingSomething ) .Take(3) .Distinct() @@ -448,17 +428,14 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Entity = x.OwnedReferenceRoot, - Scalar = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf - .SomethingSomething - } - ) + .Select(x => new + { + Entity = x.OwnedReferenceRoot, + Scalar = x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedReferenceLeaf + .SomethingSomething + }) .Take(10) .Distinct() .Select(x => new { x.Entity.OwnedReferenceBranch, x.Scalar.Length }) @@ -482,32 +459,26 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Root = x.OwnedReferenceRoot, - Scalar = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf - .SomethingSomething - } - ) + .Select(x => new + { + Root = x.OwnedReferenceRoot, + Scalar = x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedReferenceLeaf + .SomethingSomething + }) .Take(10) .Distinct() .Select(x => new { Branch = x.Root.OwnedReferenceBranch, x.Scalar.Length }) .OrderBy(x => x.Length) .Take(10) .Distinct() - .Select( - x => - new - { - x.Branch.OwnedReferenceLeaf, - x.Branch.OwnedCollectionLeaf, - x.Length - } - ) + .Select(x => new + { + x.Branch.OwnedReferenceLeaf, + x.Branch.OwnedCollectionLeaf, + x.Length + }) .AsNoTracking(), elementSorter: e => (e.OwnedReferenceLeaf.SomethingSomething, e.OwnedCollectionLeaf.Count, e.Length), @@ -621,19 +592,16 @@ public virtual Task Custom_naming_projection_everything(bool async) => async, ss => ss.Set() - .Select( - x => - new - { - root = x, - referece = x.OwnedReferenceRoot, - nested_reference = x.OwnedReferenceRoot.OwnedReferenceBranch, - collection = x.OwnedCollectionRoot, - nested_collection = x.OwnedReferenceRoot.OwnedCollectionBranch, - scalar = x.OwnedReferenceRoot.Name, - nested_scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction, - } - ) + .Select(x => new + { + root = x, + referece = x.OwnedReferenceRoot, + nested_reference = x.OwnedReferenceRoot.OwnedReferenceBranch, + collection = x.OwnedCollectionRoot, + nested_collection = x.OwnedReferenceRoot.OwnedCollectionBranch, + scalar = x.OwnedReferenceRoot.Name, + nested_scalar = x.OwnedReferenceRoot.OwnedReferenceBranch.Fraction, + }) .AsNoTracking(), elementSorter: e => e.root.Id, elementAsserter: (e, a) => @@ -763,13 +731,12 @@ public virtual Task Project_json_entity_FirstOrDefault_subquery(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault() - .OwnedReferenceBranch + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault() + .OwnedReferenceBranch ) .AsNoTracking() ); @@ -784,13 +751,12 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault() - .OwnedReferenceBranch.Date + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault() + .OwnedReferenceBranch.Date ) ); @@ -804,23 +770,21 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault() - .OwnedReferenceBranch - == ss.Set() - .OrderByDescending(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select(xx => xx.OwnedReferenceRoot) - .FirstOrDefault() - .OwnedReferenceBranch - ) + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault() + .OwnedReferenceBranch + == ss.Set() + .OrderByDescending(x => x.Id) + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => xx.OwnedReferenceRoot) + .FirstOrDefault() + .OwnedReferenceBranch + ) ) ); @@ -832,22 +796,18 @@ public virtual Task Project_json_entity_FirstOrDefault_subquery_deduplication(bo ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select( - xx => - new - { - x.OwnedReferenceRoot.OwnedCollectionBranch, - xx.OwnedReferenceRoot, - xx.OwnedReferenceRoot.OwnedReferenceBranch, - xx.OwnedReferenceRoot.Name, - x.OwnedReferenceRoot.OwnedReferenceBranch.Enum - } - ) - .FirstOrDefault() + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => new + { + x.OwnedReferenceRoot.OwnedCollectionBranch, + xx.OwnedReferenceRoot, + xx.OwnedReferenceRoot.OwnedReferenceBranch, + xx.OwnedReferenceRoot.Name, + x.OwnedReferenceRoot.OwnedReferenceBranch.Enum + }) + .FirstOrDefault() ) .AsNoTracking(), assertOrder: true, @@ -869,22 +829,18 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select( - xx => - new - { - x.OwnedReferenceRoot.OwnedCollectionBranch, - xx.OwnedReferenceRoot, - xx.OwnedReferenceRoot.OwnedReferenceBranch, - xx.OwnedReferenceRoot.Name, - x.OwnedReferenceRoot.OwnedReferenceBranch.Enum - } - ) - .FirstOrDefault() + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => new + { + x.OwnedReferenceRoot.OwnedCollectionBranch, + xx.OwnedReferenceRoot, + xx.OwnedReferenceRoot.OwnedReferenceBranch, + xx.OwnedReferenceRoot.Name, + x.OwnedReferenceRoot.OwnedReferenceBranch.Enum + }) + .FirstOrDefault() ) .AsNoTracking(), assertOrder: true, @@ -908,23 +864,19 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - ss.Set() - .OrderBy(xx => xx.Id) - .Select( - xx => - new - { - x.OwnedReferenceRoot.OwnedCollectionBranch, - xx.OwnedReferenceRoot, - xx.OwnedReferenceRoot.OwnedReferenceBranch, - xx.OwnedReferenceRoot.Name, - x.OwnedReferenceRoot.OwnedReferenceBranch.Enum - } - ) - .FirstOrDefault() - .OwnedCollectionBranch + .Select(x => + ss.Set() + .OrderBy(xx => xx.Id) + .Select(xx => new + { + x.OwnedReferenceRoot.OwnedCollectionBranch, + xx.OwnedReferenceRoot, + xx.OwnedReferenceRoot.OwnedReferenceBranch, + xx.OwnedReferenceRoot.Name, + x.OwnedReferenceRoot.OwnedReferenceBranch.Enum + }) + .FirstOrDefault() + .OwnedCollectionBranch ) .AsNoTracking(), assertOrder: true, @@ -951,15 +903,12 @@ public virtual Task Json_entity_with_inheritance_project_navigations(bool async) async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - x.ReferenceOnBase, - x.CollectionOnBase - } - ) + .Select(x => new + { + x.Id, + x.ReferenceOnBase, + x.CollectionOnBase + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -978,17 +927,14 @@ public virtual Task Json_entity_with_inheritance_project_navigations_on_derived( ss => ss.Set() .OfType() - .Select( - x => - new - { - x.Id, - x.ReferenceOnBase, - x.ReferenceOnDerived, - x.CollectionOnBase, - x.CollectionOnDerived - } - ) + .Select(x => new + { + x.Id, + x.ReferenceOnBase, + x.ReferenceOnDerived, + x.CollectionOnBase, + x.CollectionOnDerived + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -1008,9 +954,8 @@ public virtual Task Json_entity_backtracking(bool async) => async, ss => ss.Set() - .Select( - x => - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.Parent.Date + .Select(x => + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf.Parent.Date ) ); @@ -1063,8 +1008,8 @@ public virtual Task Json_collection_ElementAt_project_collection(bool async) => async, ss => ss.Set() - .Select( - x => x.OwnedCollectionRoot.AsQueryable().ElementAt(1).OwnedCollectionBranch + .Select(x => + x.OwnedCollectionRoot.AsQueryable().ElementAt(1).OwnedCollectionBranch ) .AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -1077,11 +1022,10 @@ public virtual Task Json_collection_ElementAtOrDefault_project_collection(bool a async, ss => ss.Set() - .Select( - x => - x.OwnedCollectionRoot.AsQueryable() - .ElementAtOrDefault(1) - .OwnedCollectionBranch + .Select(x => + x.OwnedCollectionRoot.AsQueryable() + .ElementAtOrDefault(1) + .OwnedCollectionBranch ) .AsNoTracking(), elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -1131,11 +1075,10 @@ bool async async, ss => ss.Set() - .Select( - x => - x.OwnedCollectionRoot[0].OwnedReferenceBranch.OwnedCollectionLeaf[ - MyMethod(x.Id) - ] + .Select(x => + x.OwnedCollectionRoot[0].OwnedReferenceBranch.OwnedCollectionLeaf[ + MyMethod(x.Id) + ] ) .AsNoTracking() ); @@ -1212,8 +1155,8 @@ public virtual Task Json_collection_index_in_projection_nested_project_reference async, ss => ss.Set() - .Select( - x => x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].OwnedReferenceLeaf + .Select(x => + x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].OwnedReferenceLeaf ) .AsNoTracking() ); @@ -1230,8 +1173,8 @@ public virtual Task Json_collection_index_in_projection_nested_project_collectio ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].OwnedCollectionLeaf + .Select(x => + x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].OwnedCollectionLeaf ) .AsNoTracking(), assertOrder: true, @@ -1251,16 +1194,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - x.OwnedCollectionRoot[0] - .OwnedCollectionBranch[prm] - .OwnedCollectionLeaf - } - ) + .Select(x => new + { + x.Id, + x.OwnedCollectionRoot[0].OwnedCollectionBranch[prm].OwnedCollectionLeaf + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -1338,10 +1276,9 @@ public virtual Task Json_collection_index_in_predicate_using_complex_expression2 async, ss => ss.Set() - .Where( - x => - x.OwnedCollectionRoot[ss.Set().Max(x => x.Id)].Name - == "e1_c2" + .Where(x => + x.OwnedCollectionRoot[ss.Set().Max(x => x.Id)].Name + == "e1_c2" ) .Select(x => new { x.Id, x }), elementSorter: e => e.Id, @@ -1373,12 +1310,11 @@ public virtual Task Json_collection_index_in_predicate_nested_mix(bool async) async, ss => ss.Set() - .Where( - x => - x.OwnedCollectionRoot[1] - .OwnedCollectionBranch[prm] - .OwnedCollectionLeaf[x.Id - 1] - .SomethingSomething == "e1_c2_c1_c1" + .Where(x => + x.OwnedCollectionRoot[1] + .OwnedCollectionBranch[prm] + .OwnedCollectionLeaf[x.Id - 1] + .SomethingSomething == "e1_c2_c1_c1" ) ); } @@ -1390,15 +1326,12 @@ public virtual Task Json_collection_ElementAt_and_pushdown(bool async) => async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - CollectionElement = x.OwnedCollectionRoot.Select(xx => xx.Number) - .ElementAt(0) - } - ) + .Select(x => new + { + x.Id, + CollectionElement = x.OwnedCollectionRoot.Select(xx => xx.Number) + .ElementAt(0) + }) ); [ConditionalTheory] @@ -1408,11 +1341,10 @@ public virtual Task Json_collection_Any_with_predicate(bool async) => async, ss => ss.Set() - .Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch.Any( - b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r" - ) + .Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch.Any(b => + b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r" + ) ) ); @@ -1423,13 +1355,12 @@ public virtual Task Json_collection_Where_ElementAt(bool async) => async, ss => ss.Set() - .Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch.Where( - o => o.Enum == JsonEnum.Three - ) - .ElementAt(0) - .OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r" + .Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch.Where(o => + o.Enum == JsonEnum.Three + ) + .ElementAt(0) + .OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r" ) ); @@ -1440,11 +1371,10 @@ public virtual Task Json_collection_Skip(bool async) => async, ss => ss.Set() - .Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch.Skip(1) - .ElementAt(0) - .OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r" + .Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch.Skip(1) + .ElementAt(0) + .OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r" ) ); @@ -1455,14 +1385,11 @@ public virtual Task Json_collection_OrderByDescending_Skip_ElementAt(bool async) async, ss => ss.Set() - .Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch.OrderByDescending( - b => b.Date - ) - .Skip(1) - .ElementAt(0) - .OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r" + .Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch.OrderByDescending(b => b.Date) + .Skip(1) + .ElementAt(0) + .OwnedReferenceLeaf.SomethingSomething == "e1_r_c1_r" ) ); @@ -1478,11 +1405,9 @@ public virtual Task Json_collection_Distinct_Count_with_predicate(bool async) => async, ss => ss.Set() - .Where( - j => - j.OwnedReferenceRoot.OwnedCollectionBranch.Distinct() - .Count(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r") - == 1 + .Where(j => + j.OwnedReferenceRoot.OwnedCollectionBranch.Distinct() + .Count(b => b.OwnedReferenceLeaf.SomethingSomething == "e1_r_c2_r") == 1 ) ); @@ -1517,8 +1442,8 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot.Select(xx => new { xx.Name, xx.Number }).ToList() + .Select(x => + x.OwnedCollectionRoot.Select(xx => new { xx.Name, xx.Number }).ToList() ) ); @@ -1532,11 +1457,10 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.Where(xx => xx.Name == "Foo") - .Select(xx => new { xx.Name, xx.Number }) - .ToList() + .Select(x => + x.OwnedCollectionRoot.Where(xx => xx.Name == "Foo") + .Select(xx => new { xx.Name, xx.Number }) + .ToList() ) ); @@ -1550,11 +1474,10 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.Where(xx => xx.Name == "Foo") - .Select(xx => new { xx.Names, xx.Numbers }) - .ToList() + .Select(x => + x.OwnedCollectionRoot.Where(xx => xx.Name == "Foo") + .Select(xx => new { xx.Names, xx.Numbers }) + .ToList() ) ); @@ -1588,15 +1511,13 @@ public virtual Task Json_nested_collection_filter_in_projection(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.Select( - xx => - xx.OwnedCollectionBranch.Where( - xxx => xxx.Date != new DateTime(2000, 1, 1) - ) - .ToList() + .Select(x => + x.OwnedCollectionRoot.Select(xx => + xx.OwnedCollectionBranch.Where(xxx => + xxx.Date != new DateTime(2000, 1, 1) ) + .ToList() + ) ) .AsNoTracking(), assertOrder: true, @@ -1617,24 +1538,19 @@ public virtual Task Json_nested_collection_anonymous_projection_in_projection(bo ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.Select( - xx => - xx.OwnedCollectionBranch.Select( - xxx => - new - { - xxx.Date, - xxx.Enum, - xxx.Enums, - xxx.Fraction, - xxx.OwnedReferenceLeaf, - xxx.OwnedCollectionLeaf - } - ) - .ToList() - ) + .Select(x => + x.OwnedCollectionRoot.Select(xx => + xx.OwnedCollectionBranch.Select(xxx => new + { + xxx.Date, + xxx.Enum, + xxx.Enums, + xxx.Fraction, + xxx.OwnedReferenceLeaf, + xxx.OwnedCollectionLeaf + }) + .ToList() + ) ) .AsNoTracking(), assertOrder: true, @@ -1673,8 +1589,8 @@ public virtual Task Json_collection_skip_take_in_projection(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => x.OwnedCollectionRoot.OrderBy(xx => xx.Name).Skip(1).Take(5).ToList() + .Select(x => + x.OwnedCollectionRoot.OrderBy(xx => xx.Name).Skip(1).Take(5).ToList() ) .AsNoTracking(), assertOrder: true, @@ -1691,24 +1607,20 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.OrderBy(xx => xx.Name) - .Skip(1) - .Take(5) - .Select( - xx => - new - { - xx.Name, - xx.Names, - xx.Number, - xx.Numbers, - xx.OwnedCollectionBranch, - xx.OwnedReferenceBranch - } - ) - .ToList() + .Select(x => + x.OwnedCollectionRoot.OrderBy(xx => xx.Name) + .Skip(1) + .Take(5) + .Select(xx => new + { + xx.Name, + xx.Names, + xx.Number, + xx.Numbers, + xx.OwnedCollectionBranch, + xx.OwnedReferenceBranch + }) + .ToList() ) .AsNoTracking(), assertOrder: true, @@ -1745,13 +1657,12 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.OrderBy(xx => xx.Name) - .Skip(1) - .Take(5) - .Select(xx => xx.OwnedReferenceBranch) - .ToList() + .Select(x => + x.OwnedCollectionRoot.OrderBy(xx => xx.Name) + .Skip(1) + .Take(5) + .Select(xx => xx.OwnedReferenceBranch) + .ToList() ) .AsNoTracking(), assertOrder: true, @@ -1795,12 +1706,11 @@ public virtual Task Json_collection_leaf_filter_in_projection(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Where( - xx => xx.SomethingSomething != "Baz" - ) - .ToList() + .Select(x => + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Where(xx => + xx.SomethingSomething != "Baz" + ) + .ToList() ) .AsNoTracking(), assertOrder: true, @@ -1815,25 +1725,21 @@ public virtual Task Json_multiple_collection_projections(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Where( - xx => xx.SomethingSomething != "Baz" - ) - .ToList(), - Second = x.OwnedCollectionRoot.Distinct().ToList(), - Third = x.OwnedCollectionRoot.Select( - xx => - xx.OwnedCollectionBranch.Where( - xxx => xxx.Date != new DateTime(2000, 1, 1) - ) - .ToList() - ), - Fourth = x.EntityCollection.ToList() - } - ) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Where( + xx => xx.SomethingSomething != "Baz" + ) + .ToList(), + Second = x.OwnedCollectionRoot.Distinct().ToList(), + Third = x.OwnedCollectionRoot.Select(xx => + xx.OwnedCollectionBranch.Where(xxx => + xxx.Date != new DateTime(2000, 1, 1) + ) + .ToList() + ), + Fourth = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1858,15 +1764,11 @@ public virtual Task Json_branch_collection_distinct_and_other_collection(bool as ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - First = x.OwnedReferenceRoot.OwnedCollectionBranch.Distinct() - .ToList(), - Second = x.EntityCollection.ToList() - } - ) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedCollectionBranch.Distinct().ToList(), + Second = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1884,15 +1786,14 @@ public virtual Task Json_leaf_collection_distinct_and_other_collection(bool asyn ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Distinct() - .ToList(), - Second = x.EntityCollection.ToList() - } - ) + .Select(x => new + { + First = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf.Distinct( + + ) + .ToList(), + Second = x.EntityCollection.ToList() + }) .AsNoTracking(), assertOrder: true, elementAsserter: (e, a) => @@ -1980,16 +1881,13 @@ await AssertQuery( async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - CollectionElement = x.OwnedCollectionRoot[prm] - .OwnedCollectionBranch.Select(xx => "Foo") - .ElementAt(0) - } - ) + .Select(x => new + { + x.Id, + CollectionElement = x.OwnedCollectionRoot[prm] + .OwnedCollectionBranch.Select(xx => "Foo") + .ElementAt(0) + }) ); } @@ -2003,25 +1901,23 @@ await AssertQuery( async, ss => ss.Set() - .Select( - j => - j.OwnedCollectionRoot[prm + j.Id] - .OwnedCollectionBranch.Select( - b => b.OwnedReferenceLeaf.SomethingSomething - ) - .ElementAt(0) + .Select(j => + j.OwnedCollectionRoot[prm + j.Id] + .OwnedCollectionBranch.Select(b => + b.OwnedReferenceLeaf.SomethingSomething + ) + .ElementAt(0) ), ss => ss.Set() - .Select( - j => - j.OwnedCollectionRoot.Count > prm + j.Id - ? j.OwnedCollectionRoot[prm + j.Id] - .OwnedCollectionBranch.Select( - b => b.OwnedReferenceLeaf.SomethingSomething - ) - .ElementAt(0) - : null + .Select(j => + j.OwnedCollectionRoot.Count > prm + j.Id + ? j.OwnedCollectionRoot[prm + j.Id] + .OwnedCollectionBranch.Select(b => + b.OwnedReferenceLeaf.SomethingSomething + ) + .ElementAt(0) + : null ) ); } @@ -2034,10 +1930,8 @@ await AssertQuery( ss => ss.Set() .AsNoTracking() - .Select( - x => - x.OwnedCollectionRoot.Select(xx => xx.OwnedCollectionBranch) - .ElementAt(0) + .Select(x => + x.OwnedCollectionRoot.Select(xx => xx.OwnedCollectionBranch).ElementAt(0) ), elementAsserter: (e, a) => { @@ -2057,9 +1951,8 @@ await AssertQuery( ss => ss.Set() .AsNoTracking() - .Select( - x => - x.OwnedCollectionRoot.Select(xx => xx.OwnedReferenceBranch).ElementAt(0) + .Select(x => + x.OwnedCollectionRoot.Select(xx => xx.OwnedReferenceBranch).ElementAt(0) ) ); @@ -2074,10 +1967,9 @@ await AssertQuery( ss.Set() .AsNoTracking() .OrderBy(x => x.Id) - .Select( - x => - x.OwnedCollectionRoot.Select(xx => new { xx.OwnedReferenceBranch }) - .ElementAt(0) + .Select(x => + x.OwnedCollectionRoot.Select(xx => new { xx.OwnedReferenceBranch }) + .ElementAt(0) ), assertOrder: true, elementAsserter: (e, a) => @@ -2095,10 +1987,9 @@ await AssertQuery( async, ss => ss.Set() - .Select( - x => - x.OwnedCollectionRoot.Select(xx => new JsonEntityBasic { Id = x.Id }) - .ElementAt(0) + .Select(x => + x.OwnedCollectionRoot.Select(xx => new JsonEntityBasic { Id = x.Id }) + .ElementAt(0) ) ); @@ -2111,18 +2002,15 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - Duplicate1 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - Original = x.OwnedCollectionRoot[0], - Duplicate2 = x.OwnedCollectionRoot[0] - .OwnedReferenceBranch - .OwnedCollectionLeaf - } - ) + .Select(x => new + { + x.Id, + Duplicate1 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + Original = x.OwnedCollectionRoot[0], + Duplicate2 = x.OwnedCollectionRoot[0] + .OwnedReferenceBranch + .OwnedCollectionLeaf + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2144,18 +2032,15 @@ public virtual Task Json_projection_deduplication_with_collection_indexer_in_tar async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - Duplicate1 = x.OwnedReferenceRoot.OwnedCollectionBranch[1], - Original = x.OwnedReferenceRoot, - Duplicate2 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedCollectionLeaf[prm] - } - ) + .Select(x => new + { + x.Id, + Duplicate1 = x.OwnedReferenceRoot.OwnedCollectionBranch[1], + Original = x.OwnedReferenceRoot, + Duplicate2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[ + prm + ] + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2180,19 +2065,16 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - DuplicateMix = x.OwnedReferenceRoot - .OwnedCollectionBranch[0] - .OwnedCollectionLeaf[prm], - DuplicatePrm = x.OwnedReferenceRoot.OwnedCollectionBranch[prm], - x.Id, - Original = x.OwnedReferenceRoot.OwnedCollectionBranch, - DuplicateConstant = x.OwnedReferenceRoot.OwnedCollectionBranch[0], - } - ) + .Select(x => new + { + DuplicateMix = x.OwnedReferenceRoot + .OwnedCollectionBranch[0] + .OwnedCollectionLeaf[prm], + DuplicatePrm = x.OwnedReferenceRoot.OwnedCollectionBranch[prm], + x.Id, + Original = x.OwnedReferenceRoot.OwnedCollectionBranch, + DuplicateConstant = x.OwnedReferenceRoot.OwnedCollectionBranch[0], + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2299,9 +2181,11 @@ bool async async, ss => ss.Set() - .Select( - x => new { x, Collection = x.OwnedCollectionRoot[1].OwnedCollectionBranch } - ) + .Select(x => new + { + x, + Collection = x.OwnedCollectionRoot[1].OwnedCollectionBranch + }) .AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => @@ -2320,14 +2204,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - Collection = x.OwnedCollectionRoot[1].OwnedCollectionBranch - } - ) + .Select(x => new + { + x.Id, + Collection = x.OwnedCollectionRoot[1].OwnedCollectionBranch + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2349,10 +2230,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new { x, Collection = x.OwnedCollectionRoot[prm].OwnedCollectionBranch } - ) + .Select(x => new + { + x, + Collection = x.OwnedCollectionRoot[prm].OwnedCollectionBranch + }) .AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => @@ -2375,14 +2257,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - Collection = x.OwnedCollectionRoot[prm].OwnedCollectionBranch - } - ) + .Select(x => new + { + x.Id, + Collection = x.OwnedCollectionRoot[prm].OwnedCollectionBranch + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2403,16 +2282,11 @@ public virtual Task Json_collection_index_in_projection_when_owner_is_present_mi async, ss => ss.Set() - .Select( - x => - new - { - x, - CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[ - prm - ], - } - ) + .Select(x => new + { + x, + CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], + }) .AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => @@ -2435,16 +2309,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[ - prm - ], - } - ) + .Select(x => new + { + x.Id, + CollectionElement = x.OwnedCollectionRoot[1].OwnedCollectionBranch[prm], + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2464,16 +2333,13 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x, - CollectionElement = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedCollectionLeaf[1] - } - ) + .Select(x => new + { + x, + CollectionElement = x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedCollectionLeaf[1] + }) .AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => @@ -2492,16 +2358,13 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - CollectionElement = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedCollectionLeaf[1] - } - ) + .Select(x => new + { + x.Id, + CollectionElement = x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedCollectionLeaf[1] + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2523,36 +2386,25 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x, - CollectionElement1 = x.OwnedCollectionRoot[ - prm - ].OwnedCollectionBranch[1], - CollectionElement2 = x.OwnedCollectionRoot[1] - .OwnedCollectionBranch[1] - .OwnedReferenceLeaf, - CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement4 = x.OwnedCollectionRoot[ - prm - ].OwnedReferenceBranch, - CollectionElement5 = x.OwnedCollectionRoot[ - prm - ].OwnedCollectionBranch[x.Id], - CollectionElement6 = x.OwnedCollectionRoot[x.Id] - .OwnedCollectionBranch[1] - .OwnedReferenceLeaf, - CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement8 = x.OwnedCollectionRoot[ - x.Id - ].OwnedReferenceBranch, - CollectionElement9 = x.OwnedCollectionRoot[ - x.Id - ].OwnedCollectionBranch[x.Id], - } - ) + .Select(x => new + { + x, + CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], + CollectionElement2 = x.OwnedCollectionRoot[1] + .OwnedCollectionBranch[1] + .OwnedReferenceLeaf, + CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, + CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], + CollectionElement6 = x.OwnedCollectionRoot[x.Id] + .OwnedCollectionBranch[1] + .OwnedReferenceLeaf, + CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, + CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[ + x.Id + ], + }) .AsNoTracking(), elementSorter: e => e.x.Id, elementAsserter: (e, a) => @@ -2583,36 +2435,25 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - CollectionElement1 = x.OwnedCollectionRoot[ - prm - ].OwnedCollectionBranch[1], - CollectionElement2 = x.OwnedCollectionRoot[1] - .OwnedCollectionBranch[1] - .OwnedReferenceLeaf, - CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement4 = x.OwnedCollectionRoot[ - prm - ].OwnedReferenceBranch, - CollectionElement5 = x.OwnedCollectionRoot[ - prm - ].OwnedCollectionBranch[x.Id], - CollectionElement6 = x.OwnedCollectionRoot[x.Id] - .OwnedCollectionBranch[1] - .OwnedReferenceLeaf, - CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, - CollectionElement8 = x.OwnedCollectionRoot[ - x.Id - ].OwnedReferenceBranch, - CollectionElement9 = x.OwnedCollectionRoot[ - x.Id - ].OwnedCollectionBranch[x.Id], - } - ) + .Select(x => new + { + x.Id, + CollectionElement1 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[1], + CollectionElement2 = x.OwnedCollectionRoot[1] + .OwnedCollectionBranch[1] + .OwnedReferenceLeaf, + CollectionElement3 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement4 = x.OwnedCollectionRoot[prm].OwnedReferenceBranch, + CollectionElement5 = x.OwnedCollectionRoot[prm].OwnedCollectionBranch[x.Id], + CollectionElement6 = x.OwnedCollectionRoot[x.Id] + .OwnedCollectionBranch[1] + .OwnedReferenceLeaf, + CollectionElement7 = x.OwnedCollectionRoot[1].OwnedReferenceBranch, + CollectionElement8 = x.OwnedCollectionRoot[x.Id].OwnedReferenceBranch, + CollectionElement9 = x.OwnedCollectionRoot[x.Id].OwnedCollectionBranch[ + x.Id + ], + }) .AsNoTracking(), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -2649,13 +2490,12 @@ public virtual Task Json_scalar_optional_null_semantics(bool async) => async, ss => ss.Set() - .Where( - x => - x.OwnedReferenceRoot.Name - != x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf - .SomethingSomething + .Where(x => + x.OwnedReferenceRoot.Name + != x.OwnedReferenceRoot + .OwnedReferenceBranch + .OwnedReferenceLeaf + .SomethingSomething ) .Select(x => x.Name) ); @@ -2799,14 +2639,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, - x.EntityCollection - } - ) + .Select(x => new + { + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + x.EntityCollection + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -2840,21 +2677,18 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - Reference1 = x.OwnedReferenceRoot, - Reference2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - x.EntityCollection, - Reference3 = x.OwnedCollectionRoot[1] - .OwnedReferenceBranch - .OwnedReferenceLeaf, - Reference4 = x.OwnedCollectionRoot[0] - .OwnedCollectionBranch[0] - .OwnedReferenceLeaf, - } - ) + .Select(x => new + { + Reference1 = x.OwnedReferenceRoot, + Reference2 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + x.EntityCollection, + Reference3 = x.OwnedCollectionRoot[1] + .OwnedReferenceBranch + .OwnedReferenceLeaf, + Reference4 = x.OwnedCollectionRoot[0] + .OwnedCollectionBranch[0] + .OwnedReferenceLeaf, + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -2875,14 +2709,11 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, - x.EntityCollection - } - ) + .Select(x => new + { + x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, + x.EntityCollection + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -2916,15 +2747,12 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - JsonCollectionElement = x.OwnedCollectionRoot[0], - x.EntityReference, - x.EntityCollection - } - ) + .Select(x => new + { + JsonCollectionElement = x.OwnedCollectionRoot[0], + x.EntityReference, + x.EntityCollection + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -2943,27 +2771,20 @@ bool async async, ss => ss.Set() - .Select( - x => - new - { - Collection1 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedCollectionLeaf, - x.EntityReference, - Reference1 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedReferenceLeaf, - x.EntityCollection, - Reference2 = x.OwnedReferenceRoot - .OwnedReferenceBranch - .OwnedCollectionLeaf[0], - Collection2 = x.OwnedReferenceRoot.OwnedCollectionBranch, - Collection3 = x.OwnedCollectionRoot, - Reference3 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, - Collection4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch - } - ) + .Select(x => new + { + Collection1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf, + x.EntityReference, + Reference1 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedReferenceLeaf, + x.EntityCollection, + Reference2 = x.OwnedReferenceRoot.OwnedReferenceBranch.OwnedCollectionLeaf[ + 0 + ], + Collection2 = x.OwnedReferenceRoot.OwnedCollectionBranch, + Collection3 = x.OwnedCollectionRoot, + Reference3 = x.OwnedCollectionRoot[0].OwnedReferenceBranch, + Collection4 = x.OwnedCollectionRoot[0].OwnedCollectionBranch + }) .AsNoTracking(), elementAsserter: (e, a) => { @@ -3002,38 +2823,35 @@ public virtual Task Json_all_types_projection_individual_properties(bool async) async, ss => ss.Set() - .Select( - x => - new - { - x.Reference.TestDefaultString, - x.Reference.TestMaxLengthString, - x.Reference.TestBoolean, - x.Reference.TestByte, - x.Reference.TestCharacter, - x.Reference.TestDateTime, - x.Reference.TestDateTimeOffset, - x.Reference.TestDecimal, - x.Reference.TestDouble, - x.Reference.TestGuid, - x.Reference.TestInt16, - x.Reference.TestInt32, - x.Reference.TestInt64, - x.Reference.TestSignedByte, - x.Reference.TestSingle, - x.Reference.TestTimeSpan, - x.Reference.TestDateOnly, - x.Reference.TestTimeOnly, - x.Reference.TestUnsignedInt16, - x.Reference.TestUnsignedInt32, - x.Reference.TestUnsignedInt64, - x.Reference.TestEnum, - x.Reference.TestEnumWithIntConverter, - x.Reference.TestNullableEnum, - x.Reference.TestNullableEnumWithIntConverter, - x.Reference.TestNullableEnumWithConverterThatHandlesNulls, - } - ) + .Select(x => new + { + x.Reference.TestDefaultString, + x.Reference.TestMaxLengthString, + x.Reference.TestBoolean, + x.Reference.TestByte, + x.Reference.TestCharacter, + x.Reference.TestDateTime, + x.Reference.TestDateTimeOffset, + x.Reference.TestDecimal, + x.Reference.TestDouble, + x.Reference.TestGuid, + x.Reference.TestInt16, + x.Reference.TestInt32, + x.Reference.TestInt64, + x.Reference.TestSignedByte, + x.Reference.TestSingle, + x.Reference.TestTimeSpan, + x.Reference.TestDateOnly, + x.Reference.TestTimeOnly, + x.Reference.TestUnsignedInt16, + x.Reference.TestUnsignedInt32, + x.Reference.TestUnsignedInt64, + x.Reference.TestEnum, + x.Reference.TestEnumWithIntConverter, + x.Reference.TestNullableEnum, + x.Reference.TestNullableEnumWithIntConverter, + x.Reference.TestNullableEnumWithConverterThatHandlesNulls, + }) ); [ConditionalTheory] @@ -3091,13 +2909,12 @@ public virtual Task Json_predicate_on_string_condition(bool async) => async, ss => ss.Set() - .Where( - x => - ( - !x.Reference.TestBoolean - ? x.Reference.TestMaxLengthString - : x.Reference.TestDefaultString - ) == "MyDefaultStringInReference1" + .Where(x => + ( + !x.Reference.TestBoolean + ? x.Reference.TestMaxLengthString + : x.Reference.TestDefaultString + ) == "MyDefaultStringInReference1" ) ); @@ -3134,10 +2951,9 @@ public virtual Task Json_predicate_on_datetimeoffset(bool async) => async, ss => ss.Set() - .Where( - x => - x.Reference.TestDateTimeOffset - != new DateTimeOffset(new DateTime(2000, 1, 4), new TimeSpan(3, 2, 0)) + .Where(x => + x.Reference.TestDateTimeOffset + != new DateTimeOffset(new DateTime(2000, 1, 4), new TimeSpan(3, 2, 0)) ) ); @@ -3302,10 +3118,8 @@ public virtual Task Json_predicate_on_nullableenumwithconverterthathandlesnulls1 async, ss => ss.Set() - .Where( - x => - x.Reference.TestNullableEnumWithConverterThatHandlesNulls - != JsonEnum.One + .Where(x => + x.Reference.TestNullableEnumWithConverterThatHandlesNulls != JsonEnum.One ) ); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindKeylessEntitiesQueryRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindKeylessEntitiesQueryRelationalTestBase.cs index 97ccc3614fb..21f2b164db7 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindKeylessEntitiesQueryRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindKeylessEntitiesQueryRelationalTestBase.cs @@ -27,17 +27,14 @@ await Assert.ThrowsAsync( async, ss => ss.Set() - .Select( - cq => - new - { - cq.City, - cq.CompanyName, - OrderDetailIds = ss.Set() - .Where(c => c.City == cq.City) - .ToList() - } - ) + .Select(cq => new + { + cq.City, + cq.CompanyName, + OrderDetailIds = ss.Set() + .Where(c => c.City == cq.City) + .ToList() + }) .OrderBy(x => x.City) .Take(2) ) @@ -64,16 +61,13 @@ await Assert.ThrowsAsync( ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => - new - { - c.City, - Collection = ss.Set() - .Where(cq => cq.City == c.City) - .ToList(), - } - ) + .Select(c => new + { + c.City, + Collection = ss.Set() + .Where(cq => cq.City == c.City) + .ToList(), + }) ) ) ).Message; diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindSqlQueryTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindSqlQueryTestBase.cs index 4e33054f06f..9dea60709a3 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindSqlQueryTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/NorthwindSqlQueryTestBase.cs @@ -47,15 +47,14 @@ public virtual async Task SqlQuery_composed_Contains(bool async) using var context = CreateContext(); var query = context .Set() - .Where( - e => - context - .Database.SqlQuery( - NormalizeDelimitersInInterpolatedString( - @$"SELECT [ProductID] AS [Value] FROM [Products]" - ) + .Where(e => + context + .Database.SqlQuery( + NormalizeDelimitersInInterpolatedString( + @$"SELECT [ProductID] AS [Value] FROM [Products]" ) - .Contains(e.OrderID) + ) + .Contains(e.OrderID) ); var result = async ? await query.ToListAsync() : query.ToList(); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/OperatorsProceduralQueryTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/OperatorsProceduralQueryTestBase.cs index 93c13f5eb1a..fa7a57f6766 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/OperatorsProceduralQueryTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/OperatorsProceduralQueryTestBase.cs @@ -315,10 +315,9 @@ Type startingResultType { var distinctTypes = types.Distinct().ToList(); var possibleLeafBinaries = Binaries - .Where( - x => - distinctTypes.Contains(x.InputTypes.Left) - && distinctTypes.Contains(x.InputTypes.Right) + .Where(x => + distinctTypes.Contains(x.InputTypes.Left) + && distinctTypes.Contains(x.InputTypes.Right) ) .ToList(); var possibleLeafUnaries = Unaries.Where(x => distinctTypes.Contains(x.InputType)).ToList(); @@ -333,10 +332,9 @@ Type startingResultType .ToList(); var possibleBinaries = Binaries - .Where( - x => - distinctTypesWithNesting.Contains(x.InputTypes.Left) - && distinctTypesWithNesting.Contains(x.InputTypes.Right) + .Where(x => + distinctTypesWithNesting.Contains(x.InputTypes.Left) + && distinctTypesWithNesting.Contains(x.InputTypes.Right) ) .ToList(); var possibleUnaries = Unaries diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/OwnedEntityQueryRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/OwnedEntityQueryRelationalTestBase.cs index b8942d8eea8..de186a753ea 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/OwnedEntityQueryRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/OwnedEntityQueryRelationalTestBase.cs @@ -51,14 +51,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) => oob => { oob.ToTable(nameof(Leaf24777)); - oob.HasKey( - x => - new - { - ProductCommissionRulesetId = x.ModdleAId, - x.UnitThreshold - } - ); + oob.HasKey(x => new + { + ProductCommissionRulesetId = x.ModdleAId, + x.UnitThreshold + }); oob.Property(x => x.ModdleAId).ValueGeneratedNever(); oob.Property(x => x.UnitThreshold).ValueGeneratedNever(); oob.WithOwner().HasForeignKey(e => e.ModdleAId); @@ -162,16 +159,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) => b => { b.WithOwner(e => e.Location).HasForeignKey(e => e.LocationId); - b.HasKey( - e => - new - { - e.LocationId, - e.ExternalId, - e.VisualNumber, - e.TokenGroupId - } - ); + b.HasKey(e => new + { + e.LocationId, + e.ExternalId, + e.VisualNumber, + e.TokenGroupId + }); } ); } @@ -319,15 +313,14 @@ bool async var query = context .RotRutCases.AsNoTracking() .OrderBy(e => e.Id) - .Select( - e => - e.Rot == null - ? null - : new RotDto - { - MyApartmentNo = e.Rot.ApartmentNo, - MyServiceType = e.Rot.ServiceType - } + .Select(e => + e.Rot == null + ? null + : new RotDto + { + MyApartmentNo = e.Rot.ApartmentNo, + MyServiceType = e.Rot.ServiceType + } ); var result = async ? await query.ToListAsync() : query.ToList(); @@ -358,15 +351,14 @@ bool async var query = context .RotRutCases.AsNoTracking() .OrderBy(e => e.Id) - .Select( - e => - e.Rot != null - ? new RotDto - { - MyApartmentNo = e.Rot.ApartmentNo, - MyServiceType = e.Rot.ServiceType - } - : null + .Select(e => + e.Rot != null + ? new RotDto + { + MyApartmentNo = e.Rot.ApartmentNo, + MyServiceType = e.Rot.ServiceType + } + : null ); var result = async ? await query.ToListAsync() : query.ToList(); @@ -631,9 +623,8 @@ public void Seed() protected override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => base.AddOptions(builder) - .ConfigureWarnings( - c => - c.Log(RelationalEventId.OptionalDependentWithoutIdentifyingPropertyWarning) - .Log(RelationalEventId.OptionalDependentWithAllNullPropertiesWarning) + .ConfigureWarnings(c => + c.Log(RelationalEventId.OptionalDependentWithoutIdentifyingPropertyWarning) + .Log(RelationalEventId.OptionalDependentWithAllNullPropertiesWarning) ); } diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/QueryNoClientEvalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/QueryNoClientEvalTestBase.cs index 074a90e565e..325d1db5029 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/QueryNoClientEvalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/QueryNoClientEvalTestBase.cs @@ -56,11 +56,8 @@ public virtual void Throws_when_where_subquery_correlated() AssertTranslationFailedWithDetails( () => context - .Customers.Where( - c1 => - context.Customers.Any( - c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon - ) + .Customers.Where(c1 => + context.Customers.Any(c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon) ) .ToList(), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer)) diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/SharedTypeQueryRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/SharedTypeQueryRelationalTestBase.cs index 952eb99822e..98bcc56b380 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/SharedTypeQueryRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/SharedTypeQueryRelationalTestBase.cs @@ -71,12 +71,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) base.OnModelCreating(modelBuilder); modelBuilder .Entity() - .HasQueryFilter( - e => - Set>("STET") - .FromSqlRaw("Select * from STET") - .Select(i => (string)i["Value"]) - .Contains(e.Value) + .HasQueryFilter(e => + Set>("STET") + .FromSqlRaw("Select * from STET") + .Select(i => (string)i["Value"]) + .Contains(e.Value) ); } } diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Query/WarningsTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Query/WarningsTestBase.cs index ecbccbe52eb..9c4ac476999 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Query/WarningsTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Query/WarningsTestBase.cs @@ -51,8 +51,8 @@ public virtual void FirstOrDefault_without_orderby_and_filter_issues_warning_sub { using var context = CreateContext(); var query = context - .Customers.Where( - c => c.CustomerID == "ALFKI" && c.Orders.FirstOrDefault().OrderID > 1000 + .Customers.Where(c => + c.CustomerID == "ALFKI" && c.Orders.FirstOrDefault().OrderID > 1000 ) .ToList(); Assert.Single(query); @@ -82,10 +82,9 @@ public virtual void LastOrDefault_with_order_by_does_not_issue_client_eval_warni { using var context = CreateContext(); var query1 = context - .Customers.Where( - c => - c.CustomerID == "ALFKI" - && c.Orders.OrderBy(o => o.OrderID).LastOrDefault().OrderID > 1000 + .Customers.Where(c => + c.CustomerID == "ALFKI" + && c.Orders.OrderBy(o => o.OrderID).LastOrDefault().OrderID > 1000 ) .ToList(); Assert.NotNull(query1); diff --git a/efcore/test/EFCore.Relational.Specification.Tests/RelationalComplianceTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/RelationalComplianceTestBase.cs index 0c984861c83..17e40ac08c1 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/RelationalComplianceTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/RelationalComplianceTestBase.cs @@ -8,8 +8,8 @@ public abstract class RelationalComplianceTestBase : ComplianceTestBase protected override IEnumerable GetBaseTestClasses() => base.GetBaseTestClasses() .Concat( - typeof(RelationalComplianceTestBase).Assembly.ExportedTypes.Where( - t => t.Name.Contains("TestBase") + typeof(RelationalComplianceTestBase).Assembly.ExportedTypes.Where(t => + t.Name.Contains("TestBase") ) ); } diff --git a/efcore/test/EFCore.Relational.Specification.Tests/TestUtilities/RelationalDatabaseCleaner.cs b/efcore/test/EFCore.Relational.Specification.Tests/TestUtilities/RelationalDatabaseCleaner.cs index f0512ab8196..b37e0efc83e 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/TestUtilities/RelationalDatabaseCleaner.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/TestUtilities/RelationalDatabaseCleaner.cs @@ -57,8 +57,8 @@ var index in databaseModel.Tables.SelectMany(t => t.Indexes.Where(AcceptIndex)) } foreach ( - var foreignKey in databaseModel.Tables.SelectMany( - t => t.ForeignKeys.Where(AcceptForeignKey) + var foreignKey in databaseModel.Tables.SelectMany(t => + t.ForeignKeys.Where(AcceptForeignKey) ) ) { diff --git a/efcore/test/EFCore.Relational.Specification.Tests/Update/UpdatesRelationalTestBase.cs b/efcore/test/EFCore.Relational.Specification.Tests/Update/UpdatesRelationalTestBase.cs index eb7a759fe3e..c3b14cb0920 100644 --- a/efcore/test/EFCore.Relational.Specification.Tests/Update/UpdatesRelationalTestBase.cs +++ b/efcore/test/EFCore.Relational.Specification.Tests/Update/UpdatesRelationalTestBase.cs @@ -292,12 +292,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con pb.OwnsOne(p => p.Address).Property(p => p.ZipCode).HasColumnName("ZipCode"); }); - modelBuilder.Entity(eb => - { - eb.HasKey(l => new { l.ProfileId }).HasName("PK_LoginDetails"); + modelBuilder.Entity( + eb => + { + eb.HasKey(l => new { l.ProfileId }).HasName("PK_LoginDetails"); - eb.HasOne(d => d.Login).WithOne().HasConstraintName("FK_LoginDetails_Login"); - }); + eb.HasOne(d => d.Login).WithOne().HasConstraintName("FK_LoginDetails_Login"); + }); } } } diff --git a/efcore/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.Json.cs b/efcore/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.Json.cs index 44147b6784d..21fec7bbf88 100644 --- a/efcore/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.Json.cs +++ b/efcore/test/EFCore.Relational.Tests/Infrastructure/RelationalModelValidatorTest.Json.cs @@ -258,8 +258,8 @@ public void Tpc_not_supported_for_owner_of_json_entity() var modelBuilder = CreateConventionModelBuilder(); modelBuilder.Entity().UseTpcMappingStrategy(); modelBuilder.Entity(); - modelBuilder.Entity( - b => b.Ignore(x => x.ReferenceOnBase) + modelBuilder.Entity(b => + b.Ignore(x => x.ReferenceOnBase) ); modelBuilder.Entity(b => diff --git a/efcore/test/EFCore.Relational.Tests/ModelBuilding/RelationalModelBuilderTest.cs b/efcore/test/EFCore.Relational.Tests/ModelBuilding/RelationalModelBuilderTest.cs index 4d3d4436d9d..f54e7bbdcb1 100644 --- a/efcore/test/EFCore.Relational.Tests/ModelBuilding/RelationalModelBuilderTest.cs +++ b/efcore/test/EFCore.Relational.Tests/ModelBuilding/RelationalModelBuilderTest.cs @@ -268,8 +268,8 @@ public virtual void Conflicting_sproc_rows_affected_return_and_parameter_throw() () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedParameter().HasRowsAffectedReturnValue() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedParameter().HasRowsAffectedReturnValue() ) ) .Message @@ -290,9 +290,8 @@ public virtual void Conflicting_sproc_rows_affected_return_and_result_column_thr () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => - s.HasRowsAffectedResultColumn().HasRowsAffectedReturnValue() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedResultColumn().HasRowsAffectedReturnValue() ) ) .Message @@ -311,8 +310,8 @@ public virtual void Conflicting_sproc_rows_affected_parameter_and_return_throw() () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedReturnValue().HasRowsAffectedParameter() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedReturnValue().HasRowsAffectedParameter() ) ) .Message @@ -333,9 +332,8 @@ public virtual void Conflicting_sproc_rows_affected_result_column_and_return_thr () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => - s.HasRowsAffectedReturnValue().HasRowsAffectedResultColumn() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedReturnValue().HasRowsAffectedResultColumn() ) ) .Message @@ -356,8 +354,8 @@ public virtual void Conflicting_sproc_rows_affected_result_column_and_parameter_ () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedParameter().HasRowsAffectedResultColumn() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedParameter().HasRowsAffectedResultColumn() ) ) .Message @@ -396,8 +394,8 @@ public virtual void Conflicting_sproc_rows_affected_parameter_and_result_column_ () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedResultColumn().HasRowsAffectedParameter() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedResultColumn().HasRowsAffectedParameter() ) ) .Message @@ -784,8 +782,8 @@ public virtual void Conflicting_sproc_rows_affected_return_and_parameter_throw() () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedParameter().HasRowsAffectedReturnValue() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedParameter().HasRowsAffectedReturnValue() ) ) .Message @@ -806,9 +804,8 @@ public virtual void Conflicting_sproc_rows_affected_return_and_result_column_thr () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => - s.HasRowsAffectedResultColumn().HasRowsAffectedReturnValue() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedResultColumn().HasRowsAffectedReturnValue() ) ) .Message @@ -847,8 +844,8 @@ public virtual void Conflicting_sproc_rows_affected_parameter_and_result_column_ () => modelBuilder .Entity() - .UpdateUsingStoredProcedure( - s => s.HasRowsAffectedResultColumn().HasRowsAffectedParameter() + .UpdateUsingStoredProcedure(s => + s.HasRowsAffectedResultColumn().HasRowsAffectedParameter() ) ) .Message @@ -1254,49 +1251,46 @@ public virtual void Can_use_sproc_mapping_with_owned_reference() lb.Property(l => l.Id).ValueGeneratedOnUpdate(); - lb.InsertUsingStoredProcedure( - s => - s.HasAnnotation("foo", "bar1") - .HasParameter(b => b.Id) - .HasParameter(b => b.BookId, p => p.HasName("InsertId")) + lb.InsertUsingStoredProcedure(s => + s.HasAnnotation("foo", "bar1") + .HasParameter(b => b.Id) + .HasParameter(b => b.BookId, p => p.HasName("InsertId")) ) - .UpdateUsingStoredProcedure( - s => - s.HasAnnotation("foo", "bar2") - .HasOriginalValueParameter(b => b.Id) - .HasOriginalValueParameter( - b => b.BookId, - p => - { - var parameterBuilder = p.HasName("UpdateId"); - var nonGenericBuilder = - (IInfrastructure) - parameterBuilder; - Assert.IsAssignableFrom( - nonGenericBuilder.Instance.GetInfrastructure() - ); - } - ) - .HasResultColumn( - b => b.Id, - p => - { - var nonGenericBuilder = - (IInfrastructure) - p; - Assert.IsAssignableFrom( - nonGenericBuilder.Instance.GetInfrastructure() - ); - } - ) + .UpdateUsingStoredProcedure(s => + s.HasAnnotation("foo", "bar2") + .HasOriginalValueParameter(b => b.Id) + .HasOriginalValueParameter( + b => b.BookId, + p => + { + var parameterBuilder = p.HasName("UpdateId"); + var nonGenericBuilder = + (IInfrastructure) + parameterBuilder; + Assert.IsAssignableFrom( + nonGenericBuilder.Instance.GetInfrastructure() + ); + } + ) + .HasResultColumn( + b => b.Id, + p => + { + var nonGenericBuilder = + (IInfrastructure) + p; + Assert.IsAssignableFrom( + nonGenericBuilder.Instance.GetInfrastructure() + ); + } + ) ) - .DeleteUsingStoredProcedure( - s => - s.HasAnnotation("foo", "bar3") - .HasOriginalValueParameter( - b => b.BookId, - p => p.HasName("DeleteId") - ) + .DeleteUsingStoredProcedure(s => + s.HasAnnotation("foo", "bar3") + .HasOriginalValueParameter( + b => b.BookId, + p => p.HasName("DeleteId") + ) ); } ); @@ -2654,8 +2648,8 @@ public override TestStoredProcedureBuilder HasRowsAffectedParameter( Action buildAction ) => Wrap( - StoredProcedureBuilder.HasRowsAffectedParameter( - s => buildAction(new TestStoredProcedureParameterBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedParameter(s => + buildAction(new TestStoredProcedureParameterBuilder(s)) ) ); @@ -2715,8 +2709,8 @@ public override TestStoredProcedureBuilder HasRowsAffectedResultColumn( Action buildAction ) => Wrap( - StoredProcedureBuilder.HasRowsAffectedResultColumn( - s => buildAction(new TestStoredProcedureResultColumnBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedResultColumn(s => + buildAction(new TestStoredProcedureResultColumnBuilder(s)) ) ); @@ -2859,8 +2853,8 @@ public override TestStoredProcedureBuilder HasRowsAffectedParameter( Action buildAction ) => Wrap( - StoredProcedureBuilder.HasRowsAffectedParameter( - s => buildAction(new TestStoredProcedureParameterBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedParameter(s => + buildAction(new TestStoredProcedureParameterBuilder(s)) ) ); @@ -2921,8 +2915,8 @@ public override TestStoredProcedureBuilder HasRowsAffectedResultColumn( Action buildAction ) => Wrap( - StoredProcedureBuilder.HasRowsAffectedResultColumn( - s => buildAction(new TestStoredProcedureResultColumnBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedResultColumn(s => + buildAction(new TestStoredProcedureResultColumnBuilder(s)) ) ); @@ -3183,8 +3177,8 @@ public override TestOwnedNavigationStoredProcedureBuilder< TDependentEntity > HasRowsAffectedParameter(Action buildAction) => Wrap( - StoredProcedureBuilder.HasRowsAffectedParameter( - s => buildAction(new TestStoredProcedureParameterBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedParameter(s => + buildAction(new TestStoredProcedureParameterBuilder(s)) ) ); @@ -3240,8 +3234,8 @@ public override TestOwnedNavigationStoredProcedureBuilder< TDependentEntity > HasRowsAffectedResultColumn(Action buildAction) => Wrap( - StoredProcedureBuilder.HasRowsAffectedResultColumn( - s => buildAction(new TestStoredProcedureResultColumnBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedResultColumn(s => + buildAction(new TestStoredProcedureResultColumnBuilder(s)) ) ); @@ -3381,8 +3375,8 @@ public override TestOwnedNavigationStoredProcedureBuilder< TDependentEntity > HasRowsAffectedParameter(Action buildAction) => Wrap( - StoredProcedureBuilder.HasRowsAffectedParameter( - s => buildAction(new TestStoredProcedureParameterBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedParameter(s => + buildAction(new TestStoredProcedureParameterBuilder(s)) ) ); @@ -3439,8 +3433,8 @@ public override TestOwnedNavigationStoredProcedureBuilder< TDependentEntity > HasRowsAffectedResultColumn(Action buildAction) => Wrap( - StoredProcedureBuilder.HasRowsAffectedResultColumn( - s => buildAction(new TestStoredProcedureResultColumnBuilder(s)) + StoredProcedureBuilder.HasRowsAffectedResultColumn(s => + buildAction(new TestStoredProcedureResultColumnBuilder(s)) ) ); diff --git a/efcore/test/EFCore.Relational.Tests/RelationalApiConsistencyTest.cs b/efcore/test/EFCore.Relational.Tests/RelationalApiConsistencyTest.cs index 27f14746591..0debe2619cf 100644 --- a/efcore/test/EFCore.Relational.Tests/RelationalApiConsistencyTest.cs +++ b/efcore/test/EFCore.Relational.Tests/RelationalApiConsistencyTest.cs @@ -344,10 +344,9 @@ Type RuntimeExtensions { typeof(RelationalCompiledQueryCacheKeyGenerator) .GetRuntimeMethods() - .Single( - m => - m.Name == "GenerateCacheKeyCore" - && m.DeclaringType == typeof(RelationalCompiledQueryCacheKeyGenerator) + .Single(m => + m.Name == "GenerateCacheKeyCore" + && m.DeclaringType == typeof(RelationalCompiledQueryCacheKeyGenerator) ) }; diff --git a/efcore/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs b/efcore/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs index 33e62c9cd89..90c969c23ec 100644 --- a/efcore/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/ApiConsistencyTestBase.cs @@ -96,12 +96,11 @@ var hidingMethod in type.GetMethods( .SequenceEqual( method .GetParameters() - .Select( - p => - GetEquivalentGenericType( - p.ParameterType, - hidingMethod.GetGenericArguments() - ) + .Select(p => + GetEquivalentGenericType( + p.ParameterType, + hidingMethod.GetGenericArguments() + ) ) ) ) @@ -163,12 +162,11 @@ var hidingMethod in type.GetMethods( method .GetParameters() .Skip(1) - .Select( - p => - GetEquivalentGenericType( - p.ParameterType, - hidingMethod.GetGenericArguments() - ) + .Select(p => + GetEquivalentGenericType( + p.ParameterType, + hidingMethod.GetGenericArguments() + ) ) ) ) @@ -193,9 +191,8 @@ var hidingMethod in type.GetMethods( "\r\n-- Non-generic fluent returns that aren't hidden --\r\n" + string.Join( Environment.NewLine, - nonGenericMethods.Select( - m => - $"{m.Method.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})" + nonGenericMethods.Select(m => + $"{m.Method.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})" ) ) ); @@ -435,16 +432,15 @@ private string ValidateMetadata(KeyValuePair typ public void Mutable_metadata_types_have_matching_methods() { var errors = Fixture - .MetadataMethods.Select( - typeTuple => - from readonlyMethod in typeTuple.ReadOnly - where !Fixture.UnmatchedMetadataMethods.Contains(readonlyMethod) - where typeTuple.Mutable != null - join mutableMethod in typeTuple.Mutable - on readonlyMethod.Name equals mutableMethod.Name - into mutableGroup - from mutableMethod in mutableGroup.DefaultIfEmpty() - select (readonlyMethod, mutableMethod) + .MetadataMethods.Select(typeTuple => + from readonlyMethod in typeTuple.ReadOnly + where !Fixture.UnmatchedMetadataMethods.Contains(readonlyMethod) + where typeTuple.Mutable != null + join mutableMethod in typeTuple.Mutable + on readonlyMethod.Name equals mutableMethod.Name + into mutableGroup + from mutableMethod in mutableGroup.DefaultIfEmpty() + select (readonlyMethod, mutableMethod) ) .SelectMany(m => m.Select(MatchMutable)) .Where(e => e != null) @@ -508,15 +504,14 @@ out var expectedReturnTypes public void Convention_metadata_types_have_matching_methods() { var errors = Fixture - .MetadataMethods.Select( - typeTuple => - from mutableMethod in typeTuple.Mutable - where !Fixture.UnmatchedMetadataMethods.Contains(mutableMethod) - join conventionMethod in typeTuple.Convention - on GetConventionName(mutableMethod) equals conventionMethod.Name - into conventionGroup - from conventionMethod in conventionGroup.DefaultIfEmpty() - select (mutableMethod, conventionMethod) + .MetadataMethods.Select(typeTuple => + from mutableMethod in typeTuple.Mutable + where !Fixture.UnmatchedMetadataMethods.Contains(mutableMethod) + join conventionMethod in typeTuple.Convention + on GetConventionName(mutableMethod) equals conventionMethod.Name + into conventionGroup + from conventionMethod in conventionGroup.DefaultIfEmpty() + select (mutableMethod, conventionMethod) ) .SelectMany(m => m.Select(MatchConvention)) .Where(e => e != null) @@ -761,12 +756,11 @@ private string ValidateConventionBuilderMethods(IReadOnlyList method public void Convention_builder_methods_have_matching_returns() { var errors = Fixture - .MetadataTypes.Select( - t => - ValidateConventionBuilderMethodReturns( - t.Value.ConventionBuilder, - t.Value.Convention - ) + .MetadataTypes.Select(t => + ValidateConventionBuilderMethodReturns( + t.Value.ConventionBuilder, + t.Value.Convention + ) ) .Where(e => e != null) .ToList(); @@ -813,8 +807,8 @@ private string ValidateConventionBuilderMethodReturns(Type builderType, Type con ? interfaceType.GetGenericTypeDefinition() : interfaceType; var readOnlyInterfaceType = Fixture - .MetadataTypes.FirstOrDefault( - p => p.Value.ConventionBuilder == normalizedInterfaceType + .MetadataTypes.FirstOrDefault(p => + p.Value.ConventionBuilder == normalizedInterfaceType ) .Key; @@ -843,12 +837,8 @@ private string ValidateConventionBuilderMethodReturns(Type builderType, Type con var parameters = method .GetParameters() - .Select( - p => - GetEquivalentGenericType( - p.ParameterType, - builderType.GetGenericArguments() - ) + .Select(p => + GetEquivalentGenericType(p.ParameterType, builderType.GetGenericArguments()) ) .ToArray(); var hidingMethod = builderType.GetMethod( @@ -903,12 +893,11 @@ private string ValidateConventionBuilderMethodReturns(Type builderType, Type con .Concat( parameters .Skip(1) - .Select( - p => - GetEquivalentGenericType( - p.ParameterType, - builderType.GetGenericArguments() - ) + .Select(p => + GetEquivalentGenericType( + p.ParameterType, + builderType.GetGenericArguments() + ) ) ) .ToArray(); @@ -937,9 +926,8 @@ private string ValidateConventionBuilderMethodReturns(Type builderType, Type con return string.Join( Environment.NewLine, - unmatchedMethods.Select( - m => - $"{m.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})" + unmatchedMethods.Select(m => + $"{m.ReturnType.ShortDisplayName()} {m.Type.Name}.{m.Method.Name}{FormatGenericArguments(m.Method)}({Format(m.Method.GetParameters())})" ) ); } @@ -948,15 +936,14 @@ private string ValidateConventionBuilderMethodReturns(Type builderType, Type con public void Runtime_metadata_types_have_matching_methods() { var errors = Fixture - .MetadataMethods.Select( - typeTuple => - from readOnlyMethod in typeTuple.ReadOnly - where !Fixture.UnmatchedMetadataMethods.Contains(readOnlyMethod) - join runtimeMethod in typeTuple.Runtime - on readOnlyMethod.Name equals runtimeMethod?.Name - into runtimeGroup - from runtimeMethod in runtimeGroup.DefaultIfEmpty() - select (readOnlyMethod, runtimeMethod) + .MetadataMethods.Select(typeTuple => + from readOnlyMethod in typeTuple.ReadOnly + where !Fixture.UnmatchedMetadataMethods.Contains(readOnlyMethod) + join runtimeMethod in typeTuple.Runtime + on readOnlyMethod.Name equals runtimeMethod?.Name + into runtimeGroup + from runtimeMethod in runtimeGroup.DefaultIfEmpty() + select (readOnlyMethod, runtimeMethod) ) .SelectMany(m => m.Select(MatchRuntime)) .Where(e => e != null) @@ -1235,11 +1222,10 @@ from sd in serviceCollection .ParameterType.GetConstructors( BindingFlags.Instance | BindingFlags.NonPublic ) - .Any( - c => - c.GetParameters() is var parameters - && parameters.Length == 1 - && parameters[0].Name == "original" + .Any(c => + c.GetParameters() is var parameters + && parameters.Length == 1 + && parameters[0].Name == "original" ) ) select it @@ -1343,10 +1329,9 @@ select method var missingOverloads = ( from methodWithoutToken in asyncMethodsWithoutToken where - !asyncMethodsWithToken.Any( - methodWithToken => - methodWithoutToken.Name == methodWithToken.Name - && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType + !asyncMethodsWithToken.Any(methodWithToken => + methodWithoutToken.Name == methodWithToken.Name + && methodWithoutToken.DeclaringType == methodWithToken.DeclaringType ) && !Fixture.AsyncMethodExceptions.Contains(methodWithoutToken) // ReSharper disable once PossibleNullReferenceException select methodWithoutToken.DeclaringType.Name + "." + methodWithoutToken.Name @@ -1359,11 +1344,10 @@ select methodWithoutToken.DeclaringType.Name + "." + methodWithoutToken.Name ); var missingSuffixMethods = asyncMethods - .Where( - method => - !method.Name.EndsWith("Async", StringComparison.Ordinal) - && method.DeclaringType != null - && !Fixture.AsyncMethodExceptions.Contains(method) + .Where(method => + !method.Name.EndsWith("Async", StringComparison.Ordinal) + && method.DeclaringType != null + && !Fixture.AsyncMethodExceptions.Contains(method) ) .Select(method => method.DeclaringType.Name + "." + method.Name) .ToList(); @@ -1762,28 +1746,25 @@ Func parameterGenerator | BindingFlags.Static | BindingFlags.DeclaredOnly ) - .Single( - mi => - mi.Name == name - && ( - (genericParameterCount == 0 && !mi.IsGenericMethod) - || ( - mi.IsGenericMethod - && mi.GetGenericArguments().Length == genericParameterCount - ) + .Single(mi => + mi.Name == name + && ( + (genericParameterCount == 0 && !mi.IsGenericMethod) + || ( + mi.IsGenericMethod + && mi.GetGenericArguments().Length == genericParameterCount ) - && mi.GetParameters() - .Select(e => e.ParameterType) - .SequenceEqual( - parameterGenerator( - type.IsGenericType - ? type.GetGenericArguments() - : Array.Empty(), - mi.IsGenericMethod - ? mi.GetGenericArguments() - : Array.Empty() - ) + ) + && mi.GetParameters() + .Select(e => e.ParameterType) + .SequenceEqual( + parameterGenerator( + type.IsGenericType + ? type.GetGenericArguments() + : Array.Empty(), + mi.IsGenericMethod ? mi.GetGenericArguments() : Array.Empty() ) + ) ); protected virtual void Initialize() @@ -1803,26 +1784,23 @@ protected virtual void Initialize() var readOnlyMethods = extensionTypeTuple .ReadonlyExtensions?.GetMethods(BindingFlags.Public | BindingFlags.Static) - .Where( - m => !IsObsolete(m) && m.GetParameters().First().ParameterType == type + .Where(m => + !IsObsolete(m) && m.GetParameters().First().ParameterType == type ) .ToArray() ?? new MethodInfo[0]; var mutableMethods = extensionTypeTuple .MutableExtensions?.GetMethods(BindingFlags.Public | BindingFlags.Static) - .Where( - m => - !IsObsolete(m) - && m.GetParameters().First().ParameterType == mutableType + .Where(m => + !IsObsolete(m) && m.GetParameters().First().ParameterType == mutableType ) .ToArray() ?? new MethodInfo[0]; var conventionMethods = extensionTypeTuple .ConventionExtensions?.GetMethods(BindingFlags.Public | BindingFlags.Static) - .Where( - m => - !IsObsolete(m) - && m.GetParameters().First().ParameterType == conventionType + .Where(m => + !IsObsolete(m) + && m.GetParameters().First().ParameterType == conventionType ) .ToArray() ?? new MethodInfo[0]; var conventionBuilderMethods = @@ -1830,19 +1808,16 @@ protected virtual void Initialize() .ConventionBuilderExtensions?.GetMethods( BindingFlags.Public | BindingFlags.Static ) - .Where( - m => - !IsObsolete(m) - && m.GetParameters().First().ParameterType == conventionBuilderType + .Where(m => + !IsObsolete(m) + && m.GetParameters().First().ParameterType == conventionBuilderType ) .ToArray() ?? new MethodInfo[0]; var runtimeMethods = extensionTypeTuple .RuntimeExtensions?.GetMethods(BindingFlags.Public | BindingFlags.Static) - .Where( - m => - !IsObsolete(m) - && m.GetParameters().First().ParameterType == runtimeType + .Where(m => + !IsObsolete(m) && m.GetParameters().First().ParameterType == runtimeType ) .ToArray() ?? new MethodInfo[0]; MetadataMethods.Add( diff --git a/efcore/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs b/efcore/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs index 0920c185d30..f1fee015780 100644 --- a/efcore/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/BuiltInDataTypesTestBase.cs @@ -30,14 +30,11 @@ public virtual async Task Can_filter_projection_with_captured_enum_variable(bool var query = context .Set() - .Select( - t => - new EmailTemplateDto - { - Id = t.Id, - TemplateType = (EmailTemplateTypeDto)t.TemplateType - } - ) + .Select(t => new EmailTemplateDto + { + Id = t.Id, + TemplateType = (EmailTemplateTypeDto)t.TemplateType + }) .Where(t => t.TemplateType == templateType); var results = async ? await query.ToListAsync() : query.ToList(); @@ -54,14 +51,11 @@ public virtual async Task Can_filter_projection_with_inline_enum_variable(bool a using var context = CreateContext(); var query = context .Set() - .Select( - t => - new EmailTemplateDto - { - Id = t.Id, - TemplateType = (EmailTemplateTypeDto)t.TemplateType - } - ) + .Select(t => new EmailTemplateDto + { + Id = t.Id, + TemplateType = (EmailTemplateTypeDto)t.TemplateType + }) .Where(t => t.TemplateType == EmailTemplateTypeDto.PasswordResetRequest); var results = async ? await query.ToListAsync() : query.ToList(); @@ -268,10 +262,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param1 = (short)-1234; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestInt16)) == param1 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestInt16)) == param1 ) .ToList() .Single() @@ -280,10 +273,8 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param2 = -123456789; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestInt32)) == param2 + set.Where(e => + e.Id == 11 && EF.Property(e, nameof(BuiltInDataTypes.TestInt32)) == param2 ) .ToList() .Single() @@ -294,10 +285,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) { Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestInt64)) == param3 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestInt64)) == param3 ) .ToList() .Single() @@ -309,10 +299,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) { Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4 ) .ToList() .Single() @@ -324,19 +313,17 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) double? param4h = -1.234567889; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && ( + set.Where(e => + e.Id == 11 + && ( + EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) == param4 + || ( EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) - == param4 - || ( - EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) - > param4l - && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) - < param4h - ) + > param4l + && EF.Property(e, nameof(BuiltInDataTypes.TestDouble)) + < param4h ) + ) ) .ToList() .Single() @@ -346,10 +333,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param5 = -1234567890.01M; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestDecimal)) == param5 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestDecimal)) == param5 ) .ToList() .Single() @@ -358,10 +344,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param6 = Fixture.DefaultDateTime; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestDateTime)) == param6 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestDateTime)) == param6 ) .ToList() .Single() @@ -372,13 +357,12 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param7 = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInDataTypes.TestDateTimeOffset) - ) == param7 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInDataTypes.TestDateTimeOffset) + ) == param7 ) .ToList() .Single() @@ -390,11 +374,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param8 = new TimeSpan(0, 10, 9, 8, 7); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestTimeSpan)) - == param8 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestTimeSpan)) == param8 ) .ToList() .Single() @@ -406,11 +388,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param9 = new DateOnly(2020, 3, 1); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestDateOnly)) - == param9 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestDateOnly)) == param9 ) .ToList() .Single() @@ -422,11 +402,10 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param10 = new TimeOnly(12, 30, 45, 123); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestTimeOnly)) - == param10 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestTimeOnly)) + == param10 ) .ToList() .Single() @@ -438,10 +417,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) { Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11 ) .ToList() .Single() @@ -453,19 +431,17 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param11h = -1.2339F; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && ( + set.Where(e => + e.Id == 11 + && ( + EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) == param11 + || ( EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) - == param11 - || ( - EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) - > param11l - && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) - < param11h - ) + > param11l + && EF.Property(e, nameof(BuiltInDataTypes.TestSingle)) + < param11h ) + ) ) .ToList() .Single() @@ -475,10 +451,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param12 = true; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestBoolean)) == param12 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestBoolean)) == param12 ) .ToList() .Single() @@ -489,10 +464,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param13 = (byte)255; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestByte)) == param13 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestByte)) == param13 ) .ToList() .Single() @@ -502,10 +476,8 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param14 = Enum64.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum64)) == param14 + set.Where(e => + e.Id == 11 && EF.Property(e, nameof(BuiltInDataTypes.Enum64)) == param14 ) .ToList() .Single() @@ -514,10 +486,8 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param15 = Enum32.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum32)) == param15 + set.Where(e => + e.Id == 11 && EF.Property(e, nameof(BuiltInDataTypes.Enum32)) == param15 ) .ToList() .Single() @@ -526,10 +496,8 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param16 = Enum16.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum16)) == param16 + set.Where(e => + e.Id == 11 && EF.Property(e, nameof(BuiltInDataTypes.Enum16)) == param16 ) .ToList() .Single() @@ -540,10 +508,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param17 = Enum8.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum8)) == param17 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.Enum8)) == param17 ) .ToList() .Single() @@ -555,11 +522,10 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param18 = (ushort)1234; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt16)) - == param18 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt16)) + == param18 ) .ToList() .Single() @@ -571,11 +537,10 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param19 = 1234565789U; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt32)) - == param19 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt32)) + == param19 ) .ToList() .Single() @@ -587,11 +552,10 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param20 = 1234567890123456789UL; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt64)) - == param20 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestUnsignedInt64)) + == param20 ) .ToList() .Single() @@ -603,11 +567,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param21 = 'a'; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestCharacter)) - == param21 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestCharacter)) == param21 ) .ToList() .Single() @@ -619,11 +581,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param22 = (sbyte)-128; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.TestSignedByte)) - == param22 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.TestSignedByte)) == param22 ) .ToList() .Single() @@ -635,10 +595,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param23 = EnumU64.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.EnumU64)) == param23 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.EnumU64)) == param23 ) .ToList() .Single() @@ -650,10 +609,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param24 = EnumU32.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.EnumU32)) == param24 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.EnumU32)) == param24 ) .ToList() .Single() @@ -665,10 +623,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param25 = EnumU16.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.EnumU16)) == param25 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.EnumU16)) == param25 ) .ToList() .Single() @@ -680,10 +637,9 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param26 = EnumS8.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.EnumS8)) == param26 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.EnumS8)) == param26 ) .ToList() .Single() @@ -699,22 +655,19 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param27 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum64)) - == (Enum64)param27 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.Enum64)) + == (Enum64)param27 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum64)) - == param27 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum64)) == param27 ) .ToList() .Single() @@ -730,22 +683,19 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param28 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum32)) - == (Enum32)param28 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.Enum32)) + == (Enum32)param28 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum32)) - == param28 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum32)) == param28 ) .ToList() .Single() @@ -761,22 +711,19 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param29 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum16)) - == (Enum16)param29 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.Enum16)) + == (Enum16)param29 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum16)) - == param29 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum16)) == param29 ) .ToList() .Single() @@ -792,21 +739,18 @@ private void QueryBuiltInDataTypesTest(EntityEntry source) var param30 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInDataTypes.Enum8)) - == (Enum8)param30 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInDataTypes.Enum8)) == (Enum8)param30 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum8)) == param30 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInDataTypes.Enum8)) == param30 ) .ToList() .Single() @@ -902,13 +846,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou short? param1 = -1234; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableInt16) - ) == param1 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableInt16)) + == param1 ) .ToList() .Single() @@ -917,11 +858,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou int? param2 = -123456789; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableInt32)) - == param2 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableInt32)) + == param2 ) .ToList() .Single() @@ -930,11 +870,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou long? param3 = -1234567890123456789L; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableInt64)) - == param3 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableInt64)) + == param3 ) .ToList() .Single() @@ -945,13 +884,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou { Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDouble) - ) == param4 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDouble) + ) == param4 ) .ToList() .Single() @@ -963,25 +901,24 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou double? param4h = -1.234567889; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && ( + set.Where(e => + e.Id == 11 + && ( + EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDouble) + ) == param4 + || ( EF.Property( e, nameof(BuiltInNullableDataTypes.TestNullableDouble) - ) == param4 - || ( - EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDouble) - ) > param4l - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDouble) - ) < param4h - ) + ) > param4l + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDouble) + ) < param4h ) + ) ) .ToList() .Single() @@ -991,13 +928,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou decimal? param5 = -1234567890.01M; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDecimal) - ) == param5 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDecimal) + ) == param5 ) .ToList() .Single() @@ -1006,13 +942,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou DateTime? param6 = Fixture.DefaultDateTime; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDateTime) - ) == param6 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDateTime) + ) == param6 ) .ToList() .Single() @@ -1026,13 +961,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou DateTimeOffset? param7 = new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset) - ) == param7 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDateTimeOffset) + ) == param7 ) .ToList() .Single() @@ -1044,13 +978,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou TimeSpan? param8 = new TimeSpan(0, 10, 9, 8, 7); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableTimeSpan) - ) == param8 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableTimeSpan) + ) == param8 ) .ToList() .Single() @@ -1062,13 +995,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou DateOnly? param9 = new DateOnly(2020, 3, 1); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableDateOnly) - ) == param9 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableDateOnly) + ) == param9 ) .ToList() .Single() @@ -1080,13 +1012,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou TimeOnly? param10 = new TimeOnly(12, 30, 45, 123); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableTimeOnly) - ) == param10 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableTimeOnly) + ) == param10 ) .ToList() .Single() @@ -1098,13 +1029,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou { Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableSingle) - ) == param11 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableSingle) + ) == param11 ) .ToList() .Single() @@ -1116,25 +1046,24 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou float? param11h = -1.2339F; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && ( + set.Where(e => + e.Id == 11 + && ( + EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableSingle) + ) == param11 + || ( EF.Property( e, nameof(BuiltInNullableDataTypes.TestNullableSingle) - ) == param11 - || ( - EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableSingle) - ) > param11l - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableSingle) - ) < param11h - ) + ) > param11l + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableSingle) + ) < param11h ) + ) ) .ToList() .Single() @@ -1144,13 +1073,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou bool? param12 = true; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableBoolean) - ) == param12 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableBoolean)) + == param12 ) .ToList() .Single() @@ -1161,13 +1087,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou byte? param13 = 255; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableByte) - ) == param13 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.TestNullableByte)) + == param13 ) .ToList() .Single() @@ -1177,11 +1100,9 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou Enum64? param14 = Enum64.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) - == param14 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) == param14 ) .ToList() .Single() @@ -1190,11 +1111,9 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou Enum32? param15 = Enum32.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) - == param15 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) == param15 ) .ToList() .Single() @@ -1203,11 +1122,9 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou Enum16? param16 = Enum16.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) - == param16 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) == param16 ) .ToList() .Single() @@ -1218,11 +1135,9 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou Enum8? param17 = Enum8.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) - == param17 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) == param17 ) .ToList() .Single() @@ -1237,13 +1152,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou ushort? param18 = 1234; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16) - ) == param18 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt16) + ) == param18 ) .ToList() .Single() @@ -1258,13 +1172,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou uint? param19 = 1234565789U; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32) - ) == param19 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt32) + ) == param19 ) .ToList() .Single() @@ -1279,13 +1192,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou ulong? param20 = 1234567890123456789UL; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64) - ) == param20 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableUnsignedInt64) + ) == param20 ) .ToList() .Single() @@ -1297,13 +1209,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou char? param21 = 'a'; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableCharacter) - ) == param21 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableCharacter) + ) == param21 ) .ToList() .Single() @@ -1317,13 +1228,12 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou sbyte? param22 = -128; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property( - e, - nameof(BuiltInNullableDataTypes.TestNullableSignedByte) - ) == param22 + set.Where(e => + e.Id == 11 + && EF.Property( + e, + nameof(BuiltInNullableDataTypes.TestNullableSignedByte) + ) == param22 ) .ToList() .Single() @@ -1335,11 +1245,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou var param23 = EnumU64.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU64)) - == param23 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU64)) + == param23 ) .ToList() .Single() @@ -1351,11 +1260,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou var param24 = EnumU32.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU32)) - == param24 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU32)) + == param24 ) .ToList() .Single() @@ -1367,11 +1275,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou var param25 = EnumU16.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU16)) - == param25 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumU16)) + == param25 ) .ToList() .Single() @@ -1383,11 +1290,10 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou var param26 = EnumS8.SomeValue; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumS8)) - == param26 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.EnumS8)) + == param26 ) .ToList() .Single() @@ -1405,22 +1311,20 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou int? param27 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) - == (Enum64)param27 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) + == (Enum64)param27 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) - == param27 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum64)) + == param27 ) .ToList() .Single() @@ -1438,22 +1342,20 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou int? param28 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) - == (Enum32)param28 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) + == (Enum32)param28 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) - == param28 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum32)) + == param28 ) .ToList() .Single() @@ -1471,22 +1373,20 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou int? param29 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) - == (Enum16)param29 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) + == (Enum16)param29 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) - == param29 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum16)) + == param29 ) .ToList() .Single() @@ -1504,22 +1404,20 @@ private void QueryBuiltInNullableDataTypesTest(EntityEntry sou int? param30 = 1; Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) - == (Enum8)param30 + set.Where(e => + e.Id == 11 + && EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) + == (Enum8)param30 ) .ToList() .Single() ); Assert.Same( entity, - set.Where( - e => - e.Id == 11 - && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) - == param30 + set.Where(e => + e.Id == 11 + && (int)EF.Property(e, nameof(BuiltInNullableDataTypes.Enum8)) + == param30 ) .ToList() .Single() @@ -1687,11 +1585,10 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => - e.Id == 12 - && -e.TestNullableDouble + -1.23456789 < 1E-5 - && -e.TestNullableDouble + -1.23456789 > -1E-5 + .Where(e => + e.Id == 12 + && -e.TestNullableDouble + -1.23456789 < 1E-5 + && -e.TestNullableDouble + -1.23456789 > -1E-5 ) .ToList() .Single() @@ -1734,11 +1631,10 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => - e.Id == 12 - && e.TestNullableDateTimeOffset - == new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)) + .Where(e => + e.Id == 12 + && e.TestNullableDateTimeOffset + == new DateTimeOffset(new DateTime(), TimeSpan.FromHours(-8.0)) ) .ToList() .Single() @@ -1754,9 +1650,8 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => - e.Id == 12 && e.TestNullableTimeSpan == new TimeSpan(0, 10, 9, 8, 7) + .Where(e => + e.Id == 12 && e.TestNullableTimeSpan == new TimeSpan(0, 10, 9, 8, 7) ) .ToList() .Single() @@ -1772,8 +1667,7 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => e.Id == 12 && e.TestNullableDateOnly == new DateOnly(2020, 3, 1) + .Where(e => e.Id == 12 && e.TestNullableDateOnly == new DateOnly(2020, 3, 1) ) .ToList() .Single() @@ -1789,10 +1683,8 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => - e.Id == 12 - && e.TestNullableTimeOnly == new TimeOnly(12, 30, 45, 123) + .Where(e => + e.Id == 12 && e.TestNullableTimeOnly == new TimeOnly(12, 30, 45, 123) ) .ToList() .Single() @@ -1930,8 +1822,8 @@ public virtual void Can_query_using_any_nullable_data_type_as_literal() entity, context .Set() - .Where( - e => e.Id == 12 && e.TestNullableUnsignedInt64 == 1234567890123456789UL + .Where(e => + e.Id == 12 && e.TestNullableUnsignedInt64 == 1234567890123456789UL ) .ToList() .Single() @@ -3272,22 +3164,19 @@ public virtual void Object_to_string_conversion() .Set() .Where(e => e.Id == 13) .AsEnumerable() - .Select( - b => - new - { - Sbyte = b.TestSignedByte.ToString(), - Byte = b.TestByte.ToString(), - Short = b.TestInt16.ToString(), - Ushort = b.TestUnsignedInt16.ToString(), - Int = b.TestInt32.ToString(), - Uint = b.TestUnsignedInt32.ToString(), - Long = b.TestInt64.ToString(), - Ulong = b.TestUnsignedInt64.ToString(), - Decimal = b.TestDecimal.ToString(), - Char = b.TestCharacter.ToString() - } - ) + .Select(b => new + { + Sbyte = b.TestSignedByte.ToString(), + Byte = b.TestByte.ToString(), + Short = b.TestInt16.ToString(), + Ushort = b.TestUnsignedInt16.ToString(), + Int = b.TestInt32.ToString(), + Uint = b.TestUnsignedInt32.ToString(), + Long = b.TestInt64.ToString(), + Ulong = b.TestUnsignedInt64.ToString(), + Decimal = b.TestDecimal.ToString(), + Char = b.TestCharacter.ToString() + }) .First(); Fixture.ListLoggerFactory.Clear(); @@ -3295,29 +3184,26 @@ public virtual void Object_to_string_conversion() var query = context .Set() .Where(e => e.Id == 13) - .Select( - b => - new - { - Sbyte = b.TestSignedByte.ToString(), - Byte = b.TestByte.ToString(), - Short = b.TestInt16.ToString(), - Ushort = b.TestUnsignedInt16.ToString(), - Int = b.TestInt32.ToString(), - Uint = b.TestUnsignedInt32.ToString(), - Long = b.TestInt64.ToString(), - Ulong = b.TestUnsignedInt64.ToString(), - Float = b.TestSingle.ToString(), - Double = b.TestDouble.ToString(), - Decimal = b.TestDecimal.ToString(), - Char = b.TestCharacter.ToString(), - DateTime = b.TestDateTime.ToString(), - DateTimeOffset = b.TestDateTimeOffset.ToString(), - TimeSpan = b.TestTimeSpan.ToString(), - DateOnly = b.TestDateOnly.ToString(), - TimeOnly = b.TestTimeOnly.ToString(), - } - ) + .Select(b => new + { + Sbyte = b.TestSignedByte.ToString(), + Byte = b.TestByte.ToString(), + Short = b.TestInt16.ToString(), + Ushort = b.TestUnsignedInt16.ToString(), + Int = b.TestInt32.ToString(), + Uint = b.TestUnsignedInt32.ToString(), + Long = b.TestInt64.ToString(), + Ulong = b.TestUnsignedInt64.ToString(), + Float = b.TestSingle.ToString(), + Double = b.TestDouble.ToString(), + Decimal = b.TestDecimal.ToString(), + Char = b.TestCharacter.ToString(), + DateTime = b.TestDateTime.ToString(), + DateTimeOffset = b.TestDateTimeOffset.ToString(), + TimeSpan = b.TestTimeSpan.ToString(), + DateOnly = b.TestDateOnly.ToString(), + TimeOnly = b.TestTimeOnly.ToString(), + }) .ToList(); var actual = Assert.Single(query); @@ -3340,28 +3226,22 @@ public virtual void Optional_datetime_reading_null_from_database() var expected = context .Set() .ToList() - .Select( - e => - new - { - DT = e.DateTimeOffset == null - ? (DateTime?)null - : e.DateTimeOffset.Value.DateTime.Date - } - ) + .Select(e => new + { + DT = e.DateTimeOffset == null + ? (DateTime?)null + : e.DateTimeOffset.Value.DateTime.Date + }) .ToList(); var actual = context .Set() - .Select( - e => - new - { - DT = e.DateTimeOffset == null - ? (DateTime?)null - : e.DateTimeOffset.Value.DateTime.Date - } - ) + .Select(e => new + { + DT = e.DateTimeOffset == null + ? (DateTime?)null + : e.DateTimeOffset.Value.DateTime.Date + }) .ToList(); for (var i = 0; i < expected.Count; i++) @@ -3392,13 +3272,12 @@ public abstract class BuiltInDataTypesFixtureBase : SharedStoreFixtureBase base.AddOptions(builder) - .ConfigureWarnings( - w => - w.Ignore( - CoreEventId.MappedEntityTypeIgnoredWarning, - CoreEventId.MappedPropertyIgnoredWarning, - CoreEventId.MappedNavigationIgnoredWarning - ) + .ConfigureWarnings(w => + w.Ignore( + CoreEventId.MappedEntityTypeIgnoredWarning, + CoreEventId.MappedPropertyIgnoredWarning, + CoreEventId.MappedNavigationIgnoredWarning + ) ); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) diff --git a/efcore/test/EFCore.Specification.Tests/ComplianceTestBase.cs b/efcore/test/EFCore.Specification.Tests/ComplianceTestBase.cs index 90ee40a04fc..3a7a54a4929 100644 --- a/efcore/test/EFCore.Specification.Tests/ComplianceTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/ComplianceTestBase.cs @@ -15,11 +15,8 @@ public virtual void All_test_bases_must_be_implemented() { var concreteTests = TargetAssembly .GetTypes() - .Where( - c => - c.BaseType != typeof(object) - && !c.IsAbstract - && (c.IsPublic || c.IsNestedPublic) + .Where(c => + c.BaseType != typeof(object) && !c.IsAbstract && (c.IsPublic || c.IsNestedPublic) ) .ToList(); var nonImplementedBases = ( diff --git a/efcore/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs b/efcore/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs index dd361594c4a..639e34445f7 100644 --- a/efcore/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/ConcurrencyDetectorTestBase.cs @@ -22,60 +22,54 @@ protected ConcurrencyDetectorTestBase(TFixture fixture) [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Find(bool async) => - ConcurrencyDetectorTest( - async c => async ? await c.Products.FindAsync(1) : c.Products.Find(1) + ConcurrencyDetectorTest(async c => + async ? await c.Products.FindAsync(1) : c.Products.Find(1) ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Count(bool async) => - ConcurrencyDetectorTest( - async c => async ? await c.Products.CountAsync() : c.Products.Count() + ConcurrencyDetectorTest(async c => + async ? await c.Products.CountAsync() : c.Products.Count() ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task First(bool async) => - ConcurrencyDetectorTest( - async c => - async - ? await c.Products.OrderBy(p => p.Id).FirstAsync() - : c.Products.OrderBy(p => p.Id).First() + ConcurrencyDetectorTest(async c => + async + ? await c.Products.OrderBy(p => p.Id).FirstAsync() + : c.Products.OrderBy(p => p.Id).First() ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Last(bool async) => - ConcurrencyDetectorTest( - async c => - async - ? await c.Products.OrderBy(p => p.Id).LastAsync() - : c.Products.OrderBy(p => p.Id).Last() + ConcurrencyDetectorTest(async c => + async + ? await c.Products.OrderBy(p => p.Id).LastAsync() + : c.Products.OrderBy(p => p.Id).Last() ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Single(bool async) => - ConcurrencyDetectorTest( - async c => - async - ? await c.Products.SingleAsync(p => p.Id == 1) - : c.Products.Single(p => p.Id == 1) + ConcurrencyDetectorTest(async c => + async ? await c.Products.SingleAsync(p => p.Id == 1) : c.Products.Single(p => p.Id == 1) ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Any(bool async) => - ConcurrencyDetectorTest( - async c => - async ? await c.Products.AnyAsync(p => p.Id < 10) : c.Products.Any(p => p.Id < 10) + ConcurrencyDetectorTest(async c => + async ? await c.Products.AnyAsync(p => p.Id < 10) : c.Products.Any(p => p.Id < 10) ); [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task ToList(bool async) => - ConcurrencyDetectorTest( - async c => async ? await c.Products.ToListAsync() : c.Products.ToList() + ConcurrencyDetectorTest(async c => + async ? await c.Products.ToListAsync() : c.Products.ToList() ); protected abstract Task ConcurrencyDetectorTest( diff --git a/efcore/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs b/efcore/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs index 086a4a63778..12f899b80f9 100644 --- a/efcore/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/CustomConvertersTestBase.cs @@ -410,11 +410,10 @@ public virtual async Task Can_query_custom_type_not_mapped_by_default_equality(b { var query = context .Set() - .Where( - c => - c.StyleKey == "Swag" - && c.IsTest == false - && c.Discriminator == new Dictionary() + .Where(c => + c.StyleKey == "Swag" + && c.IsTest == false + && c.Discriminator == new Dictionary() ); var result = async ? await query.SingleAsync() : query.Single(); @@ -440,15 +439,12 @@ public virtual void Field_on_derived_type_retrieved_via_cast_applies_value_conve var query = context .Set() .Where(b => b.BlogId == 2) - .Select( - x => - new - { - x.BlogId, - x.Url, - RssUrl = x is RssBlog ? ((RssBlog)x).RssUrl : null - } - ) + .Select(x => new + { + x.BlogId, + x.Url, + RssUrl = x is RssBlog ? ((RssBlog)x).RssUrl : null + }) .ToList(); var result = Assert.Single(query); @@ -614,13 +610,9 @@ public virtual void Value_conversion_on_enum_collection_contains() var group = MessageGroup.SomeGroup; var query = context .Set() - .Where( - x => - !x.IsSoftDeleted - && ( - x.MessageGroups.Contains(group) - || x.MessageGroups.Contains(MessageGroup.All) - ) + .Where(x => + !x.IsSoftDeleted + && (x.MessageGroups.Contains(group) || x.MessageGroups.Contains(MessageGroup.All)) ) .ToList(); @@ -847,18 +839,13 @@ public virtual void Composition_over_collection_of_complex_mapped_as_scalar() context .Set() .AsNoTracking() - .Select( - d => - new - { - d.Id, - d.Name, - Layouts = d.Layouts.Select( - l => new { H = l.Height, W = l.Width } - ) - .ToList() - } - ) + .Select(d => new + { + d.Id, + d.Name, + Layouts = d.Layouts.Select(l => new { H = l.Height, W = l.Width }) + .ToList() + }) .ToList() ) .Message.Replace("\r", "") @@ -935,10 +922,9 @@ public virtual void Infer_type_mapping_from_in_subquery_to_item() using var context = CreateContext(); var results = context .Set() - .Where( - b => - context.Set().Select(bb => bb.TestBoolean).Contains(true) - && b.Id == 13 + .Where(b => + context.Set().Select(bb => bb.TestBoolean).Contains(true) + && b.Id == 13 ) .ToList(); diff --git a/efcore/test/EFCore.Specification.Tests/F1FixtureBase.cs b/efcore/test/EFCore.Specification.Tests/F1FixtureBase.cs index 19e3b5b5195..b64648c4c39 100644 --- a/efcore/test/EFCore.Specification.Tests/F1FixtureBase.cs +++ b/efcore/test/EFCore.Specification.Tests/F1FixtureBase.cs @@ -15,8 +15,8 @@ public abstract class F1FixtureBase : SharedStoreFixtureBase base.AddOptions(builder) .UseModel(CreateModelExternal()) - .ConfigureWarnings( - w => w.Ignore(CoreEventId.SaveChangesStarting, CoreEventId.SaveChangesCompleted) + .ConfigureWarnings(w => + w.Ignore(CoreEventId.SaveChangesStarting, CoreEventId.SaveChangesCompleted) ); protected override IServiceCollection AddServices(IServiceCollection serviceCollection) => @@ -270,8 +270,8 @@ params string[] propertyNames entityType.ConstructorBinding = new ConstructorBinding( typeof(TEntity) .GetTypeInfo() - .DeclaredConstructors.Single( - c => c.GetParameters().Length == parameterBindings.Count + .DeclaredConstructors.Single(c => + c.GetParameters().Length == parameterBindings.Count ), parameterBindings ); diff --git a/efcore/test/EFCore.Specification.Tests/FieldMappingTestBase.cs b/efcore/test/EFCore.Specification.Tests/FieldMappingTestBase.cs index a4580abbe14..2f9ad7e9066 100644 --- a/efcore/test/EFCore.Specification.Tests/FieldMappingTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/FieldMappingTestBase.cs @@ -872,14 +872,11 @@ protected virtual void Projection(string property1, string property2, boo using var context = CreateContext(); var posts = context .Set() - .Select( - p => - new - { - Prop1 = EF.Property(p, property1), - Prop2 = EF.Property(p, property2) - } - ) + .Select(p => new + { + Prop1 = EF.Property(p, property1), + Prop2 = EF.Property(p, property2) + }) .AsTracking(tracking) .ToList(); diff --git a/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs b/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs index cc259ea0f1d..f96a1995806 100644 --- a/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs +++ b/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToManyAk.cs @@ -962,14 +962,13 @@ public virtual void Optional_many_to_one_dependents_with_alternate_key_are_orpha context.ChangeTracker.CascadeChanges(); Assert.True( - orphaned.All( - e => - context.Entry(e).State - == ( - Fixture.ForceClientNoAction - ? EntityState.Unchanged - : EntityState.Modified - ) + orphaned.All(e => + context.Entry(e).State + == ( + Fixture.ForceClientNoAction + ? EntityState.Unchanged + : EntityState.Modified + ) ) ); } @@ -1085,8 +1084,7 @@ public virtual void Required_many_to_one_dependents_with_alternate_key_are_casca cascadeRemoved.All(e => context.Entry(e).State == EntityState.Unchanged) ); Assert.True( - cascadeRemovedC.All( - e => context.Entry(e).State == EntityState.Unchanged + cascadeRemovedC.All(e => context.Entry(e).State == EntityState.Unchanged ) ); } diff --git a/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs b/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs index 01c0dc6d7e7..009f62ae395 100644 --- a/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs +++ b/efcore/test/EFCore.Specification.Tests/GraphUpdates/GraphUpdatesTestBaseOneToOneAk.cs @@ -1451,8 +1451,7 @@ public virtual void Save_required_one_to_one_changed_by_reference_with_alternate Assert.False( context .Set() - .Any( - r => r.RequiredSingleAk != null && r.RequiredSingleAk.Id == old1.Id + .Any(r => r.RequiredSingleAk != null && r.RequiredSingleAk.Id == old1.Id ) ); @@ -1954,8 +1953,7 @@ public virtual void Sever_required_one_to_one_with_alternate_key( Assert.False( context .Set() - .Any( - r => r.RequiredSingleAk != null && r.RequiredSingleAk.Id == old1.Id + .Any(r => r.RequiredSingleAk != null && r.RequiredSingleAk.Id == old1.Id ) ); diff --git a/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs b/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs index 4ed023ebceb..be9598d0a11 100644 --- a/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs +++ b/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToManyAk.cs @@ -50,21 +50,19 @@ bool useExistingEntities context => { new1 = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - new1d = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new1d = context.CreateProxy(e => e.AlternateId = Guid.NewGuid() ); - new1dd = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new1dd = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); new2a = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2b = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); new2ca = context.CreateProxy(); new2cb = context.CreateProxy(); - new2d = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2d = context.CreateProxy(e => e.AlternateId = Guid.NewGuid() ); - new2dd = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2dd = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); if (useExistingEntities) diff --git a/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs b/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs index f2d95313769..4a7720a207f 100644 --- a/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs +++ b/efcore/test/EFCore.Specification.Tests/GraphUpdates/ProxyGraphUpdatesTestBaseOneToOneAk.cs @@ -55,11 +55,11 @@ bool useExistingEntities context => { new2 = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - new2d = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2d = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); - new2dd = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2dd = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); new2c = context.CreateProxy(); new1 = context.CreateProxy(e => @@ -246,11 +246,11 @@ public virtual void Save_changed_optional_one_to_one_with_alternate_key_in_store context => { new2 = context.CreateProxy(e => e.AlternateId = Guid.NewGuid()); - new2d = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2d = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); - new2dd = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2dd = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); new2c = context.CreateProxy(); new1 = context.CreateProxy(e => @@ -598,14 +598,14 @@ bool useExistingEntities ExecuteWithStrategyInTransaction( context => { - new2 = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2 = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); - new2d = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2d = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); - new2dd = context.CreateProxy( - e => e.AlternateId = Guid.NewGuid() + new2dd = context.CreateProxy(e => + e.AlternateId = Guid.NewGuid() ); new1 = context.CreateProxy(e => { diff --git a/efcore/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs b/efcore/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs index 41faa3916b7..cdb8a0fe3a6 100644 --- a/efcore/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/KeysWithConvertersTestBase.cs @@ -792,8 +792,7 @@ out ComparableIntStructKeyRequiredDependent[] dependents .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = 111 })), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableIntStructKey { Id = oneTwelve }) + .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = oneTwelve }) ), context .Set() @@ -803,8 +802,8 @@ out ComparableIntStructKeyRequiredDependent[] dependents .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = 114 })), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableIntStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableIntStructKey { Id = oneFifteeen }) ), context .Set() @@ -968,26 +967,24 @@ out GenericComparableIntStructKeyRequiredDependent[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = 111 }) + .FirstOrDefault(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 111 }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = 114 }) + .FirstOrDefault(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 114 }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen }) ), context .Set() @@ -1361,10 +1358,9 @@ void Validate( [ConditionalFact] public virtual void Can_insert_and_read_back_with_comparable_class_key_and_optional_dependents() { - InsertOptionalGraph< - ComparableIntClassKeyPrincipal, - ComparableIntClassKeyOptionalDependent - >(); + InsertOptionalGraph( + + ); using (var context = CreateContext()) { @@ -1770,11 +1766,10 @@ out StructuralComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 1 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 1 } } + ) ), context .Set() @@ -1787,14 +1782,13 @@ out StructuralComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey - { - Id = new byte[] { 4, 4, 4, 4 } - } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey + { + Id = new byte[] { 4, 4, 4, 4 } + } + ) ) }; @@ -1807,11 +1801,10 @@ out StructuralComparableBytesStructKeyOptionalDependent[] dependents { context .Set() - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 101 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 101 } } + ) ), context .Set() @@ -1821,11 +1814,10 @@ out StructuralComparableBytesStructKeyOptionalDependent[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 104 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 104 } } + ) ), context .Set() @@ -1968,8 +1960,7 @@ out ComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } }) + .Single(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } }) ), context .Set() @@ -1985,11 +1976,8 @@ out ComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } } - ) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } }) ) }; @@ -2002,8 +1990,8 @@ out ComparableBytesStructKeyOptionalDependent[] dependents { context .Set() - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } }) ), context .Set() @@ -2013,8 +2001,8 @@ out ComparableBytesStructKeyOptionalDependent[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } }) ), context .Set() @@ -2157,11 +2145,8 @@ out GenericComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 1 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } }) ), context .Set() @@ -2174,14 +2159,10 @@ out GenericComparableBytesStructKeyOptionalDependent[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey - { - Id = new byte[] { 4, 4, 4, 4 } - } - ) + .Single(e => + e.Id.Equals( + new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } } + ) ) }; @@ -2194,11 +2175,8 @@ out GenericComparableBytesStructKeyOptionalDependent[] dependents { context .Set() - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 101 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 101 } }) ), context .Set() @@ -2208,11 +2186,8 @@ out GenericComparableBytesStructKeyOptionalDependent[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 104 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 104 } }) ), context .Set() @@ -2364,8 +2339,8 @@ out BytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } }) + .Single(e => + e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } }) ) }; @@ -2378,8 +2353,7 @@ out BytesStructKeyRequiredDependent[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 111 } }) + .FirstOrDefault(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 111 } }) ), context .Set() @@ -2389,8 +2363,7 @@ out BytesStructKeyRequiredDependent[] dependents .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 114 } }) + .FirstOrDefault(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 114 } }) ), context .Set() @@ -2533,8 +2506,8 @@ out ComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } }) ), context .Set() @@ -2547,11 +2520,10 @@ out ComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } } - ) + .Single(e => + e.Id.Equals( + new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } } + ) ) }; @@ -2564,26 +2536,26 @@ out ComparableBytesStructKeyRequiredDependent[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() @@ -2726,17 +2698,15 @@ out StructuralComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 11 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 11 } } + ) ), context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve }) + .Single(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve }) ), context .Set() @@ -2745,14 +2715,13 @@ out StructuralComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey - { - Id = new byte[] { 14, 14, 14, 14 } - } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey + { + Id = new byte[] { 14, 14, 14, 14 } + } + ) ) }; @@ -2765,33 +2734,30 @@ out StructuralComparableBytesStructKeyRequiredDependent[] dependents { context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 111 } } - ) + .FirstOrDefault(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 111 } } + ) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 114 } } - ) + .FirstOrDefault(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 114 } } + ) ), context .Set() - .FirstOrDefault( - e => - e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() @@ -2934,11 +2900,8 @@ out GenericComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 11 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } }) ), context .Set() @@ -2951,14 +2914,13 @@ out GenericComparableBytesStructKeyRequiredDependent[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey - { - Id = new byte[] { 14, 14, 14, 14 } - } - ) + .Single(e => + e.Id.Equals( + new GenericComparableBytesStructKey + { + Id = new byte[] { 14, 14, 14, 14 } + } + ) ) }; @@ -2971,32 +2933,26 @@ out GenericComparableBytesStructKeyRequiredDependent[] dependents { context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 111 } } - ) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 111 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 114 } } - ) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 114 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() @@ -3280,8 +3236,8 @@ public virtual void Can_query_and_update_owned_entity_with_generic_comparable_by { var owner = context .Set() - .Single( - o => o.Id.Equals(new GenericComparableBytesStructKey(new byte[] { 1, 5, 7, 1 })) + .Single(o => + o.Id.Equals(new GenericComparableBytesStructKey(new byte[] { 1, 5, 7, 1 })) ); Assert.Equal(77, owner.Owned.Position); @@ -3316,11 +3272,8 @@ public virtual void Can_query_and_update_owned_entity_with_structural_generic_co { var owner = context .Set() - .Single( - o => - o.Id.Equals( - new StructuralComparableBytesStructKey(new byte[] { 1, 5, 7, 1 }) - ) + .Single(o => + o.Id.Equals(new StructuralComparableBytesStructKey(new byte[] { 1, 5, 7, 1 })) ); Assert.Equal(77, owner.Owned.Position); @@ -4589,8 +4542,7 @@ out ComparableIntStructKeyRequiredDependentShadow[] dependents .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = 111 })), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableIntStructKey { Id = oneTwelve }) + .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = oneTwelve }) ), context .Set() @@ -4600,8 +4552,8 @@ out ComparableIntStructKeyRequiredDependentShadow[] dependents .FirstOrDefault(e => e.Id.Equals(new ComparableIntStructKey { Id = 114 })), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableIntStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableIntStructKey { Id = oneFifteeen }) ), context .Set() @@ -4832,26 +4784,24 @@ out GenericComparableIntStructKeyRequiredDependentShadow[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = 111 }) + .FirstOrDefault(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 111 }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableIntStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = 114 }) + .FirstOrDefault(e => e.Id.Equals(new GenericComparableIntStructKey { Id = 114 }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableIntStructKey { Id = oneFifteeen }) ), context .Set() @@ -6037,11 +5987,10 @@ out StructuralComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 1 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 1 } } + ) ), context .Set() @@ -6056,14 +6005,13 @@ out StructuralComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey - { - Id = new byte[] { 4, 4, 4, 4 } - } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey + { + Id = new byte[] { 4, 4, 4, 4 } + } + ) ) }; @@ -6076,11 +6024,10 @@ out StructuralComparableBytesStructKeyOptionalDependentShadow[] dependents { context .Set() - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 101 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 101 } } + ) ), context .Set() @@ -6090,11 +6037,10 @@ out StructuralComparableBytesStructKeyOptionalDependentShadow[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 104 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 104 } } + ) ), context .Set() @@ -6317,8 +6263,7 @@ out ComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } }) + .Single(e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 1 } }) ), context .Set() @@ -6333,11 +6278,8 @@ out ComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } } - ) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } }) ) }; @@ -6350,8 +6292,8 @@ out ComparableBytesStructKeyOptionalDependentShadow[] dependents { context .Set() - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 101 } }) ), context .Set() @@ -6361,8 +6303,8 @@ out ComparableBytesStructKeyOptionalDependentShadow[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 104 } }) ), context .Set() @@ -6588,11 +6530,8 @@ out GenericComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 1 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 1 } }) ), context .Set() @@ -6607,14 +6546,10 @@ out GenericComparableBytesStructKeyOptionalDependentShadow[] dependents context .Set() .Include(e => e.OptionalDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey - { - Id = new byte[] { 4, 4, 4, 4 } - } - ) + .Single(e => + e.Id.Equals( + new GenericComparableBytesStructKey { Id = new byte[] { 4, 4, 4, 4 } } + ) ) }; @@ -6627,11 +6562,8 @@ out GenericComparableBytesStructKeyOptionalDependentShadow[] dependents { context .Set() - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 101 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 101 } }) ), context .Set() @@ -6641,11 +6573,8 @@ out GenericComparableBytesStructKeyOptionalDependentShadow[] dependents .Single(e => e.Id.Equals(oneOhThree)), context .Set() - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 104 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 104 } }) ), context .Set() @@ -6881,8 +6810,8 @@ out BytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } }) + .Single(e => + e.Id.Equals(new BytesStructKey { Id = new byte[] { 14, 14, 14, 14 } }) ) }; @@ -6895,8 +6824,7 @@ out BytesStructKeyRequiredDependentShadow[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 111 } }) + .FirstOrDefault(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 111 } }) ), context .Set() @@ -6906,8 +6834,7 @@ out BytesStructKeyRequiredDependentShadow[] dependents .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 114 } }) + .FirstOrDefault(e => e.Id.Equals(new BytesStructKey { Id = new byte[] { 114 } }) ), context .Set() @@ -7128,8 +7055,8 @@ out ComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } }) + .Single(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 11 } }) ), context .Set() @@ -7142,11 +7069,10 @@ out ComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } } - ) + .Single(e => + e.Id.Equals( + new ComparableBytesStructKey { Id = new byte[] { 14, 14, 14, 14 } } + ) ) }; @@ -7159,26 +7085,26 @@ out ComparableBytesStructKeyRequiredDependentShadow[] dependents { context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 111 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = new byte[] { 114 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new ComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new ComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() @@ -7411,17 +7337,15 @@ out StructuralComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 11 } } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 11 } } + ) ), context .Set() .Include(e => e.RequiredDependents) - .Single( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve }) + .Single(e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = twelve }) ), context .Set() @@ -7430,14 +7354,13 @@ out StructuralComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey - { - Id = new byte[] { 14, 14, 14, 14 } - } - ) + .Single(e => + e.Id.Equals( + new StructuralComparableBytesStructKey + { + Id = new byte[] { 14, 14, 14, 14 } + } + ) ) }; @@ -7450,33 +7373,30 @@ out StructuralComparableBytesStructKeyRequiredDependentShadow[] dependents { context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 111 } } - ) + .FirstOrDefault(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 111 } } + ) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new StructuralComparableBytesStructKey { Id = new byte[] { 114 } } - ) + .FirstOrDefault(e => + e.Id.Equals( + new StructuralComparableBytesStructKey { Id = new byte[] { 114 } } + ) ), context .Set() - .FirstOrDefault( - e => - e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new StructuralComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() @@ -7707,11 +7627,8 @@ out GenericComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 11 } } - ) + .Single(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 11 } }) ), context .Set() @@ -7724,14 +7641,13 @@ out GenericComparableBytesStructKeyRequiredDependentShadow[] dependents context .Set() .Include(e => e.RequiredDependents) - .Single( - e => - e.Id.Equals( - new GenericComparableBytesStructKey - { - Id = new byte[] { 14, 14, 14, 14 } - } - ) + .Single(e => + e.Id.Equals( + new GenericComparableBytesStructKey + { + Id = new byte[] { 14, 14, 14, 14 } + } + ) ) }; @@ -7744,32 +7660,26 @@ out GenericComparableBytesStructKeyRequiredDependentShadow[] dependents { context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 111 } } - ) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 111 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = oneTwelve }) ), context .Set() .FirstOrDefault(e => e.Id.Equals(oneThirteen)), context .Set() - .FirstOrDefault( - e => - e.Id.Equals( - new GenericComparableBytesStructKey { Id = new byte[] { 114 } } - ) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = new byte[] { 114 } }) ), context .Set() - .FirstOrDefault( - e => e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen }) + .FirstOrDefault(e => + e.Id.Equals(new GenericComparableBytesStructKey { Id = oneFifteeen }) ), context .Set() diff --git a/efcore/test/EFCore.Specification.Tests/LoggingTestBase.cs b/efcore/test/EFCore.Specification.Tests/LoggingTestBase.cs index e2aee77a37d..e0b75ffd18e 100644 --- a/efcore/test/EFCore.Specification.Tests/LoggingTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/LoggingTestBase.cs @@ -16,10 +16,8 @@ public void Logs_context_initialization_default_options() => public void Logs_context_initialization_no_tracking() => Assert.Equal( ExpectedMessage("NoTracking " + DefaultOptions), - ActualMessage( - s => - CreateOptionsBuilder(s) - .UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) + ActualMessage(s => + CreateOptionsBuilder(s).UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) ) ); diff --git a/efcore/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs b/efcore/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs index 6f5ded52425..d9eaf1c9720 100644 --- a/efcore/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/ManyToManyLoadTestBase.cs @@ -1507,16 +1507,13 @@ bool async .Query() .Include(e => e.ThreeSkipFull.Where(e => e.Id == 13 || e.Id == 11)) .OrderBy(e => e.Id) - .Select( - e => - new - { - e.Id, - e.Name, - Count1 = e.OneSkipShared.Count, - Count3 = e.ThreeSkipFull.Count - } - ); + .Select(e => new + { + e.Id, + e.Name, + Count1 = e.OneSkipShared.Count, + Count3 = e.ThreeSkipFull.Count + }); var projected = async ? await queryable.ToListAsync() : queryable.ToList(); @@ -1611,8 +1608,7 @@ public virtual async Task Query_with_filtered_Include_marks_only_left_as_loaded( { using var context = Fixture.CreateContext(); - var queryable = context.EntityOnes.Include( - e => e.TwoSkip.Where(e => e.Id == 1 || e.Id == 2) + var queryable = context.EntityOnes.Include(e => e.TwoSkip.Where(e => e.Id == 1 || e.Id == 2) ); var left = async ? await queryable.SingleAsync(e => e.Id == 1) diff --git a/efcore/test/EFCore.Specification.Tests/MusicStoreTestBase.cs b/efcore/test/EFCore.Specification.Tests/MusicStoreTestBase.cs index 42d20362551..4228420d589 100644 --- a/efcore/test/EFCore.Specification.Tests/MusicStoreTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/MusicStoreTestBase.cs @@ -101,17 +101,14 @@ DbContext context var genres = Enumerable .Range(1, numberOfGenres) - .Select( - g => - new Genre - { - Name = "Genre " + g, - Albums = Enumerable - .Range(1, numberOfAlbums) - .Select(n => new Album { Artist = artist, Title = "Greatest Hits" }) - .ToList() - } - ) + .Select(g => new Genre + { + Name = "Genre " + g, + Albums = Enumerable + .Range(1, numberOfAlbums) + .Select(n => new Album { Artist = artist, Title = "Greatest Hits" }) + .ToList() + }) .ToList(); context.AddRange(genres); @@ -164,15 +161,12 @@ public static Album[] GetAlbums() var albums = Enumerable .Range(1, 10) - .Select( - n => - new Album - { - Artist = artists[n - 1], - Genre = genres[n - 1], - Title = "Greatest Hits" - } - ) + .Select(n => new Album + { + Artist = artists[n - 1], + Genre = genres[n - 1], + Title = "Greatest Hits" + }) .ToArray(); return albums; @@ -337,15 +331,12 @@ await context var cartItems = Enumerable .Range(1, itemCount) - .Select( - n => - new CartItem - { - Album = album, - Count = 1, - CartId = cartId - } - ) + .Select(n => new CartItem + { + Album = album, + Count = 1, + CartId = cartId + }) .ToArray(); context.AddRange(cartItems); @@ -529,20 +520,17 @@ public virtual async Task Custom_projection_FirstOrDefault_works(bool async) using var context = CreateContext(); var shoppingCartId = "CartId_A"; var id = 1; - var query = context.CartItems.Select( - ci => - new CartItem - { - CartId = ci.CartId, - CartItemId = ci.CartItemId, - Count = ci.Count, - Album = new Album { Title = ci.Album.Title } - } - ); + var query = context.CartItems.Select(ci => new CartItem + { + CartId = ci.CartId, + CartItemId = ci.CartItemId, + Count = ci.Count, + Album = new Album { Title = ci.Album.Title } + }); var cartItem = async - ? await query.FirstOrDefaultAsync( - ci => ci.CartId == shoppingCartId && ci.CartItemId == id + ? await query.FirstOrDefaultAsync(ci => + ci.CartId == shoppingCartId && ci.CartItemId == id ) : query.FirstOrDefault(ci => ci.CartId == shoppingCartId && ci.CartItemId == id); @@ -563,15 +551,12 @@ int numberOfItems var cartItems = Enumerable .Range(1, numberOfItems) - .Select( - n => - new CartItem - { - Count = 1, - CartId = cartId, - Album = albums[n % albums.Length] - } - ) + .Select(n => new CartItem + { + Count = 1, + CartId = cartId, + Album = albums[n % albums.Length] + }) .ToArray(); return cartItems; @@ -580,16 +565,13 @@ int numberOfItems private static Album[] CreateTestAlbums(decimal itemPrice, Artist artist, Genre genre) => Enumerable .Range(1, 10) - .Select( - n => - new Album - { - Title = "Greatest Hits", - Price = itemPrice, - Artist = artist, - Genre = genre - } - ) + .Select(n => new Album + { + Title = "Greatest Hits", + Price = itemPrice, + Artist = artist, + Genre = genre + }) .ToArray(); protected class CartSummaryComponent @@ -748,8 +730,8 @@ public async Task Complete(MusicStoreContext context, int id) { var userName = "RainbowDash"; - var isValid = await context.Orders.AnyAsync( - o => o.OrderId == id && o.Username == userName + var isValid = await context.Orders.AnyAsync(o => + o.OrderId == id && o.Username == userName ); if (isValid) diff --git a/efcore/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs index 457ae56ab4a..56409232c35 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/ComplexNavigationsQueryTestBase.cs @@ -64,10 +64,8 @@ public virtual Task Key_equality_using_property_method_nested(bool async) => async, ss => ss.Set() - .Where( - l => - EF.Property(EF.Property(l, "OneToOne_Required_FK1"), "Id") - == 7 + .Where(l => + EF.Property(EF.Property(l, "OneToOne_Required_FK1"), "Id") == 7 ) ); @@ -78,12 +76,11 @@ public virtual Task Key_equality_using_property_method_nested2(bool async) => async, ss => ss.Set() - .Where( - l => - EF.Property( - EF.Property(l, "OneToOne_Required_FK_Inverse2"), - "Id" - ) == 7 + .Where(l => + EF.Property( + EF.Property(l, "OneToOne_Required_FK_Inverse2"), + "Id" + ) == 7 ) ); @@ -132,10 +129,9 @@ public virtual Task Key_equality_two_conditions_on_same_navigation(bool async) = async, ss => ss.Set() - .Where( - l => - l.OneToOne_Required_FK1 == new Level2 { Id = 1 } - || l.OneToOne_Required_FK1 == new Level2 { Id = 2 } + .Where(l => + l.OneToOne_Required_FK1 == new Level2 { Id = 1 } + || l.OneToOne_Required_FK1 == new Level2 { Id = 2 } ), ss => ss.Set() @@ -149,17 +145,15 @@ public virtual Task Key_equality_two_conditions_on_same_navigation2(bool async) async, ss => ss.Set() - .Where( - l => - l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 1 } - || l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 2 } + .Where(l => + l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 1 } + || l.OneToOne_Required_FK_Inverse2 == new Level1 { Id = 2 } ), ss => ss.Set() - .Where( - l => - l.OneToOne_Required_FK_Inverse2.Id == 1 - || l.OneToOne_Required_FK_Inverse2.Id == 2 + .Where(l => + l.OneToOne_Required_FK_Inverse2.Id == 1 + || l.OneToOne_Required_FK_Inverse2.Id == 2 ) ); @@ -299,8 +293,8 @@ public virtual Task Simple_level1_level2_level3_include(bool async) => async, ss => ss.Set() - .Include( - l1 => l1.OneToOne_Required_PK1.OneToOne_Required_PK2.OneToOne_Required_PK3 + .Include(l1 => + l1.OneToOne_Required_PK1.OneToOne_Required_PK2.OneToOne_Required_PK3 ) ); @@ -402,8 +396,8 @@ where e1.OneToOne_Optional_FK1.Name.StartsWith(e1.OneToOne_Optional_FK1.Name) ss => from e1 in ss.Set() where - e1.OneToOne_Optional_FK1.Name.MaybeScalar( - x => x.StartsWith(e1.OneToOne_Optional_FK1.Name) + e1.OneToOne_Optional_FK1.Name.MaybeScalar(x => + x.StartsWith(e1.OneToOne_Optional_FK1.Name) ) == true select e1 ); @@ -443,8 +437,8 @@ from e1 in ss.Set() ss => from e1 in ss.Set() where - e1.OneToOne_Optional_FK1.MaybeScalar( - x => x.Date.AddDays(10).AddDays(15).AddMonths(2) + e1.OneToOne_Optional_FK1.MaybeScalar(x => + x.Date.AddDays(10).AddDays(15).AddMonths(2) ) > new DateTime(2000, 2, 1) select e1 ); @@ -738,10 +732,9 @@ public virtual Task Where_nav_prop_reference_optional1(bool async) => async, ss => ss.Set() - .Where( - e => - e.OneToOne_Optional_FK1.Name == "L2 05" - || e.OneToOne_Optional_FK1.Name == "L2 07" + .Where(e => + e.OneToOne_Optional_FK1.Name == "L2 05" + || e.OneToOne_Optional_FK1.Name == "L2 07" ) .Select(e => e.Id) ); @@ -774,10 +767,9 @@ public virtual Task Where_nav_prop_reference_optional2(bool async) => async, ss => ss.Set() - .Where( - e => - e.OneToOne_Optional_FK1.Name == "L2 05" - || e.OneToOne_Optional_FK1.Name != "L2 42" + .Where(e => + e.OneToOne_Optional_FK1.Name == "L2 05" + || e.OneToOne_Optional_FK1.Name != "L2 42" ) .Select(e => e.Id) ); @@ -889,10 +881,8 @@ public virtual Task Where_multiple_nav_prop_reference_optional_compared_to_null5 async, ss => ss.Set() - .Where( - e => - e.OneToOne_Optional_FK1.OneToOne_Required_FK2.OneToOne_Required_FK3 - == null + .Where(e => + e.OneToOne_Optional_FK1.OneToOne_Required_FK2.OneToOne_Required_FK3 == null ) ); @@ -1054,20 +1044,16 @@ bool async async, ss => ss.Set() - .Where( - e => - e.OneToOne_Required_FK1.OneToOne_Required_FK2 - == e.OneToOne_Required_FK1.OneToOne_Optional_FK2 - && e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id != 7 + .Where(e => + e.OneToOne_Required_FK1.OneToOne_Required_FK2 + == e.OneToOne_Required_FK1.OneToOne_Optional_FK2 + && e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id != 7 ) - .Select( - e => - new - { - e.Name, - Id = (int?)e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id - } - ), + .Select(e => new + { + e.Name, + Id = (int?)e.OneToOne_Required_FK1.OneToOne_Optional_FK2.Id + }), elementSorter: e => (e.Name, e.Id) ); @@ -1099,22 +1085,19 @@ public virtual Task Optional_navigation_projected_into_DTO(bool async) => async, ss => ss.Set() - .Select( - e => - new MyOuterDto - { - Id = e.Id, - Name = e.Name, - Inner = - e.OneToOne_Optional_FK1 != null - ? new MyInnerDto - { - Id = e.OneToOne_Optional_FK1.Id, - Name = e.OneToOne_Optional_FK1.Name - } - : null - } - ), + .Select(e => new MyOuterDto + { + Id = e.Id, + Name = e.Name, + Inner = + e.OneToOne_Optional_FK1 != null + ? new MyInnerDto + { + Id = e.OneToOne_Optional_FK1.Id, + Name = e.OneToOne_Optional_FK1.Name + } + : null + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -1338,8 +1321,8 @@ public virtual Task SelectMany_nested_navigation_property_required(bool async) = ss => ss.Set().SelectMany(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2), ss => ss.Set() - .SelectMany( - l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2 ?? new List() + .SelectMany(l1 => + l1.OneToOne_Required_FK1.OneToMany_Optional2 ?? new List() ) ); @@ -1354,8 +1337,8 @@ public virtual Task SelectMany_nested_navigation_property_optional_and_projectio .Select(e => e.Name), ss => ss.Set() - .SelectMany( - l1 => l1.OneToOne_Optional_FK1.OneToMany_Optional2 ?? new List() + .SelectMany(l1 => + l1.OneToOne_Optional_FK1.OneToMany_Optional2 ?? new List() ) .Select(e => e.Name) ); @@ -1393,10 +1376,8 @@ public virtual Task Where_navigation_property_to_collection(bool async) => .Where(l1 => l1.OneToOne_Required_FK1.OneToMany_Optional2.Count > 0), ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Required_FK1.OneToMany_Optional2.MaybeScalar(x => x.Count) - > 0 + .Where(l1 => + l1.OneToOne_Required_FK1.OneToMany_Optional2.MaybeScalar(x => x.Count) > 0 ) ); @@ -1410,11 +1391,10 @@ public virtual Task Where_navigation_property_to_collection2(bool async) => .Where(l3 => l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.Count > 0), ss => ss.Set() - .Where( - l3 => - l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.MaybeScalar( - x => x.Count - ) > 0 + .Where(l3 => + l3.OneToOne_Required_FK_Inverse3.OneToMany_Optional2.MaybeScalar(x => + x.Count + ) > 0 ) ); @@ -1430,11 +1410,10 @@ bool async .Where(l2 => l2.OneToMany_Required_Inverse2.OneToMany_Optional1.Count() > 0), ss => ss.Set() - .Where( - l2 => - l2.OneToMany_Required_Inverse2.OneToMany_Optional1.MaybeScalar( - x => x.Count() - ) > 0 + .Where(l2 => + l2.OneToMany_Required_Inverse2.OneToMany_Optional1.MaybeScalar(x => + x.Count() + ) > 0 ) ); @@ -1757,8 +1736,8 @@ public virtual Task Multiple_required_navigations_with_Include(bool async) async, ss => ss.Set() - .Select( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 + .Select(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 ) .Include(l2 => l2.OneToOne_Optional_FK2), elementAsserter: (e, a) => @@ -1806,8 +1785,8 @@ public virtual Task Multiple_required_navigation_with_string_based_Include(bool async, ss => ss.Set() - .Select( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 + .Select(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 ) .Include("OneToOne_Optional_FK2"), elementAsserter: (e, a) => @@ -1830,8 +1809,8 @@ public virtual Task Multiple_required_navigation_with_EF_Property_Include(bool a async, ss => ss.Set() - .Select( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 + .Select(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 ) .Include(l2 => EF.Property(l2, "OneToOne_Optional_FK2")), elementAsserter: (e, a) => @@ -2009,22 +1988,20 @@ bool async ss => from l1 in ss.Set() join l2 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4 - .OneToOne_Optional_FK_Inverse3 - .OneToMany_Required_Self2 + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4 + .OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 ) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, ss => from l1 in ss.Set() join l2 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4 - .OneToOne_Optional_FK_Inverse3 - .OneToMany_Required_Self2 ?? new List() + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4 + .OneToOne_Optional_FK_Inverse3 + .OneToMany_Required_Self2 ?? new List() ) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, @@ -2046,9 +2023,10 @@ bool async ss => from l1 in ss.Set() join l2 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty() + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty( + + ) ) on l1.Id equals l2.Level1_Optional_Id select new { l1, l2 }, @@ -2069,9 +2047,10 @@ bool async async, ss => from l2 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty() + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty( + + ) ) join l1 in ss.Set() on l2.Level1_Optional_Id equals l1.Id select new { l2, l1 }, @@ -2092,9 +2071,10 @@ bool async async, ss => from l4 in ss.Set() - .SelectMany( - l1 => - l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty() + .SelectMany(l1 => + l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty( + + ) ) join l2 in ss.Set() on l4.Id equals l2.Id select new { l4, l2 }, @@ -2115,9 +2095,10 @@ bool async async, ss => from l4 in ss.Set() - .SelectMany( - l1 => - l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty() + .SelectMany(l1 => + l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty( + + ) ) join l2 in ss.Set() on l4.Id equals l2.Id into grouping from l2 in grouping.DefaultIfEmpty() @@ -2139,14 +2120,16 @@ bool async async, ss => from l4 in ss.Set() - .SelectMany( - l1 => - l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty() + .SelectMany(l1 => + l1.OneToOne_Required_FK1.OneToOne_Optional_FK2.OneToMany_Required3.DefaultIfEmpty( + + ) ) join l2 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty() + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Optional_FK_Inverse3.OneToMany_Required_Self2.DefaultIfEmpty( + + ) ) on l4.Id equals l2.Id select new { l4, l2 }, @@ -2167,9 +2150,10 @@ bool async async, ss => from l3 in ss.Set() - .SelectMany( - l4 => - l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty() + .SelectMany(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3.OneToMany_Required2.DefaultIfEmpty( + + ) ) select l3.OneToOne_Required_FK_Inverse3.OneToOne_Required_PK_Inverse2 ); @@ -2265,19 +2249,17 @@ public virtual Task Contains_with_subquery_optional_navigation_and_constant_item async, ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Optional_FK1.OneToMany_Optional2.Distinct() - .Select(l3 => l3.Id) - .Contains(6) + .Where(l1 => + l1.OneToOne_Optional_FK1.OneToMany_Optional2.Distinct() + .Select(l3 => l3.Id) + .Contains(6) ), ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar( - x => x.Distinct().Select(l3 => l3.Id).Contains(6) - ) == true + .Where(l1 => + l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => + x.Distinct().Select(l3 => l3.Id).Contains(6) + ) == true ) ); @@ -2290,21 +2272,17 @@ bool async async, ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select( - l3 => l3.Name.Length - ) - .Distinct() - .Contains(5) + .Where(l1 => + l1.OneToOne_Optional_FK1.OneToMany_Optional2.Select(l3 => l3.Name.Length) + .Distinct() + .Contains(5) ), ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar( - x => x.Select(l3 => l3.Name.Length).Distinct().Contains(5) - ) == true + .Where(l1 => + l1.OneToOne_Optional_FK1.OneToMany_Optional2.MaybeScalar(x => + x.Select(l3 => l3.Name.Length).Distinct().Contains(5) + ) == true ) ); @@ -2317,26 +2295,21 @@ bool async async, ss => ss.Set() - .Where( - l1 => - l1.Id < 3 - && !l1.OneToMany_Optional1.Select( - l2 => l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.Id - ) - .All(l4 => ClientMethod(l4)) + .Where(l1 => + l1.Id < 3 + && !l1.OneToMany_Optional1.Select(l2 => + l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.Id + ) + .All(l4 => ClientMethod(l4)) ), ss => ss.Set() - .Where( - l1 => - l1.Id < 3 - && !l1.OneToMany_Optional1.Select( - l2 => - l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.MaybeScalar( - x => x.Id - ) - ) - .All(a => true) + .Where(l1 => + l1.Id < 3 + && !l1.OneToMany_Optional1.Select(l2 => + l2.OneToOne_Optional_FK2.OneToOne_Optional_FK3.MaybeScalar(x => x.Id) + ) + .All(a => true) ), assertEmpty: true ); @@ -2349,12 +2322,11 @@ public virtual Task Required_navigation_on_a_subquery_with_First_in_projection(b ss => ss.Set() .Where(l2o => l2o.Id == 7) - .Select( - l2o => - ss.Set() - .OrderBy(l2i => l2i.Id) - .First() - .OneToOne_Required_FK_Inverse2.Name + .Select(l2o => + ss.Set() + .OrderBy(l2i => l2i.Id) + .First() + .OneToOne_Required_FK_Inverse2.Name ) ); @@ -2387,22 +2359,21 @@ public virtual Task Required_navigation_on_a_subquery_with_First_in_predicate(bo ss => ss.Set() .Where(l2o => l2o.Id == 7) - .Where( - l1 => - EF.Property( - ss.Set() - .OrderBy(l2i => l2i.Id) - .First() - .OneToOne_Required_FK_Inverse2, - "Name" - ) == "L1 10" - || EF.Property( - ss.Set() - .OrderBy(l2i => l2i.Id) - .First() - .OneToOne_Required_FK_Inverse2, - "Name" - ) == "L1 01" + .Where(l1 => + EF.Property( + ss.Set() + .OrderBy(l2i => l2i.Id) + .First() + .OneToOne_Required_FK_Inverse2, + "Name" + ) == "L1 10" + || EF.Property( + ss.Set() + .OrderBy(l2i => l2i.Id) + .First() + .OneToOne_Required_FK_Inverse2, + "Name" + ) == "L1 01" ) ); @@ -3043,12 +3014,10 @@ bool async async, ss => ss.Set() - .Where( - l3 => - l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name - == "L1 10" - || l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name - == "L1 01" + .Where(l3 => + l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name == "L1 10" + || l3.OneToMany_Required_Inverse3.OneToOne_Required_FK_Inverse2.Name + == "L1 01" ) .OrderBy(l3 => l3.Level2_Required_Id) .Skip(0) @@ -3195,20 +3164,17 @@ public virtual Task Navigations_compared_to_each_other4(bool async) => ss => from l2 in ss.Set() where - l2.OneToOne_Required_FK2.OneToMany_Optional3.Select( - i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2 + l2.OneToOne_Required_FK2.OneToMany_Optional3.Select(i => + i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2 ) .Any() select l2.Name, ss => from l2 in ss.Set() where - l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar( - x => - x.Select( - i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2 - ) - .Any() + l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar(x => + x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Required_FK2) + .Any() ) == true select l2.Name ); @@ -3221,20 +3187,17 @@ public virtual Task Navigations_compared_to_each_other5(bool async) => ss => from l2 in ss.Set() where - l2.OneToOne_Required_FK2.OneToMany_Optional3.Select( - i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2 + l2.OneToOne_Required_FK2.OneToMany_Optional3.Select(i => + i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2 ) .Any() select l2.Name, ss => from l2 in ss.Set() where - l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar( - x => - x.Select( - i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2 - ) - .Any() + l2.OneToOne_Required_FK2.OneToMany_Optional3.MaybeScalar(x => + x.Select(i => i.OneToOne_Optional_PK_Inverse4 == l2.OneToOne_Optional_PK2) + .Any() ) == true select l2.Name ); @@ -3256,8 +3219,8 @@ public virtual Task Level4_Include(bool async) .Where(t => t != null) .Select(l3 => l3.OneToOne_Required_PK3) .Where(t => t != null) - .Select( - l4 => l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 + .Select(l4 => + l4.OneToOne_Required_FK_Inverse4.OneToOne_Required_FK_Inverse3 ) .Include(l2 => l2.OneToOne_Optional_FK2), elementAsserter: (e, a) => @@ -3288,12 +3251,11 @@ public virtual Task Select_subquery_with_client_eval_and_navigation1(bool async) async, ss => ss.Set() - .Select( - l2 => - ss.Set() - .OrderBy(l => l.Id) - .First() - .OneToOne_Required_FK_Inverse2.Name + .Select(l2 => + ss.Set() + .OrderBy(l => l.Id) + .First() + .OneToOne_Required_FK_Inverse2.Name ) ); @@ -3304,12 +3266,11 @@ public virtual Task Select_subquery_with_client_eval_and_navigation2(bool async) async, ss => ss.Set() - .Select( - l2 => - ss.Set() - .OrderBy(l => l.Id) - .First() - .OneToOne_Required_FK_Inverse2.Name == "L1 02" + .Select(l2 => + ss.Set() + .OrderBy(l => l.Id) + .First() + .OneToOne_Required_FK_Inverse2.Name == "L1 02" ) ); @@ -3320,12 +3281,11 @@ public virtual Task Select_subquery_with_client_eval_and_multi_level_navigation( async, ss => ss.Set() - .Select( - l3 => - ss.Set() - .OrderBy(l => l.Id) - .First() - .OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2.Name + .Select(l3 => + ss.Set() + .OrderBy(l => l.Id) + .First() + .OneToOne_Required_FK_Inverse3.OneToOne_Required_FK_Inverse2.Name ) ); @@ -3787,8 +3747,8 @@ public virtual Task Include10(bool async) => ss => ss.Set() .Include(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_PK2) - .Include( - l1 => l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 + .Include(l1 => + l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 ), elementAsserter: (e, a) => AssertInclude( @@ -3820,11 +3780,11 @@ public virtual Task Include11(bool async) => ss.Set() .Include(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2) .Include(l1 => l1.OneToOne_Optional_FK1.OneToOne_Optional_PK2) - .Include( - l1 => l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_FK3 + .Include(l1 => + l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_FK3 ) - .Include( - l1 => l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 + .Include(l1 => + l1.OneToOne_Optional_PK1.OneToOne_Optional_FK2.OneToOne_Optional_PK3 ) .Include(l1 => l1.OneToOne_Optional_PK1.OneToOne_Optional_PK2), elementAsserter: (e, a) => @@ -3911,15 +3871,12 @@ public virtual Task Include14(bool async) => ss.Set() .Include(l1 => l1.OneToOne_Optional_FK1) .ThenInclude(l2 => l2.OneToOne_Optional_FK2) - .Select( - l1 => - new - { - one = l1, - two = l1.OneToOne_Optional_FK1, - three = l1.OneToOne_Optional_PK1 - } - ), + .Select(l1 => new + { + one = l1, + two = l1.OneToOne_Optional_FK1, + three = l1.OneToOne_Optional_PK1 + }), elementAsserter: (e, a) => { AssertInclude( @@ -3946,9 +3903,11 @@ public virtual Task Include14(bool async) => public virtual Task Include17(bool async) { using var ctx = CreateContext(); - var query = ctx.LevelOne.Select( - l1 => new { foo = l1.OneToOne_Optional_FK1, bar = l1.OneToOne_Optional_PK1 } - ) + var query = ctx.LevelOne.Select(l1 => new + { + foo = l1.OneToOne_Optional_FK1, + bar = l1.OneToOne_Optional_PK1 + }) .Include(x => x.foo.OneToOne_Optional_FK2) .Distinct(); @@ -4040,10 +3999,11 @@ public virtual async Task Include18_3_2(bool async) var query = ctx.LevelOne.OrderBy(x => x.OneToOne_Required_FK1.Name) .Include(x => x.OneToOne_Optional_FK1) - .Select( - l1 => - new { outer_foo = new { inner_foo = l1, inner_bar = l1.Name }, outer_bar = l1 } - ) + .Select(l1 => new + { + outer_foo = new { inner_foo = l1, inner_bar = l1.Name }, + outer_bar = l1 + }) .Take(10); _ = async ? await query.ToListAsync() : query.ToList(); @@ -4221,14 +4181,13 @@ orderby l1.Id from l2 in ctx.LevelTwo orderby l2.Id where l2.Level1_Required_Id == l1.Id - select l2.OneToMany_Optional2.Select( - l3 => - ( - from l4 in ctx.LevelFour - where l4.Level3_Required_Id == l3.Id - orderby l4.Id - select l4 - ).FirstOrDefault() + select l2.OneToMany_Optional2.Select(l3 => + ( + from l4 in ctx.LevelFour + where l4.Level3_Required_Id == l3.Id + orderby l4.Id + select l4 + ).FirstOrDefault() ) .FirstOrDefault() ) @@ -4245,26 +4204,23 @@ public virtual Task Member_pushdown_with_multiple_collections(bool async) => async, ss => ss.Set() - .Select( - l1 => - l1.OneToMany_Optional1.OrderBy(l2 => l2.Id) - .FirstOrDefault() - .OneToMany_Optional2.OrderBy(l3 => l3.Id) - .FirstOrDefault() - .Name + .Select(l1 => + l1.OneToMany_Optional1.OrderBy(l2 => l2.Id) + .FirstOrDefault() + .OneToMany_Optional2.OrderBy(l3 => l3.Id) + .FirstOrDefault() + .Name ), ss => ss.Set() - .Select( - l1 => - l1.OneToMany_Optional1.OrderBy(l2 => l2.Id) - .FirstOrDefault() - .Maybe( - x => - x.OneToMany_Optional2.OrderBy(l3 => l3.Id) - .FirstOrDefault() - .Maybe(xx => xx.Name) - ) + .Select(l1 => + l1.OneToMany_Optional1.OrderBy(l2 => l2.Id) + .FirstOrDefault() + .Maybe(x => + x.OneToMany_Optional2.OrderBy(l3 => l3.Id) + .FirstOrDefault() + .Maybe(xx => xx.Name) + ) ) ); @@ -4294,26 +4250,25 @@ public virtual Task Null_check_removal_applied_recursively(bool async) => async, ss => ss.Set() - .Where( - l1 => + .Where(l1 => + ( ( ( - ( - l1.OneToOne_Optional_FK1 == null - ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 - ) == null + l1.OneToOne_Optional_FK1 == null ? null - : l1.OneToOne_Optional_FK1 - .OneToOne_Optional_FK2 - .OneToOne_Optional_PK3 + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 ) == null ? null : l1.OneToOne_Optional_FK1 .OneToOne_Optional_FK2 .OneToOne_Optional_PK3 - .Name - ) == "L4 01" + ) == null + ? null + : l1.OneToOne_Optional_FK1 + .OneToOne_Optional_FK2 + .OneToOne_Optional_PK3 + .Name + ) == "L4 01" ) ); @@ -4324,22 +4279,21 @@ public virtual Task Null_check_different_structure_does_not_remove_null_checks(b async, ss => ss.Set() - .Where( - l1 => - ( - l1.OneToOne_Optional_FK1 == null + .Where(l1 => + ( + l1.OneToOne_Optional_FK1 == null + ? null + : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null ? null - : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null + : l1.OneToOne_Optional_FK1 + .OneToOne_Optional_FK2 + .OneToOne_Optional_PK3 == null ? null : l1.OneToOne_Optional_FK1 .OneToOne_Optional_FK2 - .OneToOne_Optional_PK3 == null - ? null - : l1.OneToOne_Optional_FK1 - .OneToOne_Optional_FK2 - .OneToOne_Optional_PK3 - .Name - ) == "L4 01" + .OneToOne_Optional_PK3 + .Name + ) == "L4 01" ) ); @@ -4403,15 +4357,11 @@ bool async ss.Set() .Include(e => e.OneToOne_Required_FK1) .Include(e => e.OneToMany_Required1) - .Select( - e => - new - { - e, - First = e.OneToMany_Required1.OrderByDescending(e => e.Id) - .FirstOrDefault() - } - ) + .Select(e => new + { + e, + First = e.OneToMany_Required1.OrderByDescending(e => e.Id).FirstOrDefault() + }) ); [ConditionalTheory] @@ -4425,10 +4375,9 @@ public virtual Task OrderBy_collection_count_ThenBy_reference_navigation(bool as .ThenBy(l1 => l1.OneToOne_Required_FK1.OneToOne_Required_FK2.Name), ss => ss.Set() - .OrderBy( - l1 => - l1.OneToOne_Required_FK1.OneToMany_Required2.MaybeScalar(x => x.Count()) - ?? 0 + .OrderBy(l1 => + l1.OneToOne_Required_FK1.OneToMany_Required2.MaybeScalar(x => x.Count()) + ?? 0 ) .ThenBy(l1 => l1.OneToOne_Required_FK1.OneToOne_Required_FK2.Name), assertOrder: true @@ -4443,10 +4392,8 @@ bool async async, ss => ss.Set() - .Where( - l1 => - l1.OneToOne_Optional_FK1 != null - && l1.OneToOne_Optional_FK1.Name == "L2 01" + .Where(l1 => + l1.OneToOne_Optional_FK1 != null && l1.OneToOne_Optional_FK1.Name == "L2 01" ) ); @@ -4500,22 +4447,17 @@ bool async async, ss => ss.Set() - .SelectMany( - l1 => - l1.OneToMany_Optional1.DefaultIfEmpty() - .SelectMany( - l2 => - l2.OneToOne_Required_PK2.OneToMany_Optional3.DefaultIfEmpty() - .Select( - l4 => - new - { - l1Name = l1.Name, - l2Name = l2.OneToOne_Required_PK2.Name, - l3Name = l4.OneToOne_Optional_PK_Inverse4.Name - } - ) - ) + .SelectMany(l1 => + l1.OneToMany_Optional1.DefaultIfEmpty() + .SelectMany(l2 => + l2.OneToOne_Required_PK2.OneToMany_Optional3.DefaultIfEmpty() + .Select(l4 => new + { + l1Name = l1.Name, + l2Name = l2.OneToOne_Required_PK2.Name, + l3Name = l4.OneToOne_Optional_PK_Inverse4.Name + }) + ) ) ); @@ -4553,17 +4495,14 @@ public virtual Task Contains_over_optional_navigation_with_null_column(bool asyn async, ss => ss.Set() - .Select( - l1 => - new - { - l1.Name, - OptionalName = l1.OneToOne_Optional_FK1.Name, - Contains = ss.Set() - .Select(x => x.OneToOne_Optional_FK1.Name) - .Contains(l1.OneToOne_Optional_FK1.Name) - } - ), + .Select(l1 => new + { + l1.Name, + OptionalName = l1.OneToOne_Optional_FK1.Name, + Contains = ss.Set() + .Select(x => x.OneToOne_Optional_FK1.Name) + .Contains(l1.OneToOne_Optional_FK1.Name) + }), elementSorter: e => (e.Name, e.OptionalName, e.Contains) ); @@ -4574,17 +4513,14 @@ public virtual Task Contains_over_optional_navigation_with_null_entity_reference async, ss => ss.Set() - .Select( - l1 => - new - { - l1.Name, - OptionalName = l1.OneToOne_Optional_FK1.Name, - Contains = ss.Set() - .Select(x => x.OneToOne_Optional_FK1) - .Contains(l1.OneToOne_Optional_PK1) - } - ), + .Select(l1 => new + { + l1.Name, + OptionalName = l1.OneToOne_Optional_FK1.Name, + Contains = ss.Set() + .Select(x => x.OneToOne_Optional_FK1) + .Contains(l1.OneToOne_Optional_PK1) + }), elementSorter: e => (e.Name, e.OptionalName, e.Contains) ); @@ -4611,41 +4547,35 @@ public virtual Task Nested_object_constructed_from_group_key_properties(bool asy ss => ss.Set() .Where(l1 => l1.OneToOne_Optional_FK1 != null) - .GroupBy( - l1 => - new - { - l1.Id, - l1.Date, - l1.Name, - InnerId = l1.OneToOne_Optional_FK1.Id, - InnerDate = l1.OneToOne_Optional_FK1.Date, - InnerOptionalId = l1.OneToOne_Optional_FK1.Level1_Optional_Id, - InnerRequiredId = l1.OneToOne_Optional_FK1.Level1_Required_Id, - InnerName = l1.OneToOne_Required_FK1.Name - } - ) - .Select( - g => - new + .GroupBy(l1 => new + { + l1.Id, + l1.Date, + l1.Name, + InnerId = l1.OneToOne_Optional_FK1.Id, + InnerDate = l1.OneToOne_Optional_FK1.Date, + InnerOptionalId = l1.OneToOne_Optional_FK1.Level1_Optional_Id, + InnerRequiredId = l1.OneToOne_Optional_FK1.Level1_Required_Id, + InnerName = l1.OneToOne_Required_FK1.Name + }) + .Select(g => new + { + NestedEntity = new Level1 + { + Id = g.Key.Id, + Name = g.Key.Name, + Date = g.Key.Date, + OneToOne_Optional_FK1 = new Level2 { - NestedEntity = new Level1 - { - Id = g.Key.Id, - Name = g.Key.Name, - Date = g.Key.Date, - OneToOne_Optional_FK1 = new Level2 - { - Id = g.Key.InnerId, - Name = g.Key.InnerName, - Date = g.Key.InnerDate, - Level1_Optional_Id = g.Key.InnerOptionalId, - Level1_Required_Id = g.Key.InnerRequiredId - } - }, - Aggregate = g.Sum(x => x.Name.Length) + Id = g.Key.InnerId, + Name = g.Key.InnerName, + Date = g.Key.InnerDate, + Level1_Optional_Id = g.Key.InnerOptionalId, + Level1_Required_Id = g.Key.InnerRequiredId } - ) + }, + Aggregate = g.Sum(x => x.Name.Length) + }) ); [ConditionalTheory] @@ -4679,22 +4609,19 @@ public virtual Task Member_over_null_check_ternary_and_nested_dto_type(bool asyn async, ss => ss.Set() - .Select( - l1 => - new Level1Dto - { - Id = l1.Id, - Name = l1.Name, - Level2 = - l1.OneToOne_Optional_FK1 == null - ? null - : new Level2Dto - { - Id = l1.OneToOne_Optional_FK1.Id, - Name = l1.OneToOne_Optional_FK1.Name, - } - } - ) + .Select(l1 => new Level1Dto + { + Id = l1.Id, + Name = l1.Name, + Level2 = + l1.OneToOne_Optional_FK1 == null + ? null + : new Level2Dto + { + Id = l1.OneToOne_Optional_FK1.Id, + Name = l1.OneToOne_Optional_FK1.Name, + } + }) .OrderBy(e => e.Level2.Name) .ThenBy(e => e.Id), assertOrder: true, @@ -4735,29 +4662,25 @@ public virtual Task Member_over_null_check_ternary_and_nested_anonymous_type(boo async, ss => ss.Set() - .Select( - l1 => - new + .Select(l1 => new + { + l1.Id, + l1.Name, + Level2 = l1.OneToOne_Optional_FK1 == null + ? null + : new { - l1.Id, - l1.Name, - Level2 = l1.OneToOne_Optional_FK1 == null + l1.OneToOne_Optional_FK1.Id, + l1.OneToOne_Optional_FK1.Name, + Level3 = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 == null ? null : new { - l1.OneToOne_Optional_FK1.Id, - l1.OneToOne_Optional_FK1.Name, - Level3 = l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2 - == null - ? null - : new - { - l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Id, - l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name - } + l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Id, + l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.Name } } - ) + }) .Where(e => e.Level2.Level3.Name != "L"), elementSorter: e => e.Id, elementAsserter: (e, a) => @@ -4840,21 +4763,13 @@ public virtual Task Multiple_conditionals_in_projection(bool async) => async, ss => ss.Set() - .Select( - l2 => - new Level1Dto - { - Id = l2.Id, - Name = - l2.OneToOne_Optional_FK2 == null - ? null - : l2.OneToOne_Optional_FK2.Name, - Level2 = - l2.OneToOne_Optional_FK_Inverse2 == null - ? null - : new Level2Dto() - } - ), + .Select(l2 => new Level1Dto + { + Id = l2.Id, + Name = + l2.OneToOne_Optional_FK2 == null ? null : l2.OneToOne_Optional_FK2.Name, + Level2 = l2.OneToOne_Optional_FK_Inverse2 == null ? null : new Level2Dto() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -4928,16 +4843,13 @@ public virtual Task Collection_FirstOrDefault_property_accesses_in_projection(bo .Include(x => x.OneToMany_Optional1) .ThenInclude(x => x.OneToMany_Optional2) .Where(l1 => l1.Id < 3) - .Select( - l1 => - new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") - .FirstOrDefault() - .Name - } - ) + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") + .FirstOrDefault() + .Name + }) ); [ConditionalTheory] @@ -4952,16 +4864,13 @@ bool async .Include(x => x.OneToMany_Optional1) .ThenInclude(x => x.OneToMany_Optional2) .Where(l1 => l1.Id < 3) - .Select( - l1 => - new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") - .FirstOrDefault() - .OneToOne_Optional_FK2 - } - ) + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") + .FirstOrDefault() + .OneToOne_Optional_FK2 + }) ); [ConditionalTheory] @@ -4974,16 +4883,13 @@ bool async ss => ss.Set() .Where(l1 => l1.Id < 2) - .Select( - l1 => - new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") - .FirstOrDefault() - .OneToMany_Optional2.ToList() - } - ), + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") + .FirstOrDefault() + .OneToMany_Optional2.ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -5002,18 +4908,15 @@ bool async ss => ss.Set() .Where(l1 => l1.Id < 2) - .Select( - l1 => - new - { - l1.Id, - Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") - .FirstOrDefault() - .OneToMany_Optional2.OrderBy(x => x.Id) - .FirstOrDefault() - .Name - } - ) + .Select(l1 => new + { + l1.Id, + Pushdown = l1.OneToMany_Optional1.Where(x => x.Name == "L2 02") + .FirstOrDefault() + .OneToMany_Optional2.OrderBy(x => x.Id) + .FirstOrDefault() + .Name + }) ); [ConditionalTheory] @@ -5038,15 +4941,12 @@ join l3 in ss.Set() on l2.Id equals l3.Level2_Optional_Id } ) .Distinct() - .Select( - x => - new - { - Foo = x.Id1, - Bar = x.Id2, - Baz = x.Id3 - } - ) + .Select(x => new + { + Foo = x.Id1, + Bar = x.Id2, + Baz = x.Id3 + }) .Take(10), elementSorter: e => (e.Foo, e.Bar, e.Baz) ); @@ -5138,9 +5038,10 @@ bool async async, ss => ss.Set() - .Select( - x => new { Subquery = ss.Set().Where(l2 => l2.Id < 10) } - ) + .Select(x => new + { + Subquery = ss.Set().Where(l2 => l2.Id < 10) + }) .Join(ss.Set(), o => 7, i => i.Id, (o, i) => i) ), "IQueryable" diff --git a/efcore/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs index ed4b082026a..a94744e23c7 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/ComplexTypeQueryTestBase.cs @@ -146,15 +146,14 @@ public virtual Task Complex_type_equals_constant(bool async) => async, ss => ss.Set() - .Where( - c => - c.ShippingAddress - == new Address - { - AddressLine1 = "804 S. Lakeshore Road", - ZipCode = 38654, - Country = new Country { FullName = "United States", Code = "US" } - } + .Where(c => + c.ShippingAddress + == new Address + { + AddressLine1 = "804 S. Lakeshore Road", + ZipCode = 38654, + Country = new Country { FullName = "United States", Code = "US" } + } ) ); @@ -195,12 +194,11 @@ public virtual Task Subquery_over_complex_type(bool async) async, ss => ss.Set() - .Where( - c => - ss.Set() - .Select(c => c.ShippingAddress) - .OrderBy(a => a.ZipCode) - .First() == address + .Where(c => + ss.Set() + .Select(c => c.ShippingAddress) + .OrderBy(a => a.ZipCode) + .First() == address ) ); } @@ -371,10 +369,9 @@ bool async .Where(cg => cg.OptionalCustomer!.ShippingAddress.ZipCode != 07728), ss => ss.Set() - .Where( - cg => - cg.OptionalCustomer == null - || cg.OptionalCustomer.ShippingAddress.ZipCode != 07728 + .Where(cg => + cg.OptionalCustomer == null + || cg.OptionalCustomer.ShippingAddress.ZipCode != 07728 ) ); } @@ -464,19 +461,14 @@ public virtual Task Struct_complex_type_equals_constant(bool async) => async, ss => ss.Set() - .Where( - c => - c.ShippingAddress - == new AddressStruct - { - AddressLine1 = "804 S. Lakeshore Road", - ZipCode = 38654, - Country = new CountryStruct - { - FullName = "United States", - Code = "US" - } - } + .Where(c => + c.ShippingAddress + == new AddressStruct + { + AddressLine1 = "804 S. Lakeshore Road", + ZipCode = 38654, + Country = new CountryStruct { FullName = "United States", Code = "US" } + } ) ); @@ -512,12 +504,11 @@ public virtual Task Subquery_over_struct_complex_type(bool async) async, ss => ss.Set() - .Where( - c => - ss.Set() - .Select(c => c.ShippingAddress) - .OrderBy(a => a.ZipCode) - .First() == address + .Where(c => + ss.Set() + .Select(c => c.ShippingAddress) + .OrderBy(a => a.ZipCode) + .First() == address ) ); } @@ -537,11 +528,8 @@ public virtual Task Contains_over_struct_complex_type(bool async) async, ss => ss.Set() - .Where( - c => - ss.Set() - .Select(c => c.ShippingAddress) - .Contains(address) + .Where(c => + ss.Set().Select(c => c.ShippingAddress).Contains(address) ) ); } diff --git a/efcore/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs index 3018ca0bc86..c1f71440bd0 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/CompositeKeysQueryTestBase.cs @@ -127,15 +127,11 @@ orderby e1.Id2 { e1.Name, Middle = e1.OneToMany_Optional1.OrderBy(e2 => e2.Id2) - .Select( - e2 => - new - { - e2.Name, - Inner = e2.OneToMany_Required2.OrderByDescending(x => x.Id2) - .ToList() - } - ) + .Select(e2 => new + { + e2.Name, + Inner = e2.OneToMany_Required2.OrderByDescending(x => x.Id2).ToList() + }) .ToList(), }, elementSorter: e => e.Name, @@ -167,61 +163,43 @@ from e1 in ss.Set() select new { e1.Name, - Outer1 = e1.OneToMany_Optional1.Select( - e2 => - new - { - e2.Name, - Middle1 = e2.OneToMany_Required2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.ToList() - } - ) - .ToList(), - Middle2 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - } - ) - .ToList(), - } - ) + Outer1 = e1.OneToMany_Optional1.Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Required2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.ToList() + }) + .ToList(), + Middle2 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }) + .ToList(), + }) .ToList(), - Outer2 = e1.OneToMany_Required1.Select( - e2 => - new - { - e2.Name, - Middle1 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - } - ) - .ToList(), - Middle2 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.ToList() - } - ) - .ToList(), - } - ) + Outer2 = e1.OneToMany_Required1.Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }) + .ToList(), + Middle2 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.ToList() + }) + .ToList(), + }) .ToList(), }, elementSorter: e => e.Name, @@ -307,66 +285,47 @@ from e1 in ss.Set() orderby e1.Name select new { - Outer1 = e1.OneToMany_Optional1.Select( - e2 => - new + Outer1 = e1.OneToMany_Optional1.Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Required2.OrderByDescending(e3 => e3.Id2) + .ThenByDescending(e3 => e3.Id1) + .Select(e3 => new { - e2.Name, - Middle1 = e2.OneToMany_Required2.OrderByDescending(e3 => e3.Id2) - .ThenByDescending(e3 => e3.Id1) - .Select( - e3 => - new - { - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.ToList() - } - ) - .ToList(), - Middle2 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - } - ) - .ToList(), - } - ) + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.ToList() + }) + .ToList(), + Middle2 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }) + .ToList(), + }) .ToList(), Outer2 = e1.OneToMany_Required1.OrderBy(e2 => e2.Name.Length) - .Select( - e2 => - new - { - e2.Name, - Middle1 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Required3.ToList(), - Inner2 = e3.OneToMany_Optional3.ToList() - } - ) - .ToList(), - Middle2 = e2.OneToMany_Optional2.Select( - e3 => - new - { - e3.Name, - Inner1 = e3.OneToMany_Optional3.ToList(), - Inner2 = e3.OneToMany_Required3.OrderByDescending( - x => x.Id1 + x.Id2 - ) - .ToList() - } - ) - .ToList(), - } - ) + .Select(e2 => new + { + e2.Name, + Middle1 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Required3.ToList(), + Inner2 = e3.OneToMany_Optional3.ToList() + }) + .ToList(), + Middle2 = e2.OneToMany_Optional2.Select(e3 => new + { + e3.Name, + Inner1 = e3.OneToMany_Optional3.ToList(), + Inner2 = e3.OneToMany_Required3.OrderByDescending(x => x.Id1 + x.Id2 + ) + .ToList() + }) + .ToList(), + }) .ToList(), }, assertOrder: true, diff --git a/efcore/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs index 302e0a28fcc..bf6cd6db695 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/FunkyDataQueryTestBase.cs @@ -223,8 +223,8 @@ public virtual Task String_contains_on_argument_with_wildcard_column(bool async) c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) == true + .Where(r => + r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) == true ), elementSorter: e => (e.fn, e.ln), elementAsserter: (e, a) => @@ -254,8 +254,8 @@ public virtual Task String_contains_on_argument_with_wildcard_column_negated(boo c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) != true + .Where(r => + r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.Contains(xx))) != true ) ); @@ -509,11 +509,9 @@ await AssertQuery( ss => ss.Set().Where(c => c.FirstName.StartsWith(c.LastName)), ss => ss.Set() - .Where( - c => - c.FirstName.MaybeScalar( - x => c.LastName.MaybeScalar(xx => x.StartsWith(xx)) - ) == true + .Where(c => + c.FirstName.MaybeScalar(x => c.LastName.MaybeScalar(xx => x.StartsWith(xx))) + == true ) ); } @@ -538,8 +536,8 @@ public virtual Task String_starts_with_on_argument_with_wildcard_column(bool asy c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.StartsWith(xx))) == true + .Where(r => + r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.StartsWith(xx))) == true ), elementSorter: e => (e.fn, e.ln), elementAsserter: (e, a) => @@ -569,12 +567,8 @@ public virtual Task String_starts_with_on_argument_with_wildcard_column_negated( c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => - !( - r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.StartsWith(xx))) - == true - ) + .Where(r => + !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.StartsWith(xx))) == true) ) ); @@ -792,8 +786,8 @@ public virtual Task String_ends_with_on_argument_with_wildcard_column(bool async c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true + .Where(r => + r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true ), elementSorter: e => (e.fn, e.ln), elementAsserter: (e, a) => @@ -823,9 +817,8 @@ public virtual Task String_ends_with_on_argument_with_wildcard_column_negated(bo c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => - !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) + .Where(r => + !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) ) ); @@ -849,8 +842,8 @@ public virtual Task String_ends_with_inside_conditional(bool async) => c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true + .Where(r => + r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true ), elementSorter: e => (e.fn, e.ln), elementAsserter: (e, a) => @@ -880,11 +873,10 @@ public virtual Task String_ends_with_inside_conditional_negated(bool async) => c => ss.Set().Select(c2 => c2.LastName), (fn, ln) => new { fn, ln } ) - .Where( - r => - !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) - ? true - : false + .Where(r => + !(r.fn.MaybeScalar(x => r.ln.MaybeScalar(xx => x.EndsWith(xx))) == true) + ? true + : false ) ); @@ -900,13 +892,12 @@ public virtual Task String_ends_with_equals_nullable_column(bool async) => ss => ss.Set() .SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) - .Where( - r => - ( - r.c1.FirstName != null - && r.c2.LastName != null - && r.c1.FirstName.EndsWith(r.c2.LastName) - ) == r.c1.NullableBool + .Where(r => + ( + r.c1.FirstName != null + && r.c2.LastName != null + && r.c1.FirstName.EndsWith(r.c2.LastName) + ) == r.c1.NullableBool ), elementSorter: e => (e.c1.Id, e.c2.Id), elementAsserter: (e, a) => @@ -928,13 +919,12 @@ public virtual Task String_ends_with_not_equals_nullable_column(bool async) => ss => ss.Set() .SelectMany(c => ss.Set(), (c1, c2) => new { c1, c2 }) - .Where( - r => - ( - r.c1.FirstName != null - && r.c2.LastName != null - && r.c1.FirstName.EndsWith(r.c2.LastName) - ) != r.c1.NullableBool + .Where(r => + ( + r.c1.FirstName != null + && r.c2.LastName != null + && r.c1.FirstName.EndsWith(r.c2.LastName) + ) != r.c1.NullableBool ), elementSorter: e => (e.c1.Id, e.c2.Id), elementAsserter: (e, a) => @@ -952,25 +942,19 @@ public virtual Task String_FirstOrDefault_and_LastOrDefault(bool async) => ss => ss.Set() .OrderBy(e => e.Id) - .Select( - e => - new - { - first = (char?)e.FirstName.FirstOrDefault(), - last = (char?)e.FirstName.LastOrDefault() - } - ), + .Select(e => new + { + first = (char?)e.FirstName.FirstOrDefault(), + last = (char?)e.FirstName.LastOrDefault() + }), ss => ss.Set() .OrderBy(e => e.Id) - .Select( - e => - new - { - first = e.FirstName.MaybeScalar(x => x.FirstOrDefault()), - last = e.FirstName.MaybeScalar(x => x.LastOrDefault()) - } - ), + .Select(e => new + { + first = e.FirstName.MaybeScalar(x => x.FirstOrDefault()), + last = e.FirstName.MaybeScalar(x => x.LastOrDefault()) + }), assertOrder: true, elementAsserter: (e, a) => { @@ -992,10 +976,9 @@ public virtual Task String_Contains_and_StartsWith_with_same_parameter(bool asyn .Where(c => c.FirstName.Contains(s) || c.LastName.StartsWith(s)), ss => ss.Set() - .Where( - c => - c.FirstName.MaybeScalar(f => f.Contains(s)) == true - || c.LastName.MaybeScalar(l => l.StartsWith(s)) == true + .Where(c => + c.FirstName.MaybeScalar(f => f.Contains(s)) == true + || c.LastName.MaybeScalar(l => l.StartsWith(s)) == true ) ); } diff --git a/efcore/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index 47b9d171f15..964cff87da6 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -639,17 +639,12 @@ public virtual Task Bitwise_projects_values_in_select(bool async) => ss => ss.Set() .Where(g => (g.Rank & MilitaryRank.Corporal) == MilitaryRank.Corporal) - .Select( - b => - new - { - BitwiseTrue = (b.Rank & MilitaryRank.Corporal) - == MilitaryRank.Corporal, - BitwiseFalse = (b.Rank & MilitaryRank.Corporal) - == MilitaryRank.Sergeant, - BitwiseValue = b.Rank & MilitaryRank.Corporal - } - ) + .Select(b => new + { + BitwiseTrue = (b.Rank & MilitaryRank.Corporal) == MilitaryRank.Corporal, + BitwiseFalse = (b.Rank & MilitaryRank.Corporal) == MilitaryRank.Sergeant, + BitwiseValue = b.Rank & MilitaryRank.Corporal + }) ); [ConditionalTheory] @@ -692,15 +687,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - g => - g.Rank.HasFlag( - ss.Set() - .OrderBy(x => x.Nickname) - .ThenBy(x => x.SquadId) - .Select(x => x.Rank) - .FirstOrDefault() - ) + .Where(g => + g.Rank.HasFlag( + ss.Set() + .OrderBy(x => x.Nickname) + .ThenBy(x => x.SquadId) + .Select(x => x.Rank) + .FirstOrDefault() + ) ) ); @@ -708,15 +702,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - g => - MilitaryRank.Corporal.HasFlag( - ss.Set() - .OrderBy(x => x.Nickname) - .ThenBy(x => x.SquadId) - .Select(x => x.Rank) - .FirstOrDefault() - ) + .Where(g => + MilitaryRank.Corporal.HasFlag( + ss.Set() + .OrderBy(x => x.Nickname) + .ThenBy(x => x.SquadId) + .Select(x => x.Rank) + .FirstOrDefault() + ) ) ); } @@ -729,15 +722,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - g => - g.Rank.HasFlag( - ss.Set() - .OrderBy(x => x.Nickname) - .ThenBy(x => x.SquadId) - .FirstOrDefault() - .Rank - ) + .Where(g => + g.Rank.HasFlag( + ss.Set() + .OrderBy(x => x.Nickname) + .ThenBy(x => x.SquadId) + .FirstOrDefault() + .Rank + ) ) ); @@ -745,15 +737,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - g => - MilitaryRank.Corporal.HasFlag( - ss.Set() - .OrderBy(x => x.Nickname) - .ThenBy(x => x.SquadId) - .FirstOrDefault() - .Rank - ) + .Where(g => + MilitaryRank.Corporal.HasFlag( + ss.Set() + .OrderBy(x => x.Nickname) + .ThenBy(x => x.SquadId) + .FirstOrDefault() + .Rank + ) ) ); } @@ -765,15 +756,14 @@ public virtual Task Where_enum_has_flag_subquery_client_eval(bool async) => async, ss => ss.Set() - .Where( - g => - g.Rank.HasFlag( - ss.Set() - .OrderBy(x => x.Nickname) - .ThenBy(x => x.SquadId) - .First() - .Rank - ) + .Where(g => + g.Rank.HasFlag( + ss.Set() + .OrderBy(x => x.Nickname) + .ThenBy(x => x.SquadId) + .First() + .Rank + ) ) ); @@ -803,14 +793,11 @@ public virtual Task Select_enum_has_flag(bool async) => ss => ss.Set() .Where(g => g.Rank.HasFlag(MilitaryRank.Corporal)) - .Select( - b => - new - { - hasFlagTrue = b.Rank.HasFlag(MilitaryRank.Corporal), - hasFlagFalse = b.Rank.HasFlag(MilitaryRank.Sergeant) - } - ) + .Select(b => new + { + hasFlagTrue = b.Rank.HasFlag(MilitaryRank.Corporal), + hasFlagFalse = b.Rank.HasFlag(MilitaryRank.Sergeant) + }) ); [ConditionalTheory] @@ -924,22 +911,17 @@ public virtual Task Select_ternary_operation_with_has_value_not_null(bool async) async, ss => ss.Set() - .Where( - w => - w.AmmunitionType.HasValue - && w.AmmunitionType == AmmunitionType.Cartridge + .Where(w => + w.AmmunitionType.HasValue && w.AmmunitionType == AmmunitionType.Cartridge ) - .Select( - w => - new - { - w.Id, - IsCartridge = w.AmmunitionType.HasValue - && w.AmmunitionType.Value == AmmunitionType.Cartridge - ? "Yes" - : "No" - } - ), + .Select(w => new + { + w.Id, + IsCartridge = w.AmmunitionType.HasValue + && w.AmmunitionType.Value == AmmunitionType.Cartridge + ? "Yes" + : "No" + }), elementSorter: e => e.Id ); @@ -950,17 +932,14 @@ public virtual Task Select_ternary_operation_multiple_conditions(bool async) => async, ss => ss.Set() - .Select( - w => - new - { - w.Id, - IsCartridge = w.AmmunitionType == AmmunitionType.Shell - && w.SynergyWithId == 1 - ? "Yes" - : "No" - } - ), + .Select(w => new + { + w.Id, + IsCartridge = w.AmmunitionType == AmmunitionType.Shell + && w.SynergyWithId == 1 + ? "Yes" + : "No" + }), elementSorter: e => e.Id ); @@ -971,14 +950,11 @@ public virtual Task Select_ternary_operation_multiple_conditions_2(bool async) = async, ss => ss.Set() - .Select( - w => - new - { - w.Id, - IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 ? "Yes" : "No" - } - ), + .Select(w => new + { + w.Id, + IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 ? "Yes" : "No" + }), elementSorter: e => e.Id ); @@ -989,9 +965,11 @@ public virtual Task Select_multiple_conditions(bool async) => async, ss => ss.Set() - .Select( - w => new { w.Id, IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 } - ), + .Select(w => new + { + w.Id, + IsCartridge = !w.IsAutomatic && w.SynergyWithId == 1 + }), elementSorter: e => e.Id ); @@ -1002,18 +980,15 @@ public virtual Task Select_nested_ternary_operations(bool async) => async, ss => ss.Set() - .Select( - w => - new - { - w.Id, - IsManualCartridge = !w.IsAutomatic - ? w.AmmunitionType == AmmunitionType.Cartridge - ? "ManualCartridge" - : "Manual" - : "Auto" - } - ), + .Select(w => new + { + w.Id, + IsManualCartridge = !w.IsAutomatic + ? w.AmmunitionType == AmmunitionType.Cartridge + ? "ManualCartridge" + : "Manual" + : "Auto" + }), elementSorter: e => e.Id ); @@ -1034,10 +1009,8 @@ public virtual Task Null_propagation_optimization2(bool async) => async, ss => ss.Set() - .Where( - g => - (g.LeaderNickname == null ? null : g.LeaderNickname.EndsWith("us")) - == true + .Where(g => + (g.LeaderNickname == null ? null : g.LeaderNickname.EndsWith("us")) == true ) ); @@ -1048,10 +1021,8 @@ public virtual Task Null_propagation_optimization3(bool async) => async, ss => ss.Set() - .Where( - g => - (g.LeaderNickname != null ? g.LeaderNickname.EndsWith("us") : null) - == true + .Where(g => + (g.LeaderNickname != null ? g.LeaderNickname.EndsWith("us") : null) == true ) ); @@ -1062,15 +1033,14 @@ public virtual Task Null_propagation_optimization4(bool async) => async, ss => ss.Set() - .Where( - g => - ( - null == EF.Property(g, "LeaderNickname") - ? null - : g.LeaderNickname.Length - ) - == 5 - == (bool?)true + .Where(g => + ( + null == EF.Property(g, "LeaderNickname") + ? null + : g.LeaderNickname.Length + ) + == 5 + == (bool?)true ) ); @@ -1081,15 +1051,14 @@ public virtual Task Null_propagation_optimization5(bool async) => async, ss => ss.Set() - .Where( - g => - ( - null != g.LeaderNickname - ? EF.Property(g, "LeaderNickname").Length - : null - ) - == 5 - == (bool?)true + .Where(g => + ( + null != g.LeaderNickname + ? EF.Property(g, "LeaderNickname").Length + : null + ) + == 5 + == (bool?)true ) ); @@ -1100,15 +1069,14 @@ public virtual Task Null_propagation_optimization6(bool async) => async, ss => ss.Set() - .Where( - g => - ( - null != g.LeaderNickname - ? EF.Property(g, "LeaderNickname").Length - : null - ) - == 5 - == (bool?)true + .Where(g => + ( + null != g.LeaderNickname + ? EF.Property(g, "LeaderNickname").Length + : null + ) + == 5 + == (bool?)true ) ); @@ -1119,8 +1087,8 @@ public virtual Task Select_null_propagation_optimization7(bool async) => async, ss => ss.Set() - .Select( - g => null != g.LeaderNickname ? g.LeaderNickname + g.LeaderNickname : null + .Select(g => + null != g.LeaderNickname ? g.LeaderNickname + g.LeaderNickname : null ) ); @@ -1214,12 +1182,11 @@ public virtual Task Select_null_propagation_negative6(bool async) => async, ss => ss.Set() - .Select( - g => - null != g.LeaderNickname - ? EF.Property(g, "LeaderNickname").Length - != EF.Property(g, "LeaderNickname").Length - : (bool?)null + .Select(g => + null != g.LeaderNickname + ? EF.Property(g, "LeaderNickname").Length + != EF.Property(g, "LeaderNickname").Length + : (bool?)null ) ); @@ -1230,11 +1197,10 @@ public virtual Task Select_null_propagation_negative7(bool async) => async, ss => ss.Set() - .Select( - g => - null != g.LeaderNickname - ? g.LeaderNickname == g.LeaderNickname - : (bool?)null + .Select(g => + null != g.LeaderNickname + ? g.LeaderNickname == g.LeaderNickname + : (bool?)null ) ); @@ -1254,11 +1220,10 @@ public virtual Task Select_null_propagation_negative9(bool async) => async, ss => ss.Set() - .Select( - g => - g.LeaderNickname != null - ? (bool?)(g.Nickname.Length == 5) ?? default - : (bool?)null + .Select(g => + g.LeaderNickname != null + ? (bool?)(g.Nickname.Length == 5) ?? default + : (bool?)null ) ); @@ -1485,9 +1450,10 @@ public virtual Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) => ss => ss.Set() .OrderBy(w => w.Id) - .Select( - w => new Weapon { IsAutomatic = (bool?)w.SynergyWith.IsAutomatic ?? false } - ) + .Select(w => new Weapon + { + IsAutomatic = (bool?)w.SynergyWith.IsAutomatic ?? false + }) ); [ConditionalTheory] @@ -1497,9 +1463,8 @@ public virtual Task Where_subquery_boolean(bool async) => async, ss => ss.Set() - .Where( - g => - g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() + .Where(g => + g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() ) ); @@ -1519,13 +1484,12 @@ public virtual Task Where_subquery_distinct_firstordefault_boolean(bool async) = async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Distinct() - .OrderBy(w => w.Id) - .Select(w => w.IsAutomatic) - .FirstOrDefault() + .Where(g => + g.HasSoulPatch + && g.Weapons.Distinct() + .OrderBy(w => w.Id) + .Select(w => w.IsAutomatic) + .FirstOrDefault() ) ); @@ -1536,10 +1500,9 @@ public virtual Task Where_subquery_distinct_firstordefault_boolean_with_pushdown async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic ) ); @@ -1551,10 +1514,9 @@ public virtual Task Where_subquery_distinct_first_boolean(bool async) => ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => - g.HasSoulPatch - && g.Weapons.Distinct().OrderBy(w => w.Id).First().IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Distinct().OrderBy(w => w.Id).First().IsAutomatic ), assertOrder: true ); @@ -1567,13 +1529,12 @@ public virtual Task Where_subquery_distinct_singleordefault_boolean1(bool async) ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => - g.HasSoulPatch - && g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Distinct() - .Select(w => w.IsAutomatic) - .SingleOrDefault() + .Where(g => + g.HasSoulPatch + && g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Distinct() + .Select(w => w.IsAutomatic) + .SingleOrDefault() ), assertOrder: true ); @@ -1586,13 +1547,12 @@ public virtual Task Where_subquery_distinct_singleordefault_boolean2(bool async) ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => - g.HasSoulPatch - && g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Select(w => w.IsAutomatic) - .Distinct() - .SingleOrDefault() + .Where(g => + g.HasSoulPatch + && g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Select(w => w.IsAutomatic) + .Distinct() + .SingleOrDefault() ), assertOrder: true ); @@ -1605,13 +1565,12 @@ public virtual Task Where_subquery_distinct_singleordefault_boolean_with_pushdow ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => - g.HasSoulPatch - && g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Distinct() - .SingleOrDefault() - .IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Distinct() + .SingleOrDefault() + .IsAutomatic ), assertOrder: true ); @@ -1624,8 +1583,7 @@ public virtual Task Where_subquery_distinct_lastordefault_boolean(bool async) => ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => !g.Weapons.Distinct().OrderBy(w => w.Id).LastOrDefault().IsAutomatic + .Where(g => !g.Weapons.Distinct().OrderBy(w => w.Id).LastOrDefault().IsAutomatic ), assertOrder: true ); @@ -1638,10 +1596,9 @@ public virtual Task Where_subquery_distinct_last_boolean(bool async) => ss => ss.Set() .OrderBy(g => g.Nickname) - .Where( - g => - !g.HasSoulPatch - && g.Weapons.Distinct().OrderBy(w => w.Id).Last().IsAutomatic + .Where(g => + !g.HasSoulPatch + && g.Weapons.Distinct().OrderBy(w => w.Id).Last().IsAutomatic ), assertOrder: true ); @@ -1653,13 +1610,12 @@ public virtual Task Where_subquery_distinct_orderby_firstordefault_boolean(bool async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Distinct() - .OrderBy(w => w.Id) - .Select(w => w.IsAutomatic) - .FirstOrDefault() + .Where(g => + g.HasSoulPatch + && g.Weapons.Distinct() + .OrderBy(w => w.Id) + .Select(w => w.IsAutomatic) + .FirstOrDefault() ) ); @@ -1672,10 +1628,9 @@ bool async async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Distinct().OrderBy(w => w.Id).FirstOrDefault().IsAutomatic ) ); @@ -1686,13 +1641,12 @@ public virtual Task Where_subquery_union_firstordefault_boolean(bool async) => async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Union(g.Weapons) - .OrderBy(w => w.Id) - .FirstOrDefault() - .IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Union(g.Weapons) + .OrderBy(w => w.Id) + .FirstOrDefault() + .IsAutomatic ) ); @@ -1703,13 +1657,12 @@ public virtual Task Where_subquery_join_firstordefault_boolean(bool async) => async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Join(g.Weapons, e => e.Id, e => e.Id, (e1, e2) => e1) - .OrderBy(w => w.Id) - .FirstOrDefault() - .IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Join(g.Weapons, e => e.Id, e => e.Id, (e1, e2) => e1) + .OrderBy(w => w.Id) + .FirstOrDefault() + .IsAutomatic ) ); @@ -1720,18 +1673,17 @@ public virtual Task Where_subquery_left_join_firstordefault_boolean(bool async) async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && ( - from o in g.Weapons - join i in g.Weapons on o.Id equals i.Id into grouping - from i in grouping.DefaultIfEmpty() - select o - ) - .OrderBy(w => w.Id) - .FirstOrDefault() - .IsAutomatic + .Where(g => + g.HasSoulPatch + && ( + from o in g.Weapons + join i in g.Weapons on o.Id equals i.Id into grouping + from i in grouping.DefaultIfEmpty() + select o + ) + .OrderBy(w => w.Id) + .FirstOrDefault() + .IsAutomatic ) ); @@ -1742,13 +1694,12 @@ public virtual Task Where_subquery_concat_firstordefault_boolean(bool async) => async, ss => ss.Set() - .Where( - g => - g.HasSoulPatch - && g.Weapons.Concat(g.Weapons) - .OrderBy(w => w.Id) - .FirstOrDefault() - .IsAutomatic + .Where(g => + g.HasSoulPatch + && g.Weapons.Concat(g.Weapons) + .OrderBy(w => w.Id) + .FirstOrDefault() + .IsAutomatic ) ); @@ -2293,10 +2244,9 @@ public virtual Task Coalesce_operator_in_predicate_with_other_conditions(bool as async, ss => ss.Set() - .Where( - w => - w.AmmunitionType == AmmunitionType.Cartridge - && ((bool?)w.IsAutomatic ?? false) + .Where(w => + w.AmmunitionType == AmmunitionType.Cartridge + && ((bool?)w.IsAutomatic ?? false) ) ); @@ -2307,10 +2257,9 @@ public virtual Task Coalesce_operator_in_projection_with_other_conditions(bool a async, ss => ss.Set() - .Select( - w => - w.AmmunitionType == AmmunitionType.Cartridge - && ((bool?)w.IsAutomatic ?? false) + .Select(w => + w.AmmunitionType == AmmunitionType.Cartridge + && ((bool?)w.IsAutomatic ?? false) ) ); @@ -2352,13 +2301,12 @@ bool async ss => ss.Set().Where(t => !(t.Gear.HasSoulPatch ? true : t.Gear.HasSoulPatch)), ss => ss.Set() - .Where( - t => - !( - t.Gear.MaybeScalar(x => x.HasSoulPatch) == true - ? true - : t.Gear.MaybeScalar(x => x.HasSoulPatch) - ) == true + .Where(t => + !( + t.Gear.MaybeScalar(x => x.HasSoulPatch) == true + ? true + : t.Gear.MaybeScalar(x => x.HasSoulPatch) + ) == true ) ); @@ -2373,13 +2321,12 @@ bool async ss.Set().Where(t => !(!t.Gear.HasSoulPatch ? false : t.Gear.HasSoulPatch)), ss => ss.Set() - .Where( - t => - !( - t.Gear.MaybeScalar(x => x.HasSoulPatch) == false - ? false - : t.Gear.MaybeScalar(x => x.HasSoulPatch) - ) == true + .Where(t => + !( + t.Gear.MaybeScalar(x => x.HasSoulPatch) == false + ? false + : t.Gear.MaybeScalar(x => x.HasSoulPatch) + ) == true ) ); @@ -2512,10 +2459,9 @@ public virtual Task Optional_navigation_type_compensation_works_with_contains(bo async, ss => ss.Set() - .Where( - t => - t.Note != "K.I.A." - && ss.Set().Select(g => g.SquadId).Contains(t.Gear.SquadId) + .Where(t => + t.Note != "K.I.A." + && ss.Set().Select(g => g.SquadId).Contains(t.Gear.SquadId) ) ); @@ -2530,8 +2476,8 @@ public virtual Task Optional_navigation_type_compensation_works_with_skip(bool a ss.Set() .Where(t => t.Note != "K.I.A.") .OrderBy(t => t.Note) - .Select( - t => ss.Set().OrderBy(g => g.Nickname).Skip(t.Gear.SquadId) + .Select(t => + ss.Set().OrderBy(g => g.Nickname).Skip(t.Gear.SquadId) ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -2550,8 +2496,8 @@ public virtual Task Optional_navigation_type_compensation_works_with_take(bool a ss.Set() .Where(t => t.Note != "K.I.A.") .OrderBy(t => t.Note) - .Select( - t => ss.Set().OrderBy(g => g.Nickname).Take(t.Gear.SquadId) + .Select(t => + ss.Set().OrderBy(g => g.Nickname).Take(t.Gear.SquadId) ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -2871,11 +2817,9 @@ public virtual Task Distinct_with_optional_navigation_is_translated_to_sql(bool AssertQueryScalar( async, ss => - ( - from g in ss.Set() - where g.Tag.Note != "Foo" - select g.HasSoulPatch - ).Distinct() + (from g in ss.Set() where g.Tag.Note != "Foo" select g.HasSoulPatch).Distinct( + + ) ); [ConditionalTheory] @@ -3604,10 +3548,9 @@ public virtual Task Optional_navigation_with_collection_composite_key(bool async async, ss => ss.Set() - .Where( - t => - t.Gear is Officer - && ((Officer)t.Gear).Reports.Count(r => r.Nickname == "Dom") > 0 + .Where(t => + t.Gear is Officer + && ((Officer)t.Gear).Reports.Count(r => r.Nickname == "Dom") > 0 ) ); @@ -3619,11 +3562,10 @@ public virtual Task Select_null_conditional_with_inheritance(bool async) => ss => ss.Set() .Where(f => f is LocustHorde) - .Select( - f => - EF.Property((LocustHorde)f, "CommanderName") != null - ? ((LocustHorde)f).CommanderName - : null + .Select(f => + EF.Property((LocustHorde)f, "CommanderName") != null + ? ((LocustHorde)f).CommanderName + : null ) ); @@ -3635,11 +3577,10 @@ public virtual Task Select_null_conditional_with_inheritance_negative(bool async ss => ss.Set() .Where(f => f is LocustHorde) - .Select( - f => - EF.Property((LocustHorde)f, "CommanderName") != null - ? ((LocustHorde)f).Eradicated - : null + .Select(f => + EF.Property((LocustHorde)f, "CommanderName") != null + ? ((LocustHorde)f).Eradicated + : null ) ); @@ -3651,17 +3592,14 @@ public virtual Task Project_collection_navigation_with_inheritance1(bool async) ss => ss.Set() .OfType() - .Select( - h => - new - { - h.Id, - Leaders = EF.Property>( - h.Commander.CommandingFaction, - "Leaders" - ) - } - ), + .Select(h => new + { + h.Id, + Leaders = EF.Property>( + h.Commander.CommandingFaction, + "Leaders" + ) + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -3678,17 +3616,14 @@ public virtual Task Project_collection_navigation_with_inheritance2(bool async) ss => ss.Set() .OfType() - .Select( - h => - new - { - h.Id, - Gears = EF.Property>( - (Officer)h.Commander.DefeatedBy, - "Reports" - ) - } - ), + .Select(h => new + { + h.Id, + Gears = EF.Property>( + (Officer)h.Commander.DefeatedBy, + "Reports" + ) + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -3705,17 +3640,14 @@ public virtual Task Project_collection_navigation_with_inheritance3(bool async) ss => ss.Set() .Where(f => f is LocustHorde) - .Select( - f => - new - { - f.Id, - Gears = EF.Property>( - (Officer)((LocustHorde)f).Commander.DefeatedBy, - "Reports" - ) - } - ), + .Select(f => new + { + f.Id, + Gears = EF.Property>( + (Officer)((LocustHorde)f).Commander.DefeatedBy, + "Reports" + ) + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -4070,11 +4002,9 @@ public virtual Task Correlated_collections_basic_projection(bool async) => from g in ss.Set() where g.Nickname != "Marcus" orderby g.Nickname - select ( - from w in g.Weapons - where w.IsAutomatic || w.Name != "foo" - select w - ).ToList(), + select (from w in g.Weapons where w.IsAutomatic || w.Name != "foo" select w).ToList( + + ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a) ); @@ -4088,11 +4018,9 @@ public virtual Task Correlated_collections_basic_projection_explicit_to_list(boo from g in ss.Set() where g.Nickname != "Marcus" orderby g.Nickname - select ( - from w in g.Weapons - where w.IsAutomatic || w.Name != "foo" - select w - ).ToList(), + select (from w in g.Weapons where w.IsAutomatic || w.Name != "foo" select w).ToList( + + ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a) ); @@ -4342,28 +4270,20 @@ public virtual Task Correlated_collections_nested_with_custom_ordering(bool asyn ss.Set() .OfType() .OrderByDescending(o => o.HasSoulPatch) - .Select( - o => - new + .Select(o => new + { + o.FullName, + OuterCollection = o.Reports.Where(r => r.FullName != "Foo") + .OrderBy(r => r.Rank) + .Select(g => new { - o.FullName, - OuterCollection = o.Reports.Where(r => r.FullName != "Foo") - .OrderBy(r => r.Rank) - .Select( - g => - new - { - g.FullName, - InnerCollection = g.Weapons.Where( - w => w.Name != "Bar" - ) - .OrderBy(w => w.IsAutomatic) - .ToList() - } - ) + g.FullName, + InnerCollection = g.Weapons.Where(w => w.Name != "Bar") + .OrderBy(w => w.IsAutomatic) .ToList() - } - ), + }) + .ToList() + }), elementSorter: e => e.FullName, elementAsserter: (e, a) => { @@ -4587,9 +4507,11 @@ orderby w.IsAutomatic select new { w.Id, - InnerFirst = w.Owner.Weapons.Select( - ww => new { ww.Name, ww.IsAutomatic } - ) + InnerFirst = w.Owner.Weapons.Select(ww => new + { + ww.Name, + ww.IsAutomatic + }) .ToList(), InnerSecond = w.Owner.Squad.Members.OrderBy(mm => mm.Nickname) .Select(mm => new { mm.Nickname, mm.HasSoulPatch }) @@ -4860,11 +4782,8 @@ public virtual Task Correlated_collections_with_FirstOrDefault(bool async) => ss => ss.Set() .OrderBy(s => s.Name) - .Select( - s => - s.Members.OrderBy(m => m.Nickname) - .Select(m => m.FullName) - .FirstOrDefault() + .Select(s => + s.Members.OrderBy(m => m.Nickname).Select(m => m.FullName).FirstOrDefault() ), assertOrder: true ); @@ -4959,14 +4878,11 @@ join g in ss.Set() on t.GearNickName equals g.Nickname into grouping from g in grouping.DefaultIfEmpty() orderby t.Note, g.Nickname descending select g.Squad.Members.Where(m => m.HasSoulPatch) - .Select( - m => - new - { - m.Nickname, - AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() - } - ) + .Select(m => new + { + m.Nickname, + AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() + }) .ToList(), ss => from t in ss.Set() @@ -4976,25 +4892,19 @@ from g in grouping.DefaultIfEmpty() select g != null ? g.Squad.Members.Where(m => m.HasSoulPatch) .OrderBy(m => m.Nickname) - .Select( - m => - new - { - m.Nickname, - AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() - } - ) + .Select(m => new + { + m.Nickname, + AutomaticWeapons = m.Weapons.Where(w => w.IsAutomatic).ToList() + }) .ToList() : Enumerable .Empty() - .Select( - x => - new - { - Nickname = (string)null, - AutomaticWeapons = new List() - } - ) + .Select(x => new + { + Nickname = (string)null, + AutomaticWeapons = new List() + }) .ToList(), assertOrder: true, elementAsserter: (e, a) => @@ -5020,49 +4930,38 @@ bool async ss => ss.Set() .OrderBy(w => w.Name) - .Select( - w => - w.Owner.Squad.Members.OrderByDescending(m => m.FullName) - .Select( - m => - new - { - Weapons = m.Weapons.Where(ww => !ww.IsAutomatic) - .OrderBy(ww => ww.Id) - .ToList(), - m.Rank - } - ) - .ToList() + .Select(w => + w.Owner.Squad.Members.OrderByDescending(m => m.FullName) + .Select(m => new + { + Weapons = m.Weapons.Where(ww => !ww.IsAutomatic) + .OrderBy(ww => ww.Id) + .ToList(), + m.Rank + }) + .ToList() ), ss => ss.Set() .OrderBy(w => w.Name) - .Select( - w => - w.Owner != null - ? w.Owner.Squad.Members.OrderByDescending(m => m.FullName) - .Select( - m => - new - { - Weapons = m.Weapons.Where(ww => !ww.IsAutomatic) - .OrderBy(ww => ww.Id) - .ToList(), - m.Rank - } - ) - .ToList() - : Enumerable - .Empty() - .Select( - x => - new - { - Weapons = new List(), - Rank = default(MilitaryRank) - } - ) + .Select(w => + w.Owner != null + ? w.Owner.Squad.Members.OrderByDescending(m => m.FullName) + .Select(m => new + { + Weapons = m.Weapons.Where(ww => !ww.IsAutomatic) + .OrderBy(ww => ww.Id) + .ToList(), + m.Rank + }) + .ToList() + : Enumerable + .Empty() + .Select(x => new + { + Weapons = new List(), + Rank = default(MilitaryRank) + }) ), assertOrder: true, elementAsserter: (e, a) => @@ -5378,8 +5277,8 @@ public virtual Task Select_required_navigation_on_derived_type(bool async) => ss => ss.Set().Select(ll => ((LocustCommander)ll).HighCommand.Name), ss => ss.Set() - .Select( - ll => ll is LocustCommander ? ((LocustCommander)ll).HighCommand.Name : null + .Select(ll => + ll is LocustCommander ? ((LocustCommander)ll).HighCommand.Name : null ) ); @@ -5401,11 +5300,10 @@ public virtual Task Where_required_navigation_on_derived_type(bool async) => ss.Set().Where(ll => ((LocustCommander)ll).HighCommand.IsOperational), ss => ss.Set() - .Where( - ll => - ll is LocustCommander - ? ((LocustCommander)ll).HighCommand.IsOperational - : false + .Where(ll => + ll is LocustCommander + ? ((LocustCommander)ll).HighCommand.IsOperational + : false ) ); @@ -5500,30 +5398,20 @@ public virtual Task Negated_bool_ternary_inside_anonymous_type_in_projection(boo async, ss => ss.Set() - .Select( - t => - new - { - c = !( - t.Gear.HasSoulPatch - ? true - : ((bool?)t.Gear.HasSoulPatch ?? true) - ) - } - ), + .Select(t => new + { + c = !(t.Gear.HasSoulPatch ? true : ((bool?)t.Gear.HasSoulPatch ?? true)) + }), ss => ss.Set() - .Select( - t => - new - { - c = !( - t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? false - ? true - : (t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? true) - ) - } - ), + .Select(t => new + { + c = !( + t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? false + ? true + : (t.Gear.MaybeScalar(x => x.HasSoulPatch) ?? true) + ) + }), elementSorter: e => e.c ); @@ -5763,16 +5651,13 @@ public virtual Task Project_one_value_type_from_empty_collection(bool async) => ss => ss.Set() .Where(s => s.Name == "Kilo") - .Select( - s => - new - { - s.Name, - SquadId = s.Members.Where(m => m.HasSoulPatch) - .Select(m => m.SquadId) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + SquadId = s.Members.Where(m => m.HasSoulPatch) + .Select(m => m.SquadId) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5785,16 +5670,13 @@ bool async ss => ss.Set() .Where(s => s.Name == "Kilo") - .Select( - s => - new - { - s.Name, - SquadId = s.Members.Where(m => m.HasSoulPatch) - .Select(m => (int?)m.SquadId) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + SquadId = s.Members.Where(m => m.HasSoulPatch) + .Select(m => (int?)m.SquadId) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5807,16 +5689,13 @@ bool async ss => ss.Set() .Where(s => s.Name == "Kilo") - .Select( - s => - new - { - s.Name, - SquadId = s.Members.Where(m => m.HasSoulPatch) - .Select(m => ClientFunction(m.SquadId, m.LeaderSquadId)) - .FirstOrDefault() - } - ), + .Select(s => new + { + s.Name, + SquadId = s.Members.Where(m => m.HasSoulPatch) + .Select(m => ClientFunction(m.SquadId, m.LeaderSquadId)) + .FirstOrDefault() + }), elementSorter: s => s.Name ); @@ -5832,11 +5711,9 @@ bool async ss => ss.Set() .Where(s => s.Name == "Kilo") - .Where( - s => - s.Members.Where(m => m.HasSoulPatch) - .Select(m => m.SquadId) - .FirstOrDefault() != 0 + .Where(s => + s.Members.Where(m => m.HasSoulPatch).Select(m => m.SquadId).FirstOrDefault() + != 0 ) .Select(s => s.Name), assertEmpty: true @@ -5849,16 +5726,11 @@ public virtual Task Select_subquery_projecting_single_constant_int(bool async) = async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => 42) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch).Select(g => 42).FirstOrDefault() + }) ); [ConditionalTheory] @@ -5868,16 +5740,13 @@ public virtual Task Select_subquery_projecting_single_constant_string(bool async async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => "Foo") - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => "Foo") + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5887,16 +5756,13 @@ public virtual Task Select_subquery_projecting_single_constant_bool(bool async) async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => true) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => true) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5906,16 +5772,13 @@ public virtual Task Select_subquery_projecting_single_constant_inside_anonymous( async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => new { One = 1 }) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => new { One = 1 }) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5927,16 +5790,13 @@ bool async async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => new { True1 = true, False1 = false }) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => new { True1 = true, False1 = false }) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5958,9 +5818,11 @@ public virtual Task Correlated_collection_order_by_constant(bool async) => ss => ss.Set() .OrderByDescending(s => 1) - .Select( - g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() } - ), + .Select(g => new + { + g.Nickname, + Weapons = g.Weapons.Select(w => w.Name).ToList() + }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -5980,16 +5842,13 @@ bool async async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => (MyDTO)null) - .FirstOrDefault() - } - ) + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => (MyDTO)null) + .FirstOrDefault() + }) ); [ConditionalTheory] @@ -5999,16 +5858,13 @@ public virtual Task Select_subquery_projecting_single_constant_of_non_mapped_typ async, ss => ss.Set() - .Select( - s => - new - { - s.Name, - Gear = s.Members.Where(g => g.HasSoulPatch) - .Select(g => new MyDTO()) - .FirstOrDefault() - } - ), + .Select(s => new + { + s.Name, + Gear = s.Members.Where(g => g.HasSoulPatch) + .Select(g => new MyDTO()) + .FirstOrDefault() + }), elementSorter: e => e.Name, elementAsserter: (e, a) => { @@ -6030,9 +5886,11 @@ bool async ss => ss.Set() .OrderByDescending(s => (MyDTO)null) - .Select( - g => new { g.Nickname, Weapons = g.Weapons.Select(w => w.Name).ToList() } - ), + .Select(g => new + { + g.Nickname, + Weapons = g.Weapons.Select(w => w.Name).ToList() + }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -6082,9 +5940,8 @@ public virtual Task Include_collection_with_complex_OrderBy3(bool async) => ss.Set() .OfType() .Include(o => o.Reports) - .OrderBy( - o => - o.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() + .OrderBy(o => + o.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() ) .ThenBy(o => o.Nickname), elementAsserter: (e, a) => @@ -6115,17 +5972,15 @@ public virtual Task Correlated_collection_with_very_complex_order_by(bool async) ss => ss.Set() .OfType() - .OrderBy( - o => - o.Weapons.Where( - w => - w.IsAutomatic - == ss.Set() - .Where(g => g.Nickname == "Marcus") - .Select(g => g.HasSoulPatch) - .FirstOrDefault() - ) - .Count() + .OrderBy(o => + o.Weapons.Where(w => + w.IsAutomatic + == ss.Set() + .Where(g => g.Nickname == "Marcus") + .Select(g => g.HasSoulPatch) + .FirstOrDefault() + ) + .Count() ) .ThenBy(g => g.Nickname) .Select(o => o.Reports.Where(g => !g.HasSoulPatch).ToList()), @@ -6152,9 +6007,8 @@ public virtual Task Select_subquery_boolean(bool async) => async, ss => ss.Set() - .Select( - g => - g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() + .Select(g => + g.Weapons.OrderBy(w => w.Id).Select(w => w.IsAutomatic).FirstOrDefault() ) ); @@ -6175,10 +6029,8 @@ public virtual Task Select_subquery_int_with_inside_cast_and_coalesce(bool async async, ss => ss.Set() - .Select( - g => - g.Weapons.OrderBy(w => w.Id).Select(w => (int?)w.Id).FirstOrDefault() - ?? 42 + .Select(g => + g.Weapons.OrderBy(w => w.Id).Select(w => (int?)w.Id).FirstOrDefault() ?? 42 ) ); @@ -6189,10 +6041,8 @@ public virtual Task Select_subquery_int_with_outside_cast_and_coalesce(bool asyn async, ss => ss.Set() - .Select( - g => - (int?)g.Weapons.OrderBy(w => w.Id).Select(w => w.Id).FirstOrDefault() - ?? 42 + .Select(g => + (int?)g.Weapons.OrderBy(w => w.Id).Select(w => w.Id).FirstOrDefault() ?? 42 ) ); @@ -6213,10 +6063,9 @@ public virtual Task Select_subquery_int_with_pushdown_and_coalesce2(bool async) async, ss => ss.Set() - .Select( - g => - (int?)g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id - ?? g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id + .Select(g => + (int?)g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id + ?? g.Weapons.OrderBy(w => w.Id).FirstOrDefault().Id ) ); @@ -6227,12 +6076,11 @@ public virtual Task Select_subquery_boolean_empty(bool async) => async, ss => ss.Set() - .Select( - g => - g.Weapons.Where(w => w.Name == "BFG") - .OrderBy(w => w.Id) - .Select(w => w.IsAutomatic) - .FirstOrDefault() + .Select(g => + g.Weapons.Where(w => w.Name == "BFG") + .OrderBy(w => w.Id) + .Select(w => w.IsAutomatic) + .FirstOrDefault() ) ); @@ -6243,13 +6091,12 @@ public virtual Task Select_subquery_boolean_empty_with_pushdown(bool async) => async, ss => ss.Set() - .Select( - g => - (bool?) - g.Weapons.Where(w => w.Name == "BFG") - .OrderBy(w => w.Id) - .FirstOrDefault() - .IsAutomatic + .Select(g => + (bool?) + g.Weapons.Where(w => w.Name == "BFG") + .OrderBy(w => w.Id) + .FirstOrDefault() + .IsAutomatic ), ss => ss.Set().Select(g => (bool?)null) ); @@ -6262,12 +6109,11 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean1(bool async ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Distinct() - .Select(w => w.IsAutomatic) - .SingleOrDefault() + .Select(g => + g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Distinct() + .Select(w => w.IsAutomatic) + .SingleOrDefault() ), assertOrder: true ); @@ -6280,12 +6126,11 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean2(bool async ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Select(w => w.IsAutomatic) - .Distinct() - .SingleOrDefault() + .Select(g => + g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Select(w => w.IsAutomatic) + .Distinct() + .SingleOrDefault() ), assertOrder: true ); @@ -6300,12 +6145,11 @@ bool async ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - g.Weapons.Where(w => w.Name.Contains("Lancer")) - .Distinct() - .SingleOrDefault() - .IsAutomatic + .Select(g => + g.Weapons.Where(w => w.Name.Contains("Lancer")) + .Distinct() + .SingleOrDefault() + .IsAutomatic ), assertOrder: true ); @@ -6318,12 +6162,11 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean_empty1(bool ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - g.Weapons.Where(w => w.Name == "BFG") - .Distinct() - .Select(w => w.IsAutomatic) - .SingleOrDefault() + .Select(g => + g.Weapons.Where(w => w.Name == "BFG") + .Distinct() + .Select(w => w.IsAutomatic) + .SingleOrDefault() ) ); @@ -6335,12 +6178,11 @@ public virtual Task Select_subquery_distinct_singleordefault_boolean_empty2(bool ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - g.Weapons.Where(w => w.Name == "BFG") - .Select(w => w.IsAutomatic) - .Distinct() - .SingleOrDefault() + .Select(g => + g.Weapons.Where(w => w.Name == "BFG") + .Select(w => w.IsAutomatic) + .Distinct() + .SingleOrDefault() ) ); @@ -6354,13 +6196,12 @@ bool async ss => ss.Set() .Where(g => g.HasSoulPatch) - .Select( - g => - (bool?) - g.Weapons.Where(w => w.Name == "BFG") - .Distinct() - .SingleOrDefault() - .IsAutomatic + .Select(g => + (bool?) + g.Weapons.Where(w => w.Name == "BFG") + .Distinct() + .SingleOrDefault() + .IsAutomatic ), ss => ss.Set().Where(g => g.HasSoulPatch).Select(g => (bool?)null), assertOrder: true @@ -6374,23 +6215,19 @@ public virtual Task Cast_subquery_to_base_type_using_typed_ToList(bool async) => ss => ss.Set() .Where(c => c.Name == "Ephyra") - .Select( - c => - c.StationedGears.Select( - g => - new Officer - { - CityOfBirthName = g.CityOfBirthName, - FullName = g.FullName, - HasSoulPatch = g.HasSoulPatch, - LeaderNickname = g.LeaderNickname, - LeaderSquadId = g.LeaderSquadId, - Nickname = g.Nickname, - Rank = g.Rank, - SquadId = g.SquadId - } - ) - .ToList() + .Select(c => + c.StationedGears.Select(g => new Officer + { + CityOfBirthName = g.CityOfBirthName, + FullName = g.FullName, + HasSoulPatch = g.HasSoulPatch, + LeaderNickname = g.LeaderNickname, + LeaderSquadId = g.LeaderSquadId, + Nickname = g.Nickname, + Rank = g.Rank, + SquadId = g.SquadId + }) + .ToList() ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a) @@ -6404,24 +6241,20 @@ public virtual Task Cast_ordered_subquery_to_base_type_using_typed_ToArray(bool ss => ss.Set() .Where(c => c.Name == "Ephyra") - .Select( - c => - c.StationedGears.OrderByDescending(g => g.Nickname) - .Select( - g => - new Officer - { - CityOfBirthName = g.CityOfBirthName, - FullName = g.FullName, - HasSoulPatch = g.HasSoulPatch, - LeaderNickname = g.LeaderNickname, - LeaderSquadId = g.LeaderSquadId, - Nickname = g.Nickname, - Rank = g.Rank, - SquadId = g.SquadId - } - ) - .ToArray() + .Select(c => + c.StationedGears.OrderByDescending(g => g.Nickname) + .Select(g => new Officer + { + CityOfBirthName = g.CityOfBirthName, + FullName = g.FullName, + HasSoulPatch = g.HasSoulPatch, + LeaderNickname = g.LeaderNickname, + LeaderSquadId = g.LeaderSquadId, + Nickname = g.Nickname, + Rank = g.Rank, + SquadId = g.SquadId + }) + .ToArray() ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -6609,11 +6442,10 @@ public virtual Task String_concat_nullable_expressions_are_coalesced(bool async) ss => ss.Set().Select(w => w.FullName + null + w.LeaderNickname + nullableParam), ss => ss.Set() - .Select( - w => - w.FullName + string.Empty + w.LeaderNickname - ?? string.Empty + nullableParam - ?? string.Empty + .Select(w => + w.FullName + string.Empty + w.LeaderNickname + ?? string.Empty + nullableParam + ?? string.Empty ) ); } @@ -6739,15 +6571,12 @@ public virtual Task Group_by_with_include_with_entity_in_result_selector(bool as .Include(g => g.CityOfBirth) .GroupBy(g => g.Rank) .OrderBy(g => g.Key) - .Select( - g => - new - { - g.Key, - c = g.Count(), - element = g.OrderBy(gg => gg.Nickname).FirstOrDefault() - } - ), + .Select(g => new + { + g.Key, + c = g.Count(), + element = g.OrderBy(gg => gg.Nickname).FirstOrDefault() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -6924,8 +6753,8 @@ public virtual Task GetValueOrDefault_with_argument_complex(bool async) => .Where(w => w.SynergyWithId.GetValueOrDefault(w.Name.Length + 42) > 10), ss => ss.Set() - .Where( - w => (w.SynergyWithId == null ? w.Name.Length + 42 : w.SynergyWithId) > 10 + .Where(w => + (w.SynergyWithId == null ? w.Name.Length + 42 : w.SynergyWithId) > 10 ) ); @@ -6989,10 +6818,9 @@ bool async .Where(t => t.Note.Substring(0, t.Gear.Squad.Name.Length) == t.GearNickName), ss => ss.Set() - .Where( - t => - t.Gear.Maybe(x => t.Note.Substring(0, x.Squad.Name.Length)) - == t.GearNickName + .Where(t => + t.Gear.Maybe(x => t.Note.Substring(0, x.Squad.Name.Length)) + == t.GearNickName ) ); @@ -7179,13 +7007,12 @@ public virtual Task Bool_projection_from_subquery_treated_appropriately_in_where async, ss => ss.Set() - .Where( - c => - ss.Set() - .OrderBy(g => g.Nickname) - .ThenBy(g => g.SquadId) - .FirstOrDefault() - .HasSoulPatch + .Where(c => + ss.Set() + .OrderBy(g => g.Nickname) + .ThenBy(g => g.SquadId) + .FirstOrDefault() + .HasSoulPatch ) ); @@ -7202,11 +7029,8 @@ public virtual Task DateTimeOffset_Contains_Less_than_Greater_than(bool async) async, ss => ss.Set() - .Where( - m => - start <= m.Timeline.Date - && m.Timeline < end - && dates.Contains(m.Timeline) + .Where(m => + start <= m.Timeline.Date && m.Timeline < end && dates.Contains(m.Timeline) ) ); } @@ -7231,11 +7055,10 @@ public virtual Task Navigation_inside_interpolated_string_expanded(bool async) = async, ss => ss.Set() - .Select( - w => - w.SynergyWithId.HasValue - ? $"SynergyWithOwner: {w.SynergyWith.OwnerFullName}" - : string.Empty + .Select(w => + w.SynergyWithId.HasValue + ? $"SynergyWithOwner: {w.SynergyWith.OwnerFullName}" + : string.Empty ) ); @@ -7539,21 +7362,15 @@ bool async ss => ss.Set() .OrderBy(g => g.Nickname) - .Select( - g => - new - { - Weapons = g.Weapons.Select( - w => - new - { - w.Id, - w.IsAutomatic, - w.SynergyWith.Name - } - ) - } - ), + .Select(g => new + { + Weapons = g.Weapons.Select(w => new + { + w.Id, + w.IsAutomatic, + w.SynergyWith.Name + }) + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Weapons, a.Weapons, elementSorter: ee => ee.Id) @@ -7589,15 +7406,12 @@ bool async ss => ss.Set() .OrderBy(e => e.Note) - .Select( - t => - new - { - Items = t.Gear != null - ? t.Gear.Weapons.Select(w => new { w.Owner.Nickname }).ToList() - : null - } - ), + .Select(t => new + { + Items = t.Gear != null + ? t.Gear.Weapons.Select(w => new { w.Owner.Nickname }).ToList() + : null + }), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e.Items, a.Items, elementSorter: ee => ee.Nickname) @@ -7787,10 +7601,11 @@ public virtual Task Project_entity_and_collection_element(bool async) ss.Set() .Include(g => g.Squad) .Include(g => g.Weapons) - .Select( - g => - new { gear = g, weapon = g.Weapons.OrderBy(w => w.Id).FirstOrDefault() } - ), + .Select(g => new + { + gear = g, + weapon = g.Weapons.OrderBy(w => w.Id).FirstOrDefault() + }), elementSorter: e => e.gear.Nickname, elementAsserter: (e, a) => { @@ -7816,15 +7631,12 @@ from g in ss.Set() select new { g.CityOfBirth.Name, Count = g.Weapons.Count() } ) .GroupBy(x => new { x.Name, x.Count }) - .Select( - g => - new - { - g.Key.Name, - g.Key.Count, - Sum = g.Sum(xx => xx.Count) - } - ), + .Select(g => new + { + g.Key.Name, + g.Key.Count, + Sum = g.Sum(xx => xx.Count) + }), elementSorter: e => (e.Name, e.Count, e.Sum) ); @@ -7877,35 +7689,26 @@ public virtual Task GroupBy_with_boolean_grouping_key(bool async) => async, ss => ss.Set() - .Select( - g => - new - { - g.Nickname, - g.CityOfBirthName, - g.HasSoulPatch, - IsMarcus = g.Nickname == "Marcus" - } - ) - .GroupBy( - g => - new - { - g.CityOfBirthName, - g.HasSoulPatch, - g.IsMarcus - } - ) - .Select( - x => - new - { - x.Key.CityOfBirthName, - x.Key.HasSoulPatch, - x.Key.IsMarcus, - Count = x.Count() - } - ), + .Select(g => new + { + g.Nickname, + g.CityOfBirthName, + g.HasSoulPatch, + IsMarcus = g.Nickname == "Marcus" + }) + .GroupBy(g => new + { + g.CityOfBirthName, + g.HasSoulPatch, + g.IsMarcus + }) + .Select(x => new + { + x.Key.CityOfBirthName, + x.Key.HasSoulPatch, + x.Key.IsMarcus, + Count = x.Count() + }), elementSorter: e => (e.CityOfBirthName, e.HasSoulPatch, e.IsMarcus, e.Count) ); @@ -7916,23 +7719,24 @@ public virtual Task GroupBy_with_boolean_groupin_key_thru_navigation_access(bool async, ss => ss.Set() - .GroupBy( - t => new { HasSoulPatch = (bool?)t.Gear.HasSoulPatch, t.Gear.Squad.Name } - ) + .GroupBy(t => new + { + HasSoulPatch = (bool?)t.Gear.HasSoulPatch, + t.Gear.Squad.Name + }) .Select(g => new { g.Key.HasSoulPatch, Name = g.Key.Name.ToLower() }), ss => ss.Set() - .GroupBy( - t => - new - { - HasSoulPatch = t.Gear.MaybeScalar(x => x.HasSoulPatch), - t.Gear.Squad.Name - } - ) - .Select( - g => new { g.Key.HasSoulPatch, Name = g.Key.Name.Maybe(x => x.ToLower()) } - ), + .GroupBy(t => new + { + HasSoulPatch = t.Gear.MaybeScalar(x => x.HasSoulPatch), + t.Gear.Squad.Name + }) + .Select(g => new + { + g.Key.HasSoulPatch, + Name = g.Key.Name.Maybe(x => x.ToLower()) + }), elementSorter: e => (e.HasSoulPatch, e.Name) ); @@ -7945,16 +7749,13 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - g.Nickname, - AssignedCityName = g.AssignedCity.Name, - CityOfBirthName = g.CityOfBirth.Name, - SquadName = g.Squad.Name - } - ) + .Select(g => new + { + g.Nickname, + AssignedCityName = g.AssignedCity.Name, + CityOfBirthName = g.CityOfBirth.Name, + SquadName = g.Squad.Name + }) .GroupBy(x => x.CityOfBirthName) .Select(g => g.Key) ); @@ -8101,10 +7902,9 @@ bool async async, ss => ss.Set() - .Where( - g => - g.AssignedCity - == ss.Set().OrderBy(s => s.Nickname).FirstOrDefault().CityOfBirth + .Where(g => + g.AssignedCity + == ss.Set().OrderBy(s => s.Nickname).FirstOrDefault().CityOfBirth ) ); @@ -8143,12 +7943,10 @@ bool isAsync isAsync, ss => ss.Set() - .Where( - g => - g.HasSoulPatch == prm - ? ss.Set().Where(w => w.Id == g.SquadId).Single().Name - == prm2 - : g.CityOfBirthName == prm3 + .Where(g => + g.HasSoulPatch == prm + ? ss.Set().Where(w => w.Id == g.SquadId).Single().Name == prm2 + : g.CityOfBirthName == prm3 ) ); } @@ -8238,15 +8036,12 @@ public virtual Task Join_inner_source_custom_projection_followed_by_filter(bool from ll in ss.Set() join h in ss.Set() .OfType() - .Select( - f => - new - { - IsEradicated = f.Name == "Locust" ? (bool?)true : null, - f.CommanderName, - f.Name - } - ) + .Select(f => new + { + IsEradicated = f.Name == "Locust" ? (bool?)true : null, + f.CommanderName, + f.Name + }) on ll.Name equals h.CommanderName where h.IsEradicated != true select h @@ -8355,11 +8150,8 @@ bool async async, ss => ss.Set() - .Select( - g => - g.Nickname == null && g.Nickname != null - ? g.CityOfBirthName - : g.FullName + .Select(g => + g.Nickname == null && g.Nickname != null ? g.CityOfBirthName : g.FullName ) ); @@ -8370,11 +8162,8 @@ public virtual Task Conditional_with_conditions_evaluating_to_true_gets_optimize async, ss => ss.Set() - .Select( - g => - g.Nickname == null || g.Nickname != null - ? g.CityOfBirthName - : g.FullName + .Select(g => + g.Nickname == null || g.Nickname != null ? g.CityOfBirthName : g.FullName ) ); @@ -8515,11 +8304,10 @@ public virtual Task Contains_on_collection_of_byte_subquery(bool async) => async, ss => ss.Set() - .Where( - l => - ss.Set() - .Select(ll => ll.ThreatLevelByte) - .Contains(l.ThreatLevelByte) + .Where(l => + ss.Set() + .Select(ll => ll.ThreatLevelByte) + .Contains(l.ThreatLevelByte) ) ); @@ -8530,11 +8318,10 @@ public virtual Task Contains_on_collection_of_nullable_byte_subquery(bool async) async, ss => ss.Set() - .Where( - l => - ss.Set() - .Select(ll => ll.ThreatLevelNullableByte) - .Contains(l.ThreatLevelNullableByte) + .Where(l => + ss.Set() + .Select(ll => ll.ThreatLevelNullableByte) + .Contains(l.ThreatLevelNullableByte) ) ); @@ -8547,11 +8334,10 @@ bool async async, ss => ss.Set() - .Where( - l => - ss.Set() - .Select(ll => ll.ThreatLevelNullableByte) - .Contains(null) + .Where(l => + ss.Set() + .Select(ll => ll.ThreatLevelNullableByte) + .Contains(null) ) ); @@ -8565,11 +8351,10 @@ public virtual Task Contains_on_collection_of_nullable_byte_subquery_null_parame async, ss => ss.Set() - .Where( - l => - ss.Set() - .Select(ll => ll.ThreatLevelNullableByte) - .Contains(prm) + .Where(l => + ss.Set() + .Select(ll => ll.ThreatLevelNullableByte) + .Contains(prm) ) ); } @@ -8601,15 +8386,13 @@ bool async async, ss => ss.Set() - .SelectMany( - l => - ss.Set() - .Where( - g => - ss.Set() - .Select(x => x.ThreatLevelByte) - .Contains(l.ThreatLevelByte) - ) + .SelectMany(l => + ss.Set() + .Where(g => + ss.Set() + .Select(x => x.ThreatLevelByte) + .Contains(l.ThreatLevelByte) + ) ) ); @@ -8622,15 +8405,13 @@ bool async async, ss => ss.Set() - .SelectMany( - l => - ss.Set() - .Where( - g => - !ss.Set() - .Select(x => x.ThreatLevelByte) - .Contains(l.ThreatLevelByte) - ) + .SelectMany(l => + ss.Set() + .Where(g => + !ss.Set() + .Select(x => x.ThreatLevelByte) + .Contains(l.ThreatLevelByte) + ) ), assertEmpty: true ); @@ -8644,15 +8425,13 @@ bool async async, ss => ss.Set() - .SelectMany( - l => - ss.Set() - .Where( - g => - ss.Set() - .Select(x => x.ThreatLevelNullableByte) - .Contains(l.ThreatLevelNullableByte) - ) + .SelectMany(l => + ss.Set() + .Where(g => + ss.Set() + .Select(x => x.ThreatLevelNullableByte) + .Contains(l.ThreatLevelNullableByte) + ) ) ); @@ -8665,15 +8444,13 @@ bool async async, ss => ss.Set() - .SelectMany( - l => - ss.Set() - .Where( - g => - !ss.Set() - .Select(x => x.ThreatLevelNullableByte) - .Contains(l.ThreatLevelNullableByte) - ) + .SelectMany(l => + ss.Set() + .Where(g => + !ss.Set() + .Select(x => x.ThreatLevelNullableByte) + .Contains(l.ThreatLevelNullableByte) + ) ), assertEmpty: true ); @@ -8748,8 +8525,8 @@ public virtual Task Enum_array_contains(bool async) async, ss => ss.Set() - .Where( - w => w.SynergyWith != null && types.Contains(w.SynergyWith.AmmunitionType) + .Where(w => + w.SynergyWith != null && types.Contains(w.SynergyWith.AmmunitionType) ) ); } @@ -8801,12 +8578,11 @@ public virtual Task Trying_to_access_unmapped_property_inside_subquery(bool asyn async, ss => ss.Set() - .Where( - c => - ss.Set() - .Where(g => g.IsMarcus) - .Select(g => g.Nickname) - .FirstOrDefault() == "Marcus" + .Where(c => + ss.Set() + .Where(g => g.IsMarcus) + .Select(g => g.Nickname) + .FirstOrDefault() == "Marcus" ) ), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear)) @@ -8839,13 +8615,10 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - nested = ss.Set().Where(gg => gg.IsMarcus).ToList() - } - ) + .Select(g => new + { + nested = ss.Set().Where(gg => gg.IsMarcus).ToList() + }) ), CoreStrings.QueryUnableToTranslateMember(nameof(Gear.IsMarcus), nameof(Gear)) ); @@ -8857,10 +8630,9 @@ public virtual Task Client_member_and_unsupported_string_Equals_in_the_same_quer async, ss => ss.Set() - .Where( - g => - g.FullName.Equals(g.Nickname, StringComparison.InvariantCulture) - || g.IsMarcus + .Where(g => + g.FullName.Equals(g.Nickname, StringComparison.InvariantCulture) + || g.IsMarcus ) ); @@ -8884,15 +8656,12 @@ bool async ss => ss.Set() .GroupBy(w => new { w.Owner.CityOfBirth.Name, w.Owner.CityOfBirth.Location }) - .Select( - x => - new - { - x.Key.Name, - x.Key.Location, - Count = x.Count() - } - ) + .Select(x => new + { + x.Key.Name, + x.Key.Location, + Count = x.Count() + }) .OrderBy(x => x.Location), assertOrder: true ); @@ -8979,11 +8748,8 @@ bool async async, ss => ss.Set() - .SelectMany( - g => - ss.Set() - .Where(x => x.OwnerFullName != g.FullName) - .DefaultIfEmpty() + .SelectMany(g => + ss.Set().Where(x => x.OwnerFullName != g.FullName).DefaultIfEmpty() ) ); @@ -9063,12 +8829,11 @@ public virtual Task FirstOrDefault_over_int_compared_to_zero(bool async) => ss => ss.Set() .Where(s => s.Name == "Delta") - .Where( - s => - s.Members.Where(m => m.HasSoulPatch) - .OrderBy(m => m.FullName) - .Select(m => m.SquadId) - .FirstOrDefault() != 0 + .Where(s => + s.Members.Where(m => m.HasSoulPatch) + .OrderBy(m => m.FullName) + .Select(m => m.SquadId) + .FirstOrDefault() != 0 ) .Select(s => s.Name), elementSorter: e => e @@ -9118,8 +8883,7 @@ await AssertQuery( async, ss => ss.Set() - .Where( - ll => ll is LocustCommander && (ll as LocustCommander).HighCommandId != 0 + .Where(ll => ll is LocustCommander && (ll as LocustCommander).HighCommandId != 0 ) ); } @@ -9165,15 +8929,12 @@ public virtual Task Correlated_collection_take(bool async) => async, ss => ss.Set() - .Select( - g => - new - { - g.Nickname, - Weapons = g.Weapons.Take(10).ToList(), - g.CityOfBirth - } - ), + .Select(g => new + { + g.Nickname, + Weapons = g.Weapons.Take(10).ToList(), + g.CityOfBirth + }), elementSorter: e => e.Nickname, elementAsserter: (e, a) => { @@ -9303,21 +9064,18 @@ public virtual Task Projecting_property_converted_to_nullable_with_comparison(bo async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.SquadId == 1) ); @@ -9328,39 +9086,33 @@ public virtual Task Projecting_property_converted_to_nullable_with_addition(bool async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.SquadId + 1 == 2), ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable != null && x.Nullable.SquadId + 1 == 2) ); @@ -9373,21 +9125,18 @@ bool async async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .Select(x => new { x.Note, Value = x.Nullable.SquadId + 1 }) ); @@ -9399,21 +9148,18 @@ public virtual Task Projecting_property_converted_to_nullable_with_conditional(b async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Select(x => x.Note != "K.I.A." ? x.Nullable.SquadId : -1) ); @@ -9424,21 +9170,18 @@ public virtual Task Projecting_property_converted_to_nullable_with_function_call async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Select(x => x.Nullable.Nickname.Substring(0, 3)), ss => ss.Set() @@ -9452,53 +9195,46 @@ public virtual Task Projecting_property_converted_to_nullable_with_function_call async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) - .Select( - x => new { x.Note, Function = x.Note.Substring(0, x.Nullable.SquadId) } - ), + .Select(x => new + { + x.Note, + Function = x.Note.Substring(0, x.Nullable.SquadId) + }), ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) - .Select( - x => - new - { - x.Note, - Function = x.Nullable == null - ? null - : x.Note.Substring(0, x.Nullable.SquadId) - } - ) + .Select(x => new + { + x.Note, + Function = x.Nullable == null + ? null + : x.Note.Substring(0, x.Nullable.SquadId) + }) ); [ConditionalTheory] @@ -9508,33 +9244,27 @@ public virtual Task Projecting_property_converted_to_nullable_into_element_init( async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) - .Select( - x => - new List - { - x.Nullable.Nickname.Length, - x.Nullable.SquadId, - x.Nullable.SquadId + 1, - 42 - } - ), + .Select(x => new List + { + x.Nullable.Nickname.Length, + x.Nullable.SquadId, + x.Nullable.SquadId + 1, + 42 + }), assertOrder: true ); @@ -9547,21 +9277,18 @@ bool async async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) .Select(x => new Squad { Id = x.Nullable.SquadId }), @@ -9575,32 +9302,28 @@ public virtual Task Projecting_property_converted_to_nullable_into_new_array(boo async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) - .Select( - x => - new[] - { - x.Nullable.Nickname.Length, - x.Nullable.SquadId, - x.Nullable.SquadId + 1, - 42 - } + .Select(x => + new[] + { + x.Nullable.Nickname.Length, + x.Nullable.SquadId, + x.Nullable.SquadId + 1, + 42 + } ), assertOrder: true ); @@ -9612,21 +9335,18 @@ public virtual Task Projecting_property_converted_to_nullable_into_unary(bool as async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Note) .Where(x => !x.Nullable.HasSoulPatch) @@ -9641,17 +9361,12 @@ public virtual Task Projecting_property_converted_to_nullable_into_member_access async, ss => ss.Set() - .Select( - x => - new - { - x.Nickname, - x.CityOfBirthName, - Nullable = x.CityOfBirthName != null - ? new { x.Tag.IssueDate } - : null - } - ) + .Select(x => new + { + x.Nickname, + x.CityOfBirthName, + Nullable = x.CityOfBirthName != null ? new { x.Tag.IssueDate } : null + }) .Where(x => x.CityOfBirthName != null) .OrderBy(x => x.Nickname) .Where(x => x.Nullable.IssueDate.Month != 5) @@ -9668,21 +9383,18 @@ bool async async, ss => ss.Set() - .Select( - x => - new + .Select(x => new + { + x.Note, + Nullable = x.GearNickName != null + ? new { - x.Note, - Nullable = x.GearNickName != null - ? new - { - x.Gear.Nickname, - x.Gear.SquadId, - x.Gear.HasSoulPatch - } - : null + x.Gear.Nickname, + x.Gear.SquadId, + x.Gear.HasSoulPatch } - ) + : null + }) .Where(x => x.Nullable.Nickname != null) .OrderBy(x => x.Nullable.SquadId) .ThenBy(x => x.Note), @@ -9698,16 +9410,11 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Id, w.Name }) - .Distinct() - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Id, w.Name }).Distinct().ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9734,24 +9441,18 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select( - w => - new - { - w.Id, - w.Name, - w.OwnerFullName - } - ) - .Distinct() - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new + { + w.Id, + w.Name, + w.OwnerFullName + }) + .Distinct() + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9779,24 +9480,18 @@ bool async async, ss => ss.Set() - .Select( - s => - new - { - Key = s.Id, - Subquery = s.Members.Select( - m => - new - { - m.Nickname, - m.SquadId, - m.HasSoulPatch - } - ) - .Distinct() - .ToList() - } - ), + .Select(s => new + { + Key = s.Id, + Subquery = s.Members.Select(m => new + { + m.Nickname, + m.SquadId, + m.HasSoulPatch + }) + .Distinct() + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9824,16 +9519,13 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) - .Distinct() - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) + .Distinct() + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9860,24 +9552,18 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select( - w => - new - { - w.Name, - w.IsAutomatic, - w.OwnerFullName.Length - } - ) - .Distinct() - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new + { + w.Name, + w.IsAutomatic, + w.OwnerFullName.Length + }) + .Distinct() + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9905,17 +9591,14 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.IsAutomatic) - .Select(x => new { x.Key }) - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.IsAutomatic) + .Select(x => new { x.Key }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9941,17 +9624,14 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.IsAutomatic) - .Select(x => new { x.Key, Count = x.Count() }) - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.IsAutomatic) + .Select(x => new { x.Key, Count = x.Count() }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -9978,17 +9658,14 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => new { x.IsAutomatic, x.Name }) - .Select(x => new { x.Key, Count = x.Count() }) - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => new { x.IsAutomatic, x.Name }) + .Select(x => new { x.Key, Count = x.Count() }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -10016,17 +9693,14 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - Key = g.Nickname, - Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) - .GroupBy(x => x.Name.Length) - .Select(x => new { x.Key, Count = x.Count() }) - .ToList() - } - ), + .Select(g => new + { + Key = g.Nickname, + Subquery = g.Weapons.Select(w => new { w.Name, w.IsAutomatic }) + .GroupBy(x => x.Name.Length) + .Select(x => new { x.Key, Count = x.Count() }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -10054,25 +9728,22 @@ bool async ss => ss.Set() .OrderBy(g => g.Nickname) - .Select( - g => - g.Weapons.SelectMany(x => x.Owner.AssignedCity.BornGears) - .Select(x => (bool?)x.HasSoulPatch) - .Distinct() - .ToList() + .Select(g => + g.Weapons.SelectMany(x => x.Owner.AssignedCity.BornGears) + .Select(x => (bool?)x.HasSoulPatch) + .Distinct() + .ToList() ), ss => ss.Set() .OrderBy(g => g.Nickname) - .Select( - g => - g.Weapons.SelectMany( - x => - x.Owner.AssignedCity.Maybe(x => x.BornGears) ?? new List() - ) - .Select(x => (bool?)x.HasSoulPatch) - .Distinct() - .ToList() + .Select(g => + g.Weapons.SelectMany(x => + x.Owner.AssignedCity.Maybe(x => x.BornGears) ?? new List() + ) + .Select(x => (bool?)x.HasSoulPatch) + .Distinct() + .ToList() ), elementAsserter: (e, a) => AssertCollection(e, a, elementSorter: ee => ee), assertOrder: true @@ -10097,15 +9768,12 @@ bool async async, ss => ss.Set() - .Select( - g => - new - { - g.FullName, - g.HasSoulPatch, - g.Weapons - } - ) + .Select(g => new + { + g.FullName, + g.HasSoulPatch, + g.Weapons + }) .Distinct(), elementSorter: e => e.FullName, elementAsserter: (e, a) => @@ -10141,9 +9809,11 @@ bool async async, ss => ss.Set() - .Select( - g => new { g, Weapons = g.Weapons.Where(w => w.Id == g.SquadId).ToList() } - ) + .Select(g => new + { + g, + Weapons = g.Weapons.Where(w => w.Id == g.SquadId).ToList() + }) .Distinct(), elementSorter: e => e.g.FullName, elementAsserter: (e, a) => @@ -10179,25 +9849,16 @@ public virtual Task Correlated_collection_with_distinct_3_levels(bool async) => async, ss => ss.Set() - .Select( - s => - new - { - s, - Members = s.Members.Select( - m => - new - { - m, - Weapons = m.Weapons.Where( - w => w.OwnerFullName == m.FullName - ) - .ToList() - } - ) - .Distinct() - } - ) + .Select(s => new + { + s, + Members = s.Members.Select(m => new + { + m, + Weapons = m.Weapons.Where(w => w.OwnerFullName == m.FullName).ToList() + }) + .Distinct() + }) .Distinct(), elementSorter: e => e.s.Id ); @@ -10211,47 +9872,41 @@ public virtual Task Correlated_collection_after_distinct_3_levels(bool async) => ss.Set() .Select(s => new { s.Id, s.Name }) .Distinct() - .Select( - x => - new + .Select(x => new + { + x.Id, + x.Name, + Subquery1 = ( + from g in ss.Set() + where g.SquadId == x.Id + select new + { + g.Nickname, + g.FullName, + g.HasSoulPatch + } + ) + .Distinct() + .Select(xx => new { - x.Id, - x.Name, - Subquery1 = ( - from g in ss.Set() - where g.SquadId == x.Id + xx.Nickname, + xx.FullName, + xx.HasSoulPatch, + Subquery2 = ( + from w in ss.Set() + where w.OwnerFullName == xx.FullName select new { - g.Nickname, - g.FullName, - g.HasSoulPatch + x.Id, + x.Name, + xx.Nickname, + xx.FullName, + xx.HasSoulPatch } - ) - .Distinct() - .Select( - xx => - new - { - xx.Nickname, - xx.FullName, - xx.HasSoulPatch, - Subquery2 = ( - from w in ss.Set() - where w.OwnerFullName == xx.FullName - select new - { - x.Id, - x.Name, - xx.Nickname, - xx.FullName, - xx.HasSoulPatch - } - ).ToList() - } - ) - .ToList() - } - ), + ).ToList() + }) + .ToList() + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -10295,37 +9950,31 @@ bool async ss.Set() .Select(s => new { s.Name.Length }) .Distinct() - .Select( - x => - new + .Select(x => new + { + x.Length, + Subquery1 = ( + from g in ss.Set() + where g.Nickname.Length == x.Length + select new { g.HasSoulPatch, g.CityOfBirthName } + ) + .Distinct() + .Select(xx => new { - x.Length, - Subquery1 = ( - from g in ss.Set() - where g.Nickname.Length == x.Length - select new { g.HasSoulPatch, g.CityOfBirthName } - ) - .Distinct() - .Select( - xx => - new - { - xx.HasSoulPatch, - Subquery2 = ( - from w in ss.Set() - where w.OwnerFullName == xx.CityOfBirthName - select new - { - w.Id, - x.Length, - xx.HasSoulPatch - } - ).ToList() - } - ) - .ToList() - } - ), + xx.HasSoulPatch, + Subquery2 = ( + from w in ss.Set() + where w.OwnerFullName == xx.CityOfBirthName + select new + { + w.Id, + x.Length, + xx.HasSoulPatch + } + ).ToList() + }) + .ToList() + }), elementSorter: e => e.Length, elementAsserter: (e, a) => { @@ -10549,58 +10198,52 @@ bool async async, ss => ss.Set() - .Select( - g => - new + .Select(g => new + { + Gear = g, + (g as Officer).Tag, + IsNull = (g as Officer).Tag == null, + Property = (g as Officer).Nickname, + PropertyAfterNavigation = (g as Officer).Tag.Id, + NestedOuter = new + { + (g as Officer).CityOfBirth, + IsNull = (g as Officer).CityOfBirth == null, + Property = (g as Officer).Nickname, + PropertyAfterNavigation = (g as Officer).CityOfBirth.Name, + NestedInner = new { - Gear = g, - (g as Officer).Tag, - IsNull = (g as Officer).Tag == null, + (g as Officer).Squad, + IsNull = (g as Officer).Squad == null, Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).Tag.Id, - NestedOuter = new - { - (g as Officer).CityOfBirth, - IsNull = (g as Officer).CityOfBirth == null, - Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).CityOfBirth.Name, - NestedInner = new - { - (g as Officer).Squad, - IsNull = (g as Officer).Squad == null, - Property = (g as Officer).Nickname, - PropertyAfterNavigation = (g as Officer).Squad.Id - } - } + PropertyAfterNavigation = (g as Officer).Squad.Id } - ), + } + }), ss => ss.Set() - .Select( - g => - new + .Select(g => new + { + Gear = g, + g.Tag, + IsNull = g.Tag == null, + Property = g.Nickname, + PropertyAfterNavigation = g.Tag.Id, + NestedOuter = new + { + g.CityOfBirth, + IsNull = g.CityOfBirth == null, + Property = g.Nickname, + PropertyAfterNavigation = g.CityOfBirth.Name, + NestedInner = new { - Gear = g, - g.Tag, - IsNull = g.Tag == null, + g.Squad, + IsNull = g.Squad == null, Property = g.Nickname, - PropertyAfterNavigation = g.Tag.Id, - NestedOuter = new - { - g.CityOfBirth, - IsNull = g.CityOfBirth == null, - Property = g.Nickname, - PropertyAfterNavigation = g.CityOfBirth.Name, - NestedInner = new - { - g.Squad, - IsNull = g.Squad == null, - Property = g.Nickname, - PropertyAfterNavigation = g.Squad.Id - } - } + PropertyAfterNavigation = g.Squad.Id } - ), + } + }), elementSorter: e => e.Gear.Nickname, elementAsserter: (e, a) => { @@ -10637,70 +10280,60 @@ bool async async, ss => ss.Set() - .Select( - l => - new + .Select(l => new + { + Leader = l, + (l as LocustCommander).DefeatedBy, + IsNull = (l as LocustCommander).DefeatedBy == null, + Property = (l as LocustCommander).DefeatedByNickname, + PropertyAfterNavigation = (bool?) + (l as LocustCommander).DefeatedBy.HasSoulPatch, + NestedOuter = new + { + (l as LocustCommander).CommandingFaction, + IsNull = (l as LocustCommander).CommandingFaction == null, + Property = (int?)(l as LocustCommander).HighCommandId, + PropertyAfterNavigation = (l as LocustCommander) + .CommandingFaction + .Eradicated, + NestedInner = new { - Leader = l, - (l as LocustCommander).DefeatedBy, - IsNull = (l as LocustCommander).DefeatedBy == null, - Property = (l as LocustCommander).DefeatedByNickname, - PropertyAfterNavigation = (bool?) - (l as LocustCommander).DefeatedBy.HasSoulPatch, - NestedOuter = new - { - (l as LocustCommander).CommandingFaction, - IsNull = (l as LocustCommander).CommandingFaction == null, - Property = (int?)(l as LocustCommander).HighCommandId, - PropertyAfterNavigation = (l as LocustCommander) - .CommandingFaction - .Eradicated, - NestedInner = new - { - (l as LocustCommander).HighCommand, - IsNull = (l as LocustCommander).HighCommand == null, - Property = (l as LocustCommander).DefeatedBySquadId, - PropertyAfterNavigation = (l as LocustCommander) - .HighCommand - .Name - } - } + (l as LocustCommander).HighCommand, + IsNull = (l as LocustCommander).HighCommand == null, + Property = (l as LocustCommander).DefeatedBySquadId, + PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name } - ), + } + }), ss => ss.Set() - .Select( - l => - new + .Select(l => new + { + Leader = l, + (l as LocustCommander).DefeatedBy, + IsNull = (l as LocustCommander).DefeatedBy == null, + Property = (l as LocustCommander).DefeatedByNickname, + PropertyAfterNavigation = (bool?) + (l as LocustCommander).DefeatedBy.HasSoulPatch, + NestedOuter = new + { + (l as LocustCommander).CommandingFaction, + IsNull = (l as LocustCommander).CommandingFaction == null, + Property = (int?)(l as LocustCommander).HighCommandId, + PropertyAfterNavigation = ( + l as LocustCommander + ).CommandingFaction.MaybeScalar(x => x.Eradicated), + NestedInner = new { - Leader = l, - (l as LocustCommander).DefeatedBy, - IsNull = (l as LocustCommander).DefeatedBy == null, - Property = (l as LocustCommander).DefeatedByNickname, - PropertyAfterNavigation = (bool?) - (l as LocustCommander).DefeatedBy.HasSoulPatch, - NestedOuter = new - { - (l as LocustCommander).CommandingFaction, - IsNull = (l as LocustCommander).CommandingFaction == null, - Property = (int?)(l as LocustCommander).HighCommandId, - PropertyAfterNavigation = ( - l as LocustCommander - ).CommandingFaction.MaybeScalar(x => x.Eradicated), - NestedInner = new - { - (l as LocustCommander).HighCommand, - IsNull = (l as LocustCommander).HighCommand == null, - Property = (l as LocustCommander).MaybeScalar( - x => x.DefeatedBySquadId - ), - PropertyAfterNavigation = (l as LocustCommander) - .HighCommand - .Name - } - } + (l as LocustCommander).HighCommand, + IsNull = (l as LocustCommander).HighCommand == null, + Property = (l as LocustCommander).MaybeScalar(x => + x.DefeatedBySquadId + ), + PropertyAfterNavigation = (l as LocustCommander).HighCommand.Name } - ), + } + }), elementSorter: e => e.Leader.Name, elementAsserter: (e, a) => { @@ -10810,11 +10443,10 @@ bool async async, ss => ss.Set() - .Where( - s => - s.Members.Where(m => m.FullName == "Anthony Carmine") - .OrderBy(e => e.Nickname) - .FirstOrDefault() == null + .Where(s => + s.Members.Where(m => m.FullName == "Anthony Carmine") + .OrderBy(e => e.Nickname) + .FirstOrDefault() == null ) ); @@ -10837,11 +10469,10 @@ bool async async, ss => ss.Set() - .Where( - s => - s.Weapons.Where(w => w.Name == "Hammer of Dawn") - .OrderBy(e => e.Name) - .FirstOrDefault() == null + .Where(s => + s.Weapons.Where(w => w.Name == "Hammer of Dawn") + .OrderBy(e => e.Name) + .FirstOrDefault() == null ) ); @@ -10887,17 +10518,14 @@ public virtual Task Where_subquery_with_ElementAt_using_column_as_index(bool asy async, ss => ss.Set() - .Where( - s => - s.Members.OrderBy(m => m.Nickname).ElementAt(s.Id).Nickname - == "Cole Train" + .Where(s => + s.Members.OrderBy(m => m.Nickname).ElementAt(s.Id).Nickname == "Cole Train" ), ss => ss.Set() - .Where( - s => - s.Members.OrderBy(m => m.Nickname).ElementAtOrDefault(s.Id).Nickname - == "Cole Train" + .Where(s => + s.Members.OrderBy(m => m.Nickname).ElementAtOrDefault(s.Id).Nickname + == "Cole Train" ) ); @@ -10908,15 +10536,12 @@ public virtual Task Using_indexer_on_byte_array_and_string_in_projection(bool as async, ss => ss.Set() - .Select( - x => - new - { - x.Id, - ByteArray = x.Banner[0], - String = x.Name[1] - } - ), + .Select(x => new + { + x.Id, + ByteArray = x.Banner[0], + String = x.Name[1] + }), elementSorter: e => e.Id, elementAsserter: (e, a) => { @@ -10937,14 +10562,11 @@ public virtual Task DateTimeOffset_to_unix_time_milliseconds(bool async) ss => ss.Set() .Include(g => g.Squad.Missions) - .Where( - s => - s.Squad.Missions.Where( - m => - unixEpochMilliseconds - == m.Mission.Timeline.ToUnixTimeMilliseconds() - ) - .FirstOrDefault() == null + .Where(s => + s.Squad.Missions.Where(m => + unixEpochMilliseconds == m.Mission.Timeline.ToUnixTimeMilliseconds() + ) + .FirstOrDefault() == null ) ); } @@ -10960,12 +10582,11 @@ public virtual Task DateTimeOffset_to_unix_time_seconds(bool async) ss => ss.Set() .Include(g => g.Squad.Missions) - .Where( - s => - s.Squad.Missions.Where( - m => unixEpochSeconds == m.Mission.Timeline.ToUnixTimeSeconds() - ) - .FirstOrDefault() == null + .Where(s => + s.Squad.Missions.Where(m => + unixEpochSeconds == m.Mission.Timeline.ToUnixTimeSeconds() + ) + .FirstOrDefault() == null ) ); } @@ -10977,12 +10598,11 @@ public virtual Task Set_operator_with_navigation_in_projection_groupby_aggregate async, ss => ss.Set() - .Where( - x => - ss.Set() - .Concat(ss.Set()) - .Select(x => x.Nickname) - .Contains("Marcus") + .Where(x => + ss.Set() + .Concat(ss.Set()) + .Select(x => x.Nickname) + .Contains("Marcus") ) .Select(x => new { x.Squad.Name, x.CityOfBirth.Location }) .GroupBy(x => new { x.Name }) @@ -11011,8 +10631,7 @@ public virtual Task Nav_expansion_with_member_pushdown_inside_Contains_argument( async, ss => ss.Set() - .Where( - x => weapons.Contains(x.Weapons.OrderBy(w => w.Id).FirstOrDefault().Name) + .Where(x => weapons.Contains(x.Weapons.OrderBy(w => w.Id).FirstOrDefault().Name) ) ); } @@ -11028,10 +10647,9 @@ public virtual Task Subquery_inside_Take_argument(bool async) ss => ss.Set() .OrderBy(x => x.Nickname) - .Select( - x => - x.Weapons.OrderBy(g => g.Id) - .Take(numbers.OrderBy(xx => xx).Skip(1).FirstOrDefault()) + .Select(x => + x.Weapons.OrderBy(g => g.Id) + .Take(numbers.OrderBy(xx => xx).Skip(1).FirstOrDefault()) ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -11047,10 +10665,8 @@ public virtual Task Nav_expansion_inside_Skip_correlated_to_source(bool async) ss => ss.Set() .OrderBy(x => x.Name) - .Select( - x => - x.BornGears.OrderBy(g => g.FullName) - .Skip(x.StationedGears.Any() ? 1 : 0) + .Select(x => + x.BornGears.OrderBy(g => g.FullName).Skip(x.StationedGears.Any() ? 1 : 0) ) ); } @@ -11081,15 +10697,14 @@ bool async ss => ss.Set() .OrderBy(x => x.Nickname) - .Select( - x => - x.Weapons.OrderBy(g => g.Id) - .Take( - ss.Set() - .OrderBy(xx => xx.Nickname) - .FirstOrDefault() - .AssignedCity.Name.Length - ) + .Select(x => + x.Weapons.OrderBy(g => g.Id) + .Take( + ss.Set() + .OrderBy(xx => xx.Nickname) + .FirstOrDefault() + .AssignedCity.Name.Length + ) ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a, ordered: true) @@ -11105,8 +10720,8 @@ public virtual Task Nav_expansion_inside_ElementAt_correlated_to_source(bool asy ss => ss.Set() .OrderBy(x => x.Nickname) - .Select( - x => x.Weapons.OrderBy(g => g.Id).ElementAt(x.AssignedCity != null ? 1 : 0) + .Select(x => + x.Weapons.OrderBy(g => g.Id).ElementAt(x.AssignedCity != null ? 1 : 0) ) ); } diff --git a/efcore/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs index 72b9afe05ee..b0be6cd7f02 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/IncludeOneToOneTestBase.cs @@ -172,20 +172,18 @@ public abstract class OneToOneQueryFixtureBase : SharedStoreFixtureBase( - e => - e.HasOne(a => a.Resident) - .WithOne(p => p.Address) - .HasPrincipalKey(person => person.Id) + modelBuilder.Entity
(e => + e.HasOne(a => a.Resident) + .WithOne(p => p.Address) + .HasPrincipalKey(person => person.Id) ); modelBuilder.Entity().Property("PersonId"); - modelBuilder.Entity( - e => - e.HasOne(p => p.Address) - .WithOne(a => a.Resident) - .HasForeignKey("PersonId") + modelBuilder.Entity(e => + e.HasOne(p => p.Address) + .WithOne(a => a.Resident) + .HasForeignKey("PersonId") ); } diff --git a/efcore/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs index a0c5adfe26f..857658f8242 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/InheritanceQueryTestBase.cs @@ -227,14 +227,11 @@ public virtual Task Discriminator_used_when_projection_over_derived_type2(bool a async, ss => ss.Set() - .Select( - b => - new - { - b.IsFlightless, - Discriminator = EF.Property(b, "Discriminator") - } - ), + .Select(b => new + { + b.IsFlightless, + Discriminator = EF.Property(b, "Discriminator") + }), ss => ss.Set() .Select(b => new { b.IsFlightless, Discriminator = b.GetType().Name }), @@ -430,10 +427,9 @@ public virtual Task Is_operator_on_result_of_FirstOrDefault(bool async) => async, ss => ss.Set() - .Where( - a => - ss.Set().FirstOrDefault(a1 => a1.Name == "Great spotted kiwi") - is Kiwi + .Where(a => + ss.Set().FirstOrDefault(a1 => a1.Name == "Great spotted kiwi") + is Kiwi ) .OrderBy(a => a.Species), assertOrder: true diff --git a/efcore/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs index 69c4370d0a9..cab5319c091 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/InheritanceRelationshipsQueryTestBase.cs @@ -96,8 +96,8 @@ public virtual Task Include_reference_with_inheritance(bool async) => AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ) ) ); @@ -124,8 +124,8 @@ public virtual Task Include_self_reference_with_inheritance(bool async) => AssertInclude( e, a, - new ExpectedInclude( - x => x.DerivedSefReferenceOnBase + new ExpectedInclude(x => + x.DerivedSefReferenceOnBase ) ) ); @@ -142,8 +142,8 @@ public virtual Task Include_self_reference_with_inheritance_reverse(bool async) AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseSelfReferenceOnDerived + new ExpectedInclude(x => + x.BaseSelfReferenceOnDerived ) ) ); @@ -161,8 +161,8 @@ public virtual Task Include_reference_with_inheritance_with_filter(bool async) = AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ) ) ); @@ -241,8 +241,8 @@ public virtual Task Include_collection_with_inheritance(bool async) => AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnBase + new ExpectedInclude(x => + x.BaseCollectionOnBase ) ) ); @@ -270,8 +270,8 @@ public virtual Task Include_collection_with_inheritance_with_filter(bool async) AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnBase + new ExpectedInclude(x => + x.BaseCollectionOnBase ) ) ); @@ -351,8 +351,8 @@ public virtual Task Include_reference_with_inheritance_on_derived1(bool async) = AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ) ) ); @@ -369,8 +369,8 @@ public virtual Task Include_reference_with_inheritance_on_derived2(bool async) = AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnDerived + new ExpectedInclude(x => + x.BaseReferenceOnDerived ) ) ); @@ -387,8 +387,8 @@ public virtual Task Include_reference_with_inheritance_on_derived4(bool async) = AssertInclude( e, a, - new ExpectedInclude( - x => x.DerivedReferenceOnDerived + new ExpectedInclude(x => + x.DerivedReferenceOnDerived ) ) ); @@ -416,8 +416,8 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter1(b AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ) ) ); @@ -435,8 +435,8 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter2(b AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnDerived + new ExpectedInclude(x => + x.BaseReferenceOnDerived ) ) ); @@ -454,8 +454,8 @@ public virtual Task Include_reference_with_inheritance_on_derived_with_filter4(b AssertInclude( e, a, - new ExpectedInclude( - x => x.DerivedReferenceOnDerived + new ExpectedInclude(x => + x.DerivedReferenceOnDerived ) ) ); @@ -485,8 +485,7 @@ public virtual Task Include_reference_without_inheritance_on_derived1(bool async AssertInclude( e, a, - new ExpectedInclude( - x => x.ReferenceOnBase + new ExpectedInclude(x => x.ReferenceOnBase ) ) ); @@ -501,8 +500,8 @@ public virtual Task Include_reference_without_inheritance_on_derived2(bool async AssertInclude( e, a, - new ExpectedInclude( - x => x.ReferenceOnDerived + new ExpectedInclude(x => + x.ReferenceOnDerived ) ) ); @@ -528,8 +527,8 @@ public virtual Task Include_collection_with_inheritance_on_derived1(bool async) AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnBase + new ExpectedInclude(x => + x.BaseCollectionOnBase ) ) ); @@ -546,8 +545,8 @@ public virtual Task Include_collection_with_inheritance_on_derived2(bool async) AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnDerived + new ExpectedInclude(x => + x.BaseCollectionOnDerived ) ) ); @@ -564,8 +563,8 @@ public virtual Task Include_collection_with_inheritance_on_derived3(bool async) AssertInclude( e, a, - new ExpectedInclude( - x => x.DerivedCollectionOnDerived + new ExpectedInclude(x => + x.DerivedCollectionOnDerived ) ) ); @@ -592,8 +591,8 @@ public virtual Task Nested_include_with_inheritance_reference_reference(bool asy AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ), new ExpectedInclude(x => x.NestedReference) ) @@ -611,8 +610,8 @@ public virtual Task Nested_include_with_inheritance_reference_reference_on_base( AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ), new ExpectedInclude(x => x.NestedReference) ) @@ -645,8 +644,8 @@ public virtual Task Nested_include_with_inheritance_reference_collection(bool as AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ), new ExpectedInclude(x => x.NestedCollection) ) @@ -664,8 +663,8 @@ public virtual Task Nested_include_with_inheritance_reference_collection_on_base AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseReferenceOnBase + new ExpectedInclude(x => + x.BaseReferenceOnBase ), new ExpectedInclude(x => x.NestedCollection) ) @@ -699,8 +698,8 @@ public virtual Task Nested_include_with_inheritance_collection_reference(bool as AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnBase + new ExpectedInclude(x => + x.BaseCollectionOnBase ), new ExpectedInclude(x => x.NestedReference) ) @@ -734,8 +733,8 @@ public virtual Task Nested_include_with_inheritance_collection_collection(bool a AssertInclude( e, a, - new ExpectedInclude( - x => x.BaseCollectionOnBase + new ExpectedInclude(x => + x.BaseCollectionOnBase ), new ExpectedInclude(x => x.NestedCollection) ) @@ -803,8 +802,8 @@ public virtual Task Include_on_derived_type_with_queryable_Cast(bool async) => AssertInclude( e, a, - new ExpectedInclude( - i => i.DerivedCollectionOnDerived + new ExpectedInclude(i => + i.DerivedCollectionOnDerived ) ); } diff --git a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs index 87b7e01015b..1b044b1ba54 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyFieldsQueryFixtureBase.cs @@ -234,15 +234,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder .Entity() - .HasKey( - e => - new - { - e.Key1, - e.Key2, - e.Key3 - } - ); + .HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); modelBuilder.Entity(b => { @@ -387,15 +384,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinThreeFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) .IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired(), b => @@ -427,15 +421,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinLeafFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) ); modelBuilder.SharedTypeEntity( diff --git a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs index db920022ad0..569352b0358 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyNoTrackingQueryTestBase.cs @@ -72,8 +72,8 @@ await Assert.ThrowsAsync( AssertInclude( e, a, - new ExpectedInclude( - et => et.OneSkipPayloadFullShared + new ExpectedInclude(et => + et.OneSkipPayloadFullShared ), new ExpectedInclude( et => et.ThreeSkipPayloadFullShared, diff --git a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs index 7e034b7d8a7..f3ad5efd4e7 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/ManyToManyQueryTestBase.cs @@ -81,8 +81,8 @@ public virtual Task Skip_navigation_long_count_with_predicate(bool async) => async, ss => ss.Set() - .OrderByDescending( - e => e.SelfSkipSharedLeft.LongCount(e => e.Name.StartsWith("L")) + .OrderByDescending(e => + e.SelfSkipSharedLeft.LongCount(e => e.Name.StartsWith("L")) ) .ThenBy(e => e.Id), assertOrder: true @@ -166,8 +166,7 @@ public virtual Task Skip_navigation_order_by_single_or_default(bool async) => async, ss => ss.Set() - .Select( - e => e.SelfSkipPayloadRight.OrderBy(i => i.Id).Take(1).SingleOrDefault() + .Select(e => e.SelfSkipPayloadRight.OrderBy(i => i.Id).Take(1).SingleOrDefault() ) ); @@ -574,11 +573,10 @@ public virtual Task Filtered_include_skip_navigation_order_by_take_EF_Property(b async, ss => ss.Set() - .Include( - e => - EF.Property>(e, "TwoSkipShared") - .OrderBy(i => i.Id) - .Take(2) + .Include(e => + EF.Property>(e, "TwoSkipShared") + .OrderBy(i => i.Id) + .Take(2) ), elementAsserter: (e, a) => AssertInclude( @@ -716,17 +714,15 @@ bool async async, ss => ss.Set() - .Include( - e => - EF.Property>(e, "TwoSkip") - .OrderBy(i => i.Id) - .Skip(1) - .Take(2) + .Include(e => + EF.Property>(e, "TwoSkip") + .OrderBy(i => i.Id) + .Skip(1) + .Take(2) ) - .ThenInclude>( - e => - EF.Property>(e, "ThreeSkipFull") - .Where(i => i.Id < 10) + .ThenInclude>(e => + EF.Property>(e, "ThreeSkipFull") + .Where(i => i.Id < 10) ), elementAsserter: (e, a) => AssertInclude( @@ -1145,11 +1141,10 @@ public virtual Task Skip_navigation_contains_unidirectional(bool async) => async, ss => ss.Set() - .Where( - e => - e.ThreeSkipPayloadFullShared.Contains( - new UnidirectionalEntityThree { Id = 1 } - ) + .Where(e => + e.ThreeSkipPayloadFullShared.Contains( + new UnidirectionalEntityThree { Id = 1 } + ) ), ss => ss.Set() @@ -1557,33 +1552,30 @@ await Assert.ThrowsAsync( async, ss => ss.Set() - .Include( - e => - EF.Property>( - e, - "UnidirectionalEntityOne" - ) - .Where(i => i.Id < 10) + .Include(e => + EF.Property>( + e, + "UnidirectionalEntityOne" + ) + .Where(i => i.Id < 10) ) .ThenInclude(e => e.BranchSkip) - .Include( - e => - EF.Property>( - e, - "UnidirectionalEntityOne" - ) - .Where(i => i.Id < 20) + .Include(e => + EF.Property>( + e, + "UnidirectionalEntityOne" + ) + .Where(i => i.Id < 20) ) .ThenInclude< UnidirectionalEntityTwo, UnidirectionalEntityOne, ICollection - >( - e => - EF.Property>( - e, - "UnidirectionalEntityThree" - ) + >(e => + EF.Property>( + e, + "UnidirectionalEntityThree" + ) ) ) ) diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs index daf493ece6c..9d749580757 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindAggregateOperatorsQueryTestBase.cs @@ -255,9 +255,11 @@ public virtual Task Average_on_float_column_in_subquery(bool async) => ss => ss.Set() .Where(o => o.OrderID < 10300) - .Select( - o => new { o.OrderID, Sum = o.OrderDetails.Average(od => od.Discount) } - ), + .Select(o => new + { + o.OrderID, + Sum = o.OrderDetails.Average(od => od.Discount) + }), e => e.OrderID ); @@ -269,14 +271,11 @@ public virtual Task Average_on_float_column_in_subquery_with_cast(bool async) => ss => ss.Set() .Where(o => o.OrderID < 10300) - .Select( - o => - new - { - o.OrderID, - Sum = o.OrderDetails.Average(od => (float?)od.Discount) - } - ), + .Select(o => new + { + o.OrderID, + Sum = o.OrderDetails.Average(od => (float?)od.Discount) + }), e => e.OrderID ); @@ -787,12 +786,10 @@ public virtual Task FirstOrDefault_inside_subquery_gets_server_evaluated(bool as async, ss => ss.Set() - .Where( - c => - c.CustomerID == "ALFKI" - && c.Orders.Where(o => o.CustomerID == "ALFKI") - .FirstOrDefault() - .CustomerID == "ALFKI" + .Where(c => + c.CustomerID == "ALFKI" + && c.Orders.Where(o => o.CustomerID == "ALFKI").FirstOrDefault().CustomerID + == "ALFKI" ) ); @@ -805,23 +802,21 @@ public virtual Task Multiple_collection_navigation_with_FirstOrDefault_chained(b ss.Set() .Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .FirstOrDefault() - .OrderDetails.OrderBy(od => od.ProductID) - .FirstOrDefault() + .Select(c => + c.Orders.OrderBy(o => o.OrderID) + .FirstOrDefault() + .OrderDetails.OrderBy(od => od.ProductID) + .FirstOrDefault() ), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .FirstOrDefault() - .Maybe(x => x.OrderDetails) - .Maybe(xx => xx.OrderBy(od => od.ProductID).FirstOrDefault()) + .Select(c => + c.Orders.OrderBy(o => o.OrderID) + .FirstOrDefault() + .Maybe(x => x.OrderDetails) + .Maybe(xx => xx.OrderBy(od => od.ProductID).FirstOrDefault()) ) ); @@ -836,27 +831,25 @@ bool async ss.Set() .Where(c => c.CustomerID.StartsWith("A")) .OrderBy(c => c.CustomerID) - .Select( - c => - (int?) - c.Orders.OrderBy(o => o.OrderID) - .FirstOrDefault() - .OrderDetails.OrderBy(od => od.ProductID) - .FirstOrDefault() - .ProductID + .Select(c => + (int?) + c.Orders.OrderBy(o => o.OrderID) + .FirstOrDefault() + .OrderDetails.OrderBy(od => od.ProductID) + .FirstOrDefault() + .ProductID ), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("A")) .OrderBy(c => c.CustomerID) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .FirstOrDefault() - .Maybe(x => x.OrderDetails) - .MaybeScalar( - x => x.OrderBy(od => od.ProductID).FirstOrDefault().ProductID - ) + .Select(c => + c.Orders.OrderBy(o => o.OrderID) + .FirstOrDefault() + .Maybe(x => x.OrderDetails) + .MaybeScalar(x => + x.OrderBy(od => od.ProductID).FirstOrDefault().ProductID + ) ) ); @@ -867,11 +860,10 @@ public virtual Task First_inside_subquery_gets_client_evaluated(bool async) => async, ss => ss.Set() - .Where( - c => - c.CustomerID == "ALFKI" - && c.Orders.Where(o => o.CustomerID == "ALFKI").First().CustomerID - == "ALFKI" + .Where(c => + c.CustomerID == "ALFKI" + && c.Orders.Where(o => o.CustomerID == "ALFKI").First().CustomerID + == "ALFKI" ) ); @@ -966,11 +958,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - ss.Set() - .Where(c1 => ids.Contains(c1.City)) - .Any(e => e.CustomerID == c.CustomerID) + .Where(c => + ss.Set() + .Where(c1 => ids.Contains(c1.City)) + .Any(e => e.CustomerID == c.CustomerID) ) ); @@ -980,11 +971,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - ss.Set() - .Where(c1 => ids.Contains(c1.City)) - .Any(e => e.CustomerID == c.CustomerID) + .Where(c => + ss.Set() + .Where(c1 => ids.Contains(c1.City)) + .Any(e => e.CustomerID == c.CustomerID) ) ); } @@ -1146,11 +1136,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", "ALFKI" } - .Where(e => e != null) - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", "ALFKI" } + .Where(e => e != null) + .Contains(c.CustomerID) ) ); @@ -1164,11 +1153,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .Where(e => e != null) - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .Where(e => e != null) + .Contains(c.CustomerID) ) ); @@ -1178,11 +1166,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .Where(e => e != null) - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .Where(e => e != null) + .Contains(c.CustomerID) ) ); } @@ -1236,11 +1223,10 @@ public virtual Task Contains_with_local_ordered_enumerable_inline(bool async) => async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", "ALFKI" } - .Order() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", "ALFKI" } + .Order() + .Contains(c.CustomerID) ) ); @@ -1254,11 +1240,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .Order() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .Order() + .Contains(c.CustomerID) ) ); @@ -1268,11 +1253,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .Order() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .Order() + .Contains(c.CustomerID) ) ); } @@ -1326,11 +1310,10 @@ public virtual Task Contains_with_local_read_only_collection_inline(bool async) async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", "ALFKI" } - .AsReadOnly() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", "ALFKI" } + .AsReadOnly() + .Contains(c.CustomerID) ) ); @@ -1346,11 +1329,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .AsReadOnly() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .AsReadOnly() + .Contains(c.CustomerID) ) ); @@ -1360,11 +1342,10 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", id } - .AsReadOnly() - .Contains(c.CustomerID) + .Where(c => + new List { "ABCDE", id } + .AsReadOnly() + .Contains(c.CustomerID) ) ); } @@ -1379,15 +1360,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List - { - new() { CustomerID = "ABCDE" }, - new() { CustomerID = id } - } - .Select(i => i.CustomerID) - .Contains(c.CustomerID) + .Where(c => + new List + { + new() { CustomerID = "ABCDE" }, + new() { CustomerID = id } + } + .Select(i => i.CustomerID) + .Contains(c.CustomerID) ) ); @@ -1397,15 +1377,14 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - new List - { - new() { CustomerID = "ABCDE" }, - new() { CustomerID = id } - } - .Select(i => i.CustomerID) - .Contains(c.CustomerID) + .Where(c => + new List + { + new() { CustomerID = "ABCDE" }, + new() { CustomerID = id } + } + .Select(i => i.CustomerID) + .Contains(c.CustomerID) ) ); } @@ -1446,10 +1425,9 @@ public virtual Task Contains_with_local_collection_complex_predicate_and(bool as async, ss => ss.Set() - .Where( - c => - (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") - && ids.Contains(c.CustomerID) + .Where(c => + (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") + && ids.Contains(c.CustomerID) ) ); } @@ -1464,10 +1442,9 @@ public virtual Task Contains_with_local_collection_complex_predicate_or(bool asy async, ss => ss.Set() - .Where( - c => - ids.Contains(c.CustomerID) - || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") + .Where(c => + ids.Contains(c.CustomerID) + || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") ) ); } @@ -1484,10 +1461,9 @@ bool async async, ss => ss.Set() - .Where( - c => - (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") - || !ids.Contains(c.CustomerID) + .Where(c => + (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") + || !ids.Contains(c.CustomerID) ) ); } @@ -1504,10 +1480,9 @@ bool async async, ss => ss.Set() - .Where( - c => - ids.Contains(c.CustomerID) - && (c.CustomerID != "ALFKI" && c.CustomerID != "ABCDE") + .Where(c => + ids.Contains(c.CustomerID) + && (c.CustomerID != "ALFKI" && c.CustomerID != "ABCDE") ), assertEmpty: true ); @@ -1523,10 +1498,9 @@ public virtual Task Contains_with_local_collection_sql_injection(bool async) async, ss => ss.Set() - .Where( - c => - ids.Contains(c.CustomerID) - || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") + .Where(c => + ids.Contains(c.CustomerID) + || (c.CustomerID == "ALFKI" || c.CustomerID == "ABCDE") ) ); } @@ -1700,13 +1674,12 @@ public virtual Task List_Contains_with_constant_list(bool async) => async, ss => ss.Set() - .Where( - c => - new List - { - new() { CustomerID = "ALFKI" }, - new() { CustomerID = "ANATR" } - }.Contains(c) + .Where(c => + new List + { + new() { CustomerID = "ALFKI" }, + new() { CustomerID = "ANATR" } + }.Contains(c) ) ); @@ -1743,13 +1716,12 @@ public virtual Task Contains_with_constant_list_value_type_id(bool async) => async, ss => ss.Set() - .Where( - o => - new List - { - new() { OrderID = 10248 }, - new() { OrderID = 10249 } - }.Contains(o) + .Where(o => + new List + { + new() { OrderID = 10248 }, + new() { OrderID = 10249 } + }.Contains(o) ) ); @@ -1847,12 +1819,11 @@ bool async async, ss => ss.Set() - .Where( - o => - ss.Set() - .Where(o => o.CustomerID == "VINET") - .Select(o => o.EmployeeID) - .Contains(null) + .Where(o => + ss.Set() + .Where(o => o.CustomerID == "VINET") + .Select(o => o.EmployeeID) + .Contains(null) ), assertEmpty: true ); @@ -1866,12 +1837,11 @@ bool async async, ss => ss.Set() - .Where( - o => - !ss.Set() - .Where(o => o.CustomerID == "VINET") - .Select(o => o.EmployeeID) - .Contains(null) + .Where(o => + !ss.Set() + .Where(o => o.CustomerID == "VINET") + .Select(o => o.EmployeeID) + .Contains(null) ) ); @@ -1884,16 +1854,15 @@ bool async async, ss => ss.Set() - .Where( - o => - ss.Set() - .Where(o => o.CustomerID == "VINET") - .Select(o => o.EmployeeID) - .Contains(null) - == ss.Set() - .Where(o => o.CustomerID != "VINET") - .Select(o => o.EmployeeID) - .Contains(null) + .Where(o => + ss.Set() + .Where(o => o.CustomerID == "VINET") + .Select(o => o.EmployeeID) + .Contains(null) + == ss.Set() + .Where(o => o.CustomerID != "VINET") + .Select(o => o.EmployeeID) + .Contains(null) ) ); @@ -1906,12 +1875,11 @@ bool async async, ss => ss.Set() - .Select( - o => - ss.Set() - .Where(o => o.CustomerID == "VINET") - .Select(o => o.EmployeeID) - .Contains(null) + .Select(o => + ss.Set() + .Where(o => o.CustomerID == "VINET") + .Select(o => o.EmployeeID) + .Contains(null) ) ); @@ -1924,12 +1892,11 @@ bool async async, ss => ss.Set() - .Select( - o => - ss.Set() - .Where(o => o.CustomerID != "VINET") - .Select(o => o.CustomerID) - .Contains(null) + .Select(o => + ss.Set() + .Where(o => o.CustomerID != "VINET") + .Select(o => o.CustomerID) + .Contains(null) ) ); @@ -1950,10 +1917,9 @@ public virtual Task Contains_over_entityType_should_materialize_when_composite2( async, ss => ss.Set() - .Where( - o => - o.ProductID == 42 - && ss.Set().Where(x => x.OrderID > 42).Contains(o) + .Where(o => + o.ProductID == 42 + && ss.Set().Where(x => x.OrderID > 42).Contains(o) ) ); @@ -1989,8 +1955,8 @@ public virtual Task Where_subquery_any_equals(bool async) => async, ss => ss.Set() - .Where( - c => new[] { "ABCDE", "ALFKI", "ANATR" }.Any(li => li.Equals(c.CustomerID)) + .Where(c => + new[] { "ABCDE", "ALFKI", "ANATR" }.Any(li => li.Equals(c.CustomerID)) ) ); @@ -2048,11 +2014,10 @@ public virtual Task Where_subquery_all_not_equals(bool async) => async, ss => ss.Set() - .Where( - c => - new List { "ABCDE", "ALFKI", "ANATR" }.All( - li => !li.Equals(c.CustomerID) - ) + .Where(c => + new List { "ABCDE", "ALFKI", "ANATR" }.All(li => + !li.Equals(c.CustomerID) + ) ) ); @@ -2140,19 +2105,16 @@ public virtual Task Collection_Last_member_access_in_projection_translated(bool ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Where( - c => - c.Orders.OrderByDescending(o => o.OrderID).Last().CustomerID - == c.CustomerID + .Where(c => + c.Orders.OrderByDescending(o => o.OrderID).Last().CustomerID == c.CustomerID ), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Where( - c => - c.Orders.OrderByDescending(o => o.OrderID) - .LastOrDefault() - .Maybe(x => x.CustomerID) == c.CustomerID + .Where(c => + c.Orders.OrderByDescending(o => o.OrderID) + .LastOrDefault() + .Maybe(x => x.CustomerID) == c.CustomerID ) ); @@ -2166,19 +2128,17 @@ bool async ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Where( - c => - c.Orders.OrderByDescending(o => o.OrderID).LastOrDefault().CustomerID - == c.CustomerID + .Where(c => + c.Orders.OrderByDescending(o => o.OrderID).LastOrDefault().CustomerID + == c.CustomerID ), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Where( - c => - c.Orders.OrderByDescending(o => o.OrderID) - .LastOrDefault() - .Maybe(x => x.CustomerID) == c.CustomerID + .Where(c => + c.Orders.OrderByDescending(o => o.OrderID) + .LastOrDefault() + .Maybe(x => x.CustomerID) == c.CustomerID ) ); @@ -2296,15 +2256,12 @@ public virtual Task Average_on_nav_subquery_in_projection(bool async) => ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => - new - { - Ave = c.Orders != null && c.Orders.Count() > 0 - ? (double?)c.Orders.Average(o => o.OrderID) - : null - } - ), + .Select(c => new + { + Ave = c.Orders != null && c.Orders.Count() > 0 + ? (double?)c.Orders.Average(o => o.OrderID) + : null + }), assertOrder: true, elementAsserter: (e, a) => { @@ -2327,16 +2284,11 @@ public virtual Task Count_after_client_projection(bool async) => ss => ss.Set() // ReSharper disable once ConvertTypeCheckToNullCheck - .Select( - o => - new - { - o.OrderID, - Customer = o.Customer is Customer - ? new { o.Customer.ContactName } - : null - } - ) + .Select(o => new + { + o.OrderID, + Customer = o.Customer is Customer ? new { o.Customer.ContactName } : null + }) .Take(1) ); diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs index abcb6057f7a..44340f492a8 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindCompiledQueryTestBase.cs @@ -607,23 +607,22 @@ string s15 ) => context .Set() - .Where( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Where(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) ); @@ -648,23 +647,22 @@ string s15 ) => context .Set() - .Where( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Where(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) .Include(c => c.Orders) ); @@ -690,23 +688,22 @@ string s15 ) => context .Set() - .Count( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Count(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) ); @@ -731,23 +728,22 @@ string s15 ) => context .Set() - .Where( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Where(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) ); @@ -772,23 +768,22 @@ string s15 ) => context .Set() - .Where( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Where(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) .Include(c => c.Orders) ); @@ -814,23 +809,22 @@ string s15 ) => context .Set() - .Count( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 - || c.CustomerID == s15 + .Count(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 + || c.CustomerID == s15 ) ); @@ -855,22 +849,21 @@ CancellationToken ct ) => context .Set() - .Count( - c => - c.CustomerID == s1 - || c.CustomerID == s2 - || c.CustomerID == s3 - || c.CustomerID == s4 - || c.CustomerID == s5 - || c.CustomerID == s6 - || c.CustomerID == s7 - || c.CustomerID == s8 - || c.CustomerID == s9 - || c.CustomerID == s10 - || c.CustomerID == s11 - || c.CustomerID == s12 - || c.CustomerID == s13 - || c.CustomerID == s14 + .Count(c => + c.CustomerID == s1 + || c.CustomerID == s2 + || c.CustomerID == s3 + || c.CustomerID == s4 + || c.CustomerID == s5 + || c.CustomerID == s6 + || c.CustomerID == s7 + || c.CustomerID == s8 + || c.CustomerID == s9 + || c.CustomerID == s10 + || c.CustomerID == s11 + || c.CustomerID == s12 + || c.CustomerID == s13 + || c.CustomerID == s14 ) ); diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs index f79793d47f6..0b42665d36b 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindEFPropertyIncludeQueryTestBase.cs @@ -165,27 +165,24 @@ private class IncludeRewritingExpressionVisitor : ExpressionVisitor typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.Include)) - .Single( - mi => - mi.GetGenericArguments().Count() == 2 - && mi.GetParameters() - .Any( - pi => - pi.Name == "navigationPropertyPath" - && pi.ParameterType != typeof(string) - ) + .Single(mi => + mi.GetGenericArguments().Count() == 2 + && mi.GetParameters() + .Any(pi => + pi.Name == "navigationPropertyPath" + && pi.ParameterType != typeof(string) + ) ); private static readonly MethodInfo _thenIncludeAfterReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(EntityFrameworkQueryableExtensions.ThenInclude)) - .Single( - mi => - mi.GetGenericArguments().Count() == 3 - && mi.GetParameters()[0] - .ParameterType.GenericTypeArguments[1] - .IsGenericParameter + .Single(mi => + mi.GetGenericArguments().Count() == 3 + && mi.GetParameters()[0] + .ParameterType.GenericTypeArguments[1] + .IsGenericParameter ); private static readonly MethodInfo _thenIncludeAfterEnumerableMethodInfo = diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs index 3bd94c1cfcb..8ce9d98eef7 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindGroupByQueryTestBase.cs @@ -116,16 +116,13 @@ public virtual Task GroupBy_Property_Select_Sum_Min_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => (e.Min, e.Max) ); @@ -209,17 +206,14 @@ public virtual Task GroupBy_Property_Select_Key_Sum_Min_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + g.Key, + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -231,17 +225,14 @@ public virtual Task GroupBy_Property_Select_Sum_Min_Key_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => EF.Property(o, "CustomerID")) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -253,15 +244,12 @@ public virtual Task GroupBy_Property_Select_key_multiple_times_and_aggregate(boo ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - Key1 = g.Key, - Key2 = g.Key, - Sum = g.Sum(o => o.OrderID) - } - ), + .Select(g => new + { + Key1 = g.Key, + Key2 = g.Key, + Sum = g.Sum(o => o.OrderID) + }), e => e.Key1 ); @@ -285,16 +273,13 @@ public virtual Task GroupBy_aggregate_projecting_conditional_expression(bool asy ss => ss.Set() .GroupBy(o => o.OrderDate) - .Select( - g => - new - { - g.Key, - SomeValue = g.Count() == 0 - ? 1 - : g.Sum(o => o.OrderID % 2 == 0 ? 1 : 0) / g.Count() - } - ), + .Select(g => new + { + g.Key, + SomeValue = g.Count() == 0 + ? 1 + : g.Sum(o => o.OrderID % 2 == 0 ? 1 : 0) / g.Count() + }), e => (e.Key, e.SomeValue) ); @@ -308,14 +293,11 @@ bool async ss => ss.Set() .GroupBy(o => o.OrderDate) - .Select( - g => - new - { - Key = g.Key == null ? "is null" : "is not null", - Sum = g.Sum(o => o.OrderID) - } - ), + .Select(g => new + { + Key = g.Key == null ? "is null" : "is not null", + Sum = g.Sum(o => o.OrderID) + }), e => e.Sum ); @@ -381,15 +363,12 @@ public virtual Task GroupBy_with_cast_inside_grouping_aggregate(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(o => (long)o.OrderID) - } - ), + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(o => (long)o.OrderID) + }), elementSorter: e => e.Key ); @@ -443,25 +422,19 @@ await AssertQuery( ss => ss.Set() .Where(o => o.CustomerID.StartsWith("A")) - .Select( - o => - new - { - o.CustomerID, - Age = 2020 - o.OrderDate.Value.Year, - o.OrderID - } - ) + .Select(o => new + { + o.CustomerID, + Age = 2020 - o.OrderDate.Value.Year, + o.OrderID + }) .GroupBy(x => x.CustomerID) - .Select( - x => - new - { - x.Key, - Sum1 = x.Sum(y => y.Age <= 30 ? y.OrderID : 0), - Sum2 = x.Sum(y => y.Age > 30 && y.Age <= 60 ? y.OrderID : 0) - } - ) + .Select(x => new + { + x.Key, + Sum1 = x.Sum(y => y.Age <= 30 ? y.OrderID : 0), + Sum2 = x.Sum(y => y.Age > 30 && y.Age <= 60 ? y.OrderID : 0) + }) ); [ConditionalTheory] @@ -590,16 +563,13 @@ public virtual Task GroupBy_anonymous_Select_Sum_Min_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => new { o.CustomerID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -688,16 +658,13 @@ public virtual Task GroupBy_Composite_Select_Sum_Min_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -781,17 +748,14 @@ public virtual Task GroupBy_Composite_Select_Key_Sum_Min_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new - { - g.Key, - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + g.Key, + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -803,17 +767,14 @@ public virtual Task GroupBy_Composite_Select_Sum_Min_Key_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -825,18 +786,15 @@ public virtual Task GroupBy_Composite_Select_Sum_Min_Key_flattened_Max_Avg(bool ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key.CustomerID, - g.Key.EmployeeID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key.CustomerID, + g.Key.EmployeeID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -847,10 +805,11 @@ public virtual Task GroupBy_Dto_as_key_Select_Sum(bool async) => async, ss => ss.Set() - .GroupBy( - o => - new NominalType { CustomerID = o.CustomerID, EmployeeID = o.EmployeeID } - ) + .GroupBy(o => new NominalType + { + CustomerID = o.CustomerID, + EmployeeID = o.EmployeeID + }) .Select(g => new { Sum = g.Sum(o => o.OrderID), g.Key }) ); @@ -863,8 +822,11 @@ public virtual Task GroupBy_Dto_as_element_selector_Select_Sum(bool async) => ss.Set() .GroupBy( o => o.CustomerID, - o => - new NominalType { CustomerID = o.CustomerID, EmployeeID = o.EmployeeID } + o => new NominalType + { + CustomerID = o.CustomerID, + EmployeeID = o.EmployeeID + } ) .Select(g => new { Sum = g.Sum(o => o.EmployeeID), g.Key }) ); @@ -895,18 +857,15 @@ public virtual Task GroupBy_Composite_Select_Dto_Sum_Min_Key_flattened_Max_Avg(b ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new CompositeDto - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - CustomerId = g.Key.CustomerID, - EmployeeId = g.Key.EmployeeID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new CompositeDto + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + CustomerId = g.Key.CustomerID, + EmployeeId = g.Key.EmployeeID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.CustomerId + " " + e.EmployeeId ); @@ -941,17 +900,14 @@ public virtual Task GroupBy_Composite_Select_Sum_Min_part_Key_flattened_Max_Avg( ss => ss.Set() .GroupBy(o => new { o.CustomerID, o.EmployeeID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key.CustomerID, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key.CustomerID, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -963,17 +919,14 @@ public virtual Task GroupBy_Constant_Select_Sum_Min_Key_Max_Avg(bool async) => ss => ss.Set() .GroupBy(o => 2) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -1010,13 +963,12 @@ public virtual Task GroupBy_Constant_with_element_selector_Select_Sum3(bool asyn ss.Set() .GroupBy( o => 2, - o => - new - { - o.OrderID, - o.OrderDate, - o.CustomerID - } + o => new + { + o.OrderID, + o.OrderDate, + o.CustomerID + } ) .Select(g => new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum @@ -1031,17 +983,14 @@ public virtual Task GroupBy_after_predicate_Constant_Select_Sum_Min_Key_Max_Avg( ss.Set() .Where(o => o.OrderID > 10500) .GroupBy(o => 2) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - Random = g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + Random = g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); @@ -1070,16 +1019,13 @@ bool async ss.Set() .GroupBy(o => 1) .OrderBy(g => g.Key) - .Select( - g => - new - { - Min = g.Where(i => 1 == g.Key).Min(o => o.OrderDate), - Max = g.Where(i => 1 == g.Key).Max(o => o.OrderDate), - Sum = g.Where(i => 1 == g.Key).Sum(o => o.OrderID), - Average = g.Where(i => 1 == g.Key).Average(o => o.OrderID), - } - ) + .Select(g => new + { + Min = g.Where(i => 1 == g.Key).Min(o => o.OrderDate), + Max = g.Where(i => 1 == g.Key).Max(o => o.OrderDate), + Sum = g.Where(i => 1 == g.Key).Sum(o => o.OrderID), + Average = g.Where(i => 1 == g.Key).Average(o => o.OrderID), + }) ); [ConditionalTheory] @@ -1093,17 +1039,14 @@ public virtual Task GroupBy_param_Select_Sum_Min_Key_Max_Avg(bool async) ss => ss.Set() .GroupBy(o => a) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.OrderID), - g.Key, - Max = g.Max(o => o.OrderID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.OrderID), + g.Key, + Max = g.Max(o => o.OrderID), + Avg = g.Average(o => o.OrderID) + }), e => e.Min + " " + e.Max ); } @@ -1152,13 +1095,12 @@ public virtual Task GroupBy_param_with_element_selector_Select_Sum3(bool async) ss.Set() .GroupBy( o => a, - o => - new - { - o.OrderID, - o.OrderDate, - o.CustomerID - } + o => new + { + o.OrderID, + o.OrderDate, + o.CustomerID + } ) .Select(g => new { Sum = g.Sum(o => o.OrderID) }), e => e.Sum @@ -1241,17 +1183,14 @@ public virtual Task Odata_groupby_empty_key(bool async) => ss => ss.Set() .GroupBy(e => new NoGroupByWrapper()) - .Select( - e => - new NoGroupByAggregationWrapper - { - Container = new LastInChain - { - Name = "TotalAmount", - Value = e.Sum(e => (decimal)e.OrderID) - } - } - ), + .Select(e => new NoGroupByAggregationWrapper + { + Container = new LastInChain + { + Name = "TotalAmount", + Value = e.Sum(e => (decimal)e.OrderID) + } + }), assertOrder: true, elementAsserter: (e, a) => { @@ -1342,16 +1281,13 @@ public virtual Task GroupBy_Property_scalar_element_selector_Sum_Min_Max_Avg(boo ss => ss.Set() .GroupBy(o => o.CustomerID, o => o.OrderID) - .Select( - g => - new - { - Sum = g.Sum(), - Min = g.Min(), - Max = g.Max(), - Avg = g.Average() - } - ), + .Select(g => new + { + Sum = g.Sum(), + Min = g.Min(), + Max = g.Max(), + Avg = g.Average() + }), e => e.Min + " " + e.Max ); @@ -1429,16 +1365,13 @@ public virtual Task GroupBy_Property_anonymous_element_selector_Sum_Min_Max_Avg( ss => ss.Set() .GroupBy(o => o.CustomerID, o => new { o.OrderID, o.EmployeeID }) - .Select( - g => - new - { - Sum = g.Sum(o => o.OrderID), - Min = g.Min(o => o.EmployeeID), - Max = g.Max(o => o.EmployeeID), - Avg = g.Average(o => o.OrderID) - } - ), + .Select(g => new + { + Sum = g.Sum(o => o.OrderID), + Min = g.Min(o => o.EmployeeID), + Max = g.Max(o => o.EmployeeID), + Avg = g.Average(o => o.OrderID) + }), e => e.Sum + " " + e.Avg ); @@ -1519,12 +1452,11 @@ public virtual Task GroupBy_conditional_properties(bool async) ss => ss.Set() .GroupBy( - x => - new - { - OrderMonth = groupByMonth ? (int?)x.OrderDate.Value.Month : null, - Customer = groupByCustomer ? x.CustomerID : null - }, + x => new + { + OrderMonth = groupByMonth ? (int?)x.OrderDate.Value.Month : null, + Customer = groupByCustomer ? x.CustomerID : null + }, x => x, (key, items) => new @@ -1879,26 +1811,20 @@ public virtual Task Select_anonymous_GroupBy_Aggregate(bool async) => ss => ss.Set() .Where(o => o.OrderID < 10300) - .Select( - o => - new - { - A = o.CustomerID, - B = o.OrderDate, - C = o.OrderID - } - ) + .Select(o => new + { + A = o.CustomerID, + B = o.OrderDate, + C = o.OrderID + }) .GroupBy(e => e.A) - .Select( - g => - new - { - Min = g.Min(o => o.B), - Max = g.Max(o => o.B), - Sum = g.Sum(o => o.C), - Avg = g.Average(o => o.C) - } - ) + .Select(g => new + { + Min = g.Min(o => o.B), + Max = g.Max(o => o.B), + Sum = g.Sum(o => o.C), + Avg = g.Average(o => o.C) + }) ); [ConditionalTheory] @@ -1985,15 +1911,12 @@ public virtual Task Select_collection_of_scalar_before_GroupBy_aggregate(bool as async, ss => ss.Set() - .Select( - c => - new - { - c.CustomerID, - c.City, - Orders = c.Orders.Select(e => e.OrderID) - } - ) + .Select(c => new + { + c.CustomerID, + c.City, + Orders = c.Orders.Select(e => e.OrderID) + }) .GroupBy(e => e.City) .Select(g => new { g.Key, Count = g.Count() }), elementSorter: e => (e.Key, e.Count), @@ -2056,13 +1979,12 @@ public virtual Task GroupBy_aggregate_Contains(bool async) => async, ss => ss.Set() - .Where( - o => - ss.Set() - .GroupBy(e => e.CustomerID) - .Where(g => g.Count() > 30) - .Select(g => g.Key) - .Contains(o.CustomerID) + .Where(o => + ss.Set() + .GroupBy(e => e.CustomerID) + .Where(g => g.Count() > 30) + .Select(g => g.Key) + .Contains(o.CustomerID) ) ); @@ -2176,15 +2098,12 @@ public virtual Task GroupBy_filter_count_OrderBy_count_Select_sum(bool async) => .Where(o => o.Count() > 4) .OrderBy(o => o.Count()) .ThenBy(o => o.Key) - .Select( - g => - new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(o => o.OrderID) - } - ) + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(o => o.OrderID) + }) ); [ConditionalTheory] @@ -2342,9 +2261,11 @@ from c in ss.Set() join a in ss.Set() .GroupBy(o => o.CustomerID) .Where(g => g.Count() > 5) - .Select( - g => new { CustomerID = g.Key, LastOrderID = g.Max(o => o.OrderID) } - ) + .Select(g => new + { + CustomerID = g.Key, + LastOrderID = g.Max(o => o.OrderID) + }) on c.CustomerID equals a.CustomerID select new { c, a.LastOrderID } ) @@ -2439,11 +2360,10 @@ public virtual Task Select_nested_collection_with_groupby(bool async) => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) - .Select( - c => - c.Orders.Any() - ? c.Orders.GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() - : Array.Empty() + .Select(c => + c.Orders.Any() + ? c.Orders.GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() + : Array.Empty() ), assertOrder: true, elementAsserter: (e, a) => @@ -2459,8 +2379,8 @@ public virtual Task Select_uncorrelated_collection_with_groupby_works(bool async ss.Set() .OrderBy(c => c.CustomerID) .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => ss.Set().GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() + .Select(c => + ss.Set().GroupBy(o => o.OrderID).Select(g => g.Key).ToArray() ), assertOrder: true, elementAsserter: (e, a) => AssertCollection(e, a) @@ -2477,20 +2397,17 @@ bool async ss.Set() .Where(c => c.CustomerID.StartsWith("A")) .Select(c => c.Customer.City) - .Select( - c => - new - { - c1 = ss.Set() - .GroupBy(p => p.ProductID) - .Select(g => g.Key) - .ToArray(), - c2 = ss.Set() - .GroupBy(p => p.ProductID) - .Select(g => g.Count()) - .ToArray() - } - ), + .Select(c => new + { + c1 = ss.Set() + .GroupBy(p => p.ProductID) + .Select(g => g.Key) + .ToArray(), + c2 = ss.Set() + .GroupBy(p => p.ProductID) + .Select(g => g.Count()) + .ToArray() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -2572,15 +2489,12 @@ public virtual Task GroupBy_Key_as_part_of_element_selector(bool async) => ss => ss.Set() .GroupBy(o => o.OrderID, o => new { o.OrderID, o.OrderDate }) - .Select( - g => - new - { - g.Key, - Avg = g.Average(e => e.OrderID), - Max = g.Max(o => o.OrderDate) - } - ) + .Select(g => new + { + g.Key, + Avg = g.Average(e => e.OrderID), + Max = g.Max(o => o.OrderDate) + }) ); [ConditionalTheory] @@ -2594,15 +2508,12 @@ public virtual Task GroupBy_composite_Key_as_part_of_element_selector(bool async o => new { o.OrderID, o.CustomerID }, o => new { o.OrderID, o.OrderDate } ) - .Select( - g => - new - { - g.Key, - Avg = g.Average(e => e.OrderID), - Max = g.Max(o => o.OrderDate) - } - ) + .Select(g => new + { + g.Key, + Avg = g.Average(e => e.OrderID), + Max = g.Max(o => o.OrderDate) + }) ); [ConditionalTheory] @@ -2671,9 +2582,11 @@ public virtual Task GroupBy_let_orderby_projection_with_coalesce_operation(bool .Select(g => new { citiesCount = g.Count(), g }) .OrderByDescending(x => x.citiesCount) .ThenBy(x => x.g.Key) - .Select( - x => new { Locality = x.g.Key ?? "Unknown", Count = x.citiesCount } - ) + .Select(x => new + { + Locality = x.g.Key ?? "Unknown", + Count = x.citiesCount + }) ), CoreStrings.QuerySelectContainsGrouping ); @@ -2710,18 +2623,15 @@ public virtual Task GroupBy_aggregate_over_a_subquery(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Count = ( - from c in ss.Set() - where c.CustomerID == g.Key - select c - ).Count() - } - ), + .Select(g => new + { + g.Key, + Count = ( + from c in ss.Set() + where c.CustomerID == g.Key + select c + ).Count() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3140,19 +3050,16 @@ public virtual Task GroupBy_Select_Distinct_aggregate(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Average = g.Select(e => e.OrderID).Distinct().Average(), - Count = g.Select(e => e.EmployeeID).Distinct().Count(), - LongCount = g.Select(e => e.EmployeeID).Distinct().LongCount(), - Max = g.Select(e => e.OrderDate).Distinct().Max(), - Min = g.Select(e => e.OrderDate).Distinct().Min(), - Sum = g.Select(e => e.OrderID).Distinct().Sum(), - } - ), + .Select(g => new + { + g.Key, + Average = g.Select(e => e.OrderID).Distinct().Average(), + Count = g.Select(e => e.EmployeeID).Distinct().Count(), + LongCount = g.Select(e => e.EmployeeID).Distinct().LongCount(), + Max = g.Select(e => e.OrderDate).Distinct().Max(), + Min = g.Select(e => e.OrderDate).Distinct().Min(), + Sum = g.Select(e => e.OrderID).Distinct().Sum(), + }), elementSorter: e => e.Key ); @@ -3164,14 +3071,11 @@ public virtual Task GroupBy_group_Distinct_Select_Distinct_aggregate(bool async) ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Max = g.Distinct().Select(e => e.OrderDate).Distinct().Max(), - } - ), + .Select(g => new + { + g.Key, + Max = g.Distinct().Select(e => e.OrderDate).Distinct().Max(), + }), elementSorter: e => e.Key ); @@ -3183,17 +3087,14 @@ public virtual Task GroupBy_group_Where_Select_Distinct_aggregate(bool async) => ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Max = g.Where(e => e.OrderDate.HasValue) - .Select(e => e.OrderDate) - .Distinct() - .Max(), - } - ), + .Select(g => new + { + g.Key, + Max = g.Where(e => e.OrderDate.HasValue) + .Select(e => e.OrderDate) + .Distinct() + .Max(), + }), elementSorter: e => e.Key ); @@ -3238,15 +3139,12 @@ public virtual Task Final_GroupBy_property_anonymous_type(bool async) => async, ss => ss.Set() - .Select( - e => - new - { - e.City, - e.ContactName, - e.ContactTitle - } - ) + .Select(e => new + { + e.City, + e.ContactName, + e.ContactTitle + }) .GroupBy(c => c.City), elementSorter: e => e.Key, elementAsserter: (e, a) => @@ -3435,16 +3333,12 @@ bool async ss => ss.Set() .Where(c => c.Country == "USA") - .Select( - c => - new - { - c.City, - Orders = c.Orders.Where(o => o.OrderID < 11000), - LastOrder = c.Orders.OrderByDescending(o => o.OrderDate) - .FirstOrDefault() - } - ) + .Select(c => new + { + c.City, + Orders = c.Orders.Where(o => o.OrderID < 11000), + LastOrder = c.Orders.OrderByDescending(o => o.OrderDate).FirstOrDefault() + }) .GroupBy(c => c.City), elementSorter: e => e.Key, elementAsserter: (e, a) => @@ -3604,10 +3498,11 @@ public virtual Task Select_GroupBy_SelectMany(bool async) async, ss => ss.Set() - .Select( - o => - new ProjectedType { Order = o.OrderID, Customer = o.CustomerID } - ) + .Select(o => new ProjectedType + { + Order = o.OrderID, + Customer = o.CustomerID + }) .GroupBy(p => p.Customer) .SelectMany(g => g), elementSorter: g => g.Order @@ -3625,10 +3520,9 @@ public virtual Task GroupBy_Shadow(bool async) => async, ss => ss.Set() - .Where( - e => - EF.Property(e, "Title") == "Sales Representative" - && e.EmployeeID == 1 + .Where(e => + EF.Property(e, "Title") == "Sales Representative" + && e.EmployeeID == 1 ) .GroupBy(e => EF.Property(e, "Title")) .Select(g => EF.Property(g.First(), "Title")) @@ -3641,10 +3535,9 @@ public virtual Task GroupBy_Shadow2(bool async) => async, ss => ss.Set() - .Where( - e => - EF.Property(e, "Title") == "Sales Representative" - && e.EmployeeID == 1 + .Where(e => + EF.Property(e, "Title") == "Sales Representative" + && e.EmployeeID == 1 ) .GroupBy(e => EF.Property(e, "Title")) .Select(g => g.First()) @@ -3704,14 +3597,11 @@ public virtual Task GroupBy_select_grouping_composed_list(bool async) => ss => ss.Set() .GroupBy(e => e.City) - .Select( - g => - new - { - g.Key, - List = g.Where(c => c.CustomerID.StartsWith("A")).ToList() - } - ), + .Select(g => new + { + g.Key, + List = g.Where(c => c.CustomerID.StartsWith("A")).ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -3791,17 +3681,14 @@ bool async ss => ss.Set() .GroupBy(od => od.Order) - .Select( - g => - new - { - g.Key, - Id1 = g.Key.CustomerID, - Id2 = g.Key.Customer.CustomerID, - Id3 = g.Key.OrderID, - Aggregate = g.Sum(od => od.OrderID) - } - ), + .Select(g => new + { + g.Key, + Id1 = g.Key.CustomerID, + Id2 = g.Key.Customer.CustomerID, + Id3 = g.Key.OrderID, + Aggregate = g.Sum(od => od.OrderID) + }), elementSorter: e => e.Id3, elementAsserter: (e, a) => { @@ -3922,15 +3809,12 @@ public virtual Task GroupBy_aggregate_followed_by_another_GroupBy_aggregate(bool ss => ss.Set() .GroupBy(o => o.CustomerID) - .Select( - g => - new - { - g.Key, - Count = g.Count(), - LastOrder = g.Max(e => e.OrderID) - } - ) + .Select(g => new + { + g.Key, + Count = g.Count(), + LastOrder = g.Max(e => e.OrderID) + }) .GroupBy(e => 1) .Select(g => new { g.Key, Count = g.Sum(e => e.Count) }) ); @@ -3943,22 +3827,19 @@ public virtual Task GroupBy_Count_in_projection(bool async) => ss => ss.Set() .Where(o => o.OrderDate.HasValue) - .Select( - o => new { o, OrderDetails = o.OrderDetails.Where(od => od.ProductID < 25) } - ) - .Select( - info => - new - { - info.o.OrderID, - info.o.OrderDate, - HasOrderDetails = info.OrderDetails.Any(), - HasMultipleProducts = info.OrderDetails.GroupBy( - e => e.Product.ProductName - ) - .Count() > 1 - } - ) + .Select(o => new + { + o, + OrderDetails = o.OrderDetails.Where(od => od.ProductID < 25) + }) + .Select(info => new + { + info.o.OrderID, + info.o.OrderDate, + HasOrderDetails = info.OrderDetails.Any(), + HasMultipleProducts = info.OrderDetails.GroupBy(e => e.Product.ProductName) + .Count() > 1 + }) ); [ConditionalTheory] @@ -3990,19 +3871,18 @@ public virtual Task Complex_query_with_groupBy_in_subquery1(bool async) => async, ss => ss.Set() - .Select( - c => - new - { - Key = c.CustomerID, - Subquery = c.Orders.Select( - o => new { First = o.CustomerID, Second = o.OrderID } - ) - .GroupBy(x => x.First) - .Select(g => new { Sum = g.Sum(x => x.Second) }) - .ToList() - } - ), + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders.Select(o => new + { + First = o.CustomerID, + Second = o.OrderID + }) + .GroupBy(x => x.First) + .Select(g => new { Sum = g.Sum(x => x.Second) }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -4018,26 +3898,22 @@ public virtual Task Complex_query_with_groupBy_in_subquery2(bool async) => async, ss => ss.Set() - .Select( - c => - new + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders.Select(o => new + { + First = o.CustomerID, + Second = o.OrderID + }) + .GroupBy(x => x.First) + .Select(g => new { - Key = c.CustomerID, - Subquery = c.Orders.Select( - o => new { First = o.CustomerID, Second = o.OrderID } - ) - .GroupBy(x => x.First) - .Select( - g => - new - { - Max = g.Max(x => x.First.Length), - Sum = g.Sum(x => x.Second) - } - ) - .ToList() - } - ), + Max = g.Max(x => x.First.Length), + Sum = g.Sum(x => x.Second) + }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -4053,25 +3929,19 @@ public virtual Task Complex_query_with_groupBy_in_subquery3(bool async) => async, ss => ss.Set() - .Select( - c => - new + .Select(c => new + { + Key = c.CustomerID, + Subquery = ss.Set() + .Select(o => new { First = o.CustomerID, Second = o.OrderID }) + .GroupBy(x => x.First) + .Select(g => new { - Key = c.CustomerID, - Subquery = ss.Set() - .Select(o => new { First = o.CustomerID, Second = o.OrderID }) - .GroupBy(x => x.First) - .Select( - g => - new - { - Max = g.Max(x => x.First.Length), - Sum = g.Sum(x => x.Second) - } - ) - .ToList() - } - ), + Max = g.Max(x => x.First.Length), + Sum = g.Sum(x => x.Second) + }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -4087,31 +3957,22 @@ public virtual Task Complex_query_with_groupBy_in_subquery4(bool async) => async, ss => ss.Set() - .Select( - c => - new + .Select(c => new + { + Key = c.CustomerID, + Subquery = c.Orders.Select(o => new + { + First = o.OrderID, + Second = o.Customer.City + o.CustomerID + }) + .GroupBy(x => x.Second) + .Select(g => new { - Key = c.CustomerID, - Subquery = c.Orders.Select( - o => - new - { - First = o.OrderID, - Second = o.Customer.City + o.CustomerID - } - ) - .GroupBy(x => x.Second) - .Select( - g => - new - { - Sum = g.Sum(x => x.First), - Count = g.Count(x => x.Second.StartsWith("Lon")) - } - ) - .ToList() - } - ), + Sum = g.Sum(x => x.First), + Count = g.Count(x => x.Second.StartsWith("Lon")) + }) + .ToList() + }), elementSorter: e => e.Key, elementAsserter: (e, a) => { @@ -4154,12 +4015,11 @@ public virtual Task GroupBy_scalar_subquery(bool async) => async, ss => ss.Set() - .GroupBy( - o => - ss.Set() - .Where(c => c.CustomerID == o.CustomerID) - .Select(c => c.ContactName) - .FirstOrDefault() + .GroupBy(o => + ss.Set() + .Where(c => c.CustomerID == o.CustomerID) + .Select(c => c.ContactName) + .FirstOrDefault() ) .Select(g => new { g.Key, Count = g.Count() }), elementSorter: e => e.Key @@ -4190,21 +4050,16 @@ public virtual Task AsEnumerable_in_subquery_for_GroupBy(bool async) => ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Select( - c => - new - { - Customer = c, - Orders = ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .AsEnumerable() - .GroupBy(o => o.CustomerID) - .Select( - g => g.OrderByDescending(e => e.OrderDate).FirstOrDefault() - ) - .ToList() - } - ), + .Select(c => new + { + Customer = c, + Orders = ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .AsEnumerable() + .GroupBy(o => o.CustomerID) + .Select(g => g.OrderByDescending(e => e.OrderDate).FirstOrDefault()) + .ToList() + }), elementSorter: e => e.Customer.CustomerID, elementAsserter: (e, a) => { @@ -4221,19 +4076,16 @@ public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection(boo ss => ss.Set() .GroupBy(e => e.CustomerID) - .Select( - g => - new - { - g.Key, - A = ss.Set() - .Where(e => e.City == "Seattle") - .GroupBy(e => e.City) - .Select(g2 => new { g2.Key, C = g2.Count() + g.Count() }) - .OrderBy(e => 1) - .FirstOrDefault() - } - ), + .Select(g => new + { + g.Key, + A = ss.Set() + .Where(e => e.City == "Seattle") + .GroupBy(e => e.City) + .Select(g2 => new { g2.Key, C = g2.Count() + g.Count() }) + .OrderBy(e => 1) + .FirstOrDefault() + }), elementSorter: e => e.Key ); @@ -4245,19 +4097,16 @@ public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection_2(b ss => ss.Set() .GroupBy(e => e.CustomerID) - .Select( - g => - new - { - g.Key, - A = ss.Set() - .Where(e => e.City == "Seattle") - .GroupBy(e => e.City) - .Select(g2 => g2.Count() + g.Min(e => e.OrderID)) - .OrderBy(e => 1) - .FirstOrDefault() - } - ), + .Select(g => new + { + g.Key, + A = ss.Set() + .Where(e => e.City == "Seattle") + .GroupBy(e => e.City) + .Select(g2 => g2.Count() + g.Min(e => e.OrderID)) + .OrderBy(e => 1) + .FirstOrDefault() + }), elementSorter: e => e.Key ); @@ -4269,19 +4118,16 @@ public virtual Task GroupBy_aggregate_from_multiple_query_in_same_projection_3(b ss => ss.Set() .GroupBy(e => e.CustomerID) - .Select( - g => - new - { - g.Key, - A = ss.Set() - .Where(e => e.City == "Seattle") - .GroupBy(e => e.City) - .Select(g2 => g2.Count() + g.Count()) - .OrderBy(e => e) - .FirstOrDefault() - } - ), + .Select(g => new + { + g.Key, + A = ss.Set() + .Where(e => e.City == "Seattle") + .GroupBy(e => e.City) + .Select(g2 => g2.Count() + g.Count()) + .OrderBy(e => e) + .FirstOrDefault() + }), elementSorter: e => e.Key ); @@ -4301,20 +4147,17 @@ bool async .Where(c => c.CustomerID.StartsWith("A")) .Select(c => c.Customer.City) .Distinct() - .Select( - c => - new - { - c1 = ss.Set() - .GroupBy(p => p.ProductID) - .Select(g => g.Key) - .ToArray(), - c2 = ss.Set() - .GroupBy(p => p.ProductID) - .Select(g => g.Count()) - .ToArray() - } - ), + .Select(c => new + { + c1 = ss.Set() + .GroupBy(p => p.ProductID) + .Select(g => g.Key) + .ToArray(), + c2 = ss.Set() + .GroupBy(p => p.ProductID) + .Select(g => g.Count()) + .ToArray() + }), assertOrder: true, elementAsserter: (e, a) => { @@ -4335,14 +4178,11 @@ bool async .GroupBy(e => e.CustomerID) .Where(g => g.Key.StartsWith("F")) .Select(e => e.Key) - .Select( - c => - new - { - c, - Orders = ss.Set().Where(o => o.CustomerID == c).ToList() - } - ), + .Select(c => new + { + c, + Orders = ss.Set().Where(o => o.CustomerID == c).ToList() + }), elementSorter: e => e.c, elementAsserter: (e, a) => { @@ -4363,14 +4203,11 @@ bool async .GroupBy(e => e.CustomerID) .Where(g => g.Key.StartsWith("F")) .Select(e => e.Key) - .Select( - c => - new - { - c, - Orders = ss.Set().Where(o => o.CustomerID == c).ToList() - } - ), + .Select(c => new + { + c, + Orders = ss.Set().Where(o => o.CustomerID == c).ToList() + }), elementSorter: e => e.c, elementAsserter: (e, a) => { @@ -4391,16 +4228,11 @@ bool async .GroupBy(e => e.CustomerID + "A") .Where(g => g.Key.StartsWith("F")) .Select(e => e.Key) - .Select( - c => - new - { - c, - Orders = ss.Set() - .Where(o => o.CustomerID + "A" == c) - .ToList() - } - ), + .Select(c => new + { + c, + Orders = ss.Set().Where(o => o.CustomerID + "A" == c).ToList() + }), elementSorter: e => e.c, elementAsserter: (e, a) => { diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs index 70656b7bd8a..0ea3563dbc5 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindIncludeQueryTestBase.cs @@ -104,11 +104,8 @@ public virtual Task Then_include_collection_order_by_collection_column(bool asyn .Include(c => c.Orders) .ThenInclude(o => o.OrderDetails) .Where(c => c.CustomerID.StartsWith("W")) - .OrderByDescending( - c => - c.Orders.OrderByDescending(oo => oo.OrderDate) - .FirstOrDefault() - .OrderDate + .OrderByDescending(c => + c.Orders.OrderByDescending(oo => oo.OrderDate).FirstOrDefault().OrderDate ), asserter: (e, a) => AssertInclude( @@ -491,11 +488,8 @@ public virtual Task Include_collection_order_by_collection_column(bool async) => ss.Set() .Include(c => c.Orders) .Where(c => c.CustomerID.StartsWith("W")) - .OrderByDescending( - c => - c.Orders.OrderByDescending(oo => oo.OrderDate) - .FirstOrDefault() - .OrderDate + .OrderByDescending(c => + c.Orders.OrderByDescending(oo => oo.OrderDate).FirstOrDefault().OrderDate ), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)) ); @@ -573,11 +567,10 @@ public virtual Task Include_collection_order_by_subquery(bool async) => ss.Set() .Include(c => c.Orders) .Where(c => c.CustomerID == "ALFKI") - .OrderBy( - c => - c.Orders.OrderBy(o => o.EmployeeID) - .Select(o => o.OrderDate) - .FirstOrDefault() + .OrderBy(c => + c.Orders.OrderBy(o => o.EmployeeID) + .Select(o => o.OrderDate) + .FirstOrDefault() ), asserter: (e, a) => AssertInclude(e, a, new ExpectedInclude(c => c.Orders)) ); @@ -1836,11 +1829,8 @@ public virtual Task Filtered_include_with_multiple_ordering(bool async) => ss => ss.Set() .Where(c => c.CustomerID.StartsWith("F")) - .Include( - c => - c.Orders.OrderBy(o => o.OrderID) - .Skip(1) - .OrderByDescending(o => o.OrderDate) + .Include(c => + c.Orders.OrderBy(o => o.OrderID).Skip(1).OrderByDescending(o => o.OrderDate) ), elementAsserter: (e, a) => AssertInclude( diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs index 69d89874331..9634dd07b27 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindKeylessEntitiesQueryTestBase.cs @@ -131,15 +131,12 @@ public virtual Task KeylessEntity_groupby(bool async) => ss => ss.Set() .GroupBy(cv => cv.City) - .Select( - g => - new - { - g.Key, - Count = g.Count(), - Sum = g.Sum(e => e.Address.Length) - } - ), + .Select(g => new + { + g.Key, + Count = g.Count(), + Sum = g.Sum(e => e.Address.Length) + }), elementSorter: e => (e.Key, e.Count, e.Sum) ); diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs index 55a62b532f1..b847343a106 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindNavigationsQueryTestBase.cs @@ -187,11 +187,8 @@ public virtual Task Select_collection_FirstOrDefault_project_single_column2(bool ss.Set() .OrderBy(c => c.CustomerID) .Take(2) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .Select(o => o.CustomerID) - .FirstOrDefault() + .Select(c => + c.Orders.OrderBy(o => o.OrderID).Select(o => o.CustomerID).FirstOrDefault() ) ); @@ -205,11 +202,10 @@ public virtual Task Select_collection_FirstOrDefault_project_anonymous_type(bool .Where(e => e.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) .Take(2) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .Select(o => new { o.CustomerID, o.OrderID }) - .FirstOrDefault() + .Select(c => + c.Orders.OrderBy(o => o.OrderID) + .Select(o => new { o.CustomerID, o.OrderID }) + .FirstOrDefault() ), assertOrder: true ); @@ -226,14 +222,14 @@ bool async .Where(e => e.CustomerID.StartsWith("F")) .OrderBy(c => c.CustomerID) .Take(2) - .Select( - c => - c.Orders.OrderBy(o => o.OrderID) - .Select( - o => - new { o.CustomerID, OrderID = ClientFunction(o.OrderID, 5) } - ) - .FirstOrDefault() + .Select(c => + c.Orders.OrderBy(o => o.OrderID) + .Select(o => new + { + o.CustomerID, + OrderID = ClientFunction(o.OrderID, 5) + }) + .FirstOrDefault() ), assertOrder: true ); @@ -338,14 +334,10 @@ public virtual Task Select_count_plus_sum(bool async) => async, ss => ss.Set() - .Select( - o => - new - { - Total = o.OrderDetails.Sum(od => od.Quantity) - + o.OrderDetails.Count() - } - ), + .Select(o => new + { + Total = o.OrderDetails.Sum(od => od.Quantity) + o.OrderDetails.Count() + }), elementSorter: e => e.Total ); @@ -798,11 +790,8 @@ bool async ss => ss.Set() .Where(e => e.CustomerID.StartsWith("A")) - .Select( - c => - ss.Set() - .FirstOrDefault(o => o.CustomerID == "ALFKI") - .Customer.City + .Select(c => + ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer.City ) ); @@ -816,8 +805,8 @@ bool async ss => ss.Set() .Where(e => e.CustomerID.StartsWith("A")) - .Select( - c => ss.Set().SingleOrDefault(o => o.OrderID == 10643).Customer.City + .Select(c => + ss.Set().SingleOrDefault(o => o.OrderID == 10643).Customer.City ) ); @@ -831,27 +820,25 @@ bool async ss => ss.Set() .Where(e => e.CustomerID.StartsWith("A")) - .Select( - c => - EF.Property( - EF.Property( - ss.Set().FirstOrDefault(oo => oo.CustomerID == "ALFKI"), - "Customer" - ), - "City" - ) + .Select(c => + EF.Property( + EF.Property( + ss.Set().FirstOrDefault(oo => oo.CustomerID == "ALFKI"), + "Customer" + ), + "City" + ) ), ss => ss.Set() .Where(c => c.CustomerID.StartsWith("A")) - .Select( - c => - ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer - != null - ? ss.Set() - .FirstOrDefault(o => o.CustomerID == "ALFKI") - .Customer.City - : null + .Select(c => + ss.Set().FirstOrDefault(o => o.CustomerID == "ALFKI").Customer + != null + ? ss.Set() + .FirstOrDefault(o => o.CustomerID == "ALFKI") + .Customer.City + : null ) ); @@ -865,12 +852,11 @@ bool async ss => ss.Set() .Where(e => e.CustomerID.StartsWith("A")) - .Select( - c => - ss.Set() - .OrderBy(o => o.CustomerID) - .FirstOrDefault(o => o.CustomerID == "ALFKI") - .Customer.City + .Select(c => + ss.Set() + .OrderBy(o => o.CustomerID) + .FirstOrDefault(o => o.CustomerID == "ALFKI") + .Customer.City ) ); @@ -941,8 +927,7 @@ from p in ss.Set() ss.Set() .OrderByDescending(o => o.OrderID) .ThenBy(o => o.ProductID) - .FirstOrDefault( - orderDetail => orderDetail.Quantity == 1 + .FirstOrDefault(orderDetail => orderDetail.Quantity == 1 ) ) select p diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs index 1ea56bc8d3c..3410f9eab5b 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindSetOperationsQueryTestBase.cs @@ -1075,16 +1075,13 @@ public virtual Task Union_on_entity_plus_other_column_with_correlated_collection .Select(c => new { c.Customer, c.OrderDate }) ) .OrderBy(c => c.Customer.CustomerID) - .Select( - c => - new - { - c.OrderDate, - Orders = ss.Set() - .Where(o => o.CustomerID == c.Customer.CustomerID) - .ToList() - } - ), + .Select(c => new + { + c.OrderDate, + Orders = ss.Set() + .Where(o => o.CustomerID == c.Customer.CustomerID) + .ToList() + }), assertOrder: true, elementAsserter: (e, a) => { diff --git a/efcore/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs index 65d6133df49..1a173d278fd 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs @@ -314,8 +314,8 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => c.City == new City { InstanceFieldValue = "London" }.InstanceFieldValue + .Where(c => + c.City == new City { InstanceFieldValue = "London" }.InstanceFieldValue ) ); @@ -323,9 +323,8 @@ await AssertQuery( async, ss => ss.Set() - .Where( - c => - c.City == new City { InstanceFieldValue = "Seattle" }.InstanceFieldValue + .Where(c => + c.City == new City { InstanceFieldValue = "Seattle" }.InstanceFieldValue ) ); } @@ -541,10 +540,9 @@ public virtual Task Where_subquery_correlated_client_eval(bool async) => ss.Set() .OrderBy(c1 => c1.CustomerID) .Take(5) - .Where( - c1 => - ss.Set() - .Any(c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon) + .Where(c1 => + ss.Set() + .Any(c2 => c1.CustomerID == c2.CustomerID && c2.IsLondon) ) ) ); @@ -582,10 +580,8 @@ public virtual Task Where_client_and_server_non_top_level(bool async) => async, ss => ss.Set() - .Where( - c => - c.CustomerID != "ALFKI" - == (c.IsLondon && c.CustomerID != "AROUT") + .Where(c => + c.CustomerID != "ALFKI" == (c.IsLondon && c.CustomerID != "AROUT") ) ), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer)) @@ -600,13 +596,12 @@ public virtual Task Where_client_deep_inside_predicate_and_server_top_level(bool async, ss => ss.Set() - .Where( - c => - c.CustomerID != "ALFKI" - && ( - c.CustomerID == "MAUMAR" - || (c.CustomerID != "AROUT" && c.IsLondon) - ) + .Where(c => + c.CustomerID != "ALFKI" + && ( + c.CustomerID == "MAUMAR" + || (c.CustomerID != "AROUT" && c.IsLondon) + ) ) ), CoreStrings.QueryUnableToTranslateMember(nameof(Customer.IsLondon), nameof(Customer)) @@ -1495,10 +1490,9 @@ public virtual Task Where_ternary_boolean_condition_with_another_condition(bool async, ss => ss.Set() - .Where( - p => - p.ProductID < productId - && (flag ? p.UnitsInStock >= 20 : p.UnitsInStock < 20) + .Where(p => + p.ProductID < productId + && (flag ? p.UnitsInStock >= 20 : p.UnitsInStock < 20) ) ); } @@ -1544,8 +1538,7 @@ public virtual Task Where_compare_constructed_multi_value_equal(bool async) => async, ss => ss.Set() - .Where( - c => new { x = c.City, y = c.Country } == new { x = "London", y = "UK" } + .Where(c => new { x = c.City, y = c.Country } == new { x = "London", y = "UK" } ), ss => ss.Set().Where(c => c.City == "London" && c.Country == "UK") ); @@ -1578,10 +1571,9 @@ public virtual Task Where_compare_tuple_constructed_multi_value_equal(bool async async, ss => ss.Set() - .Where( - c => - new Tuple(c.City, c.Country) - == new Tuple("London", "UK") + .Where(c => + new Tuple(c.City, c.Country) + == new Tuple("London", "UK") ), ss => ss.Set().Where(c => c.City == "London" && c.Country == "UK") ); @@ -1593,10 +1585,9 @@ public virtual Task Where_compare_tuple_constructed_multi_value_not_equal(bool a async, ss => ss.Set() - .Where( - c => - new Tuple(c.City, c.Country) - != new Tuple("London", "UK") + .Where(c => + new Tuple(c.City, c.Country) + != new Tuple("London", "UK") ), ss => ss.Set().Where(c => c.City != "London" || c.Country != "UK") ); @@ -1716,18 +1707,17 @@ public virtual Task Where_multiple_contains_in_subquery_with_or(bool async) => async, ss => ss.Set() - .Where( - od => - ss.Set() - .OrderBy(p => p.ProductID) - .Take(1) - .Select(p => p.ProductID) - .Contains(od.ProductID) - || ss.Set() - .OrderBy(o => o.OrderID) - .Take(1) - .Select(o => o.OrderID) - .Contains(od.OrderID) + .Where(od => + ss.Set() + .OrderBy(p => p.ProductID) + .Take(1) + .Select(p => p.ProductID) + .Contains(od.ProductID) + || ss.Set() + .OrderBy(o => o.OrderID) + .Take(1) + .Select(o => o.OrderID) + .Contains(od.OrderID) ) ); @@ -1738,18 +1728,17 @@ public virtual Task Where_multiple_contains_in_subquery_with_and(bool async) => async, ss => ss.Set() - .Where( - od => - ss.Set() - .OrderBy(p => p.ProductID) - .Take(20) - .Select(p => p.ProductID) - .Contains(od.ProductID) - && ss.Set() - .OrderBy(o => o.OrderID) - .Take(10) - .Select(o => o.OrderID) - .Contains(od.OrderID) + .Where(od => + ss.Set() + .OrderBy(p => p.ProductID) + .Take(20) + .Select(p => p.ProductID) + .Contains(od.ProductID) + && ss.Set() + .OrderBy(o => o.OrderID) + .Take(10) + .Select(o => o.OrderID) + .Contains(od.OrderID) ) ); @@ -1778,10 +1767,9 @@ public virtual Task Where_subquery_FirstOrDefault_compared_to_entity(bool async) async, ss => ss.Set() - .Where( - c => - c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() - == new Order { OrderID = 10276 } + .Where(c => + c.Orders.OrderBy(o => o.OrderID).FirstOrDefault() + == new Order { OrderID = 10276 } ), ss => ss.Set() @@ -1875,13 +1863,12 @@ bool async async, ss => ss.Set() - .Where( - c => - ss.Set() - .Where(o => o.CustomerID == "John Doe") - .Select(o => o.CustomerID) - .FirstOrDefault() - .Length == 0 + .Where(c => + ss.Set() + .Where(o => o.CustomerID == "John Doe") + .Select(o => o.CustomerID) + .FirstOrDefault() + .Length == 0 ), ss => ss.Set().Where(c => false), assertEmpty: true @@ -1941,12 +1928,11 @@ public virtual Task Where_Queryable_ToList_Contains(bool async) => async, ss => ss.Set() - .Select( - c => - ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .Select(o => o.CustomerID) - .ToList() + .Select(c => + ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .Select(o => o.CustomerID) + .ToList() ) .Where(e => e.Contains("ALFKI")) ); @@ -1972,12 +1958,11 @@ public virtual Task Where_Queryable_ToArray_Contains(bool async) => async, ss => ss.Set() - .Select( - c => - ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .Select(o => o.CustomerID) - .ToArray() + .Select(c => + ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .Select(o => o.CustomerID) + .ToArray() ) .Where(e => e.Contains("ALFKI")) ); @@ -1990,8 +1975,8 @@ public virtual Task Where_Queryable_AsEnumerable_Count(bool async) => ss => ss.Set() .OrderBy(c => c.CustomerID) - .Select( - c => ss.Set().Where(o => o.CustomerID == c.CustomerID).AsEnumerable() + .Select(c => + ss.Set().Where(o => o.CustomerID == c.CustomerID).AsEnumerable() ) .Where(e => e.Count() == 0), assertOrder: true, @@ -2005,12 +1990,11 @@ public virtual Task Where_Queryable_AsEnumerable_Contains(bool async) => async, ss => ss.Set() - .Select( - c => - ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .Select(o => o.CustomerID) - .AsEnumerable() + .Select(c => + ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .Select(o => o.CustomerID) + .AsEnumerable() ) .Where(e => e.Contains("ALFKI")) ); @@ -2022,17 +2006,14 @@ public virtual Task Where_Queryable_AsEnumerable_Contains_negated(bool async) => async, ss => ss.Set() - .Select( - c => - new - { - c.CustomerID, - Subquery = ss.Set() - .Where(o => o.CustomerID == c.CustomerID) - .Select(o => o.CustomerID) - .AsEnumerable() - } - ) + .Select(c => new + { + c.CustomerID, + Subquery = ss.Set() + .Where(o => o.CustomerID == c.CustomerID) + .Select(o => o.CustomerID) + .AsEnumerable() + }) .Where(e => !e.Subquery.Contains("ALFKI")), elementSorter: e => e.CustomerID, elementAsserter: (e, a) => AssertCollection(e.Subquery, a.Subquery) @@ -2209,12 +2190,11 @@ public virtual Task Multiple_OrElse_on_same_column_converted_to_in_with_overlap( async, ss => ss.Set() - .Where( - c => - c.CustomerID == "ALFKI" - || c.CustomerID == "ANATR" - || c.CustomerID == "ANTON" - || c.CustomerID == "ANATR" + .Where(c => + c.CustomerID == "ALFKI" + || c.CustomerID == "ANATR" + || c.CustomerID == "ANTON" + || c.CustomerID == "ANATR" ) ); @@ -2227,12 +2207,8 @@ bool async async, ss => ss.Set() - .Where( - c => - c.Region == "WA" - || c.Region == "OR" - || c.Region == null - || c.Region == "BC" + .Where(c => + c.Region == "WA" || c.Region == "OR" || c.Region == null || c.Region == "BC" ) ); @@ -2245,10 +2221,8 @@ bool async async, ss => ss.Set() - .Where( - c => - new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) - || c.CustomerID == "ANTON" + .Where(c => + new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) || c.CustomerID == "ANTON" ) ); @@ -2261,11 +2235,10 @@ bool async async, ss => ss.Set() - .Where( - c => - c.CustomerID == "ANTON" - || new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) - || c.CustomerID == "ALFKI" + .Where(c => + c.CustomerID == "ANTON" + || new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) + || c.CustomerID == "ALFKI" ) ); @@ -2278,10 +2251,9 @@ bool async async, ss => ss.Set() - .Where( - c => - new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) - || new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID) + .Where(c => + new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) + || new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID) ) ); @@ -2294,10 +2266,9 @@ bool async async, ss => ss.Set() - .Where( - c => - !new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) - && !new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID) + .Where(c => + !new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) + && !new[] { "ALFKI", "ANTON" }.Contains(c.CustomerID) ) ); @@ -2313,8 +2284,7 @@ public virtual Task Multiple_AndAlso_on_same_column_converted_to_in_using_parame async, ss => ss.Set() - .Where( - c => c.CustomerID != prm1 && c.CustomerID != prm2 && c.CustomerID != prm3 + .Where(c => c.CustomerID != prm1 && c.CustomerID != prm2 && c.CustomerID != prm3 ) ); } @@ -2332,8 +2302,8 @@ bool async async, ss => ss.Set() - .Where( - c => new[] { prm1, prm2 }.Contains(c.CustomerID) || c.CustomerID == "ANTON" + .Where(c => + new[] { prm1, prm2 }.Contains(c.CustomerID) || c.CustomerID == "ANTON" ) ); } @@ -2350,12 +2320,8 @@ bool async async, ss => ss.Set() - .Where( - c => - c.Region == "WA" - || c.Region == "OR" - || c.Region == prm - || c.Region == "BC" + .Where(c => + c.Region == "WA" || c.Region == "OR" || c.Region == prm || c.Region == "BC" ) ); } @@ -2388,11 +2354,8 @@ bool async async, ss => ss.Set() - .Where( - c => - c.CustomerID == prm1 - || array.Contains(c.CustomerID) - || c.CustomerID == prm2 + .Where(c => + c.CustomerID == prm1 || array.Contains(c.CustomerID) || c.CustomerID == prm2 ) ); } @@ -2404,10 +2367,9 @@ public virtual Task Two_sets_of_comparison_combine_correctly(bool async) => async, ss => ss.Set() - .Where( - c => - new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) - && (c.CustomerID == "ANATR" || c.CustomerID == "ANTON") + .Where(c => + new[] { "ALFKI", "ANATR" }.Contains(c.CustomerID) + && (c.CustomerID == "ANATR" || c.CustomerID == "ANTON") ) ); @@ -2418,10 +2380,9 @@ public virtual Task Two_sets_of_comparison_combine_correctly2(bool async) => async, ss => ss.Set() - .Where( - c => - (c.Region != "WA" && c.Region != "OR" && c.Region != null) - || (c.Region != "WA" && c.Region != null) + .Where(c => + (c.Region != "WA" && c.Region != "OR" && c.Region != null) + || (c.Region != "WA" && c.Region != null) ) ); @@ -2575,8 +2536,8 @@ public virtual Task ElementAt_over_custom_projection_compared_to_not_null(bool a .Where(c => c.Orders.Select(o => new { o.OrderID }).ElementAt(3) != null), ss => ss.Set() - .Where( - c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(3) != null + .Where(c => + c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(3) != null ) ); @@ -2587,13 +2548,13 @@ public virtual Task ElementAtOrDefault_over_custom_projection_compared_to_null(b async, ss => ss.Set() - .Where( - c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null + .Where(c => + c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null ), ss => ss.Set() - .Where( - c => c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null + .Where(c => + c.Orders.Select(o => new { o.OrderID }).ElementAtOrDefault(7) == null ) ); diff --git a/efcore/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs index 74548f00d36..9c8457233a5 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/OwnedEntityQueryTestBase.cs @@ -21,33 +21,29 @@ bool async { var query = context .Entities.AsNoTracking() - .Select( - e => - new - { - e.Id, - FirstChild = e.Children.Where(c => c.Type == 1) - .AsQueryable() - .Select(_project) - .FirstOrDefault(), - SecondChild = e.Children.Where(c => c.Type == 2) - .AsQueryable() - .Select(_project) - .FirstOrDefault(), - } - ); + .Select(e => new + { + e.Id, + FirstChild = e.Children.Where(c => c.Type == 1) + .AsQueryable() + .Select(_project) + .FirstOrDefault(), + SecondChild = e.Children.Where(c => c.Type == 2) + .AsQueryable() + .Select(_project) + .FirstOrDefault(), + }); var result = async ? await query.ToListAsync() : query.ToList(); } } - private static readonly Expression> _project = x => - new - { - x.Id, - x.Owned, // Comment this line for success - x.Type, - }; + private static readonly Expression> _project = x => new + { + x.Id, + x.Owned, // Comment this line for success + x.Type, + }; protected class Context20277 : DbContext { @@ -101,14 +97,11 @@ public virtual async Task OwnsMany_correlated_projection(bool async) using (var context = contextFactory.CreateContext()) { var results = await context - .Contacts.Select( - contact => - new ContactDto22089 - { - Id = contact.Id, - Names = contact.Names.Select(name => new NameDto22089()).ToArray() - } - ) + .Contacts.Select(contact => new ContactDto22089 + { + Id = contact.Id, + Names = contact.Names.Select(name => new NameDto22089()).ToArray() + }) .ToListAsync(); } } @@ -162,22 +155,16 @@ public virtual async Task Projecting_owned_collection_and_aggregate(bool async) using var context = contextFactory.CreateContext(); var query = context .Set() - .Select( - b => - new BlogDto24133 - { - Id = b.Id, - TotalComments = b.Posts.Sum(p => p.CommentsCount), - Posts = b.Posts.Select( - p => - new PostDto24133 - { - Title = p.Title, - CommentsCount = p.CommentsCount - } - ) - } - ); + .Select(b => new BlogDto24133 + { + Id = b.Id, + TotalComments = b.Posts.Sum(p => p.CommentsCount), + Posts = b.Posts.Select(p => new PostDto24133 + { + Title = p.Title, + CommentsCount = p.CommentsCount + }) + }); var result = async ? await query.ToListAsync() : query.ToList(); } @@ -240,15 +227,12 @@ public virtual async Task Projecting_correlated_collection_property_for_owned_en using var context = contextFactory.CreateContext(); var query = context - .Warehouses.Select( - x => - new WarehouseModel - { - WarehouseCode = x.WarehouseCode, - DestinationCountryCodes = x.DestinationCountries.Select(c => c.CountryCode) - .ToArray() - } - ) + .Warehouses.Select(x => new WarehouseModel + { + WarehouseCode = x.WarehouseCode, + DestinationCountryCodes = x.DestinationCountries.Select(c => c.CountryCode) + .ToArray() + }) .AsNoTracking(); var result = async ? await query.ToListAsync() : query.ToList(); diff --git a/efcore/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs index 17376239ecd..d7c1da7e113 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/PrimitiveCollectionsQueryTestBase.cs @@ -458,16 +458,14 @@ public virtual Task Column_collection_index_datetime(bool async) => async, ss => ss.Set() - .Where( - c => - c.DateTimes[1] == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc) + .Where(c => + c.DateTimes[1] == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc) ), ss => ss.Set() - .Where( - c => - (c.DateTimes.Length >= 2 ? c.DateTimes[1] : default) - == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc) + .Where(c => + (c.DateTimes.Length >= 2 ? c.DateTimes[1] : default) + == new DateTime(2020, 1, 10, 12, 30, 0, DateTimeKind.Utc) ) ); @@ -493,10 +491,9 @@ bool async .Where(c => c.NullableStrings[2] == c.NullableString), ss => ss.Set() - .Where( - c => - (c.NullableStrings.Length > 2 ? c.NullableStrings[2] : default) - == c.NullableString + .Where(c => + (c.NullableStrings.Length > 2 ? c.NullableStrings[2] : default) + == c.NullableString ) ); @@ -512,10 +509,9 @@ bool async .Where(c => c.Strings.Any() && c.Strings[1] == c.NullableString), ss => ss.Set() - .Where( - c => - c.Strings.Any() - && (c.Strings.Length > 1 ? c.Strings[1] : default) == c.NullableString + .Where(c => + c.Strings.Any() + && (c.Strings.Length > 1 ? c.Strings[1] : default) == c.NullableString ) ); @@ -610,10 +606,8 @@ public virtual Task Column_collection_OrderByDescending_ElementAt(bool async) => .Where(c => c.Ints.OrderByDescending(i => i).ElementAt(0) == 111), ss => ss.Set() - .Where( - c => - c.Ints.Length > 0 - && c.Ints.OrderByDescending(i => i).ElementAt(0) == 111 + .Where(c => + c.Ints.Length > 0 && c.Ints.OrderByDescending(i => i).ElementAt(0) == 111 ) ); @@ -655,10 +649,9 @@ public virtual Task Column_collection_Join_parameter_collection(bool async) async, ss => ss.Set() - .Where( - c => - c.Ints.Join(ints, i => i, j => j, (i, j) => new { I = i, J = j }) - .Count() == 2 + .Where(c => + c.Ints.Join(ints, i => i, j => j, (i, j) => new { I = i, J = j }).Count() + == 2 ) ); } @@ -670,11 +663,10 @@ public virtual Task Inline_collection_Join_ordered_column_collection(bool async) async, ss => ss.Set() - .Where( - c => - new[] { 11, 111 } - .Join(c.Ints, i => i, j => j, (i, j) => new { I = i, J = j }) - .Count() == 2 + .Where(c => + new[] { 11, 111 } + .Join(c.Ints, i => i, j => j, (i, j) => new { I = i, J = j }) + .Count() == 2 ) ); @@ -856,17 +848,16 @@ public virtual Task Parameter_collection_in_subquery_Union_column_collection_nes async, ss => ss.Set() - .Where( - p => - ints.Skip(1) - .Union( - p.Ints.OrderBy(x => x) - .Skip(1) - .Distinct() - .OrderByDescending(x => x) - .Take(20) - ) - .Count() == 3 + .Where(p => + ints.Skip(1) + .Union( + p.Ints.OrderBy(x => x) + .Skip(1) + .Distinct() + .OrderByDescending(x => x) + .Take(20) + ) + .Count() == 3 ) ); } @@ -1045,14 +1036,11 @@ bool async ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Empty = x.NullableInts.Where(x => false).ToList(), - OnlyNull = x.NullableInts.Where(x => x == null).ToList(), - } - ), + .Select(x => new + { + Empty = x.NullableInts.Where(x => false).ToList(), + OnlyNull = x.NullableInts.Where(x => x == null).ToList(), + }), assertOrder: true, elementAsserter: (e, a) => { @@ -1069,19 +1057,14 @@ public virtual Task Project_multiple_collections(bool async) => ss => ss.Set() .OrderBy(x => x.Id) - .Select( - x => - new - { - Ints = x.Ints.ToList(), - OrderedInts = x.Ints.OrderByDescending(xx => xx).ToList(), - FilteredDateTimes = x.DateTimes.Where(xx => xx.Day != 1).ToList(), - FilteredDateTimes2 = x.DateTimes.Where( - xx => xx > new DateTime(2000, 1, 1) - ) - .ToList() - } - ), + .Select(x => new + { + Ints = x.Ints.ToList(), + OrderedInts = x.Ints.OrderByDescending(xx => xx).ToList(), + FilteredDateTimes = x.DateTimes.Where(xx => xx.Day != 1).ToList(), + FilteredDateTimes2 = x.DateTimes.Where(xx => xx > new DateTime(2000, 1, 1)) + .ToList() + }), elementAsserter: (e, a) => { AssertCollection(e.Ints, a.Ints, ordered: true); @@ -1105,15 +1088,12 @@ public virtual Task Project_primitive_collections_element(bool async) => ss.Set() .Where(x => x.Id < 4) .OrderBy(x => x.Id) - .Select( - x => - new - { - Indexer = x.Ints[0], - EnumerableElementAt = x.DateTimes.ElementAt(0), - QueryableElementAt = x.Strings.AsQueryable().ElementAt(1) - } - ), + .Select(x => new + { + Indexer = x.Ints[0], + EnumerableElementAt = x.DateTimes.ElementAt(0), + QueryableElementAt = x.Strings.AsQueryable().ElementAt(1) + }), elementAsserter: (e, a) => { AssertEqual(e.Indexer, a.Indexer); diff --git a/efcore/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs b/efcore/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs index c562d47ead4..2d98ad6b24b 100644 --- a/efcore/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Query/SharedTypeQueryTestBase.cs @@ -47,11 +47,10 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder .Entity() .HasNoKey() - .HasQueryFilter( - e => - Set>("STET") - .Select(i => (string)i["Value"]) - .Contains(e.Value) + .HasQueryFilter(e => + Set>("STET") + .Select(i => (string)i["Value"]) + .Contains(e.Value) ); } } diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs b/efcore/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs index e0f7648964f..8fccd4273e1 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/AspNetIdentity/IdentityUserContext.cs @@ -56,8 +56,7 @@ protected override void OnModelCreating(ModelBuilder builder) { var personalDataProps = typeof(TUser) .GetProperties() - .Where( - prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute)) + .Where(prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute)) ); foreach (var p in personalDataProps) { @@ -93,15 +92,12 @@ protected override void OnModelCreating(ModelBuilder builder) builder.Entity(b => { - b.HasKey( - t => - new - { - t.UserId, - t.LoginProvider, - t.Name - } - ); + b.HasKey(t => new + { + t.UserId, + t.LoginProvider, + t.Name + }); if (maxKeyLength > 0) { @@ -113,8 +109,7 @@ protected override void OnModelCreating(ModelBuilder builder) { var tokenProps = typeof(TUserToken) .GetProperties() - .Where( - prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute)) + .Where(prop => Attribute.IsDefined(prop, typeof(ProtectedPersonalDataAttribute)) ); foreach (var p in tokenProps) { diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs b/efcore/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs index 373e67515c9..0c55e48cc9c 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/ConferencePlanner/EntityExtensions.cs @@ -15,9 +15,11 @@ public static SessionResponse MapSessionResponse(this Session session) => StartTime = session.StartTime, EndTime = session.EndTime, Speakers = session - .SessionSpeakers?.Select( - ss => new ConferenceDTO.Speaker { Id = ss.SpeakerId, Name = ss.Speaker.Name } - ) + .SessionSpeakers?.Select(ss => new ConferenceDTO.Speaker + { + Id = ss.SpeakerId, + Name = ss.Speaker.Name + }) .ToList(), TrackId = session.TrackId, Track = new ConferenceDTO.Track @@ -36,9 +38,11 @@ public static SpeakerResponse MapSpeakerResponse(this Speaker speaker) => Bio = speaker.Bio, WebSite = speaker.WebSite, Sessions = speaker - .SessionSpeakers?.Select( - ss => new ConferenceDTO.Session { Id = ss.SessionId, Title = ss.Session.Title } - ) + .SessionSpeakers?.Select(ss => new ConferenceDTO.Session + { + Id = ss.SessionId, + Title = ss.Session.Title + }) .ToList() }; @@ -51,16 +55,13 @@ public static AttendeeResponse MapAttendeeResponse(this Attendee attendee) => UserName = attendee.UserName, EmailAddress = attendee.EmailAddress, Sessions = attendee - .SessionsAttendees?.Select( - sa => - new ConferenceDTO.Session - { - Id = sa.SessionId, - Title = sa.Session.Title, - StartTime = sa.Session.StartTime, - EndTime = sa.Session.EndTime - } - ) + .SessionsAttendees?.Select(sa => new ConferenceDTO.Session + { + Id = sa.SessionId, + Title = sa.Session.Title, + StartTime = sa.Session.StartTime, + EndTime = sa.Session.EndTime + }) .ToList() }; } diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs b/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs index 7c221b8318d..4d0b91d6545 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceModel/InheritanceData.cs @@ -24,26 +24,25 @@ public InheritanceData(bool useGeneratedKeys) WireUp(Animals, Countries); AnimalQueries = Animals - .Select( - a => - a is Eagle - ? (AnimalQuery) - new EagleQuery - { - Name = a.Name, - CountryId = a.CountryId, - EagleId = ((Bird)a).EagleId, - IsFlightless = ((Bird)a).IsFlightless, - Group = ((Eagle)a).Group, - } - : new KiwiQuery + .Select(a => + a is Eagle + ? (AnimalQuery) + new EagleQuery { Name = a.Name, CountryId = a.CountryId, EagleId = ((Bird)a).EagleId, IsFlightless = ((Bird)a).IsFlightless, - FoundOn = ((Kiwi)a).FoundOn, + Group = ((Eagle)a).Group, } + : new KiwiQuery + { + Name = a.Name, + CountryId = a.CountryId, + EagleId = ((Bird)a).EagleId, + IsFlightless = ((Bird)a).IsFlightless, + FoundOn = ((Kiwi)a).FoundOn, + } ) .ToList(); } diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceRelationshipsModel/InheritanceRelationshipsContext.cs b/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceRelationshipsModel/InheritanceRelationshipsContext.cs index 52b65963884..dba25369acb 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceRelationshipsModel/InheritanceRelationshipsContext.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/InheritanceRelationshipsModel/InheritanceRelationshipsContext.cs @@ -27,8 +27,9 @@ public InheritanceRelationshipsContext(DbContextOptions options) public static void Seed(InheritanceRelationshipsContext context) { var baseCollectionsOnBase = InheritanceRelationshipsData.CreateBaseCollectionsOnBase(); - var baseCollectionsOnDerived = - InheritanceRelationshipsData.CreateBaseCollectionsOnDerived(); + var baseCollectionsOnDerived = InheritanceRelationshipsData.CreateBaseCollectionsOnDerived( + + ); var baseEntities = InheritanceRelationshipsData.CreateBaseEntities(); var baseReferencesOnBase = InheritanceRelationshipsData.CreateBaseReferencesOnBase(); var baseReferencesOnDerived = InheritanceRelationshipsData.CreateBaseReferencesOnDerived(); diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs b/efcore/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs index 9103c67ac25..7ac85d9cdf7 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/MonsterContext`.cs @@ -398,22 +398,20 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) // TODO: Many-to-many //modelBuilder.Entity().ForeignKeys(fk => fk.HasForeignKey(e => e.SupplierId)); - modelBuilder.Entity( - bb => - bb.HasOne(b => (TSupplier)b.Supplier) - .WithMany(s => (ICollection)s.BackOrderLines) - .HasForeignKey(e => e.SupplierId) + modelBuilder.Entity(bb => + bb.HasOne(b => (TSupplier)b.Supplier) + .WithMany(s => (ICollection)s.BackOrderLines) + .HasForeignKey(e => e.SupplierId) ); - modelBuilder.Entity( - db => - db.HasOne(d => (TProduct)d.ReplacedBy) - .WithMany(p => (ICollection)p.Replaces) - .HasForeignKey(e => e.ReplacementProductId) + modelBuilder.Entity(db => + db.HasOne(d => (TProduct)d.ReplacedBy) + .WithMany(p => (ICollection)p.Replaces) + .HasForeignKey(e => e.ReplacementProductId) ); - modelBuilder.Entity( - pb => pb.HasOne(p => (TProduct)p.Product).WithMany().HasForeignKey(e => e.ProductId) + modelBuilder.Entity(pb => + pb.HasOne(p => (TProduct)p.Product).WithMany().HasForeignKey(e => e.ProductId) ); } diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs b/efcore/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs index b9f5a465935..eb3ed60ce38 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/MusicStore/ShoppingCart.cs @@ -19,8 +19,8 @@ private ShoppingCart(MusicStoreContext dbContext, string id) public async Task AddToCart(Album album) { // Get the matching cart and album instances - var cartItem = await _dbContext.CartItems.SingleOrDefaultAsync( - c => c.CartId == _shoppingCartId && c.AlbumId == album.AlbumId + var cartItem = await _dbContext.CartItems.SingleOrDefaultAsync(c => + c.CartId == _shoppingCartId && c.AlbumId == album.AlbumId ); if (cartItem == null) @@ -46,8 +46,8 @@ public async Task AddToCart(Album album) public int RemoveFromCart(int id) { // Get the cart - var cartItem = _dbContext.CartItems.SingleOrDefault( - cart => cart.CartId == _shoppingCartId && cart.CartItemId == id + var cartItem = _dbContext.CartItems.SingleOrDefault(cart => + cart.CartId == _shoppingCartId && cart.CartItemId == id ); var itemCount = 0; diff --git a/efcore/test/EFCore.Specification.Tests/TestModels/QueryFilterFuncletizationContext.cs b/efcore/test/EFCore.Specification.Tests/TestModels/QueryFilterFuncletizationContext.cs index e1351ed2183..109ef52da40 100644 --- a/efcore/test/EFCore.Specification.Tests/TestModels/QueryFilterFuncletizationContext.cs +++ b/efcore/test/EFCore.Specification.Tests/TestModels/QueryFilterFuncletizationContext.cs @@ -48,8 +48,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) .HasQueryFilter(x => x.IsEnabled == Property && (Tenant + GetId() > 0)); modelBuilder .Entity() - .HasQueryFilter( - x => !x.IsDeleted && (IsModerated == null || IsModerated == x.IsModerated) + .HasQueryFilter(x => + !x.IsDeleted && (IsModerated == null || IsModerated == x.IsModerated) ); modelBuilder .Entity() @@ -90,8 +90,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) // Multiple context used in filter modelBuilder .Entity() - .HasQueryFilter( - e => e.IsEnabled == Property && e.BossId == new IncorrectDbContext().BossId + .HasQueryFilter(e => + e.IsEnabled == Property && e.BossId == new IncorrectDbContext().BossId ); modelBuilder.Entity().HasQueryFilter(x => x.Tenant == Tenant); @@ -113,8 +113,8 @@ private static void IncorrectFilter(EntityTypeBuilder builder, private static void SetDependentFilter(ModelBuilder modelBuilder, DbContext context) => modelBuilder .Entity() - .HasQueryFilter( - p => context.Set().Any(b => b.BossId == p.PrincipalSetFilterId) + .HasQueryFilter(p => + context.Set().Any(b => b.BossId == p.PrincipalSetFilterId) ); #region EntityTypeConfigs diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/ExpectedQueryRewritingVisitor.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/ExpectedQueryRewritingVisitor.cs index 52162056e94..4ef9bf99af1 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/ExpectedQueryRewritingVisitor.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/ExpectedQueryRewritingVisitor.cs @@ -28,14 +28,11 @@ static ExpectedQueryRewritingVisitor() var maybeScalarMethods = typeof(TestExtensions) .GetMethods() .Where(m => m.Name == nameof(TestExtensions.MaybeScalar)) - .Select( - m => - new - { - method = m, - argument = m.GetParameters()[1].ParameterType.GetGenericArguments()[1] - } - ); + .Select(m => new + { + method = m, + argument = m.GetParameters()[1].ParameterType.GetGenericArguments()[1] + }); _maybeScalarNullableMethod = maybeScalarMethods .Single(x => x.argument.IsNullableValueType()) @@ -267,10 +264,9 @@ expression is MethodCallExpression methodCallExpression if (propertyName != null) { var shadowPropertyMapping = _shadowPropertyMappings - .Where( - m => - caller.Type.GetTypesInHierarchy().Contains(m.Key.Item1) - && m.Key.Item2 == propertyName + .Where(m => + caller.Type.GetTypesInHierarchy().Contains(m.Key.Item1) + && m.Key.Item2 == propertyName ) .Select(m => m.Value) .SingleOrDefault(); diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs index 297933c798b..1021993d950 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/QueryTestGeneration/ExpressionMutator.cs @@ -17,30 +17,27 @@ static ExpressionMutator() { IncludeMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetMethods() - .Where( - m => - m.Name == nameof(EntityFrameworkQueryableExtensions.Include) - && m.GetParameters()[1].ParameterType != typeof(string) + .Where(m => + m.Name == nameof(EntityFrameworkQueryableExtensions.Include) + && m.GetParameters()[1].ParameterType != typeof(string) ) .Single(); ThenIncludeCollectionMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetMethods() - .Where( - m => - m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) - && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].IsGenericType - && m.GetParameters()[0] - .ParameterType.GetGenericArguments()[1] - .GetGenericTypeDefinition() == typeof(IEnumerable<>) + .Where(m => + m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) + && m.GetParameters()[0].ParameterType.GetGenericArguments()[1].IsGenericType + && m.GetParameters()[0] + .ParameterType.GetGenericArguments()[1] + .GetGenericTypeDefinition() == typeof(IEnumerable<>) ) .Single(); ThenIncludeReferenceMethodInfo = typeof(EntityFrameworkQueryableExtensions) .GetMethods() - .Where( - m => - m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) - && m != ThenIncludeCollectionMethodInfo + .Where(m => + m.Name == nameof(EntityFrameworkQueryableExtensions.ThenInclude) + && m != ThenIncludeCollectionMethodInfo ) .Single(); } @@ -95,8 +92,8 @@ protected List FilterPropertyInfos(Type type, List p if (type.IsArray) { properties = properties - .Where( - p => p.Name != "Rank" && p.Name != "IsFixedSize" && p.Name != "IsSynchronized" + .Where(p => + p.Name != "Rank" && p.Name != "IsFixedSize" && p.Name != "IsSynchronized" ) .ToList(); } @@ -110,13 +107,12 @@ protected List FilterPropertyInfos(Type type, List p if (entityType != null) { properties = properties - .Where( - p => - entityType - .GetProperties() - .Where(pp => pp.PropertyInfo != null) - .Select(pp => pp.Name) - .Contains(p.Name) + .Where(p => + entityType + .GetProperties() + .Where(pp => pp.PropertyInfo != null) + .Select(pp => pp.Name) + .Contains(p.Name) ) .ToList(); } diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs index c51aff29c3b..c113bd969f4 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/ServiceCollectionExtensions.cs @@ -9,12 +9,11 @@ public static class ServiceCollectionExtensions typeof(EntityFrameworkServiceCollectionExtensions) .GetTypeInfo() .GetDeclaredMethods(nameof(EntityFrameworkServiceCollectionExtensions.AddDbContext)) - .Single( - mi => - mi.GetParameters().Length == 4 - && mi.GetParameters()[1].ParameterType - == typeof(Action) - && mi.GetGenericArguments().Length == 1 + .Single(mi => + mi.GetParameters().Length == 4 + && mi.GetParameters()[1].ParameterType + == typeof(Action) + && mi.GetGenericArguments().Length == 1 ); public static IServiceCollection AddDbContext( @@ -44,12 +43,11 @@ public static IServiceCollection AddDbContext( .GetDeclaredMethods( nameof(EntityFrameworkServiceCollectionExtensions.AddPooledDbContextFactory) ) - .Single( - mi => - mi.GetParameters().Length == 3 - && mi.GetParameters()[1].ParameterType - == typeof(Action) - && mi.GetGenericArguments().Length == 1 + .Single(mi => + mi.GetParameters().Length == 3 + && mi.GetParameters()[1].ParameterType + == typeof(Action) + && mi.GetGenericArguments().Length == 1 ); public static IServiceCollection AddDbContextPool( diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs index c2f2c71832b..ad6c28f1b4e 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestHelpers.cs @@ -352,13 +352,12 @@ public static void AssertAllMethodsOverridden(Type testClass) { var methods = testClass .GetRuntimeMethods() - .Where( - m => - m.DeclaringType != testClass - && ( - Attribute.IsDefined(m, typeof(ConditionalFactAttribute)) - || Attribute.IsDefined(m, typeof(ConditionalTheoryAttribute)) - ) + .Where(m => + m.DeclaringType != testClass + && ( + Attribute.IsDefined(m, typeof(ConditionalFactAttribute)) + || Attribute.IsDefined(m, typeof(ConditionalTheoryAttribute)) + ) ) .ToList(); diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestModelSource.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestModelSource.cs index 8640d46aefc..15ba7f1af0c 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestModelSource.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestModelSource.cs @@ -46,21 +46,19 @@ public static Func GetFactory( Action onModelCreating, Action configureConventions = null ) => - p => - new TestModelSource( - configureConventions, - (mb, c) => onModelCreating(mb), - p.GetRequiredService() - ); + p => new TestModelSource( + configureConventions, + (mb, c) => onModelCreating(mb), + p.GetRequiredService() + ); public static Func GetFactory( Action onModelCreating, Action configureConventions = null ) => - p => - new TestModelSource( - configureConventions, - onModelCreating, - p.GetRequiredService() - ); + p => new TestModelSource( + configureConventions, + onModelCreating, + p.GetRequiredService() + ); } diff --git a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs index cd756a99498..358691d73b3 100644 --- a/efcore/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs +++ b/efcore/test/EFCore.Specification.Tests/TestUtilities/TestServiceFactory.cs @@ -85,10 +85,9 @@ private static ServiceCollection AddType( serviceCollection.AddSingleton(ServiceType, ImplementationType); var constructors = ImplementationType.GetConstructors(); - var constructor = constructors.FirstOrDefault( - c => - c.GetParameters().Length - == constructors.Max(c2 => c2.GetParameters().Length) + var constructor = constructors.FirstOrDefault(c => + c.GetParameters().Length + == constructors.Max(c2 => c2.GetParameters().Length) ); if (constructor == null) diff --git a/efcore/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs b/efcore/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs index 853a4d62827..cac8c52d51a 100644 --- a/efcore/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/UnidirectionalManyToManyTrackingTestBase.cs @@ -373,8 +373,8 @@ public virtual void Can_delete_with_many_to_many_composite_with_navs_unidirectio // Make sure other related entities are loaded for delete fixup context.Set().Load(); - var toRemoveOne = context.UnidirectionalEntityCompositeKeys.Single( - e => e.Name == "Composite 6" + var toRemoveOne = context.UnidirectionalEntityCompositeKeys.Single(e => + e.Name == "Composite 6" ); key1 = toRemoveOne.Key1; key2 = toRemoveOne.Key2; @@ -1115,12 +1115,12 @@ public virtual void Can_delete_with_many_to_many_composite_additional_pk_with_na // Make sure other related entities are loaded for delete fixup context.Set().Load(); - var toRemoveOne = context.UnidirectionalEntityCompositeKeys.Single( - e => e.Name == "Composite 6" + var toRemoveOne = context.UnidirectionalEntityCompositeKeys.Single(e => + e.Name == "Composite 6" ); - var toRemoveThree = context.UnidirectionalEntityThrees.Single( - e => e.Name == "EntityThree 17" + var toRemoveThree = context.UnidirectionalEntityThrees.Single(e => + e.Name == "EntityThree 17" ); threeId = toRemoveThree.Id; var refCountThrees = ones.SelectMany(e => e.ThreeSkipFull) @@ -2407,8 +2407,8 @@ public virtual void Can_update_many_to_many_self_with_payload_unidirectional() keys[5], context .Entry( - context.UnidirectionalEntityOnes.Local.Single( - e => e.Name == "EntityOne 1" + context.UnidirectionalEntityOnes.Local.Single(e => + e.Name == "EntityOne 1" ) ) .Property(e => e.Id) @@ -2420,16 +2420,16 @@ public virtual void Can_update_many_to_many_self_with_payload_unidirectional() .Find( context .Entry( - context.UnidirectionalEntityOnes.Local.Single( - e => e.Name == "EntityOne 20" + context.UnidirectionalEntityOnes.Local.Single(e => + e.Name == "EntityOne 20" ) ) .Property(e => e.Id) .CurrentValue, context .Entry( - context.UnidirectionalEntityOnes.Local.Single( - e => e.Name == "EntityOne 16" + context.UnidirectionalEntityOnes.Local.Single(e => + e.Name == "EntityOne 16" ) ) .Property(e => e.Id) @@ -2854,8 +2854,8 @@ public virtual void Can_update_many_to_many_shared_with_payload_unidirectional() ); leftEntities[2].ThreeSkipPayloadFullShared.Remove( - leftEntities[2].ThreeSkipPayloadFullShared.Single( - e => e.Name == "EntityThree 10" + leftEntities[2].ThreeSkipPayloadFullShared.Single(e => + e.Name == "EntityThree 10" ) ); var rightNav4 = @@ -2867,8 +2867,8 @@ public virtual void Can_update_many_to_many_shared_with_payload_unidirectional() rightNav4.Remove(rightNav4.Single(e => e.Name == "EntityOne 6")); leftEntities[3].ThreeSkipPayloadFullShared.Remove( - leftEntities[3].ThreeSkipPayloadFullShared.Single( - e => e.Name == "EntityThree 17" + leftEntities[3].ThreeSkipPayloadFullShared.Single(e => + e.Name == "EntityThree 17" ) ); leftEntities[3].ThreeSkipPayloadFullShared.Add( diff --git a/efcore/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs b/efcore/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs index 6bd815360fc..2ba24d25d6b 100644 --- a/efcore/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs +++ b/efcore/test/EFCore.Specification.Tests/Update/UpdatesTestBase.cs @@ -1070,59 +1070,54 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); - modelBuilder.Entity(eb => - { - eb.HasKey( - l => - new - { - l.ProfileId, - l.ProfileId1, - l.ProfileId3, - l.ProfileId4, - l.ProfileId5, - l.ProfileId6, - l.ProfileId7, - l.ProfileId8, - l.ProfileId9, - l.ProfileId10, - l.ProfileId11, - l.ProfileId12, - l.ProfileId13, - l.ProfileId14 - } - ); - eb.HasIndex( - l => - new - { - l.ProfileId, - l.ProfileId1, - l.ProfileId3, - l.ProfileId4, - l.ProfileId5, - l.ProfileId6, - l.ProfileId7, - l.ProfileId8, - l.ProfileId9, - l.ProfileId10, - l.ProfileId11, - l.ProfileId12, - l.ProfileId13, - l.ProfileId14, - l.ExtraProperty - } - ); - }); - - modelBuilder.Entity(eb => - { - eb.HasKey(l => new { l.ProfileId }); - eb.HasOne(d => d.Login) - .WithOne() - .HasForeignKey( - l => - new + modelBuilder.Entity( + eb => + { + eb.HasKey(l => new + { + l.ProfileId, + l.ProfileId1, + l.ProfileId3, + l.ProfileId4, + l.ProfileId5, + l.ProfileId6, + l.ProfileId7, + l.ProfileId8, + l.ProfileId9, + l.ProfileId10, + l.ProfileId11, + l.ProfileId12, + l.ProfileId13, + l.ProfileId14 + }); + eb.HasIndex(l => new + { + l.ProfileId, + l.ProfileId1, + l.ProfileId3, + l.ProfileId4, + l.ProfileId5, + l.ProfileId6, + l.ProfileId7, + l.ProfileId8, + l.ProfileId9, + l.ProfileId10, + l.ProfileId11, + l.ProfileId12, + l.ProfileId13, + l.ProfileId14, + l.ExtraProperty + }); + }); + + modelBuilder.Entity( + eb => + { + eb.HasKey(l => new { l.ProfileId }); + eb.HasOne(d => d.Login) + .WithOne() + .HasForeignKey( + l => new { l.ProfileId, l.ProfileId1, @@ -1139,31 +1134,29 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l.ProfileId13, l.ProfileId14 } - ); - }); + ); + } + ); modelBuilder.Entity(pb => { - pb.HasKey( - l => - new - { - l.Id, - l.Id1, - l.Id3, - l.Id4, - l.Id5, - l.Id6, - l.Id7, - l.Id8, - l.Id9, - l.Id10, - l.Id11, - l.Id12, - l.Id13, - l.Id14 - } - ); + pb.HasKey(l => new + { + l.Id, + l.Id1, + l.Id3, + l.Id4, + l.Id5, + l.Id6, + l.Id7, + l.Id8, + l.Id9, + l.Id10, + l.Id11, + l.Id12, + l.Id13, + l.Id14 + }); pb.HasOne(p => p.User).WithOne(l => l.Profile).IsRequired(); }); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/DbContextPoolingTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/DbContextPoolingTest.cs index 291ad58c878..d8ca159a962 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/DbContextPoolingTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/DbContextPoolingTest.cs @@ -573,8 +573,9 @@ public void Does_not_throw_when_parameterless_and_correct_constructor() using var scope = serviceProvider.CreateScope(); - var context = - scope.ServiceProvider.GetRequiredService(); + var context = scope.ServiceProvider.GetRequiredService( + + ); Assert.Equal("Options", context.ConstructorUsed); } @@ -703,10 +704,9 @@ async Task GetContextAsync(IServiceScope serviceScope) => public async Task ContextIds_make_sense_when_not_pooling(bool async) { var serviceProvider = new ServiceCollection() - .AddDbContext( - ob => - ob.UseSqlServer(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString) - .EnableServiceProviderCaching(false) + .AddDbContext(ob => + ob.UseSqlServer(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString) + .EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true); @@ -908,11 +908,11 @@ public async Task Context_configuration_is_reset( ) { var serviceProvider = useInterface - ? BuildServiceProvider( - b => UseQueryTrackingBehavior(b, queryTrackingBehavior) + ? BuildServiceProvider(b => + UseQueryTrackingBehavior(b, queryTrackingBehavior) ) - : BuildServiceProvider( - b => UseQueryTrackingBehavior(b, queryTrackingBehavior) + : BuildServiceProvider(b => + UseQueryTrackingBehavior(b, queryTrackingBehavior) ); var serviceScope = serviceProvider.CreateScope(); @@ -1032,8 +1032,8 @@ public async Task Uninitialized_context_configuration_is_reset_properly( QueryTrackingBehavior? queryTrackingBehavior ) { - var serviceProvider = BuildServiceProvider( - b => UseQueryTrackingBehavior(b, queryTrackingBehavior) + var serviceProvider = BuildServiceProvider(b => + UseQueryTrackingBehavior(b, queryTrackingBehavior) ); var serviceScope = serviceProvider.CreateScope(); @@ -1305,8 +1305,8 @@ public async Task Default_Context_configuration_is_reset( QueryTrackingBehavior? queryTrackingBehavior ) { - var serviceProvider = BuildServiceProvider( - b => UseQueryTrackingBehavior(b, queryTrackingBehavior) + var serviceProvider = BuildServiceProvider(b => + UseQueryTrackingBehavior(b, queryTrackingBehavior) ); var serviceScope = serviceProvider.CreateScope(); @@ -1663,9 +1663,9 @@ public async Task Double_dispose_does_not_enter_pool_twice(bool useInterface, bo : BuildServiceProvider(); var scope = serviceProvider.CreateScope(); - var lease = scope.ServiceProvider.GetRequiredService< - IScopedDbContextLease - >(); + var lease = scope.ServiceProvider.GetRequiredService>( + + ); var context = lease.Context; await Dispose(scope, async); @@ -1747,8 +1747,8 @@ public async Task Provider_services_are_reset(bool useInterface, bool async) { var serviceProvider = useInterface ? BuildServiceProvider() - : BuildServiceProvider( - o => o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) + : BuildServiceProvider(o => + o.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking) ); var serviceScope = serviceProvider.CreateScope(); @@ -1839,10 +1839,9 @@ bool openWithEf ) { var serviceProvider = new ServiceCollection() - .AddDbContextPool( - ob => - ob.UseSqlServer(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString) - .EnableServiceProviderCaching(false) + .AddDbContextPool(ob => + ob.UseSqlServer(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString) + .EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true); @@ -1925,8 +1924,8 @@ bool openWithEf } var serviceProvider = new ServiceCollection() - .AddDbContextPool( - ob => ob.UseSqlServer(connection).EnableServiceProviderCaching(false) + .AddDbContextPool(ob => + ob.UseSqlServer(connection).EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true); @@ -2003,12 +2002,9 @@ bool withDependencyInjection var factory = withDependencyInjection ? new ServiceCollection() - .AddPooledDbContextFactory( - ob => - ob.UseSqlServer( - SqlServerNorthwindTestStoreFactory.NorthwindConnectionString - ) - .EnableServiceProviderCaching(false) + .AddPooledDbContextFactory(ob => + ob.UseSqlServer(SqlServerNorthwindTestStoreFactory.NorthwindConnectionString) + .EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true) .GetRequiredService>() @@ -2100,8 +2096,8 @@ bool withDependencyInjection var factory = withDependencyInjection ? new ServiceCollection() - .AddPooledDbContextFactory( - ob => ob.UseSqlServer(connection).EnableServiceProviderCaching(false) + .AddPooledDbContextFactory(ob => + ob.UseSqlServer(connection).EnableServiceProviderCaching(false) ) .BuildServiceProvider(validateScopes: true) .GetRequiredService>() @@ -2283,24 +2279,23 @@ public async Task Concurrency_test2(bool async) await Task.WhenAll( Enumerable .Range(0, 10) - .Select( - _ => - Task.Run(async () => + .Select(_ => + Task.Run(async () => + { + for (var j = 0; j < 1_000_000; j++) { - for (var j = 0; j < 1_000_000; j++) + var ctx = factory.CreateDbContext(); + + if (async) + { + await ctx.DisposeAsync(); + } + else { - var ctx = factory.CreateDbContext(); - - if (async) - { - await ctx.DisposeAsync(); - } - else - { - ctx.Dispose(); - } + ctx.Dispose(); } - }) + } + }) ) ); } diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/ExecutionStrategyTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/ExecutionStrategyTest.cs index 08f234cd6c3..090a1f338c4 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/ExecutionStrategyTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/ExecutionStrategyTest.cs @@ -142,8 +142,8 @@ Action execute + "Microsoft.Data.SqlClient.SqlException (0x80131904): Bang!"; if (realFailure) { - var logEntry = Fixture.TestSqlLoggerFactory.Log.Single( - l => l.Id == CoreEventId.ExecutionStrategyRetrying + var logEntry = Fixture.TestSqlLoggerFactory.Log.Single(l => + l.Id == CoreEventId.ExecutionStrategyRetrying ); Assert.Contains(retryMessage, logEntry.Message); Assert.Equal(LogLevel.Information, logEntry.Level); @@ -151,8 +151,8 @@ Action execute else { Assert.Empty( - Fixture.TestSqlLoggerFactory.Log.Where( - l => l.Id == CoreEventId.ExecutionStrategyRetrying + Fixture.TestSqlLoggerFactory.Log.Where(l => + l.Id == CoreEventId.ExecutionStrategyRetrying ) ); } @@ -315,8 +315,8 @@ Func exe + "Microsoft.Data.SqlClient.SqlException (0x80131904): Bang!"; if (realFailure) { - var logEntry = Fixture.TestSqlLoggerFactory.Log.Single( - l => l.Id == CoreEventId.ExecutionStrategyRetrying + var logEntry = Fixture.TestSqlLoggerFactory.Log.Single(l => + l.Id == CoreEventId.ExecutionStrategyRetrying ); Assert.Contains(retryMessage, logEntry.Message); Assert.Equal(LogLevel.Information, logEntry.Level); @@ -324,8 +324,8 @@ Func exe else { Assert.Empty( - Fixture.TestSqlLoggerFactory.Log.Where( - l => l.Id == CoreEventId.ExecutionStrategyRetrying + Fixture.TestSqlLoggerFactory.Log.Where(l => + l.Id == CoreEventId.ExecutionStrategyRetrying ) ); } diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/GraphUpdates/GraphUpdatesSqlServerOwnedTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/GraphUpdates/GraphUpdatesSqlServerOwnedTest.cs index b7a3fc695e8..d76b7554b48 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/GraphUpdates/GraphUpdatesSqlServerOwnedTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/GraphUpdates/GraphUpdatesSqlServerOwnedTest.cs @@ -383,9 +383,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con b.HasOne(e => e.SingleComposite) .WithOne(e => e.Back) - .HasForeignKey( - e => new { e.BackId, e.ParentAlternateId } - ) + .HasForeignKey(e => new + { + e.BackId, + e.ParentAlternateId + }) .HasPrincipalKey(e => new { e.Id, e.AlternateId }); }); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs index 0f1bfa800ea..a895a691a83 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Migrations/MigrationsSqlServerTest.cs @@ -3770,13 +3770,12 @@ await Test( e.Property("SystemTimeEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("SystemTimeStart"); - ttb.HasPeriodEnd("SystemTimeEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("SystemTimeStart"); + ttb.HasPeriodEnd("SystemTimeEnd"); + }) ); } ), @@ -3841,13 +3840,12 @@ await Test( e.Property("SystemTimeEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("SystemTimeStart").HasColumnName("Start"); - ttb.HasPeriodEnd("SystemTimeEnd").HasColumnName("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("SystemTimeStart").HasColumnName("Start"); + ttb.HasPeriodEnd("SystemTimeEnd").HasColumnName("End"); + }) ); } ), @@ -3909,14 +3907,13 @@ await Test( e.Property("SystemTimeEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("SystemTimeStart"); - ttb.HasPeriodEnd("SystemTimeEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("SystemTimeStart"); + ttb.HasPeriodEnd("SystemTimeEnd"); + }) ); } ), @@ -4810,13 +4807,12 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); + }) ); } ), @@ -4857,14 +4853,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); + }) ); } ), @@ -4905,14 +4900,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("Start").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("End").HasColumnName("PeriodEnd"); + }) ); } ), @@ -4953,14 +4947,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -5046,14 +5039,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); e.Property("Discount"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -5168,14 +5160,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -6808,14 +6799,13 @@ await Test( e.Property("PeriodEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd"); + }) ); } ), @@ -6882,13 +6872,12 @@ await Test( e.Property("PeriodEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd"); + }) ); } ), @@ -6971,14 +6960,13 @@ await Test( e.Property("PeriodEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd"); + }) ); } ), @@ -7060,14 +7048,13 @@ await Test( e.Property("PeriodEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd"); + }) ); } ), @@ -7542,13 +7529,12 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7621,14 +7607,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7704,13 +7689,12 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7791,14 +7775,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7872,14 +7855,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7894,14 +7876,13 @@ await Test( e.Property("ModifiedEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("ModifiedStart"); - ttb.HasPeriodEnd("ModifiedEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("ModifiedStart"); + ttb.HasPeriodEnd("ModifiedEnd"); + }) ); } ), @@ -7967,14 +7948,13 @@ await Test( "Customer", e => { - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -7983,14 +7963,13 @@ await Test( "Customer", e => { - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start").HasColumnName("ModifiedStart"); - ttb.HasPeriodEnd("End").HasColumnName("ModifiedEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start").HasColumnName("ModifiedStart"); + ttb.HasPeriodEnd("End").HasColumnName("ModifiedEnd"); + }) ); } ), @@ -8120,14 +8099,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8195,14 +8173,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); // adding data to make sure default for null value can be applied correctly @@ -8310,14 +8287,13 @@ await Test( e.Property("NumberPlusFive") .HasComputedColumnSql("Number + 5 PERSISTED"); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8379,14 +8355,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8460,14 +8435,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8541,14 +8515,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8633,14 +8606,13 @@ await Assert.ThrowsAsync( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8718,14 +8690,13 @@ await Test( e.HasKey("Id"); e.Property("IdPlusFive").HasComputedColumnSql("Id + 5 PERSISTED"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8788,14 +8759,13 @@ await Test( e.HasKey("Id"); e.Property("IdPlusFive").HasComputedColumnSql("Id + 5 PERSISTED"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8882,14 +8852,13 @@ await Test( e.HasKey("Id"); e.Property("IdPlusFive").HasComputedColumnSql("Id + 5 PERSISTED"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -8958,14 +8927,13 @@ await Test( e.Property("Start").ValueGeneratedOnAddOrUpdate(); e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -9136,14 +9104,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); e.HasData( new { MyColumn = 1 }, @@ -9247,14 +9214,13 @@ await Test( e.Property("End").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); e.HasData( new { MyColumn = 1 }, @@ -9438,14 +9404,13 @@ await Test( e.Property("SystemTimeEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("SystemTimeStart"); - ttb.HasPeriodEnd("SystemTimeEnd"); - }) - .HasComment("Table comment") + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("SystemTimeStart"); + ttb.HasPeriodEnd("SystemTimeEnd"); + }) + .HasComment("Table comment") ); } ), @@ -9524,14 +9489,13 @@ await Test( e.HasKey("Id"); e.HasIndex("Name"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable"); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable"); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); } ), @@ -9624,13 +9588,12 @@ await Test( e.Property("SystemTimeEnd").ValueGeneratedOnAddOrUpdate(); e.HasKey("Id"); - e.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("SystemTimeStart"); - ttb.HasPeriodEnd("SystemTimeEnd"); - }) + e.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("SystemTimeStart"); + ttb.HasPeriodEnd("SystemTimeEnd"); + }) ); } ), @@ -10000,10 +9963,9 @@ await Test( Assert.Equal(2, model.Tables.Count); Assert.True(model.Tables.All(x => x.Schema == "mySchema")); Assert.True( - model.Tables.All( - x => - x[SqlServerAnnotationNames.TemporalHistoryTableSchema] as string - == "mySchema" + model.Tables.All(x => + x[SqlServerAnnotationNames.TemporalHistoryTableSchema] as string + == "mySchema" ) ); } @@ -10098,10 +10060,9 @@ await Test( Assert.Equal(2, model.Tables.Count); Assert.True(model.Tables.All(x => x.Schema == "mySchema")); Assert.True( - model.Tables.All( - x => - x[SqlServerAnnotationNames.TemporalHistoryTableSchema] as string - == "mySchema2" + model.Tables.All(x => + x[SqlServerAnnotationNames.TemporalHistoryTableSchema] as string + == "mySchema2" ) ); } diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/OptimisticConcurrencySqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/OptimisticConcurrencySqlServerTest.cs index 4a98c3eb052..578989141e5 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/OptimisticConcurrencySqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/OptimisticConcurrencySqlServerTest.cs @@ -19,18 +19,15 @@ public async Task ULong_row_version_can_handle_empty_array_from_the_database() await context .Set() - .Select( - x => - new - { - x.Id, - Child = new - { - Id = x.OptionalChild == null ? Guid.Empty : x.OptionalChild.Id, - Version = x.OptionalChild == null ? 0 : x.OptionalChild.Version - } - } - ) + .Select(x => new + { + x.Id, + Child = new + { + Id = x.OptionalChild == null ? Guid.Empty : x.OptionalChild.Id, + Version = x.OptionalChild == null ? 0 : x.OptionalChild.Version + } + }) .ToArrayAsync(); } diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index f951cefbe83..7129a03423b 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -3191,8 +3191,8 @@ public virtual async Task Where_AtTimeZone_datetime_constant(bool async) var query = context .Set() - .Where( - m => m.Timeline == EF.Functions.AtTimeZone(new DateTime(10, 5, 3, 12, 0, 0), "UTC") + .Where(m => + m.Timeline == EF.Functions.AtTimeZone(new DateTime(10, 5, 3, 12, 0, 0), "UTC") ); var missions = async ? await query.ToListAsync() : query.ToList(); @@ -3248,10 +3248,9 @@ public virtual async Task Where_AtTimeZone_datetime_column(bool async) var query = context .Set() - .Where( - ct => - EF.Functions.AtTimeZone(ct.IssueDate, "UTC") - == new DateTimeOffset(15, 3, 7, 0, 0, 0, TimeSpan.Zero) + .Where(ct => + EF.Functions.AtTimeZone(ct.IssueDate, "UTC") + == new DateTimeOffset(15, 3, 7, 0, 0, 0, TimeSpan.Zero) ); var missions = async ? await query.ToListAsync() : query.ToList(); @@ -6865,7 +6864,9 @@ FROM [Gears] AS [g] public override async Task Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection() { - await base.Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection(); + await base.Multiple_includes_with_client_method_around_entity_and_also_projecting_included_collection( + + ); AssertSql( """ @@ -9462,8 +9463,8 @@ FROM [LocustLeaders] AS [l] public async Task FreeText_with_binary_column() { using var context = CreateContext(); - var result = await context.Missions.SingleAsync( - e => EF.Functions.FreeText(EF.Property(e, "BriefingDocument"), "bombing") + var result = await context.Missions.SingleAsync(e => + EF.Functions.FreeText(EF.Property(e, "BriefingDocument"), "bombing") ); Assert.Equal(1, result.Id); @@ -9482,8 +9483,8 @@ WHERE FREETEXT([m].[BriefingDocument], N'bombing') public async Task FreeText_with_binary_column_and_language_term() { using var context = CreateContext(); - var result = await context.Missions.SingleAsync( - e => EF.Functions.FreeText(EF.Property(e, "BriefingDocument"), "bombing", 1033) + var result = await context.Missions.SingleAsync(e => + EF.Functions.FreeText(EF.Property(e, "BriefingDocument"), "bombing", 1033) ); Assert.Equal(1, result.Id); @@ -9502,8 +9503,8 @@ WHERE FREETEXT([m].[BriefingDocument], N'bombing', LANGUAGE 1033) public async Task Contains_with_binary_column() { using var context = CreateContext(); - var result = await context.Missions.SingleAsync( - e => EF.Functions.Contains(EF.Property(e, "BriefingDocument"), "bomb") + var result = await context.Missions.SingleAsync(e => + EF.Functions.Contains(EF.Property(e, "BriefingDocument"), "bomb") ); Assert.Equal(1, result.Id); @@ -9522,8 +9523,8 @@ WHERE CONTAINS([m].[BriefingDocument], N'bomb') public async Task Contains_with_binary_column_and_language_term() { using var context = CreateContext(); - var result = await context.Missions.SingleAsync( - e => EF.Functions.Contains(EF.Property(e, "BriefingDocument"), "bomb", 1033) + var result = await context.Missions.SingleAsync(e => + EF.Functions.Contains(EF.Property(e, "BriefingDocument"), "bomb", 1033) ); Assert.Equal(1, result.Id); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 6fb8e3ef87b..c95f0f7201a 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -38,12 +38,11 @@ public async Task Where_equals_DateTime_Now(bool async) var contextFactory = await InitializeDateTimeContextAsync(); using var context = contextFactory.CreateContext(); - var query = context.Dates.Where( - d => - d.DateTime2_2 == DateTime.Now - || d.DateTime2_7 == DateTime.Now - || d.DateTime == DateTime.Now - || d.SmallDateTime == DateTime.Now + var query = context.Dates.Where(d => + d.DateTime2_2 == DateTime.Now + || d.DateTime2_7 == DateTime.Now + || d.DateTime == DateTime.Now + || d.SmallDateTime == DateTime.Now ); var results = async ? await query.ToListAsync() : query.ToList(); @@ -67,12 +66,11 @@ public async Task Where_not_equals_DateTime_Now(bool async) var contextFactory = await InitializeDateTimeContextAsync(); using var context = contextFactory.CreateContext(); - var query = context.Dates.Where( - d => - d.DateTime2_2 != DateTime.Now - && d.DateTime2_7 != DateTime.Now - && d.DateTime != DateTime.Now - && d.SmallDateTime != DateTime.Now + var query = context.Dates.Where(d => + d.DateTime2_2 != DateTime.Now + && d.DateTime2_7 != DateTime.Now + && d.DateTime != DateTime.Now + && d.SmallDateTime != DateTime.Now ); var results = async ? await query.ToListAsync() : query.ToList(); @@ -96,19 +94,18 @@ public async Task Where_equals_new_DateTime(bool async) var contextFactory = await InitializeDateTimeContextAsync(); using var context = contextFactory.CreateContext(); - var query = context.Dates.Where( - d => - d.SmallDateTime == new DateTime(1970, 9, 3, 12, 0, 0) - && d.DateTime == new DateTime(1971, 9, 3, 12, 0, 10, 220) - && d.DateTime2 == new DateTime(1972, 9, 3, 12, 0, 10, 333) - && d.DateTime2_0 == new DateTime(1973, 9, 3, 12, 0, 10) - && d.DateTime2_1 == new DateTime(1974, 9, 3, 12, 0, 10, 500) - && d.DateTime2_2 == new DateTime(1975, 9, 3, 12, 0, 10, 660) - && d.DateTime2_3 == new DateTime(1976, 9, 3, 12, 0, 10, 777) - && d.DateTime2_4 == new DateTime(1977, 9, 3, 12, 0, 10, 888) - && d.DateTime2_5 == new DateTime(1978, 9, 3, 12, 0, 10, 999) - && d.DateTime2_6 == new DateTime(1979, 9, 3, 12, 0, 10, 111) - && d.DateTime2_7 == new DateTime(1980, 9, 3, 12, 0, 10, 222) + var query = context.Dates.Where(d => + d.SmallDateTime == new DateTime(1970, 9, 3, 12, 0, 0) + && d.DateTime == new DateTime(1971, 9, 3, 12, 0, 10, 220) + && d.DateTime2 == new DateTime(1972, 9, 3, 12, 0, 10, 333) + && d.DateTime2_0 == new DateTime(1973, 9, 3, 12, 0, 10) + && d.DateTime2_1 == new DateTime(1974, 9, 3, 12, 0, 10, 500) + && d.DateTime2_2 == new DateTime(1975, 9, 3, 12, 0, 10, 660) + && d.DateTime2_3 == new DateTime(1976, 9, 3, 12, 0, 10, 777) + && d.DateTime2_4 == new DateTime(1977, 9, 3, 12, 0, 10, 888) + && d.DateTime2_5 == new DateTime(1978, 9, 3, 12, 0, 10, 999) + && d.DateTime2_6 == new DateTime(1979, 9, 3, 12, 0, 10, 111) + && d.DateTime2_7 == new DateTime(1980, 9, 3, 12, 0, 10, 222) ); var results = async ? await query.ToListAsync() : query.ToList(); @@ -147,19 +144,18 @@ public async Task Where_contains_DateTime_literals(bool async) var contextFactory = await InitializeDateTimeContextAsync(); using var context = contextFactory.CreateContext(); - var query = context.Dates.Where( - d => - dateTimes.Contains(d.SmallDateTime) - && dateTimes.Contains(d.DateTime) - && dateTimes.Contains(d.DateTime2) - && dateTimes.Contains(d.DateTime2_0) - && dateTimes.Contains(d.DateTime2_1) - && dateTimes.Contains(d.DateTime2_2) - && dateTimes.Contains(d.DateTime2_3) - && dateTimes.Contains(d.DateTime2_4) - && dateTimes.Contains(d.DateTime2_5) - && dateTimes.Contains(d.DateTime2_6) - && dateTimes.Contains(d.DateTime2_7) + var query = context.Dates.Where(d => + dateTimes.Contains(d.SmallDateTime) + && dateTimes.Contains(d.DateTime) + && dateTimes.Contains(d.DateTime2) + && dateTimes.Contains(d.DateTime2_0) + && dateTimes.Contains(d.DateTime2_1) + && dateTimes.Contains(d.DateTime2_2) + && dateTimes.Contains(d.DateTime2_3) + && dateTimes.Contains(d.DateTime2_4) + && dateTimes.Contains(d.DateTime2_5) + && dateTimes.Contains(d.DateTime2_6) + && dateTimes.Contains(d.DateTime2_7) ); var results = async ? await query.ToListAsync() : query.ToList(); @@ -427,10 +423,9 @@ public async Task Multiple_optional_navs_should_not_deadlock_Issue_5481() using var context = contextFactory.CreateContext(); var count = await context - .Persons.Where( - p => - p.AddressOne != null && p.AddressOne.Street.Contains("Low Street") - || p.AddressTwo != null && p.AddressTwo.Street.Contains("Low Street") + .Persons.Where(p => + p.AddressOne != null && p.AddressOne.Street.Contains("Low Street") + || p.AddressTwo != null && p.AddressTwo.Street.Contains("Low Street") ) .CountAsync(); @@ -519,8 +514,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) [ConditionalFact] public async Task Query_when_null_key_in_database_should_throw() { - var contextFactory = await InitializeAsync( - onConfiguring: o => o.EnableDetailedErrors() + var contextFactory = await InitializeAsync(onConfiguring: o => + o.EnableDetailedErrors() ); using var context = contextFactory.CreateContext(); @@ -965,7 +960,9 @@ public async Task Customer_collections_materialize_properly_3758() CoreStrings.NavigationCannotCreateType( "Orders4", typeof(MyContext3758.Customer3758).Name, - typeof(MyContext3758.MyInvalidCollection3758).ShortDisplayName() + typeof(MyContext3758.MyInvalidCollection3758).ShortDisplayName( + + ) ), Assert.Throws(() => query4.ToList()).Message ); @@ -1113,14 +1110,11 @@ public async Task ThenInclude_with_interface_navigations_3409() using (var context = contextFactory.CreateContext()) { var results = context - .Children.Select( - c => - new - { - c.SelfReferenceBackNavigation, - c.SelfReferenceBackNavigation.ParentBackNavigation - } - ) + .Children.Select(c => new + { + c.SelfReferenceBackNavigation, + c.SelfReferenceBackNavigation.ParentBackNavigation + }) .ToList(); Assert.Equal(3, results.Count); @@ -1131,23 +1125,17 @@ public async Task ThenInclude_with_interface_navigations_3409() using (var context = contextFactory.CreateContext()) { var results = context - .Children.Select( - c => - new - { - SelfReferenceBackNavigation = EF.Property( - c, - "SelfReferenceBackNavigation" - ), - ParentBackNavigationB = EF.Property( - EF.Property( - c, - "SelfReferenceBackNavigation" - ), - "ParentBackNavigation" - ) - } - ) + .Children.Select(c => new + { + SelfReferenceBackNavigation = EF.Property( + c, + "SelfReferenceBackNavigation" + ), + ParentBackNavigationB = EF.Property( + EF.Property(c, "SelfReferenceBackNavigation"), + "ParentBackNavigation" + ) + }) .ToList(); Assert.Equal(3, results.Count); @@ -1965,8 +1953,8 @@ FROM [Entity] AS [e] { ClearLog(); var query = context - .Entity.Where( - e => e.PermissionShort.HasFlag(MyContext8538.PermissionShort.READ_WRITE) + .Entity.Where(e => + e.PermissionShort.HasFlag(MyContext8538.PermissionShort.READ_WRITE) ) .ToList(); @@ -2790,15 +2778,10 @@ public virtual async Task Conditional_expression_with_conditions_does_not_collap using (var context = contextFactory.CreateContext()) { var query = context - .Carts.Select( - t => - new - { - Processing = t.Configuration != null - ? !t.Configuration.Processed - : (bool?)null - } - ) + .Carts.Select(t => new + { + Processing = t.Configuration != null ? !t.Configuration.Processed : (bool?)null + }) .ToList(); Assert.Single(query.Where(t => t.Processing == null)); @@ -3092,9 +3075,8 @@ public class Stuff [ConditionalFact] public virtual async Task GroupJoin_Anonymous_projection_GroupBy_Aggregate_join_elimination() { - var contextFactory = await InitializeAsync( - onConfiguring: o => - o.ConfigureWarnings(w => w.Log(CoreEventId.FirstWithoutOrderByAndFilterWarning)) + var contextFactory = await InitializeAsync(onConfiguring: o => + o.ConfigureWarnings(w => w.Log(CoreEventId.FirstWithoutOrderByAndFilterWarning)) ); using (var context = contextFactory.CreateContext()) @@ -3401,41 +3383,32 @@ public virtual async Task Collection_without_setter_materialized_correctly() using (var context = contextFactory.CreateContext()) { var query1 = context - .Blogs.Select( - b => - new - { - Collection1 = b.Posts1, - Collection2 = b.Posts2, - Collection3 = b.Posts3 - } - ) + .Blogs.Select(b => new + { + Collection1 = b.Posts1, + Collection2 = b.Posts2, + Collection3 = b.Posts3 + }) .ToList(); var query2 = context - .Blogs.Select( - b => - new - { - Collection1 = b.Posts1.OrderBy(p => p.Id).First().Comments.Count, - Collection2 = b.Posts2.OrderBy(p => p.Id).First().Comments.Count, - Collection3 = b.Posts3.OrderBy(p => p.Id).First().Comments.Count - } - ) + .Blogs.Select(b => new + { + Collection1 = b.Posts1.OrderBy(p => p.Id).First().Comments.Count, + Collection2 = b.Posts2.OrderBy(p => p.Id).First().Comments.Count, + Collection3 = b.Posts3.OrderBy(p => p.Id).First().Comments.Count + }) .ToList(); Assert.Throws( () => context - .Blogs.Select( - b => - new - { - Collection1 = b.Posts1.OrderBy(p => p.Id), - Collection2 = b.Posts2.OrderBy(p => p.Id), - Collection3 = b.Posts3.OrderBy(p => p.Id) - } - ) + .Blogs.Select(b => new + { + Collection1 = b.Posts1.OrderBy(p => p.Id), + Collection2 = b.Posts2.OrderBy(p => p.Id), + Collection3 = b.Posts3.OrderBy(p => p.Id) + }) .ToList() ); } @@ -3756,10 +3729,9 @@ public virtual async Task Include_collection_with_OfType_base() using (var context = contextFactory.CreateContext()) { var query = context - .Employees.Select( - e => - e.Devices.Where(d => d.Device != "foo") - .Cast() + .Employees.Select(e => + e.Devices.Where(d => d.Device != "foo") + .Cast() ) .ToList(); @@ -4026,8 +3998,8 @@ public virtual async Task Include_collection_works_when_defined_on_intermediate_ using (var context = contextFactory.CreateContext()) { - var query = context.Schools.Include( - s => ((MyContext11944.ElementarySchool11944)s).Students + var query = context.Schools.Include(s => + ((MyContext11944.ElementarySchool11944)s).Students ); var result = query.ToList(); @@ -4040,8 +4012,8 @@ public virtual async Task Include_collection_works_when_defined_on_intermediate_ using (var context = contextFactory.CreateContext()) { - var query = context.Schools.Select( - s => ((MyContext11944.ElementarySchool11944)s).Students.Where(ss => true).ToList() + var query = context.Schools.Select(s => + ((MyContext11944.ElementarySchool11944)s).Students.Where(ss => true).ToList() ); var result = query.ToList(); @@ -4142,8 +4114,8 @@ public MyContext13118(DbContextOptions options) : base(options) { } protected override void OnModelCreating(ModelBuilder modelBuilder) => - modelBuilder.Entity( - e => e.Property("MyTime").HasColumnType("smalldatetime") + modelBuilder.Entity(e => + e.Property("MyTime").HasColumnType("smalldatetime") ); public void Seed() @@ -4246,22 +4218,14 @@ public virtual async Task Correlated_subquery_with_owned_navigation_being_compar using (var context = contextFactory.CreateContext()) { var partners = context - .Partners.Select( - x => - new - { - Addresses = x.Addresses.Select( - y => - new - { - Turnovers = y.Turnovers == null - ? null - : new { y.Turnovers.AmountIn } - } - ) - .ToList() - } - ) + .Partners.Select(x => new + { + Addresses = x.Addresses.Select(y => new + { + Turnovers = y.Turnovers == null ? null : new { y.Turnovers.AmountIn } + }) + .ToList() + }) .ToList(); Assert.Single(partners); @@ -5053,9 +5017,11 @@ public virtual async Task Select_nested_projection() using (var context = contextFactory.CreateContext()) { var customers = context - .Customers.Select( - c => new { Customer = c, CustomerAgain = MyContext8864.Get(context, c.Id) } - ) + .Customers.Select(c => new + { + Customer = c, + CustomerAgain = MyContext8864.Get(context, c.Id) + }) .ToList(); Assert.Equal(2, customers.Count); @@ -5198,8 +5164,8 @@ SELECT 1 using (var context = contextFactory.CreateContext()) { ClearLog(); - var query = context.EntitiesReferencingEntityWithQueryFilterSelfReference.Where( - e => e.Name != "Foo" + var query = context.EntitiesReferencingEntityWithQueryFilterSelfReference.Where(e => + e.Name != "Foo" ); var result = query.ToList(); @@ -5336,12 +5302,11 @@ FROM [RemovableEntities] AS [r] { ClearLog(); var query = context - .Parents.Where( - p => - EF.Property( - EF.Property(p, "RemovableEntity"), - "IsRemoved" - ) + .Parents.Where(p => + EF.Property( + EF.Property(p, "RemovableEntity"), + "IsRemoved" + ) ) .ToList(); @@ -5359,12 +5324,11 @@ FROM [Parents] AS [p] { ClearLog(); var query = context - .RemovableEntities.Where( - p => - EF.Property( - EF.Property(p, "OwnedEntity"), - "OwnedValue" - ) == "Abc" + .RemovableEntities.Where(p => + EF.Property( + EF.Property(p, "OwnedEntity"), + "OwnedValue" + ) == "Abc" ) .ToList(); @@ -5725,9 +5689,11 @@ public virtual async Task Return_type_of_singular_operator_is_preserved() { var personsToFind = await context .Persons.Where(p => p.Age >= 21) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .FirstAsync(); AssertSql( @@ -5744,9 +5710,11 @@ FROM [Persons] AS [p] ClearLog(); var personsToFind = await context .Persons.Where(p => p.Age >= 21) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .FirstOrDefaultAsync(); AssertSql( @@ -5763,9 +5731,11 @@ FROM [Persons] AS [p] ClearLog(); var personsToFind = await context .Persons.Where(p => p.Age >= 21) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .SingleAsync(); AssertSql( @@ -5782,9 +5752,11 @@ FROM [Persons] AS [p] ClearLog(); var personsToFind = await context .Persons.Where(p => p.Age >= 21) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .SingleOrDefaultAsync(); AssertSql( @@ -5802,9 +5774,11 @@ FROM [Persons] AS [p] var personsToFind = await context .Persons.Where(p => p.Age >= 21) .OrderBy(p => p.Id) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .LastAsync(); AssertSql( @@ -5823,9 +5797,11 @@ ORDER BY [p].[Id] DESC var personsToFind = await context .Persons.Where(p => p.Age >= 21) .OrderBy(p => p.Id) - .Select( - p => new MyContext17644.PersonDetailView17644 { Name = p.Name, Age = p.Age } - ) + .Select(p => new MyContext17644.PersonDetailView17644 + { + Name = p.Name, + Age = p.Age + }) .LastOrDefaultAsync(); AssertSql( @@ -5883,15 +5859,10 @@ public virtual async Task Async_correlated_projection_with_first() using (var context = contextFactory.CreateContext()) { var query = await context - .Entities.Select( - e => - new - { - ThingIds = e.Values.First() - .Things.Select(t => t.Subthing.ThingId) - .ToList() - } - ) + .Entities.Select(e => new + { + ThingIds = e.Values.First().Things.Select(t => t.Subthing.ThingId).ToList() + }) .ToListAsync(); var result = Assert.Single(query); @@ -6166,8 +6137,8 @@ public virtual async Task Let_multiple_references_with_reference_to_outer() { var users = ( from a in context.Activities - let cs = context.CompetitionSeasons.First( - s => s.StartDate <= a.DateTime && a.DateTime < s.EndDate + let cs = context.CompetitionSeasons.First(s => + s.StartDate <= a.DateTime && a.DateTime < s.EndDate ) select new { @@ -6202,30 +6173,24 @@ FROM [CompetitionSeasons] AS [c1] { ClearLog(); var users = context - .Activities.Select( - a => - new - { - Activity = a, - CompetitionSeason = context.CompetitionSeasons.First( - s => s.StartDate <= a.DateTime && a.DateTime < s.EndDate - ) - } - ) - .Select( - a => - new - { - a.Activity, - CompetitionSeasonId = a.CompetitionSeason.Id, - Points = a.Activity.Points - ?? a.Activity.ActivityType.Points.Where( - p => p.CompetitionSeason == a.CompetitionSeason - ) - .Select(p => p.Points) - .SingleOrDefault() - } - ) + .Activities.Select(a => new + { + Activity = a, + CompetitionSeason = context.CompetitionSeasons.First(s => + s.StartDate <= a.DateTime && a.DateTime < s.EndDate + ) + }) + .Select(a => new + { + a.Activity, + CompetitionSeasonId = a.CompetitionSeason.Id, + Points = a.Activity.Points + ?? a.Activity.ActivityType.Points.Where(p => + p.CompetitionSeason == a.CompetitionSeason + ) + .Select(p => p.Points) + .SingleOrDefault() + }) .ToList(); AssertSql( @@ -6310,35 +6275,27 @@ public virtual async Task Max_in_multi_level_nested_subquery() using (var context = contextFactory.CreateContext()) { var container = await context - .Trades.Select( - x => - new + .Trades.Select(x => new + { + x.Id, + Assets = x.Assets.AsQueryable() + .Select(y => new { - x.Id, - Assets = x.Assets.AsQueryable() - .Select( - y => - new - { - y.Id, - Contract = new - { - y.Contract.Id, - Season = new - { - y.Contract.Season.Id, - IsPastTradeDeadline = ( - y.Contract.Season.Games.Max( - z => (int?)z.GameNumber - ) ?? 0 - ) > 10 - } - } - } - ) - .ToList() - } - ) + y.Id, + Contract = new + { + y.Contract.Id, + Season = new + { + y.Contract.Season.Id, + IsPastTradeDeadline = ( + y.Contract.Season.Games.Max(z => (int?)z.GameNumber) ?? 0 + ) > 10 + } + } + }) + .ToList() + }) .SingleAsync(); AssertSql( @@ -6445,22 +6402,19 @@ public async Task Query_filter_with_pk_fk_optimization_Issue_13517() using (var context = contextFactory.CreateContext()) { context - .Entities.Select( - s => - new IssueContext13517.IssueEntityDto13517 - { - Id = s.Id, - RefEntity = - s.RefEntity == null - ? null - : new IssueContext13517.IssueRefEntityDto13517 - { - Id = s.RefEntity.Id, - Public = s.RefEntity.Public - }, - RefEntityId = s.RefEntityId - } - ) + .Entities.Select(s => new IssueContext13517.IssueEntityDto13517 + { + Id = s.Id, + RefEntity = + s.RefEntity == null + ? null + : new IssueContext13517.IssueRefEntityDto13517 + { + Id = s.RefEntity.Id, + Public = s.RefEntity.Public + }, + RefEntityId = s.RefEntityId + }) .Single(p => p.Id == 1); AssertSql( @@ -6793,13 +6747,12 @@ public async Task Accessing_scalar_property_in_derived_type_projection_does_not_ using (var context = contextFactory.CreateContext()) { var result = context - .BaseEntities.Select( - b => - context - .OtherEntities.Where( - o => o.OtherEntityData == ((IssueContext19138.SubEntity19138)b).Data - ) - .FirstOrDefault() + .BaseEntities.Select(b => + context + .OtherEntities.Where(o => + o.OtherEntityData == ((IssueContext19138.SubEntity19138)b).Data + ) + .FirstOrDefault() ) .ToList(); @@ -6948,18 +6901,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder .Entity() - .HasQueryFilter( - e => - ( - from a in ( - from c in Customers - join cm in CustomerMemberships on c.Id equals cm.CustomerId into g - from cm in g.DefaultIfEmpty() - select new { c.Id, CustomerMembershipId = (int?)cm.Id } - ) - where a.CustomerMembershipId != null && a.Id == e.CustomerId - select a - ).Count() > 0 + .HasQueryFilter(e => + ( + from a in ( + from c in Customers + join cm in CustomerMemberships on c.Id equals cm.CustomerId into g + from cm in g.DefaultIfEmpty() + select new { c.Id, CustomerMembershipId = (int?)cm.Id } + ) + where a.CustomerMembershipId != null && a.Id == e.CustomerId + select a + ).Count() > 0 ) .HasKey(e => e.CustomerId); @@ -7060,9 +7012,10 @@ public async Task Interface_casting_though_generic_method() using (var context = contextFactory.CreateContext()) { - var originalQuery = context.Entities.Select( - a => new IssueContext20097.MyModel20097 { Id = a.Id } - ); + var originalQuery = context.Entities.Select(a => new IssueContext20097.MyModel20097 + { + Id = a.Id + }); var query = IssueContext20097.AddFilter(originalQuery, 1).ToList(); Assert.Single(query); @@ -7081,9 +7034,10 @@ FROM [Entities] AS [e] using (var context = contextFactory.CreateContext()) { ClearLog(); - var originalQuery = context.Entities.Select( - a => new IssueContext20097.MyModel20097 { Id = a.Id } - ); + var originalQuery = context.Entities.Select(a => new IssueContext20097.MyModel20097 + { + Id = a.Id + }); var query = originalQuery .Where(a => a.Id == 1) .ToList(); @@ -7102,9 +7056,10 @@ FROM [Entities] AS [e] using (var context = contextFactory.CreateContext()) { ClearLog(); - var originalQuery = context.Entities.Select( - a => new IssueContext20097.MyModel20097 { Id = a.Id } - ); + var originalQuery = context.Entities.Select(a => new IssueContext20097.MyModel20097 + { + Id = a.Id + }); var query = originalQuery .Where(a => ((IssueContext20097.IHaveId20097)a).Id == 1) .ToList(); @@ -7123,9 +7078,10 @@ FROM [Entities] AS [e] using (var context = contextFactory.CreateContext()) { ClearLog(); - var originalQuery = context.Entities.Select( - a => new IssueContext20097.MyModel20097 { Id = a.Id } - ); + var originalQuery = context.Entities.Select(a => new IssueContext20097.MyModel20097 + { + Id = a.Id + }); var query = originalQuery .Where(a => (a as IssueContext20097.IHaveId20097).Id == 1) .ToList(); @@ -7144,9 +7100,10 @@ FROM [Entities] AS [e] using (var context = contextFactory.CreateContext()) { ClearLog(); - var originalQuery = context.Entities.Select( - a => new IssueContext20097.MyModel20097 { Id = a.Id } - ); + var originalQuery = context.Entities.Select(a => new IssueContext20097.MyModel20097 + { + Id = a.Id + }); var query = originalQuery .Where(a => ((IssueContext20097.IHaveId20097)a).Id == 1) .ToList(); @@ -7204,9 +7161,8 @@ public class MyModel20097 : IHaveId20097 [ConditionalFact] public virtual async Task Can_ignore_invalid_include_path_error() { - var contextFactory = await InitializeAsync( - onConfiguring: o => - o.ConfigureWarnings(x => x.Ignore(CoreEventId.InvalidIncludePathError)) + var contextFactory = await InitializeAsync(onConfiguring: o => + o.ConfigureWarnings(x => x.Ignore(CoreEventId.InvalidIncludePathError)) ); using var context = contextFactory.CreateContext(); @@ -7803,14 +7759,13 @@ public enum BusinessType18346 [ConditionalFact] public virtual async Task Thread_safety_in_relational_command_cache() { - var contextFactory = await InitializeAsync( - onConfiguring: options => - ((IDbContextOptionsBuilderInfrastructure)options).AddOrUpdateExtension( - options - .Options.FindExtension() - .WithConnection(null) - .WithConnectionString(SqlServerTestStore.CreateConnectionString(StoreName)) - ) + var contextFactory = await InitializeAsync(onConfiguring: options => + ((IDbContextOptionsBuilderInfrastructure)options).AddOrUpdateExtension( + options + .Options.FindExtension() + .WithConnection(null) + .WithConnectionString(SqlServerTestStore.CreateConnectionString(StoreName)) + ) ); var ids = new[] { 1, 2, 3 }; @@ -7855,21 +7810,20 @@ public virtual async Task Using_explicit_interface_implementation_as_navigation_ { Expression< Func - > projection = b => - new MyContext21768.BookViewModel21768 - { - FirstPage = - b.FrontCover.Illustrations.FirstOrDefault( - i => i.State >= MyContext21768.IllustrationState21768.Approved - ) != null - ? new MyContext21768.PageViewModel21768 - { - Uri = b.FrontCover.Illustrations.FirstOrDefault( - i => i.State >= MyContext21768.IllustrationState21768.Approved - ).Uri - } - : null, - }; + > projection = b => new MyContext21768.BookViewModel21768 + { + FirstPage = + b.FrontCover.Illustrations.FirstOrDefault(i => + i.State >= MyContext21768.IllustrationState21768.Approved + ) != null + ? new MyContext21768.PageViewModel21768 + { + Uri = b.FrontCover.Illustrations.FirstOrDefault(i => + i.State >= MyContext21768.IllustrationState21768.Approved + ).Uri + } + : null, + }; var result = context.Books.Where(b => b.Id == 1).Select(projection).SingleOrDefault(); @@ -9206,15 +9160,12 @@ public virtual async Task Parameterless_ctor_on_inner_DTO_gets_called_for_every_ using (var context = contextFactory.CreateContext()) { var results = context - .Entities.Select( - x => - new MyContext12274.OuterDTO12274 - { - Id = x.Id, - Name = x.Name, - Inner = new MyContext12274.InnerDTO12274() - } - ) + .Entities.Select(x => new MyContext12274.OuterDTO12274 + { + Id = x.Id, + Name = x.Name, + Inner = new MyContext12274.InnerDTO12274() + }) .ToList(); Assert.Equal(4, results.Count); Assert.False(ReferenceEquals(results[0].Inner, results[1].Inner)); @@ -9269,15 +9220,12 @@ public virtual async Task Projecting_correlated_collection_along_with_non_mapped using (var context = contextFactory.CreateContext()) { var result = context - .Blogs.Select( - e => - new - { - e.Id, - e.Title, - FirstPostName = e.Posts.Where(i => i.Name.Contains("2")).ToList() - } - ) + .Blogs.Select(e => new + { + e.Id, + e.Title, + FirstPostName = e.Posts.Where(i => i.Name.Contains("2")).ToList() + }) .ToList(); AssertSql( @@ -9298,15 +9246,12 @@ ORDER BY [b].[Id] { ClearLog(); var result = context - .Blogs.Select( - e => - new - { - e.Id, - e.Title, - FirstPostName = e.Posts.OrderBy(i => i.Id).FirstOrDefault().Name - } - ) + .Blogs.Select(e => new + { + e.Id, + e.Title, + FirstPostName = e.Posts.OrderBy(i => i.Id).FirstOrDefault().Name + }) .ToList(); AssertSql( @@ -10009,8 +9954,8 @@ public virtual async Task Method_call_translators_are_invoked_for_indexer_if_not using (var context = contextFactory.CreateContext()) { - var testUser = context.Blogs.FirstOrDefault( - x => x.JObject["Author"].Value() == "Maumar" + var testUser = context.Blogs.FirstOrDefault(x => + x.JObject["Author"].Value() == "Maumar" ); Assert.NotNull(testUser); @@ -10430,43 +10375,34 @@ public virtual async Task Projection_with_multiple_includes_and_subquery_with_se .Include(p => p.Director) .ThenInclude(a => a.Movies) .ThenInclude(p => p.Movie) - .Select( - x => - new + .Select(x => new + { + x.Id, + x.Name, + x.Surname, + x.Birthday, + x.Hometown, + x.Bio, + x.AvatarUrl, + Images = x.Images.Select(i => new + { + i.Id, + i.ImageUrl, + i.Height, + i.Width + }) + .ToList(), + KnownByFilms = x.Actor.Movies.Select(m => m.Movie) + .Union(x.Director.Movies.Select(m => m.Movie)) + .Select(m => new { - x.Id, - x.Name, - x.Surname, - x.Birthday, - x.Hometown, - x.Bio, - x.AvatarUrl, - Images = x.Images.Select( - i => - new - { - i.Id, - i.ImageUrl, - i.Height, - i.Width - } - ) - .ToList(), - KnownByFilms = x.Actor.Movies.Select(m => m.Movie) - .Union(x.Director.Movies.Select(m => m.Movie)) - .Select( - m => - new - { - m.Id, - m.Name, - m.PosterUrl, - m.Rating - } - ) - .ToList() - } - ) + m.Id, + m.Name, + m.PosterUrl, + m.Rating + }) + .ToList() + }) .FirstOrDefaultAsync(x => x.Id == id); // Verify the valid generated SQL @@ -10602,29 +10538,23 @@ public virtual async Task Multiple_select_many_in_projection() using var context = contextFactory.CreateContext(); var query = context - .Users.Select( - captain => - new + .Users.Select(captain => new + { + CaptainRateDtos = captain + .Cars.SelectMany(car0 => car0.Taxis) + .OrderByDescending(taxi => taxi.DateArrived) + .Take(12) + .Select(taxi => new { - CaptainRateDtos = captain - .Cars.SelectMany(car0 => car0.Taxis) - .OrderByDescending(taxi => taxi.DateArrived) - .Take(12) - .Select( - taxi => - new - { - Rate = taxi.UserRate.Value, - UserRateText = taxi.UserTextRate, - UserId = taxi.UserEUser.Id, - } - ) - .ToList(), - ReportCount = captain - .Cars.SelectMany(car1 => car1.Taxis) - .Count(taxi0 => taxi0.ReportText != ""), - } - ) + Rate = taxi.UserRate.Value, + UserRateText = taxi.UserTextRate, + UserId = taxi.UserEUser.Id, + }) + .ToList(), + ReportCount = captain + .Cars.SelectMany(car1 => car1.Taxis) + .Count(taxi0 => taxi0.ReportText != ""), + }) .SingleOrDefault(); // Verify the valid generated SQL @@ -10662,26 +10592,20 @@ public virtual async Task Single_select_many_in_projection_with_take() using var context = contextFactory.CreateContext(); var query = context - .Users.Select( - captain => - new + .Users.Select(captain => new + { + CaptainRateDtos = captain + .Cars.SelectMany(car0 => car0.Taxis) + .OrderByDescending(taxi => taxi.DateArrived) + .Take(12) + .Select(taxi => new { - CaptainRateDtos = captain - .Cars.SelectMany(car0 => car0.Taxis) - .OrderByDescending(taxi => taxi.DateArrived) - .Take(12) - .Select( - taxi => - new - { - Rate = taxi.UserRate.Value, - UserRateText = taxi.UserTextRate, - UserId = taxi.UserEUser.Id, - } - ) - .ToList() - } - ) + Rate = taxi.UserRate.Value, + UserRateText = taxi.UserTextRate, + UserId = taxi.UserEUser.Id, + }) + .ToList() + }) .SingleOrDefault(); // Verify the valid generated SQL @@ -10757,20 +10681,14 @@ public virtual async Task SelectMany_and_collection_in_projection_in_FirstOrDefa var customerId = new Guid("1115c816-6c4c-4016-94df-d8b60a22ffa1"); var query = context .Orders.Where(o => o.ExternalReferenceId == referenceId && o.CustomerId == customerId) - .Select( - o => - new - { - IdentityDocuments = o.IdentityDocuments.Select( - id => - new - { - Images = o.IdentityDocuments.SelectMany(id => id.Images) - .Select(i => new { i.Image }), - } - ) - } - ) + .Select(o => new + { + IdentityDocuments = o.IdentityDocuments.Select(id => new + { + Images = o.IdentityDocuments.SelectMany(id => id.Images) + .Select(i => new { i.Image }), + }) + }) .SingleOrDefault(); // Verify the valid generated SQL @@ -10868,23 +10786,20 @@ public virtual async Task Set_operation_in_pending_collection() using var context = contextFactory.CreateContext(); var resultCollection = context .StudentGameMapper.OrderBy(s => s.Id) - .Select( - s => - new StudentGameResult - { - SportsList = ( - from inDoorSports in context.InDoorSports - where inDoorSports.Id == s.InCategoryId - select inDoorSports.Name - ) - .Union( - from outDoorSports in context.OutDoorSports - where outDoorSports.Id == s.OutCategoryId - select outDoorSports.Name - ) - .ToList() - } - ) + .Select(s => new StudentGameResult + { + SportsList = ( + from inDoorSports in context.InDoorSports + where inDoorSports.Id == s.InCategoryId + select inDoorSports.Name + ) + .Union( + from outDoorSports in context.OutDoorSports + where outDoorSports.Id == s.OutCategoryId + select outDoorSports.Name + ) + .ToList() + }) .Take(5) // Without this line the query works .ToList(); @@ -11332,17 +11247,16 @@ Guid parentId ) => context .Parents.Where(x => x.Id == parentId) - .Select( - p => - new ParentViewModel25225 - { - Id = p.Id, - Collection = p.Collection.Select( - c => new CollectionViewModel25225 { Id = c.Id, ParentId = c.ParentId, } - ) - .ToArray() - } - ); + .Select(p => new ParentViewModel25225 + { + Id = p.Id, + Collection = p.Collection.Select(c => new CollectionViewModel25225 + { + Id = c.Id, + ParentId = c.ParentId, + }) + .ToArray() + }); private static void AssertParent25225( Guid expectedParentId, diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerFixture.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerFixture.cs index 718e09941ac..7859882aa29 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerFixture.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerFixture.cs @@ -16,13 +16,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().ToTable(tb => tb.IsTemporal()); modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasPrecision(0); - ttb.HasPeriodEnd("PeriodEnd").HasPrecision(0); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasPrecision(0); + ttb.HasPeriodEnd("PeriodEnd").HasPrecision(0); + }) ); modelBuilder.Entity().ToTable(tb => tb.IsTemporal()); modelBuilder.Entity().ToTable(tb => tb.IsTemporal()); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerFixture.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerFixture.cs index 75dff3e5c55..879a94bbcbf 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerFixture.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerFixture.cs @@ -40,15 +40,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder .Entity() - .HasKey( - e => - new - { - e.Key1, - e.Key2, - e.Key3 - } - ); + .HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().HasBaseType(); modelBuilder.Entity().HasBaseType(); @@ -63,15 +60,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder .Entity() - .HasKey( - e => - new - { - e.Key1, - e.Key2, - e.Key3 - } - ); + .HasKey(e => new + { + e.Key1, + e.Key2, + e.Key3 + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); modelBuilder.Entity().HasBaseType(); modelBuilder.Entity().HasBaseType(); @@ -218,15 +212,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinThreeFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) .IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired() ) @@ -256,15 +247,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinLeafFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) ) .ToTable(tb => tb.IsTemporal()); @@ -395,15 +383,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinThreeFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) .IsRequired(), r => r.HasOne(x => x.Three).WithMany(x => x.JoinCompositeKeyFull).IsRequired() ) @@ -433,15 +418,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con l => l.HasOne(x => x.Composite) .WithMany(x => x.JoinLeafFull) - .HasForeignKey( - e => - new - { - e.CompositeId1, - e.CompositeId2, - e.CompositeId3 - } - ) + .HasForeignKey(e => new + { + e.CompositeId1, + e.CompositeId2, + e.CompositeId3 + }) ) .ToTable(tb => tb.IsTemporal()); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs index 1f740dd933f..eb11d3d6ca9 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs @@ -1666,13 +1666,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con { modelBuilder.Entity(eb => { - eb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + eb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); eb.IndexerProperty("Name"); var ownedPerson = new OwnedPerson { Id = 1 }; @@ -1683,13 +1682,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con p => p.PersonAddress, ab => { - ab.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ab.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ab.IndexerProperty("AddressLine"); ab.IndexerProperty(typeof(int), "ZipCode"); @@ -1728,15 +1726,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con a => a.Country, cb => { - cb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart") - .HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd") - .HasColumnName("PeriodEnd"); - }) + cb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart") + .HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); cb.HasData( new @@ -1778,13 +1774,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con p => p.Orders, ob => { - ob.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ob.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ob.IndexerProperty("OrderDate"); ob.HasData( @@ -1824,15 +1819,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con e => e.Details, odb => { - odb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart") - .HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd") - .HasColumnName("PeriodEnd"); - }) + odb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart") + .HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); odb.HasData( new @@ -1878,13 +1871,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con p => p.BranchAddress, ab => { - ab.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ab.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ab.IndexerProperty("BranchName").IsRequired(); ab.HasData( @@ -1906,15 +1898,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con a => a.Country, cb => { - cb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart") - .HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd") - .HasColumnName("PeriodEnd"); - }) + cb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart") + .HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); cb.HasData( new @@ -1946,13 +1936,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con p => p.LeafAAddress, ab => { - ab.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ab.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ab.IndexerProperty("LeafType"); @@ -1969,15 +1958,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con a => a.Country, cb => { - cb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart") - .HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd") - .HasColumnName("PeriodEnd"); - }) + cb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart") + .HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); cb.HasOne(c => c.Planet) .WithMany() @@ -2008,13 +1995,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con p => p.LeafBAddress, ab => { - ab.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ab.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ab.IndexerProperty("LeafBType").IsRequired(); ab.HasData( @@ -2030,15 +2016,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con a => a.Country, cb => { - cb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart") - .HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd") - .HasColumnName("PeriodEnd"); - }) + cb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart") + .HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); cb.HasOne(c => c.Planet) .WithMany() @@ -2087,26 +2071,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(sb => { - sb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + sb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); sb.HasData(new Star { Id = 1, Name = "Sol" }); sb.OwnsMany( s => s.Composition, ob => { - ob.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + ob.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); ob.HasKey(e => e.Id); ob.HasData( @@ -2129,25 +2111,23 @@ protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext con modelBuilder.Entity(b => { - b.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + b.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); b.OwnsOne( e => e.Throned, b => { - b.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); - ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); - }) + b.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("PeriodStart").HasColumnName("PeriodStart"); + ttb.HasPeriodEnd("PeriodEnd").HasColumnName("PeriodEnd"); + }) ); b.HasData( new diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs index 0dfddeb052d..d4c004945db 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs @@ -474,13 +474,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity(eb => { - eb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("StartTime").HasColumnName("StartTime"); - ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); - }) + eb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("StartTime").HasColumnName("StartTime"); + ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); + }) ); eb.OwnsOne( @@ -488,27 +487,24 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) oeb => { oeb.WithOwner(); - oeb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("StartTime").HasColumnName("StartTime"); - ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); - }) + oeb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("StartTime").HasColumnName("StartTime"); + ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); + }) ); oeb.OwnsOne( x => x.Nested, neb => { neb.WithOwner(); - neb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("StartTime") - .HasColumnName("StartTime"); - ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); - }) + neb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("StartTime").HasColumnName("StartTime"); + ttb.HasPeriodEnd("EndTime").HasColumnName("EndTime"); + }) ); } ); @@ -557,13 +553,12 @@ protected virtual void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(eb => { - eb.ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start").HasColumnName("Start"); - ttb.HasPeriodEnd("End").HasColumnName("End"); - }) + eb.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start").HasColumnName("Start"); + ttb.HasPeriodEnd("End").HasColumnName("End"); + }) ); eb.HasDiscriminator("Discriminator"); eb.Property("Discriminator").HasColumnName("Discriminator"); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/SqlServerValueGenerationConflictTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/SqlServerValueGenerationConflictTest.cs index 152b8820f91..a132563c3b7 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/SqlServerValueGenerationConflictTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/SqlServerValueGenerationConflictTest.cs @@ -96,10 +96,9 @@ public virtual void SqlServerValueGeneration_conflicting_with_existing_ValueGene // Assert - this does not throw Validate(modelBuilder); - var logEntry = Fixture.ListLoggerFactory.Log.Single( - l => - l.Level == LogLevel.Warning - && l.Id == SqlServerEventId.ConflictingValueGenerationStrategiesWarning + var logEntry = Fixture.ListLoggerFactory.Log.Single(l => + l.Level == LogLevel.Warning + && l.Id == SqlServerEventId.ConflictingValueGenerationStrategiesWarning ); Assert.Equal( SqlServerResources @@ -127,8 +126,8 @@ public NoThrowContext(DbContextOptions options) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder .UseSqlServer() - .ConfigureWarnings( - b => b.Log(SqlServerEventId.ConflictingValueGenerationStrategiesWarning) + .ConfigureWarnings(b => + b.Log(SqlServerEventId.ConflictingValueGenerationStrategiesWarning) ); } } diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/StoreGeneratedSqlServerTestBase.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/StoreGeneratedSqlServerTestBase.cs index 632f73c8dc9..ff4f75d5e83 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/StoreGeneratedSqlServerTestBase.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/StoreGeneratedSqlServerTestBase.cs @@ -955,11 +955,10 @@ public abstract class StoreGeneratedSqlServerFixtureBase : StoreGeneratedFixture public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => builder .EnableSensitiveDataLogging() - .ConfigureWarnings( - b => - b.Default(WarningBehavior.Throw) - .Ignore(CoreEventId.SensitiveDataLoggingEnabledWarning) - .Ignore(RelationalEventId.BoolWithDefaultWarning) + .ConfigureWarnings(b => + b.Default(WarningBehavior.Throw) + .Ignore(CoreEventId.SensitiveDataLoggingEnabledWarning) + .Ignore(RelationalEventId.BoolWithDefaultWarning) ); protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Update/MismatchedKeyTypesSqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Update/MismatchedKeyTypesSqlServerTest.cs index 3d4c01f641c..4aed34044bf 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Update/MismatchedKeyTypesSqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Update/MismatchedKeyTypesSqlServerTest.cs @@ -488,27 +488,21 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder .Entity() - .HasKey( - e => - new - { - e.Id1, - e.Id2, - e.Id3 - } - ); + .HasKey(e => new + { + e.Id1, + e.Id2, + e.Id3 + }); modelBuilder .Entity() - .HasKey( - e => - new - { - e.Id1, - e.Id2, - e.Id3 - } - ); + .HasKey(e => new + { + e.Id1, + e.Id2, + e.Id3 + }); modelBuilder.Entity().Property(e => e.Id).ValueGeneratedNever(); diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/Update/StoreValueGenerationSqlServerFixtureBase.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/Update/StoreValueGenerationSqlServerFixtureBase.cs index 69ab9b132fe..8e75b72bb0a 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/Update/StoreValueGenerationSqlServerFixtureBase.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/Update/StoreValueGenerationSqlServerFixtureBase.cs @@ -23,10 +23,9 @@ private string GetCleanDataSql() var helper = context.GetService(); var tables = context .Model.GetEntityTypes() - .SelectMany( - e => - e.GetTableMappings() - .Select(m => helper.DelimitIdentifier(m.Table.Name, m.Table.Schema)) + .SelectMany(e => + e.GetTableMappings() + .Select(m => helper.DelimitIdentifier(m.Table.Name, m.Table.Schema)) ); foreach (var table in tables) diff --git a/efcore/test/EFCore.SqlServer.FunctionalTests/ValueConvertersEndToEndSqlServerTest.cs b/efcore/test/EFCore.SqlServer.FunctionalTests/ValueConvertersEndToEndSqlServerTest.cs index e6d34802db1..0fd85828504 100644 --- a/efcore/test/EFCore.SqlServer.FunctionalTests/ValueConvertersEndToEndSqlServerTest.cs +++ b/efcore/test/EFCore.SqlServer.FunctionalTests/ValueConvertersEndToEndSqlServerTest.cs @@ -188,11 +188,9 @@ public virtual void Can_use_custom_converters_without_property() Assert.Empty( context .Set() - .Where( - e => - EF.Functions.DataLength( - (string)(object)new WrappedString { Value = "" } - ) == 1 + .Where(e => + EF.Functions.DataLength((string)(object)new WrappedString { Value = "" }) + == 1 ) .ToList() ); diff --git a/efcore/test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs b/efcore/test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs index 7d98ec4935a..05f0f97288a 100644 --- a/efcore/test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs +++ b/efcore/test/EFCore.SqlServer.Tests/Design/Internal/SqlServerAnnotationCodeGeneratorTest.cs @@ -394,8 +394,7 @@ public void GenerateFluentApi_IModel_works_with_PerformanceLevel() var annotations = modelBuilder.Model.GetAnnotations().ToDictionary(a => a.Name, a => a); var result = generator .GenerateFluentApiCalls((IModel)modelBuilder.Model, annotations) - .Single( - c => c.Method == nameof(SqlServerModelBuilderExtensions.HasPerformanceLevelSql) + .Single(c => c.Method == nameof(SqlServerModelBuilderExtensions.HasPerformanceLevelSql) ); Assert.Equal("'foo'", Assert.Single(result.Arguments)); diff --git a/efcore/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs b/efcore/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs index c8897baca0f..c10ece9340d 100644 --- a/efcore/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs +++ b/efcore/test/EFCore.SqlServer.Tests/Infrastructure/SqlServerModelValidatorTest.cs @@ -1167,15 +1167,13 @@ public void Temporal_all_properties_mapped_to_period_column_must_have_value_gene var modelBuilder = CreateConventionModelBuilder(); modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal( - ttb => - ttb.HasPeriodStart("Start") - .HasColumnName("StartColumn") - .GetInfrastructure() - .ValueGeneratedNever() - ) + .ToTable(tb => + tb.IsTemporal(ttb => + ttb.HasPeriodStart("Start") + .HasColumnName("StartColumn") + .GetInfrastructure() + .ValueGeneratedNever() + ) ); VerifyError( @@ -1263,13 +1261,12 @@ public void Temporal_table_with_explicit_precision_on_period_columns_passes_vali var modelBuilder = CreateConventionModelBuilder(); modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start").HasPrecision(2); - ttb.HasPeriodEnd("End").HasPrecision(2); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start").HasPrecision(2); + ttb.HasPeriodEnd("End").HasPrecision(2); + }) ); Validate(modelBuilder); @@ -1286,22 +1283,20 @@ public void Temporal_table_with_owned_with_explicit_precision_on_period_columns_ var modelBuilder = CreateConventionModelBuilder(); modelBuilder.Entity(b => { - b.ToTable( - tb => + b.ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.HasPeriodStart("Start").HasColumnName("Start").HasPrecision(2); + ttb.HasPeriodEnd("End").HasColumnName("End").HasPrecision(2); + }) + ); + b.OwnsOne(x => x.Owned) + .ToTable(tb => tb.IsTemporal(ttb => { ttb.HasPeriodStart("Start").HasColumnName("Start").HasPrecision(2); ttb.HasPeriodEnd("End").HasColumnName("End").HasPrecision(2); }) - ); - b.OwnsOne(x => x.Owned) - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.HasPeriodStart("Start").HasColumnName("Start").HasPrecision(2); - ttb.HasPeriodEnd("End").HasColumnName("End").HasPrecision(2); - }) ); }); diff --git a/efcore/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs b/efcore/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs index 614507800c0..d5155785237 100644 --- a/efcore/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs +++ b/efcore/test/EFCore.SqlServer.Tests/Metadata/SqlServerMetadataBuilderExtensionsTest.cs @@ -437,9 +437,9 @@ public void Throws_setting_key_sequence_generation_for_invalid_type() Assert .Throws( () => - new PropertyBuilder( - (IMutableProperty)propertyBuilder.Metadata - ).UseSequence() + new PropertyBuilder((IMutableProperty)propertyBuilder.Metadata).UseSequence( + + ) ) .Message ); diff --git a/efcore/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderTestBase.cs b/efcore/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderTestBase.cs index 409100793d3..14a0c9ef606 100644 --- a/efcore/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderTestBase.cs +++ b/efcore/test/EFCore.SqlServer.Tests/ModelBuilding/SqlServerModelBuilderTestBase.cs @@ -287,15 +287,11 @@ public virtual void Can_set_collation_for_primitive_collection() [InlineData(false)] public virtual void Can_avoid_attributes_when_discovering_properties(bool useAttributes) { - var modelBuilder = CreateModelBuilder( - c => - c.Conventions.Replace( - s => - new PropertyDiscoveryConvention( - s.GetService()!, - useAttributes - ) - ) + var modelBuilder = CreateModelBuilder(c => + c.Conventions.Replace(s => new PropertyDiscoveryConvention( + s.GetService()!, + useAttributes + )) ); modelBuilder.Entity(); @@ -640,10 +636,8 @@ public void Can_add_check_constraints() modelBuilder .Entity() .HasBaseType(null) - .ToTable( - tb => - tb.HasCheckConstraint("CK_ChildBase_LargeId", "Id > 1000") - .HasName("CK_LargeId") + .ToTable(tb => + tb.HasCheckConstraint("CK_ChildBase_LargeId", "Id > 1000").HasName("CK_LargeId") ); modelBuilder .Entity() @@ -1713,14 +1707,13 @@ public virtual void Temporal_table_with_history_table_configuration() modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("MyPeriodStart").HasColumnName("PeriodStartColumn"); - ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("PeriodEndColumn"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("MyPeriodStart").HasColumnName("PeriodStartColumn"); + ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("PeriodEndColumn"); + }) ); modelBuilder.FinalizeModel(); @@ -1756,26 +1749,24 @@ public virtual void Temporal_table_with_changed_configuration() modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("MyPeriodStart"); - ttb.HasPeriodEnd("MyPeriodEnd"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("MyPeriodStart"); + ttb.HasPeriodEnd("MyPeriodEnd"); + }) ); modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("ChangedHistoryTable", "changedHistorySchema"); - ttb.HasPeriodStart("ChangedMyPeriodStart"); - ttb.HasPeriodEnd("ChangedMyPeriodEnd"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("ChangedHistoryTable", "changedHistorySchema"); + ttb.HasPeriodStart("ChangedMyPeriodStart"); + ttb.HasPeriodEnd("ChangedMyPeriodEnd"); + }) ); modelBuilder.FinalizeModel(); @@ -1811,27 +1802,25 @@ public virtual void Temporal_table_with_period_column_names_changed_configuratio modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", "historySchema"); - ttb.HasPeriodStart("MyPeriodStart").HasColumnName("PeriodStartColumn"); - ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("PeriodEndColumn"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", "historySchema"); + ttb.HasPeriodStart("MyPeriodStart").HasColumnName("PeriodStartColumn"); + ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("PeriodEndColumn"); + }) ); modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("ChangedHistoryTable", "changedHistorySchema"); - ttb.HasPeriodStart("MyPeriodStart") - .HasColumnName("ChangedPeriodStartColumn"); - ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("ChangedPeriodEndColumn"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("ChangedHistoryTable", "changedHistorySchema"); + ttb.HasPeriodStart("MyPeriodStart") + .HasColumnName("ChangedPeriodStartColumn"); + ttb.HasPeriodEnd("MyPeriodEnd").HasColumnName("ChangedPeriodEndColumn"); + }) ); modelBuilder.FinalizeModel(); @@ -1870,14 +1859,13 @@ public virtual void Temporal_table_with_explicit_properties_mapped_to_the_period modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", schema: null); - ttb.HasPeriodStart("Start").HasColumnName("PeriodStartColumn"); - ttb.HasPeriodEnd("End").HasColumnName("PeriodEndColumn"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", schema: null); + ttb.HasPeriodStart("Start").HasColumnName("PeriodStartColumn"); + ttb.HasPeriodEnd("End").HasColumnName("PeriodEndColumn"); + }) ); modelBuilder @@ -1934,14 +1922,13 @@ public virtual void Temporal_table_with_explicit_properties_with_same_name_as_de modelBuilder .Entity() - .ToTable( - tb => - tb.IsTemporal(ttb => - { - ttb.UseHistoryTable("HistoryTable", schema: null); - ttb.HasPeriodStart("Start"); - ttb.HasPeriodEnd("End"); - }) + .ToTable(tb => + tb.IsTemporal(ttb => + { + ttb.UseHistoryTable("HistoryTable", schema: null); + ttb.HasPeriodStart("Start"); + ttb.HasPeriodEnd("End"); + }) ); modelBuilder.FinalizeModel(); diff --git a/efcore/test/EFCore.SqlServer.Tests/SqlServerConnectionTest.cs b/efcore/test/EFCore.SqlServer.Tests/SqlServerConnectionTest.cs index ebee8fa7b82..683d1904eef 100644 --- a/efcore/test/EFCore.SqlServer.Tests/SqlServerConnectionTest.cs +++ b/efcore/test/EFCore.SqlServer.Tests/SqlServerConnectionTest.cs @@ -103,7 +103,9 @@ public static RelationalConnectionDependencies CreateDependencies( new RelationalCommandBuilderDependencies( new TestRelationalTypeMappingSource( TestServiceFactory.Instance.Create(), - TestServiceFactory.Instance.Create() + TestServiceFactory.Instance.Create( + + ) ), new SqlServerExceptionDetector() ) diff --git a/efcore/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerConnectionTest.cs b/efcore/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerConnectionTest.cs index 3ed82c01db1..881bac25538 100644 --- a/efcore/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerConnectionTest.cs +++ b/efcore/test/EFCore.SqlServer.Tests/Storage/Internal/SqlServerConnectionTest.cs @@ -102,7 +102,9 @@ public static RelationalConnectionDependencies CreateDependencies( new RelationalCommandBuilderDependencies( new TestRelationalTypeMappingSource( TestServiceFactory.Instance.Create(), - TestServiceFactory.Instance.Create() + TestServiceFactory.Instance.Create( + + ) ), new SqlServerExceptionDetector() ) diff --git a/efcore/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs b/efcore/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs index 1d0d8d547f2..ecc7567aca7 100644 --- a/efcore/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs +++ b/efcore/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs @@ -187,13 +187,10 @@ await AssertQuery( ss => ss.Set() .Where(o => o.OrderDate != null) - .Select( - o => - new Order - { - OrderDate = o.OrderDate.Value.AddTicks(10 * TimeSpan.TicksPerSecond) - } - ), + .Select(o => new Order + { + OrderDate = o.OrderDate.Value.AddTicks(10 * TimeSpan.TicksPerSecond) + }), e => e.OrderDate ); diff --git a/efcore/test/EFCore.Sqlite.FunctionalTests/Query/OwnedQuerySqliteTest.cs b/efcore/test/EFCore.Sqlite.FunctionalTests/Query/OwnedQuerySqliteTest.cs index 2fb3980855a..95e52f20789 100644 --- a/efcore/test/EFCore.Sqlite.FunctionalTests/Query/OwnedQuerySqliteTest.cs +++ b/efcore/test/EFCore.Sqlite.FunctionalTests/Query/OwnedQuerySqliteTest.cs @@ -13,8 +13,8 @@ public class OwnedQuerySqliteFixture : RelationalOwnedQueryFixture { public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) => base.AddOptions( - builder.ConfigureWarnings( - b => b.Ignore(SqliteEventId.CompositeKeyWithValueGeneration) + builder.ConfigureWarnings(b => + b.Ignore(SqliteEventId.CompositeKeyWithValueGeneration) ) ); diff --git a/efcore/test/EFCore.Tests/ChangeTracking/PropertyEntryTest.cs b/efcore/test/EFCore.Tests/ChangeTracking/PropertyEntryTest.cs index 2bf0c7424ed..0b0458bf1bd 100644 --- a/efcore/test/EFCore.Tests/ChangeTracking/PropertyEntryTest.cs +++ b/efcore/test/EFCore.Tests/ChangeTracking/PropertyEntryTest.cs @@ -5235,8 +5235,8 @@ public static IModel BuildModel( b.HasChangeTrackingStrategy(ChangeTrackingStrategy.Snapshot); }); - builder.Entity( - b => b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangedNotifications) + builder.Entity(b => + b.HasChangeTrackingStrategy(ChangeTrackingStrategy.ChangedNotifications) ); builder.Entity(b => diff --git a/efcore/test/EFCore.Tests/ChangeTracking/SkipCollectionEntryTest.cs b/efcore/test/EFCore.Tests/ChangeTracking/SkipCollectionEntryTest.cs index 3c5123d9d9f..3511fb7a555 100644 --- a/efcore/test/EFCore.Tests/ChangeTracking/SkipCollectionEntryTest.cs +++ b/efcore/test/EFCore.Tests/ChangeTracking/SkipCollectionEntryTest.cs @@ -458,10 +458,9 @@ public void IsModified_tracks_mutation_of_join_fks() var joinEntity = context .ChangeTracker.Entries>() - .Single( - e => - e.Property("CherryId").CurrentValue == 1 - && e.Property("ChunkyId").CurrentValue == 2 + .Single(e => + e.Property("CherryId").CurrentValue == 1 + && e.Property("ChunkyId").CurrentValue == 2 ) .Entity; @@ -541,10 +540,9 @@ public void Setting_IsModified_false_reverts_changes_to_join_table_FKs() var joinEntity = context .ChangeTracker.Entries>() - .Single( - e => - e.Property("CherryId").CurrentValue == 1 - && e.Property("ChunkyId").CurrentValue == 2 + .Single(e => + e.Property("CherryId").CurrentValue == 1 + && e.Property("ChunkyId").CurrentValue == 2 ) .Entity; diff --git a/efcore/test/EFCore.Tests/DbContextLoggerTests.cs b/efcore/test/EFCore.Tests/DbContextLoggerTests.cs index 789b712558d..8d8d83876d9 100644 --- a/efcore/test/EFCore.Tests/DbContextLoggerTests.cs +++ b/efcore/test/EFCore.Tests/DbContextLoggerTests.cs @@ -514,8 +514,8 @@ private static async Task LogTest( { var options = configureLogging( new DbContextOptionsBuilder() - .ConfigureWarnings( - wb => wb.Log((CoreEventId.ContextInitialized, LogLevel.Information)) + .ConfigureWarnings(wb => + wb.Log((CoreEventId.ContextInitialized, LogLevel.Information)) ) .UseInMemoryDatabase("DbContextLoggerTests") ).Options; diff --git a/efcore/test/EFCore.Tests/DbContextTest.cs b/efcore/test/EFCore.Tests/DbContextTest.cs index 7a9c080ae8c..6e9cc43c8e9 100644 --- a/efcore/test/EFCore.Tests/DbContextTest.cs +++ b/efcore/test/EFCore.Tests/DbContextTest.cs @@ -354,11 +354,8 @@ protected internal override void OnConfiguring(DbContextOptionsBuilder optionsBu protected internal override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity( - b => - b.HasOne(x => x.Author) - .WithMany(x => x.Questions) - .HasForeignKey(x => x.AuthorId) + modelBuilder.Entity(b => + b.HasOne(x => x.Author).WithMany(x => x.Questions).HasForeignKey(x => x.AuthorId) ); modelBuilder.Entity(b => diff --git a/efcore/test/EFCore.Tests/EventSourceTest.cs b/efcore/test/EFCore.Tests/EventSourceTest.cs index 58d68cad946..e364d5a5eb1 100644 --- a/efcore/test/EFCore.Tests/EventSourceTest.cs +++ b/efcore/test/EFCore.Tests/EventSourceTest.cs @@ -89,8 +89,8 @@ public async Task Counts_query_cache_hits_and_misses(bool async) { using var context = new SomeDbContext(); - var query = context.Foos.Where( - e => e.Id == new Guid("6898CFFC-3DCC-45A6-A472-A23057462EE6") + var query = context.Foos.Where(e => + e.Id == new Guid("6898CFFC-3DCC-45A6-A472-A23057462EE6") ); _ = async ? await query.ToListAsync() : query.ToList(); diff --git a/efcore/test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs b/efcore/test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs index befd6849318..f07360d38aa 100644 --- a/efcore/test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs +++ b/efcore/test/EFCore.Tests/Extensions/QueryableExtensionsTest.cs @@ -45,186 +45,181 @@ public void Extension_methods_call_provider_ExecuteAsync() { var cancellationTokenSource = new CancellationTokenSource(); - VerifyProducedExpression( - value => value.AllAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AllAsync(e => true, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.AnyAsync(default)); VerifyProducedExpression(value => value.AnyAsync(cancellationTokenSource.Token)); VerifyProducedExpression(value => value.AnyAsync(e => true, default)); - VerifyProducedExpression( - value => value.AnyAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AnyAsync(e => true, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.AverageAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.AverageAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.ContainsAsync(0, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.ContainsAsync(0, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.CountAsync(default)); - VerifyProducedExpression( - value => value.CountAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => value.CountAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.CountAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.CountAsync(e => true, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.FirstAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => value.FirstAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.FirstAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.FirstAsync(e => true, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.FirstOrDefaultAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.FirstOrDefaultAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.FirstOrDefaultAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.FirstOrDefaultAsync(e => true, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.LongCountAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.LongCountAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.LongCountAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.LongCountAsync(e => true, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.MaxAsync(cancellationTokenSource.Token)); - VerifyProducedExpression( - value => value.MaxAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.MaxAsync(e => e, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.MinAsync(cancellationTokenSource.Token)); - VerifyProducedExpression( - value => value.MinAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.MinAsync(e => e, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SingleAsync(default)); - VerifyProducedExpression( - value => value.SingleAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => value.SingleAsync(cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SingleAsync(e => true, default)); - VerifyProducedExpression( - value => value.SingleAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SingleAsync(e => true, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SingleOrDefaultAsync(default)); - VerifyProducedExpression( - value => value.SingleOrDefaultAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SingleOrDefaultAsync(cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SingleOrDefaultAsync(e => true, default)); - VerifyProducedExpression( - value => value.SingleOrDefaultAsync(e => true, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SingleOrDefaultAsync(e => true, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SumAsync(default)); VerifyProducedExpression(value => value.SumAsync(cancellationTokenSource.Token)); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); VerifyProducedExpression(value => value.SumAsync(default)); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(cancellationTokenSource.Token) ); - VerifyProducedExpression( - value => value.SumAsync(e => e, cancellationTokenSource.Token) + VerifyProducedExpression(value => + value.SumAsync(e => e, cancellationTokenSource.Token) ); } diff --git a/efcore/test/EFCore.Tests/Infrastructure/EventIdTestBase.cs b/efcore/test/EFCore.Tests/Infrastructure/EventIdTestBase.cs index 8a1abcf485a..c76265683f9 100644 --- a/efcore/test/EFCore.Tests/Infrastructure/EventIdTestBase.cs +++ b/efcore/test/EFCore.Tests/Infrastructure/EventIdTestBase.cs @@ -57,10 +57,8 @@ public void TestEventLogging( var eventIdFields = eventIdType .GetTypeInfo() - .DeclaredFields.Where( - p => - p.FieldType == typeof(EventId) - && p.GetCustomAttribute() == null + .DeclaredFields.Where(p => + p.FieldType == typeof(EventId) && p.GetCustomAttribute() == null ) .ToList(); @@ -88,10 +86,9 @@ public void TestEventLogging( ? loggerParameters[0].ParameterType.GenericTypeArguments[0] : loggerMethod .DeclaringType!.GetInterfaces() - .Single( - i => - i.IsGenericType - && i.GetGenericTypeDefinition() == typeof(IDiagnosticsLogger<>) + .Single(i => + i.IsGenericType + && i.GetGenericTypeDefinition() == typeof(IDiagnosticsLogger<>) ) .GetGenericArguments()[0]; diff --git a/efcore/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs b/efcore/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs index 126f0a50b9b..19e6b81c619 100644 --- a/efcore/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs +++ b/efcore/test/EFCore.Tests/Infrastructure/ModelValidatorTest.PropertyMapping.cs @@ -78,8 +78,8 @@ public virtual void Throws_when_nonprimitive_value_type_property_is_not_added_or [ConditionalFact] public virtual void Does_not_throw_when_nonprimitive_value_type_property_type_is_ignored() { - var modelBuilder = CreateConventionlessModelBuilder( - configurationBuilder => configurationBuilder.IgnoreAny() + var modelBuilder = CreateConventionlessModelBuilder(configurationBuilder => + configurationBuilder.IgnoreAny() ); modelBuilder.Entity(typeof(NonPrimitiveValueTypePropertyEntity)).HasNoKey(); @@ -193,8 +193,8 @@ public virtual void Does_not_throw_when_navigation_is_ignored() [ConditionalFact] public virtual void Does_not_throw_when_navigation_type_is_ignored() { - var modelBuilder = CreateConventionlessModelBuilder( - configurationBuilder => configurationBuilder.IgnoreAny() + var modelBuilder = CreateConventionlessModelBuilder(configurationBuilder => + configurationBuilder.IgnoreAny() ); modelBuilder.Entity(typeof(NavigationEntity)).HasNoKey(); @@ -252,8 +252,8 @@ public virtual void Throws_when_interface_type_property_is_not_added_or_ignored( [ConditionalFact] public virtual void Does_not_throw_when_interface_collection_type_property_type_is_ignored() { - var modelBuilder = CreateConventionlessModelBuilder( - configurationBuilder => configurationBuilder.IgnoreAny() + var modelBuilder = CreateConventionlessModelBuilder(configurationBuilder => + configurationBuilder.IgnoreAny() ); modelBuilder.Entity(typeof(InterfaceNavigationEntity)).HasNoKey(); @@ -263,8 +263,8 @@ public virtual void Does_not_throw_when_interface_collection_type_property_type_ [ConditionalFact] public virtual void Does_not_throw_when_interface_generic_type_property_type_is_ignored() { - var modelBuilder = CreateConventionlessModelBuilder( - configurationBuilder => configurationBuilder.IgnoreAny(typeof(IList<>)) + var modelBuilder = CreateConventionlessModelBuilder(configurationBuilder => + configurationBuilder.IgnoreAny(typeof(IList<>)) ); modelBuilder.Entity(typeof(InterfaceNavigationEntity)).HasNoKey(); @@ -274,8 +274,8 @@ public virtual void Does_not_throw_when_interface_generic_type_property_type_is_ [ConditionalFact] public virtual void Does_not_throw_when_interface_base_type_property_type_is_ignored() { - var modelBuilder = CreateConventionlessModelBuilder( - configurationBuilder => configurationBuilder.IgnoreAny>() + var modelBuilder = CreateConventionlessModelBuilder(configurationBuilder => + configurationBuilder.IgnoreAny>() ); modelBuilder.Entity(typeof(InterfaceNavigationEntity)).HasNoKey(); diff --git a/efcore/test/EFCore.Tests/Infrastructure/ServiceCollectionMapTest.cs b/efcore/test/EFCore.Tests/Infrastructure/ServiceCollectionMapTest.cs index 07f772ae4e8..6e7c7cfe523 100644 --- a/efcore/test/EFCore.Tests/Infrastructure/ServiceCollectionMapTest.cs +++ b/efcore/test/EFCore.Tests/Infrastructure/ServiceCollectionMapTest.cs @@ -151,12 +151,12 @@ public void Existing_services_are_not_replaced() ExistingServiceTest(m => m.TryAddTransient(typeof(IFakeService), typeof(FakeService))); ExistingServiceTest(m => m.TryAddScoped(typeof(IFakeService), typeof(FakeService))); ExistingServiceTest(m => m.TryAddSingleton(typeof(IFakeService), typeof(FakeService))); - ExistingServiceTest( - m => m.TryAddTransient(p => new FakeService()) + ExistingServiceTest(m => + m.TryAddTransient(p => new FakeService()) ); ExistingServiceTest(m => m.TryAddScoped(p => new FakeService())); - ExistingServiceTest( - m => m.TryAddSingleton(p => new FakeService()) + ExistingServiceTest(m => + m.TryAddSingleton(p => new FakeService()) ); ExistingServiceTest(m => m.TryAddTransient(p => new FakeService())); ExistingServiceTest(m => m.TryAddScoped(p => new FakeService())); diff --git a/efcore/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs b/efcore/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs index 5c09b925c29..9773edd0f2f 100644 --- a/efcore/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs +++ b/efcore/test/EFCore.Tests/Metadata/Conventions/DiscriminatorConventionTest.cs @@ -122,9 +122,9 @@ public void Sets_discriminator_for_three_level_hierarchy() RunConvention(entityTypeBuilder, baseTypeBuilder.Metadata); Assert.Null(((IReadOnlyEntityType)baseTypeBuilder.Metadata).FindDiscriminatorProperty()); - discriminator = ( - (IReadOnlyEntityType)entityTypeBuilder.Metadata - ).FindDiscriminatorProperty(); + discriminator = ((IReadOnlyEntityType)entityTypeBuilder.Metadata).FindDiscriminatorProperty( + + ); Assert.NotNull(discriminator); Assert.Same( discriminator, diff --git a/efcore/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs b/efcore/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs index c52bd2885dd..e50eb6f59c2 100644 --- a/efcore/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs +++ b/efcore/test/EFCore.Tests/Metadata/Conventions/NonNullableNavigationConventionTest.cs @@ -206,8 +206,8 @@ private ProviderConventionSetBuilderDependencies CreateDependencies() => protected IServiceProvider CreateServiceProvider() => InMemoryTestHelpers.Instance.CreateContextServices( - new ServiceCollection().AddScoped>( - _ => CreateLogger() + new ServiceCollection().AddScoped>(_ => + CreateLogger() ) ); diff --git a/efcore/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs b/efcore/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs index 5a26db4ee8a..ef76175d367 100644 --- a/efcore/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs +++ b/efcore/test/EFCore.Tests/Metadata/Internal/InternalEntityTypeBuilderTest.cs @@ -1117,9 +1117,8 @@ Func shadowConfig Assert.Empty( dependentEntityBuilder .Metadata.GetForeignKeys() - .Where( - foreignKey => - foreignKey.Properties.SequenceEqual(relationshipBuilder.Metadata.Properties) + .Where(foreignKey => + foreignKey.Properties.SequenceEqual(relationshipBuilder.Metadata.Properties) ) ); } diff --git a/efcore/test/EFCore.Tests/ModelBuilding/ComplexTypeTestBase.cs b/efcore/test/EFCore.Tests/ModelBuilding/ComplexTypeTestBase.cs index 9f656a5e740..a9f1280758d 100644 --- a/efcore/test/EFCore.Tests/ModelBuilding/ComplexTypeTestBase.cs +++ b/efcore/test/EFCore.Tests/ModelBuilding/ComplexTypeTestBase.cs @@ -105,8 +105,8 @@ public virtual void Can_set_property_annotation_when_no_clr_property() [ConditionalFact] public virtual void Can_set_property_annotation_by_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveAnnotation("foo", "bar") + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveAnnotation("foo", "bar") ); modelBuilder @@ -743,8 +743,8 @@ public virtual void Properties_can_have_provider_type_set() [ConditionalFact] public virtual void Properties_can_have_provider_type_set_for_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveConversion() + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveConversion() ); modelBuilder @@ -845,10 +845,9 @@ public virtual void Properties_can_have_custom_type_value_converter_type_set() b.Property("Charm") .HasConversion, CustomValueComparer>(); b.Property("Strange") - .HasConversion< - UTF8StringToBytesConverter, - CustomValueComparer - >(); + .HasConversion>( + + ); b.Property("Strange").HasConversion(null, null); } ); @@ -2005,8 +2004,8 @@ public virtual void Can_call_Property_on_a_field() [ConditionalFact] public virtual void Can_ignore_a_field() { - var modelBuilder = CreateModelBuilder( - c => c.ComplexProperties() + var modelBuilder = CreateModelBuilder(c => + c.ComplexProperties() ); modelBuilder diff --git a/efcore/test/EFCore.Tests/ModelBuilding/ManyToManyTestBase.cs b/efcore/test/EFCore.Tests/ModelBuilding/ManyToManyTestBase.cs index 580c9b5ef14..1b5efd1dc0c 100644 --- a/efcore/test/EFCore.Tests/ModelBuilding/ManyToManyTestBase.cs +++ b/efcore/test/EFCore.Tests/ModelBuilding/ManyToManyTestBase.cs @@ -116,8 +116,8 @@ public virtual void Finds_existing_navigations_and_uses_associated_FK_with_impli .Entity() .HasMany(p => p.Categories) .WithMany(c => c.Products) - .UsingEntity( - pcb => pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId }) + .UsingEntity(pcb => + pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId }) ); var productType = model.FindEntityType(typeof(Product))!; @@ -335,8 +335,8 @@ public virtual void Can_configure_join_type_with_implicit_join_relationships() .Entity() .HasMany(p => p.Categories) .WithMany(c => c.Products) - .UsingEntity( - pcb => pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId }) + .UsingEntity(pcb => + pcb.HasKey(pc => new { pc.ProductId, pc.CategoryId }) ); Assert.Equal(typeof(Product), manyToMany.Metadata.ClrType); diff --git a/efcore/test/EFCore.Tests/ModelBuilding/ModelBuilderGenericRelationshipTypeTest.cs b/efcore/test/EFCore.Tests/ModelBuilding/ModelBuilderGenericRelationshipTypeTest.cs index d2d73dbed99..4545f9408a1 100644 --- a/efcore/test/EFCore.Tests/ModelBuilding/ModelBuilderGenericRelationshipTypeTest.cs +++ b/efcore/test/EFCore.Tests/ModelBuilding/ModelBuilderGenericRelationshipTypeTest.cs @@ -49,9 +49,8 @@ public override TestModelBuilder Entity( Action> buildAction ) { - ModelBuilder.Entity( - entityTypeBuilder => - buildAction(new GenericTypeTestEntityTypeBuilder(entityTypeBuilder)) + ModelBuilder.Entity(entityTypeBuilder => + buildAction(new GenericTypeTestEntityTypeBuilder(entityTypeBuilder)) ); return this; } @@ -326,11 +325,8 @@ public override TestEntityTypeBuilder UsingEntity( Action> configureJoinEntityType ) => new GenericTypeTestEntityTypeBuilder( - CollectionCollectionBuilder.UsingEntity( - e => - configureJoinEntityType( - new GenericTypeTestEntityTypeBuilder(e) - ) + CollectionCollectionBuilder.UsingEntity(e => + configureJoinEntityType(new GenericTypeTestEntityTypeBuilder(e)) ) ); diff --git a/efcore/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs b/efcore/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs index efd4de8daab..abf775a5367 100644 --- a/efcore/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs +++ b/efcore/test/EFCore.Tests/ModelBuilding/NonRelationshipTestBase.cs @@ -371,8 +371,8 @@ public virtual void Can_set_property_annotation_when_no_clr_property() [ConditionalFact] public virtual void Can_set_property_annotation_by_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveAnnotation("foo", "bar") + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveAnnotation("foo", "bar") ); modelBuilder.Ignore(); @@ -454,8 +454,7 @@ public virtual void Properties_can_be_ignored_by_type() [ConditionalFact] public virtual void Conventions_can_be_added() { - var modelBuilder = CreateModelBuilder( - c => c.Conventions.Add(s => new TestConvention()) + var modelBuilder = CreateModelBuilder(c => c.Conventions.Add(s => new TestConvention()) ); var model = modelBuilder.FinalizeModel(); @@ -494,14 +493,10 @@ public virtual void Conventions_can_be_removed_by_generic_method() [ConditionalFact] public virtual void Conventions_can_be_replaced() { - var modelBuilder = CreateModelBuilder( - c => - c.Conventions.Replace( - s => - new TestDbSetFindingConvention( - s.GetService()! - ) - ) + var modelBuilder = CreateModelBuilder(c => + c.Conventions.Replace(s => new TestDbSetFindingConvention( + s.GetService()! + )) ); var model = modelBuilder.FinalizeModel(); @@ -975,8 +970,8 @@ public virtual void Properties_can_have_provider_type_set() [ConditionalFact] public virtual void Properties_can_have_provider_type_set_for_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveConversion() + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveConversion() ); modelBuilder.Entity(b => @@ -1276,10 +1271,9 @@ public virtual void Properties_can_have_value_converter_configured_by_type() [ConditionalFact] public virtual void Value_converter_configured_on_non_nullable_type_is_applied() { - var modelBuilder = CreateModelBuilder( - c => - c.Properties() - .HaveConversion, CustomValueComparer>() + var modelBuilder = CreateModelBuilder(c => + c.Properties() + .HaveConversion, CustomValueComparer>() ); modelBuilder.Entity(b => b.Property("Wierd")); @@ -2723,8 +2717,8 @@ public virtual void Can_set_primitive_collection_annotation_when_no_clr_property [ConditionalFact] public virtual void Can_set_primitive_collection_annotation_by_type() { - var modelBuilder = CreateModelBuilder( - c => c.Properties().HaveAnnotation("foo", "bar") + var modelBuilder = CreateModelBuilder(c => + c.Properties().HaveAnnotation("foo", "bar") ); modelBuilder.Ignore(); diff --git a/efcore/test/EFCore.Tests/ModelBuilding/OneToOneTestBase.cs b/efcore/test/EFCore.Tests/ModelBuilding/OneToOneTestBase.cs index b92841d5e89..96d34ae6ac0 100644 --- a/efcore/test/EFCore.Tests/ModelBuilding/OneToOneTestBase.cs +++ b/efcore/test/EFCore.Tests/ModelBuilding/OneToOneTestBase.cs @@ -135,8 +135,8 @@ public virtual void Can_create_two_FKs_using_the_same_property() .ToList(); Assert.Equal(2, foreignKeys.Count); - var customerFk = foreignKeys.Single( - fk => fk.PrincipalEntityType.ClrType == typeof(Customer) + var customerFk = foreignKeys.Single(fk => + fk.PrincipalEntityType.ClrType == typeof(Customer) ); var orderFk = foreignKeys.Single(fk => fk.PrincipalEntityType.ClrType == typeof(Order)); var dependentType = customerFk.DeclaringEntityType; @@ -414,10 +414,9 @@ public virtual void Creates_relationship_with_navigation_to_dependent_and_new_FK Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -735,10 +734,9 @@ public virtual void Creates_relationship_with_specified_FK_with_navigation_to_pr Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -1026,10 +1024,9 @@ public virtual void Creates_FK_when_specified_on_dependent_with_navigation_to_pr Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -1072,10 +1069,9 @@ public virtual void Creates_FK_when_specified_on_principal_with_navigation_to_pr Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -1154,10 +1150,9 @@ public virtual void Creates_FK_when_specified_on_dependent_with_no_navigations() Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -1203,10 +1198,9 @@ public virtual void Creates_FK_when_specified_on_principal_with_no_navigations() Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -2807,10 +2801,9 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_naviga Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -2862,10 +2855,9 @@ public virtual void Creates_composite_FK_when_specified_on_principal_with_no_nav Assert.True( principalType .GetForeignKeys() - .All( - foreignKey => - principalType.FindIndex(foreignKey.Properties).IsUnique - == foreignKey.IsUnique + .All(foreignKey => + principalType.FindIndex(foreignKey.Properties).IsUnique + == foreignKey.IsUnique ) ); } @@ -4260,8 +4252,8 @@ public virtual void Creates_field_backed_FK_property() modelBuilder.Ignore(); - modelBuilder.Entity( - b => b.HasOne().WithOne().HasForeignKey("_forUp").IsRequired() + modelBuilder.Entity(b => + b.HasOne().WithOne().HasForeignKey("_forUp").IsRequired() ); var fkProperty = modelBuilder @@ -4330,8 +4322,8 @@ public virtual void Can_create_relationship_if_dependent_has_matching_property_w b.Ignore(e => e.OneToOneDependentEntityId); b.Ignore(e => e.NavOneToOneDependentEntityId); }); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOnePrincipalEntityId) ); modelBuilder @@ -4360,8 +4352,8 @@ public virtual void Can_create_relationship_if_dependent_has_matching_property_w b.Ignore(e => e.OneToOneDependentEntityId); b.Ignore(e => e.NavOneToOneDependentEntityId); }); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOnePrincipalEntityId) ); modelBuilder @@ -4385,8 +4377,8 @@ public virtual void Can_create_relationship_if_dependent_has_matching_property_w public virtual void Can_invert_relationship_if_principal_has_matching_property_with_navigation_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOneDependentEntityId) ); modelBuilder.Entity(b => { @@ -4415,8 +4407,8 @@ public virtual void Can_invert_relationship_if_principal_has_matching_property_w public virtual void Can_invert_relationship_if_principal_has_matching_property_with_entity_type_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOneDependentEntityId) ); modelBuilder.Entity(b => { @@ -4458,8 +4450,8 @@ public virtual void Ignoring_properties_resolves_ambiguity() .WithOne(e => e.NavOneToOnePrincipalEntity) .IsRequired(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOneDependentEntityId) ); modelBuilder.FinalizeModel(); @@ -4470,8 +4462,8 @@ public virtual void Ignoring_properties_on_principal_resolves_ambiguity() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOnePrincipalEntityId) ); modelBuilder @@ -4561,11 +4553,11 @@ public virtual void Throws_for_one_to_one_relationship_if_no_side_has_matching_p public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matching_property_with_navigation_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOneDependentEntityId) ); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOnePrincipalEntityId) ); modelBuilder @@ -4590,11 +4582,11 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matching_property_with_entity_type_name() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOneDependentEntityId) ); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOnePrincipalEntityId) ); modelBuilder @@ -4619,11 +4611,11 @@ public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matchi public virtual void Throws_for_one_to_one_relationship_if_both_sides_have_matching_property_mixed() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOneDependentEntityId) ); - modelBuilder.Entity( - b => b.Ignore(e => e.OneToOnePrincipalEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.OneToOnePrincipalEntityId) ); modelBuilder @@ -4815,8 +4807,8 @@ public virtual void Does_not_use_pk_as_fk_if_principal_end_is_not_specified() public virtual void Creates_one_to_one_relationship_with_single_ref_as_principal_to_dependent_if_matching_properties_are_on_the_other_side() { var modelBuilder = CreateModelBuilder(); - modelBuilder.Entity( - b => b.Ignore(e => e.NavOneToOneDependentEntityId) + modelBuilder.Entity(b => + b.Ignore(e => e.NavOneToOneDependentEntityId) ); modelBuilder.Entity(b => { diff --git a/efcore/test/EFCore.Tests/Query/EntityMaterializerSourceTest.cs b/efcore/test/EFCore.Tests/Query/EntityMaterializerSourceTest.cs index 7416cc08af8..81ef9cb6751 100644 --- a/efcore/test/EFCore.Tests/Query/EntityMaterializerSourceTest.cs +++ b/efcore/test/EFCore.Tests/Query/EntityMaterializerSourceTest.cs @@ -302,18 +302,17 @@ public void Can_create_materializer_for_entity_with_auto_properties(bool usePara [InlineData(true)] public void Can_create_materializer_for_entity_with_fields(bool useParameters) { - using var context = new SomeEntityContext( - b => - b.Entity(eb => - { - eb.UsePropertyAccessMode(PropertyAccessMode.Field); + using var context = new SomeEntityContext(b => + b.Entity(eb => + { + eb.UsePropertyAccessMode(PropertyAccessMode.Field); - eb.Property(e => e.Enum).HasField("_enum"); - eb.Property(e => e.Foo).HasField("_foo"); - eb.Property(e => e.Goo).HasField("_goo"); - eb.Property(e => e.Id).HasField("_id"); - eb.Property(e => e.MaybeEnum).HasField("_maybeEnum"); - }) + eb.Property(e => e.Enum).HasField("_enum"); + eb.Property(e => e.Foo).HasField("_foo"); + eb.Property(e => e.Goo).HasField("_goo"); + eb.Property(e => e.Id).HasField("_id"); + eb.Property(e => e.MaybeEnum).HasField("_maybeEnum"); + }) ); var entityType = context.Model.FindEntityType(typeof(SomeEntityWithFields)); @@ -346,13 +345,12 @@ public void Can_create_materializer_for_entity_with_fields(bool useParameters) [InlineData(true)] public void Can_read_nulls(bool useParameters) { - using var context = new SomeEntityContext( - b => - b.Entity(eb => - { - eb.Ignore(e => e.Enum); - eb.Ignore(e => e.MaybeEnum); - }) + using var context = new SomeEntityContext(b => + b.Entity(eb => + { + eb.Ignore(e => e.Enum); + eb.Ignore(e => e.MaybeEnum); + }) ); var entityType = context.Model.FindEntityType(typeof(SomeEntity)); @@ -379,19 +377,18 @@ public void Can_read_nulls(bool useParameters) [InlineData(true)] public void Can_create_materializer_for_entity_ignoring_shadow_fields(bool useParameters) { - using var context = new SomeEntityContext( - b => - b.Entity(eb => - { - eb.UsePropertyAccessMode(PropertyAccessMode.Property); + using var context = new SomeEntityContext(b => + b.Entity(eb => + { + eb.UsePropertyAccessMode(PropertyAccessMode.Property); - eb.Ignore(e => e.Enum); - eb.Ignore(e => e.MaybeEnum); + eb.Ignore(e => e.Enum); + eb.Ignore(e => e.MaybeEnum); - eb.Property("IdShadow"); - eb.Property("FooShadow"); - eb.Property("GooShadow"); - }) + eb.Property("IdShadow"); + eb.Property("FooShadow"); + eb.Property("GooShadow"); + }) ); var entityType = context.Model.FindEntityType(typeof(SomeEntity)); diff --git a/efcore/test/EFCore.Tests/Query/ExpressionPrinterTest.cs b/efcore/test/EFCore.Tests/Query/ExpressionPrinterTest.cs index 2b58eac0e70..43cd3d171e4 100644 --- a/efcore/test/EFCore.Tests/Query/ExpressionPrinterTest.cs +++ b/efcore/test/EFCore.Tests/Query/ExpressionPrinterTest.cs @@ -274,8 +274,8 @@ public void Simple_MethodCall_printed_correctly() => Expression.Constant("Foo"), typeof(string) .GetMethods() - .Single( - m => m.Name == nameof(string.ToUpper) && m.GetParameters().Count() == 0 + .Single(m => + m.Name == nameof(string.ToUpper) && m.GetParameters().Count() == 0 ) ) ) @@ -293,9 +293,8 @@ public void Complex_MethodCall_printed_correctly() => Expression.Constant("Foobar"), typeof(string) .GetMethods() - .Single( - m => - m.Name == nameof(string.Substring) && m.GetParameters().Count() == 2 + .Single(m => + m.Name == nameof(string.Substring) && m.GetParameters().Count() == 2 ), Expression.Constant(0), Expression.Constant(4) diff --git a/efcore/test/EFCore.Tests/Storage/ExecutionStrategyTest.cs b/efcore/test/EFCore.Tests/Storage/ExecutionStrategyTest.cs index f7b873729e6..c88751e51f3 100644 --- a/efcore/test/EFCore.Tests/Storage/ExecutionStrategyTest.cs +++ b/efcore/test/EFCore.Tests/Storage/ExecutionStrategyTest.cs @@ -376,14 +376,14 @@ Action> execute [ConditionalFact] public Task ExecuteAsync_Action_throws_for_an_existing_transaction() => - ExecuteAsync_throws_for_an_existing_transaction( - e => e.ExecuteAsync(() => (Task)Task.FromResult(1)) + ExecuteAsync_throws_for_an_existing_transaction(e => + e.ExecuteAsync(() => (Task)Task.FromResult(1)) ); [ConditionalFact] public Task ExecuteAsync_Func_throws_for_an_existing_transaction() => - ExecuteAsync_throws_for_an_existing_transaction( - e => e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) + ExecuteAsync_throws_for_an_existing_transaction(e => + e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) ); private async Task ExecuteAsync_throws_for_an_existing_transaction( @@ -409,14 +409,14 @@ await Assert.ThrowsAsync( [ConditionalFact] public async Task ExecuteAsync_Action_throws_for_an_ambient_transaction() => - await ExecuteAsync_throws_for_an_ambient_transaction( - e => e.ExecuteAsync(() => (Task)Task.FromResult(1)) + await ExecuteAsync_throws_for_an_ambient_transaction(e => + e.ExecuteAsync(() => (Task)Task.FromResult(1)) ); [ConditionalFact] public async Task ExecuteAsync_Func_throws_for_an_ambient_transaction() => - await ExecuteAsync_throws_for_an_ambient_transaction( - e => e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) + await ExecuteAsync_throws_for_an_ambient_transaction(e => + e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) ); private async Task ExecuteAsync_throws_for_an_ambient_transaction( @@ -442,14 +442,14 @@ await Assert.ThrowsAsync( [ConditionalFact] public async Task ExecuteAsync_Action_throws_for_an_enlisted_transaction() => - await ExecuteAsync_throws_for_an_enlisted_transaction( - e => e.ExecuteAsync(() => (Task)Task.FromResult(1)) + await ExecuteAsync_throws_for_an_enlisted_transaction(e => + e.ExecuteAsync(() => (Task)Task.FromResult(1)) ); [ConditionalFact] public async Task ExecuteAsync_Func_throws_for_an_enlisted_transaction() => - await ExecuteAsync_throws_for_an_enlisted_transaction( - e => e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) + await ExecuteAsync_throws_for_an_enlisted_transaction(e => + e.ExecuteAsync(ct => Task.FromResult(1), CancellationToken.None) ); private async Task ExecuteAsync_throws_for_an_enlisted_transaction( diff --git a/format/perf/Utilities/MSBuildRegister.cs b/format/perf/Utilities/MSBuildRegister.cs index 7953d0be939..4fb94df0451 100644 --- a/format/perf/Utilities/MSBuildRegister.cs +++ b/format/perf/Utilities/MSBuildRegister.cs @@ -46,9 +46,8 @@ public static void RegisterInstance(string solutionDir) pathsToSearch.AddRange( new DirectoryInfo(installs) .EnumerateDirectories() - .Select( - install => - Path.Combine(install.FullName, "MSBuild", "Current", "Bin") + .Select(install => + Path.Combine(install.FullName, "MSBuild", "Current", "Bin") ) ); } diff --git a/format/src/Analyzers/AnalyzerFormatter.cs b/format/src/Analyzers/AnalyzerFormatter.cs index 054e7a4c3a6..ef2c62f97dc 100644 --- a/format/src/Analyzers/AnalyzerFormatter.cs +++ b/format/src/Analyzers/AnalyzerFormatter.cs @@ -88,18 +88,16 @@ CancellationToken cancellationToken // Only include compiler diagnostics if we have an associated fixer that supports FixAllScope.Solution var fixableCompilerDiagnostics = _includeCompilerDiagnostics ? allFixers - .Where( - codefix => - codefix - .GetFixAllProvider() - ?.GetSupportedFixAllScopes() - ?.Contains(FixAllScope.Solution) == true + .Where(codefix => + codefix + .GetFixAllProvider() + ?.GetSupportedFixAllScopes() + ?.Contains(FixAllScope.Solution) == true ) - .SelectMany( - codefix => - codefix.FixableDiagnosticIds.Where( - id => id.StartsWith("CS") || id.StartsWith("BC") - ) + .SelectMany(codefix => + codefix.FixableDiagnosticIds.Where(id => + id.StartsWith("CS") || id.StartsWith("BC") + ) ) .ToImmutableHashSet() : ImmutableHashSet.Empty; @@ -231,8 +229,8 @@ CancellationToken cancellationToken var projects = options.WorkspaceType == WorkspaceType.Solution ? solution.Projects - : solution.Projects.Where( - project => project.FilePath == options.WorkspaceFilePath + : solution.Projects.Where(project => + project.FilePath == options.WorkspaceFilePath ); foreach (var project in projects) { @@ -376,11 +374,10 @@ CancellationToken cancellationToken } var analyzers = projectAnalyzers[project.Id] - .Where( - analyzer => - analyzer.SupportedDiagnostics.Any( - descriptor => descriptor.Id == diagnosticId - ) + .Where(analyzer => + analyzer.SupportedDiagnostics.Any(descriptor => + descriptor.Id == diagnosticId + ) ) .ToImmutableArray(); await _runner @@ -476,8 +473,8 @@ CancellationToken cancellationToken // Skip if the project does not contain any of the formattable paths. if ( - !project.Documents.Any( - d => d.FilePath is not null && formattablePaths.Contains(d.FilePath) + !project.Documents.Any(d => + d.FilePath is not null && formattablePaths.Contains(d.FilePath) ) ) { @@ -496,8 +493,8 @@ CancellationToken cancellationToken // Filter by excluded diagnostics if ( !excludeDiagnostics.IsEmpty - && analyzer.SupportedDiagnostics.All( - descriptor => excludeDiagnostics.Contains(descriptor.Id) + && analyzer.SupportedDiagnostics.All(descriptor => + excludeDiagnostics.Contains(descriptor.Id) ) ) { @@ -507,8 +504,8 @@ CancellationToken cancellationToken // Filter by diagnostics if ( !diagnostics.IsEmpty - && !analyzer.SupportedDiagnostics.Any( - descriptor => diagnostics.Contains(descriptor.Id) + && !analyzer.SupportedDiagnostics.Any(descriptor => + diagnostics.Contains(descriptor.Id) ) ) { diff --git a/format/src/Analyzers/AnalyzerReferenceInformationProvider.cs b/format/src/Analyzers/AnalyzerReferenceInformationProvider.cs index 2e53ca9d355..64c117b1d33 100644 --- a/format/src/Analyzers/AnalyzerReferenceInformationProvider.cs +++ b/format/src/Analyzers/AnalyzerReferenceInformationProvider.cs @@ -40,15 +40,14 @@ Project project ) { var analyzerAssemblies = project - .AnalyzerReferences.Select( - reference => TryLoadAssemblyFrom(workspace, reference.FullPath, reference) + .AnalyzerReferences.Select(reference => + TryLoadAssemblyFrom(workspace, reference.FullPath, reference) ) .OfType() .ToImmutableArray(); var analyzers = project - .AnalyzerReferences.SelectMany( - reference => reference.GetAnalyzers(project.Language) + .AnalyzerReferences.SelectMany(reference => reference.GetAnalyzers(project.Language) ) .ToImmutableArray(); return new AnalyzersAndFixers( diff --git a/format/src/Analyzers/SolutionCodeFixApplier.cs b/format/src/Analyzers/SolutionCodeFixApplier.cs index 192ab2bc9d5..f4169b76fbe 100644 --- a/format/src/Analyzers/SolutionCodeFixApplier.cs +++ b/format/src/Analyzers/SolutionCodeFixApplier.cs @@ -154,8 +154,8 @@ CancellationToken cancellationToken cancellationToken ); return projectDiagnostics - .Where( - diagnostic => diagnostic.Location.SourceTree?.FilePath == document.FilePath + .Where(diagnostic => + diagnostic.Location.SourceTree?.FilePath == document.FilePath ) .ToImmutableArray(); } diff --git a/format/src/Workspaces/MSBuildWorkspaceFinder.cs b/format/src/Workspaces/MSBuildWorkspaceFinder.cs index 6e4385523bf..9a1ee72af4c 100644 --- a/format/src/Workspaces/MSBuildWorkspaceFinder.cs +++ b/format/src/Workspaces/MSBuildWorkspaceFinder.cs @@ -127,12 +127,11 @@ private static IEnumerable FindSolutionFiles(string basePath) => private static IEnumerable FindProjectFiles(string basePath) => Directory .EnumerateFileSystemEntries(basePath, "*.*proj", SearchOption.TopDirectoryOnly) - .Where( - f => - !DnxProjectExtension.Equals( - Path.GetExtension(f), - StringComparison.OrdinalIgnoreCase - ) + .Where(f => + !DnxProjectExtension.Equals( + Path.GetExtension(f), + StringComparison.OrdinalIgnoreCase + ) ); private static string? FindMatchingFile( diff --git a/format/tests/Analyzers/AnalyzerAssemblyGenerator.cs b/format/tests/Analyzers/AnalyzerAssemblyGenerator.cs index d1842f78399..a6fddc610d0 100644 --- a/format/tests/Analyzers/AnalyzerAssemblyGenerator.cs +++ b/format/tests/Analyzers/AnalyzerAssemblyGenerator.cs @@ -61,9 +61,8 @@ private static async Task> GetReferencesAsync() CancellationToken.None ); references.AddRange( - netcoreMetadataReferences.Where( - reference => - Path.GetFileName(reference.Display) != "System.Collections.Immutable.dll" + netcoreMetadataReferences.Where(reference => + Path.GetFileName(reference.Display) != "System.Collections.Immutable.dll" ) ); @@ -142,10 +141,9 @@ public static async Task GenerateAssemblyAsync(params SyntaxTree[] tre if (!result.Success) { var failures = result - .Diagnostics.Where( - diagnostic => - diagnostic.IsWarningAsError - || diagnostic.Severity == DiagnosticSeverity.Error + .Diagnostics.Where(diagnostic => + diagnostic.IsWarningAsError + || diagnostic.Severity == DiagnosticSeverity.Error ) .Select(diagnostic => $"{diagnostic.Id}: {diagnostic.GetMessage()}"); diff --git a/format/tests/Analyzers/FilterDiagnosticsTests.cs b/format/tests/Analyzers/FilterDiagnosticsTests.cs index a696c5ee2a5..c5090abf913 100644 --- a/format/tests/Analyzers/FilterDiagnosticsTests.cs +++ b/format/tests/Analyzers/FilterDiagnosticsTests.cs @@ -171,11 +171,10 @@ await GenerateAssemblyAsync( var analyzers = assemblies .SelectMany(assembly => assembly.GetTypes()) .Where(type => typeof(DiagnosticAnalyzer).IsAssignableFrom(type)) - .Where( - type => - type.GetCustomAttribute(inherit: false) - is { } attribute - && attribute.Languages.Contains(language) + .Where(type => + type.GetCustomAttribute(inherit: false) + is { } attribute + && attribute.Languages.Contains(language) ) .Select(type => (DiagnosticAnalyzer)Activator.CreateInstance(type)) .OfType() diff --git a/format/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs b/format/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs index 15e9d782097..2aa455f31bd 100644 --- a/format/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs +++ b/format/tests/Analyzers/ThirdPartyAnalyzerFormatterTests.cs @@ -84,8 +84,8 @@ public Task DisposeAsync() } private IEnumerable GetAnalyzerReferences(string prefix) => - _analyzerReferencesProject.AnalyzerReferences.Where( - reference => reference.Display.StartsWith(prefix) + _analyzerReferencesProject.AnalyzerReferences.Where(reference => + reference.Display.StartsWith(prefix) ); [MSBuildFact] diff --git a/mono/acceptance-tests/profiler-stress/runner.cs b/mono/acceptance-tests/profiler-stress/runner.cs index 4ff9cc67593..35cf241978e 100644 --- a/mono/acceptance-tests/profiler-stress/runner.cs +++ b/mono/acceptance-tests/profiler-stress/runner.cs @@ -113,12 +113,11 @@ static int Main() var benchmarks = Directory .EnumerateFiles(benchDir, "*.benchmark") .Select(Benchmark.Load) - .Where( - b => - !b.OnlyExplicit - && b.ClientCommandLine == null - && IsSupported(b) - && regex.IsMatch(b.Name) + .Where(b => + !b.OnlyExplicit + && b.ClientCommandLine == null + && IsSupported(b) + && regex.IsMatch(b.Name) ) .OrderBy(b => b.Name) .ToArray(); diff --git a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs index 8bd77cc8a1d..c66d00cd6c9 100644 --- a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs +++ b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Construction/ProjectRootElement.cs @@ -345,13 +345,12 @@ IEnumerable> metadata ) { var @group = ItemGroups - .Where( - p => - string.IsNullOrEmpty(p.Condition) - && p.Items.Where( - s => s.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) - ) - .FirstOrDefault() != null + .Where(p => + string.IsNullOrEmpty(p.Condition) + && p.Items.Where(s => + s.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) + ) + .FirstOrDefault() != null ) .FirstOrDefault(); if (@group == null) @@ -362,13 +361,12 @@ IEnumerable> metadata public ProjectItemDefinitionElement AddItemDefinition(string itemType) { var @group = ItemDefinitionGroups - .Where( - p => - string.IsNullOrEmpty(p.Condition) - && p.ItemDefinitions.Where( - s => s.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) - ) - .FirstOrDefault() != null + .Where(p => + string.IsNullOrEmpty(p.Condition) + && p.ItemDefinitions.Where(s => + s.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) + ) + .FirstOrDefault() != null ) .FirstOrDefault(); if (@group == null) @@ -406,10 +404,9 @@ public ProjectPropertyElement AddProperty(string name, string value) if (parentGroup == null) parentGroup = @group; var property = @group - .Properties.Where( - p => - string.IsNullOrEmpty(p.Condition) - && p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + .Properties.Where(p => + string.IsNullOrEmpty(p.Condition) + && p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ) .FirstOrDefault(); if (property != null) diff --git a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs index 4513fcdcc99..3bee0b18e38 100644 --- a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs +++ b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/Project.cs @@ -290,13 +290,12 @@ IEnumerable elements foreach (var p in pge.Properties) // do not allow overwriting reserved or well-known properties by user if ( - !this.properties.Any( - _ => - (_.IsReservedProperty || _.IsWellKnownProperty) - && _.Name.Equals( - p.Name, - StringComparison.InvariantCultureIgnoreCase - ) + !this.properties.Any(_ => + (_.IsReservedProperty || _.IsWellKnownProperty) + && _.Name.Equals( + p.Name, + StringComparison.InvariantCultureIgnoreCase + ) ) ) if (Evaluate(p.Condition)) @@ -364,8 +363,8 @@ Action assignRecurse DirectoryPath, assignRecurse, t => - all_evaluated_items.Any( - i => i.EvaluatedInclude == t.ItemSpec && itemTypeCheck(i.ItemType) + all_evaluated_items.Any(i => + i.EvaluatedInclude == t.ItemSpec && itemTypeCheck(i.ItemType) ) ); } @@ -489,8 +488,7 @@ IEnumerable Import(ProjectImportElement import) public ICollection GetItemsIgnoringCondition(string itemType) { return new CollectionFromEnumerable( - raw_items.Where( - p => p.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) + raw_items.Where(p => p.ItemType.Equals(itemType, StringComparison.OrdinalIgnoreCase) ) ); } @@ -697,12 +695,8 @@ public ICollection GetItems(string itemType) public ICollection GetItemsByEvaluatedInclude(string evaluatedInclude) { return new CollectionFromEnumerable( - Items.Where( - p => - p.EvaluatedInclude.Equals( - evaluatedInclude, - StringComparison.OrdinalIgnoreCase - ) + Items.Where(p => + p.EvaluatedInclude.Equals(evaluatedInclude, StringComparison.OrdinalIgnoreCase) ) ); } @@ -719,16 +713,16 @@ public static string GetMetadataValueEscaped(ProjectMetadata metadatum) public static string GetMetadataValueEscaped(ProjectItem item, string name) { - var md = item.Metadata.FirstOrDefault( - m => m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + var md = item.Metadata.FirstOrDefault(m => + m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); return md != null ? ProjectCollection.Escape(md.EvaluatedValue) : null; } public static string GetMetadataValueEscaped(ProjectItemDefinition item, string name) { - var md = item.Metadata.FirstOrDefault( - m => m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + var md = item.Metadata.FirstOrDefault(m => + m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); return md != null ? ProjectCollection.Escape(md.EvaluatedValue) : null; } @@ -759,8 +753,8 @@ public ProjectProperty GetProperty(string name) ) ) return new ReservedProjectProperty(this, name, () => extensions_path_override); - return properties.FirstOrDefault( - p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + return properties.FirstOrDefault(p => + p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); } @@ -787,8 +781,8 @@ public bool RemoveItem(ProjectItem item) public bool RemoveProperty(ProjectProperty property) { - var removed = properties.FirstOrDefault( - p => p.Name.Equals(property.Name, StringComparison.OrdinalIgnoreCase) + var removed = properties.FirstOrDefault(p => + p.Name.Equals(property.Name, StringComparison.OrdinalIgnoreCase) ); if (removed == null) return false; diff --git a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs index 02ed5538674..af4eb0e4605 100644 --- a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs +++ b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Evaluation/ProjectCollection.cs @@ -184,10 +184,8 @@ protected virtual void Dispose(bool disposing) public ICollection GetLoadedProjects(string fullPath) { return LoadedProjects - .Where( - p => - p.FullPath != null - && Path.GetFullPath(p.FullPath) == Path.GetFullPath(fullPath) + .Where(p => + p.FullPath != null && Path.GetFullPath(p.FullPath) == Path.GetFullPath(fullPath) ) .ToList(); } diff --git a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs index 2f40819491d..006582e00be 100644 --- a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs +++ b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectInstance.cs @@ -253,13 +253,9 @@ IEnumerable elements foreach (var p in pge.Properties) // do not allow overwriting reserved or well-known properties by user if ( - !this.properties.Any( - _ => - (_.Value.IsImmutable) - && _.Key.Equals( - p.Name, - StringComparison.InvariantCultureIgnoreCase - ) + !this.properties.Any(_ => + (_.Value.IsImmutable) + && _.Key.Equals(p.Name, StringComparison.InvariantCultureIgnoreCase) ) ) if (EvaluateCondition(p.Condition)) @@ -329,8 +325,8 @@ Action assignRecurse Directory, assignRecurse, t => - all_evaluated_items.Any( - i => i.EvaluatedInclude == t.ItemSpec && itemTypeCheck(i.ItemType) + all_evaluated_items.Any(i => + i.EvaluatedInclude == t.ItemSpec && itemTypeCheck(i.ItemType) ) ); } @@ -346,16 +342,16 @@ void EvaluateItems(ProjectRootElement xml, IEnumerable elements) { if (!EvaluateCondition(ige.Condition) || !EvaluateCondition(p.Condition)) continue; - Func creator = s => - new ProjectItemInstance( - this, - p.ItemType, - p.Metadata.Select( - m => new KeyValuePair(m.Name, m.Value) - ) - .ToList(), - s - ); + Func creator = s => new ProjectItemInstance( + this, + p.ItemType, + p.Metadata.Select(m => new KeyValuePair( + m.Name, + m.Value + )) + .ToList(), + s + ); foreach ( var item in GetAllItems( p.Include, @@ -669,8 +665,8 @@ public ProjectPropertyInstance GetProperty(string name) ) ) return new ProjectPropertyInstance(name, true, extensions_path_override); - return properties.Values.FirstOrDefault( - p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + return properties.Values.FirstOrDefault(p => + p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); } @@ -689,8 +685,8 @@ public bool RemoveItem(ProjectItemInstance item) public bool RemoveProperty(string name) { - var removed = properties.Values.FirstOrDefault( - p => p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + var removed = properties.Values.FirstOrDefault(p => + p.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); if (removed == null) return false; @@ -738,16 +734,16 @@ public static string GetMetadataValueEscaped( string name ) { - var md = item.Metadata.FirstOrDefault( - m => m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + var md = item.Metadata.FirstOrDefault(m => + m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); return md != null ? ProjectCollection.Escape(md.EvaluatedValue) : null; } public static string GetMetadataValueEscaped(ProjectItemInstance item, string name) { - var md = item.Metadata.FirstOrDefault( - m => m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + var md = item.Metadata.FirstOrDefault(m => + m.Name.Equals(name, StringComparison.OrdinalIgnoreCase) ); return md != null ? ProjectCollection.Escape(md.EvaluatedValue) : null; } diff --git a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyGroupTaskInstance.cs b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyGroupTaskInstance.cs index 678b10df51b..955c2a1fa23 100644 --- a/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyGroupTaskInstance.cs +++ b/mono/mcs/class/Microsoft.Build/Microsoft.Build.Execution/ProjectPropertyGroupTaskInstance.cs @@ -41,9 +41,9 @@ internal ProjectPropertyGroupTaskInstance(ProjectPropertyGroupElement xml) //this.FullPath = fullPath; location = xml.Location; - Properties = xml.Properties.Select( - prop => new ProjectPropertyGroupTaskPropertyInstance(prop) - ) + Properties = xml.Properties.Select(prop => new ProjectPropertyGroupTaskPropertyInstance( + prop + )) .ToArray(); } diff --git a/mono/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildParametersTest.cs b/mono/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildParametersTest.cs index a9ea792fa69..fcf77cf57ab 100644 --- a/mono/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildParametersTest.cs +++ b/mono/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildParametersTest.cs @@ -46,8 +46,8 @@ public void GetToolset() var ts = bp.GetToolset("2.0"); // They are equal Assert.AreEqual( - ProjectCollection.GlobalProjectCollection.Toolsets.First( - t => t.ToolsVersion == "2.0" + ProjectCollection.GlobalProjectCollection.Toolsets.First(t => + t.ToolsVersion == "2.0" ), ts, "#2" @@ -58,8 +58,8 @@ public void GetToolset() ts = bp.GetToolset("2.0"); // They are NOT equal, because ProjectCollection seems to be different. Assert.AreNotEqual( - ProjectCollection.GlobalProjectCollection.Toolsets.First( - t => t.ToolsVersion == "2.0" + ProjectCollection.GlobalProjectCollection.Toolsets.First(t => + t.ToolsVersion == "2.0" ), ts, "#2" diff --git a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/ExprVisitor.cs b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/ExprVisitor.cs index 67929de14b7..986bc5d904a 100644 --- a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/ExprVisitor.cs +++ b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/ExprVisitor.cs @@ -135,13 +135,12 @@ protected virtual Expr VisitCompareLessThan(ExprCompareLessThan e) { return this.VisitCollection( e, - exprs => - new ExprCompareLessThan( - e.MethodInfo, - exprs.First(), - exprs.ElementAt(1), - e.Signage - ), + exprs => new ExprCompareLessThan( + e.MethodInfo, + exprs.First(), + exprs.ElementAt(1), + e.Signage + ), e.Left, e.Right ); @@ -151,13 +150,12 @@ protected virtual Expr VisitCompareGreaterThan(ExprCompareGreaterThan e) { return this.VisitCollection( e, - exprs => - new ExprCompareGreaterThan( - e.MethodInfo, - exprs.First(), - exprs.ElementAt(1), - e.Signage - ), + exprs => new ExprCompareGreaterThan( + e.MethodInfo, + exprs.First(), + exprs.ElementAt(1), + e.Signage + ), e.Left, e.Right ); @@ -177,14 +175,13 @@ protected virtual Expr VisitAdd(ExprAdd e) { return this.VisitCollection( e, - exprs => - new ExprAdd( - e.MethodInfo, - exprs.First(), - exprs.ElementAt(1), - e.Signage, - e.Overflow - ), + exprs => new ExprAdd( + e.MethodInfo, + exprs.First(), + exprs.ElementAt(1), + e.Signage, + e.Overflow + ), e.Left, e.Right ); @@ -194,14 +191,13 @@ protected virtual Expr VisitSub(ExprSub e) { return this.VisitCollection( e, - exprs => - new ExprSub( - e.MethodInfo, - exprs.First(), - exprs.ElementAt(1), - e.Signage, - e.Overflow - ), + exprs => new ExprSub( + e.MethodInfo, + exprs.First(), + exprs.ElementAt(1), + e.Signage, + e.Overflow + ), e.Left, e.Right ); diff --git a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/Module.cs b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/Module.cs index 89347baf31a..80db6160afe 100644 --- a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/Module.cs +++ b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/Module.cs @@ -61,8 +61,8 @@ public List Types public TypeNode GetType(string ns, string className) { - TypeReference firstOrDefault = this.definition.Types.FirstOrDefault( - t => t.Namespace == ns && t.Name == className + TypeReference firstOrDefault = this.definition.Types.FirstOrDefault(t => + t.Namespace == ns && t.Name == className ); if (firstOrDefault == null) return null; diff --git a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.ControlFlow.Subroutines/SubroutineBase.cs b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.ControlFlow.Subroutines/SubroutineBase.cs index d1be484b226..4d9199bdeb4 100644 --- a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.ControlFlow.Subroutines/SubroutineBase.cs +++ b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.ControlFlow.Subroutines/SubroutineBase.cs @@ -874,13 +874,10 @@ private Sequence> SpecializedEnsures( Subroutine specializedEnsures ) { - return subroutines.Select( - pair => - new Pair( - pair.Key, - pair.Value == toReplace ? specializedEnsures : pair.Value - ) - ); + return subroutines.Select(pair => new Pair( + pair.Key, + pair.Value == toReplace ? specializedEnsures : pair.Value + )); } private static Predicate> FilterRecursiveContracts( diff --git a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Lattices/EnvironmentDomain.cs b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Lattices/EnvironmentDomain.cs index abe8192d8f7..4255bd86ed3 100644 --- a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Lattices/EnvironmentDomain.cs +++ b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Lattices/EnvironmentDomain.cs @@ -213,8 +213,8 @@ public bool LessEqual(EnvironmentDomain that) if (map.Count < that.map.Count) return false; - return that.map.Keys.All( - key => map.ContainsKey(key) && map[key].LessEqual(that.map[key]) + return that.map.Keys.All(key => + map.ContainsKey(key) && map[key].LessEqual(that.map[key]) ); } diff --git a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Proving/ComposedFactQuery.cs b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Proving/ComposedFactQuery.cs index 4f0a88e432e..7e398e877fa 100644 --- a/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Proving/ComposedFactQuery.cs +++ b/mono/mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.Proving/ComposedFactQuery.cs @@ -172,8 +172,7 @@ BoxedExpression goal ) { return elements - .Select( - fact => fact.IsTrueImply(pc, positiveAssumptions, negativeAssumptions, goal) + .Select(fact => fact.IsTrueImply(pc, positiveAssumptions, negativeAssumptions, goal) ) .FirstOrDefault(factResult => !factResult.IsTop); } diff --git a/mono/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs b/mono/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs index 15a2f0094a0..f702e808126 100644 --- a/mono/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs +++ b/mono/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs @@ -309,9 +309,8 @@ public IList GetVisibleVariables() return Method .GetLocals() - .Where( - l => - l.LiveRangeStart <= location.ILOffset && l.LiveRangeEnd >= location.ILOffset + .Where(l => + l.LiveRangeStart <= location.ILOffset && l.LiveRangeEnd >= location.ILOffset ) .ToList(); } @@ -326,11 +325,10 @@ public LocalVariable GetVisibleVariableByName(string name) return Method .GetLocals() - .Where( - l => - l.LiveRangeStart <= location.ILOffset - && l.LiveRangeEnd >= location.ILOffset - && l.Name == name + .Where(l => + l.LiveRangeStart <= location.ILOffset + && l.LiveRangeEnd >= location.ILOffset + && l.Name == name ) .FirstOrDefault(); } diff --git a/mono/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mono/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 0671d2ac838..d33129f518f 100644 --- a/mono/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mono/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -1999,11 +1999,9 @@ public void TypeInfo() // reference types t = frame.Method.GetParameters()[7].ParameterType; Assert.AreEqual("Tests", t.Name); - var nested = ( - from nt in t.GetNestedTypes() - where nt.IsNestedPublic - select nt - ).ToArray(); + var nested = (from nt in t.GetNestedTypes() where nt.IsNestedPublic select nt).ToArray( + + ); Assert.AreEqual(2, nested.Length); Assert.AreEqual("NestedClass", nested[0].Name); Assert.IsTrue(t.BaseType.IsAssignableFrom(t)); @@ -3385,12 +3383,11 @@ public void Invoke() var stringType = vm.RootDomain.Corlib.GetType("System.String"); var stringConstructor = stringType .GetMethods() - .Single( - c => - c.Name == ".ctor" - && c.GetParameters().Length == 2 - && c.GetParameters()[0].ParameterType.Name == "Char" - && c.GetParameters()[1].ParameterType.Name == "Int32" + .Single(c => + c.Name == ".ctor" + && c.GetParameters().Length == 2 + && c.GetParameters()[0].ParameterType.Name == "Char" + && c.GetParameters()[1].ParameterType.Name == "Int32" ); var str = stringType.NewInstance( e.Thread, diff --git a/mono/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs b/mono/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs index a958bcb0faa..496e70389b8 100644 --- a/mono/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs +++ b/mono/mcs/class/Novell.Directory.Ldap/Novell.Directory.Ldap.Rfc2251/RfcFilter.cs @@ -319,9 +319,9 @@ private Asn1Tagged parseFilterComp() int tokCnt = sub.Count; int cnt = 0; - System.String lastTok = new System.Text.StringBuilder( - "" - ).ToString(); + System.String lastTok = new System.Text.StringBuilder("").ToString( + + ); while (sub.HasMoreTokens()) { diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs index e2ff4622152..7dccb705068 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/CompositionException.cs @@ -111,15 +111,12 @@ IEnumerable errors var data = new CompositionExceptionData(); if (this._errors != null) { - data._errors = this._errors.Select( - error => - new CompositionError( - error.Id, - error.Description, - error.Element.ToSerializableElement(), - error.Exception - ) - ) + data._errors = this._errors.Select(error => new CompositionError( + error.Id, + error.Description, + error.Element.ToSerializableElement(), + error.Exception + )) .ToArray(); } else diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs index 0e82680233d..3b79e6a52a7 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/CompositionServices.cs @@ -620,9 +620,10 @@ Type metadataViewType // NOTE : this is a carefully found balance between eager and delay-evaluation - the properties are filtered once and upfront // whereas the key/Type pairs are created every time. The latter is fine as KVPs are structs and as such copied on access regardless. // This also allows us to avoid creation of List which - at least according to FxCop - leads to isues with NGEN - return properties.Select( - property => new KeyValuePair(property.Name, property.PropertyType) - ); + return properties.Select(property => new KeyValuePair( + property.Name, + property.PropertyType + )); } internal static IDictionary GetImportMetadata( diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs index acd23882e43..cc50be49a28 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/DirectoryCatalog.DirectoryCatalogDebuggerProxy.cs @@ -29,8 +29,7 @@ public ReadOnlyCollection Assemblies { get { - return this._catalog._assemblyCatalogs.Values.Select( - catalog => catalog.Assembly + return this._catalog._assemblyCatalogs.Values.Select(catalog => catalog.Assembly ) .ToReadOnlyCollection(); } diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs index 08e715daa08..77674a5c9dd 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs @@ -61,8 +61,8 @@ public static IEnumerable GetAffectedImports( IEnumerable changedExports ) { - return part.ImportDefinitions.Where( - import => IsAffectedImport(import, changedExports) + return part.ImportDefinitions.Where(import => + IsAffectedImport(import, changedExports) ); } diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs index 44af8ed5af9..4e9b77f5205 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/Hosting/TypeCatalog.cs @@ -381,8 +381,8 @@ private IDictionary> CreateIndex() foreach (var part in this.PartsInternal) { foreach ( - string contractName in part.ExportDefinitions.Select( - export => export.ContractName + string contractName in part.ExportDefinitions.Select(export => + export.ContractName ) .Distinct() ) diff --git a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs index 1259b533869..2c94d05ce7b 100644 --- a/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs +++ b/mono/mcs/class/System.ComponentModel.Composition.4.5/src/ComponentModel/System/ComponentModel/Composition/ReflectionModel/ReflectionMemberImportDefinition.cs @@ -48,8 +48,9 @@ ICompositionElement origin public override ImportingItem ToImportingItem() { - ReflectionWritableMember member = - this.ImportingLazyMember.ToReflectionWriteableMember(); + ReflectionWritableMember member = this.ImportingLazyMember.ToReflectionWriteableMember( + + ); return new ImportingMember( this, member, diff --git a/mono/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs b/mono/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs index fa3e31fbea9..53ae8128525 100644 --- a/mono/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs +++ b/mono/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs @@ -2538,6 +2538,7 @@ private IEnumerator GetSourceEnumerator() { if (source != null && cursor == null) throw new InvalidOperationException( /* GetEnumerator not called yet */ + ); if (source == null && cursor == null) throw new ObjectDisposedException(GetType().FullName); diff --git a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ALinq/ProjectionAnalyzer.cs b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ALinq/ProjectionAnalyzer.cs index 881656e808f..fa0bb60c49b 100644 --- a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ALinq/ProjectionAnalyzer.cs +++ b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ALinq/ProjectionAnalyzer.cs @@ -736,10 +736,9 @@ internal override Expression VisitInvocation(InvocationExpression iv) if ( ClientType.CheckElementTypeIsEntity(iv.Expression.Type) || IsCollectionProducingExpression(iv.Expression) - || iv.Arguments.Any( - a => - ClientType.CheckElementTypeIsEntity(a.Type) - || IsCollectionProducingExpression(a) + || iv.Arguments.Any(a => + ClientType.CheckElementTypeIsEntity(a.Type) + || IsCollectionProducingExpression(a) ) ) { diff --git a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/AtomMaterializer.cs b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/AtomMaterializer.cs index 3d3b811cca6..333a56a98f5 100644 --- a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/AtomMaterializer.cs +++ b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/AtomMaterializer.cs @@ -1474,10 +1474,9 @@ EpmTargetPathSegment target { var node = element .Nodes() - .Where( - n => - n.NodeType == XmlNodeType.Text - || n.NodeType == XmlNodeType.SignificantWhitespace + .Where(n => + n.NodeType == XmlNodeType.Text + || n.NodeType == XmlNodeType.SignificantWhitespace ) .FirstOrDefault(); string elementValue = (node == null) ? null : ((XText)node).Value; diff --git a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/Binding/BindingGraph.cs b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/Binding/BindingGraph.cs index 84f709182e0..e967b454cf0 100644 --- a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/Binding/BindingGraph.cs +++ b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/Binding/BindingGraph.cs @@ -289,10 +289,9 @@ public bool IsTracking(object item) public void RemoveNonTrackedEntities() { foreach ( - var entity in this.graph.Select( - o => - BindingEntityInfo.IsEntityType(o.GetType()) - && !this.observer.IsContextTrackingEntity(o) + var entity in this.graph.Select(o => + BindingEntityInfo.IsEntityType(o.GetType()) + && !this.observer.IsContextTrackingEntity(o) ) ) { diff --git a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/DataServiceContext.cs b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/DataServiceContext.cs index 9e97ed3c62a..639b7e2df76 100644 --- a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/DataServiceContext.cs +++ b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/DataServiceContext.cs @@ -1755,8 +1755,8 @@ out EntityStates state internal IEnumerable GetLinks(object source, string sourceProperty) { - return this.bindings.Values.Where( - o => (o.Source == source) && (o.SourceProperty == sourceProperty) + return this.bindings.Values.Where(o => + (o.Source == source) && (o.SourceProperty == sourceProperty) ); } @@ -3093,8 +3093,8 @@ out bool propertiesWritten EpmSourcePathSegment matchedSegment = currentSegment != null - ? currentSegment.SubProperties.SingleOrDefault( - s => s.PropertyName == property.PropertyName + ? currentSegment.SubProperties.SingleOrDefault(s => + s.PropertyName == property.PropertyName ) : null; @@ -3250,8 +3250,8 @@ MergeOption linkMerge this.DetachExistingLink(existing, false); Debug.Assert( - !this.bindings.Values.Any( - o => (o.Source == source) && (o.SourceProperty == sourceProperty) + !this.bindings.Values.Any(o => + (o.Source == source) && (o.SourceProperty == sourceProperty) ), "only expecting one" ); @@ -5715,14 +5715,14 @@ out etag && ( 0 == changesetIndex || 0 < queryCount - || this.ChangedEntries.Any( - o => o.ContentGeneratedForSave && 0 == o.SaveResultWasProcessed + || this.ChangedEntries.Any(o => + o.ContentGeneratedForSave && 0 == o.SaveResultWasProcessed ) && ( !IsFlagSet(this.options, SaveChangesOptions.Batch) || null - == this.ChangedEntries.FirstOrDefault( - o => null != o.SaveError + == this.ChangedEntries.FirstOrDefault(o => + null != o.SaveError ) ) ) diff --git a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ProjectionPlanCompiler.cs b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ProjectionPlanCompiler.cs index 7bcdcfbdc0b..bee8ba23802 100644 --- a/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ProjectionPlanCompiler.cs +++ b/mono/mcs/class/System.Data.Services.Client/Client/System/Data/Services/Client/ProjectionPlanCompiler.cs @@ -842,10 +842,9 @@ private NewExpression RebindNewExpressionForDataServiceCollectionOfT(NewExpressi ConstructorInfo constructorInfo = nex.Type.GetConstructors( BindingFlags.NonPublic | BindingFlags.Instance ) - .First( - c => - c.GetParameters().Length == 7 - && c.GetParameters()[0].ParameterType == typeof(object) + .First(c => + c.GetParameters().Length == 7 + && c.GetParameters()[0].ParameterType == typeof(object) ); Type enumerable = typeof(IEnumerable<>).MakeGenericType( diff --git a/mono/mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.jvm/OleDbCommandBuilder/OleDbCommandBuilder_DeriveParameters_O.cs b/mono/mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.jvm/OleDbCommandBuilder/OleDbCommandBuilder_DeriveParameters_O.cs index 1d029965e79..d5c53f2ce19 100644 --- a/mono/mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.jvm/OleDbCommandBuilder/OleDbCommandBuilder_DeriveParameters_O.cs +++ b/mono/mcs/class/System.Data/Test/ProviderTests/System.Data.OleDb.jvm/OleDbCommandBuilder/OleDbCommandBuilder_DeriveParameters_O.cs @@ -71,8 +71,9 @@ public void TearDown() public static void Main() { - OleDbCommandBuilder_DeriveParameters_O tc = - new OleDbCommandBuilder_DeriveParameters_O(); + OleDbCommandBuilder_DeriveParameters_O tc = new OleDbCommandBuilder_DeriveParameters_O( + + ); try { tc.BeginTest("OleDbCommandBuilder_DeriveParameters_O"); diff --git a/mono/mcs/class/System.Data/Test/System.Data.Tests.Mainsoft/System.Data/DataColumnCollection/DataColumnCollection_CollectionChanged.cs b/mono/mcs/class/System.Data/Test/System.Data.Tests.Mainsoft/System.Data/DataColumnCollection/DataColumnCollection_CollectionChanged.cs index 38e890feead..cfefb35ec1d 100644 --- a/mono/mcs/class/System.Data/Test/System.Data.Tests.Mainsoft/System.Data/DataColumnCollection/DataColumnCollection_CollectionChanged.cs +++ b/mono/mcs/class/System.Data/Test/System.Data.Tests.Mainsoft/System.Data/DataColumnCollection/DataColumnCollection_CollectionChanged.cs @@ -42,8 +42,9 @@ public class DataColumnCollection_CollectionChanged : GHTBase [Test] public void Main() { - DataColumnCollection_CollectionChanged tc = - new DataColumnCollection_CollectionChanged(); + DataColumnCollection_CollectionChanged tc = new DataColumnCollection_CollectionChanged( + + ); Exception exp = null; try { diff --git a/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpRequestHeaders.cs b/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpRequestHeaders.cs index fe3ed786203..696f5226ec3 100644 --- a/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpRequestHeaders.cs +++ b/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/HttpRequestHeaders.cs @@ -80,8 +80,8 @@ public bool? ConnectionClose { if ( connectionclose == true - || Connection.Find( - l => string.Equals(l, "close", StringComparison.OrdinalIgnoreCase) + || Connection.Find(l => + string.Equals(l, "close", StringComparison.OrdinalIgnoreCase) ) != null ) return true; @@ -105,8 +105,8 @@ internal bool ConnectionKeepAlive { get { - return Connection.Find( - l => string.Equals(l, "Keep-Alive", StringComparison.OrdinalIgnoreCase) + return Connection.Find(l => + string.Equals(l, "Keep-Alive", StringComparison.OrdinalIgnoreCase) ) != null; } } @@ -129,8 +129,8 @@ public bool? ExpectContinue if (expectContinue.HasValue) return expectContinue; - var found = TransferEncoding.Find( - l => string.Equals(l.Value, "100-continue", StringComparison.OrdinalIgnoreCase) + var found = TransferEncoding.Find(l => + string.Equals(l.Value, "100-continue", StringComparison.OrdinalIgnoreCase) ); return found != null ? true : (bool?)null; } @@ -245,8 +245,8 @@ public bool? TransferEncodingChunked if (transferEncodingChunked.HasValue) return transferEncodingChunked; - var found = TransferEncoding.Find( - l => string.Equals(l.Value, "chunked", StringComparison.OrdinalIgnoreCase) + var found = TransferEncoding.Find(l => + string.Equals(l.Value, "chunked", StringComparison.OrdinalIgnoreCase) ); return found != null ? true : (bool?)null; } diff --git a/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/QualityValue.cs b/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/QualityValue.cs index cf4f0d91397..c0b53a3b8de 100644 --- a/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/QualityValue.cs +++ b/mono/mcs/class/System.Net.Http/System.Net.Http.Headers/QualityValue.cs @@ -38,8 +38,8 @@ static class QualityValue if (parameters == null) return null; - var found = parameters.Find( - l => string.Equals(l.Name, "q", StringComparison.OrdinalIgnoreCase) + var found = parameters.Find(l => + string.Equals(l.Name, "q", StringComparison.OrdinalIgnoreCase) ); if (found == null) return null; diff --git a/mono/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractImporterTest.cs b/mono/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractImporterTest.cs index b60886cba54..ffcafc3a09e 100644 --- a/mono/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractImporterTest.cs +++ b/mono/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractImporterTest.cs @@ -910,8 +910,8 @@ private void CheckDataContractAttribute(CodeTypeDeclaration type, string msg) msg + "b" ); - var ca = l.FirstOrDefault( - a => a.Name == "System.Runtime.Serialization.DataContractAttribute" + var ca = l.FirstOrDefault(a => + a.Name == "System.Runtime.Serialization.DataContractAttribute" ); Assert.IsNotNull(ca, msg + "b"); Assert.AreEqual(2, ca.Arguments.Count, msg + "d"); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.Udp/UdpDuplexChannel.cs b/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.Udp/UdpDuplexChannel.cs index e704f28e077..ab1908236ac 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.Udp/UdpDuplexChannel.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.Udp/UdpDuplexChannel.cs @@ -310,11 +310,10 @@ protected override void OnOpen(TimeSpan timeout) var ip = IPAddress.Parse(LocalAddress.Uri.Host); bool isMulticast = NetworkInterface .GetAllNetworkInterfaces() - .Any( - nic => - nic.SupportsMulticast - && nic.GetIPProperties() - .MulticastAddresses.Any(mca => mca.Address.Equals(ip)) + .Any(nic => + nic.SupportsMulticast + && nic.GetIPProperties() + .MulticastAddresses.Any(mca => mca.Address.Equals(ip)) ); int port = LocalAddress.Uri.Port; if (isMulticast) diff --git a/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryService.cs b/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryService.cs index 16655435ecf..38fd2d48751 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryService.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryService.cs @@ -314,7 +314,9 @@ void IDiscoveryTargetContractApril2005.EndFind(IAsyncResult result) { OnEndFind(result); var cb = - OperationContext.Current.GetCallbackChannel(); + OperationContext.Current.GetCallbackChannel( + + ); cb.ReplyFind(CreateFindResponseApril2005()); } diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementClientTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementClientTest.cs index 23214cf6c7c..a2c4d6b7491 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementClientTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementClientTest.cs @@ -51,24 +51,18 @@ public void DefaultValues() ); Assert.AreEqual(2, ac.Endpoint.Contract.Operations.Count, "#2-2"); Assert.IsTrue( - ac.Endpoint.Contract.Operations.Any( - od => - od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello" - ) + ac.Endpoint.Contract.Operations.Any(od => + od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello" + ) ), "#2-3" ); Assert.IsTrue( - ac.Endpoint.Contract.Operations.Any( - od => - od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Bye" - ) + ac.Endpoint.Contract.Operations.Any(od => + od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Bye" + ) ), "#2-4" ); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementServiceTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementServiceTest.cs index e49cb956035..dfb40640a3d 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementServiceTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/AnnouncementServiceTest.cs @@ -57,22 +57,20 @@ public void ContractInterface() ) ); - var v11 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" + var v11 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" ); Assert.IsNotNull(v11, "v11"); Assert.AreEqual("CustomBinding_Client", v11.Name, "v11.Name"); - var v200504 = host.Description.Endpoints.FirstOrDefault( - ep => ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" + var v200504 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" ); Assert.IsNotNull(v200504, "v200504"); Assert.AreEqual("CustomBinding_Client", v200504.Name, "v200504.Name"); - var vCD1 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" + var vCD1 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" ); Assert.IsNotNull(vCD1, "vCD1"); Assert.AreEqual("CustomBinding_Client", vCD1.Name, "v11.Name"); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryEndpointTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryEndpointTest.cs index 51e55d906e0..c906ec2121d 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryEndpointTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryEndpointTest.cs @@ -54,31 +54,25 @@ public void DefaultValues() ); Assert.AreEqual("DiscoveryProxy", cd.Name, "#11-3"); Assert.AreEqual(2, cd.Operations.Count, "#11-4"); - var oper = cd.Operations.FirstOrDefault( - od => - !od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Probe" - ) + var oper = cd.Operations.FirstOrDefault(od => + !od.IsOneWay + && od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Probe" + ) ); Assert.IsNotNull(oper, "#11-5"); Assert.IsNotNull( - oper.Messages.Any( - md => md.Body.ReturnValue != null && md.Body.ReturnValue.Type == typeof(void) + oper.Messages.Any(md => + md.Body.ReturnValue != null && md.Body.ReturnValue.Type == typeof(void) ), "#11-5-2" ); // return type is void Assert.IsTrue( - cd.Operations.Any( - od => - !od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Resolve" - ) + cd.Operations.Any(od => + !od.IsOneWay + && od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Resolve" + ) ), "#11-6" ); @@ -109,62 +103,49 @@ public void AdhocDefaultValues() Assert.AreEqual("TargetService", cd.Name, "#11-3"); Assert.AreEqual(5, cd.Operations.Count, "#11-4"); Assert.IsTrue( - cd.Operations.Any( - od => - od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Probe" - ) + cd.Operations.Any(od => + od.IsOneWay + && od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Probe" + ) ), "#11-5" ); Assert.IsTrue( - cd.Operations.Any( - od => - od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Resolve" - ) + cd.Operations.Any(od => + od.IsOneWay + && od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Resolve" + ) ), "#11-6" ); Assert.IsTrue( - cd.Operations.Any( - od => - od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/ProbeMatches" - ) + cd.Operations.Any(od => + od.IsOneWay + && od.Messages.Any(md => + md.Action + == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/ProbeMatches" + ) ), "#11-7" ); Assert.IsTrue( - cd.Operations.Any( - od => - od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/ResolveMatches" - ) + cd.Operations.Any(od => + od.IsOneWay + && od.Messages.Any(md => + md.Action + == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/ResolveMatches" + ) ), "#11-8" ); Assert.IsTrue( - cd.Operations.Any( - od => - od.IsOneWay - && od.Messages.Any( - md => - md.Action - == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Hello" - ) + cd.Operations.Any(od => + od.IsOneWay + && od.Messages.Any(md => + md.Action == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09/Hello" + ) ), "#11-9" ); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryServiceTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryServiceTest.cs index 2afb8b6172d..54a56824479 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryServiceTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DiscoveryServiceTest.cs @@ -68,22 +68,20 @@ public void ContractInterfaceManaged() ) ); - var v11 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" + var v11 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" ); Assert.IsNotNull(v11, "v11"); Assert.AreEqual("BasicHttpBinding_DiscoveryProxy", v11.Name, "v11.Name"); - var v200504 = host.Description.Endpoints.FirstOrDefault( - ep => ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" + var v200504 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" ); Assert.IsNotNull(v200504, "v200504"); Assert.AreEqual("BasicHttpBinding_DiscoveryProxy", v200504.Name, "v200504.Name"); - var vCD1 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" + var vCD1 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" ); Assert.IsNotNull(vCD1, "vCD1"); Assert.AreEqual("BasicHttpBinding_DiscoveryProxy", vCD1.Name, "v11.Name"); @@ -108,22 +106,20 @@ public void ContractInterfaceAdhoc() ) ); - var v11 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" + var v11 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" ); Assert.IsNotNull(v11, "v11"); Assert.AreEqual("CustomBinding_TargetService", v11.Name, "v11.Name"); - var v200504 = host.Description.Endpoints.FirstOrDefault( - ep => ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" + var v200504 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://schemas.xmlsoap.org/ws/2005/04/discovery" ); Assert.IsNotNull(v200504, "v200504"); Assert.AreEqual("CustomBinding_TargetService", v200504.Name, "v200504.Name"); - var vCD1 = host.Description.Endpoints.FirstOrDefault( - ep => - ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" + var vCD1 = host.Description.Endpoints.FirstOrDefault(ep => + ep.Contract.Namespace == "http://docs.oasis-open.org/ws-dd/ns/discovery/2008/09" ); Assert.IsNotNull(vCD1, "vCD1"); Assert.AreEqual("CustomBinding_TargetService", vCD1.Name, "v11.Name"); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DynamicEndpointTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DynamicEndpointTest.cs index f482aca4742..0e65fd97506 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DynamicEndpointTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/DynamicEndpointTest.cs @@ -101,10 +101,8 @@ public void TestDiscoveryEndpoint(DiscoveryEndpoint de) TransportBindingElement tbe; Assert.IsTrue( de.Binding.CreateBindingElements() - .Any( - be => - (tbe = be as TransportBindingElement) != null - && tbe.Scheme == "soap.udp" + .Any(be => + (tbe = be as TransportBindingElement) != null && tbe.Scheme == "soap.udp" ), "#12-2" ); diff --git a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/UdpAnnouncementEndpointTest.cs b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/UdpAnnouncementEndpointTest.cs index 022f94bfc9b..78b3d0bdd32 100644 --- a/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/UdpAnnouncementEndpointTest.cs +++ b/mono/mcs/class/System.ServiceModel.Discovery/Test/System.ServiceModel.Discovery/UdpAnnouncementEndpointTest.cs @@ -56,10 +56,8 @@ public void DefaultValues() TransportBindingElement tbe = null; Assert.IsTrue( de.Binding.CreateBindingElements() - .Any( - be => - (tbe = be as TransportBindingElement) != null - && tbe.Scheme == "soap.udp" + .Any(be => + (tbe = be as TransportBindingElement) != null && tbe.Scheme == "soap.udp" ), "#12-2" ); diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManagerTable.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManagerTable.cs index 0f575e682bc..e8eedfbd6f4 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManagerTable.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManagerTable.cs @@ -119,8 +119,8 @@ public HttpListenerManager GetOrCreateManager(Uri uri, HttpTransportBindingEleme // Lastly, try to match the listener to the start of the current request path // This is to support WCF methods with path parameters in UriTemplate annotation m = listeners - .FirstOrDefault( - p => absolutePath.StartsWith(p.Key.AbsolutePath, StringComparison.Ordinal) + .FirstOrDefault(p => + absolutePath.StartsWith(p.Key.AbsolutePath, StringComparison.Ordinal) ) .Value; if (m != null) diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Security/SecurityDuplexSessionChannel.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Security/SecurityDuplexSessionChannel.cs index cf6b49f55ce..17960cd09ab 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Security/SecurityDuplexSessionChannel.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Security/SecurityDuplexSessionChannel.cs @@ -202,10 +202,9 @@ Message DecryptMessage(Message msg) security_initiator ).DecryptMessage(); // FIXME: supply SecurityMessageProperty (if any) else - return new RecipientSecureMessageDecryptor( - msg, - security_recipient - ).DecryptMessage(); + return new RecipientSecureMessageDecryptor(msg, security_recipient).DecryptMessage( + + ); } } } diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs index a2f9acc0a93..b12f837c392 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs @@ -307,12 +307,11 @@ Type serviceTypeForCallback foreach (var od in icd.Operations) { if ( - !cd.Operations.Any( - o => - o.Name == od.Name - && o.SyncMethod == od.SyncMethod - && o.BeginMethod == od.BeginMethod - && o.InCallbackContract == od.InCallbackContract + !cd.Operations.Any(o => + o.Name == od.Name + && o.SyncMethod == od.SyncMethod + && o.BeginMethod == od.BeginMethod + && o.InCallbackContract == od.InCallbackContract ) ) cd.Operations.Add(od); @@ -431,8 +430,8 @@ Type givenServiceType { string name = oca.Name ?? (oca.AsyncPattern ? mi.Name.Substring(5) : mi.Name); - OperationDescription od = cd.Operations.FirstOrDefault( - o => o.Name == name && o.InCallbackContract == isCallback + OperationDescription od = cd.Operations.FirstOrDefault(o => + o.Name == name && o.InCallbackContract == isCallback ); if (od == null) { @@ -585,11 +584,9 @@ static bool HasInvalidMessageContract(MethodInfo mi, bool async) { if ( pars.Take(pars.Length - 2) - .Any( - par => - par.ParameterType.GetCustomAttribute( - true - ) != null + .Any(par => + par.ParameterType.GetCustomAttribute(true) + != null ) ) return true; @@ -600,10 +597,9 @@ static bool HasInvalidMessageContract(MethodInfo mi, bool async) if (pars.Length > 1) { if ( - pars.Any( - par => - par.ParameterType.GetCustomAttribute(true) - != null + pars.Any(par => + par.ParameterType.GetCustomAttribute(true) + != null ) ) return true; diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessageDescription.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessageDescription.cs index be207cdc629..c525fb62de2 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessageDescription.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/MessageDescription.cs @@ -42,8 +42,9 @@ public class MessageDescription { string action; MessageDirection direction; - MessagePropertyDescriptionCollection properties = - new MessagePropertyDescriptionCollection(); + MessagePropertyDescriptionCollection properties = new MessagePropertyDescriptionCollection( + + ); MessageBodyDescription body = new MessageBodyDescription(); MessageHeaderDescriptionCollection headers = new MessageHeaderDescriptionCollection(); Type message_type; diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceContractGenerator.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceContractGenerator.cs index 94f4be1676c..cd2f3d8c27e 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceContractGenerator.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceContractGenerator.cs @@ -980,9 +980,9 @@ CodeNamespace cns thisExpr, cm.Name, inArgs - .ConvertAll( - decl => new CodeArgumentReferenceExpression(decl.Name) - ) + .ConvertAll(decl => new CodeArgumentReferenceExpression( + decl.Name + )) .ToArray() ); call.Parameters.Add(nullExpr); @@ -1072,9 +1072,9 @@ CodeNamespace cns new CodeArrayCreateExpression( typeof(object), inArgs - .ConvertAll( - decl => new CodeArgumentReferenceExpression(decl.Name) - ) + .ConvertAll(decl => new CodeArgumentReferenceExpression( + decl.Name + )) .ToArray() ) ); diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs index f9c40745368..1f2b7d04c29 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRealProxy.cs @@ -97,11 +97,10 @@ public override IMessage Invoke(IMessage inputMessage) IMessage DoInvoke(IMessage inputMessage) { var inmsg = (IMethodCallMessage)inputMessage; - var od = channel.Contract.Operations.FirstOrDefault( - o => - inmsg.MethodBase.Equals(o.SyncMethod) - || inmsg.MethodBase.Equals(o.BeginMethod) - || inmsg.MethodBase.Equals(o.EndMethod) + var od = channel.Contract.Operations.FirstOrDefault(o => + inmsg.MethodBase.Equals(o.SyncMethod) + || inmsg.MethodBase.Equals(o.BeginMethod) + || inmsg.MethodBase.Equals(o.EndMethod) ); if (od == null) { diff --git a/mono/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs b/mono/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs index 10de52f82aa..1a29dba9976 100644 --- a/mono/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs +++ b/mono/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs @@ -259,8 +259,8 @@ public virtual void AddServiceEndpoint(ServiceEndpoint endpoint) throw new ArgumentException("Binding on the argument endpoint is null"); if ( - !ImplementedContracts.Values.Any( - cd => cd.ContractType == endpoint.Contract.ContractType + !ImplementedContracts.Values.Any(cd => + cd.ContractType == endpoint.Contract.ContractType ) && endpoint.Binding.Namespace != "http://schemas.microsoft.com/ws/2005/02/mex/bindings" @@ -602,8 +602,8 @@ private void ValidateDescription() } if ( - Description.Endpoints.FirstOrDefault( - e => e.Contract != mex_contract && !e.IsSystemEndpoint + Description.Endpoints.FirstOrDefault(e => + e.Contract != mex_contract && !e.IsSystemEndpoint ) == null ) throw new InvalidOperationException( diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs index a72b6424102..05c2638c0c1 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs @@ -50,8 +50,9 @@ public void ExportPolicyDefault() PolicyConversionContext conversion_context = new CustomPolicyConversionContext(); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(2, binding_assertions.Count, "#A0"); Assert.AreEqual(0, binding_elements.Count, "#A1"); @@ -110,8 +111,9 @@ public void ExportPolicy() PolicyConversionContext conversion_context = new CustomPolicyConversionContext(); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(3, binding_assertions.Count, "#A0"); Assert.AreEqual(0, binding_elements.Count, "#A1"); @@ -188,8 +190,9 @@ public void ExportPolicy_CustomEncoding_Soap12() ); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(0, binding_assertions.Count, "#A0"); Assert.AreEqual(1, binding_elements.Count, "#A1"); @@ -207,8 +210,9 @@ public void ExportPolicy_CustomEncoding_Soap12August2004() ); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(1, binding_assertions.Count, "#A0"); Assert.AreEqual(1, binding_elements.Count, "#A1"); diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/HttpTransportBindingElementTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/HttpTransportBindingElementTest.cs index 60948a31b5b..11384e0a7ad 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Channels/HttpTransportBindingElementTest.cs @@ -198,10 +198,9 @@ public void BuildChannelFactory_CreateChannelNullVia() [ExpectedException(typeof(ArgumentException))] public void CreateChannelInvalidScheme() { - IChannelFactory f = - new BasicHttpBinding().BuildChannelFactory( - new BindingParameterCollection() - ); + IChannelFactory f = new BasicHttpBinding( + + ).BuildChannelFactory(new BindingParameterCollection()); f.Open(); f.CreateChannel(new EndpointAddress("stream:dummy")); } @@ -466,8 +465,9 @@ public void ExportPolicyDefault() PolicyConversionContext conversion_context = new CustomPolicyConversionContext(); binding_element.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(1, binding_assertions.Count, "#A0"); Assert.AreEqual(0, binding_elements.Count, "#A1"); @@ -526,8 +526,9 @@ public void ExportPolicy() PolicyConversionContext conversion_context = new CustomPolicyConversionContext(); binding_element.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(2, binding_assertions.Count, "#A0"); Assert.AreEqual(0, binding_elements.Count, "#A1"); @@ -605,8 +606,9 @@ public void ExportPolicy_CustomEncoding_Soap12() ); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(0, binding_assertions.Count, "#A0"); Assert.AreEqual(1, binding_elements.Count, "#A1"); @@ -623,8 +625,9 @@ public void ExportPolicy_CustomEncoding_Soap12August2004() ); export_extension.ExportPolicy(new WsdlExporter(), conversion_context); - PolicyAssertionCollection binding_assertions = - conversion_context.GetBindingAssertions(); + PolicyAssertionCollection binding_assertions = conversion_context.GetBindingAssertions( + + ); BindingElementCollection binding_elements = conversion_context.BindingElements; Assert.AreEqual(1, binding_assertions.Count, "#A0"); Assert.AreEqual(1, binding_elements.Count, "#A1"); diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs index 580b528fc4b..7f588bc2026 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs @@ -50,8 +50,8 @@ public void ServiceMetadataExists() Assert.IsNotNull( StandardEndpointsSection .GetSection(cfg) - .EndpointCollections.FirstOrDefault( - e => e is ServiceMetadataEndpointCollectionElement + .EndpointCollections.FirstOrDefault(e => + e is ServiceMetadataEndpointCollectionElement ), "#1" ); diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs index f258eeb2f3c..df3c3acb0e7 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs @@ -622,24 +622,22 @@ public void InheritedContractAndNamespaces() { var cd = ContractDescription.GetContract(typeof(IService)); Assert.IsTrue( - cd.Operations.Any( - od => od.Messages.Any(md => md.Action == "http://tempuri.org/IServiceBase/Say") + cd.Operations.Any(od => + od.Messages.Any(md => md.Action == "http://tempuri.org/IServiceBase/Say") ), "#1" ); // inherited Assert.IsTrue( - cd.Operations.Any( - od => - od.SyncMethod == typeof(IService).GetMethod("Join") - && od.Messages.Any(md => md.Action == "http://tempuri.org/IService/Join") + cd.Operations.Any(od => + od.SyncMethod == typeof(IService).GetMethod("Join") + && od.Messages.Any(md => md.Action == "http://tempuri.org/IService/Join") ), "#2" ); // self Assert.IsTrue( - cd.Operations.Any( - od => - od.SyncMethod == typeof(IService2).GetMethod("Join") - && od.Messages.Any(md => md.Action == "http://tempuri.org/IService/Join") + cd.Operations.Any(od => + od.SyncMethod == typeof(IService2).GetMethod("Join") + && od.Messages.Any(md => md.Action == "http://tempuri.org/IService/Join") ), "#3" ); // callback @@ -672,28 +670,26 @@ public void InheritingDuplexContract() Assert.AreSame(typeof(IDerivedDuplexContract), cd.ContractType, "#2"); Assert.AreSame(typeof(IDerivedDuplexCallback), cd.CallbackContractType, "#3"); Assert.IsTrue( - cd.Operations.Any( - od => od.SyncMethod == typeof(IBaseDuplexCallback).GetMethod("CallbackMethod") + cd.Operations.Any(od => + od.SyncMethod == typeof(IBaseDuplexCallback).GetMethod("CallbackMethod") ), "#4" ); Assert.IsTrue( - cd.Operations.Any( - od => - od.SyncMethod - == typeof(IDerivedDuplexCallback).GetMethod("CallbackSomething") + cd.Operations.Any(od => + od.SyncMethod == typeof(IDerivedDuplexCallback).GetMethod("CallbackSomething") ), "#5" ); Assert.IsTrue( - cd.Operations.Any( - od => od.SyncMethod == typeof(IBaseDuplexContract).GetMethod("ContractMethod") + cd.Operations.Any(od => + od.SyncMethod == typeof(IBaseDuplexContract).GetMethod("ContractMethod") ), "#6" ); Assert.IsTrue( - cd.Operations.Any( - od => od.SyncMethod == typeof(IDerivedDuplexContract).GetMethod("Something") + cd.Operations.Any(od => + od.SyncMethod == typeof(IDerivedDuplexContract).GetMethod("Something") ), "#7" ); @@ -708,17 +704,16 @@ public void SymmetricInheritingContract() Assert.AreSame(typeof(ISymmetricInheritance), cd.CallbackContractType, "#3"); Assert.AreEqual( 2, - cd.Operations.Count( - od => - od.SyncMethod - == typeof(IAsyncContractWithSymmetricCallbackContract).GetMethod("Foo") + cd.Operations.Count(od => + od.SyncMethod + == typeof(IAsyncContractWithSymmetricCallbackContract).GetMethod("Foo") ), "#4" ); Assert.AreEqual( 2, - cd.Operations.Count( - od => od.SyncMethod == typeof(ISymmetricInheritance).GetMethod("Bar") + cd.Operations.Count(od => + od.SyncMethod == typeof(ISymmetricInheritance).GetMethod("Bar") ), "#5" ); diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/MetadataSetTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/MetadataSetTest.cs index 4b024b57114..3f2245176ac 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/MetadataSetTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/MetadataSetTest.cs @@ -60,8 +60,8 @@ public void ReadFrom() Assert.AreEqual( 2, metadata - .MetadataSections.Where( - m => m.Dialect == MetadataSection.ServiceDescriptionDialect + .MetadataSections.Where(m => + m.Dialect == MetadataSection.ServiceDescriptionDialect ) .Count(), "#2" diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceCredentialsTest.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceCredentialsTest.cs index c06cca51b10..4b79c58f357 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceCredentialsTest.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ServiceCredentialsTest.cs @@ -47,8 +47,9 @@ public class ServiceCredentialsTest [Test] public void ClientCertificate() { - X509CertificateInitiatorServiceCredential cc = - new ServiceCredentials().ClientCertificate; + X509CertificateInitiatorServiceCredential cc = new ServiceCredentials( + + ).ClientCertificate; Assert.IsNull(cc.Certificate, "#1"); Assert.AreEqual( X509CertificateValidationMode.ChainTrust, @@ -112,8 +113,9 @@ public void Peer() [Test] public void SecureConversationAuthentication() { - SecureConversationServiceCredential sc = - new ServiceCredentials().SecureConversationAuthentication; + SecureConversationServiceCredential sc = new ServiceCredentials( + + ).SecureConversationAuthentication; Assert.AreEqual(5, sc.SecurityContextClaimTypes.Count, "#1"); Collection types = new Collection( new Type[] diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug32886Test.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug32886Test.cs index 1ba9fd84a38..dd190051b03 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug32886Test.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug32886Test.cs @@ -519,7 +519,9 @@ public System.Net.CookieContainer CookieContainer get { System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = - this.InnerChannel.GetProperty(); + this.InnerChannel.GetProperty( + + ); if ((httpCookieContainerManager != null)) { return httpCookieContainerManager.CookieContainer; @@ -532,7 +534,9 @@ public System.Net.CookieContainer CookieContainer set { System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = - this.InnerChannel.GetProperty(); + this.InnerChannel.GetProperty( + + ); if ((httpCookieContainerManager != null)) { httpCookieContainerManager.CookieContainer = value; diff --git a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel/Bug36080Test.cs b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel/Bug36080Test.cs index 30834abdd28..400247d4f57 100644 --- a/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel/Bug36080Test.cs +++ b/mono/mcs/class/System.ServiceModel/Test/System.ServiceModel/Bug36080Test.cs @@ -335,7 +335,9 @@ public System.Net.CookieContainer CookieContainer get { System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = - this.InnerChannel.GetProperty(); + this.InnerChannel.GetProperty( + + ); if ((httpCookieContainerManager != null)) { return httpCookieContainerManager.CookieContainer; @@ -348,7 +350,9 @@ public System.Net.CookieContainer CookieContainer set { System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = - this.InnerChannel.GetProperty(); + this.InnerChannel.GetProperty( + + ); if ((httpCookieContainerManager != null)) { httpCookieContainerManager.CookieContainer = value; diff --git a/mono/mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/OptionsTest.cs b/mono/mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/OptionsTest.cs index 8d4c1d20ac9..6eeecfb7f85 100644 --- a/mono/mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/OptionsTest.cs +++ b/mono/mcs/class/System.Threading.Tasks.Dataflow/Test/System.Threading.Tasks.Dataflow/OptionsTest.cs @@ -74,29 +74,26 @@ ExecutionDataflowBlockOptions options { var blockFactories = new Func>, ITargetBlock>[] { - q => - new ActionBlock( - i => q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)), - options - ), - q => - new TransformBlock( - i => - { - q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)); - return i; - }, - options - ), - q => - new TransformManyBlock( - i => - { - q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)); - return new[] { i }; - }, - options - ) + q => new ActionBlock( + i => q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)), + options + ), + q => new TransformBlock( + i => + { + q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)); + return i; + }, + options + ), + q => new TransformManyBlock( + i => + { + q.Enqueue(Tuple.Create(i, Task.CurrentId.Value)); + return new[] { i }; + }, + options + ) }; foreach (var factory in blockFactories) @@ -250,8 +247,8 @@ public void DefaultSchedulerIsDefaultTest() { Assert.AreEqual(scheduler, TaskScheduler.Current); - action = new ActionBlock( - i => Assert.AreNotEqual(scheduler, TaskScheduler.Current) + action = new ActionBlock(i => + Assert.AreNotEqual(scheduler, TaskScheduler.Current) ); Assert.IsTrue(action.Post(1)); action.Complete(); diff --git a/mono/mcs/class/System.Web.Mvc3/Mvc/Async/ReflectedAsyncActionDescriptor.cs b/mono/mcs/class/System.Web.Mvc3/Mvc/Async/ReflectedAsyncActionDescriptor.cs index 9e8f503570d..efe0e76587c 100644 --- a/mono/mcs/class/System.Web.Mvc3/Mvc/Async/ReflectedAsyncActionDescriptor.cs +++ b/mono/mcs/class/System.Web.Mvc3/Mvc/Async/ReflectedAsyncActionDescriptor.cs @@ -143,13 +143,12 @@ select ExtractParameterFromDictionary( // to simplify the logic, force the rest of the pipeline to execute in an asynchronous callback listener.SetContinuation( () => - ThreadPool.QueueUserWorkItem( - _ => - asyncResult.MarkCompleted( - false /* completedSynchronously */ - , - asyncCallback - ) + ThreadPool.QueueUserWorkItem(_ => + asyncResult.MarkCompleted( + false /* completedSynchronously */ + , + asyncCallback + ) ) ); diff --git a/mono/mcs/class/System.Web.Mvc3/Mvc/DefaultModelBinder.cs b/mono/mcs/class/System.Web.Mvc3/Mvc/DefaultModelBinder.cs index 475186390d9..947cb56608c 100644 --- a/mono/mcs/class/System.Web.Mvc3/Mvc/DefaultModelBinder.cs +++ b/mono/mcs/class/System.Web.Mvc3/Mvc/DefaultModelBinder.cs @@ -350,8 +350,8 @@ PropertyDescriptor propertyDescriptor // Convert FormatExceptions (type conversion failures) into InvalidValue messages foreach ( ModelError error in modelState - .Errors.Where( - err => String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null + .Errors.Where(err => + String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null ) .ToList() ) diff --git a/mono/mcs/class/System.Web.Mvc3/Mvc/Html/DefaultEditorTemplates.cs b/mono/mcs/class/System.Web.Mvc3/Mvc/Html/DefaultEditorTemplates.cs index 43d5ae89ce3..867c4dd17ec 100644 --- a/mono/mcs/class/System.Web.Mvc3/Mvc/Html/DefaultEditorTemplates.cs +++ b/mono/mcs/class/System.Web.Mvc3/Mvc/Html/DefaultEditorTemplates.cs @@ -225,8 +225,8 @@ TemplateHelpers.TemplateHelperDelegate templateHelper } foreach ( - ModelMetadata propertyMetadata in modelMetadata.Properties.Where( - pm => ShouldShow(pm, templateInfo) + ModelMetadata propertyMetadata in modelMetadata.Properties.Where(pm => + ShouldShow(pm, templateInfo) ) ) { diff --git a/mono/mcs/class/System.Web.Mvc3/Mvc/Html/ValidationExtensions.cs b/mono/mcs/class/System.Web.Mvc3/Mvc/Html/ValidationExtensions.cs index 0e58873d801..a32aff84978 100644 --- a/mono/mcs/class/System.Web.Mvc3/Mvc/Html/ValidationExtensions.cs +++ b/mono/mcs/class/System.Web.Mvc3/Mvc/Html/ValidationExtensions.cs @@ -40,8 +40,8 @@ string modelName htmlHelper.ViewContext ); foreach ( - ModelClientValidationRule rule in validators.SelectMany( - v => v.GetClientValidationRules() + ModelClientValidationRule rule in validators.SelectMany(v => + v.GetClientValidationRules() ) ) { diff --git a/mono/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs b/mono/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs index 348ad99f325..01d3ca86a57 100644 --- a/mono/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs +++ b/mono/mcs/class/System.Web.Services/System.Web.Services.Discovery/DiscoveryClientProtocol.cs @@ -48,8 +48,9 @@ public class DiscoveryClientProtocol : HttpWebClientProtocol #region Fields private IList additionalInformation = new ArrayList(); - private DiscoveryClientDocumentCollection documents = - new DiscoveryClientDocumentCollection(); + private DiscoveryClientDocumentCollection documents = new DiscoveryClientDocumentCollection( + + ); private DiscoveryExceptionDictionary errors = new DiscoveryExceptionDictionary(); private DiscoveryClientReferenceCollection references = new DiscoveryClientReferenceCollection(); diff --git a/mono/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs b/mono/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs index a70276f56ee..d24f404d375 100644 --- a/mono/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs +++ b/mono/mcs/class/System.Web/System.Web.Compilation/AppCodeCompiler.cs @@ -552,8 +552,9 @@ ProfilePropertySettings pset property.Type = GetProfilePropertyType(typeName); property.Attributes = MemberAttributes.Public; - CodeAttributeDeclarationCollection collection = - new CodeAttributeDeclarationCollection(); + CodeAttributeDeclarationCollection collection = new CodeAttributeDeclarationCollection( + + ); GetProfileProviderAttribute(ps, collection, pset.Provider); GetProfileSettingsSerializeAsAttribute(ps, collection, pset.SerializeAs); diff --git a/mono/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mono/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs index 3001333ffa6..5d1219bf519 100644 --- a/mono/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs +++ b/mono/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs @@ -173,10 +173,9 @@ public override string GetAppPathTranslated() && (app_physical_dir.Length > 0) ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - app_physical_dir - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, app_physical_dir).Demand( + + ); } return app_physical_dir; } diff --git a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs index 563f04a58c8..e7bea298dbb 100644 --- a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs +++ b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/GridViewTest.cs @@ -1721,9 +1721,9 @@ public void GridView_Render() [Test] public void GridView_RenderAllowPaging() { - string RenderedPageHtml = new WebTest( - PageInvoker.CreateOnLoad(RenderAllowPaging) - ).Run(); + string RenderedPageHtml = new WebTest(PageInvoker.CreateOnLoad(RenderAllowPaging)).Run( + + ); string RenderedControlHtml = HtmlDiff.GetControlFromPageHtml(RenderedPageHtml); string OriginControlHtml = "
\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t
Item
Norway
Sweden
\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
12
\r\n
"; @@ -1753,9 +1753,9 @@ public static void RenderAllowPaging(Page p) [Category("NunitWeb")] public void GridView_RenderAllowPaging2() { - string RenderedPageHtml = new WebTest( - PageInvoker.CreateOnLoad(RenderAllowPaging2) - ).Run(); + string RenderedPageHtml = new WebTest(PageInvoker.CreateOnLoad(RenderAllowPaging2)).Run( + + ); string RenderedControlHtml = HtmlDiff.GetControlFromPageHtml(RenderedPageHtml); string OriginControlHtml = "
\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t
Item
France
Italy
\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
1234...>>
\r\n
"; diff --git a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/ObjectDataSourceTest.cs b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/ObjectDataSourceTest.cs index b08408161cc..cba1667127e 100644 --- a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/ObjectDataSourceTest.cs +++ b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/ObjectDataSourceTest.cs @@ -484,9 +484,9 @@ public static void FilterParameter(Page p) [Category("NunitWeb")] public void ObjectDataSource_EnablePaging() { - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(EnablePaging)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(EnablePaging))).Run( + + ); string newHtml = HtmlDiff.GetControlFromPageHtml(html); string origHtml = "
\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t
NameNumber
Number00
Number11
Number22
Number33
Number44
\r\n\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
1234
\r\n
"; @@ -522,9 +522,9 @@ public static void EnablePaging(Page p) [Category("NunitWeb")] public void ObjectDataSource_Delete() { - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(DeleteMethod)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(DeleteMethod))).Run( + + ); string newHtml = HtmlDiff.GetControlFromPageHtml(html); string origHtml = "
\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t\t\t\r\n\t\t\r\n\t
ID1002
FNameMelanie
LNameTalmadge
\r\n
"; @@ -567,9 +567,9 @@ public static void DeleteMethod(Page p) [Category("NunitWeb")] public void ObjectDataSource_Select() { - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(SelectMethod)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(SelectMethod))).Run( + + ); } public static void SelectMethod(Page p) @@ -622,9 +622,9 @@ public static void SelectMethodCached(Page p) [Category("NunitWeb")] public void ObjectDataSource_Insert() { - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(InsertMethod)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(InsertMethod))).Run( + + ); } public static void InsertMethod(Page p) @@ -650,9 +650,9 @@ public static void InsertMethod(Page p) [Category("NunitWeb")] public void ObjectDataSource_Update() { - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(UpdateMethod)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(UpdateMethod))).Run( + + ); } public static void UpdateMethod(Page p) diff --git a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/SiteMapPathTest.cs b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/SiteMapPathTest.cs index 43a215157f3..247cf05423c 100644 --- a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/SiteMapPathTest.cs +++ b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/SiteMapPathTest.cs @@ -228,9 +228,9 @@ public void SiteMapPath_RenderProperty() [Category("NunitWeb")] public void SiteMapPath_RenderStyles() { - string RenderedPageHtml = new WebTest( - PageInvoker.CreateOnLoad(DoTestStylesRender) - ).Run(); + string RenderedPageHtml = new WebTest(PageInvoker.CreateOnLoad(DoTestStylesRender)).Run( + + ); string RenderedControlHtml = HtmlDiff.GetControlFromPageHtml(RenderedPageHtml); string OriginControlHtml = "\"Skiproot > node1"; diff --git a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardStepBaseTest.cs b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardStepBaseTest.cs index 079f893eb2b..0334db30f20 100644 --- a/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardStepBaseTest.cs +++ b/mono/mcs/class/System.Web/Test/System.Web.UI.WebControls/WizardStepBaseTest.cs @@ -209,9 +209,9 @@ public void WizardStepBase_ID() public void WizardStepBase_RenderTest() { // This render test include Title property test - string html = new WebTest( - PageInvoker.CreateOnLoad(new PageDelegate(Render_Test)) - ).Run(); + string html = new WebTest(PageInvoker.CreateOnLoad(new PageDelegate(Render_Test))).Run( + + ); string origin = "\r\n\t\r\n\t\t\r\n\t\r\n
\"Skip\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t
my_title
my_title_2
\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t
123
\r\n\t\t\t\t\t\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\r\n\t\t\t\t
"; string renderedHtml = HtmlDiff.GetControlFromPageHtml(html); diff --git a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_AddAt_IT.aspx.cs b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_AddAt_IT.aspx.cs index a587cc8f4a5..a29cbad9533 100644 --- a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_AddAt_IT.aspx.cs +++ b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_AddAt_IT.aspx.cs @@ -79,8 +79,9 @@ private void Page_Load(object sender, System.EventArgs e) // add new cell tbl1.Rows.AddAt(0, new System.Web.UI.WebControls.TableRow()); tbl.Rows.AddAt(0, new System.Web.UI.WebControls.TableRow()); - System.Web.UI.WebControls.TableRow tblRow = - new System.Web.UI.WebControls.TableRow(); + System.Web.UI.WebControls.TableRow tblRow = new System.Web.UI.WebControls.TableRow( + + ); tbl.Rows.AddAt(1, tblRow); // add cell from one table to another diff --git a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_Add_T.aspx.cs b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_Add_T.aspx.cs index 9c45701baa4..2f0a76574c3 100644 --- a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_Add_T.aspx.cs +++ b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableRowCollection/TableRowCollection_Add_T.aspx.cs @@ -76,8 +76,9 @@ private void Page_Load(object sender, System.EventArgs e) //add new row tbl1.Rows.Add(new System.Web.UI.WebControls.TableRow()); tbl.Rows.Add(new System.Web.UI.WebControls.TableRow()); - System.Web.UI.WebControls.TableRow tblRow = - new System.Web.UI.WebControls.TableRow(); + System.Web.UI.WebControls.TableRow tblRow = new System.Web.UI.WebControls.TableRow( + + ); tbl.Rows.Add(tblRow); //add row from one table to another tbl.Rows.Add(tbl1.Rows[0]); diff --git a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_BackImageUrl.aspx.cs b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_BackImageUrl.aspx.cs index 33b6a2ac20d..37069ecc284 100644 --- a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_BackImageUrl.aspx.cs +++ b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_BackImageUrl.aspx.cs @@ -64,8 +64,9 @@ private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); - System.Web.UI.WebControls.TableStyle myStyle = - new System.Web.UI.WebControls.TableStyle(); + System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle( + + ); try { base.GHTSubTestBegin("TableStyle - BackImageUrl"); diff --git a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_CellSpacing.aspx.cs b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_CellSpacing.aspx.cs index 022d3b5a04c..9be5cfa9c2e 100644 --- a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_CellSpacing.aspx.cs +++ b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_CellSpacing.aspx.cs @@ -68,8 +68,9 @@ private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); - System.Web.UI.WebControls.TableStyle myStyle = - new System.Web.UI.WebControls.TableStyle(); + System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle( + + ); try { base.GHTActiveSubTest = GHTSubTest1; diff --git a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_GridLines.aspx.cs b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_GridLines.aspx.cs index 4cbf533b4b2..448996ac8ef 100644 --- a/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_GridLines.aspx.cs +++ b/mono/mcs/class/System.Web/Test/mainsoft/MainsoftWebApp/System_Web_UI_WebControls/TableStyle/TableStyle_GridLines.aspx.cs @@ -70,8 +70,9 @@ private void Page_Load(object sender, System.EventArgs e) { //Put user code to initialize the page here base.GHTTestBegin((HtmlForm)this.FindControl("Form1")); - System.Web.UI.WebControls.TableStyle myStyle = - new System.Web.UI.WebControls.TableStyle(); + System.Web.UI.WebControls.TableStyle myStyle = new System.Web.UI.WebControls.TableStyle( + + ); try { myStyle.GridLines = GridLines.None; diff --git a/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnHeaderTest.cs b/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnHeaderTest.cs index b393b6294a2..d3437ebeb0d 100644 --- a/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnHeaderTest.cs +++ b/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnHeaderTest.cs @@ -41,8 +41,9 @@ public class DataGridViewColumnHeaderTest : TestHelper [ExpectedException(typeof(ArgumentOutOfRangeException))] public void GetClipboardContentTestException() { - DataGridViewColumnHeaderClipboardCell cell = - new DataGridViewColumnHeaderClipboardCell(); + DataGridViewColumnHeaderClipboardCell cell = new DataGridViewColumnHeaderClipboardCell( + + ); using (DataGridView dgv = new DataGridView()) { diff --git a/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs b/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs index be3ded0ce37..bde7164e902 100644 --- a/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs +++ b/mono/mcs/class/System.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs @@ -288,8 +288,9 @@ DataGridViewSelectionMode selectionmode in Enum.GetValues( continue; using ( - DataGridView dgv = - DataGridViewCommon.CreateAndFillForClipboard() + DataGridView dgv = DataGridViewCommon.CreateAndFillForClipboard( + + ) ) { dgv.SelectionMode = selectionmode; diff --git a/mono/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaLengthFacetTests.cs b/mono/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaLengthFacetTests.cs index 9a19418b509..a314fd8f186 100644 --- a/mono/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaLengthFacetTests.cs +++ b/mono/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaLengthFacetTests.cs @@ -55,8 +55,9 @@ bool expected XmlSchemaSimpleType testType = new XmlSchemaSimpleType(); testType.Name = "TestType"; - XmlSchemaSimpleTypeRestriction testTypeRestriction = - new XmlSchemaSimpleTypeRestriction(); + XmlSchemaSimpleTypeRestriction testTypeRestriction = new XmlSchemaSimpleTypeRestriction( + + ); testTypeRestriction.BaseTypeName = new XmlQualifiedName( "string", "http://www.w3.org/2001/XMLSchema" diff --git a/mono/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs b/mono/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs index 8ccc8574a1c..0ec4dc474ae 100644 --- a/mono/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs +++ b/mono/mcs/class/System.Xaml/System.Xaml/TypeExtensionMethods.cs @@ -268,11 +268,10 @@ IValueSerializerContext vsctx public static IEnumerable GetConstructorArguments(this XamlType type) { return type.GetAllMembers() - .Where( - m => - m.UnderlyingMember != null - && m.GetCustomAttributeProvider() - .GetCustomAttribute(false) != null + .Where(m => + m.UnderlyingMember != null + && m.GetCustomAttributeProvider() + .GetCustomAttribute(false) != null ); } @@ -294,8 +293,8 @@ var ci in type.UnderlyingType.GetConstructors() mismatch = true; if (mismatch) continue; - return args.OrderBy( - c => pis.FindParameterWithName(c.ConstructorArgumentName()).Position + return args.OrderBy(c => + pis.FindParameterWithName(c.ConstructorArgumentName()).Position ); } return null; diff --git a/mono/mcs/class/System.Xaml/System.Xaml/XamlObjectWriter.cs b/mono/mcs/class/System.Xaml/System.Xaml/XamlObjectWriter.cs index 2ba15c6def1..e907d8deff4 100644 --- a/mono/mcs/class/System.Xaml/System.Xaml/XamlObjectWriter.cs +++ b/mono/mcs/class/System.Xaml/System.Xaml/XamlObjectWriter.cs @@ -400,10 +400,9 @@ protected override void OnWriteEndMember() var contents = (List)state.Value; var mi = state .Type.UnderlyingType.GetMethods(static_flags) - .FirstOrDefault( - mii => - mii.Name == state.FactoryMethod - && mii.GetParameters().Length == contents.Count + .FirstOrDefault(mii => + mii.Name == state.FactoryMethod + && mii.GetParameters().Length == contents.Count ); if (mi == null) throw new XamlObjectWriterException( diff --git a/mono/mcs/class/System.Xaml/System.Xaml/XamlSchemaContext.cs b/mono/mcs/class/System.Xaml/System.Xaml/XamlSchemaContext.cs index d20cad86410..1bfa51918a9 100644 --- a/mono/mcs/class/System.Xaml/System.Xaml/XamlSchemaContext.cs +++ b/mono/mcs/class/System.Xaml/System.Xaml/XamlSchemaContext.cs @@ -222,14 +222,14 @@ params XamlType[] typeArguments { ret = XamlLanguage.SpecialNames.Find(name, xamlNamespace); if (ret == null) - ret = XamlLanguage.AllTypes.FirstOrDefault( - t => TypeMatches(t, xamlNamespace, name, typeArguments) + ret = XamlLanguage.AllTypes.FirstOrDefault(t => + TypeMatches(t, xamlNamespace, name, typeArguments) ); if (ret != null) return ret; } - ret = run_time_types.FirstOrDefault( - t => TypeMatches(t, xamlNamespace, name, typeArguments) + ret = run_time_types.FirstOrDefault(t => + TypeMatches(t, xamlNamespace, name, typeArguments) ); if (ret == null) ret = GetAllXamlTypes(xamlNamespace) diff --git a/mono/mcs/class/System.Xaml/System.Xaml/XamlXmlReader.cs b/mono/mcs/class/System.Xaml/System.Xaml/XamlXmlReader.cs index 7736feae83b..5469c2afe6d 100644 --- a/mono/mcs/class/System.Xaml/System.Xaml/XamlXmlReader.cs +++ b/mono/mcs/class/System.Xaml/System.Xaml/XamlXmlReader.cs @@ -328,8 +328,8 @@ XamlMember currentMember sti.Name, sti.TypeName.TypeArguments == null ? null - : sti.TypeName.TypeArguments.Select( - xxtn => sctx.GetXamlType(xxtn) + : sti.TypeName.TypeArguments.Select(xxtn => + sctx.GetXamlType(xxtn) ) .ToArray(), sctx @@ -587,8 +587,8 @@ XamlMember GetExtraMember(XamlType xt) static XamlDirective FindStandardDirective(string name, AllowedMemberLocations loc) { - return XamlLanguage.AllDirectives.FirstOrDefault( - dd => (dd.AllowedLocation & loc) != 0 && dd.Name == name + return XamlLanguage.AllDirectives.FirstOrDefault(dd => + (dd.AllowedLocation & loc) != 0 && dd.Name == name ); } diff --git a/mono/mcs/class/System/System.Configuration/ConfigXmlDocument.cs b/mono/mcs/class/System/System.Configuration/ConfigXmlDocument.cs index 36b1f5f3b52..e7543de0781 100644 --- a/mono/mcs/class/System/System.Configuration/ConfigXmlDocument.cs +++ b/mono/mcs/class/System/System.Configuration/ConfigXmlDocument.cs @@ -190,10 +190,9 @@ public string Filename && SecurityManager.SecurityEnabled ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - fileName - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, fileName).Demand( + + ); } return fileName; } @@ -230,10 +229,9 @@ public string Filename && SecurityManager.SecurityEnabled ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - fileName - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, fileName).Demand( + + ); } return fileName; } @@ -267,10 +265,9 @@ public string Filename && SecurityManager.SecurityEnabled ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - fileName - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, fileName).Demand( + + ); } return fileName; } @@ -312,10 +309,9 @@ public string Filename && SecurityManager.SecurityEnabled ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - fileName - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, fileName).Demand( + + ); } return fileName; } @@ -352,10 +348,9 @@ public string Filename && SecurityManager.SecurityEnabled ) { - new FileIOPermission( - FileIOPermissionAccess.PathDiscovery, - fileName - ).Demand(); + new FileIOPermission(FileIOPermissionAccess.PathDiscovery, fileName).Demand( + + ); } return fileName; } diff --git a/mono/mcs/class/System/Test/System/UriTest.cs b/mono/mcs/class/System/Test/System/UriTest.cs index 44795e115e8..0395a1ff1c1 100644 --- a/mono/mcs/class/System/Test/System/UriTest.cs +++ b/mono/mcs/class/System/Test/System/UriTest.cs @@ -1374,10 +1374,9 @@ public void RelativeFragmentUri2() { Assert.AreEqual( "file:///d:/myhost/ext", - new Uri( - new Uri("file:///c:/localhost/bar"), - "file:///d:/myhost/ext" - ).ToString(), + new Uri(new Uri("file:///c:/localhost/bar"), "file:///d:/myhost/ext").ToString( + + ), "#2-w" ); Assert.AreEqual( diff --git a/mono/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs b/mono/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs index 0b1fa3939d8..9793cf0dec5 100644 --- a/mono/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs +++ b/mono/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs @@ -1070,9 +1070,8 @@ static void EnsureMethodExists(Type type, string name, params Type[] parameterTy { var method = type.GetTypeInfo() .GetDeclaredMethods(name) - .SingleOrDefault( - m => - m.GetParameters().Select(p => p.ParameterType).SequenceEqual(parameterTypes) + .SingleOrDefault(m => + m.GetParameters().Select(p => p.ParameterType).SequenceEqual(parameterTypes) ); Assert.IsNotNull(method, $"{type}.{name}"); } diff --git a/mono/mcs/class/corlib/Test/System.Security.Claims/ClaimsPrincipalTest.cs b/mono/mcs/class/corlib/Test/System.Security.Claims/ClaimsPrincipalTest.cs index 561d8461efb..ecf722c24aa 100644 --- a/mono/mcs/class/corlib/Test/System.Security.Claims/ClaimsPrincipalTest.cs +++ b/mono/mcs/class/corlib/Test/System.Security.Claims/ClaimsPrincipalTest.cs @@ -82,10 +82,8 @@ public void IIdentityCtorNonClaimsIdentityWorks() Assert.IsNotNull(p.Claims, "#6"); Assert.AreEqual(1, p.Claims.Count(), "#7"); Assert.IsTrue( - p.Claims.Any( - claim => - claim.Type == ClaimsIdentity.DefaultNameClaimType - && claim.Value == "test_name" + p.Claims.Any(claim => + claim.Type == ClaimsIdentity.DefaultNameClaimType && claim.Value == "test_name" ), "#8" ); @@ -146,10 +144,8 @@ public void IPrincipalCtorNonClaimsPrincipalWithNonClaimsIdentityWorks() Assert.IsNotNull(p.Claims, "#6"); Assert.AreEqual(1, p.Claims.Count(), "#7"); Assert.IsTrue( - p.Claims.Any( - claim => - claim.Type == ClaimsIdentity.DefaultNameClaimType - && claim.Value == "test_name" + p.Claims.Any(claim => + claim.Type == ClaimsIdentity.DefaultNameClaimType && claim.Value == "test_name" ), "#8" ); @@ -205,10 +201,9 @@ public void IPrincipalCtorClaimsPrincipalWithMultipleIdentitiesWorks() Assert.AreEqual(baseId3, p.Identity, "#5"); Assert.IsTrue( - p.Claims.Any( - claim => - claim.Type == ClaimsIdentity.DefaultNameClaimType - && claim.Value == "generic_name" + p.Claims.Any(claim => + claim.Type == ClaimsIdentity.DefaultNameClaimType + && claim.Value == "generic_name" ), "#6" ); @@ -255,18 +250,16 @@ public void IEnumClaimsIdCtorMultipleIdentitiesWorks() Assert.AreEqual(baseId1, p.Identity, "#5"); Assert.IsTrue( - p.Claims.Any( - claim => - claim.Type == ClaimsIdentity.DefaultNameClaimType - && claim.Value == "generic_name2" + p.Claims.Any(claim => + claim.Type == ClaimsIdentity.DefaultNameClaimType + && claim.Value == "generic_name2" ), "#6" ); Assert.IsTrue( - p.Claims.Any( - claim => - claim.Type == ClaimsIdentity.DefaultNameClaimType - && claim.Value == "generic_name3" + p.Claims.Any(claim => + claim.Type == ClaimsIdentity.DefaultNameClaimType + && claim.Value == "generic_name3" ), "#7" ); diff --git a/mono/mcs/class/corlib/Test/System/StringTest.cs b/mono/mcs/class/corlib/Test/System/StringTest.cs index f201cb22c05..661f039e246 100644 --- a/mono/mcs/class/corlib/Test/System/StringTest.cs +++ b/mono/mcs/class/corlib/Test/System/StringTest.cs @@ -4494,7 +4494,9 @@ public void TestTrim() Assert.AreEqual( "", - "\x9\xa\xb\xc\xd\x20\x85\xa0\x1680\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2009\x200a\x2028\x2029\x202f\x205f\x3000".Trim(), + "\x9\xa\xb\xc\xd\x20\x85\xa0\x1680\x2000\x2001\x2002\x2003\x2004\x2005\x2006\x2007\x2008\x2009\x200a\x2028\x2029\x202f\x205f\x3000".Trim( + + ), "net_4_0 changes #1" ); } diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/FlowchartDesigner.Helpers.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/FlowchartDesigner.Helpers.cs index 9b30fb878e3..641e90b946b 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/FlowchartDesigner.Helpers.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/FlowchartDesigner.Helpers.cs @@ -99,8 +99,8 @@ ConnectionPointKind excludePointType ) { List candidateDestConnPoints; - IEnumerable freeDestConnPoints = destConnPoints.Where( - p => p.PointType != excludePointType && !p.AttachedConnectors.Any() + IEnumerable freeDestConnPoints = destConnPoints.Where(p => + p.PointType != excludePointType && !p.AttachedConnectors.Any() ); if (freeDestConnPoints.Any()) @@ -109,13 +109,11 @@ ConnectionPointKind excludePointType } else { - IEnumerable availablePoints = destConnPoints.Where( - p => - p.PointType != excludePointType - && p.AttachedConnectors.Any( - connector => - FreeFormPanel.GetDestinationConnectionPoint(connector).Equals(p) - ) + IEnumerable availablePoints = destConnPoints.Where(p => + p.PointType != excludePointType + && p.AttachedConnectors.Any(connector => + FreeFormPanel.GetDestinationConnectionPoint(connector).Equals(p) + ) ); candidateDestConnPoints = availablePoints.Any() @@ -300,8 +298,8 @@ List GetOutGoingConnectors(UIElement shape) if (connPoint != null) { outGoingConnectors.AddRange( - connPoint.AttachedConnectors.Where( - p => FreeFormPanel.GetSourceConnectionPoint(p).Equals(connPoint) + connPoint.AttachedConnectors.Where(p => + FreeFormPanel.GetSourceConnectionPoint(p).Equals(connPoint) ) ); } @@ -318,8 +316,8 @@ List GetInComingConnectors(UIElement shape) if (connPoint != null) { inComingConnectors.AddRange( - connPoint.AttachedConnectors.Where( - p => FreeFormPanel.GetDestinationConnectionPoint(p).Equals(connPoint) + connPoint.AttachedConnectors.Where(p => + FreeFormPanel.GetDestinationConnectionPoint(p).Equals(connPoint) ) ); } diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/SequenceDesigner.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/SequenceDesigner.xaml.cs index 3cd4fdb7852..9f5f80560bd 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/SequenceDesigner.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/SequenceDesigner.xaml.cs @@ -23,8 +23,9 @@ public SequenceDesigner() protected override void OnModelItemChanged(object newItem) { // Make sequence designer always expand by default, but only if the user didnt explicitly specify collapsed or expanded. - ViewStateService viewStateService = - this.Context.Services.GetService(); + ViewStateService viewStateService = this.Context.Services.GetService( + + ); if (viewStateService != null) { bool? isExpanded = (bool?) diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.CompositeView.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.CompositeView.cs index 0c167d7a0dd..bfe3790b792 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.CompositeView.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.CompositeView.cs @@ -125,14 +125,15 @@ void DoDeleteItems(List itemsToDelete, bool removeIncomingConnectors) HashSet connectorsToDelete = new HashSet(); List allStateModelItemsToDelete = new List(); - IEnumerable selectedStateModelItems = - this.Context.Items.GetValue() - .SelectedObjects.Where( - (p) => - { - return p.ItemType == typeof(State); - } - ); + IEnumerable selectedStateModelItems = this.Context.Items.GetValue( + + ) + .SelectedObjects.Where( + (p) => + { + return p.ItemType == typeof(State); + } + ); foreach (ModelItem stateModelItem in itemsToDelete) { @@ -208,8 +209,8 @@ public bool CanPasteItems(List itemsToPaste) string errorMessage; IEnumerable selectedStateModelItems = this.Context.Items.GetValue().SelectedObjects; - return selectedStateModelItems.All( - item => CanPasteTransition(item, out errorMessage) + return selectedStateModelItems.All(item => + CanPasteTransition(item, out errorMessage) ); } else diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.xaml.cs index 5bc16bad0b5..45e5bdf8a94 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/StateContainerEditor.xaml.cs @@ -2828,7 +2828,9 @@ void KeyboardMove(Key key) using (EditingScope es = (EditingScope)this.ModelItem.BeginEdit(SR.ItemMove)) { foreach ( - ModelItem selectedModelItem in this.Context.Items.GetValue().SelectedObjects + ModelItem selectedModelItem in this.Context.Items.GetValue( + + ).SelectedObjects ) { UIElement shapeToMove = this.modelItemToUIElement[selectedModelItem]; diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TransitionDesigner.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TransitionDesigner.xaml.cs index a25067fc02f..f927f6ba7e2 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TransitionDesigner.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TransitionDesigner.xaml.cs @@ -526,13 +526,12 @@ void OnNewTransitionTextBoxGotFocus(object sender, RoutedEventArgs e) this.addNewTransitionLabel.Visibility = Visibility.Visible; this.addNewTransitionBox.ViewModel.ComboBoxItems = new ObservableCollection( GetAvailableStates() - .Select( - modelItem => - ( - modelItem - .Properties[StateDesigner.DisplayNamePropertyName] - .ComputedValue as string - ) + .Select(modelItem => + ( + modelItem + .Properties[StateDesigner.DisplayNamePropertyName] + .ComputedValue as string + ) ) .Where(displayName => !string.IsNullOrEmpty(displayName)) .Distinct() @@ -713,13 +712,12 @@ ModelItem transitionModelItem in stateModelItem } } - return availableStates.OrderBy( - modelItem => - modelItem.Properties[StateDesigner.DisplayNamePropertyName].Value == null - ? SR.EmptyName - : modelItem - .Properties[StateDesigner.DisplayNamePropertyName] - .Value.GetCurrentValue() + return availableStates.OrderBy(modelItem => + modelItem.Properties[StateDesigner.DisplayNamePropertyName].Value == null + ? SR.EmptyName + : modelItem + .Properties[StateDesigner.DisplayNamePropertyName] + .Value.GetCurrentValue() ); } diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TryCatchDesigner.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TryCatchDesigner.xaml.cs index 3b13be89105..5b26a6b9ad1 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TryCatchDesigner.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Core/Presentation/TryCatchDesigner.xaml.cs @@ -146,8 +146,9 @@ void OnLoaded(object sender, RoutedEventArgs e) this.ModelItem.Properties[CatchesPropertyName].Collection.CollectionChanged += OnModelItemCollectionChanged; - ViewStateService viewStateService = - this.Context.Services.GetService(); + ViewStateService viewStateService = this.Context.Services.GetService( + + ); foreach (ModelItem modelItem in this.ModelItem.Properties["Catches"].Collection) { diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDesigner.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDesigner.xaml.cs index b0f5daf7f9f..454f2626490 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDesigner.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDesigner.xaml.cs @@ -589,8 +589,8 @@ DependencyPropertyChangedEventArgs e DataGridRow row = entry.Row; string newName = e.NewValue as string; - bool duplicates = this.DynamicArguments.Any( - p => string.Equals(p.Name, newName) && p != entry + bool duplicates = this.DynamicArguments.Any(p => + string.Equals(p.Name, newName) && p != entry ); if (duplicates || string.IsNullOrEmpty(newName)) { @@ -669,17 +669,16 @@ internal string GetDefaultName() DynamicArgumentWrapperObject, string >(p => (string)p.Name) - .Where( - p => - 0 - == string.Compare( - p, - 0, - this.ArgumentPrefix, - 0, - this.ArgumentPrefix.Length, - StringComparison.Ordinal - ) + .Where(p => + 0 + == string.Compare( + p, + 0, + this.ArgumentPrefix, + 0, + this.ArgumentPrefix.Length, + StringComparison.Ordinal + ) ) .Select(p => p.Substring(this.ArgumentPrefix.Length)); diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDialog.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDialog.cs index 67c7d32fc78..ad482c850bd 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDialog.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/Activities/Presentation/DynamicArgumentDialog.cs @@ -60,13 +60,9 @@ public static bool ShowDialog( DynamicArgumentDesignerOptions options ) { - return new DynamicArgumentDialog( - activity, - data, - context, - owner, - options - ).ShowOkCancel(); + return new DynamicArgumentDialog(activity, data, context, owner, options).ShowOkCancel( + + ); } protected override void OnWorkflowElementDialogClosed(bool? dialogResult) diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/BindingEditor.xaml.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/BindingEditor.xaml.cs index 89183d4539d..0eaaeda1e65 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/BindingEditor.xaml.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/BindingEditor.xaml.cs @@ -61,12 +61,11 @@ void LoadBindings() section .Bindings.BindingCollections.OrderBy(p => p.BindingName) .Select( - p => - new BindingDescriptor() - { - BindingName = p.BindingName, - Value = p - } + p => new BindingDescriptor() + { + BindingName = p.BindingName, + Value = p + } ) ); } diff --git a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/SendReplyValidationFeature.cs b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/SendReplyValidationFeature.cs index fe2072eba04..115a425d1d8 100644 --- a/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/SendReplyValidationFeature.cs +++ b/mono/mcs/class/referencesource/System.Activities.Core.Presentation/System/ServiceModel/Activities/Presentation/SendReplyValidationFeature.cs @@ -55,8 +55,8 @@ Constraint UnrootedRequestRule() { new If { - Condition = new InArgument( - ctx => sendReply.Get(ctx).Request != null + Condition = new InArgument(ctx => + sendReply.Get(ctx).Request != null ), Then = new Sequence { @@ -73,10 +73,9 @@ Constraint UnrootedRequestRule() Argument = activityInTree, Handler = new If { - Condition = new InArgument( - ctx => - activityInTree.Get(ctx) - == sendReply.Get(ctx).Request + Condition = new InArgument(ctx => + activityInTree.Get(ctx) + == sendReply.Get(ctx).Request ), Then = new Assign { @@ -88,22 +87,21 @@ Constraint UnrootedRequestRule() }, new AssertValidation { - Assertion = new InArgument( - ctx => requestInTree.Get(ctx) + Assertion = new InArgument(ctx => + requestInTree.Get(ctx) ), IsWarning = false, - Message = new InArgument( - ctx => - string.Format( - CultureInfo.CurrentCulture, - System - .Activities - .Core - .Presentation - .SR - .UnrootedRequestInSendReply, - sendReply.Get(ctx).DisplayName - ) + Message = new InArgument(ctx => + string.Format( + CultureInfo.CurrentCulture, + System + .Activities + .Core + .Presentation + .SR + .UnrootedRequestInSendReply, + sendReply.Get(ctx).DisplayName + ) ) } } diff --git a/mono/mcs/class/referencesource/System.Activities/Microsoft/VisualBasic/Activities/VisualBasicHelper.cs b/mono/mcs/class/referencesource/System.Activities/Microsoft/VisualBasic/Activities/VisualBasicHelper.cs index 9a48979ca95..d3116e1b0eb 100644 --- a/mono/mcs/class/referencesource/System.Activities/Microsoft/VisualBasic/Activities/VisualBasicHelper.cs +++ b/mono/mcs/class/referencesource/System.Activities/Microsoft/VisualBasic/Activities/VisualBasicHelper.cs @@ -576,7 +576,9 @@ bool isLocationReference // they are not valid anymore since we just aborted the shortcut rewrite. // clean up, and start again. - this.publicAccessor.Value.ActivityMetadata.CurrentActivity.ResetTempAutoGeneratedArguments(); + this.publicAccessor.Value.ActivityMetadata.CurrentActivity.ResetTempAutoGeneratedArguments( + + ); } } diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Debugger/XamlDebuggerXmlReader.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Debugger/XamlDebuggerXmlReader.cs index 607ab9b37a5..b24d0039cf3 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Debugger/XamlDebuggerXmlReader.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Debugger/XamlDebuggerXmlReader.cs @@ -584,8 +584,9 @@ out valueRange { // For Value Node with known line info, we want to route the value setting process through this Reader. // Therefore we need to go back to the member node and replace the XamlMemberInvoker. - XamlNode startMemberNodeForValue = - this.bufferedXamlNodes.Peek(); + XamlNode startMemberNodeForValue = this.bufferedXamlNodes.Peek( + + ); XamlMember xamlMemberForValue = startMemberNodeForValue.Member; XamlMemberInvoker newXamlMemberInvoker = new ValueNodeXamlMemberInvoker( diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/ExpressionUtilities.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/ExpressionUtilities.cs index c95ee9fba74..29ee1d4cd7b 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/ExpressionUtilities.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/ExpressionUtilities.cs @@ -2149,8 +2149,9 @@ bool isLocationExpression Expression> locationReferenceLambda = Expression.Lambda< Func >(locationReferenceExpression); - Func locationReferenceFunc = - locationReferenceLambda.Compile(); + Func locationReferenceFunc = locationReferenceLambda.Compile( + + ); locationReference = locationReferenceFunc(); } catch (Exception e) diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/NativeActivityContext.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/NativeActivityContext.cs index 66b1455a382..df61c164cf0 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/NativeActivityContext.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/NativeActivityContext.cs @@ -3373,8 +3373,8 @@ public ActivityInstance ScheduleDelegate( // Check if the inputParameters collection matches the expected inputs for activityDelegate IEnumerable expectedParameters = - activityDelegate.RuntimeDelegateArguments.Where( - p => ArgumentDirectionHelper.IsIn(p.Direction) + activityDelegate.RuntimeDelegateArguments.Where(p => + ArgumentDirectionHelper.IsIn(p.Direction) ); int expectedParameterCount = expectedParameters.Count(); if ( diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/ActivityInstanceMap.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/ActivityInstanceMap.cs index aca777dd035..b7b6bf458be 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/ActivityInstanceMap.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/ActivityInstanceMap.cs @@ -164,9 +164,9 @@ ref Collection updateErrors // we start from a secondary root instead of starting from the enviroment with the already completed owner that was added symbols. // It is becuase for the case of adding symbols to noSymbols activities, the environment doesn't even exist from which we can start looking for referencing secondary root. - int[] secondaryRootOriginalQID = new QualifiedId( - instanceList.ActivityId - ).AsIDArray(); + int[] secondaryRootOriginalQID = new QualifiedId(instanceList.ActivityId).AsIDArray( + + ); Fx.Assert( secondaryRootOriginalQID != null && secondaryRootOriginalQID.Length > 1, diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/BookmarkManager.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/BookmarkManager.cs index a2ad72659d4..1dc49b5c917 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/BookmarkManager.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Runtime/BookmarkManager.cs @@ -129,8 +129,9 @@ void UpdateAllExclusiveHandles(Bookmark bookmark, ActivityInstance owningInstanc return; } - List handles = - owningInstance.PropertyManager.FindAll(); + List handles = owningInstance.PropertyManager.FindAll( + + ); if (handles == null) { diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/MethodResolver.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/MethodResolver.cs index 80f4132a5fa..7b29ea85cf1 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/MethodResolver.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/MethodResolver.cs @@ -271,11 +271,10 @@ ref MethodExecutor methodExecutor // Convert OutArgs and InOutArgs to out/ref types before resolution Type[] parameterTypes = Parameters - .Select( - argument => - argument.Direction == ArgumentDirection.In - ? argument.ArgumentType - : argument.ArgumentType.MakeByRefType() + .Select(argument => + argument.Direction == ArgumentDirection.In + ? argument.ArgumentType + : argument.ArgumentType.MakeByRefType() ) .ToArray(); diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/TransactionScope.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/TransactionScope.cs index bfe9013dad7..8c3d2c9e3e9 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/TransactionScope.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Statements/TransactionScope.cs @@ -172,8 +172,8 @@ Constraint ProcessParentChainConstraints() Condition = new Equal { Left = new ObtainType { Input = parent, }, - Right = new InArgument( - context => typeof(TransactionScope) + Right = new InArgument(context => + typeof(TransactionScope) ) }, Then = new Sequence @@ -279,8 +279,8 @@ Constraint ProcessChildSubtreeConstraints() { Input = new InArgument(child) }, - Right = new InArgument( - context => typeof(CompensableActivity) + Right = new InArgument(context => + typeof(CompensableActivity) ) }, Then = new Assign diff --git a/mono/mcs/class/referencesource/System.Activities/System/Activities/Validation/ValidationHelper.cs b/mono/mcs/class/referencesource/System.Activities/System/Activities/Validation/ValidationHelper.cs index 5481f3fecc9..571158c26ec 100644 --- a/mono/mcs/class/referencesource/System.Activities/System/Activities/Validation/ValidationHelper.cs +++ b/mono/mcs/class/referencesource/System.Activities/System/Activities/Validation/ValidationHelper.cs @@ -65,8 +65,8 @@ ref IList validationErrors if (requiredArguments.Count() > 0) { if ( - requiredArguments.All( - localArgument => CheckIfArgumentIsBound(localArgument, inputs) + requiredArguments.All(localArgument => + CheckIfArgumentIsBound(localArgument, inputs) ) ) { @@ -82,8 +82,8 @@ ref IList validationErrors (a) => !a.IsRequired ); if ( - optionalArguments.Any( - localArgument => CheckIfArgumentIsBound(localArgument, inputs) + optionalArguments.Any(localArgument => + CheckIfArgumentIsBound(localArgument, inputs) ) ) { @@ -114,8 +114,8 @@ ref IList validationErrors overloadGroups[configuredGroupName] ); Predicate checkIfArgumentIsBound = - new Predicate( - localArgument => CheckIfArgumentIsBound(localArgument, inputs) + new Predicate(localArgument => + CheckIfArgumentIsBound(localArgument, inputs) ); List disjointGroups = null; diff --git a/mono/mcs/class/referencesource/System.Configuration/System/Configuration/CommaDelimitedStringAttributeCollectionConverter.cs b/mono/mcs/class/referencesource/System.Configuration/System/Configuration/CommaDelimitedStringAttributeCollectionConverter.cs index 447cd4221b8..fd0565e2769 100644 --- a/mono/mcs/class/referencesource/System.Configuration/System/Configuration/CommaDelimitedStringAttributeCollectionConverter.cs +++ b/mono/mcs/class/referencesource/System.Configuration/System/Configuration/CommaDelimitedStringAttributeCollectionConverter.cs @@ -41,8 +41,9 @@ Type type public override object ConvertFrom(ITypeDescriptorContext ctx, CultureInfo ci, object data) { - CommaDelimitedStringCollection attributeCollection = - new CommaDelimitedStringCollection(); + CommaDelimitedStringCollection attributeCollection = new CommaDelimitedStringCollection( + + ); attributeCollection.FromString((string)data); return attributeCollection; } diff --git a/mono/mcs/class/referencesource/System.Data.DataSetExtensions/System/Data/SortExpressionBuilder.cs b/mono/mcs/class/referencesource/System.Data.DataSetExtensions/System/Data/SortExpressionBuilder.cs index c0d408e48a2..61fe3833de4 100644 --- a/mono/mcs/class/referencesource/System.Data.DataSetExtensions/System/Data/SortExpressionBuilder.cs +++ b/mono/mcs/class/referencesource/System.Data.DataSetExtensions/System/Data/SortExpressionBuilder.cs @@ -174,8 +174,8 @@ internal SortExpressionBuilder CloneCast() { if (selector == _currentSelector.Value) { - builder._currentSelector = builder._selectors.AddLast( - r => selector((T)(object)r) + builder._currentSelector = builder._selectors.AddLast(r => + selector((T)(object)r) ); } else diff --git a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/Common/MetadataItemSerializer.cs b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/Common/MetadataItemSerializer.cs index b1a42bcbf30..0ab4b8adab2 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/Common/MetadataItemSerializer.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/Common/MetadataItemSerializer.cs @@ -913,8 +913,8 @@ private void WriteEntityContainerElement(EntityContainer container) } foreach ( - EdmFunction functionImport in container.FunctionImports.Where( - fi => fi.IsComposableAttribute + EdmFunction functionImport in container.FunctionImports.Where(fi => + fi.IsComposableAttribute ) ) { @@ -1005,8 +1005,8 @@ out property private void WriteExtendedPropertyAttributes(MetadataItem item) { foreach ( - MetadataProperty property in item.MetadataProperties.Where( - p => p.PropertyKind == PropertyKind.Extended + MetadataProperty property in item.MetadataProperties.Where(p => + p.PropertyKind == PropertyKind.Extended ) ) { diff --git a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/EntityViewGeneration/EntityViewGenerator.cs b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/EntityViewGeneration/EntityViewGenerator.cs index 9da72101bf3..c1252dd52e3 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/EntityViewGeneration/EntityViewGenerator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/Entity/Design/EntityViewGeneration/EntityViewGenerator.cs @@ -343,8 +343,8 @@ private static IList HandleValidationErrors( IList schemaErrors ) { - IEnumerable warningsToRemove = schemaErrors.Where( - s => s.ErrorCode == ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME + IEnumerable warningsToRemove = schemaErrors.Where(s => + s.ErrorCode == ERRORCODE_MAPPINGALLQUERYVIEWATCOMPILETIME ); // When EntityContainerMapping only has QueryView, the mapping is valid return schemaErrors.Except(warningsToRemove).ToList(); @@ -470,7 +470,9 @@ IList schemaErrors compileUnit.Namespaces.Add(codeNamespace); foreach ( - var storageEntityContainerMapping in mappingCollection.GetItems() + var storageEntityContainerMapping in mappingCollection.GetItems( + + ) ) { //Throw warning when containerMapping contains query view for bug 547285. diff --git a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/EntityModel/Emitters/EntityTypeEmitter.cs b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/EntityModel/Emitters/EntityTypeEmitter.cs index b5775b53ead..1ba6e8144ab 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/EntityModel/Emitters/EntityTypeEmitter.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity.Design/System/Data/EntityModel/Emitters/EntityTypeEmitter.cs @@ -40,7 +40,9 @@ protected override void EmitProperties(CodeTypeDeclaration typeDecl) { base.EmitProperties(typeDecl); foreach ( - NavigationProperty navigationProperty in Item.GetDeclaredOnlyMembers() + NavigationProperty navigationProperty in Item.GetDeclaredOnlyMembers( + + ) ) { NavigationPropertyEmitter navigationPropertyEmitter = new NavigationPropertyEmitter( diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/CommandTrees/DbQueryCommandTree.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/CommandTrees/DbQueryCommandTree.cs index 6c990b56df6..fbfb4afc965 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/CommandTrees/DbQueryCommandTree.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/CommandTrees/DbQueryCommandTree.cs @@ -88,9 +88,10 @@ internal override IEnumerable> GetParameters() { this._parameters = ParameterRetriever.GetParameters(this); } - return this._parameters.Select( - p => new KeyValuePair(p.ParameterName, p.ResultType) - ); + return this._parameters.Select(p => new KeyValuePair( + p.ParameterName, + p.ResultType + )); } internal override void DumpStructure(ExpressionDumper dumper) diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/SemanticResolver.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/SemanticResolver.cs index 8f614a77662..3226b93685b 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/SemanticResolver.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/SemanticResolver.cs @@ -1085,8 +1085,8 @@ internal IDisposable EnterScopeRegion() // // Reset aggregate info of AST nodes of aggregates resolved to the CurrentScopeRegion. // - this.CurrentScopeRegion.GroupAggregateInfos.ForEach( - groupAggregateInfo => groupAggregateInfo.DetachFromAstNode() + this.CurrentScopeRegion.GroupAggregateInfos.ForEach(groupAggregateInfo => + groupAggregateInfo.DetachFromAstNode() ); // diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/TypeResolver.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/TypeResolver.cs index c0207771009..ebe26bb93d5 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/TypeResolver.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/EntitySql/TypeResolver.cs @@ -359,14 +359,13 @@ internal void DeclareInlineFunction(string name, InlineFunctionInfo functionInfo // Check overload uniqueness. // if ( - overloads.Exists( - overload => - overload - .Parameters.Select(p => p.ResultType) - .SequenceEqual( - functionInfo.Parameters.Select(p => p.ResultType), - TypeUsageStructuralComparer.Instance - ) + overloads.Exists(overload => + overload + .Parameters.Select(p => p.ResultType) + .SequenceEqual( + functionInfo.Parameters.Select(p => p.ResultType), + TypeUsageStructuralComparer.Instance + ) ) ) { diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/Utils/MetadataHelper.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/Utils/MetadataHelper.cs index 2a3bccb8b48..28cd022143d 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/Utils/MetadataHelper.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Common/Utils/MetadataHelper.cs @@ -377,8 +377,8 @@ internal static AssociationSetEnd GetOppositeEnd(AssociationSetEnd end) { Debug.Assert(null != end); // there must be exactly one ("Single") other end that isn't ("Filter") this end - AssociationSetEnd otherEnd = end.ParentAssociationSet.AssociationSetEnds.Where( - e => !e.EdmEquals(end) + AssociationSetEnd otherEnd = end.ParentAssociationSet.AssociationSetEnds.Where(e => + !e.EdmEquals(end) ) .Single(); return otherEnd; @@ -439,14 +439,12 @@ MetadataWorkspace workspace //find EntitySetMappings where one of the mapping fragment maps some type to the given table return containerMapping - .EntitySetMaps.Where( - map => - map.TypeMappings.Any( - typeMap => - typeMap.MappingFragments.Any( - mappingFrag => mappingFrag.TableSet.EdmEquals(table) - ) + .EntitySetMaps.Where(map => + map.TypeMappings.Any(typeMap => + typeMap.MappingFragments.Any(mappingFrag => + mappingFrag.TableSet.EdmEquals(table) ) + ) ) .Select(m => m.Set) .Cast() @@ -664,9 +662,10 @@ HashSet> associationkeys HashSet> thisEndKeys = new HashSet< Pair >( - thisEndsEntityType.KeyMembers.Select( - edmMember => new Pair(edmMember, thisEndsEntityType) - ) + thisEndsEntityType.KeyMembers.Select(edmMember => new Pair( + edmMember, + thisEndsEntityType + )) ); foreach (ReferentialConstraint constraint in assocType.ReferentialConstraints) diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/FunctionImportMapping.ReturnTypeRenameMapping.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/FunctionImportMapping.ReturnTypeRenameMapping.cs index 341eeb220bd..7e4da82385e 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/FunctionImportMapping.ReturnTypeRenameMapping.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/FunctionImportMapping.ReturnTypeRenameMapping.cs @@ -67,11 +67,10 @@ internal IEnumerable GetMappedEntityTypes(ItemCollection itemCollect { const bool includeAbstractTypes = false; return this.EntityTypes.Concat( - this.IsOfTypeEntityTypes.SelectMany( - entityType => - MetadataHelper - .GetTypeAndSubtypesOf(entityType, itemCollection, includeAbstractTypes) - .Cast() + this.IsOfTypeEntityTypes.SelectMany(entityType => + MetadataHelper + .GetTypeAndSubtypesOf(entityType, itemCollection, includeAbstractTypes) + .Cast() ) ); } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/StorageEntityContainerMapping.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/StorageEntityContainerMapping.cs index fffdf59f558..10943b1fa52 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/StorageEntityContainerMapping.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/StorageEntityContainerMapping.cs @@ -204,9 +204,9 @@ internal ReadOnlyCollection RelationshipSetMaps { get { - return new List( - this.m_associationSetMappings.Values - ).AsReadOnly(); + return new List(this.m_associationSetMappings.Values).AsReadOnly( + + ); } } @@ -300,17 +300,15 @@ EntitySetBase storeEntitySet IEnumerable associationSetMappings = m_associationSetMappings .Values.Cast() - .Where( - w => ((w.StoreEntitySet != null) && (w.StoreEntitySet == storeEntitySet)) + .Where(w => ((w.StoreEntitySet != null) && (w.StoreEntitySet == storeEntitySet)) ); //From this again filter the ones that have the specified EntitySet on atleast one end - associationSetMappings = associationSetMappings.Where( - associationSetMap => - ( - (associationSetMap.Set as AssociationSet).AssociationSetEnds.Any( - associationSetEnd => associationSetEnd.EntitySet == edmEntitySet - ) + associationSetMappings = associationSetMappings.Where(associationSetMap => + ( + (associationSetMap.Set as AssociationSet).AssociationSetEnds.Any( + associationSetEnd => associationSetEnd.EntitySet == edmEntitySet ) + ) ); return associationSetMappings; } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/ExtractorMetadata.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/ExtractorMetadata.cs index 8aa47e963be..2201aaeccfd 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/ExtractorMetadata.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/ExtractorMetadata.cs @@ -68,8 +68,8 @@ UpdateTranslator translator entityType = (EntityType)type; keyMembers = new Set(entityType.KeyMembers).MakeReadOnly(); foreignKeyMembers = new Set( - ((EntitySet)entitySetBase).ForeignKeyDependents.SelectMany( - fk => fk.Item2.ToProperties + ((EntitySet)entitySetBase).ForeignKeyDependents.SelectMany(fk => + fk.Item2.ToProperties ) ).MakeReadOnly(); break; diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/FunctionUpdateCommand.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/FunctionUpdateCommand.cs index a67b8f22886..29e302e9a2d 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/FunctionUpdateCommand.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/FunctionUpdateCommand.cs @@ -283,13 +283,10 @@ List> generatedValues foreach ( var resultColumn in m_resultColumns - .Select( - r => - new KeyValuePair( - GetColumnOrdinal(translator, reader, r.Key), - r.Value - ) - ) + .Select(r => new KeyValuePair( + GetColumnOrdinal(translator, reader, r.Key), + r.Value + )) .OrderBy(r => r.Key) ) // order by column ordinal to avoid breaking SequentialAccess readers { diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/Propagator.JoinPropagator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/Propagator.JoinPropagator.cs index ca82f020cf3..1f5f0cb7e8b 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/Propagator.JoinPropagator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/Propagator.JoinPropagator.cs @@ -541,9 +541,8 @@ ChangeNode result if (null != map) { PropagatorResult replacement; - join = join.Replace( - original => - map.TryGetValue(original, out replacement) ? replacement : original + join = join.Replace(original => + map.TryGetValue(original, out replacement) ? replacement : original ); } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/UpdateTranslator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/UpdateTranslator.cs index 578f9a31592..205b4aef17f 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/UpdateTranslator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/Update/Internal/UpdateTranslator.cs @@ -896,10 +896,10 @@ StorageModificationFunctionResultBinding resultBinding in functionMapping.Result // add function parameters IEnumerable> functionParams = - functionMapping.Function.Parameters.Select( - paramInfo => - new KeyValuePair(paramInfo.Name, paramInfo.TypeUsage) - ); + functionMapping.Function.Parameters.Select(paramInfo => new KeyValuePair< + string, + TypeUsage + >(paramInfo.Name, paramInfo.TypeUsage)); // construct DbFunctionCommandTree including implict return type DbFunctionCommandTree tree = new DbFunctionCommandTree( diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/BasicViewGenerator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/BasicViewGenerator.cs index 7a3af8716fa..b878d14d70a 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/BasicViewGenerator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/BasicViewGenerator.cs @@ -490,8 +490,8 @@ private static IEnumerable GetFKOverPKDependents(EntitySet principal) if (i == pkColumns.Count) { yield return pkFkInfo - .Item1.AssociationSetEnds.Where( - ase => ase.Name == pkFkInfo.Item2.ToRole.Name + .Item1.AssociationSetEnds.Where(ase => + ase.Name == pkFkInfo.Item2.ToRole.Name ) .Single() .EntitySet; diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/CqlGeneration/CqlBlock.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/CqlGeneration/CqlBlock.cs index 50500970c27..9b0584e4ca6 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/CqlGeneration/CqlBlock.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/CqlGeneration/CqlBlock.cs @@ -228,13 +228,10 @@ protected DbExpression GenerateProjectionCqt(DbExpression row, bool isTopLevel) { return DbExpressionBuilder.NewRow( this.Slots.Where(slot => slot.IsRequiredByParent) - .Select( - slot => - new KeyValuePair( - slot.CqlFieldAlias, - slot.AsCqt(row) - ) - ) + .Select(slot => new KeyValuePair( + slot.CqlFieldAlias, + slot.AsCqt(row) + )) ); } } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/FragmentQueryKB.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/FragmentQueryKB.cs index c7210bb1980..7be5726cb18 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/FragmentQueryKB.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/FragmentQueryKB.cs @@ -77,10 +77,8 @@ EdmItemCollection edmItemCollection { EntityType type = (EntityType) ((RefType)endMember.TypeUsage.EdmType).ElementType; - type.KeyMembers.All( - member => - associationkeys.Add(new Pair(member, type)) - || true /* prevent early termination */ + type.KeyMembers.All(member => + associationkeys.Add(new Pair(member, type)) || true /* prevent early termination */ ); } @@ -286,7 +284,9 @@ EdmItemCollection edmItemCollection StructuralType structuralType = (StructuralType)possibleType; foreach ( - EdmProperty childProperty in structuralType.GetDeclaredOnlyMembers() + EdmProperty childProperty in structuralType.GetDeclaredOnlyMembers( + + ) ) { MemberPath childPath = new MemberPath(currentPath, childProperty); diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/QueryRewriter.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/QueryRewriter.cs index c6ec93f4368..de36863da6e 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/QueryRewriter.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/QueryRewriting/QueryRewriter.cs @@ -280,16 +280,16 @@ private void AdjustMemberDomainsForUpdateViews() { // try to remove default value followed by negated value, in this order IEnumerable oldDomain = _domainMap.GetDomain(currentPath); - Constant defaultValue = oldDomain.FirstOrDefault( - domainValue => IsDefaultValue(domainValue, currentPath) + Constant defaultValue = oldDomain.FirstOrDefault(domainValue => + IsDefaultValue(domainValue, currentPath) ); if (defaultValue != null) { RemoveUnusedValueFromStoreDomain(defaultValue, currentPath); } oldDomain = _domainMap.GetDomain(currentPath); // is case has changed - Constant negatedValue = oldDomain.FirstOrDefault( - domainValue => domainValue is NegatedConstant + Constant negatedValue = oldDomain.FirstOrDefault(domainValue => + domainValue is NegatedConstant ); if (negatedValue != null) { @@ -666,8 +666,8 @@ HashSet outputUsedViews { // Compute right domain query - non-simplified version of "basic view" // It is used below to check whether we need a default value in a case statement - IEnumerable usedCells = _context.AllWrappersForExtent.Where( - w => _usedViews.Contains(w.FragmentQuery) + IEnumerable usedCells = _context.AllWrappersForExtent.Where(w => + _usedViews.Contains(w.FragmentQuery) ); CellTreeNode rightDomainQuery = new OpCellTreeNode( _context, @@ -1043,8 +1043,8 @@ LeftCellWrapper leftCellWrapper in _context.AllWrappersForExtent // otherwise it means condition on the fragment is not satisfiable if (!found) { - LeftCellWrapper fragment = _context.AllWrappersForExtent.First( - lcr => lcr.FragmentQuery.Equals(toFill.Query) + LeftCellWrapper fragment = _context.AllWrappersForExtent.First(lcr => + lcr.FragmentQuery.Equals(toFill.Query) ); Debug.Assert(fragment != null); @@ -1698,8 +1698,8 @@ ViewgenContext context if (tile.OpKind == TileOpKind.Named) { FragmentQuery view = ((TileNamed)tile).NamedQuery; - LeftCellWrapper leftCellWrapper = context.AllWrappersForExtent.First( - w => w.FragmentQuery == view + LeftCellWrapper leftCellWrapper = context.AllWrappersForExtent.First(w => + w.FragmentQuery == view ); return new LeafCellTreeNode(context, leftCellWrapper); } @@ -1787,8 +1787,8 @@ from domainConstraint in query.Condition.VariableConstraints where domainConstraint.Variable.Identifier is MemberRestriction && false - == domainConstraint.Variable.Domain.All( - constant => domainConstraint.Range.Contains(constant) + == domainConstraint.Variable.Domain.All(constant => + domainConstraint.Range.Contains(constant) ) select ((MemberRestriction)domainConstraint.Variable.Identifier) .RestrictedMemberSlot diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/LeftCellWrapper.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/LeftCellWrapper.cs index d311fadbca2..dea97dbf272 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/LeftCellWrapper.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/LeftCellWrapper.cs @@ -55,8 +55,9 @@ internal class LeftCellWrapper : InternalBase private ViewTarget m_viewTarget; private FragmentQuery m_leftFragmentQuery; // Fragment query corresponding to the left cell query of the cell - internal static readonly IComparer Comparer = - new LeftCellWrapperComparer(); + internal static readonly IComparer Comparer = new LeftCellWrapperComparer( + + ); internal static readonly IComparer OriginalCellIdComparer = new CellIdComparer(); #endregion diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/ScalarRestriction.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/ScalarRestriction.cs index 394652f8255..58f79dc642e 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/ScalarRestriction.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/ScalarRestriction.cs @@ -144,12 +144,9 @@ internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull) { // Multiple values: build list of var = c1, var = c2, ..., then OR them all. List operands = domainValues - .Select( - c => - (DbExpression) - cqt.Equal( - c.AsCqt(row, this.RestrictedMemberSlot.MemberPath) - ) + .Select(c => + (DbExpression) + cqt.Equal(c.AsCqt(row, this.RestrictedMemberSlot.MemberPath)) ) .ToList(); cqt = Helpers.BuildBalancedTreeInPlace( diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/TypeRestriction.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/TypeRestriction.cs index 53e97546b59..e5782ea9ec8 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/TypeRestriction.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Structures/TypeRestriction.cs @@ -173,8 +173,8 @@ internal override DbExpression AsCqt(DbExpression row, bool skipIsNotNull) else { // Multiple values: build list of var IsOnOnly(t1), var = IsOnOnly(t1), ..., then OR them all. - List operands = this.Domain.Values.Select( - t => (DbExpression)cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)t).EdmType)) + List operands = this.Domain.Values.Select(t => + (DbExpression)cqt.IsOfOnly(TypeUsage.Create(((TypeConstant)t).EdmType)) ) .ToList(); cqt = Helpers.BuildBalancedTreeInPlace(operands, (prev, next) => prev.Or(next)); diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Validator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Validator.cs index 4903a73e182..0cb136904d9 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Validator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/Validator.cs @@ -304,10 +304,8 @@ private bool CheckCellsWithDistinctFlag() //There should be no other fragments mapping cExtent to sExtent var mapepdFragments = m_cells .Where(otherCell => otherCell != cell) - .Where( - otherCell => - otherCell.CQuery.Extent == cExtent - && otherCell.SQuery.Extent == sExtent + .Where(otherCell => + otherCell.CQuery.Extent == cExtent && otherCell.SQuery.Extent == sExtent ); if (mapepdFragments.Any()) diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/ViewGenerator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/ViewGenerator.cs index 9398f74f97f..4236c5f42dc 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/ViewGenerator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewGeneration/ViewGenerator.cs @@ -493,8 +493,8 @@ CqlIdentifiers identifiers if (!m_queryRewriterCache.TryGetValue(extent, out queryRewriter)) { // collect the cells that belong to this extent (just a few of them since we segment the mapping first) - var cellsForExtent = m_cellGroup.Where( - c => c.GetLeftQuery(viewTarget).Extent == extent + var cellsForExtent = m_cellGroup.Where(c => + c.GetLeftQuery(viewTarget).Extent == extent ); return new ViewgenContext( diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewValidator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewValidator.cs index 7f1a76fb452..d1fb3a8f3c5 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewValidator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Mapping/ViewValidator.cs @@ -427,12 +427,8 @@ DbExpressionStructuralTypeEntitySetInfo setInfos //query view, it is better to be defensive since we might have missed some path up the tree //while computing the sets if ( - setInfos.SetInfos.All( - it => - ( - (it.Value != null) - && (it.Value is DbExpressionSimpleTypeEntitySetInfo) - ) + setInfos.SetInfos.All(it => + ((it.Value != null) && (it.Value is DbExpressionSimpleTypeEntitySetInfo)) ) && setInfos.SetInfos.Count() == 2 ) diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Converter.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Converter.cs index 650f421da55..bb4202f4edd 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Converter.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Converter.cs @@ -1221,14 +1221,10 @@ private static EdmFunction ConvertToFunction( ); EntityContainer entityContainer = functionImportEntityContainer; entitySets = somFunctionImport - .ReturnTypeList.Select( - returnType => - null != returnType.EntitySet - ? GetEntitySet( - returnType.EntitySet, - functionImportEntityContainer - ) - : null + .ReturnTypeList.Select(returnType => + null != returnType.EntitySet + ? GetEntitySet(returnType.EntitySet, functionImportEntityContainer) + : null ) .ToArray(); } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Edm/Provider/EdmProviderManifest.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Edm/Provider/EdmProviderManifest.cs index 82dbe3d4f02..14ee869b909 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Edm/Provider/EdmProviderManifest.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/Edm/Provider/EdmProviderManifest.cs @@ -869,11 +869,11 @@ private void InitializeCanonicalFunctions() ); // Count and Big Count must be supported for all edm types, except the strong spatial types. - functions.ForAllBasePrimitiveTypes( - type => functions.AddAggregate(PrimitiveTypeKind.Int32, "Count", type) + functions.ForAllBasePrimitiveTypes(type => + functions.AddAggregate(PrimitiveTypeKind.Int32, "Count", type) ); - functions.ForAllBasePrimitiveTypes( - type => functions.AddAggregate(PrimitiveTypeKind.Int64, "BigCount", type) + functions.ForAllBasePrimitiveTypes(type => + functions.AddAggregate(PrimitiveTypeKind.Int64, "BigCount", type) ); #endregion diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MappingMetadataHelper.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MappingMetadataHelper.cs index a74200ad61b..621a66837fa 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MappingMetadataHelper.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MappingMetadataHelper.cs @@ -40,8 +40,8 @@ EntityTypeBase entityType //for each mapping fragment of Type we are interested in within the given set //Check use of IsOfTypes in Code review foreach ( - StorageTypeMapping typeMap in extentMap.TypeMappings.Where( - map => map.Types.Union(map.IsOfTypes).Contains(entityType) + StorageTypeMapping typeMap in extentMap.TypeMappings.Where(map => + map.Types.Union(map.IsOfTypes).Contains(entityType) ) ) { @@ -66,22 +66,21 @@ EntityTypeBase childEntityType mappingCollection.EdmItemCollection, true /*includeAbstractTypes*/ ) - .SelectMany( - edmType => - edmType.EdmEquals(childEntityType) - ? GetMappingsForEntitySetAndType( - mappingCollection, - container, - entitySet, - (edmType as EntityTypeBase) - ) - : GetIsTypeOfMappingsForEntitySetAndType( - mappingCollection, - container, - entitySet, - (edmType as EntityTypeBase), - childEntityType - ) + .SelectMany(edmType => + edmType.EdmEquals(childEntityType) + ? GetMappingsForEntitySetAndType( + mappingCollection, + container, + entitySet, + (edmType as EntityTypeBase) + ) + : GetIsTypeOfMappingsForEntitySetAndType( + mappingCollection, + container, + entitySet, + (edmType as EntityTypeBase), + childEntityType + ) ) .ToList(); } @@ -107,8 +106,7 @@ var mapping in GetMappingsForEntitySetAndType( ) { if ( - mapping.IsOfTypes.Any( - parentType => parentType.IsAssignableFrom(childEntityType) + mapping.IsOfTypes.Any(parentType => parentType.IsAssignableFrom(childEntityType) ) || mapping.Types.Contains(childEntityType) ) { @@ -138,8 +136,8 @@ EntityTypeBase entityType if (entitySetMapping != null) //could be association set mapping { foreach ( - var v in entitySetMapping.ModificationFunctionMappings.Where( - functionMap => functionMap.EntityType.Equals(entityType) + var v in entitySetMapping.ModificationFunctionMappings.Where(functionMap => + functionMap.EntityType.Equals(entityType) ) ) { diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MetadataWorkspace.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MetadataWorkspace.cs index 143a1eee625..ccd1e1df909 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MetadataWorkspace.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/MetadataWorkspace.cs @@ -268,8 +268,8 @@ public void RegisterItemCollection(ItemCollection collection) Helper.GetCommaDelimitedString( SupportedEdmVersions .Where(e => e != XmlConstants.UndefinedVersion) - .Select( - e => e.ToString(CultureInfo.InvariantCulture) + .Select(e => + e.ToString(CultureInfo.InvariantCulture) ) ) ) @@ -531,11 +531,8 @@ internal void ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly) _foundAssemblyWithAttribute || MetadataAssemblyHelper .GetNonSystemReferencedAssemblies(callingAssembly) - .Any( - a => - ObjectItemAttributeAssemblyLoader.IsSchemaAttributePresent( - a - ) + .Any(a => + ObjectItemAttributeAssemblyLoader.IsSchemaAttributePresent(a) ) ) ) diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/ObjectLayer/KnownAssembliesSet.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/ObjectLayer/KnownAssembliesSet.cs index 742ad56d898..15a31913dcc 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/ObjectLayer/KnownAssembliesSet.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Metadata/ObjectLayer/KnownAssembliesSet.cs @@ -72,8 +72,8 @@ public IEnumerable GetEntries( EdmItemCollection itemCollection ) { - return _assemblies.Values.Where( - e => e.HaveSeenInCompatibleContext(loaderCookie, itemCollection) + return _assemblies.Values.Where(e => + e.HaveSeenInCompatibleContext(loaderCookie, itemCollection) ); } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/DataClasses/RelatedEnd.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/DataClasses/RelatedEnd.cs index 588b76b51b8..415168395ce 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/DataClasses/RelatedEnd.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/DataClasses/RelatedEnd.cs @@ -1583,7 +1583,9 @@ bool forceForeignKeyChanges "entityToAdd should be set if attachedRelatedEnd is set" ); - attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.DegradePromotedRelationships(); + attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.DegradePromotedRelationships( + + ); // Remove the source entity from the target related end attachedRelatedEnd.FixupOtherEndOfRelationshipForRemove( @@ -1609,7 +1611,9 @@ bool forceForeignKeyChanges } finally { - attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.TransactionManager.EndAddTracking(); + attachedRelatedEnd.WrappedOwner.Context.ObjectStateManager.TransactionManager.EndAddTracking( + + ); } } } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/ELinq/ExpressionConverter.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/ELinq/ExpressionConverter.cs index 8599e738d14..1f6734ab1a7 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/ELinq/ExpressionConverter.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Objects/ELinq/ExpressionConverter.cs @@ -1661,14 +1661,13 @@ private DbExpression TranslateFunctionIntoLike( { useLikeTranslation = true; bool specifyEscapeDummy; - patternExpression = queryParameterExpression.EscapeParameterForLike( - input => - PreparePattern( - input, - insertPercentAtStart, - insertPercentAtEnd, - out specifyEscapeDummy - ) + patternExpression = queryParameterExpression.EscapeParameterForLike(input => + PreparePattern( + input, + insertPercentAtStart, + insertPercentAtEnd, + out specifyEscapeDummy + ) ); } diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/ITreeGenerator.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/ITreeGenerator.cs index e64fad5cadf..619008a8495 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/ITreeGenerator.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/ITreeGenerator.cs @@ -2104,11 +2104,10 @@ IsOfFilter typeFilter List predicates = new List( typeFilter .ToEnumerable() - .Select( - tf => - tf.Value - ? resultBinding.Variable.IsOfOnly(tf.Key) - : resultBinding.Variable.IsOf(tf.Key) + .Select(tf => + tf.Value + ? resultBinding.Variable.IsOfOnly(tf.Key) + : resultBinding.Variable.IsOf(tf.Key) ) .ToList() ); diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/JoinGraph.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/JoinGraph.cs index 9a9843878de..7ef502fe2a7 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/JoinGraph.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Query/PlanCompiler/JoinGraph.cs @@ -1286,8 +1286,8 @@ AugmentedJoinNode augmentedJoinNode in m_vertexes useCompatMode ? ( augmentedJoinNode.Children.All(c => c is AugmentedTableNode) - && augmentedJoinNode.JoinEdges.All( - joinEdge => IsConstraintPresentForTurningIntoInnerJoin(joinEdge) + && augmentedJoinNode.JoinEdges.All(joinEdge => + IsConstraintPresentForTurningIntoInnerJoin(joinEdge) ) ) : ( diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeography.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeography.cs index 2c0b4cdc5cb..513f1c708d7 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeography.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeography.cs @@ -68,7 +68,9 @@ public DbGeographyWellKnownValue WellKnownValue { if (this.spatialSvcs != null) { - throw SpatialExceptions.WellKnownValueSerializationPropertyNotDirectlySettable(); + throw SpatialExceptions.WellKnownValueSerializationPropertyNotDirectlySettable( + + ); } DbSpatialServices resolvedServices = DbSpatialServices.Default; diff --git a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeometry.cs b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeometry.cs index d03e70d6076..ea9a54d7c20 100644 --- a/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeometry.cs +++ b/mono/mcs/class/referencesource/System.Data.Entity/System/Data/Spatial/DbGeometry.cs @@ -65,7 +65,9 @@ public DbGeometryWellKnownValue WellKnownValue { if (this.spatialSvcs != null) { - throw SpatialExceptions.WellKnownValueSerializationPropertyNotDirectlySettable(); + throw SpatialExceptions.WellKnownValueSerializationPropertyNotDirectlySettable( + + ); } DbSpatialServices resolvedServices = DbSpatialServices.Default; diff --git a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Common/TypeSystem.cs b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Common/TypeSystem.cs index a314f32616e..243880497d6 100644 --- a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Common/TypeSystem.cs +++ b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Common/TypeSystem.cs @@ -177,8 +177,8 @@ params Type[] typeArgs .GetMethods(BindingFlags.Static | BindingFlags.Public) .ToLookup(m => m.Name); } - MethodInfo mi = _sequenceMethods[name].FirstOrDefault( - m => ArgsMatchExact(m, args, typeArgs) + MethodInfo mi = _sequenceMethods[name].FirstOrDefault(m => + ArgsMatchExact(m, args, typeArgs) ); if (mi == null) return null; @@ -210,8 +210,8 @@ params Type[] typeArgs .GetMethods(BindingFlags.Static | BindingFlags.Public) .ToLookup(m => m.Name); } - MethodInfo mi = _queryMethods[name].FirstOrDefault( - m => ArgsMatchExact(m, args, typeArgs) + MethodInfo mi = _queryMethods[name].FirstOrDefault(m => + ArgsMatchExact(m, args, typeArgs) ); if (mi == null) throw Error.NoMethodInTypeMatchingArguments(typeof(Queryable)); diff --git a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/QueryConverter.cs b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/QueryConverter.cs index 8ca1669ff4e..cf46ad1f917 100644 --- a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/QueryConverter.cs +++ b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/QueryConverter.cs @@ -2454,8 +2454,8 @@ private SqlNode VisitContains(Expression sequence, Expression value) SqlExpression expr = this.VisitExpression(value); List list = values .OfType() - .Select( - v => sql.ValueFromObject(v, elemType, true, this.dominatingExpression) + .Select(v => + sql.ValueFromObject(v, elemType, true, this.dominatingExpression) ) .ToList(); return this.GenerateInExpression(expr, list); diff --git a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/SqlRetyper.cs b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/SqlRetyper.cs index 9d4570fa266..da73abf2a26 100644 --- a/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/SqlRetyper.cs +++ b/mono/mcs/class/referencesource/System.Data.Linq/SqlClient/Query/SqlRetyper.cs @@ -290,8 +290,8 @@ internal override SqlExpression VisitSearchedCase(SqlSearchedCase c) // coerce each one foreach ( - SqlWhen when in c.Whens.Where( - w => w.Value.SqlType != type && !w.Value.SqlType.IsRuntimeOnlyType + SqlWhen when in c.Whens.Where(w => + w.Value.SqlType != type && !w.Value.SqlType.IsRuntimeOnlyType ) ) { @@ -330,8 +330,8 @@ internal override SqlExpression VisitSimpleCase(SqlSimpleCase c) // coerce each one foreach ( - SqlWhen when in c.Whens.Where( - w => w.Value.SqlType != type && !w.Value.SqlType.IsRuntimeOnlyType + SqlWhen when in c.Whens.Where(w => + w.Value.SqlType != type && !w.Value.SqlType.IsRuntimeOnlyType ) ) { diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/DataTable.cs b/mono/mcs/class/referencesource/System.Data/System/Data/DataTable.cs index d4227e545e2..70183df29d5 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/DataTable.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/DataTable.cs @@ -5092,12 +5092,9 @@ public DataRow[] Select(string filterExpression) ObjectID, filterExpression ); - return new Select( - this, - filterExpression, - "", - DataViewRowState.CurrentRows - ).SelectRows(); + return new Select(this, filterExpression, "", DataViewRowState.CurrentRows).SelectRows( + + ); } /// diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/OleDb/OleDbCommand.cs b/mono/mcs/class/referencesource/System.Data/System/Data/OleDb/OleDbCommand.cs index f06366ae2fe..50358c03ed6 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/OleDb/OleDbCommand.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/OleDb/OleDbCommand.cs @@ -1616,8 +1616,9 @@ private bool PropertiesOnCommand(bool throwNotSupported) { if (null != propSet) { - UnsafeNativeMethods.ICommandProperties icommandProperties = - ICommandProperties(); + UnsafeNativeMethods.ICommandProperties icommandProperties = ICommandProperties( + + ); Bid.Trace(" %d#\n", ObjectID); OleDbHResult hr = icommandProperties.SetProperties( diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionClosed.cs b/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionClosed.cs index da3eafa531f..f030d7b6d2e 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionClosed.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionClosed.cs @@ -127,8 +127,9 @@ private DbConnectionClosedBusy() internal sealed class DbConnectionOpenBusy : DbConnectionBusy { // Open Connection, Currently Busy - closing connection - internal static readonly DbConnectionInternal SingletonInstance = - new DbConnectionOpenBusy(); // singleton object + internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionOpenBusy( + + ); // singleton object private DbConnectionOpenBusy() : base(ConnectionState.Open) { } diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs b/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs index effa513925e..c6cfd8a2fce 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/ProviderBase/DbConnectionPoolGroup.cs @@ -158,7 +158,9 @@ internal int Clear() DbConnectionFactory connectionFactory = pool.ConnectionFactory; #if !MOBILE - connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement(); + connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement( + + ); #endif connectionFactory.QueuePoolForRelease(pool, true); } @@ -236,7 +238,9 @@ internal DbConnectionPool GetConnectionPool(DbConnectionFactory connectionFactor "No other pool with current identity should exist at this point" ); #if !MOBILE - connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment(); + connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Increment( + + ); #endif pool = newPool; newPool = null; @@ -337,7 +341,9 @@ internal bool Prune() DbConnectionFactory connectionFactory = pool.ConnectionFactory; #if !MOBILE - connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement(); + connectionFactory.PerformanceCounters.NumberOfActiveConnectionPools.Decrement( + + ); #endif connectionFactory.QueuePoolForRelease(pool, false); } diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlSymmetricKeyCache.cs b/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlSymmetricKeyCache.cs index 8ec0a233e27..24b6df36a03 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlSymmetricKeyCache.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/SqlSymmetricKeyCache.cs @@ -23,8 +23,9 @@ namespace System.Data.SqlClient sealed internal class SqlSymmetricKeyCache { private readonly MemoryCache _cache; - private static readonly SqlSymmetricKeyCache _singletonInstance = - new SqlSymmetricKeyCache(); + private static readonly SqlSymmetricKeyCache _singletonInstance = new SqlSymmetricKeyCache( + + ); private SqlSymmetricKeyCache() { @@ -98,12 +99,11 @@ out trustedKeyPaths || // (trustedKeyPaths.Where(s => s.Equals(keyInfo.keyPath, StringComparison.InvariantCultureIgnoreCase)).Count() == 0)) { ( - trustedKeyPaths.Any( - s => - s.Equals( - keyInfo.keyPath, - StringComparison.InvariantCultureIgnoreCase - ) + trustedKeyPaths.Any(s => + s.Equals( + keyInfo.keyPath, + StringComparison.InvariantCultureIgnoreCase + ) ) == false ) ) diff --git a/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParser.cs b/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParser.cs index 408c1115d66..eaddbf1d066 100644 --- a/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParser.cs +++ b/mono/mcs/class/referencesource/System.Data/System/Data/SqlClient/TdsParser.cs @@ -10004,8 +10004,9 @@ internal void TdsLogin( // if (null == s_nicAddress) - s_nicAddress = - TdsParserStaticMethods.GetNetworkPhysicalAddressForTdsLoginOnly(); + s_nicAddress = TdsParserStaticMethods.GetNetworkPhysicalAddressForTdsLoginOnly( + + ); _physicalStateObj.WriteByteArray(s_nicAddress, s_nicAddress.Length, 0); diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Configuration/IdentityConfiguration.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Configuration/IdentityConfiguration.cs index 4a981ec09ca..003de99d424 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Configuration/IdentityConfiguration.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Configuration/IdentityConfiguration.cs @@ -36,8 +36,9 @@ public class IdentityConfiguration StoreLocation.LocalMachine; #pragma warning restore 1591 - ClaimsAuthenticationManager _claimsAuthenticationManager = - new ClaimsAuthenticationManager(); + ClaimsAuthenticationManager _claimsAuthenticationManager = new ClaimsAuthenticationManager( + + ); ClaimsAuthorizationManager _claimsAuthorizationManager = new ClaimsAuthorizationManager(); bool _isInitialized; SecurityTokenHandlerCollectionManager _securityTokenHandlerCollectionManager; @@ -515,7 +516,9 @@ IdentityConfigurationElement serviceElement // handlers for the system. // SecurityTokenHandlerCollectionManager manager = - SecurityTokenHandlerCollectionManager.CreateEmptySecurityTokenHandlerCollectionManager(); + SecurityTokenHandlerCollectionManager.CreateEmptySecurityTokenHandlerCollectionManager( + + ); if (serviceElement != null) { diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Diagnostics/SecurityTraceRecordHelper.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Diagnostics/SecurityTraceRecordHelper.cs index f4e8e6e078d..10b422f9778 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Diagnostics/SecurityTraceRecordHelper.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Diagnostics/SecurityTraceRecordHelper.cs @@ -293,7 +293,9 @@ internal override void WriteTo(XmlWriter writer) else { SecurityTokenHandlerCollection sthc = - SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); + SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection( + + ); if (sthc.CanWriteToken(_securityToken)) { { diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationContext.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationContext.cs index e931d666fda..ec9f9782cd7 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationContext.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationContext.cs @@ -22,7 +22,9 @@ public class WSTrustSerializationContext /// public WSTrustSerializationContext() : this( - SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager() + SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager( + + ) ) { } /// diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationHelper.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationHelper.cs index f47ed8f30b0..22e0a6597b1 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationHelper.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Protocols/WSTrust/WSTrustSerializationHelper.cs @@ -569,11 +569,15 @@ WSTrustConstantsAdapter trustConstants ); } else if ( - originalUseKeyToken.CanCreateKeyIdentifierClause() + originalUseKeyToken.CanCreateKeyIdentifierClause( + + ) ) { useKeySki.Add( - originalUseKeyToken.CreateKeyIdentifierClause() + originalUseKeyToken.CreateKeyIdentifierClause( + + ) ); } else diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/EncryptedSecurityTokenHandler.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/EncryptedSecurityTokenHandler.cs index 20b9bf70312..d8b1e7aa08f 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/EncryptedSecurityTokenHandler.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/EncryptedSecurityTokenHandler.cs @@ -87,7 +87,9 @@ public SecurityTokenSerializer KeyInfoSerializer SecurityTokenHandlerCollection sthc = (ContainingCollection != null) ? ContainingCollection - : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); + : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection( + + ); _keyInfoSerializer = new SecurityTokenSerializerAdapter(sthc); } } diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/Saml2SecurityTokenHandler.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/Saml2SecurityTokenHandler.cs index a639c4bd265..bf684da8f28 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/Saml2SecurityTokenHandler.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/Saml2SecurityTokenHandler.cs @@ -184,7 +184,9 @@ public SecurityTokenSerializer KeyInfoSerializer SecurityTokenHandlerCollection sthc = (ContainingCollection != null) ? ContainingCollection - : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); + : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection( + + ); this.keyInfoSerializer = new SecurityTokenSerializerAdapter(sthc); } } diff --git a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/SamlSecurityTokenHandler.cs b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/SamlSecurityTokenHandler.cs index a4ed7991041..4bcbffe80b4 100644 --- a/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/SamlSecurityTokenHandler.cs +++ b/mono/mcs/class/referencesource/System.IdentityModel/System/IdentityModel/Tokens/SamlSecurityTokenHandler.cs @@ -4734,7 +4734,9 @@ public SecurityTokenSerializer KeyInfoSerializer SecurityTokenHandlerCollection sthc = (ContainingCollection != null) ? ContainingCollection - : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection(); + : SecurityTokenHandlerCollection.CreateDefaultSecurityTokenHandlerCollection( + + ); _keyInfoSerializer = new SecurityTokenSerializerAdapter(sthc); } } diff --git a/mono/mcs/class/referencesource/System.Net/net/PeerToPeer/Collaboration/PeerCollaboration.cs b/mono/mcs/class/referencesource/System.Net/net/PeerToPeer/Collaboration/PeerCollaboration.cs index 78f3dee4a48..54c10daefd1 100644 --- a/mono/mcs/class/referencesource/System.Net/net/PeerToPeer/Collaboration/PeerCollaboration.cs +++ b/mono/mcs/class/referencesource/System.Net/net/PeerToPeer/Collaboration/PeerCollaboration.cs @@ -727,8 +727,9 @@ PeerApplicationRegistrationType type // Convert PeerApplication.Guid into native GUID struct // - PEER_APPLICATION_REGISTRATION_INFO appRegInfo = - new PEER_APPLICATION_REGISTRATION_INFO(); + PEER_APPLICATION_REGISTRATION_INFO appRegInfo = new PEER_APPLICATION_REGISTRATION_INFO( + + ); appRegInfo.application.guid = CollaborationHelperFunctions.ConvertGuidToGUID( application.Id ); diff --git a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceHandle.cs b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceHandle.cs index 2ee38ea3c18..a7ce19dd122 100644 --- a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceHandle.cs +++ b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceHandle.cs @@ -165,8 +165,8 @@ public void Free() IEnumerable eventsToUnbind = null; if (this.pendingOwnerEvents != null && this.pendingOwnerEvents.Count > 0) { - eventsToUnbind = this.pendingOwnerEvents.Select( - persistenceEvent => persistenceEvent.Name + eventsToUnbind = this.pendingOwnerEvents.Select(persistenceEvent => + persistenceEvent.Name ); } if (this.boundOwnerEvents != null && this.boundOwnerEvents.Count > 0) diff --git a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceStore.cs b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceStore.cs index cb45a780088..e145baabfd5 100644 --- a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceStore.cs +++ b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/DurableInstancing/InstanceStore.cs @@ -318,8 +318,8 @@ protected InstanceOwner[] GetInstanceOwners() { lock (ThisLock) { - return this.owners.Values.Select( - weakReference => (InstanceOwner)weakReference.Target + return this.owners.Values.Select(weakReference => + (InstanceOwner)weakReference.Target ) .Where(owner => owner != null) .ToArray(); diff --git a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/PersistencePipeline.cs b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/PersistencePipeline.cs index 1b1f80b2fe3..c34fb2982cd 100644 --- a/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/PersistencePipeline.cs +++ b/mono/mcs/class/referencesource/System.Runtime.DurableInstancing/System/Runtime/PersistencePipeline.cs @@ -154,9 +154,9 @@ public void Map() if (pendingValues == null) { pendingValues = - new List< - Tuple> - >(); + new List>>( + + ); } pendingValues.Add( new Tuple>( diff --git a/mono/mcs/class/referencesource/System.Runtime.Serialization/System/Xml/ArrayHelper.cs b/mono/mcs/class/referencesource/System.Runtime.Serialization/System/Xml/ArrayHelper.cs index 91d6388bc28..a5688e09c33 100644 --- a/mono/mcs/class/referencesource/System.Runtime.Serialization/System/Xml/ArrayHelper.cs +++ b/mono/mcs/class/referencesource/System.Runtime.Serialization/System/Xml/ArrayHelper.cs @@ -201,8 +201,9 @@ int count class Int16ArrayHelperWithString : ArrayHelper { - public static readonly Int16ArrayHelperWithString Instance = - new Int16ArrayHelperWithString(); + public static readonly Int16ArrayHelperWithString Instance = new Int16ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, @@ -263,8 +264,9 @@ int count class Int32ArrayHelperWithString : ArrayHelper { - public static readonly Int32ArrayHelperWithString Instance = - new Int32ArrayHelperWithString(); + public static readonly Int32ArrayHelperWithString Instance = new Int32ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, @@ -325,8 +327,9 @@ int count class Int64ArrayHelperWithString : ArrayHelper { - public static readonly Int64ArrayHelperWithString Instance = - new Int64ArrayHelperWithString(); + public static readonly Int64ArrayHelperWithString Instance = new Int64ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/Activation/AspNetPartialTrustHelpers.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/Activation/AspNetPartialTrustHelpers.cs index c40c552c650..2ee7cde1ef4 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/Activation/AspNetPartialTrustHelpers.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/Activation/AspNetPartialTrustHelpers.cs @@ -65,7 +65,9 @@ internal static bool NeedPartialTrustInvoke { aspNetPermissionSet.PermitOnly(); aspNetSecurityContext = - System.Runtime.PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow(); + System.Runtime.PartialTrustHelpers.CaptureSecurityContextNoIdentityFlow( + + ); } finally { diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/ServiceHostingEnvironment.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/ServiceHostingEnvironment.cs index e0854694607..a255f40bf48 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/ServiceHostingEnvironment.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activation/System/ServiceModel/ServiceHostingEnvironment.cs @@ -1785,8 +1785,9 @@ factory is ServiceHostFactory service.Description.Behaviors.Add(new ApplyHostConfigurationBehavior()); if ( this.multipleSiteBindingsEnabled - && service.Description.Behaviors.Find() - == null + && service.Description.Behaviors.Find( + + ) == null ) { service.Description.Behaviors.Add( diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/CorrelationHandle.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/CorrelationHandle.cs index acd939309a0..56ba32f3f0c 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/CorrelationHandle.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/CorrelationHandle.cs @@ -141,8 +141,9 @@ protected override void OnInitialize(HandleInitializationContext context) protected override void OnUninitialize(HandleInitializationContext context) { - SendReceiveExtension sendReceiveExtension = - context.GetExtension(); + SendReceiveExtension sendReceiveExtension = context.GetExtension( + + ); if (sendReceiveExtension != null) { if (this.InstanceKey != null) diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/PersistenceProviderDirectory.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/PersistenceProviderDirectory.cs index dcd04eac76e..c6b78866aa5 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/PersistenceProviderDirectory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/PersistenceProviderDirectory.cs @@ -1791,11 +1791,15 @@ static void OnComplete(AsyncResult result, Exception exception) { if (!thisPtr.isInstanceInitialized && thisPtr.canCreateInstance) { - thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowCreated(); + thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowCreated( + + ); } else { - thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowLoaded(); + thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowLoaded( + + ); } thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowLoadDuration( @@ -1850,7 +1854,9 @@ static void OnThrottleAcquired(object state, Exception asyncException) thisPtr.ownsThrottle = asyncException == null; if (thisPtr.ownsThrottle) { - thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowInMemory(); + thisPtr.ppd.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowInMemory( + + ); } thisPtr.Complete(false, asyncException); } diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/WorkflowServiceInstance.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/WorkflowServiceInstance.cs index b61449b1275..7668d4b5933 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/WorkflowServiceInstance.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/Dispatcher/WorkflowServiceInstance.cs @@ -1007,7 +1007,9 @@ void AbortInstance(Exception reason, bool isWorkflowThread, bool shouldTrackAbor this.state = State.Aborted; if (shouldTrackAbort) { - this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowAborted(); + this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowAborted( + + ); this.Controller.Abort(reason); } else @@ -1045,7 +1047,9 @@ void AbortInstance(Exception reason, bool isWorkflowThread, bool shouldTrackAbor this.state = State.Aborted; if (shouldTrackAbort) { - this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowAborted(); + this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowAborted( + + ); this.Controller.Abort(reason); } else @@ -1381,7 +1385,9 @@ protected override void OnNotifyPaused() GetCompletionState(); if (this.completionState == ActivityInstanceState.Closed) { - this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowCompleted(); + this.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowCompleted( + + ); } if (this.Controller.HasPendingTrackingRecords) @@ -5292,7 +5298,9 @@ protected override void EndPerformOperation(IAsyncResult result) if (!this.shouldTrackAbort) { - this.instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowUnloaded(); + this.instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowUnloaded( + + ); } this.Instance.AbortInstance(this.reason, true, this.shouldTrackAbort); @@ -5410,7 +5418,9 @@ protected override void EndPerformOperation(IAsyncResult result) ); } - this.Instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowSuspended(); + this.Instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowSuspended( + + ); } finally { @@ -5688,7 +5698,9 @@ ref thisPtr.parent.ownsLock ); } - thisPtr.parent.instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowSuspended(); + thisPtr.parent.instance.serviceHost.WorkflowServiceHostPerformanceCounters.WorkflowSuspended( + + ); // This is to handle a corner case where Pause is called // from an event handler: diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/InternalSendMessage.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/InternalSendMessage.cs index e38379994c8..6da86a90a40 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/InternalSendMessage.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/InternalSendMessage.cs @@ -625,8 +625,9 @@ protected override void CacheMetadata(NativeActivityMetadata metadata) protected override void Cancel(NativeActivityContext context) { - SendReceiveExtension sendReceiveExtension = - context.GetExtension(); + SendReceiveExtension sendReceiveExtension = context.GetExtension( + + ); if (sendReceiveExtension != null) { Bookmark pendingBookmark = this.extensionSendCompleteBookmark.Get(context); @@ -646,8 +647,9 @@ protected override void Cancel(NativeActivityContext context) protected override void Abort(NativeActivityAbortContext context) { - SendReceiveExtension sendReceiveExtension = - context.GetExtension(); + SendReceiveExtension sendReceiveExtension = context.GetExtension( + + ); if (sendReceiveExtension != null) { Bookmark pendingBookmark = this.extensionSendCompleteBookmark.Get(context); @@ -683,8 +685,9 @@ void CleanupResources(SendMessageInstance instance) // workflowservicehost and always use the extension. protected override void Execute(NativeActivityContext context) { - SendReceiveExtension sendReceiveExtension = - context.GetExtension(); + SendReceiveExtension sendReceiveExtension = context.GetExtension( + + ); if (sendReceiveExtension != null) { this.ExecuteUsingExtension(sendReceiveExtension, context); @@ -1541,7 +1544,9 @@ void OnPersistCompleted(NativeActivityContext context, ActivityInstance complete // Do it with or without correlation if ( instance.CorrelationSynchronizer == null - || instance.CorrelationSynchronizer.NotifyWorkflowCorrelationProcessingComplete() + || instance.CorrelationSynchronizer.NotifyWorkflowCorrelationProcessingComplete( + + ) ) { // The send complete notification has already occurred @@ -2171,8 +2176,9 @@ object state if (this.channel.State == CommunicationState.Created) { // Disable ContextManager before channel is opened - IContextManager contextManager = - this.channel.GetProperty(); + IContextManager contextManager = this.channel.GetProperty( + + ); if (contextManager != null) { contextManager.Enabled = false; diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/ReceiveMessageContent.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/ReceiveMessageContent.cs index 9fb56edf213..c377591a274 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/ReceiveMessageContent.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/ReceiveMessageContent.cs @@ -124,8 +124,8 @@ out FromRequest requestFormatter { if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage) { - internalReceiveMessage.Message = new OutArgument( - context => ((OutArgument)this.Message).Get(context) + internalReceiveMessage.Message = new OutArgument(context => + ((OutArgument)this.Message).Get(context) ); requestFormatter = null; } @@ -149,8 +149,8 @@ out FromReply responseFormatter if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage) { // do not use the formatter in this case - internalReceiveMessage.Message = new OutArgument( - context => ((OutArgument)this.Message).Get(context) + internalReceiveMessage.Message = new OutArgument(context => + ((OutArgument)this.Message).Get(context) ); responseFormatter = null; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/SendMessageContent.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/SendMessageContent.cs index 98b4a28c435..05ad52492b4 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/SendMessageContent.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/SendMessageContent.cs @@ -142,8 +142,8 @@ out ToRequest requestFormatter if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage) { // Value is a Message, do not use the formatter but directly pass it to InternalSendMessage - internalSendMessage.Message = new InArgument( - context => ((InArgument)this.Message).Get(context) + internalSendMessage.Message = new InArgument(context => + ((InArgument)this.Message).Get(context) ); requestFormatter = null; } @@ -166,8 +166,8 @@ out ToReply responseFormatter { if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage) { - internalSendMessage.Message = new InArgument( - context => ((InArgument)this.Message).Get(context) + internalSendMessage.Message = new InArgument(context => + ((InArgument)this.Message).Get(context) ); responseFormatter = null; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/TransactedReceiveScope.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/TransactedReceiveScope.cs index c088e822ff3..8848b469965 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/TransactedReceiveScope.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/TransactedReceiveScope.cs @@ -130,8 +130,8 @@ Constraint ProcessChildSubtreeConstraints() { Input = new InArgument(child) }, - Right = new InArgument( - context => typeof(TransactionScope) + Right = new InArgument(context => + typeof(TransactionScope) ) }, Then = new AssertValidation @@ -164,8 +164,8 @@ Constraint ProcessChildSubtreeConstraints() { Input = new InArgument(child) }, - Right = new InArgument( - context => typeof(CompensableActivity) + Right = new InArgument(context => + typeof(CompensableActivity) ) }, Then = new Assign diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/WorkflowUpdateableControlClient.cs b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/WorkflowUpdateableControlClient.cs index 26715b967ae..79b284bf3f9 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/WorkflowUpdateableControlClient.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Activities/System/ServiceModel/Activities/WorkflowUpdateableControlClient.cs @@ -86,7 +86,9 @@ bool SupportsTransactedInvoke if (!this.checkedBinding) { foreach ( - BindingElement bindingElement in base.Endpoint.Binding.CreateBindingElements() + BindingElement bindingElement in base.Endpoint.Binding.CreateBindingElements( + + ) ) { TransactionFlowBindingElement transactionFlowElement = diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Routing/System/ServiceModel/Routing/ProcessMessagesAsyncResult.cs b/mono/mcs/class/referencesource/System.ServiceModel.Routing/System/ServiceModel/Routing/ProcessMessagesAsyncResult.cs index 911750c6066..09457a7382d 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Routing/System/ServiceModel/Routing/ProcessMessagesAsyncResult.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Routing/System/ServiceModel/Routing/ProcessMessagesAsyncResult.cs @@ -66,7 +66,9 @@ object state messageRpc.EventTraceActivity, messageRpc.UniqueID, messageRpc.Message.Headers.Action, - messageRpc.OperationContext.EndpointDispatcher.EndpointAddress.Uri.ToString(), + messageRpc.OperationContext.EndpointDispatcher.EndpointAddress.Uri.ToString( + + ), (messageRpc.Transaction != null).ToString() ); } diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Channels/WebScriptMetadataMessageEncoderFactory.cs b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Channels/WebScriptMetadataMessageEncoderFactory.cs index e634ff0f2cc..18d85232d0d 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Channels/WebScriptMetadataMessageEncoderFactory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Channels/WebScriptMetadataMessageEncoderFactory.cs @@ -148,7 +148,9 @@ int messageOffset MessageLogger.LogMessage(ref message, MessageLoggingSource.TransportSend); } if ( - System.ServiceModel.Diagnostics.Application.TD.MessageWrittenByEncoderIsEnabled() + System.ServiceModel.Diagnostics.Application.TD.MessageWrittenByEncoderIsEnabled( + + ) && messageData != null ) { diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/HelpHtmlBuilder.cs b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/HelpHtmlBuilder.cs index 842d49e0406..c7b7f03c9d7 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/HelpHtmlBuilder.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/HelpHtmlBuilder.cs @@ -75,8 +75,8 @@ IEnumerable operations XElement firstTr = null; int rowspan = 0; foreach ( - OperationHelpInformation operationHelpInfo in operations.OrderBy( - o => FilterQueryVariables(o.UriTemplate) + OperationHelpInformation operationHelpInfo in operations.OrderBy(o => + FilterQueryVariables(o.UriTemplate) ) ) { diff --git a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/WebErrorHandler.cs b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/WebErrorHandler.cs index 42530ae7b26..55c8b5eb642 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/WebErrorHandler.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel.Web/System/ServiceModel/Dispatcher/WebErrorHandler.cs @@ -209,20 +209,18 @@ Message CreateHtmlResponse(Exception error) StreamBodyWriter bodyWriter; if (this.includeExceptionDetailInFaults) { - bodyWriter = StreamBodyWriter.CreateStreamBodyWriter( - s => - HelpHtmlBuilder - .CreateServerErrorPage(helpUri, error) - .Save(s, SaveOptions.OmitDuplicateNamespaces) + bodyWriter = StreamBodyWriter.CreateStreamBodyWriter(s => + HelpHtmlBuilder + .CreateServerErrorPage(helpUri, error) + .Save(s, SaveOptions.OmitDuplicateNamespaces) ); } else { - bodyWriter = StreamBodyWriter.CreateStreamBodyWriter( - s => - HelpHtmlBuilder - .CreateServerErrorPage(helpUri, null) - .Save(s, SaveOptions.OmitDuplicateNamespaces) + bodyWriter = StreamBodyWriter.CreateStreamBodyWriter(s => + HelpHtmlBuilder + .CreateServerErrorPage(helpUri, null) + .Save(s, SaveOptions.OmitDuplicateNamespaces) ); } Message response = new HttpStreamMessage(bodyWriter); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Activation/AspNetEnvironment.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Activation/AspNetEnvironment.cs index 85fc505b814..60b2b1c0314 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Activation/AspNetEnvironment.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Activation/AspNetEnvironment.cs @@ -360,8 +360,9 @@ internal static bool IsApplicationDomainHosted() bool isApplicationDomainHosted = false; if (AspNetEnvironment.Enabled) { - isApplicationDomainHosted = - AspNetEnvironment.IsSystemWebAssemblyLoaded(); + isApplicationDomainHosted = AspNetEnvironment.IsSystemWebAssemblyLoaded( + + ); } AspNetEnvironment.isApplicationDomainHosted = isApplicationDomainHosted; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/CallbackContextMessageHeader.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/CallbackContextMessageHeader.cs index 1ec30c45b43..34abf48c11d 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/CallbackContextMessageHeader.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/CallbackContextMessageHeader.cs @@ -79,8 +79,9 @@ ProtectionLevel protectionLevel CallbackContextHeaderNamespace ) ); - ChannelProtectionRequirements requirements = - new ChannelProtectionRequirements(); + ChannelProtectionRequirements requirements = new ChannelProtectionRequirements( + + ); requirements.IncomingSignatureParts.AddParts(header); requirements.IncomingEncryptionParts.AddParts(header); requirements.OutgoingSignatureParts.AddParts(header); @@ -101,8 +102,9 @@ ProtectionLevel protectionLevel CallbackContextHeaderNamespace ) ); - ChannelProtectionRequirements requirements = - new ChannelProtectionRequirements(); + ChannelProtectionRequirements requirements = new ChannelProtectionRequirements( + + ); requirements.IncomingSignatureParts.AddParts(header); requirements.OutgoingSignatureParts.AddParts(header); requirements.MakeReadOnly(); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelBuilder.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelBuilder.cs index 67b6db77df9..304497d99d4 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelBuilder.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelBuilder.cs @@ -91,8 +91,9 @@ public IChannelFactory BuildChannelFactory() { if (this.context != null) { - IChannelFactory factory = - this.context.BuildInnerChannelFactory(); + IChannelFactory factory = this.context.BuildInnerChannelFactory( + + ); this.context = null; return factory; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelReliableSession.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelReliableSession.cs index d5dbc116edd..300f19505e9 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelReliableSession.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ChannelReliableSession.cs @@ -743,8 +743,9 @@ UniqueId inputID { SendReceiveReliableRequestor sendReceiveRequestor = new SendReceiveReliableRequestor(); - sendReceiveRequestor.TimeoutIsSafe = - !this.ChannelSupportsOneCreateSequenceAttempt(); + sendReceiveRequestor.TimeoutIsSafe = !this.ChannelSupportsOneCreateSequenceAttempt( + + ); this.requestor = sendReceiveRequestor; } else diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ClientWebSocketTransportDuplexSessionChannel.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ClientWebSocketTransportDuplexSessionChannel.cs index 984b8198bd6..5b83c9db18c 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ClientWebSocketTransportDuplexSessionChannel.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/ClientWebSocketTransportDuplexSessionChannel.cs @@ -384,8 +384,9 @@ void RemoveIdentityMapping(bool aborting) HttpWebRequest CreateHttpWebRequest(TimeSpan timeout) { TimeoutHelper helper = new TimeoutHelper(timeout); - ChannelParameterCollection channelParameterCollection = - new ChannelParameterCollection(); + ChannelParameterCollection channelParameterCollection = new ChannelParameterCollection( + + ); HttpWebRequest request; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/HttpsChannelFactory.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/HttpsChannelFactory.cs index f87426fdca8..f53bbb14e16 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/HttpsChannelFactory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/HttpsChannelFactory.cs @@ -40,7 +40,9 @@ BindingContext context ) { this.sslCertificateValidator = - credentials.ServiceCertificate.SslCertificateAuthentication.GetCertificateValidator(); + credentials.ServiceCertificate.SslCertificateAuthentication.GetCertificateValidator( + + ); this.remoteCertificateValidationCallback = new RemoteCertificateValidationCallback( RemoteCertificateValidationCallback ); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/NamedPipeChannelFactory.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/NamedPipeChannelFactory.cs index 2a6e660dfd9..c4c7cfa8a4f 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/NamedPipeChannelFactory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/NamedPipeChannelFactory.cs @@ -41,7 +41,9 @@ public override string Scheme static string GetConnectionGroupName(NamedPipeTransportBindingElement bindingElement) { return bindingElement.ConnectionPoolSettings.GroupName - + bindingElement.PipeSettings.ApplicationContainerSettings.GetConnectionGroupSuffix(); + + bindingElement.PipeSettings.ApplicationContainerSettings.GetConnectionGroupSuffix( + + ); } internal override IConnectionInitiator GetConnectionInitiator() diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/PeerUnsafeNativeMethods.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/PeerUnsafeNativeMethods.cs index 5dd3f1dbe1c..cb512de14b9 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/PeerUnsafeNativeMethods.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/PeerUnsafeNativeMethods.cs @@ -313,8 +313,9 @@ public static CriticalAllocHandleSocketAddressList FromAddressCount(int count) static new CriticalAllocHandleSocketAddressList FromSize(int size) { - CriticalAllocHandleSocketAddressList result = - new CriticalAllocHandleSocketAddressList(); + CriticalAllocHandleSocketAddressList result = new CriticalAllocHandleSocketAddressList( + + ); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityBindingElementImporter.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityBindingElementImporter.cs index 0facc197536..01722c5118c 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityBindingElementImporter.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityBindingElementImporter.cs @@ -326,8 +326,9 @@ PolicyConversionContext policyContext isContractAssociatedWithAtLeastOneOtherBinding = false; } - ICollection endpointBindingAssertions = - policyContext.GetBindingAssertions(); + ICollection endpointBindingAssertions = policyContext.GetBindingAssertions( + + ); this.ImportProtectionAssertions( endpointBindingAssertions, out endpointSignedParts, diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityChannelFactory.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityChannelFactory.cs index 1a6dd46842f..1c1275a5035 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityChannelFactory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SecurityChannelFactory.cs @@ -562,8 +562,9 @@ as TransportSecurityBindingElement if (InnerChannel != null) { - IChannelBindingProvider cbp = - InnerChannel.GetProperty(); + IChannelBindingProvider cbp = InnerChannel.GetProperty( + + ); if (cbp != null) { cbp.EnableChannelBindingSupport(); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SessionConnectionReader.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SessionConnectionReader.cs index b227d9d5417..9009a6f7248 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SessionConnectionReader.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SessionConnectionReader.cs @@ -768,8 +768,9 @@ Exception exception } String primaryIdentity = String.Empty; - SecurityMessageProperty clientSecurity = - securityUpgradeAcceptor.GetRemoteSecurity(); + SecurityMessageProperty clientSecurity = securityUpgradeAcceptor.GetRemoteSecurity( + + ); if (clientSecurity != null) { primaryIdentity = GetIdentityNameFromContext(clientSecurity); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SymmetricSecurityBindingElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SymmetricSecurityBindingElement.cs index e616c0fd5d7..fd3354de831 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SymmetricSecurityBindingElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/SymmetricSecurityBindingElement.cs @@ -183,8 +183,9 @@ BindingContext issuerBindingContext ); } - SymmetricSecurityProtocolFactory protocolFactory = - new SymmetricSecurityProtocolFactory(); + SymmetricSecurityProtocolFactory protocolFactory = new SymmetricSecurityProtocolFactory( + + ); if (isForService) { base.ApplyAuditBehaviorSettings(context, protocolFactory); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransactionFlowBindingElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransactionFlowBindingElement.cs index d00ade9e0d9..4433ea5145c 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransactionFlowBindingElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransactionFlowBindingElement.cs @@ -292,8 +292,9 @@ BindingContext context ); } - IChannelListener innerListener = - context.BuildInnerChannelListener(); + IChannelListener innerListener = context.BuildInnerChannelListener( + + ); TransactionChannelListener listener = new TransactionChannelListener( this.transactionProtocol, diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransportSecurityBindingElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransportSecurityBindingElement.cs index 0b724c428b0..eac10a98a9d 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransportSecurityBindingElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Channels/TransportSecurityBindingElement.cs @@ -87,8 +87,9 @@ BindingContext issuerBindingContext "credentialsManager" ); - TransportSecurityProtocolFactory protocolFactory = - new TransportSecurityProtocolFactory(); + TransportSecurityProtocolFactory protocolFactory = new TransportSecurityProtocolFactory( + + ); if (isForService) base.ApplyAuditBehaviorSettings(context, protocolFactory); base.ConfigureProtocolFactory( diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/ServiceModelExtensionCollectionElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/ServiceModelExtensionCollectionElement.cs index b1cd91e07e2..f3c4987806a 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/ServiceModelExtensionCollectionElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/ServiceModelExtensionCollectionElement.cs @@ -499,18 +499,17 @@ childExtensionElement as RemoveBehaviorElement ).Name; if (!string.IsNullOrEmpty(childExtensionElementName)) { - parentExtensionElements.RemoveAll( - element => - element != null - && element.ConfigurationElementName == childExtensionElementName + parentExtensionElements.RemoveAll(element => + element != null + && element.ConfigurationElementName == childExtensionElementName ); } } else { Type childExtensionElementType = childExtensionElement.GetType(); - parentExtensionElements.RemoveAll( - element => element != null && element.GetType() == childExtensionElementType + parentExtensionElements.RemoveAll(element => + element != null && element.GetType() == childExtensionElementType ); parentExtensionElements.Add(childExtensionElement); } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/SslStreamSecurityElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/SslStreamSecurityElement.cs index 088364ad584..23d87af024b 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/SslStreamSecurityElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/SslStreamSecurityElement.cs @@ -45,8 +45,9 @@ public override void ApplyConfiguration(BindingElement bindingElement) protected internal override BindingElement CreateBindingElement() { - SslStreamSecurityBindingElement sslBindingElement = - new SslStreamSecurityBindingElement(); + SslStreamSecurityBindingElement sslBindingElement = new SslStreamSecurityBindingElement( + + ); this.ApplyConfiguration(sslBindingElement); return sslBindingElement; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/UseManagedPresentationElement.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/UseManagedPresentationElement.cs index 719d87ac7b8..2dc3aa877d7 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/UseManagedPresentationElement.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Configuration/UseManagedPresentationElement.cs @@ -17,8 +17,9 @@ public override Type BindingElementType protected internal override BindingElement CreateBindingElement() { - UseManagedPresentationBindingElement binding = - new UseManagedPresentationBindingElement(); + UseManagedPresentationBindingElement binding = new UseManagedPresentationBindingElement( + + ); this.ApplyConfiguration(binding); return binding; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ClientCredentials.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ClientCredentials.cs index 90e6b63a17f..c4f655865c6 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ClientCredentials.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ClientCredentials.cs @@ -195,7 +195,9 @@ public SecurityTokenHandlerCollectionManager SecurityTokenHandlerCollectionManag if (this.securityTokenHandlerCollectionManager == null) { this.securityTokenHandlerCollectionManager = - SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager(); + SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager( + + ); } } } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/MetadataExchangeClient.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/MetadataExchangeClient.cs index 57ce94996e7..8e515806c5e 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/MetadataExchangeClient.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/MetadataExchangeClient.cs @@ -201,7 +201,9 @@ internal XmlDictionaryReaderQuotas ReaderQuotas if (bindingElement != null) { this.readerQuotas = - bindingElement.GetIndividualProperty(); + bindingElement.GetIndividualProperty( + + ); } } } @@ -1482,8 +1484,9 @@ object state : base(callback, state) { message = MetadataReferenceRetriever.CreateGetMessage(messageVersion); - ((IClientChannel)metadataClient).OperationTimeout = - timeoutHelper.RemainingTime(); + ((IClientChannel)metadataClient).OperationTimeout = timeoutHelper.RemainingTime( + + ); IAsyncResult result = metadataClient.BeginGet( message, Fx.ThunkCallback(new AsyncCallback(this.RequestCallback)), @@ -1538,9 +1541,9 @@ void HandleResult(IAsyncResult result) new InvalidOperationException( SR.GetString( SR.SFxBadMetadataReference, - ( - (IClientChannel)metadataClient - ).RemoteAddress.Uri.ToString() + ((IClientChannel)metadataClient).RemoteAddress.Uri.ToString( + + ) ) ) ); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ServiceMetadataExtension.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ServiceMetadataExtension.cs index fbf0a48f4ec..26df77c4396 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ServiceMetadataExtension.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/ServiceMetadataExtension.cs @@ -1517,8 +1517,9 @@ static Message CreateRedirectMessage(string redirectedDestination) static Message CreateHttpResponseMessage(HttpStatusCode code) { Message message = new NullMessage(); - HttpResponseMessageProperty httpResponseProperty = - new HttpResponseMessageProperty(); + HttpResponseMessageProperty httpResponseProperty = new HttpResponseMessageProperty( + + ); httpResponseProperty.StatusCode = code; message.Properties.Add(HttpResponseMessageProperty.Name, httpResponseProperty); return message; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/TypeLoader.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/TypeLoader.cs index 3a947cb2837..1f1e33567e4 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/TypeLoader.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/TypeLoader.cs @@ -116,7 +116,9 @@ out actualContractAttribute serviceType ); foreach ( - ContractDescription inheritedContract in contractDescription.GetInheritedContracts() + ContractDescription inheritedContract in contractDescription.GetInheritedContracts( + + ) ) { UpdateContractDescriptionWithAttributesFromServiceType( diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlEndpointConversionContext.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlEndpointConversionContext.cs index 7e172ed9751..e495d609e54 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlEndpointConversionContext.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlEndpointConversionContext.cs @@ -75,7 +75,9 @@ internal IEnumerable ExportExtensions get { foreach ( - IWsdlExportExtension extension in endpoint.Behaviors.FindAll() + IWsdlExportExtension extension in endpoint.Behaviors.FindAll( + + ) ) { yield return extension; @@ -91,7 +93,9 @@ IWsdlExportExtension extension in endpoint } foreach ( - IWsdlExportExtension extension in endpoint.Contract.Behaviors.FindAll() + IWsdlExportExtension extension in endpoint.Contract.Behaviors.FindAll( + + ) ) { yield return extension; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlHelper.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlHelper.cs index 2f5ffebff1a..8870cb35628 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlHelper.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Description/WsdlHelper.cs @@ -308,8 +308,8 @@ string elementName private static void VerifyContractNamespace(List wsdls) { - IEnumerable contractWsdls = wsdls.Where( - serviceDescription => serviceDescription.PortTypes.Count > 0 + IEnumerable contractWsdls = wsdls.Where(serviceDescription => + serviceDescription.PortTypes.Count > 0 ); if (contractWsdls.Count() > 1) { diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Diagnostics/ServicePerformanceCountersBase.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Diagnostics/ServicePerformanceCountersBase.cs index 27053b68ea2..c05694d2d6d 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Diagnostics/ServicePerformanceCountersBase.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Diagnostics/ServicePerformanceCountersBase.cs @@ -239,8 +239,9 @@ internal static string GetFriendlyInstanceName(ServiceHostBase serviceHost) static bool TryGetFullVirtualPath(ServiceHostBase serviceHost, out string uri) { - VirtualPathExtension pathExtension = - serviceHost.Extensions.Find(); + VirtualPathExtension pathExtension = serviceHost.Extensions.Find( + + ); if (pathExtension == null) { uri = null; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/AsyncMethodInvoker.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/AsyncMethodInvoker.cs index 40d76659313..f53f494292b 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/AsyncMethodInvoker.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/AsyncMethodInvoker.cs @@ -462,11 +462,9 @@ void EnsureIsInitialized() // Only pass locals byref because InvokerUtil may store temporary results in the byref. // If two threads both reference this.count, temporary results may interact. int inputParameterCount; - InvokeBeginDelegate invokeBeginDelegate = - new InvokerUtil().GenerateInvokeBeginDelegate( - this.beginMethod, - out inputParameterCount - ); + InvokeBeginDelegate invokeBeginDelegate = new InvokerUtil( + + ).GenerateInvokeBeginDelegate(this.beginMethod, out inputParameterCount); this.inputParameterCount = inputParameterCount; int outputParameterCount; diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/MessageQueryTable.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/MessageQueryTable.cs index 974ddd48646..962cfdf3927 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/MessageQueryTable.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Dispatcher/MessageQueryTable.cs @@ -134,9 +134,9 @@ MessageBuffer buffer public IEnumerator> GetEnumerator() { - return ( - (ICollection>)this.dictionary - ).GetEnumerator(); + return ((ICollection>)this.dictionary).GetEnumerator( + + ); } IEnumerator IEnumerable.GetEnumerator() @@ -351,8 +351,9 @@ class Enumerator : IEnumerator> public Enumerator(Enumerable enumerable) { - this.outerEnumerator = - enumerable.table.collectionsByType.Values.GetEnumerator(); + this.outerEnumerator = enumerable.table.collectionsByType.Values.GetEnumerator( + + ); this.enumerable = enumerable; } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/MessageSecurityVersion.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/MessageSecurityVersion.cs index 66428427024..f1ad95d2881 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/MessageSecurityVersion.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/MessageSecurityVersion.cs @@ -102,7 +102,9 @@ class WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityP : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11MessageSecurityVersion(); + new WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { @@ -137,7 +139,9 @@ class WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityP : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10MessageSecurityVersion(); + new WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { @@ -172,7 +176,9 @@ class WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityP : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10MessageSecurityVersion(); + new WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { @@ -207,7 +213,9 @@ class WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurity : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10MessageSecurityVersion(); + new WSSecurity10WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { @@ -242,7 +250,9 @@ class WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12MessageSecuri : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12MessageSecurityVersion(); + new WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { @@ -277,7 +287,9 @@ class WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurity : MessageSecurityVersion { static MessageSecurityVersion instance = - new WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10MessageSecurityVersion(); + new WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10MessageSecurityVersion( + + ); public static MessageSecurityVersion Instance { diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/ClientCredentialsSecurityTokenManager.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/ClientCredentialsSecurityTokenManager.cs index 29e4dea227c..2684cf38064 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/ClientCredentialsSecurityTokenManager.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/ClientCredentialsSecurityTokenManager.cs @@ -547,7 +547,9 @@ X509SecurityTokenAuthenticator CreateServerSslX509TokenAuthenticator() if (parent.ServiceCertificate.SslCertificateAuthentication != null) { return new X509SecurityTokenAuthenticator( - parent.ServiceCertificate.SslCertificateAuthentication.GetCertificateValidator(), + parent.ServiceCertificate.SslCertificateAuthentication.GetCertificateValidator( + + ), false ); } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/IdentityModelServiceAuthorizationManager.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/IdentityModelServiceAuthorizationManager.cs index 86183e9b539..877adaa9224 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/IdentityModelServiceAuthorizationManager.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/IdentityModelServiceAuthorizationManager.cs @@ -693,8 +693,8 @@ string authenticationMethod ) { System.Security.Claims.Claim authenticationMethodClaim = - claimsIdentity.Claims.FirstOrDefault( - claim => claim.Type == System.Security.Claims.ClaimTypes.AuthenticationMethod + claimsIdentity.Claims.FirstOrDefault(claim => + claim.Type == System.Security.Claims.ClaimTypes.AuthenticationMethod ); if (authenticationMethodClaim == null) @@ -718,8 +718,8 @@ string authenticationInstant // the issuer for this claim should always be the default issuer. string issuerName = ClaimsIdentity.DefaultIssuer; System.Security.Claims.Claim authenticationInstantClaim = - claimsIdentity.Claims.FirstOrDefault( - claim => claim.Type == System.Security.Claims.ClaimTypes.AuthenticationInstant + claimsIdentity.Claims.FirstOrDefault(claim => + claim.Type == System.Security.Claims.ClaimTypes.AuthenticationInstant ); if (authenticationInstantClaim == null) diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InfoCardHelper.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InfoCardHelper.cs index 8085e0d9729..52607c2bbde 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InfoCardHelper.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InfoCardHelper.cs @@ -598,8 +598,9 @@ Binding currentStsBinding } BindingElementCollection bindingElements = currentStsBinding.CreateBindingElements(); - SecurityBindingElement secBindingElement = - bindingElements.Find(); + SecurityBindingElement secBindingElement = bindingElements.Find( + + ); return TryGetNextStsIssuedTokenParameters(secBindingElement); } diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InitiatorSessionSymmetricMessageSecurityProtocol.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InitiatorSessionSymmetricMessageSecurityProtocol.cs index 108ff0f2937..c9b476a7dde 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InitiatorSessionSymmetricMessageSecurityProtocol.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/InitiatorSessionSymmetricMessageSecurityProtocol.cs @@ -313,8 +313,9 @@ SecurityProtocolCorrelationState correlationState out sourceToken, out tokenParameters ); - SecurityProtocolCorrelationState newCorrelationState = - CreateCorrelationStateIfRequired(); + SecurityProtocolCorrelationState newCorrelationState = CreateCorrelationStateIfRequired( + + ); IList supportingTokens; this.TryGetSupportingTokens( this.SecurityProtocolFactory, diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionSecurityTokenAuthenticator.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionSecurityTokenAuthenticator.cs index a079c760c2e..7120d013c12 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionSecurityTokenAuthenticator.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionSecurityTokenAuthenticator.cs @@ -1019,7 +1019,9 @@ internal static void RemoveCachedTokensIfRequired(SecurityMessageProperty securi return; } ILogonTokenCacheManager logonManager = - OperationContext.Current.EndpointDispatcher.ChannelDispatcher.Listener.GetProperty(); + OperationContext.Current.EndpointDispatcher.ChannelDispatcher.Listener.GetProperty( + + ); Collection sctCaches = OperationContext.Current.EndpointDispatcher.ChannelDispatcher.Listener.GetProperty< Collection @@ -1625,7 +1627,9 @@ out listener ) { ServiceAuthenticationManager serviceAuthenticationManager = - this.authenticator.IssuerBindingContext.BindingParameters.Find(); + this.authenticator.IssuerBindingContext.BindingParameters.Find( + + ); if (serviceAuthenticationManager != null) { endpointDispatcher.DispatchRuntime.ServiceAuthenticationManager = diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionServerSettings.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionServerSettings.cs index 762a297b5e6..e181f357212 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionServerSettings.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SecuritySessionServerSettings.cs @@ -779,8 +779,9 @@ internal IChannelAcceptor CreateAcceptor() new InvalidOperationException(SR.GetString(SR.SSSSCreateAcceptor)) ); } - object listenerSecurityState = - this.sessionProtocolFactory.CreateListenerSecurityState(); + object listenerSecurityState = this.sessionProtocolFactory.CreateListenerSecurityState( + + ); if (typeof(TChannel) == typeof(IReplySessionChannel)) { this.channelAcceptor = new SecuritySessionChannelAcceptor( diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SendSecurityHeader.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SendSecurityHeader.cs index 2ab3a081dac..f3c0f938c53 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SendSecurityHeader.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/SendSecurityHeader.cs @@ -855,8 +855,9 @@ MessageVersion messageVersion ); } } - SendSecurityHeaderElement[] basicTokensXml = - elementContainer.GetBasicSupportingTokens(); + SendSecurityHeaderElement[] basicTokensXml = elementContainer.GetBasicSupportingTokens( + + ); if (basicTokensXml != null) { for (int i = 0; i < basicTokensXml.Length; ++i) diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/Tokens/X509SecurityTokenParameters.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/Tokens/X509SecurityTokenParameters.cs index 0c684ff1ccb..e34398f193a 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/Tokens/X509SecurityTokenParameters.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/Tokens/X509SecurityTokenParameters.cs @@ -143,10 +143,14 @@ out x509KeyIdentifierClause if (result == null) result = - token.CreateKeyIdentifierClause(); + token.CreateKeyIdentifierClause( + + ); if (result == null) result = - token.CreateKeyIdentifierClause(); + token.CreateKeyIdentifierClause( + + ); } else result = token.CreateKeyIdentifierClause(); diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSSecurityOneDotZeroReceiveSecurityHeader.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSSecurityOneDotZeroReceiveSecurityHeader.cs index 3376b215c89..de7ed977601 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSSecurityOneDotZeroReceiveSecurityHeader.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSSecurityOneDotZeroReceiveSecurityHeader.cs @@ -412,8 +412,9 @@ bool hasAtLeastOneSupportingTokenExpectedToBeSigned if (!encryptBeforeSign && id != null) { - XmlDictionaryReader decryptedHeaderReader = - decryptedHeader.GetHeaderReader(); + XmlDictionaryReader decryptedHeaderReader = decryptedHeader.GetHeaderReader( + + ); headerSigned = EnsureDigestValidityIfIdMatches( signedInfo, id, diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrustChannelFactory.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrustChannelFactory.cs index ffadf0c64ee..dbfd9a002ca 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrustChannelFactory.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/Security/WSTrustChannelFactory.cs @@ -66,7 +66,9 @@ class WSTrustChannelLockedProperties SecurityTokenResolver _securityTokenResolver; SecurityTokenResolver _useKeyTokenResolver; SecurityTokenHandlerCollectionManager _securityTokenHandlerCollectionManager = - SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager(); + SecurityTokenHandlerCollectionManager.CreateDefaultSecurityTokenHandlerCollectionManager( + + ); // // These serializers determine how the channels serialize RST and RSTR messages. diff --git a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceConfiguration.cs b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceConfiguration.cs index d4d834b0d10..c21fedd9077 100644 --- a/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceConfiguration.cs +++ b/mono/mcs/class/referencesource/System.ServiceModel/System/ServiceModel/ServiceConfiguration.cs @@ -210,8 +210,8 @@ public ServiceEndpoint AddServiceEndpoint(Type contractType, Binding binding, Ur ContractDescription contract = this.host.ImplementedContracts == null ? null - : this.host.ImplementedContracts.Values.FirstOrDefault( - implementedContract => implementedContract.ContractType == contractType + : this.host.ImplementedContracts.Values.FirstOrDefault(implementedContract => + implementedContract.ContractType == contractType ); if (contract == null) { @@ -307,15 +307,11 @@ public Collection EnableProtocol(Binding protocol) { // don't generate endpoints for contracts that serve as the base type for other reflected contracts IEnumerable contracts = this.host.ImplementedContracts.Values; - IEnumerable mostSpecificContracts = contracts.Where( - contract => - contracts.All( - otherContract => - object.ReferenceEquals(contract, otherContract) - || !contract.ContractType.IsAssignableFrom( - otherContract.ContractType - ) - ) + IEnumerable mostSpecificContracts = contracts.Where(contract => + contracts.All(otherContract => + object.ReferenceEquals(contract, otherContract) + || !contract.ContractType.IsAssignableFrom(otherContract.ContractType) + ) ); foreach (var uri in this.host.BaseAddresses) diff --git a/mono/mcs/class/referencesource/System.Web.DataVisualization/Common/ChartTypes/BoxPlotChart.cs b/mono/mcs/class/referencesource/System.Web.DataVisualization/Common/ChartTypes/BoxPlotChart.cs index 56b99e4ec3d..c78d966bb5b 100644 --- a/mono/mcs/class/referencesource/System.Web.DataVisualization/Common/ChartTypes/BoxPlotChart.cs +++ b/mono/mcs/class/referencesource/System.Web.DataVisualization/Common/ChartTypes/BoxPlotChart.cs @@ -2016,8 +2016,9 @@ internal static void CalculateBoxPlotFromLinkedSeries(Series boxPlotSeries) foreach (string val in attrValues) { boxPlotSeries.Points.AddY(0.0); - boxPlotSeries.Points[pointIndex++][CustomPropertyName.BoxPlotSeries] = - val.Trim(); + boxPlotSeries.Points[pointIndex++][CustomPropertyName.BoxPlotSeries] = val.Trim( + + ); } } diff --git a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/FilterRepeater.cs b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/FilterRepeater.cs index 9352b8d70e1..1b1acc0936e 100644 --- a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/FilterRepeater.cs +++ b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/FilterRepeater.cs @@ -350,13 +350,9 @@ public virtual IEnumerable GetWhereParameters(IDynamicDataSource data { // Add all the specific filters as where parameters return GetFilterControls() - .Select( - filter => - (Parameter) - new DynamicControlParameter(filter.UniqueID) - { - Name = filter.DataField, - } + .Select(filter => + (Parameter) + new DynamicControlParameter(filter.UniqueID) { Name = filter.DataField, } ); } diff --git a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/MetaTable.cs b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/MetaTable.cs index dc6d975437c..6aa5b88bc6f 100644 --- a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/MetaTable.cs +++ b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/MetaTable.cs @@ -745,10 +745,9 @@ private IDictionary GetColumnGroupingOrder() // Group columns that have groups by group names. Then put them into a dictionary from group name -> // minimum column order so that groups are "stick" close together. return Columns - .Where( - c => - c.Metadata.DisplayAttribute != null - && !String.IsNullOrEmpty(c.Metadata.DisplayAttribute.GetGroupName()) + .Where(c => + c.Metadata.DisplayAttribute != null + && !String.IsNullOrEmpty(c.Metadata.DisplayAttribute.GetGroupName()) ) .GroupBy(c => c.Metadata.DisplayAttribute.GetGroupName()) .ToDictionary(cg => cg.Key, cg => cg.Min(c => GetColumnOrder(c))); diff --git a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/ModelProviders/EFAssociationProvider.cs b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/ModelProviders/EFAssociationProvider.cs index 464ff61ba85..565b749a1c4 100644 --- a/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/ModelProviders/EFAssociationProvider.cs +++ b/mono/mcs/class/referencesource/System.Web.DynamicData/DynamicData/ModelProviders/EFAssociationProvider.cs @@ -37,8 +37,8 @@ public EFAssociationProvider(EFColumnProvider column, NavigationProperty navigat { EntityType value = (EntityType) navigationProperty - .ToEndMember.TypeUsage.EdmType.MetadataProperties.Single( - prop => prop.Name == "ElementType" + .ToEndMember.TypeUsage.EdmType.MetadataProperties.Single(prop => + prop.Name == "ElementType" ) .Value; ToTable = parentEntityModel.TableEndLookup[value]; @@ -95,8 +95,8 @@ public EFAssociationProvider(EFColumnProvider column, NavigationProperty navigat else { // If any of the foreign keys are also PKs, set the flag - IsPrimaryKeyInThisTable = foreignKeyNames.Any( - fkName => primaryKeyNames.Contains(fkName, StringComparer.OrdinalIgnoreCase) + IsPrimaryKeyInThisTable = foreignKeyNames.Any(fkName => + primaryKeyNames.Contains(fkName, StringComparer.OrdinalIgnoreCase) ); } @@ -181,8 +181,8 @@ bool checkRelationshipType AssociationType relationshipType = (AssociationType) navigationProperty.RelationshipType; ReferentialConstraint constraint = - relationshipType.ReferentialConstraints.FirstOrDefault( - c => c.ToRole == navigationProperty.ToEndMember + relationshipType.ReferentialConstraints.FirstOrDefault(c => + c.ToRole == navigationProperty.ToEndMember ); if (constraint != null) { diff --git a/mono/mcs/class/referencesource/System.Web.Services/System/Web/Services/Discovery/DiscoveryClientProtocol.cs b/mono/mcs/class/referencesource/System.Web.Services/System/Web/Services/Discovery/DiscoveryClientProtocol.cs index 5fa4544c239..9267229898f 100644 --- a/mono/mcs/class/referencesource/System.Web.Services/System/Web/Services/Discovery/DiscoveryClientProtocol.cs +++ b/mono/mcs/class/referencesource/System.Web.Services/System/Web/Services/Discovery/DiscoveryClientProtocol.cs @@ -30,8 +30,9 @@ public class DiscoveryClientProtocol : HttpWebClientProtocol { private DiscoveryClientReferenceCollection references = new DiscoveryClientReferenceCollection(); - private DiscoveryClientDocumentCollection documents = - new DiscoveryClientDocumentCollection(); + private DiscoveryClientDocumentCollection documents = new DiscoveryClientDocumentCollection( + + ); private Hashtable inlinedSchemas = new Hashtable(); private ArrayList additionalInformation = new ArrayList(); private DiscoveryExceptionDictionary errors = new DiscoveryExceptionDictionary(); diff --git a/mono/mcs/class/referencesource/System.Web/Compilation/BuildManager.cs b/mono/mcs/class/referencesource/System.Web/Compilation/BuildManager.cs index 535fce71566..529720fbe98 100644 --- a/mono/mcs/class/referencesource/System.Web/Compilation/BuildManager.cs +++ b/mono/mcs/class/referencesource/System.Web/Compilation/BuildManager.cs @@ -1408,8 +1408,9 @@ private void EnsureExcludedCodeSubDirectoriesComputed() _excludedCodeSubdirectories = new CaseInsensitiveStringSet(); // Get the list of sub directories that will be compiled separately - CodeSubDirectoriesCollection codeSubDirectories = - CompilationUtil.GetCodeSubDirectories(); + CodeSubDirectoriesCollection codeSubDirectories = CompilationUtil.GetCodeSubDirectories( + + ); // Add them to the exclusion list of the top level code directory if (codeSubDirectories != null) @@ -1426,8 +1427,9 @@ private void CompileCodeDirectories() VirtualPath virtualDir = HttpRuntime.CodeDirectoryVirtualPath; // Get the list of sub directories that will be compiled separately - CodeSubDirectoriesCollection codeSubDirectories = - CompilationUtil.GetCodeSubDirectories(); + CodeSubDirectoriesCollection codeSubDirectories = CompilationUtil.GetCodeSubDirectories( + + ); if (codeSubDirectories != null) { @@ -2634,8 +2636,9 @@ internal string[] GetCodeDirectories() return new string[0]; // Get the list of code sub directories that will be compiled separately - CodeSubDirectoriesCollection codeSubDirectories = - CompilationUtil.GetCodeSubDirectories(); + CodeSubDirectoriesCollection codeSubDirectories = CompilationUtil.GetCodeSubDirectories( + + ); // Compute the number of code dirs, including the root one int numOfCodeDirs = 1; @@ -3690,8 +3693,8 @@ private bool IsNonUpdatablePrecompiledApp private bool IsExcludedFromPrecompilation(VirtualDirectory dir) { Debug.Assert(dir != null); - return _excludedCompilationPaths.Any( - path => UrlPath.IsEqualOrSubpath(path.VirtualPathString, dir.VirtualPath) + return _excludedCompilationPaths.Any(path => + UrlPath.IsEqualOrSubpath(path.VirtualPathString, dir.VirtualPath) ); } @@ -4356,8 +4359,9 @@ internal static string GetNormalizedCodeAssemblyName(string assemblyName) } // Check the sub code directories. - CodeSubDirectoriesCollection codeSubDirectories = - CompilationUtil.GetCodeSubDirectories(); + CodeSubDirectoriesCollection codeSubDirectories = CompilationUtil.GetCodeSubDirectories( + + ); foreach (CodeSubDirectory directory in codeSubDirectories) { if ( diff --git a/mono/mcs/class/referencesource/System.Web/Compilation/PageCodeDomTreeGenerator.cs b/mono/mcs/class/referencesource/System.Web/Compilation/PageCodeDomTreeGenerator.cs index 14a1265e444..549c95acc07 100644 --- a/mono/mcs/class/referencesource/System.Web/Compilation/PageCodeDomTreeGenerator.cs +++ b/mono/mcs/class/referencesource/System.Web/Compilation/PageCodeDomTreeGenerator.cs @@ -264,8 +264,9 @@ protected override void BuildDefaultConstructor() ); // e.g. outputCacheSettings = new outputCacheParameters; - CodeObjectCreateExpression cacheSettingsObject = - new CodeObjectCreateExpression(); + CodeObjectCreateExpression cacheSettingsObject = new CodeObjectCreateExpression( + + ); cacheSettingsObject.CreateType = new CodeTypeReference( typeof(OutputCacheParameters) ); diff --git a/mono/mcs/class/referencesource/System.Web/Configuration/BrowserCapabilitiesCodeGenerator.cs b/mono/mcs/class/referencesource/System.Web/Configuration/BrowserCapabilitiesCodeGenerator.cs index d2ff5b05822..05695ce5725 100644 --- a/mono/mcs/class/referencesource/System.Web/Configuration/BrowserCapabilitiesCodeGenerator.cs +++ b/mono/mcs/class/referencesource/System.Web/Configuration/BrowserCapabilitiesCodeGenerator.cs @@ -268,8 +268,8 @@ private void RestartW3SVCIfNecessary() // Dev10 bug 734918 // We should not fail when the w3svc service is not installed. ServiceController[] services = ServiceController.GetServices(); - ServiceController controller = services.SingleOrDefault( - s => String.Equals(s.ServiceName, "W3SVC", StringComparison.OrdinalIgnoreCase) + ServiceController controller = services.SingleOrDefault(s => + String.Equals(s.ServiceName, "W3SVC", StringComparison.OrdinalIgnoreCase) ); if (controller == null) { diff --git a/mono/mcs/class/referencesource/System.Web/Hosting/HostingEnvironment.cs b/mono/mcs/class/referencesource/System.Web/Hosting/HostingEnvironment.cs index 77a48003f48..4284e450885 100644 --- a/mono/mcs/class/referencesource/System.Web/Hosting/HostingEnvironment.cs +++ b/mono/mcs/class/referencesource/System.Web/Hosting/HostingEnvironment.cs @@ -374,9 +374,9 @@ Exception appDomainCreationException // if (appHost is ISAPIApplicationHost && !ServerConfig.UseMetabase) { - string rootWebConfigPath = ( - (ISAPIApplicationHost)appHost - ).ResolveRootWebConfigPath(); + string rootWebConfigPath = ((ISAPIApplicationHost)appHost).ResolveRootWebConfigPath( + + ); if (!String.IsNullOrEmpty(rootWebConfigPath)) { Debug.Assert(File.Exists(rootWebConfigPath), "File.Exists(rootWebConfigPath)"); diff --git a/mono/mcs/class/referencesource/System.Web/HttpApplication.cs b/mono/mcs/class/referencesource/System.Web/HttpApplication.cs index f6ad900d184..c1303c1408c 100644 --- a/mono/mcs/class/referencesource/System.Web/HttpApplication.cs +++ b/mono/mcs/class/referencesource/System.Web/HttpApplication.cs @@ -303,8 +303,9 @@ protected EventHandlerList Events internal IExecutionStep CreateImplicitAsyncPreloadExecutionStep() { - ImplicitAsyncPreloadModule implicitAsyncPreloadModule = - new ImplicitAsyncPreloadModule(); + ImplicitAsyncPreloadModule implicitAsyncPreloadModule = new ImplicitAsyncPreloadModule( + + ); BeginEventHandler beginHandler = null; EndEventHandler endHandler = null; implicitAsyncPreloadModule.GetEventHandlers(out beginHandler, out endHandler); diff --git a/mono/mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelMetadataProvider.cs b/mono/mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelMetadataProvider.cs index 2c77efd2fa8..3a3455474c2 100644 --- a/mono/mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelMetadataProvider.cs +++ b/mono/mcs/class/referencesource/System.Web/ModelBinding/DataAnnotationsModelMetadataProvider.cs @@ -45,13 +45,8 @@ string propertyName // We prefer [UIHint("...", PresentationLayer = "MVC")] but will fall back to [UIHint("...")] IEnumerable uiHintAttributes = attributeList.OfType(); UIHintAttribute uiHintAttribute = - uiHintAttributes.FirstOrDefault( - a => - String.Equals( - a.PresentationLayer, - "MVC", - StringComparison.OrdinalIgnoreCase - ) + uiHintAttributes.FirstOrDefault(a => + String.Equals(a.PresentationLayer, "MVC", StringComparison.OrdinalIgnoreCase) ) ?? uiHintAttributes.FirstOrDefault(a => String.IsNullOrEmpty(a.PresentationLayer)); if (uiHintAttribute != null) diff --git a/mono/mcs/class/referencesource/System.Web/Routing/ContentPathSegment.cs b/mono/mcs/class/referencesource/System.Web/Routing/ContentPathSegment.cs index 27e57230280..b5f1adab732 100644 --- a/mono/mcs/class/referencesource/System.Web/Routing/ContentPathSegment.cs +++ b/mono/mcs/class/referencesource/System.Web/Routing/ContentPathSegment.cs @@ -16,8 +16,8 @@ public bool IsCatchAll get { // - return Subsegments.Any( - seg => (seg is ParameterSubsegment) && (((ParameterSubsegment)seg).IsCatchAll) + return Subsegments.Any(seg => + (seg is ParameterSubsegment) && (((ParameterSubsegment)seg).IsCatchAll) ); } } diff --git a/mono/mcs/class/referencesource/System.Web/Routing/RouteParser.cs b/mono/mcs/class/referencesource/System.Web/Routing/RouteParser.cs index 2614a40bc12..413d4381754 100644 --- a/mono/mcs/class/referencesource/System.Web/Routing/RouteParser.cs +++ b/mono/mcs/class/referencesource/System.Web/Routing/RouteParser.cs @@ -342,9 +342,8 @@ private static Exception ValidateUrlParts(IList pathSegments) return exception; } - foundCatchAllParameter = subsegments.Any( - seg => - (seg is ParameterSubsegment) && (((ParameterSubsegment)seg).IsCatchAll) + foundCatchAllParameter = subsegments.Any(seg => + (seg is ParameterSubsegment) && (((ParameterSubsegment)seg).IsCatchAll) ); } } diff --git a/mono/mcs/class/referencesource/System.Web/UI/ControlBuilder.cs b/mono/mcs/class/referencesource/System.Web/UI/ControlBuilder.cs index a7878507d29..3fabb82f303 100644 --- a/mono/mcs/class/referencesource/System.Web/UI/ControlBuilder.cs +++ b/mono/mcs/class/referencesource/System.Web/UI/ControlBuilder.cs @@ -3928,7 +3928,9 @@ private void PreprocessAttributes(ParsedAttributeCollection attribs) // Preprocess all the attributes foreach ( - FilteredAttributeDictionary filteredAttributes in attribs.GetFilteredAttributeDictionaries() + FilteredAttributeDictionary filteredAttributes in attribs.GetFilteredAttributeDictionaries( + + ) ) { string filter = filteredAttributes.Filter; diff --git a/mono/mcs/class/referencesource/System.Web/UI/TemplateParser.cs b/mono/mcs/class/referencesource/System.Web/UI/TemplateParser.cs index f436fd48a96..c05a116958a 100644 --- a/mono/mcs/class/referencesource/System.Web/UI/TemplateParser.cs +++ b/mono/mcs/class/referencesource/System.Web/UI/TemplateParser.cs @@ -2291,7 +2291,9 @@ internal virtual void ProcessMainDirective(IDictionary mainDirective) // Process all the unknown attributes foreach ( - FilteredAttributeDictionary filteredAttributes in unknownAttributes.GetFilteredAttributeDictionaries() + FilteredAttributeDictionary filteredAttributes in unknownAttributes.GetFilteredAttributeDictionaries( + + ) ) { string filter = filteredAttributes.Filter; diff --git a/mono/mcs/class/referencesource/System.Web/UI/WebControls/DetailsViewRowsGenerator.cs b/mono/mcs/class/referencesource/System.Web/UI/WebControls/DetailsViewRowsGenerator.cs index 237c00a1e70..70d75183b4f 100644 --- a/mono/mcs/class/referencesource/System.Web/UI/WebControls/DetailsViewRowsGenerator.cs +++ b/mono/mcs/class/referencesource/System.Web/UI/WebControls/DetailsViewRowsGenerator.cs @@ -100,8 +100,9 @@ Control control bool isKey = ((IList)dataKeyNamesCaseInsensitive).Contains( name.ToLowerInvariant() ); - AutoGeneratedFieldProperties fieldProps = - new AutoGeneratedFieldProperties(); + AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties( + + ); ((IStateManager)fieldProps).TrackViewState(); fieldProps.Name = name; diff --git a/mono/mcs/class/referencesource/System.Web/UI/WebControls/GridViewColumnsGenerator.cs b/mono/mcs/class/referencesource/System.Web/UI/WebControls/GridViewColumnsGenerator.cs index 4fb1dddeebe..4101e603ad2 100644 --- a/mono/mcs/class/referencesource/System.Web/UI/WebControls/GridViewColumnsGenerator.cs +++ b/mono/mcs/class/referencesource/System.Web/UI/WebControls/GridViewColumnsGenerator.cs @@ -112,8 +112,9 @@ Control control // don't care about their properties, but rather we care about them directly if (ShouldGenerateField(sampleItemType, gridView)) { - AutoGeneratedFieldProperties fieldProps = - new AutoGeneratedFieldProperties(); + AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties( + + ); ((IStateManager)fieldProps).TrackViewState(); fieldProps.Type = sampleItemType; @@ -165,8 +166,9 @@ Control control bool isKey = ((IList)dataKeyNamesCaseInsensitive).Contains( name.ToLowerInvariant() ); - AutoGeneratedFieldProperties fieldProps = - new AutoGeneratedFieldProperties(); + AutoGeneratedFieldProperties fieldProps = new AutoGeneratedFieldProperties( + + ); ((IStateManager)fieldProps).TrackViewState(); fieldProps.Name = name; fieldProps.IsReadOnly = isKey; diff --git a/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/CodeDomDecompiler.cs b/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/CodeDomDecompiler.cs index 1180d9aaa45..642acf14a48 100644 --- a/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/CodeDomDecompiler.cs +++ b/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/CodeDomDecompiler.cs @@ -427,8 +427,9 @@ private enum Operation private delegate Operation ComputePrecedence(CodeExpression expresssion); - private static Dictionary precedenceMap = - InitializePrecedenceMap(); + private static Dictionary precedenceMap = InitializePrecedenceMap( + + ); private static Dictionary InitializePrecedenceMap() { diff --git a/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/Design/Dialogs/ConditionBrowserDialog.cs b/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/Design/Dialogs/ConditionBrowserDialog.cs index 4ae48c5ccf4..ea8b7154d1a 100644 --- a/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/Design/Dialogs/ConditionBrowserDialog.cs +++ b/mono/mcs/class/referencesource/System.Workflow.Activities/Rules/Design/Dialogs/ConditionBrowserDialog.cs @@ -61,8 +61,9 @@ protected override object OnNewInternal() { if (DialogResult.OK == dlg.ShowDialog(this)) { - RuleExpressionCondition declarativeRuleDefinition = - new RuleExpressionCondition(); + RuleExpressionCondition declarativeRuleDefinition = new RuleExpressionCondition( + + ); declarativeRuleDefinition.Expression = dlg.Expression; declarativeRuleDefinition.Name = this.CreateNewName(); this.declarativeConditionCollection.Add(declarativeRuleDefinition); diff --git a/mono/mcs/class/referencesource/System.Workflow.Activities/WebServiceResponse.cs b/mono/mcs/class/referencesource/System.Workflow.Activities/WebServiceResponse.cs index bb52d900b26..9e183e84bca 100644 --- a/mono/mcs/class/referencesource/System.Workflow.Activities/WebServiceResponse.cs +++ b/mono/mcs/class/referencesource/System.Workflow.Activities/WebServiceResponse.cs @@ -718,7 +718,9 @@ out outParameters ), new BindValidationContext( paramInfo.ParameterType.IsByRef - ? paramInfo.ParameterType.GetElementType() + ? paramInfo.ParameterType.GetElementType( + + ) : paramInfo.ParameterType, access ) diff --git a/mono/mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Bind.cs b/mono/mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Bind.cs index 3a9161817ff..7c7bb1f683e 100644 --- a/mono/mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Bind.cs +++ b/mono/mcs/class/referencesource/System.Workflow.ComponentModel/AuthoringOM/Bind.cs @@ -761,8 +761,9 @@ memberInfo is FieldInfo ) { if (activityBind.UserData[UserDataKeys.BindDataSource] == null) - activityBind.UserData[UserDataKeys.BindDataSource] = - new Hashtable(); + activityBind.UserData[UserDataKeys.BindDataSource] = new Hashtable( + + ); ((Hashtable)activityBind.UserData[UserDataKeys.BindDataSource])[ activity.QualifiedName diff --git a/mono/mcs/class/referencesource/System.Workflow.Runtime/System/Activities/Statements/Interop.cs b/mono/mcs/class/referencesource/System.Workflow.Runtime/System/Activities/Statements/Interop.cs index 3f69b7d9445..004ab051b64 100644 --- a/mono/mcs/class/referencesource/System.Workflow.Runtime/System/Activities/Statements/Interop.cs +++ b/mono/mcs/class/referencesource/System.Workflow.Runtime/System/Activities/Statements/Interop.cs @@ -1135,19 +1135,14 @@ Constraint ProcessAdvancedConstraints() { Input = parent, }, - Right = new InArgument( - context => - typeof(System.Activities.Statements.TransactionScope) + Right = new InArgument(context => + typeof(System.Activities.Statements.TransactionScope) ) }, Right = new Equal { - Left = new InArgument( - env => - parent - .Get(env) - .GetType() - .FullName + Left = new InArgument(env => + parent.Get(env).GetType().FullName ), Right = "System.ServiceModel.Activities.TransactedReceiveScope" @@ -1681,7 +1676,9 @@ HashSet validationResults bool persistOnClose = false; foreach ( - System.Workflow.ComponentModel.Activity activity in interopBody.CollectNestedActivities() + System.Workflow.ComponentModel.Activity activity in interopBody.CollectNestedActivities( + + ) ) { if (activity.PersistOnClose) diff --git a/mono/mcs/class/referencesource/System.Workflow.Runtime/Tracking/TrackPoint.cs b/mono/mcs/class/referencesource/System.Workflow.Runtime/Tracking/TrackPoint.cs index b0f64f45144..ffa4dbf04fc 100644 --- a/mono/mcs/class/referencesource/System.Workflow.Runtime/Tracking/TrackPoint.cs +++ b/mono/mcs/class/referencesource/System.Workflow.Runtime/Tracking/TrackPoint.cs @@ -26,8 +26,9 @@ public sealed class ActivityTrackPoint { #region Private Data Members - private ActivityTrackingLocationCollection _match = - new ActivityTrackingLocationCollection(); + private ActivityTrackingLocationCollection _match = new ActivityTrackingLocationCollection( + + ); private ActivityTrackingLocationCollection _exclude = new ActivityTrackingLocationCollection(); private TrackingAnnotationCollection _annotations = new TrackingAnnotationCollection(); diff --git a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowOperationBehavior.cs b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowOperationBehavior.cs index cf22331e0f3..d2ee60b8f53 100644 --- a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowOperationBehavior.cs +++ b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowOperationBehavior.cs @@ -60,7 +60,9 @@ DispatchOperation dispatch } WorkflowRuntimeBehavior workflowRuntimeBehavior = - dispatch.Parent.ChannelDispatcher.Host.Description.Behaviors.Find(); + dispatch.Parent.ChannelDispatcher.Host.Description.Behaviors.Find( + + ); if (workflowRuntimeBehavior == null) { diff --git a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowServiceBehavior.cs b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowServiceBehavior.cs index cf54bf00840..bf30e32b4b3 100644 --- a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowServiceBehavior.cs +++ b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Description/WorkflowServiceBehavior.cs @@ -295,7 +295,9 @@ ChannelDispatcherBase channelDispatcherBase in serviceHostBase.ChannelDispatcher else if (!syncContextRegistered) { SynchronizationContextWorkflowSchedulerService syncSchedulerService = - workflowRuntimeBehavior.WorkflowRuntime.GetService(); + workflowRuntimeBehavior.WorkflowRuntime.GetService( + + ); Fx.Assert( syncSchedulerService != null, "Wrong Synchronization Context Set" diff --git a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowInstanceContextProvider.cs b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowInstanceContextProvider.cs index b79888096e4..dda74989814 100644 --- a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowInstanceContextProvider.cs +++ b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowInstanceContextProvider.cs @@ -48,7 +48,9 @@ public WorkflowInstanceLifetimeManagerExtension InstanceLifeTimeManager if (!hasCheckedForExtension) { this.instanceLifeTimeManager = - this.serviceHostBase.Extensions.Find(); + this.serviceHostBase.Extensions.Find( + + ); hasCheckedForExtension = true; } return this.instanceLifeTimeManager; diff --git a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowOperationInvoker.cs b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowOperationInvoker.cs index 59661e0e257..f352d827382 100644 --- a/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowOperationInvoker.cs +++ b/mono/mcs/class/referencesource/System.WorkflowServices/System/ServiceModel/Dispatcher/WorkflowOperationInvoker.cs @@ -97,7 +97,9 @@ public WorkflowInstanceLifetimeManagerExtension InstanceLifetimeManager if (this.workflowInstanceLifeTimeManager == null) { this.workflowInstanceLifeTimeManager = - this.dispatchRuntime.ChannelDispatcher.Host.Extensions.Find(); + this.dispatchRuntime.ChannelDispatcher.Host.Extensions.Find( + + ); } return this.workflowInstanceLifeTimeManager; diff --git a/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs b/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs index 9b42888a327..46055e6b85c 100644 --- a/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs +++ b/mono/mcs/class/referencesource/System.Xml.Linq/System/Xml/Linq/XLinq.cs @@ -10898,8 +10898,9 @@ int IXmlLineInfo.LineNumber XElement e = source as XElement; if (e != null) { - LineInfoEndElementAnnotation a = - e.Annotation(); + LineInfoEndElementAnnotation a = e.Annotation( + + ); if (a != null) { return a.lineNumber; @@ -10929,8 +10930,9 @@ int IXmlLineInfo.LinePosition XElement e = source as XElement; if (e != null) { - LineInfoEndElementAnnotation a = - e.Annotation(); + LineInfoEndElementAnnotation a = e.Annotation( + + ); if (a != null) { return a.linePosition; diff --git a/mono/mcs/class/referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs b/mono/mcs/class/referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs index db1ae0bbf35..01fb80fa9e8 100644 --- a/mono/mcs/class/referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs +++ b/mono/mcs/class/referencesource/System.Xml/System/Xml/Schema/DataTypeImplementation.cs @@ -812,8 +812,9 @@ internal string GetTypeName() } // XSD types - static private readonly DatatypeImplementation c_anySimpleType = - new Datatype_anySimpleType(); + static private readonly DatatypeImplementation c_anySimpleType = new Datatype_anySimpleType( + + ); private static readonly DatatypeImplementation c_anyURI = new Datatype_anyURI(); private static readonly DatatypeImplementation c_base64Binary = new Datatype_base64Binary(); private static readonly DatatypeImplementation c_boolean = new Datatype_boolean(); @@ -823,8 +824,9 @@ internal string GetTypeName() private static readonly DatatypeImplementation c_dateTime = new Datatype_dateTime(); private static readonly DatatypeImplementation c_dateTimeNoTz = new Datatype_dateTimeNoTimeZone(); // XDR - private static readonly DatatypeImplementation c_dateTimeTz = - new Datatype_dateTimeTimeZone(); // XDR + private static readonly DatatypeImplementation c_dateTimeTz = new Datatype_dateTimeTimeZone( + + ); // XDR private static readonly DatatypeImplementation c_day = new Datatype_day(); private static readonly DatatypeImplementation c_decimal = new Datatype_decimal(); private static readonly DatatypeImplementation c_double = new Datatype_double(); @@ -875,8 +877,9 @@ internal string GetTypeName() private static readonly DatatypeImplementation c_unsignedByte = new Datatype_unsignedByte(); private static readonly DatatypeImplementation c_unsignedInt = new Datatype_unsignedInt(); private static readonly DatatypeImplementation c_unsignedLong = new Datatype_unsignedLong(); - private static readonly DatatypeImplementation c_unsignedShort = - new Datatype_unsignedShort(); + private static readonly DatatypeImplementation c_unsignedShort = new Datatype_unsignedShort( + + ); private static readonly DatatypeImplementation c_uuid = new Datatype_uuid(); // XDR private static readonly DatatypeImplementation c_year = new Datatype_year(); private static readonly DatatypeImplementation c_yearMonth = new Datatype_yearMonth(); @@ -888,8 +891,9 @@ internal string GetTypeName() new Datatype_tokenV1Compat(); // XQuery types - static private readonly DatatypeImplementation c_anyAtomicType = - new Datatype_anyAtomicType(); + static private readonly DatatypeImplementation c_anyAtomicType = new Datatype_anyAtomicType( + + ); private static readonly DatatypeImplementation c_dayTimeDuration = new Datatype_dayTimeDuration(); private static readonly DatatypeImplementation c_untypedAtomicType = diff --git a/mono/mcs/class/referencesource/System.Xml/System/Xml/Serialization/CodeExporter.cs b/mono/mcs/class/referencesource/System.Xml/System/Xml/Serialization/CodeExporter.cs index 9635140ff41..d12b6c9d7dc 100644 --- a/mono/mcs/class/referencesource/System.Xml/System/Xml/Serialization/CodeExporter.cs +++ b/mono/mcs/class/referencesource/System.Xml/System/Xml/Serialization/CodeExporter.cs @@ -33,8 +33,9 @@ public abstract class CodeExporter CodeCompileUnit codeCompileUnit; bool rootExported; TypeScope scope; - CodeAttributeDeclarationCollection includeMetadata = - new CodeAttributeDeclarationCollection(); + CodeAttributeDeclarationCollection includeMetadata = new CodeAttributeDeclarationCollection( + + ); CodeGenerationOptions options; CodeDomProvider codeProvider; CodeAttributeDeclaration generatedCodeAttribute; diff --git a/mono/mcs/class/referencesource/System/compmod/microsoft/visualbasic/VBCodeProvider.cs b/mono/mcs/class/referencesource/System/compmod/microsoft/visualbasic/VBCodeProvider.cs index 45d06f81b5d..66d5c8bb66e 100644 --- a/mono/mcs/class/referencesource/System/compmod/microsoft/visualbasic/VBCodeProvider.cs +++ b/mono/mcs/class/referencesource/System/compmod/microsoft/visualbasic/VBCodeProvider.cs @@ -3411,11 +3411,9 @@ string[] fileNames // Create an empty assembly. This is so that the file will have permissions that // we can later access with our current credential.< - new FileStream( - options.OutputAssembly, - FileMode.Create, - FileAccess.ReadWrite - ).Close(); + new FileStream(options.OutputAssembly, FileMode.Create, FileAccess.ReadWrite).Close( + + ); createdEmptyAssembly = true; } diff --git a/mono/mcs/class/referencesource/System/compmod/system/codedom/compiler/CodeCompiler.cs b/mono/mcs/class/referencesource/System/compmod/system/codedom/compiler/CodeCompiler.cs index 18bee527b2e..08cd0427620 100644 --- a/mono/mcs/class/referencesource/System/compmod/system/codedom/compiler/CodeCompiler.cs +++ b/mono/mcs/class/referencesource/System/compmod/system/codedom/compiler/CodeCompiler.cs @@ -442,11 +442,9 @@ string[] fileNames // Create an empty assembly. This is so that the file will have permissions that // we can later access with our current credential. If we don't do this, the compiler // could end up creating an assembly that we cannot open - new FileStream( - options.OutputAssembly, - FileMode.Create, - FileAccess.ReadWrite - ).Close(); + new FileStream(options.OutputAssembly, FileMode.Create, FileAccess.ReadWrite).Close( + + ); createdEmptyAssembly = true; } diff --git a/mono/mcs/class/referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs b/mono/mcs/class/referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs index a122ad94851..67ac1445b4a 100644 --- a/mono/mcs/class/referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs +++ b/mono/mcs/class/referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs @@ -3580,8 +3580,9 @@ private long HashExtenders(IExtenderProvider[] providers, object instance) class MemberDescriptorComparer : IComparer { - public static readonly MemberDescriptorComparer Instance = - new MemberDescriptorComparer(); + public static readonly MemberDescriptorComparer Instance = new MemberDescriptorComparer( + + ); // When we change the comparers to ordinal string comparison, it fails Properties1/Events1: potential breaking change [SuppressMessage( diff --git a/mono/mcs/class/referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs b/mono/mcs/class/referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs index 83909b1be67..9fb2e1350bb 100644 --- a/mono/mcs/class/referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs +++ b/mono/mcs/class/referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs @@ -4298,8 +4298,9 @@ private interface IUnimplemented { } /// private sealed class MemberDescriptorComparer : IComparer { - public static readonly MemberDescriptorComparer Instance = - new MemberDescriptorComparer(); + public static readonly MemberDescriptorComparer Instance = new MemberDescriptorComparer( + + ); public int Compare(object left, object right) { diff --git a/mono/mcs/class/referencesource/System/compmod/system/security/permissions/ResourcePermissionBase.cs b/mono/mcs/class/referencesource/System/compmod/system/security/permissions/ResourcePermissionBase.cs index e93840678fa..dd7f401e1aa 100644 --- a/mono/mcs/class/referencesource/System/compmod/system/security/permissions/ResourcePermissionBase.cs +++ b/mono/mcs/class/referencesource/System/compmod/system/security/permissions/ResourcePermissionBase.cs @@ -749,9 +749,9 @@ private object UnionOfContents(object currentContent, object targetContent) //The wildcard and "." entries can be merged as //any other entry. Hashtable newContents = CreateHashtable(); - IDictionaryEnumerator contentEnumerator = ( - (Hashtable)currentContent - ).GetEnumerator(); + IDictionaryEnumerator contentEnumerator = ((Hashtable)currentContent).GetEnumerator( + + ); IDictionaryEnumerator targetContentEnumerator = ( (Hashtable)targetContent ).GetEnumerator(); diff --git a/mono/mcs/class/referencesource/System/net/System/Net/NetworkInformation/SystemIPGlobalProperties.cs b/mono/mcs/class/referencesource/System/net/System/Net/NetworkInformation/SystemIPGlobalProperties.cs index 4084cc29ffd..5850d5ce147 100644 --- a/mono/mcs/class/referencesource/System/net/System/Net/NetworkInformation/SystemIPGlobalProperties.cs +++ b/mono/mcs/class/referencesource/System/net/System/Net/NetworkInformation/SystemIPGlobalProperties.cs @@ -597,8 +597,9 @@ private static void StableUnicastAddressTableCallback(object param) private static UnicastIPAddressInformationCollection GetUnicastAddressTable() { - UnicastIPAddressInformationCollection rval = - new UnicastIPAddressInformationCollection(); + UnicastIPAddressInformationCollection rval = new UnicastIPAddressInformationCollection( + + ); NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); for (int i = 0; i < interfaces.Length; ++i) diff --git a/mono/mcs/class/referencesource/System/net/System/Net/_Connection.cs b/mono/mcs/class/referencesource/System/net/System/Net/_Connection.cs index 3f66ac856dd..163bccaf364 100644 --- a/mono/mcs/class/referencesource/System/net/System/Net/_Connection.cs +++ b/mono/mcs/class/referencesource/System/net/System/Net/_Connection.cs @@ -3669,8 +3669,7 @@ internal bool AbortOrDisassociate(HttpWebRequest request, WebException webExcept if (m_WaitList.Count > 0) { - foundItem = m_WaitList.Find( - o => object.ReferenceEquals(o.Request, request) + foundItem = m_WaitList.Find(o => object.ReferenceEquals(o.Request, request) ); } diff --git a/mono/mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/PartialClassGenerationTask.cs b/mono/mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/PartialClassGenerationTask.cs index 18a69b9dc0d..0a3415ad23b 100644 --- a/mono/mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/PartialClassGenerationTask.cs +++ b/mono/mcs/class/referencesource/XamlBuildTask/Microsoft/Build/Tasks/Xaml/PartialClassGenerationTask.cs @@ -314,8 +314,8 @@ void PopulateBuildArtifacts(PartialClassGenerationTaskInternal wrapper) IList applicationMarkup = null; if (this.ApplicationMarkup != null) { - applicationMarkup = this.ApplicationMarkup.Select( - i => new DelegatingTaskItem(i) as ITaskItem + applicationMarkup = this.ApplicationMarkup.Select(i => + new DelegatingTaskItem(i) as ITaskItem ) .ToList(); } diff --git a/mono/mcs/class/referencesource/mscorlib/system/appdomainmanager.cs b/mono/mcs/class/referencesource/mscorlib/system/appdomainmanager.cs index abab194a216..fc615cec3bf 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/appdomainmanager.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/appdomainmanager.cs @@ -120,8 +120,9 @@ out inheritedDomainManagerType // If there was no specified TargetFrameworkName for the new domain, default it to the current domain's. if (appDomainInfo.TargetFrameworkName == null) - appDomainInfo.TargetFrameworkName = - AppDomain.CurrentDomain.GetTargetFrameworkName(); + appDomainInfo.TargetFrameworkName = AppDomain.CurrentDomain.GetTargetFrameworkName( + + ); return AppDomain.nCreateDomain( friendlyName, diff --git a/mono/mcs/class/referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs b/mono/mcs/class/referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs index 8c4de07566d..e0ba06acb70 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/diagnostics/contracts/contractsbcl.cs @@ -483,7 +483,9 @@ ref string resultFailureMessage innerException ); foreach ( - EventHandler handler in contractFailedEventLocal.GetInvocationList() + EventHandler handler in contractFailedEventLocal.GetInvocationList( + + ) ) { try diff --git a/mono/mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingDataCollector.cs b/mono/mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingDataCollector.cs index acd3b8c4b2b..acd854db312 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingDataCollector.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/diagnostics/eventing/TraceLogging/TraceLoggingDataCollector.cs @@ -20,8 +20,9 @@ namespace System.Diagnostics.Tracing [SecuritySafeCritical] internal unsafe class TraceLoggingDataCollector { - internal static readonly TraceLoggingDataCollector Instance = - new TraceLoggingDataCollector(); + internal static readonly TraceLoggingDataCollector Instance = new TraceLoggingDataCollector( + + ); private TraceLoggingDataCollector() { diff --git a/mono/mcs/class/referencesource/mscorlib/system/environment.cs b/mono/mcs/class/referencesource/mscorlib/system/environment.cs index 80989c42f03..194c6dcb0df 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/environment.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/environment.cs @@ -579,10 +579,9 @@ public static String ExpandEnvironmentVariables(String name) } if (!isFullTrust) - new EnvironmentPermission( - EnvironmentPermissionAccess.Read, - vars.ToString() - ).Demand(); + new EnvironmentPermission(EnvironmentPermissionAccess.Read, vars.ToString()).Demand( + + ); #endif // !FEATURE_CORECLR blob.Length = 0; @@ -612,10 +611,9 @@ public static String MachineName { // In future release of operating systems, you might be able to rename a machine without // rebooting. Therefore, don't cache this machine name. - new EnvironmentPermission( - EnvironmentPermissionAccess.Read, - "COMPUTERNAME" - ).Demand(); + new EnvironmentPermission(EnvironmentPermissionAccess.Read, "COMPUTERNAME").Demand( + + ); StringBuilder buf = new StringBuilder(MaxMachineNameLength); int len = MaxMachineNameLength; if (Win32Native.GetComputerName(buf, ref len) == 0) @@ -943,10 +941,9 @@ public static IDictionary GetEnvironmentVariables() #if !FEATURE_CORECLR if (!isFullTrust) - new EnvironmentPermission( - EnvironmentPermissionAccess.Read, - vars.ToString() - ).Demand(); + new EnvironmentPermission(EnvironmentPermissionAccess.Read, vars.ToString()).Demand( + + ); #endif return table; } diff --git a/mono/mcs/class/referencesource/mscorlib/system/globalization/datetimeformatinfo.cs b/mono/mcs/class/referencesource/mscorlib/system/globalization/datetimeformatinfo.cs index 9c830f73a7b..17bb5eff7fa 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/globalization/datetimeformatinfo.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/globalization/datetimeformatinfo.cs @@ -1828,9 +1828,9 @@ internal String internalGetMonthName(int month, MonthNameStyles style, bool abbr monthNamesArray = internalGetGenitiveMonthNames(abbreviated); break; case MonthNameStyles.LeapYear: - monthNamesArray = - internalGetLeapYearMonthNames( /*abbreviated*/ - ); + monthNamesArray = internalGetLeapYearMonthNames( /*abbreviated*/ + + ); break; default: monthNamesArray = ( diff --git a/mono/mcs/class/referencesource/mscorlib/system/io/longpath.cs b/mono/mcs/class/referencesource/mscorlib/system/io/longpath.cs index 7d1d1e856e0..0d2106e0d76 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/io/longpath.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/io/longpath.cs @@ -386,8 +386,9 @@ internal static DateTimeOffset GetCreationTime(String path) String tempPath = Path.AddLongPathPrefix(fullPath); - Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = - new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); + Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA( + + ); int dataInitialised = File.FillAttributeInfo(tempPath, ref data, false, false); if (dataInitialised != 0) __Error.WinIOError(dataInitialised, fullPath); @@ -408,8 +409,9 @@ internal static DateTimeOffset GetLastAccessTime(String path) FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false); String tempPath = Path.AddLongPathPrefix(fullPath); - Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = - new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); + Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA( + + ); int dataInitialised = File.FillAttributeInfo(tempPath, ref data, false, false); if (dataInitialised != 0) __Error.WinIOError(dataInitialised, fullPath); @@ -430,8 +432,9 @@ internal static DateTimeOffset GetLastWriteTime(String path) FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false); String tempPath = Path.AddLongPathPrefix(fullPath); - Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = - new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); + Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA( + + ); int dataInitialised = File.FillAttributeInfo(tempPath, ref data, false, false); if (dataInitialised != 0) __Error.WinIOError(dataInitialised, fullPath); @@ -496,8 +499,9 @@ internal static long GetLength(String path) FileIOPermission.QuickDemand(FileIOPermissionAccess.Read, fullPath, false, false); String tempPath = Path.AddLongPathPrefix(fullPath); - Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = - new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); + Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA( + + ); int dataInitialised = File.FillAttributeInfo(tempPath, ref data, false, true); // return error if (dataInitialised != 0) __Error.WinIOError(dataInitialised, path); // from FileInfo. @@ -824,8 +828,9 @@ private static void InternalDelete(String fullPath, String userPath, bool recurs // future version we will add a new flag to control this behavior, // but for now we're much safer if we err on the conservative side. // This applies to symbolic links and mount points. - Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = - new Win32Native.WIN32_FILE_ATTRIBUTE_DATA(); + Win32Native.WIN32_FILE_ATTRIBUTE_DATA data = new Win32Native.WIN32_FILE_ATTRIBUTE_DATA( + + ); int dataInitialised = File.FillAttributeInfo(longPath, ref data, false, true); if (dataInitialised != 0) { diff --git a/mono/mcs/class/referencesource/mscorlib/system/progress.cs b/mono/mcs/class/referencesource/mscorlib/system/progress.cs index 422b8ac3d5b..f907a5457b4 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/progress.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/progress.cs @@ -126,7 +126,8 @@ private void InvokeHandlers(object state) internal static class ProgressStatics { /// A default synchronization context that targets the ThreadPool. - internal static readonly SynchronizationContext DefaultContext = - new SynchronizationContext(); + internal static readonly SynchronizationContext DefaultContext = new SynchronizationContext( + + ); } } diff --git a/mono/mcs/class/referencesource/mscorlib/system/rttype.cs b/mono/mcs/class/referencesource/mscorlib/system/rttype.cs index a627bd8d478..1ab59f11ac5 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/rttype.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/rttype.cs @@ -6751,9 +6751,9 @@ out state try { #pragma warning disable 618 - new SecurityPermission( - SecurityPermissionFlag.UnmanagedCode - ).Demand(); + new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand( + + ); #pragma warning restore 618 } catch diff --git a/mono/mcs/class/referencesource/mscorlib/system/runtime/remoting/soap.cs b/mono/mcs/class/referencesource/mscorlib/system/runtime/remoting/soap.cs index c5a5516e0e5..ef809d3946e 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/runtime/remoting/soap.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/runtime/remoting/soap.cs @@ -854,9 +854,9 @@ out bool assemblyIncluded } if (uri.StartsWith(systemNSprefix, StringComparison.Ordinal)) { - String assemName = ( - (RuntimeAssembly)typeof(String).Module.Assembly - ).GetSimpleName(); + String assemName = ((RuntimeAssembly)typeof(String).Module.Assembly).GetSimpleName( + + ); assemblyIncluded = true; return uri.Substring(systemNSprefix.Length) + ", " + assemName; // now contains type } diff --git a/mono/mcs/class/referencesource/mscorlib/system/security/permissions/fileiopermission.cs b/mono/mcs/class/referencesource/mscorlib/system/security/permissions/fileiopermission.cs index cac4cd2d85d..2a249236ce1 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/security/permissions/fileiopermission.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/security/permissions/fileiopermission.cs @@ -1152,12 +1152,9 @@ internal static void QuickDemand( { if (!CodeAccessSecurityEngine.QuickCheckForAllDemands()) { - new FileIOPermission( - access, - fullPathList, - checkForDuplicates, - needFullPath - ).Demand(); + new FileIOPermission(access, fullPathList, checkForDuplicates, needFullPath).Demand( + + ); } else { diff --git a/mono/mcs/class/referencesource/mscorlib/system/text/decoder.cs b/mono/mcs/class/referencesource/mscorlib/system/text/decoder.cs index 9e8f83ec2b6..f5198875246 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/text/decoder.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/text/decoder.cs @@ -74,8 +74,9 @@ public DecoderFallbackBuffer FallbackBuffer if (m_fallback != null) m_fallbackBuffer = m_fallback.CreateFallbackBuffer(); else - m_fallbackBuffer = - DecoderFallback.ReplacementFallback.CreateFallbackBuffer(); + m_fallbackBuffer = DecoderFallback.ReplacementFallback.CreateFallbackBuffer( + + ); } return m_fallbackBuffer; diff --git a/mono/mcs/class/referencesource/mscorlib/system/text/encoder.cs b/mono/mcs/class/referencesource/mscorlib/system/text/encoder.cs index 57eaf93694f..5c262f92125 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/text/encoder.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/text/encoder.cs @@ -74,8 +74,9 @@ public EncoderFallbackBuffer FallbackBuffer if (m_fallback != null) m_fallbackBuffer = m_fallback.CreateFallbackBuffer(); else - m_fallbackBuffer = - EncoderFallback.ReplacementFallback.CreateFallbackBuffer(); + m_fallbackBuffer = EncoderFallback.ReplacementFallback.CreateFallbackBuffer( + + ); } return m_fallbackBuffer; diff --git a/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs b/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs index e52ef902e17..8a938434ef1 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/ConcurrentExclusiveSchedulerPair.cs @@ -374,9 +374,9 @@ private void ProcessAsyncIfNecessary(bool fairly = false) { processingTask = new Task( thisPair => - ( - (ConcurrentExclusiveSchedulerPair)thisPair - ).ProcessExclusiveTasks(), + ((ConcurrentExclusiveSchedulerPair)thisPair).ProcessExclusiveTasks( + + ), this, default(CancellationToken), GetCreationOptionsForTask(fairly) diff --git a/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs b/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs index 4cf522f64f7..d6d90c6816e 100644 --- a/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs +++ b/mono/mcs/class/referencesource/mscorlib/system/threading/Tasks/TaskScheduler.cs @@ -285,8 +285,9 @@ internal void InternalQueueTask(Task task) private static ConditionalWeakTable s_activeTaskSchedulers; // An AppDomain-wide default manager. - private static readonly TaskScheduler s_defaultTaskScheduler = - new ThreadPoolTaskScheduler(); + private static readonly TaskScheduler s_defaultTaskScheduler = new ThreadPoolTaskScheduler( + + ); //static counter used to generate unique TaskScheduler IDs internal static int s_taskSchedulerIdCounter; diff --git a/mono/mcs/mcs/anonymous.cs b/mono/mcs/mcs/anonymous.cs index 1b0c45b51d8..abae2ede894 100644 --- a/mono/mcs/mcs/anonymous.cs +++ b/mono/mcs/mcs/anonymous.cs @@ -710,8 +710,8 @@ protected virtual void EmitHoistedParameters(EmitContext ec, List l.Parameter.Parameter == hp.Parameter.Parameter + var local_param = hoisted_local_params.Find(l => + l.Parameter.Parameter == hp.Parameter.Parameter ); var source = new FieldExpr(local_param.Field, Location); source.InstanceExpression = new CompilerGeneratedThis(CurrentType, Location); diff --git a/mono/mcs/mcs/assembly.cs b/mono/mcs/mcs/assembly.cs index 65388863d0a..8d18ae5d0b1 100644 --- a/mono/mcs/mcs/assembly.cs +++ b/mono/mcs/mcs/assembly.cs @@ -713,7 +713,9 @@ public virtual void Emit() if (pa.IsDefined && pa.ResolveBuilder()) { var prop = - module.PredefinedMembers.RuntimeCompatibilityWrapNonExceptionThrows.Get(); + module.PredefinedMembers.RuntimeCompatibilityWrapNonExceptionThrows.Get( + + ); if (prop != null) { AttributeEncoder encoder = new AttributeEncoder(); diff --git a/mono/mcs/mcs/eval.cs b/mono/mcs/mcs/eval.cs index a935daac841..06183005397 100644 --- a/mono/mcs/mcs/eval.cs +++ b/mono/mcs/mcs/eval.cs @@ -1444,8 +1444,8 @@ public void AddTypeContainer(TypeContainer current_container, TypeDefinition tc) if (current_container.Containers != null) { - var existing = current_container.Containers.FirstOrDefault( - l => l.MemberName.Basename == tc.MemberName.Basename + var existing = current_container.Containers.FirstOrDefault(l => + l.MemberName.Basename == tc.MemberName.Basename ); if (existing != null) { diff --git a/mono/mcs/mcs/parameter.cs b/mono/mcs/mcs/parameter.cs index 82e4a5840c5..1fc24c92201 100644 --- a/mono/mcs/mcs/parameter.cs +++ b/mono/mcs/mcs/parameter.cs @@ -1418,8 +1418,9 @@ public ParametersImported(IParameterData[] param, TypeSpec[] types, bool hasPara /// public class ParametersCompiled : AParametersCollection { - public static readonly ParametersCompiled EmptyReadOnlyParameters = - new ParametersCompiled(); + public static readonly ParametersCompiled EmptyReadOnlyParameters = new ParametersCompiled( + + ); // Used by C# 2.0 delegates public static readonly ParametersCompiled Undefined = new ParametersCompiled(); diff --git a/mono/mcs/mcs/property.cs b/mono/mcs/mcs/property.cs index 795221c7e22..fd7a6c67335 100644 --- a/mono/mcs/mcs/property.cs +++ b/mono/mcs/mcs/property.cs @@ -2286,8 +2286,9 @@ public override bool Define() if (InterfaceType != null) { - string base_IndexerName = - InterfaceType.MemberDefinition.GetAttributeDefaultMember(); + string base_IndexerName = InterfaceType.MemberDefinition.GetAttributeDefaultMember( + + ); if (base_IndexerName != ShortName) { SetMemberName( diff --git a/mono/mcs/tests/gtest-lambda-06.cs b/mono/mcs/tests/gtest-lambda-06.cs index 74eaca193d5..5f0fe6fedc7 100644 --- a/mono/mcs/tests/gtest-lambda-06.cs +++ b/mono/mcs/tests/gtest-lambda-06.cs @@ -79,9 +79,7 @@ static void StopTrue(T t) { } public static int Main() { // Test that we encode (!v3) & ((!v1) & ((v1 | v2) & (v2 | v3))) - P( - v1 => - P(v2 => P(v3 => StopTrue(And(Not(v3), And(Not(v1), And(Or(v1, v2), Or(v2, v3))))))) + P(v1 => P(v2 => P(v3 => StopTrue(And(Not(v3), And(Not(v1), And(Or(v1, v2), Or(v2, v3))))))) ); return 0; diff --git a/mono/mcs/tools/cil-strip/Mono.Cecil.Cil/CodeWriter.cs b/mono/mcs/tools/cil-strip/Mono.Cecil.Cil/CodeWriter.cs index d5c99242a7e..cad4e820da3 100644 --- a/mono/mcs/tools/cil-strip/Mono.Cecil.Cil/CodeWriter.cs +++ b/mono/mcs/tools/cil-strip/Mono.Cecil.Cil/CodeWriter.cs @@ -287,8 +287,9 @@ MetadataToken GetCallSiteToken(CallSite cs) if (m_standaloneSigCache.Contains(sig)) return (MetadataToken)m_standaloneSigCache[sig]; - StandAloneSigTable sasTable = - m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable(); + StandAloneSigTable sasTable = m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable( + + ); StandAloneSigRow sasRow = m_reflectWriter.MetadataRowWriter.CreateStandAloneSigRow(sig); sasTable.Rows.Add(sasRow); @@ -416,8 +417,9 @@ VariableDefinitionCollection variables return; } - StandAloneSigTable sasTable = - m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable(); + StandAloneSigTable sasTable = m_reflectWriter.MetadataTableWriter.GetStandAloneSigTable( + + ); StandAloneSigRow sasRow = m_reflectWriter.MetadataRowWriter.CreateStandAloneSigRow(sig); sasTable.Rows.Add(sasRow); diff --git a/mono/mcs/tools/mono-symbolicate/LocationProvider.cs b/mono/mcs/tools/mono-symbolicate/LocationProvider.cs index b40f7c508c9..ed1b318c992 100644 --- a/mono/mcs/tools/mono-symbolicate/LocationProvider.cs +++ b/mono/mcs/tools/mono-symbolicate/LocationProvider.cs @@ -75,10 +75,8 @@ out Location location var parensStart = sfData.MethodSignature.IndexOf('('); var methodName = sfData.MethodSignature.Substring(0, parensStart).TrimEnd(); var methodParameters = sfData.MethodSignature.Substring(parensStart); - var methods = type.Methods.Where( - m => - CompareName(m, methodName) - && CompareParameters(m.Parameters, methodParameters) + var methods = type.Methods.Where(m => + CompareName(m, methodName) && CompareParameters(m.Parameters, methodParameters) ) .ToArray(); if (methods.Length == 0) @@ -168,10 +166,9 @@ static CustomAttribute GetAsyncStateMachine(MethodDefinition method) if (!method.HasCustomAttributes) return null; - return method.CustomAttributes.FirstOrDefault( - l => - l.AttributeType.Name == "AsyncStateMachineAttribute" - && l.AttributeType.Namespace == "System.Runtime.CompilerServices" + return method.CustomAttributes.FirstOrDefault(l => + l.AttributeType.Name == "AsyncStateMachineAttribute" + && l.AttributeType.Namespace == "System.Runtime.CompilerServices" ); } diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.Constraints.cs b/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.Constraints.cs index 303a6aa5ae6..ef9ecd2b3e7 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.Constraints.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.Constraints.cs @@ -125,19 +125,18 @@ protected virtual List ReadConstraints(IDbConnection conn, strin sql, ":owner", db.ToLower(), - r => - new + r => new + { + Key = new { - Key = new - { - Owner = r.GetString(0), - ConName = r.GetString(1), - TableName = r.GetString(2), - ConType = r.GetString(3), - RevCconName = r.GetAsString(4) - }, - Value = new { ColName = r.GetString(5), ColPos = r.GetInt32(6) } - } + Owner = r.GetString(0), + ConName = r.GetString(1), + TableName = r.GetString(2), + ConType = r.GetString(3), + RevCconName = r.GetAsString(4) + }, + Value = new { ColName = r.GetString(5), ColPos = r.GetInt32(6) } + } ) .GroupBy( r => r.Key, diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.StoredProcedures.cs b/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.StoredProcedures.cs index f4b53882610..32c223ee1e3 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.StoredProcedures.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq.Oracle/OracleSchemaLoader.StoredProcedures.cs @@ -97,8 +97,8 @@ NameFormat nameFormat nameFormat ); - Function function = schema.Functions.SingleOrDefault( - f => f.Method == procedureName.MethodName + Function function = schema.Functions.SingleOrDefault(f => + f.Method == procedureName.MethodName ); if (function == null) { diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq.PostgreSql/PgsqlSchemaLoader.cs b/mono/mcs/tools/sqlmetal/src/DbLinq.PostgreSql/PgsqlSchemaLoader.cs index 5e11c04ac4e..68887e11e06 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq.PostgreSql/PgsqlSchemaLoader.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq.PostgreSql/PgsqlSchemaLoader.cs @@ -116,8 +116,8 @@ Names names keyColRow.TableName, keyColRow.TableSchema ); - DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault( - t => constraintFullDbName == t.Name + DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault(t => + constraintFullDbName == t.Name ); if (table == null) { @@ -140,15 +140,15 @@ Names names if (isPrimaryKey) { //A) add primary key - DbLinq.Schema.Dbml.Column primaryKeyCol = table.Type.Columns.First( - c => c.Name == keyColRow.ColumnName + DbLinq.Schema.Dbml.Column primaryKeyCol = table.Type.Columns.First(c => + c.Name == keyColRow.ColumnName ); primaryKeyCol.IsPrimaryKey = true; } else { - DataForeignConstraint dataForeignConstraint = foreignKeys.FirstOrDefault( - f => f.ConstraintName == keyColRow.ConstraintName + DataForeignConstraint dataForeignConstraint = foreignKeys.FirstOrDefault(f => + f.ConstraintName == keyColRow.ConstraintName ); if (dataForeignConstraint == null) diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq.Sqlite/SqliteSchemaLoader.cs b/mono/mcs/tools/sqlmetal/src/DbLinq.Sqlite/SqliteSchemaLoader.cs index 7c42d0211a5..392bf4ea45c 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq.Sqlite/SqliteSchemaLoader.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq.Sqlite/SqliteSchemaLoader.cs @@ -108,8 +108,8 @@ Names names keyColRow.TableName, keyColRow.TableSchema ); - DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault( - t => tableFullDbName == t.Name + DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault(t => + tableFullDbName == t.Name ); if (table == null) { diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/DbSchemaLoader.cs b/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/DbSchemaLoader.cs index 403eae573b7..6a628c47e80 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/DbSchemaLoader.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/DbSchemaLoader.cs @@ -85,8 +85,8 @@ Names names var fromColumn = UnquoteSqlName(GetValue(r, iFromColumn, null)); string fullFromTable = GetFullDbName(fromTable, fromSchema); - DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault( - t => fullFromTable == t.Name + DbLinq.Schema.Dbml.Table table = schema.Tables.FirstOrDefault(t => + fullFromTable == t.Name ); if (table == null) { diff --git a/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/Implementation/SchemaLoader.cs b/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/Implementation/SchemaLoader.cs index 476761ac161..7c2b7e61469 100644 --- a/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/Implementation/SchemaLoader.cs +++ b/mono/mcs/tools/sqlmetal/src/DbLinq/Vendor/Implementation/SchemaLoader.cs @@ -503,8 +503,8 @@ Names names //find which table this column belongs to string fullColumnDbName = GetFullDbName(columnRow.TableName, columnRow.TableSchema); - DbLinq.Schema.Dbml.Table tableSchema = schema.Tables.FirstOrDefault( - tblSchema => fullColumnDbName == tblSchema.Name + DbLinq.Schema.Dbml.Table tableSchema = schema.Tables.FirstOrDefault(tblSchema => + fullColumnDbName == tblSchema.Name ); if (tableSchema == null) { diff --git a/mono/mcs/tools/sqlmetal/src/DbMetal/Generator/CodeDomGenerator.cs b/mono/mcs/tools/sqlmetal/src/DbMetal/Generator/CodeDomGenerator.cs index feae4ab8cfe..f20b3d2055a 100644 --- a/mono/mcs/tools/sqlmetal/src/DbMetal/Generator/CodeDomGenerator.cs +++ b/mono/mcs/tools/sqlmetal/src/DbMetal/Generator/CodeDomGenerator.cs @@ -670,8 +670,8 @@ void GenerateContextFunction(CodeTypeDeclaration contextType, Function function) }; if (method.Parameters != null) executeMethodCallArgs.AddRange( - function.Parameters.Select( - p => (CodeExpression)new CodeVariableReferenceExpression(p.Name) + function.Parameters.Select(p => + (CodeExpression)new CodeVariableReferenceExpression(p.Name) ) ); method.Statements.Add( @@ -1142,8 +1142,8 @@ void GenerateExtensibilityDeclarations(CodeTypeDeclaration entity, Table table) var partialMethods = new[] { CreatePartialMethod("OnCreated") } .Concat( table - .Type.Columns.Select( - c => new[] { CreateChangedMethodDecl(c), CreateChangingMethodDecl(c) } + .Type.Columns.Select(c => + new[] { CreateChangedMethodDecl(c), CreateChangingMethodDecl(c) } ) .SelectMany(md => md) ) @@ -1831,8 +1831,8 @@ void GenerateEntityParents(CodeTypeDeclaration entity, Table table, Database sch (from p in parents where p.Member == parent.Member select p).Count() > 1; // WriteClassParent(writer, parent, hasDuplicates, schema, context); // the following is apparently useless - DbLinq.Schema.Dbml.Table targetTable = schema.Tables.FirstOrDefault( - t => t.Type.Name == parent.Type + DbLinq.Schema.Dbml.Table targetTable = schema.Tables.FirstOrDefault(t => + t.Type.Name == parent.Type ); if (targetTable == null) { @@ -2001,18 +2001,19 @@ select table.Type.Columns.Single(c => c.Member == ck) .Concat( Enumerable .Range(0, parentKeys.Length) - .Select( - i => - (CodeStatement) - new CodeAssignStatement( - new CodeVariableReferenceExpression( - GetStorageFieldName(childColumns[i]) + .Select(i => + (CodeStatement) + new CodeAssignStatement( + new CodeVariableReferenceExpression( + GetStorageFieldName(childColumns[i]) + ), + new CodePropertyReferenceExpression( + new CodePropertySetValueReferenceExpression( + ), - new CodePropertyReferenceExpression( - new CodePropertySetValueReferenceExpression(), - parentKeys[i] - ) + parentKeys[i] ) + ) ) ) .ToArray(), @@ -2021,8 +2022,8 @@ select table.Type.Columns.Single(c => c.Member == ck) .Range(0, parentKeys.Length) .Select(i => { - var column = parentTable.Type.Columns.Single( - c => c.Member == childKeys[i] + var column = parentTable.Type.Columns.Single(c => + c.Member == childKeys[i] ); return (CodeStatement) new CodeAssignStatement( diff --git a/mono/mcs/tools/svcutil/MoonlightChannelBaseExtension.cs b/mono/mcs/tools/svcutil/MoonlightChannelBaseExtension.cs index 82dfd054868..4acc2a91bf5 100644 --- a/mono/mcs/tools/svcutil/MoonlightChannelBaseExtension.cs +++ b/mono/mcs/tools/svcutil/MoonlightChannelBaseExtension.cs @@ -389,9 +389,9 @@ void FixupSync() new CodeArrayCreateExpression( typeof(object), inArgs - .ConvertAll( - decl => new CodeArgumentReferenceExpression(decl.Name) - ) + .ConvertAll(decl => new CodeArgumentReferenceExpression( + decl.Name + )) .ToArray() ) ); @@ -450,9 +450,9 @@ public void FixupAsync() new CodeArrayCreateExpression( typeof(object), inArgs - .ConvertAll( - decl => new CodeArgumentReferenceExpression(decl.Name) - ) + .ConvertAll(decl => new CodeArgumentReferenceExpression( + decl.Name + )) .ToArray() ), new CodeArgumentReferenceExpression("asyncCallback"), diff --git a/moq4/src/Moq.Tests/ActionObserverFixture.cs b/moq4/src/Moq.Tests/ActionObserverFixture.cs index 84adf8c3bfe..450ddeee9e5 100644 --- a/moq4/src/Moq.Tests/ActionObserverFixture.cs +++ b/moq4/src/Moq.Tests/ActionObserverFixture.cs @@ -203,8 +203,7 @@ public void Indexer_assignment_with_matchers_everywhere() AssertReconstructable( "x => x[It.Is(i => i == 0), It.Is(i => i == 2)] = It.Is(i => i == 3)", x => - x[It.Is(i => i == 0), It.Is(i => i == 2)] = It.Is( - i => i == 3 + x[It.Is(i => i == 0), It.Is(i => i == 2)] = It.Is(i => i == 3 ) ); } diff --git a/moq4/src/Moq.Tests/CallbacksFixture.cs b/moq4/src/Moq.Tests/CallbacksFixture.cs index a20f831025d..b23bf501abe 100644 --- a/moq4/src/Moq.Tests/CallbacksFixture.cs +++ b/moq4/src/Moq.Tests/CallbacksFixture.cs @@ -115,14 +115,13 @@ public void CallbackCalledWithFourArguments() string callbackArg2 = null; string callbackArg3 = null; string callbackArg4 = null; - mock.Setup( - x => - x.Submit( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Submit( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4) => @@ -150,15 +149,14 @@ public void CallbackCalledWithFiveArguments() string callbackArg3 = null; string callbackArg4 = null; string callbackArg5 = null; - mock.Setup( - x => - x.Submit( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Submit( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5) => @@ -189,16 +187,15 @@ public void CallbackCalledWithSixArguments() string callbackArg4 = null; string callbackArg5 = null; string callbackArg6 = null; - mock.Setup( - x => - x.Submit( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Submit( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5, string s6) => @@ -232,17 +229,16 @@ public void CallbackCalledWithSevenArguments() string callbackArg5 = null; string callbackArg6 = null; string callbackArg7 = null; - mock.Setup( - x => - x.Submit( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Submit( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5, string s6, string s7) => @@ -279,18 +275,17 @@ public void CallbackCalledWithEightArguments() string callbackArg6 = null; string callbackArg7 = null; string callbackArg8 = null; - mock.Setup( - x => - x.Submit( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Submit( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( ( @@ -401,14 +396,13 @@ public void CallbackCalledWithFourArgumentsForNonVoidMethod() string callbackArg2 = null; string callbackArg3 = null; string callbackArg4 = null; - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4) => @@ -437,15 +431,14 @@ public void CallbackCalledWithFiveArgumentsForNonVoidMethod() string callbackArg3 = null; string callbackArg4 = null; string callbackArg5 = null; - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5) => @@ -477,16 +470,15 @@ public void CallbackCalledWithSixArgumentsForNonVoidMethod() string callbackArg4 = null; string callbackArg5 = null; string callbackArg6 = null; - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5, string s6) => @@ -521,17 +513,16 @@ public void CallbackCalledWithSevenArgumentsForNonVoidMethod() string callbackArg5 = null; string callbackArg6 = null; string callbackArg7 = null; - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( (string s1, string s2, string s3, string s4, string s5, string s6, string s7) => @@ -569,18 +560,17 @@ public void CallbackCalledWithEightArgumentsForNonVoidMethod() string callbackArg6 = null; string callbackArg7 = null; string callbackArg8 = null; - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Callback( ( diff --git a/moq4/src/Moq.Tests/CustomTypeMatchersFixture.cs b/moq4/src/Moq.Tests/CustomTypeMatchersFixture.cs index d6b7ea38b06..17f989cb737 100644 --- a/moq4/src/Moq.Tests/CustomTypeMatchersFixture.cs +++ b/moq4/src/Moq.Tests/CustomTypeMatchersFixture.cs @@ -203,8 +203,7 @@ public void It_Is_works_with_custom_comparer() var invocationCount = 0; var mock = new Mock(); - mock.Setup( - m => m.Method(It.Is(acceptableArg, StringComparer.OrdinalIgnoreCase)) + mock.Setup(m => m.Method(It.Is(acceptableArg, StringComparer.OrdinalIgnoreCase)) ) .Callback((object arg) => invocationCount++); @@ -225,14 +224,10 @@ public void It_Is_object_works_with_custom_comparer() var invocationCount = 0; var mock = new Mock(); - mock.Setup( - m => - m.Method( - It.Is( - acceptableArg, - new ObjectStringOrdinalIgnoreCaseComparer() - ) - ) + mock.Setup(m => + m.Method( + It.Is(acceptableArg, new ObjectStringOrdinalIgnoreCaseComparer()) + ) ) .Callback((object arg) => invocationCount++); diff --git a/moq4/src/Moq.Tests/Demo.cs b/moq4/src/Moq.Tests/Demo.cs index 596c08b2cfa..04b57c59701 100644 --- a/moq4/src/Moq.Tests/Demo.cs +++ b/moq4/src/Moq.Tests/Demo.cs @@ -43,8 +43,8 @@ public void FillingDoesNotRemoveIfNotEnoughInStock() var mock = new Mock(); //setup - expectations - mock.Setup( - x => x.HasInventory(It.IsAny(), It.IsInRange(0, 100, Range.Inclusive)) + mock.Setup(x => + x.HasInventory(It.IsAny(), It.IsInRange(0, 100, Range.Inclusive)) ) .Returns(false); mock.Setup(x => x.Remove(It.IsAny(), It.IsAny())) diff --git a/moq4/src/Moq.Tests/Linq/QueryableMocksFixture.cs b/moq4/src/Moq.Tests/Linq/QueryableMocksFixture.cs index e77b627dbeb..041d87fb250 100644 --- a/moq4/src/Moq.Tests/Linq/QueryableMocksFixture.cs +++ b/moq4/src/Moq.Tests/Linq/QueryableMocksFixture.cs @@ -164,10 +164,9 @@ public void ShouldOneOfWithPredicateCreateNewMock() [Fact] public void ShouldAllowFluentOnReadOnlyGetterProperty() { - var target = Mock.Of( - x => - x.Bars - == new[] { Mock.Of(b => b.Id == "1"), Mock.Of(b => b.Id == "2"), } + var target = Mock.Of(x => + x.Bars + == new[] { Mock.Of(b => b.Id == "1"), Mock.Of(b => b.Id == "2"), } ); Assert.NotNull(Mock.Get(target)); diff --git a/moq4/src/Moq.Tests/Matchers/ConstantMatcherFixture.cs b/moq4/src/Moq.Tests/Matchers/ConstantMatcherFixture.cs index 2eb1bcbd9a1..fc4ee6fd9be 100644 --- a/moq4/src/Moq.Tests/Matchers/ConstantMatcherFixture.cs +++ b/moq4/src/Moq.Tests/Matchers/ConstantMatcherFixture.cs @@ -82,13 +82,13 @@ public void Workaround_2() var mockA = new Mock(); var mockB = new Mock(); mockA - .Setup( - m => m.Equals(It.Is(x => object.ReferenceEquals(x, mockA.Object))) + .Setup(m => + m.Equals(It.Is(x => object.ReferenceEquals(x, mockA.Object))) ) .Returns(true); mockB - .Setup( - m => m.Equals(It.Is(x => object.ReferenceEquals(x, mockB.Object))) + .Setup(m => + m.Equals(It.Is(x => object.ReferenceEquals(x, mockB.Object))) ) .Returns(true); Assert.True(mockA.Object.Equals(mockA.Object)); diff --git a/moq4/src/Moq.Tests/MockedEventsFixture.cs b/moq4/src/Moq.Tests/MockedEventsFixture.cs index b3095d0681c..5b2291f4b61 100644 --- a/moq4/src/Moq.Tests/MockedEventsFixture.cs +++ b/moq4/src/Moq.Tests/MockedEventsFixture.cs @@ -225,14 +225,13 @@ public void ShouldRaiseEventWithFuncFourArgs() { var mock = new Mock>(); - mock.Setup( - add => - add.Do( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(add => + add.Do( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Raises( m => m.Added += null, diff --git a/moq4/src/Moq.Tests/Regressions/IssueReportsFixture.cs b/moq4/src/Moq.Tests/Regressions/IssueReportsFixture.cs index 7974543e6bf..a6ebf36808e 100644 --- a/moq4/src/Moq.Tests/Regressions/IssueReportsFixture.cs +++ b/moq4/src/Moq.Tests/Regressions/IssueReportsFixture.cs @@ -330,10 +330,9 @@ public class Issue142 [Fact] public void Mock_Of_recursive_with_argument_matchers() { - var foo = Mock.Of( - f => - f.Foo(It.Is(i => i == 1)).Name == "One" - && f.Foo(It.Is(i => i == 2)).Name == "Two" + var foo = Mock.Of(f => + f.Foo(It.Is(i => i == 1)).Name == "One" + && f.Foo(It.Is(i => i == 2)).Name == "Two" ); Assert.Equal("One", foo.Foo(1).Name); Assert.Equal("Two", foo.Foo(2).Name); @@ -1434,10 +1433,9 @@ public void GivenAnIndexer_WhenQueryingWithTwoIndexes_ThenSetsThemDirectly1() [Fact] public void WhenQueryingWithTwoIndexes_ThenSetsThemDirectly2() { - var foo = Mock.Of( - x => - x[0] == Mock.Of(b => b.Value == "hello") - && x[1] == Mock.Of(b => b.Value == "goodbye") + var foo = Mock.Of(x => + x[0] == Mock.Of(b => b.Value == "hello") + && x[1] == Mock.Of(b => b.Value == "goodbye") ); Assert.Equal("hello", foo[0].Value); // These pass no problem @@ -1592,8 +1590,8 @@ public void Mock_Of_can_setup_null_return_value() // becomes relevant once Moq starts supporting custom implementations of // `IDefaultValueProvider`. Then it might no longer be a given that `null` // is the default return value that no one would want to explicitly set up. - var userProvider = Mock.Of( - p => p.GetUserByEmail("alice@example.com") == null + var userProvider = Mock.Of(p => + p.GetUserByEmail("alice@example.com") == null ); var user = userProvider.GetUserByEmail("alice@example.com"); Assert.Null(user); @@ -2834,8 +2832,8 @@ public void SetterSetupPhraseConvertsExpressionToDescriptiveString() public void SetupSequencePhraseConvertsExpressionToDescriptiveString() { var setupSequence = new Mock().SetupSequence(x => x.DoThings(null)); - var setupGenericSequence = new Mock().SetupSequence( - x => x.DoThings(null) + var setupGenericSequence = new Mock().SetupSequence(x => + x.DoThings(null) ); Assert.Equal("x => x.DoThings(null)", setupSequence.ToString()); @@ -2925,8 +2923,8 @@ public void SetupAllProperties_can_process_Items_property_1() [Fact] public void SetupAllProperties_can_process_Items_property_2() { - var httpContext = Mock.Of( - c => c.Items == new Dictionary() + var httpContext = Mock.Of(c => + c.Items == new Dictionary() ); Assert.NotNull(httpContext.Items); } @@ -3354,15 +3352,14 @@ public void object_with_Microsoft_Extensions_Logging_Abstractions_ILogger() { var loggerMock = new Mock(); loggerMock - .Setup( - m => - m.Log( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Log( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Verifiable(); @@ -3383,15 +3380,14 @@ public void It_IsAnyType_with_Microsoft_Extensions_Logging_Abstractions_ILogger( { var loggerMock = new Mock(); loggerMock - .Setup( - m => - m.Log( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny>() - ) + .Setup(m => + m.Log( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny>() + ) ) .Verifiable(); @@ -3514,8 +3510,8 @@ public void Expression_lambdas_capturing_same_variable() { Guid originalItemId = Guid.NewGuid(); var session = new Mock(); - session.Setup( - x => x.QueryOverExpression(item => item.Id == originalItemId).List() + session.Setup(x => + x.QueryOverExpression(item => item.Id == originalItemId).List() ); _ = session @@ -3528,8 +3524,8 @@ public void Expression_lambdas_capturing_different_variables_having_same_value() { Guid originalItemId = Guid.NewGuid(); var session = new Mock(); - session.Setup( - x => x.QueryOverExpression(item => item.Id == originalItemId).List() + session.Setup(x => + x.QueryOverExpression(item => item.Id == originalItemId).List() ); var copiedItemId = originalItemId; @@ -4114,14 +4110,13 @@ static void DoWork(IHardware hw, byte[] send) public void Pass_byte_array_directly() { Mock hwMock = new Mock(); - hwMock.Setup( - m => m.Transmit(It.IsAny(), It.IsAny(), It.IsAny()) + hwMock.Setup(m => + m.Transmit(It.IsAny(), It.IsAny(), It.IsAny()) ); DoWork(hwMock.Object, new byte[] { 1, 2, 3 }); - hwMock.Verify( - m => m.Transmit((IntPtr)1, new byte[] { 1, 2, 3 }, It.IsAny()) + hwMock.Verify(m => m.Transmit((IntPtr)1, new byte[] { 1, 2, 3 }, It.IsAny()) ); } @@ -4129,21 +4124,20 @@ public void Pass_byte_array_directly() public void Pass_byte_array_indirectly_via_method_call() { Mock hwMock = new Mock(); - hwMock.Setup( - m => m.Transmit(It.IsAny(), It.IsAny(), It.IsAny()) + hwMock.Setup(m => + m.Transmit(It.IsAny(), It.IsAny(), It.IsAny()) ); DoWork(hwMock.Object, new byte[] { 1, 2, 3 }); string inputAsString = Convert.ToBase64String(new byte[] { 1, 2, 3 }); - hwMock.Verify( - m => - m.Transmit( - (IntPtr)1, - Convert.FromBase64String(inputAsString), - It.IsAny() - ) + hwMock.Verify(m => + m.Transmit( + (IntPtr)1, + Convert.FromBase64String(inputAsString), + It.IsAny() + ) ); } } @@ -4664,8 +4658,7 @@ public class Issue134 public void Test() { var target = new Mock(); - target.Setup( - t => t.Submit(It.IsAny(), It.IsAny(), It.IsAny()) + target.Setup(t => t.Submit(It.IsAny(), It.IsAny(), It.IsAny()) ); var e = Assert.Throws(() => target.VerifyAll()); diff --git a/moq4/src/Moq.Tests/ReturnsFixture.cs b/moq4/src/Moq.Tests/ReturnsFixture.cs index aa1ff62973e..d9743ec2035 100644 --- a/moq4/src/Moq.Tests/ReturnsFixture.cs +++ b/moq4/src/Moq.Tests/ReturnsFixture.cs @@ -169,14 +169,13 @@ public void PassesThreeArgumentsToReturns() public void PassesFourArgumentsToReturns() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns((string s1, string s2, string s3, string s4) => s1 + s2 + s3 + s4); @@ -188,15 +187,14 @@ public void PassesFourArgumentsToReturns() public void PassesFiveArgumentsToReturns() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( (string s1, string s2, string s3, string s4, string s5) => @@ -211,16 +209,15 @@ public void PassesFiveArgumentsToReturns() public void PassesSixArgumentsToReturns() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( (string s1, string s2, string s3, string s4, string s5, string s6) => @@ -242,17 +239,16 @@ public void PassesSixArgumentsToReturns() public void PassesSevenArgumentsToReturns() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( (string s1, string s2, string s3, string s4, string s5, string s6, string s7) => @@ -275,18 +271,17 @@ public void PassesSevenArgumentsToReturns() public void PassesEightArgumentsToReturns() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( ( diff --git a/moq4/src/Moq.Tests/SetupTaskResultFixture.cs b/moq4/src/Moq.Tests/SetupTaskResultFixture.cs index 199e2629a09..01a127bc10b 100644 --- a/moq4/src/Moq.Tests/SetupTaskResultFixture.cs +++ b/moq4/src/Moq.Tests/SetupTaskResultFixture.cs @@ -92,8 +92,8 @@ public async Task Mock_Of__property_of__completed_Task() [Fact] public async Task Mock_Of__property_of__completed_ValueTask() { - var person = Mock.Of( - p => p.GetFriendValueTaskAsync().Result.Name == NameOfFriend + var person = Mock.Of(p => + p.GetFriendValueTaskAsync().Result.Name == NameOfFriend ); var friend = await person.GetFriendValueTaskAsync(); Assert.Equal(NameOfFriend, friend.Name); @@ -102,10 +102,9 @@ public async Task Mock_Of__property_of__completed_ValueTask() [Fact] public async Task Mock_Of__properties_of__completed_Task() { - var person = Mock.Of( - p => - p.GetFriendTaskAsync().Result.Name == NameOfFriend - && p.GetFriendTaskAsync().Result.Friend == SecondFriend + var person = Mock.Of(p => + p.GetFriendTaskAsync().Result.Name == NameOfFriend + && p.GetFriendTaskAsync().Result.Friend == SecondFriend ); var friend = await person.GetFriendTaskAsync(); Assert.Equal(NameOfFriend, friend.Name); @@ -115,10 +114,9 @@ public async Task Mock_Of__properties_of__completed_Task() [Fact] public async Task Mock_Of__properties_of__completed_ValueTask() { - var person = Mock.Of( - p => - p.GetFriendValueTaskAsync().Result.Name == NameOfFriend - && p.GetFriendValueTaskAsync().Result.Friend == SecondFriend + var person = Mock.Of(p => + p.GetFriendValueTaskAsync().Result.Name == NameOfFriend + && p.GetFriendValueTaskAsync().Result.Friend == SecondFriend ); var friend = await person.GetFriendValueTaskAsync(); Assert.Equal(NameOfFriend, friend.Name); diff --git a/moq4/src/Moq.Tests/ThrowsFixture.cs b/moq4/src/Moq.Tests/ThrowsFixture.cs index a9d256b2246..ef678a2837a 100644 --- a/moq4/src/Moq.Tests/ThrowsFixture.cs +++ b/moq4/src/Moq.Tests/ThrowsFixture.cs @@ -47,14 +47,13 @@ public void PassesThreeArgumentsToThrows() public void PassesFourArgumentsToThrows() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws( (string s1, string s2, string s3, string s4) => new Exception(s1 + s2 + s3 + s4) @@ -70,15 +69,14 @@ public void PassesFourArgumentsToThrows() public void PassesFiveArgumentsToThrows() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws( (string s1, string s2, string s3, string s4, string s5) => @@ -95,16 +93,15 @@ public void PassesFiveArgumentsToThrows() public void PassesSixArgumentsToThrows() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws( (string s1, string s2, string s3, string s4, string s5, string s6) => @@ -121,17 +118,16 @@ public void PassesSixArgumentsToThrows() public void PassesSevenArgumentsToThrows() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws( (string s1, string s2, string s3, string s4, string s5, string s6, string s7) => @@ -157,18 +153,17 @@ public void PassesSevenArgumentsToThrows() public void PassesEightArgumentsToThrows() { var mock = new Mock(); - mock.Setup( - x => - x.Execute( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + mock.Setup(x => + x.Execute( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Throws( ( diff --git a/moq4/src/Moq/Interception/CastleProxyFactory.cs b/moq4/src/Moq/Interception/CastleProxyFactory.cs index fe31a176711..f1fd6fecb30 100644 --- a/moq4/src/Moq/Interception/CastleProxyFactory.cs +++ b/moq4/src/Moq/Interception/CastleProxyFactory.cs @@ -428,8 +428,8 @@ public static MethodInfo FindMostSpecificOverride(MethodInfo declaration, Type p var implementedInterfaces = proxyType.GetInterfaces(); var candidateMethods = new HashSet(); foreach ( - var implementedInterface in implementedInterfaces.Where( - i => declaringType.IsAssignableFrom(i) + var implementedInterface in implementedInterfaces.Where(i => + declaringType.IsAssignableFrom(i) ) ) { @@ -471,8 +471,8 @@ var implementedInterface in implementedInterfaces.Where( // Now we have a candidate override. We need to check if it is less specific than any others // that we have already found earlier: if ( - candidateMethods.Any( - cm => implementedInterface.IsAssignableFrom(cm.DeclaringType) + candidateMethods.Any(cm => + implementedInterface.IsAssignableFrom(cm.DeclaringType) ) ) continue; @@ -481,8 +481,7 @@ var implementedInterface in implementedInterfaces.Where( // remove all less specific overrides from it: candidateMethods.ExceptWith( candidateMethods - .Where( - cm => cm.DeclaringType.IsAssignableFrom(implementedInterface) + .Where(cm => cm.DeclaringType.IsAssignableFrom(implementedInterface) ) .ToArray() ); diff --git a/moq4/src/Moq/Matchers/MatcherAttributeMatcher.cs b/moq4/src/Moq/Matchers/MatcherAttributeMatcher.cs index 8e24fee6e4b..0690533de91 100644 --- a/moq4/src/Moq/Matchers/MatcherAttributeMatcher.cs +++ b/moq4/src/Moq/Matchers/MatcherAttributeMatcher.cs @@ -121,18 +121,15 @@ static MethodInfo ResolveValidatorMethod(MethodCallExpression call) var genericArgs = call.Method.GetGenericArguments(); method = call.Method.DeclaringType.GetMethods(call.Method.Name) - .Where( - m => - m.IsGenericMethodDefinition - && m.GetGenericArguments().Length - == call.Method.GetGenericMethodDefinition() - .GetGenericArguments() - .Length - && expectedParametersTypes.SequenceEqual( - m.MakeGenericMethod(genericArgs) - .GetParameters() - .Select(p => p.ParameterType) - ) + .Where(m => + m.IsGenericMethodDefinition + && m.GetGenericArguments().Length + == call.Method.GetGenericMethodDefinition().GetGenericArguments().Length + && expectedParametersTypes.SequenceEqual( + m.MakeGenericMethod(genericArgs) + .GetParameters() + .Select(p => p.ParameterType) + ) ) .Select(m => m.MakeGenericMethod(genericArgs)) .FirstOrDefault(); @@ -165,8 +162,8 @@ static MethodInfo ResolveValidatorMethod(MethodCallExpression call) public bool Matches(object argument, Type parameterType) { // use matcher Expression to get extra arguments - var extraArgs = this.expression.Arguments.Select( - ae => ((ConstantExpression)ae.PartialEval()).Value + var extraArgs = this.expression.Arguments.Select(ae => + ((ConstantExpression)ae.PartialEval()).Value ); var args = new[] { argument }.Concat(extraArgs).ToArray(); // for static and non-static method diff --git a/moq4/src/Moq/Mock.cs b/moq4/src/Moq/Mock.cs index be248da5c1d..d03fb680c09 100644 --- a/moq4/src/Moq/Mock.cs +++ b/moq4/src/Moq/Mock.cs @@ -297,8 +297,8 @@ internal void Verify(Func predicate, HashSet verifiedMocks) var errors = new List(); foreach ( - var setup in this.MutableSetups.FindAll( - setup => !setup.IsConditional && predicate(setup) + var setup in this.MutableSetups.FindAll(setup => + !setup.IsConditional && predicate(setup) ) ) { @@ -448,8 +448,8 @@ static void VerifyNoOtherCalls(Mock mock, HashSet verifiedMocks) if (!verifiedMocks.Add(mock)) return; - var unverifiedInvocations = mock.MutableInvocations.ToArray( - invocation => !invocation.IsVerified + var unverifiedInvocations = mock.MutableInvocations.ToArray(invocation => + !invocation.IsVerified ); var innerMocks = mock.MutableSetups.FindAllInnerMocks(); @@ -469,8 +469,8 @@ static void VerifyNoOtherCalls(Mock mock, HashSet verifiedMocks) // sub-object (inner mock); and that sub-object has to have received at least // one call: var wasTransitiveInvocation = - mock.MutableSetups.FindLastInnerMock( - setup => setup.Matches(unverifiedInvocations[i]) + mock.MutableSetups.FindLastInnerMock(setup => + setup.Matches(unverifiedInvocations[i]) ) is Mock innerMock && innerMock.MutableInvocations.Any(); @@ -713,8 +713,8 @@ internal static bool SetupReturns(Mock mock, LambdaExpression expression, object if ( setter.CanOverride() && ProxyFactory.Instance.IsMethodVisible(setter, out _) - && targetMock.MutableSetups.FindLast( - s => s is StubbedPropertiesSetup + && targetMock.MutableSetups.FindLast(s => + s is StubbedPropertiesSetup ) is StubbedPropertiesSetup sps ) diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertProgramAnalysis_ProgramMain.cs b/roslyn/src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertProgramAnalysis_ProgramMain.cs index 75cbfbbfdfd..3daf71c0eb3 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertProgramAnalysis_ProgramMain.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/ConvertProgram/ConvertProgramAnalysis_ProgramMain.cs @@ -73,8 +73,8 @@ bool isHidden // note: the legal start has to come after any #pragma directives. We don't want this to be suppressed, but // then have the span of the diagnostic end up outside the suppression. var lastPragma = root.GetFirstToken() - .LeadingTrivia.LastOrDefault( - t => t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia + .LeadingTrivia.LastOrDefault(t => + t.Kind() is SyntaxKind.PragmaWarningDirectiveTrivia ); var start = lastPragma == default ? 0 : lastPragma.FullSpan.End; diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs index 9b7914c54a4..99c25c1fd09 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableDiagnosticAnalyzer.cs @@ -45,8 +45,8 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => protected override void InitializeWorker(AnalysisContext context) { - context.RegisterCompilationStartAction( - context => SymbolAnalyzer.CreateAndRegisterActions(context) + context.RegisterCompilationStartAction(context => + SymbolAnalyzer.CreateAndRegisterActions(context) ); } @@ -96,9 +96,8 @@ private static bool HasReadonlyField(INamedTypeSymbol namedTypeSymbol) return namedTypeSymbol .GetMembers() .OfType() - .Any( - field => - field is { AssociatedSymbol: null, IsStatic: false, IsReadOnly: true } + .Any(field => + field is { AssociatedSymbol: null, IsStatic: false, IsReadOnly: true } ); } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/MisplacedUsingDirectives/MisplacedUsingDirectivesDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/MisplacedUsingDirectives/MisplacedUsingDirectivesDiagnosticAnalyzer.cs index ed980ac754e..c2e20bc22fa 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/MisplacedUsingDirectives/MisplacedUsingDirectivesDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/MisplacedUsingDirectives/MisplacedUsingDirectivesDiagnosticAnalyzer.cs @@ -139,14 +139,13 @@ private static bool ShouldSuppressDiagnostic(CompilationUnitSyntax compilationUn // compilation unit (including ExternAlias). return compilationUnit .ChildNodes() - .Any( - t => - t.Kind() - is not ( - SyntaxKind.UsingDirective - or SyntaxKind.NamespaceDeclaration - or SyntaxKind.FileScopedNamespaceDeclaration - ) + .Any(t => + t.Kind() + is not ( + SyntaxKind.UsingDirective + or SyntaxKind.NamespaceDeclaration + or SyntaxKind.FileScopedNamespaceDeclaration + ) ); } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ArrowExpressionClausePlacement/ArrowExpressionClausePlacementDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ArrowExpressionClausePlacement/ArrowExpressionClausePlacementDiagnosticAnalyzer.cs index 2dd65e2183e..8205fd55919 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ArrowExpressionClausePlacement/ArrowExpressionClausePlacementDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ArrowExpressionClausePlacement/ArrowExpressionClausePlacementDiagnosticAnalyzer.cs @@ -34,11 +34,10 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeTree(treeContext, context.Compilation.Options) + ) ); private void AnalyzeTree( @@ -132,13 +131,12 @@ static bool IsOk(SyntaxToken token) return true; if ( - nextToken.LeadingTrivia.Any( - static t => - t.Kind() - is SyntaxKind.IfDirectiveTrivia - or SyntaxKind.ElseDirectiveTrivia - or SyntaxKind.ElifDirectiveTrivia - or SyntaxKind.EndIfDirectiveTrivia + nextToken.LeadingTrivia.Any(static t => + t.Kind() + is SyntaxKind.IfDirectiveTrivia + or SyntaxKind.ElseDirectiveTrivia + or SyntaxKind.ElifDirectiveTrivia + or SyntaxKind.EndIfDirectiveTrivia ) ) { diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementDiagnosticAnalyzer.cs index 3c144418e0f..a1e48e68b0e 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementDiagnosticAnalyzer.cs @@ -35,11 +35,10 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeTree(treeContext, context.Compilation.Options) + ) ); private void AnalyzeTree( @@ -156,8 +155,8 @@ out SyntaxTrivia endOfLineTrivia return false; } - endOfLineTrivia = secondBrace.LeadingTrivia.Last( - t => t.IsKind(SyntaxKind.EndOfLineTrivia) + endOfLineTrivia = secondBrace.LeadingTrivia.Last(t => + t.IsKind(SyntaxKind.EndOfLineTrivia) ); return endOfLineTrivia != default; } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementDiagnosticAnalyzer.cs index e6fd2d182d1..4f44b2b8b3d 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementDiagnosticAnalyzer.cs @@ -36,11 +36,10 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeTree(treeContext, context.Compilation.Options) + ) ); private void AnalyzeTree( @@ -110,8 +109,8 @@ ConstructorInitializerSyntax initializer return; if ( - thisOrBaseKeyword.LeadingTrivia.Any( - t => !t.IsWhitespaceOrEndOfLine() && !t.IsSingleOrMultiLineComment() + thisOrBaseKeyword.LeadingTrivia.Any(t => + !t.IsWhitespaceOrEndOfLine() && !t.IsSingleOrMultiLineComment() ) ) return; diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs b/roslyn/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs index bcaaab07fad..91efcc8cbeb 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs @@ -977,13 +977,12 @@ is not int indexValue assignmentExpression .Right.DescendantNodesAndSelf() .OfType() - .Any( - i => - localSymbol.Equals( - semanticModel - .GetSymbolInfo(i, cancellationToken) - .GetAnySymbol() - ) + .Any(i => + localSymbol.Equals( + semanticModel + .GetSymbolInfo(i, cancellationToken) + .GetAnySymbol() + ) ) ) { @@ -1160,13 +1159,9 @@ or ImplicitArrayCreationExpressionSyntax // If we have `Create(T)`, `Create(T, T)` etc., then this is convertible. if ( - originalCreateMethod.Parameters.All( - static p => - p.Type - is ITypeParameterSymbol - { - TypeParameterKind: TypeParameterKind.Method - } + originalCreateMethod.Parameters.All(static p => + p.Type + is ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method } ) ) return arguments.Count == originalCreateMethod.Parameters.Length; @@ -1426,11 +1421,10 @@ ImplicitObjectCreationExpressionSyntax implicitObjectCreation : SeparatedList( initializer .Expressions.GetWithSeparators() - .Select( - nodeOrToken => - nodeOrToken.IsToken - ? nodeOrToken - : Argument((ExpressionSyntax)nodeOrToken.AsNode()!) + .Select(nodeOrToken => + nodeOrToken.IsToken + ? nodeOrToken + : Argument((ExpressionSyntax)nodeOrToken.AsNode()!) ) ); } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/Helpers.cs b/roslyn/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/Helpers.cs index 7029d5c4049..b29241bfa46 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/Helpers.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/Helpers.cs @@ -146,13 +146,12 @@ ITypeSymbol returnType ) => type.GetMembers(WellKnownMemberNames.Indexer) .OfType() - .Where( - p => - p.IsIndexer - && IsPublicInstance(p) - && returnType.Equals(p.Type) - && p.Parameters.Length == 1 - && p.Parameters[0].Type.Equals(parameterType) + .Where(p => + p.IsIndexer + && IsPublicInstance(p) + && returnType.Equals(p.Type) + && p.Parameters.Length == 1 + && p.Parameters[0].Type.Equals(parameterType) ) .FirstOrDefault(); @@ -167,12 +166,11 @@ ITypeSymbol returnType : method .ContainingType.GetMembers(method.Name) .OfType() - .Where( - m => - IsPublicInstance(m) - && m.Parameters.Length == 1 - && m.Parameters[0].Type.Equals(parameterType) - && m.ReturnType.Equals(method.ReturnType) + .Where(m => + IsPublicInstance(m) + && m.Parameters.Length == 1 + && m.Parameters[0].Type.Equals(parameterType) + && m.ReturnType.Equals(method.ReturnType) ) .FirstOrDefault(); } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/UseLocalFunction/CSharpUseLocalFunctionDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/UseLocalFunction/CSharpUseLocalFunctionDiagnosticAnalyzer.cs index f44b4c9756a..fca087a6bf7 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/UseLocalFunction/CSharpUseLocalFunctionDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/UseLocalFunction/CSharpUseLocalFunctionDiagnosticAnalyzer.cs @@ -74,14 +74,13 @@ protected override void InitializeWorker(AnalysisContext context) // and eventually report a diagnostic on the local declaration node. // Without the containing CodeBlockStartAction, our reported diagnostic would be classified // as a non-local diagnostic and would not participate in lightbulb for computing code fixes. - context.RegisterCodeBlockStartAction( - blockStartContext => - blockStartContext.RegisterSyntaxNodeAction( - ctx => SyntaxNodeAction(ctx, expressionType), - SyntaxKind.SimpleLambdaExpression, - SyntaxKind.ParenthesizedLambdaExpression, - SyntaxKind.AnonymousMethodExpression - ) + context.RegisterCodeBlockStartAction(blockStartContext => + blockStartContext.RegisterSyntaxNodeAction( + ctx => SyntaxNodeAction(ctx, expressionType), + SyntaxKind.SimpleLambdaExpression, + SyntaxKind.ParenthesizedLambdaExpression, + SyntaxKind.AnonymousMethodExpression + ) ); }); } diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs index 02cceef89ed..7984cefcad8 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs @@ -52,15 +52,14 @@ protected override void InitializeWorker(AnalysisContext context) // Without the containing CodeBlockStartAction, our reported diagnostic would be classified // as a non-local diagnostic and would not participate in lightbulb for computing code fixes. => - context.RegisterCodeBlockStartAction( - blockStartContext => - blockStartContext.RegisterSyntaxNodeAction( - SyntaxNodeAction, - SyntaxKind.EqualsExpression, - SyntaxKind.NotEqualsExpression, - SyntaxKind.IsExpression, - SyntaxKind.IsPatternExpression - ) + context.RegisterCodeBlockStartAction(blockStartContext => + blockStartContext.RegisterSyntaxNodeAction( + SyntaxNodeAction, + SyntaxKind.EqualsExpression, + SyntaxKind.NotEqualsExpression, + SyntaxKind.IsExpression, + SyntaxKind.IsPatternExpression + ) ); private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext) diff --git a/roslyn/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs index db3f494eb5d..8b18e5a06c3 100644 --- a/roslyn/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/CSharp/Analyzers/UsePrimaryConstructor/CSharpUsePrimaryConstructorDiagnosticAnalyzer.cs @@ -122,8 +122,8 @@ CancellationToken cancellationToken { if ( property.AccessorList is null - || property.AccessorList.Accessors.Any( - static a => a.ExpressionBody != null || a.Body != null + || property.AccessorList.Accessors.Any(static a => + a.ExpressionBody != null || a.Body != null ) ) { @@ -337,8 +337,8 @@ out var primaryConstructorDeclaration return null; if ( - primaryConstructor.Parameters.Any( - static p => p.RefKind is RefKind.Ref or RefKind.Out + primaryConstructor.Parameters.Any(static p => + p.RefKind is RefKind.Ref or RefKind.Out ) ) return null; @@ -472,13 +472,8 @@ Dictionary candidateMembersToRemove { // Quick pass. Must all be assignment expressions. Don't have to do any more analysis if we see anything beyond that. if ( - !block.Statements.All( - static s => - s - is ExpressionStatementSyntax - { - Expression: AssignmentExpressionSyntax - } + !block.Statements.All(static s => + s is ExpressionStatementSyntax { Expression: AssignmentExpressionSyntax } ) ) return false; @@ -529,8 +524,12 @@ out var member { // All the member decls have to be in the same containing type decl for this to be safe. if ( - lastAssignedMemberDeclaration.FirstAncestorOrSelf() - != currentAssignedMemberDeclaration.FirstAncestorOrSelf() + lastAssignedMemberDeclaration.FirstAncestorOrSelf( + + ) + != currentAssignedMemberDeclaration.FirstAncestorOrSelf( + + ) ) { return false; diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/ConvertToRecordHelpers.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/ConvertToRecordHelpers.cs index 57b9dbd2d2b..da838b1ad01 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/ConvertToRecordHelpers.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/ConvertToRecordHelpers.cs @@ -379,10 +379,9 @@ arg is // https://github.com/dotnet/roslyn/issues/54286 var positionalParam = param .ContainingSymbol.ContainingType.GetMembers() - .FirstOrDefault( - member => - member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() - == param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() + .FirstOrDefault(member => + member.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() + == param.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() ); if (positionalParam is IPropertySymbol property) { @@ -1093,15 +1092,14 @@ is IDeclarationPatternOperation && // found the correct binding, add any members we equate in the rest of the binary condition // if we were in a binary condition at all, and signal failure if any condition is bad - additionalConditions.All( - otherCondition => - TryAddEqualizedFieldsForCondition( - otherCondition, - successRequirement, - currentObject, - otherVar, - builder - ) + additionalConditions.All(otherCondition => + TryAddEqualizedFieldsForCondition( + otherCondition, + successRequirement, + currentObject, + otherVar, + builder + ) ) ) { diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/PositionalParameterInfo.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/PositionalParameterInfo.cs index c2d3a5b4cd5..4ede1c81b9b 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/PositionalParameterInfo.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/ConvertToRecord/PositionalParameterInfo.cs @@ -43,27 +43,24 @@ CancellationToken cancellationToken using var _ = ArrayBuilder.GetInstance(out var resultBuilder); // get all declared property symbols, put inherited property symbols first - var symbols = properties.SelectAsArray( - p => semanticModel.GetRequiredDeclaredSymbol(p, cancellationToken) + var symbols = properties.SelectAsArray(p => + semanticModel.GetRequiredDeclaredSymbol(p, cancellationToken) ); // add inherited properties from a potential base record first var inheritedProperties = GetInheritedPositionalParams(type, cancellationToken); resultBuilder.AddRange( - inheritedProperties.Select( - property => - new PositionalParameterInfo( - Declaration: null, - property, - KeepAsOverride: false - ) - ) + inheritedProperties.Select(property => new PositionalParameterInfo( + Declaration: null, + property, + KeepAsOverride: false + )) ); // The user may not know about init or be converting code from before init was introduced. // In this case we can convert set properties to init ones - var allowSetToInitConversion = !symbols.Any( - symbol => symbol.SetMethod is IMethodSymbol { IsInitOnly: true } + var allowSetToInitConversion = !symbols.Any(symbol => + symbol.SetMethod is IMethodSymbol { IsInitOnly: true } ); resultBuilder.AddRange( @@ -110,8 +107,8 @@ CancellationToken cancellationToken if (baseType != null && baseType.TryGetPrimaryConstructor(out var basePrimary)) { return basePrimary - .Parameters.Select( - param => param.GetAssociatedSynthesizedRecordProperty(cancellationToken) + .Parameters.Select(param => + param.GetAssociatedSynthesizedRecordProperty(cancellationToken) ) .WhereNotNull() .AsImmutable(); diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs index ca8452709dc..1455935d6af 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs @@ -219,8 +219,8 @@ IfStatementSyntax ifStatement // We're combining trivia from the delegate invocation and the end of the if statement // but we don't want two EndOfLines so we ignore the one on the invocation (if it exists) var expressionTrivia = newStatement.GetTrailingTrivia(); - var expressionTriviaWithoutEndOfLine = expressionTrivia.Where( - t => !t.IsKind(SyntaxKind.EndOfLineTrivia) + var expressionTriviaWithoutEndOfLine = expressionTrivia.Where(t => + !t.IsKind(SyntaxKind.EndOfLineTrivia) ); var ifStatementTrivia = ifStatement.GetTrailingTrivia(); diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixHelper.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixHelper.cs index 3e2bcbbe7b8..9c70802f121 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixHelper.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixHelper.cs @@ -126,8 +126,8 @@ CancellationToken cancellationToken (node, generator) => { var currentInvocation = (InvocationExpressionSyntax)node; - var seenNamedArgument = currentInvocation.ArgumentList.Arguments.Any( - a => a.NameColon != null + var seenNamedArgument = currentInvocation.ArgumentList.Arguments.Any(a => + a.NameColon != null ); var seenDefaultArgumentValue = currentInvocation.ArgumentList.Arguments.Count @@ -136,16 +136,15 @@ CancellationToken cancellationToken // Add all the non-this parameters to the end. If there is a 'this' parameter, add it to the start. var newArguments = parameterAndCapturedSymbols .Where(p => !p.symbol.IsThisParameter()) - .Select( - symbolAndCapture => - (ArgumentSyntax) - generator.Argument( - seenNamedArgument || seenDefaultArgumentValue - ? symbolAndCapture.symbol.Name - : null, - symbolAndCapture.symbol.RefKind, - symbolAndCapture.capture.Name.ToIdentifierName() - ) + .Select(symbolAndCapture => + (ArgumentSyntax) + generator.Argument( + seenNamedArgument || seenDefaultArgumentValue + ? symbolAndCapture.symbol.Name + : null, + symbolAndCapture.symbol.RefKind, + symbolAndCapture.capture.Name.ToIdentifierName() + ) ); var newArgumentsList = currentInvocation.ArgumentList.Arguments.AddRange( diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs index 287d55a5fd7..ea57114a48d 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs @@ -119,12 +119,11 @@ CancellationToken cancellationToken // Find all unique local functions that contain the error. var localFunctions = diagnostics - .Select( - d => - root.FindNode(d.Location.SourceSpan) - .AncestorsAndSelf() - .OfType() - .FirstOrDefault() + .Select(d => + root.FindNode(d.Location.SourceSpan) + .AncestorsAndSelf() + .OfType() + .FirstOrDefault() ) .WhereNotNull() .Distinct() diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeStructMemberReadOnly/CSharpMakeStructMemberReadOnlyCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeStructMemberReadOnly/CSharpMakeStructMemberReadOnlyCodeFixProvider.cs index 6d965b9ab5e..f6dc8215b2d 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/MakeStructMemberReadOnly/CSharpMakeStructMemberReadOnlyCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/MakeStructMemberReadOnly/CSharpMakeStructMemberReadOnlyCodeFixProvider.cs @@ -53,8 +53,8 @@ CancellationToken cancellationToken ) { var generator = editor.Generator; - var declarations = diagnostics.Select( - d => d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken) + var declarations = diagnostics.Select(d => + d.AdditionalLocations[0].FindNode(getInnermostNodeForTie: true, cancellationToken) ); foreach (var declaration in declarations.OrderByDescending(t => t.SpanStart)) @@ -92,11 +92,11 @@ declaration is AccessorDeclarationSyntax var currentAccessorList = currentProperty.AccessorList; Contract.ThrowIfNull(currentAccessorList); - var currentAccessor = currentAccessorList.Accessors.First( - a => a.Kind() == accessor.Kind() + var currentAccessor = currentAccessorList.Accessors.First(a => + a.Kind() == accessor.Kind() ); - var otherAccessor = currentAccessorList.Accessors.Single( - a => a != currentAccessor + var otherAccessor = currentAccessorList.Accessors.Single(a => + a != currentAccessor ); if (otherAccessor.Modifiers.Any(SyntaxKind.ReadOnlyKeyword)) diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs index c76bdc0f34a..b52fd841503 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs @@ -102,8 +102,8 @@ CancellationToken cancellationToken var descendentStatements = startStatement .DescendantNodesAndSelf() .OfType(); - var badStatements = descendentStatements.Where( - s => EmbeddedStatementPlacementDiagnosticAnalyzer.StatementNeedsWrapping(s) + var badStatements = descendentStatements.Where(s => + EmbeddedStatementPlacementDiagnosticAnalyzer.StatementNeedsWrapping(s) ); // Walk from lower statements to higher so the higher up changes see the changes below. diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs index 8d0f079c80b..6b768ed9ae4 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs @@ -101,8 +101,8 @@ CancellationToken cancellationToken var isNode = updatedNode .DescendantNodesAndSelf() - .First( - n => n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression + .First(n => + n.Kind() is SyntaxKind.IsExpression or SyntaxKind.IsPatternExpression ); var left = isNode switch { diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs index be6a1ebfdd9..8676c2edabd 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs @@ -69,10 +69,9 @@ await document var originalRoot = editor.OriginalRoot; var parseOptions = (CSharpParseOptions)originalRoot.SyntaxTree.Options; - var originalNodes = diagnostics.SelectAsArray( - d => - (DefaultExpressionSyntax) - originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true) + var originalNodes = diagnostics.SelectAsArray(d => + (DefaultExpressionSyntax) + originalRoot.FindNode(d.Location.SourceSpan, getInnermostNodeForTie: true) ); await editor diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs index cf84b0784e5..759ed62bc03 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/UsePrimaryConstructor/CSharpUsePrimaryConstructorCodeFixProvider_DocComments.cs @@ -189,8 +189,8 @@ SyntaxTrivia constructorDocComment // then add the constructor comments. If the type decl already had a summary tag then convert the // constructor's summary tag to a 'remarks' tag to keep around the info while not stomping on the // existing summary. - var constructorContents = typeStructure.Content.Any( - n => n is XmlElementSyntax { StartTag.Name.LocalName.ValueText: s_summaryTagName } + var constructorContents = typeStructure.Content.Any(n => + n is XmlElementSyntax { StartTag.Name.LocalName.ValueText: s_summaryTagName } ) ? ConvertSummaryToRemarks(constructorStructure.Content) : constructorStructure.Content; @@ -218,8 +218,8 @@ SyntaxTriviaList typeDeclarationLeadingTrivia // `` doc comments. // Keep the tags ordered by the order they are in the constructor parameters. - var orderedKVPs = properties.OrderBy( - kvp => constructor.Parameters.FirstOrDefault(p => p.Name == kvp.Value)?.Ordinal + var orderedKVPs = properties.OrderBy(kvp => + constructor.Parameters.FirstOrDefault(p => p.Name == kvp.Value)?.Ordinal ); using var _1 = ArrayBuilder<( string parameterName, @@ -227,8 +227,8 @@ DocumentationCommentTriviaSyntax docComment )>.GetInstance(out var docCommentsToMove); foreach (var (memberName, parameterName) in orderedKVPs) { - var (removedMember, memberDeclaration) = removedMembers.FirstOrDefault( - kvp => kvp.Key.Name == memberName + var (removedMember, memberDeclaration) = removedMembers.FirstOrDefault(kvp => + kvp.Key.Name == memberName ); if (removedMember is null) continue; diff --git a/roslyn/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs b/roslyn/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs index caf0377a7fb..ab3f0ef0f00 100644 --- a/roslyn/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs +++ b/roslyn/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs @@ -64,8 +64,8 @@ CancellationToken cancellationToken ) { var topmostUsingStatements = diagnostics - .Select( - d => (UsingStatementSyntax)d.AdditionalLocations[0].FindNode(cancellationToken) + .Select(d => + (UsingStatementSyntax)d.AdditionalLocations[0].FindNode(cancellationToken) ) .ToSet(); var blocks = topmostUsingStatements.Select(u => (BlockSyntax)u.Parent); @@ -91,8 +91,8 @@ ISet topmostUsingStatements { if (originalBlock.Statements.Count == currentBlock.Statements.Count) { - var statementToUpdateIndex = originalBlock.Statements.IndexOf( - s => topmostUsingStatements.Contains(s) + var statementToUpdateIndex = originalBlock.Statements.IndexOf(s => + topmostUsingStatements.Contains(s) ); var statementToUpdate = currentBlock.Statements[statementToUpdateIndex]; @@ -172,8 +172,8 @@ UsingStatementSyntax usingStatement } if ( - openBraceLeadingTrivia.Any( - t => t.IsSingleOrMultiLineComment() || t.IsDirective + openBraceLeadingTrivia.Any(t => + t.IsSingleOrMultiLineComment() || t.IsDirective ) ) { diff --git a/roslyn/src/Analyzers/CSharp/Tests/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs b/roslyn/src/Analyzers/CSharp/Tests/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs index f589b5d2ac4..d282bdd3389 100644 --- a/roslyn/src/Analyzers/CSharp/Tests/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs +++ b/roslyn/src/Analyzers/CSharp/Tests/ConditionalExpressionInStringInterpolation/CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProviderTests.cs @@ -30,7 +30,9 @@ Workspace workspace ) => ( null, - new CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider() + new CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider( + + ) ); private async Task TestInMethodAsync(string initialMethodBody, string expectedMethodBody) diff --git a/roslyn/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs b/roslyn/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs index b469753ae08..5e2d473b3b1 100644 --- a/roslyn/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs +++ b/roslyn/src/Analyzers/CSharp/Tests/NamingStyles/NamingStylesTests.cs @@ -1438,7 +1438,9 @@ public async Task TestRefactorNotify() var previewOperations = await action.GetPreviewOperationsAsync(CancellationToken.None); Assert.Empty( - previewOperations.OfType() + previewOperations.OfType( + + ) ); var commitOperations = await action.GetOperationsAsync(CancellationToken.None); @@ -1467,7 +1469,9 @@ public async Task TestRefactorNotifyInterfaceNamesStartWithI() var previewOperations = await action.GetPreviewOperationsAsync(CancellationToken.None); Assert.Empty( - previewOperations.OfType() + previewOperations.OfType( + + ) ); var commitOperations = await action.GetOperationsAsync(CancellationToken.None); @@ -1502,7 +1506,9 @@ public async Task TestRefactorNotifyTypeParameterNamesStartWithT() var previewOperations = await action.GetPreviewOperationsAsync(CancellationToken.None); Assert.Empty( - previewOperations.OfType() + previewOperations.OfType( + + ) ); var commitOperations = await action.GetOperationsAsync(CancellationToken.None); diff --git a/roslyn/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckTests.cs b/roslyn/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckTests.cs index 0f0b48d9ba8..6eeac6a0a34 100644 --- a/roslyn/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckTests.cs +++ b/roslyn/src/Analyzers/CSharp/Tests/UseCoalesceExpression/UseCoalesceExpressionForNullableTernaryConditionalCheckTests.cs @@ -28,7 +28,9 @@ internal override (DiagnosticAnalyzer, CodeFixProvider) CreateDiagnosticProvider Workspace workspace ) => ( - new CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer(), + new CSharpUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer( + + ), new UseCoalesceExpressionForNullableTernaryConditionalCheckCodeFixProvider() ); diff --git a/roslyn/src/Analyzers/Core/Analyzers/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs index dd0188a6dbd..49f37dfa334 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersDiagnosticAnalyzer.cs @@ -39,11 +39,10 @@ public sealed override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected sealed override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeTree(treeContext, context.Compilation.Options) + ) ); private void AnalyzeTree( diff --git a/roslyn/src/Analyzers/Core/Analyzers/Helpers/DeserializationConstructorCheck.cs b/roslyn/src/Analyzers/Core/Analyzers/Helpers/DeserializationConstructorCheck.cs index fd14fca488e..a65b9b9542f 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/Helpers/DeserializationConstructorCheck.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/Helpers/DeserializationConstructorCheck.cs @@ -11,8 +11,9 @@ internal readonly struct DeserializationConstructorCheck(Compilation compilation private readonly INamedTypeSymbol? _iSerializableType = compilation.ISerializableType(); private readonly INamedTypeSymbol? _serializationInfoType = compilation.SerializationInfoType(); - private readonly INamedTypeSymbol? _streamingContextType = - compilation.StreamingContextType(); + private readonly INamedTypeSymbol? _streamingContextType = compilation.StreamingContextType( + + ); // True if the method is a constructor adhering to the pattern used for custom // deserialization by types that implement System.Runtime.Serialization.ISerializable diff --git a/roslyn/src/Analyzers/Core/Analyzers/NewLines/ConsecutiveStatementPlacement/AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/NewLines/ConsecutiveStatementPlacement/AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs index ba2665789ec..1739dc259ba 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/NewLines/ConsecutiveStatementPlacement/AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/NewLines/ConsecutiveStatementPlacement/AbstractConsecutiveStatementPlacementDiagnosticAnalyzer.cs @@ -41,11 +41,10 @@ public sealed override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected sealed override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeTree(treeContext, context.Compilation.Options) + ) ); private void AnalyzeTree( diff --git a/roslyn/src/Analyzers/Core/Analyzers/OrderModifiers/AbstractOrderModifiersDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/OrderModifiers/AbstractOrderModifiersDiagnosticAnalyzer.cs index dca6b953f57..501f7dca03b 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/OrderModifiers/AbstractOrderModifiersDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/OrderModifiers/AbstractOrderModifiersDiagnosticAnalyzer.cs @@ -46,11 +46,10 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; protected override void InitializeWorker(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => - context.RegisterSyntaxTreeAction( - treeContext => AnalyzeSyntaxTree(treeContext, context.Compilation.Options) - ) + context.RegisterCompilationStartAction(context => + context.RegisterSyntaxTreeAction(treeContext => + AnalyzeSyntaxTree(treeContext, context.Compilation.Options) + ) ); protected abstract CodeStyleOption2 GetPreferredOrderStyle( diff --git a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnnecessarySuppressions/AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnnecessarySuppressions/AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs index de3580641a4..73534f45589 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnnecessarySuppressions/AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnnecessarySuppressions/AbstractRemoveUnnecessaryAttributeSuppressionsDiagnosticAnalyzer.cs @@ -98,8 +98,9 @@ protected sealed override void InitializeWorker(AnalysisContext context) { context.RegisterCompilationStartAction(context => { - var suppressMessageAttributeType = - context.Compilation.SuppressMessageAttributeType(); + var suppressMessageAttributeType = context.Compilation.SuppressMessageAttributeType( + + ); if (suppressMessageAttributeType == null) { return; diff --git a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs index 0e08c6d95d6..90f9ffc29dc 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.SymbolStartAnalyzer.cs @@ -251,7 +251,9 @@ Compilation compilation // Don't flag MEF import constructors with ImportingConstructor attribute. yield return compilation.SystemCompositionImportingConstructorAttribute(); - yield return compilation.SystemComponentModelCompositionImportingConstructorAttribute(); + yield return compilation.SystemComponentModelCompositionImportingConstructorAttribute( + + ); } private bool IsUnusedParameterCandidate( diff --git a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs index 52ddc8cb40f..3a9f9b60259 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/RemoveUnusedParametersAndValues/AbstractRemoveUnusedParametersAndValuesDiagnosticAnalyzer.cs @@ -264,9 +264,8 @@ public override DiagnosticAnalyzerCategory GetAnalyzerCategory() => protected sealed override void InitializeWorker(AnalysisContext context) { - context.RegisterCompilationStartAction( - compilationContext => - SymbolStartAnalyzer.CreateAndRegisterActions(compilationContext, this) + context.RegisterCompilationStartAction(compilationContext => + SymbolStartAnalyzer.CreateAndRegisterActions(compilationContext, this) ); } diff --git a/roslyn/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerAnalyzer.cs b/roslyn/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerAnalyzer.cs index bc8008127a6..cfed2528ba8 100644 --- a/roslyn/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerAnalyzer.cs +++ b/roslyn/src/Analyzers/Core/Analyzers/UseCollectionInitializer/AbstractUseCollectionInitializerAnalyzer.cs @@ -248,8 +248,8 @@ protected sealed override bool ShouldAnalyze(CancellationToken cancellationToken includeReducedExtensionMethods: true ); - return addMethods.Any( - static m => m is IMethodSymbol methodSymbol && methodSymbol.Parameters.Any() + return addMethods.Any(static m => + m is IMethodSymbol methodSymbol && methodSymbol.Parameters.Any() ); } diff --git a/roslyn/src/Analyzers/Core/CodeFixes/AddParameter/AddParameterService.cs b/roslyn/src/Analyzers/Core/CodeFixes/AddParameter/AddParameterService.cs index efd56b6ed9d..e54bcef0770 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/AddParameter/AddParameterService.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/AddParameter/AddParameterService.cs @@ -92,16 +92,15 @@ CancellationToken cancellationToken .ConfigureAwait(false) : method.GetAllMethodSymbolsOfPartialParts(); - var anySymbolReferencesNotInSource = referencedSymbols.Any( - static symbol => !symbol.IsFromSource() + var anySymbolReferencesNotInSource = referencedSymbols.Any(static symbol => + !symbol.IsFromSource() ); var locationsInSource = referencedSymbols.Where(symbol => symbol.IsFromSource()); // Indexing Locations[0] is valid because IMethodSymbols have one location at most // and IsFromSource() tests if there is at least one location. - var locationsByDocument = locationsInSource.ToLookup( - declarationLocation => - solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!) + var locationsByDocument = locationsInSource.ToLookup(declarationLocation => + solution.GetRequiredDocument(declarationLocation.Locations[0].SourceTree!) ); foreach (var documentLookup in locationsByDocument) diff --git a/roslyn/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs b/roslyn/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs index 4506fe102c4..e7da7905d16 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs @@ -77,8 +77,8 @@ CancellationToken cancellationToken ) { var generator = editor.Generator; - var declaratorsByField = declarators.GroupBy( - g => g.FirstAncestorOrSelf()! + var declaratorsByField = declarators.GroupBy(g => + g.FirstAncestorOrSelf()! ); foreach (var fieldDeclarators in declaratorsByField) diff --git a/roslyn/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs b/roslyn/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs index 10bd26f5705..d9ab91c8d1a 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs @@ -27,7 +27,9 @@ internal abstract partial class AbstractChangeNamespaceToMatchFolderCodeFixProvi public override Task RegisterCodeFixesAsync(CodeFixContext context) { var service = - context.Document.Project.Solution.Services.GetRequiredService(); + context.Document.Project.Solution.Services.GetRequiredService( + + ); if (service.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)) { context.RegisterCodeFix( @@ -59,9 +61,8 @@ CancellationToken cancellationToken // All the target namespaces should be the same for a given document Debug.Assert( diagnostics - .Select( - diagnostic => - diagnostic.Properties[MatchFolderAndNamespaceConstants.TargetNamespace] + .Select(diagnostic => + diagnostic.Properties[MatchFolderAndNamespaceConstants.TargetNamespace] ) .Distinct() .Count() == 1 diff --git a/roslyn/src/Analyzers/Core/CodeFixes/NamingStyle/NamingStyleCodeFixProvider.cs b/roslyn/src/Analyzers/Core/CodeFixes/NamingStyle/NamingStyleCodeFixProvider.cs index c095d3207ec..dfe57bbf107 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/NamingStyle/NamingStyleCodeFixProvider.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/NamingStyle/NamingStyleCodeFixProvider.cs @@ -205,7 +205,9 @@ CancellationToken cancellationToken operations.Add(codeAction); var factory = - _startingSolution.Services.GetService(); + _startingSolution.Services.GetService( + + ); if (factory is not null) { operations.Add( diff --git a/roslyn/src/Analyzers/Core/CodeFixes/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs b/roslyn/src/Analyzers/Core/CodeFixes/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs index cf9c990045e..7f3dfbf156c 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs @@ -253,8 +253,7 @@ KnownTypes knownTypes // Look for all return statements, but if we find a new node that can have the async modifier we stop // because that will have its own diagnostic and fix, if applicable - var returns = node.DescendantNodes( - n => n == node || !IsAsyncSupportingFunctionSyntax(n) + var returns = node.DescendantNodes(n => n == node || !IsAsyncSupportingFunctionSyntax(n) ) .OfType(); diff --git a/roslyn/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs b/roslyn/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs index 88b9c96be26..a9cde8cc74c 100644 --- a/roslyn/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs +++ b/roslyn/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs @@ -60,8 +60,9 @@ CancellationToken cancellationToken var semanticModel = await document .GetRequiredSemanticModelAsync(cancellationToken) .ConfigureAwait(false); - var declarationService = - document.GetRequiredLanguageService(); + var declarationService = document.GetRequiredLanguageService( + + ); // Compute declarators to remove, and also track common field declarators. foreach (var diagnostic in diagnostics) diff --git a/roslyn/src/CodeStyle/Tools/Program.cs b/roslyn/src/CodeStyle/Tools/Program.cs index 1ad7757571b..77609a23b89 100644 --- a/roslyn/src/CodeStyle/Tools/Program.cs +++ b/roslyn/src/CodeStyle/Tools/Program.cs @@ -191,12 +191,11 @@ AnalysisMode analysisMode ) { Debug.Assert( - rule.CustomTags.Any( - c => - c == s_neverTag - || c == s_whenExplicitlyEnabledTag - || c == s_recommendedTag - || c == s_highlyRecommendedTag + rule.CustomTags.Any(c => + c == s_neverTag + || c == s_whenExplicitlyEnabledTag + || c == s_recommendedTag + || c == s_highlyRecommendedTag ), $"DiagnosticDescriptor for '{rule.Id}' must have a {nameof(EnforceOnBuild)} custom tag" ); diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder.CapturedParametersFinder.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder.CapturedParametersFinder.cs index 9647ae45693..49e5b000594 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder.CapturedParametersFinder.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder.CapturedParametersFinder.cs @@ -60,7 +60,9 @@ SynthesizedPrimaryConstructor primaryConstructor var containingType = primaryConstructor.ContainingType; foreach ( - SourceMemberMethodSymbol sourceMethod in containingType.GetMethodsPossiblyCapturingPrimaryConstructorParameters() + SourceMemberMethodSymbol sourceMethod in containingType.GetMethodsPossiblyCapturingPrimaryConstructorParameters( + + ) ) { Binder? bodyBinder; diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs index cca5024e820..a0b7733c36b 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/BinderFactory.BinderFactoryVisitor.cs @@ -664,7 +664,9 @@ container is SourceMemberContainerTypeSymbol ) { foreach ( - Symbol sym in sourceMemberContainerTypeSymbol.GetMembersToMatchAgainstDeclarationSpan() + Symbol sym in sourceMemberContainerTypeSymbol.GetMembersToMatchAgainstDeclarationSpan( + + ) ) { if (sym.IsAccessor()) diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs index d304cf8a890..7721e26c98c 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Attributes.cs @@ -315,8 +315,8 @@ ref useSiteInfo ); if ( - attributeConstructor.Parameters.Any( - static p => p.RefKind is RefKind.In or RefKind.RefReadOnlyParameter + attributeConstructor.Parameters.Any(static p => + p.RefKind is RefKind.In or RefKind.RefReadOnlyParameter ) ) { @@ -1085,9 +1085,9 @@ ref bool attrHasErrors { if (builder == null) { - builder = ArrayBuilder< - KeyValuePair - >.GetInstance(); + builder = ArrayBuilder>.GetInstance( + + ); } builder.Add(kv.Value); diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Crefs.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Crefs.cs index dead3060157..372b910d03d 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Crefs.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Crefs.cs @@ -894,8 +894,8 @@ BindingDiagnosticBag diagnostics if (hasNonGenericMethod && hasGenericMethod) { - symbols = symbols.WhereAsArray( - s => s.Kind != SymbolKind.Method || ((MethodSymbol)s).Arity == 0 + symbols = symbols.WhereAsArray(s => + s.Kind != SymbolKind.Method || ((MethodSymbol)s).Arity == 0 ); } } @@ -960,8 +960,8 @@ BindingDiagnosticBag diagnostics typeArgumentListSyntax, symbol ); - return symbols.SelectAsArray( - sym => ConstructWithCrefTypeParameters(arity, typeArgumentListSyntax, sym) + return symbols.SelectAsArray(sym => + ConstructWithCrefTypeParameters(arity, typeArgumentListSyntax, sym) ); } } @@ -1199,7 +1199,9 @@ Symbol symbol // Should be in a WithCrefTypeParametersBinder. Debug.Assert( typeArgumentSyntax.ContainsDiagnostics - || !typeArgumentSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics() + || !typeArgumentSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics( + + ) || ( !unusedDiagnostics.HasAnyErrors() && typeArgument.Type is CrefTypeParameterSymbol diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs index b47de9822aa..ac656a6876e 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Expressions.cs @@ -5733,8 +5733,9 @@ bool isInferred { Debug.Assert(!boundInitExpr.IsDefault); - ArrayBuilder initializers = - ArrayBuilder.GetInstance(); + ArrayBuilder initializers = ArrayBuilder.GetInstance( + + ); if (dimension == type.Rank) { // We are processing the nth dimension of a rank-n array. We expect that these will @@ -6160,8 +6161,9 @@ node is StackAllocArrayCreationExpressionSyntax bool inLegalPosition = true; // If we are using a language version that does not restrict the position of a stackalloc expression, skip that test. - LanguageVersion requiredVersion = - MessageID.IDS_FeatureNestedStackalloc.RequiredVersion(); + LanguageVersion requiredVersion = MessageID.IDS_FeatureNestedStackalloc.RequiredVersion( + + ); if (requiredVersion > Compilation.LanguageVersion) { inLegalPosition = @@ -8123,10 +8125,9 @@ argument is BoundConversion .GetInterpolatedStringHandlerData() .ArgumentPlaceholders; if ( - handlerPlaceholders.Any( - static placeholder => - placeholder.ArgumentIndex - == BoundInterpolatedStringArgumentPlaceholder.InstanceParameter + handlerPlaceholders.Any(static placeholder => + placeholder.ArgumentIndex + == BoundInterpolatedStringArgumentPlaceholder.InstanceParameter ) ) { @@ -8742,8 +8743,8 @@ BoundObjectOrCollectionValuePlaceholder implicitReceiver elementInitializer, applicableMethods: ImmutableArray.Empty, implicitReceiver, - arguments: boundElementInitializerExpressions.SelectAsArray( - e => BindToNaturalType(e, diagnostics) + arguments: boundElementInitializerExpressions.SelectAsArray(e => + BindToNaturalType(e, diagnostics) ), type: GetSpecialType(SpecialType.System_Void, diagnostics, elementInitializer), hasErrors: hasErrors @@ -13720,8 +13721,9 @@ ref useSiteInfo } ImmutableArray argumentNames = analyzedArguments.GetNames(); - ImmutableArray argumentRefKinds = - analyzedArguments.RefKinds.ToImmutableOrNull(); + ImmutableArray argumentRefKinds = analyzedArguments.RefKinds.ToImmutableOrNull( + + ); if (!overloadResolutionResult.Succeeded) { // If the arguments had an error reported about them then suppress further error diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs index 35b530f32e5..91803825643 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Invocation.cs @@ -174,11 +174,10 @@ internal BoundExpression MakeInvocationExpression( var analyzedArguments = AnalyzedArguments.GetInstance(); Debug.Assert( - !args.Any( - static e => - e.Kind == BoundKind.OutVariablePendingInference - || e.Kind == BoundKind.OutDeconstructVarPendingInference - || e.Kind == BoundKind.DiscardExpression && !e.HasExpressionType() + !args.Any(static e => + e.Kind == BoundKind.OutVariablePendingInference + || e.Kind == BoundKind.OutDeconstructVarPendingInference + || e.Kind == BoundKind.DiscardExpression && !e.HasExpressionType() ) ); analyzedArguments.Arguments.AddRange(args); diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs index 934d426cccc..7754a7c5b58 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Operators.cs @@ -1832,9 +1832,9 @@ out MethodSymbol falseOperator t.IsInterface && (signature.Method.IsAbstract || signature.Method.IsVirtual) && SourceUserDefinedOperatorSymbol.IsSelfConstrainedTypeParameter( - ( - definition = signature.Method.OriginalDefinition - ).ReturnType.StrippedType(), + (definition = signature.Method.OriginalDefinition).ReturnType.StrippedType( + + ), definition.ContainingType ) ); diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs index 1c284a6ddef..f6e1690f699 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_Statements.cs @@ -5061,8 +5061,9 @@ private BoundNode BindSimpleProgramCompilationUnit( BindingDiagnosticBag diagnostics ) { - ArrayBuilder boundStatements = - ArrayBuilder.GetInstance(); + ArrayBuilder boundStatements = ArrayBuilder.GetInstance( + + ); var first = true; foreach (var statement in compilationUnit.Members) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_TupleOperators.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_TupleOperators.cs index e03914d301f..68d21e79517 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_TupleOperators.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Binder_TupleOperators.cs @@ -649,14 +649,14 @@ BindingDiagnosticBag diagnostics } } - ImmutableArray elementLocations = elements.SelectAsArray( - e => e.Syntax.Location + ImmutableArray elementLocations = elements.SelectAsArray(e => + e.Syntax.Location ); var tuple = NamedTypeSymbol.CreateTuple( locationOpt: null, - elementTypesWithAnnotations: convertedTypes.SelectAsArray( - t => TypeWithAnnotations.Create(t) + elementTypesWithAnnotations: convertedTypes.SelectAsArray(t => + TypeWithAnnotations.Create(t) ), elementLocations, elementNames: names, diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs index 20400aac8aa..abdc3ee7b99 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/ForEachLoopBinder.cs @@ -589,9 +589,8 @@ out alias Debug.Assert( hasErrors || _syntax.HasErrors - || iterationVariables.All( - local => - local.DeclarationKind == LocalDeclarationKind.ForEachIterationVariable + || iterationVariables.All(local => + local.DeclarationKind == LocalDeclarationKind.ForEachIterationVariable ), "Should not have iteration variables that are not ForEachIterationVariable in valid code" ); @@ -754,7 +753,9 @@ out alias var location = _syntax.ForEachKeyword.GetLocation(); foreach ( - var d in createConversionDiagnostics.DiagnosticBag.AsEnumerableWithoutResolution() + var d in createConversionDiagnostics.DiagnosticBag.AsEnumerableWithoutResolution( + + ) ) { diagnostics.Add(d.WithLocation(location)); diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/BinaryOperatorOverloadResolutionResult.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/BinaryOperatorOverloadResolutionResult.cs index ec877859a1b..ac271a0e314 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/BinaryOperatorOverloadResolutionResult.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/Operators/BinaryOperatorOverloadResolutionResult.cs @@ -145,8 +145,9 @@ public void Clear() this.Results.Clear(); } - public static readonly ObjectPool Pool = - CreatePool(); + public static readonly ObjectPool Pool = CreatePool( + + ); private static ObjectPool CreatePool() { diff --git a/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs b/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs index 9732d270afb..3c81fe2a17d 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Binder/Semantics/OverloadResolution/OverloadResolution.cs @@ -226,13 +226,12 @@ internal void MethodOrPropertyOverloadResolution( // types derived from System.Object. bool checkOverriddenOrHidden = !( isExtensionMethodResolution - && members.All( - static m => - m.ContainingSymbol - is NamedTypeSymbol - { - BaseTypeNoUseSiteDiagnostics.SpecialType: SpecialType.System_Object - } + && members.All(static m => + m.ContainingSymbol + is NamedTypeSymbol + { + BaseTypeNoUseSiteDiagnostics.SpecialType: SpecialType.System_Object + } ) ); @@ -659,11 +658,10 @@ in CallingConventionInfo expectedConvention var unmanagedCallingConventionTypes = unmanagedCallersOnlyData.CallingConventionTypes; Debug.Assert( - unmanagedCallingConventionTypes.All( - u => - FunctionPointerTypeSymbol.IsCallingConventionModifier( - (NamedTypeSymbol)u - ) + unmanagedCallingConventionTypes.All(u => + FunctionPointerTypeSymbol.IsCallingConventionModifier( + (NamedTypeSymbol)u + ) ) ); diff --git a/roslyn/src/Compilers/CSharp/Portable/BoundTree/BoundDecisionDag.cs b/roslyn/src/Compilers/CSharp/Portable/BoundTree/BoundDecisionDag.cs index 8bbae1aa7dd..ec243fa25c0 100644 --- a/roslyn/src/Compilers/CSharp/Portable/BoundTree/BoundDecisionDag.cs +++ b/roslyn/src/Compilers/CSharp/Portable/BoundTree/BoundDecisionDag.cs @@ -232,10 +232,9 @@ IReadOnlyDictionary replacement public bool ContainsAnySynthesizedNodes() { - return this.TopologicallySortedNodes.Any( - static node => - node is BoundEvaluationDecisionDagNode e - && e.Evaluation.Kind == BoundKind.DagAssignmentEvaluation + return this.TopologicallySortedNodes.Any(static node => + node is BoundEvaluationDecisionDagNode e + && e.Evaluation.Kind == BoundKind.DagAssignmentEvaluation ); } diff --git a/roslyn/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs b/roslyn/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs index 1d6ce51a2ca..0d3f7f014c5 100644 --- a/roslyn/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs +++ b/roslyn/src/Compilers/CSharp/Portable/CodeGen/EmitStatement.cs @@ -1581,13 +1581,10 @@ SyntaxNode syntaxNode // lengthConstant -> corresponding label _builder.EmitIntegerSwitchJumpTable( lengthBasedSwitchInfo - .LengthBasedJumpTable.LengthCaseLabels.Select( - p => - new KeyValuePair( - ConstantValue.Create(p.value), - p.label - ) - ) + .LengthBasedJumpTable.LengthCaseLabels.Select(p => new KeyValuePair< + ConstantValue, + object + >(ConstantValue.Create(p.value), p.label)) .ToArray(), fallThroughLabel, stringLength, @@ -1639,13 +1636,10 @@ SyntaxNode syntaxNode // charConstant -> corresponding label _builder.EmitIntegerSwitchJumpTable( charJumpTable - .CharCaseLabels.Select( - p => - new KeyValuePair( - ConstantValue.Create(p.value), - p.label - ) - ) + .CharCaseLabels.Select(p => new KeyValuePair( + ConstantValue.Create(p.value), + p.label + )) .ToArray(), fallThroughLabel, charTemp, @@ -1673,13 +1667,10 @@ SyntaxNode syntaxNode // stringConstant -> corresponding label EmitStringSwitchJumpTable( stringJumpTable - .StringCaseLabels.Select( - p => - new KeyValuePair( - ConstantValue.Create(p.value), - p.label - ) - ) + .StringCaseLabels.Select(p => new KeyValuePair( + ConstantValue.Create(p.value), + p.label + )) .ToArray(), fallThroughLabel, keyTemp, diff --git a/roslyn/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs b/roslyn/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs index 4dd6f1df9e5..8d7340f631d 100644 --- a/roslyn/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs +++ b/roslyn/src/Compilers/CSharp/Portable/CommandLine/CSharpCommandLineParser.cs @@ -929,13 +929,10 @@ out outputDirectory // An error will be reported by the assembly manager anyways. metadataReferences.AddRange( ParseSeparatedPaths(value) - .Select( - path => - new CommandLineReference( - path, - MetadataReferenceProperties.Module - ) - ) + .Select(path => new CommandLineReference( + path, + MetadataReferenceProperties.Module + )) ); resourcesOrModulesSpecified = true; } diff --git a/roslyn/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs b/roslyn/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs index 590dd08a634..80cffe9b768 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Compilation/CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs @@ -77,7 +77,9 @@ public static UsingsFromOptionsAndDiagnostics FromOptions(CSharpCompilation comp new NamespaceOrTypeAndUsingDirective( imported, null, - dependencies: directiveDiagnostics.DependenciesBag.ToImmutableArray() + dependencies: directiveDiagnostics.DependenciesBag.ToImmutableArray( + + ) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Portable/Compilation/DeconstructionInfo.cs b/roslyn/src/Compilers/CSharp/Portable/Compilation/DeconstructionInfo.cs index be03a3f63af..9591305873d 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Compilation/DeconstructionInfo.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Compilation/DeconstructionInfo.cs @@ -70,12 +70,9 @@ public ImmutableArray Nested return deconstructConversionInfo.IsDefault ? ImmutableArray.Empty - : deconstructConversionInfo.SelectAsArray( - c => - new DeconstructionInfo( - BoundNode.GetConversion(c.conversion, c.placeholder) - ) - ); + : deconstructConversionInfo.SelectAsArray(c => new DeconstructionInfo( + BoundNode.GetConversion(c.conversion, c.placeholder) + )); } } diff --git a/roslyn/src/Compilers/CSharp/Portable/Compilation/SpeculativeSemanticModelWithMemberModel.cs b/roslyn/src/Compilers/CSharp/Portable/Compilation/SpeculativeSemanticModelWithMemberModel.cs index c93ffa25ee9..255cb6551be 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Compilation/SpeculativeSemanticModelWithMemberModel.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Compilation/SpeculativeSemanticModelWithMemberModel.cs @@ -179,8 +179,8 @@ private MemberSemanticModel GetEnclosingMemberModel(SyntaxNode node) return _memberModel; } - var attributeOrParameter = node.FirstAncestorOrSelf( - static n => n.Kind() is SyntaxKind.Attribute or SyntaxKind.Parameter + var attributeOrParameter = node.FirstAncestorOrSelf(static n => + n.Kind() is SyntaxKind.Attribute or SyntaxKind.Parameter ); if ( diff --git a/roslyn/src/Compilers/CSharp/Portable/Compiler/DocumentationCommentCompiler.IncludeElementExpander.cs b/roslyn/src/Compilers/CSharp/Portable/Compiler/DocumentationCommentCompiler.IncludeElementExpander.cs index 652300acdab..1325344dab0 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Compiler/DocumentationCommentCompiler.IncludeElementExpander.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Compiler/DocumentationCommentCompiler.IncludeElementExpander.cs @@ -104,10 +104,8 @@ CancellationToken cancellationToken // If one of the trees wasn't diagnosing doc comments, then an error might have slipped through. // Otherwise, we shouldn't see exceptions from XDocument.Parse. Debug.Assert( - sourceIncludeElementNodes.All( - syntax => - syntax.SyntaxTree.Options.DocumentationMode - < DocumentationMode.Diagnose + sourceIncludeElementNodes.All(syntax => + syntax.SyntaxTree.Options.DocumentationMode < DocumentationMode.Diagnose ), "Why didn't our parser catch this exception? " + e ); @@ -360,8 +358,9 @@ ref originatingSyntax ); Debug.Assert(originatingSyntax != null); - bool diagnose = - originatingSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics(); + bool diagnose = originatingSyntax.SyntaxTree.ReportDocumentationCommentDiagnostics( + + ); if (!EnterIncludeElement(location)) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs b/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs index fbd9b2667b5..4089c6c2e69 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Emitter/Model/PEModuleBuilder.cs @@ -955,11 +955,10 @@ private static void GetForwardedTypes( if (builder is object) { - orderedForwardedTypes = orderedForwardedTypes.OrderBy( - t => - t.OriginalDefinition.ToDisplayString( - SymbolDisplayFormat.QualifiedNameArityFormat - ) + orderedForwardedTypes = orderedForwardedTypes.OrderBy(t => + t.OriginalDefinition.ToDisplayString( + SymbolDisplayFormat.QualifiedNameArityFormat + ) ); } @@ -1721,8 +1720,8 @@ ImmutableArray @params if (!mustBeTranslated) { #if DEBUG - return @params.SelectAsArray( - p => p.GetCciAdapter() + return @params.SelectAsArray(p => + p.GetCciAdapter() ); #else return StaticCast.From(@params); diff --git a/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/ControlFlowAnalysis.cs b/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/ControlFlowAnalysis.cs index 330014a80a7..b41cab14509 100644 --- a/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/ControlFlowAnalysis.cs +++ b/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/ControlFlowAnalysis.cs @@ -156,10 +156,8 @@ public override ImmutableArray ReturnStatements // way that jumps out of the region are computed. get { - return ExitPoints.WhereAsArray( - s => - s.IsKind(SyntaxKind.ReturnStatement) - || s.IsKind(SyntaxKind.YieldBreakStatement) + return ExitPoints.WhereAsArray(s => + s.IsKind(SyntaxKind.ReturnStatement) || s.IsKind(SyntaxKind.YieldBreakStatement) ); } } diff --git a/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs b/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs index ef936705a4a..3d4428b763c 100644 --- a/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs +++ b/roslyn/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs @@ -727,8 +727,9 @@ void enforceMemberNotNull(SyntaxNode? syntaxOpt, LocalState state) var exitLocation = method.DeclaringSyntaxReferences.IsEmpty ? null : method.TryGetFirstLocation(); - bool constructorEnforcesRequiredMembers = - method.ShouldCheckRequiredMembers(); + bool constructorEnforcesRequiredMembers = method.ShouldCheckRequiredMembers( + + ); // Required properties can be attributed MemberNotNull, indicating that if the property is set, the field will be set as well. // If we're enforcing required members (ie, the constructor is not attributed with SetsRequiredMembers), we also want to @@ -1273,8 +1274,8 @@ bool includeBaseRequiredMembers includeCurrentTypeRequiredMembers: true, includeBaseRequiredMembers: true ) - => containingType.AllRequiredMembers.SelectManyAsArray( - static kvp => getAllMembersToBeDefaulted(kvp.Value) + => containingType.AllRequiredMembers.SelectManyAsArray(static kvp => + getAllMembersToBeDefaulted(kvp.Value) ), ( @@ -2052,11 +2053,10 @@ static bool isNullableAnalysisEnabledAnywhere(CSharpCompilation compilation) { return true; } - return compilation.SyntaxTrees.Any( - static tree => - ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled( - new Text.TextSpan(0, tree.Length) - ) == true + return compilation.SyntaxTrees.Any(static tree => + ((CSharpSyntaxTree)tree).IsNullableAnalysisEnabled( + new Text.TextSpan(0, tree.Length) + ) == true ); } #endif @@ -5616,8 +5616,8 @@ BoundAnonymousObjectCreationExpression node (arg, self) => self.VisitRvalueWithState(arg), this ); - var argumentsWithAnnotations = argumentTypes.SelectAsArray( - arg => arg.ToTypeWithAnnotations(compilation) + var argumentsWithAnnotations = argumentTypes.SelectAsArray(arg => + arg.ToTypeWithAnnotations(compilation) ); if (argumentsWithAnnotations.All(argType => argType.HasType)) @@ -11409,7 +11409,9 @@ conversionOperand is BoundObjectCreationExpressionBase ) { operandType = completion( - targetTypeWithNullability.Type.GetNullableUnderlyingTypeWithAnnotations() + targetTypeWithNullability.Type.GetNullableUnderlyingTypeWithAnnotations( + + ) ); conversion = Conversion.MakeNullableConversion( ConversionKind.ImplicitNullable, diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs index 573426bab1c..ec3888550da 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/AsyncRewriter/AsyncExceptionHandlerRewriter.cs @@ -343,8 +343,9 @@ SynthesizedLocal pendingBranchVar // skip 0 - it means we took no explicit branches int i = 1; - var cases = - ArrayBuilder.GetInstance(); + var cases = ArrayBuilder.GetInstance( + + ); if (proxiedLabels != null) { @@ -1166,14 +1167,13 @@ AwaitCatchFrame parentOpt public void HoistLocal(LocalSymbol local, SyntheticBoundNodeFactory F) { if ( - !_hoistedLocals.Keys.Any( - l => - l.Name == local.Name - && TypeSymbol.Equals( - l.Type, - local.Type, - TypeCompareKind.ConsiderEverything2 - ) + !_hoistedLocals.Keys.Any(l => + l.Name == local.Name + && TypeSymbol.Equals( + l.Type, + local.Type, + TypeCompareKind.ConsiderEverything2 + ) ) ) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs index 14123736be8..f0d0c69258e 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.Analysis.cs @@ -400,10 +400,9 @@ private PooledDictionary< // calculate functions which directly capture a scope - var environmentsToScopes = PooledDictionary< - ClosureEnvironment, - Scope - >.GetInstance(); + var environmentsToScopes = PooledDictionary.GetInstance( + + ); VisitScopeTree( ScopeTree, diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs index 57a74f1ca88..c5afba6aec7 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/ClosureConversion/ClosureConversion.cs @@ -1926,8 +1926,9 @@ private void AddSynthesizedMethod(MethodSymbol method, BoundStatement body) { if (_synthesizedMethods == null) { - _synthesizedMethods = - ArrayBuilder.GetInstance(); + _synthesizedMethods = ArrayBuilder.GetInstance( + + ); } _synthesizedMethods.Add( diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs index 3a131c3e286..f915c35e44e 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter.cs @@ -433,8 +433,8 @@ public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatemen { var typeParameters = localFunction.TypeParameters; if ( - typeParameters.Any( - static typeParameter => typeParameter.HasUnmanagedTypeConstraint + typeParameters.Any(static typeParameter => + typeParameter.HasUnmanagedTypeConstraint ) ) { @@ -448,11 +448,10 @@ public override BoundNode VisitLocalFunctionStatement(BoundLocalFunctionStatemen localFunction, static t => t.ContainsNativeIntegerWrapperType() ) - || typeParameters.Any( - static t => - t.ConstraintTypesNoUseSiteDiagnostics.Any( - static t => t.ContainsNativeIntegerWrapperType() - ) + || typeParameters.Any(static t => + t.ConstraintTypesNoUseSiteDiagnostics.Any(static t => + t.ContainsNativeIntegerWrapperType() + ) ) ) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs index 74161f3d70d..3b121bf938e 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_CollectionExpression.cs @@ -1093,9 +1093,8 @@ Action, BoundExpression, BoundExpression> addEleme ); var builder = ArrayBuilder.GetInstance(); addElement(builder, rewrittenReceiver, rewrittenValue); - var statements = builder.SelectAsArray( - expr => - (BoundStatement)new BoundExpressionStatement(expr.Syntax, expr) + var statements = builder.SelectAsArray(expr => + (BoundStatement)new BoundExpressionStatement(expr.Syntax, expr) ); builder.Free(); Debug.Assert(statements.Length > 0); diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs index 02ef629a8b4..6ba9e0a7f7f 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_DeconstructionAssignmentOperator.cs @@ -368,8 +368,8 @@ ref inInit { var tupleType = NamedTypeSymbol.CreateTuple( locationOpt: null, - elementTypesWithAnnotations: builder!.SelectAsArray( - e => TypeWithAnnotations.Create(e.Type) + elementTypesWithAnnotations: builder!.SelectAsArray(e => + TypeWithAnnotations.Create(e.Type) ), elementLocations: default, elementNames: default, diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringConcat.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringConcat.cs index b04fbbae2f9..323535b25fc 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringConcat.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_StringConcat.cs @@ -81,8 +81,9 @@ loweredRight.Type is { } } // flatten and merge - ( expr1 + "A" ) + ("B" + expr2) ===> (expr1 + "AB" + expr2) - ArrayBuilder leftFlattened = - ArrayBuilder.GetInstance(); + ArrayBuilder leftFlattened = ArrayBuilder.GetInstance( + + ); ArrayBuilder rightFlattened = ArrayBuilder.GetInstance(); diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs index e3612bd94c5..270dd990ee3 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_UsingStatement.cs @@ -669,13 +669,12 @@ or RefKind.None } Debug.Assert( - methodArgumentInfo.Arguments.All( - arg => - arg - is not BoundConversion - { - ConversionKind: ConversionKind.InterpolatedStringHandler - } + methodArgumentInfo.Arguments.All(arg => + arg + is not BoundConversion + { + ConversionKind: ConversionKind.InterpolatedStringHandler + } ) ); #endif diff --git a/roslyn/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/IteratorAndAsyncCaptureWalker.cs b/roslyn/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/IteratorAndAsyncCaptureWalker.cs index 8689bc7e478..bfbc72a6412 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/IteratorAndAsyncCaptureWalker.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Lowering/StateMachineRewriter/IteratorAndAsyncCaptureWalker.cs @@ -426,7 +426,9 @@ IteratorAndAsyncCaptureWalker parent protected override bool ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException() { - return _parent.ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException(); + return _parent.ConvertInsufficientExecutionStackExceptionToCancelledByStackGuardException( + + ); } public override BoundNode VisitBlock(BoundBlock node) diff --git a/roslyn/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs b/roslyn/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs index dc4a8d05cf2..0d46adc5940 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Operations/CSharpOperationFactory.cs @@ -2077,8 +2077,8 @@ BoundCollectionExpression expr expr ) .GetPublicSymbol(); - ImmutableArray elements = expr.Elements.SelectAsArray( - e => CreateBoundCollectionExpressionElement(e) + ImmutableArray elements = expr.Elements.SelectAsArray(e => + CreateBoundCollectionExpressionElement(e) ); return new CollectionExpressionOperation( constructMethod, @@ -2573,8 +2573,9 @@ IOperation right BinaryOperatorKind operatorKind = Helper.DeriveBinaryOperatorKind( boundBinaryOperator.OperatorKind ); - IMethodSymbol operatorMethod = - boundBinaryOperator.LogicalOperator.GetPublicSymbol(); + IMethodSymbol operatorMethod = boundBinaryOperator.LogicalOperator.GetPublicSymbol( + + ); IMethodSymbol unaryOperatorMethod = boundBinaryOperator.OperatorKind.Operator() == CSharp.BinaryOperatorKind.And ? boundBinaryOperator.FalseOperator.GetPublicSymbol() @@ -3505,7 +3506,9 @@ boundUsingStatement.ExpressionOpt is object || boundUsingStatement.Locals.Length DisposeOperationInfo disposeOperationInfo = boundUsingStatement.PatternDisposeInfoOpt is object ? new DisposeOperationInfo( - disposeMethod: boundUsingStatement.PatternDisposeInfoOpt.Method.GetPublicSymbol(), + disposeMethod: boundUsingStatement.PatternDisposeInfoOpt.Method.GetPublicSymbol( + + ), disposeArguments: CreateDisposeArguments( boundUsingStatement.PatternDisposeInfoOpt ) @@ -4495,8 +4498,9 @@ BoundSwitchStatement boundSwitchStatement BoundSwitchSection, ISwitchCaseOperation >(boundSwitchStatement.SwitchSections); - ImmutableArray locals = - boundSwitchStatement.InnerLocals.GetPublicSymbols(); + ImmutableArray locals = boundSwitchStatement.InnerLocals.GetPublicSymbols( + + ); ILabelSymbol exitLabel = boundSwitchStatement.BreakLabel.GetPublicSymbol(); SyntaxNode syntax = boundSwitchStatement.Syntax; bool isImplicit = boundSwitchStatement.WasCompilerGenerated; diff --git a/roslyn/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor_Minimal.cs b/roslyn/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor_Minimal.cs index e4a2ef567cb..e7e5de20d49 100644 --- a/roslyn/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor_Minimal.cs +++ b/roslyn/src/Compilers/CSharp/Portable/SymbolDisplay/SymbolDisplayVisitor_Minimal.cs @@ -190,10 +190,9 @@ private IDictionary CreateAliasMap() { if (!this.IsMinimizing) { - return SpecializedCollections.EmptyDictionary< - INamespaceOrTypeSymbol, - IAliasSymbol - >(); + return SpecializedCollections.EmptyDictionary( + + ); } // Walk up the ancestors from the current position. If this is a speculative diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs index 62486a9edcb..b08fc8dc986 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/ConstraintsHelper.cs @@ -278,8 +278,9 @@ CompoundUseSiteInfo template case TypeKind.Struct: if (constraintType.IsNullableType()) { - var underlyingType = - constraintType.Type.GetNullableUnderlyingType(); + var underlyingType = constraintType.Type.GetNullableUnderlyingType( + + ); if (underlyingType.TypeKind == TypeKind.TypeParameter) { var underlyingTypeParameter = diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs index fcb9e41ea4b..281298caa9d 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/FunctionPointers/FunctionPointerMethodSymbol.cs @@ -28,8 +28,9 @@ public static FunctionPointerMethodSymbol CreateFromSource( bool suppressUseSiteDiagnostics ) { - ArrayBuilder customModifiers = - ArrayBuilder.GetInstance(); + ArrayBuilder customModifiers = ArrayBuilder.GetInstance( + + ); CallingConvention callingConvention = getCallingConvention( typeBinder.Compilation, syntax.CallingConvention, diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs index 075ac0ba982..9da40f38ab5 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEFieldSymbol.cs @@ -358,11 +358,10 @@ private void EnsureSignatureIsLoaded() : RefKind.None; _packedFlags.SetRefKind(refKind); _packedFlags.SetIsVolatile( - customModifiersArray.Any( - static m => - !m.IsOptional - && ((CSharpCustomModifier)m).ModifierSymbol.SpecialType - == SpecialType.System_Runtime_CompilerServices_IsVolatile + customModifiersArray.Any(static m => + !m.IsOptional + && ((CSharpCustomModifier)m).ModifierSymbol.SpecialType + == SpecialType.System_Runtime_CompilerServices_IsVolatile ) ); diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs index a0f265a78b8..9a887647c52 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PENamedTypeSymbol.cs @@ -95,8 +95,9 @@ private Dictionary< // a separate class with a noUncommonProperties singleton used for cases when type is "common". // this is done purely to save memory with expectation that "uncommon" cases are indeed uncommon. #region "Uncommon properties" - private static readonly UncommonProperties s_noUncommonProperties = - new UncommonProperties(); + private static readonly UncommonProperties s_noUncommonProperties = new UncommonProperties( + + ); private UncommonProperties _lazyUncommonProperties; private UncommonProperties GetUncommonProperties() @@ -2024,8 +2025,8 @@ private ImmutableArray MakeAcyclicInterfaces() return declaredInterfaces; } - return declaredInterfaces.SelectAsArray( - t => BaseTypeAnalysis.TypeDependsOn(t, this) ? CyclicInheritanceError(t) : t + return declaredInterfaces.SelectAsArray(t => + BaseTypeAnalysis.TypeDependsOn(t, this) ? CyclicInheritanceError(t) : t ); } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEPropertySymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEPropertySymbol.cs index 7f0d2ad631f..2b98eeb35bd 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEPropertySymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Metadata/PE/PEPropertySymbol.cs @@ -372,15 +372,13 @@ out isBad static bool anyUnexpectedRequiredModifiers(ParamInfo[] propertyParams) { - return propertyParams.Any( - p => - ( - !p.RefCustomModifiers.IsDefaultOrEmpty - && p.RefCustomModifiers.Any( - static m => - !m.IsOptional && !m.Modifier.IsWellKnownTypeInAttribute() - ) - ) || p.CustomModifiers.AnyRequired() + return propertyParams.Any(p => + ( + !p.RefCustomModifiers.IsDefaultOrEmpty + && p.RefCustomModifiers.Any(static m => + !m.IsOptional && !m.Modifier.IsWellKnownTypeInAttribute() + ) + ) || p.CustomModifiers.AnyRequired() ); } } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/PublicModel/NamedTypeSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/PublicModel/NamedTypeSymbol.cs index ccca6eb7026..76c46e24ece 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/PublicModel/NamedTypeSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/PublicModel/NamedTypeSymbol.cs @@ -60,7 +60,9 @@ ImmutableArray INamedTypeSymbol.TypeArguments { ImmutableInterlocked.InterlockedCompareExchange( ref _lazyTypeArguments, - UnderlyingNamedTypeSymbol.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.GetPublicSymbols(), + UnderlyingNamedTypeSymbol.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.GetPublicSymbols( + + ), default ); } @@ -73,7 +75,9 @@ ImmutableArray INamedTypeSymbol.TypeArguments { get { - return UnderlyingNamedTypeSymbol.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.ToPublicAnnotations(); + return UnderlyingNamedTypeSymbol.TypeArgumentsWithAnnotationsNoUseSiteDiagnostics.ToPublicAnnotations( + + ); } } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/ConstantEvaluationHelpers.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/ConstantEvaluationHelpers.cs index 1a66128c0e5..03f0c27eb99 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/ConstantEvaluationHelpers.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/ConstantEvaluationHelpers.cs @@ -301,15 +301,11 @@ ref ArrayBuilder fieldsInvolvedInCycles fieldsInvolvedInCycles.AddRange( graph .Keys.GroupBy(static f => f.DeclaringCompilation) - .SelectMany( - static g => - g.OrderByDescending( - (f1, f2) => - g.Key.CompareSourceLocations( - f1.ErrorLocation, - f2.ErrorLocation - ) - ) + .SelectMany(static g => + g.OrderByDescending( + (f1, f2) => + g.Key.CompareSourceLocations(f1.ErrorLocation, f2.ErrorLocation) + ) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs index af89885b7c7..86e95e92280 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/CustomModifierUtils.cs @@ -245,10 +245,9 @@ bool alsoCopyParamsModifier internal static bool HasInAttributeModifier(this ImmutableArray modifiers) { - return modifiers.Any( - static modifier => - !modifier.IsOptional - && ((CSharpCustomModifier)modifier).ModifierSymbol.IsWellKnownTypeInAttribute() + return modifiers.Any(static modifier => + !modifier.IsOptional + && ((CSharpCustomModifier)modifier).ModifierSymbol.IsWellKnownTypeInAttribute() ); } @@ -256,12 +255,11 @@ internal static bool HasRequiresLocationAttributeModifier( this ImmutableArray modifiers ) { - return modifiers.Any( - static modifier => - modifier.IsOptional - && ( - (CSharpCustomModifier)modifier - ).ModifierSymbol.IsWellKnownTypeRequiresLocationAttribute() + return modifiers.Any(static modifier => + modifier.IsOptional + && ( + (CSharpCustomModifier)modifier + ).ModifierSymbol.IsWellKnownTypeRequiresLocationAttribute() ); } @@ -269,21 +267,17 @@ internal static bool HasIsExternalInitModifier( this ImmutableArray modifiers ) { - return modifiers.Any( - static modifier => - !modifier.IsOptional - && ( - (CSharpCustomModifier)modifier - ).ModifierSymbol.IsWellKnownTypeIsExternalInit() + return modifiers.Any(static modifier => + !modifier.IsOptional + && ((CSharpCustomModifier)modifier).ModifierSymbol.IsWellKnownTypeIsExternalInit() ); } internal static bool HasOutAttributeModifier(this ImmutableArray modifiers) { - return modifiers.Any( - static modifier => - !modifier.IsOptional - && ((CSharpCustomModifier)modifier).ModifierSymbol.IsWellKnownTypeOutAttribute() + return modifiers.Any(static modifier => + !modifier.IsOptional + && ((CSharpCustomModifier)modifier).ModifierSymbol.IsWellKnownTypeOutAttribute() ); } } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs index 72939ff24c6..a10a3227358 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceAssemblySymbol.cs @@ -278,8 +278,8 @@ internal string FileVersion { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyFileVersionAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyFileVersionAttributeSetting ); } } @@ -288,8 +288,8 @@ internal string Title { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyTitleAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyTitleAttributeSetting ); } } @@ -298,8 +298,8 @@ internal string Description { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyDescriptionAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyDescriptionAttributeSetting ); } } @@ -308,8 +308,8 @@ internal string Company { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyCompanyAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyCompanyAttributeSetting ); } } @@ -318,8 +318,8 @@ internal string Product { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyProductAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyProductAttributeSetting ); } } @@ -328,8 +328,8 @@ internal string InformationalVersion { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyInformationalVersionAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyInformationalVersionAttributeSetting ); } } @@ -338,8 +338,8 @@ internal string Copyright { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyCopyrightAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyCopyrightAttributeSetting ); } } @@ -348,8 +348,8 @@ internal string Trademark { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyTrademarkAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyTrademarkAttributeSetting ); } } @@ -410,8 +410,8 @@ private string AssemblyCultureAttributeSetting { get { - return GetWellKnownAttributeDataStringField( - data => data.AssemblyCultureAttributeSetting + return GetWellKnownAttributeDataStringField(data => + data.AssemblyCultureAttributeSetting ); } } @@ -1261,7 +1261,9 @@ private void ReportDiagnosticsForAddedModules() try { foreach ( - var referencedModuleName in m.Module.GetReferencedManagedModulesOrThrow() + var referencedModuleName in m.Module.GetReferencedManagedModulesOrThrow( + + ) ) { // Do not report error for this module twice @@ -2010,8 +2012,8 @@ internal bool IsIndexOfOmittedAssemblyAttribute(int index) { Debug.Assert( _lazyOmittedAttributeIndices == null - || !_lazyOmittedAttributeIndices.Any( - i => i < 0 || i >= this.GetAttributes().Length + || !_lazyOmittedAttributeIndices.Any(i => + i < 0 || i >= this.GetAttributes().Length ) ); Debug.Assert(_lazySourceAttributesBag.IsSealed); diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs index 248de917c80..8718802c42b 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceComplexParameterSymbol.cs @@ -135,8 +135,9 @@ internal override int CallerArgumentExpressionParameterIndex { get { - return GetEarlyDecodedWellKnownAttributeData()?.CallerArgumentExpressionParameterIndex - ?? -1; + return GetEarlyDecodedWellKnownAttributeData( + + )?.CallerArgumentExpressionParameterIndex ?? -1; } } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs index 7914dc58f22..8018620176a 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMemberContainerSymbol_ImplementationChecks.cs @@ -2171,8 +2171,8 @@ internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? metho nRefParametersRequired = 1; } else if ( - parameters.Any( - p => (p.RefKind is RefKind.Ref or RefKind.Out) && p.Type.IsRefLikeType + parameters.Any(p => + (p.RefKind is RefKind.Ref or RefKind.Out) && p.Type.IsRefLikeType ) ) { @@ -2185,13 +2185,12 @@ internal static bool RequiresValidScopedOverrideForRefSafety(MethodSymbol? metho // ... // - The method has at least one additional `ref`, `in`, `ref readonly`, or `out` parameter, or a parameter of `ref struct` type. - int nRefParameters = parameters.Count( - p => - p.RefKind - is RefKind.Ref - or RefKind.In - or RefKind.RefReadOnlyParameter - or RefKind.Out + int nRefParameters = parameters.Count(p => + p.RefKind + is RefKind.Ref + or RefKind.In + or RefKind.RefReadOnlyParameter + or RefKind.Out ); if (nRefParameters >= nRefParametersRequired) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs index 022d24185a7..2c6dccf9c77 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceMethodSymbolWithAttributes.cs @@ -866,8 +866,9 @@ BindingDiagnosticBag diagnostics if (this.IsAccessor()) { // CS1667: Attribute '{0}' is not valid on property or event accessors. It is only valid on '{1}' declarations. - AttributeUsageInfo attributeUsage = - attribute.AttributeClass.GetAttributeUsageInfo(); + AttributeUsageInfo attributeUsage = attribute.AttributeClass.GetAttributeUsageInfo( + + ); diagnostics.Add( ErrorCode.ERR_AttributeNotOnAccessor, node.Name.Location, @@ -1281,8 +1282,8 @@ is not [ (CSharpParseOptions)attributeSyntax.SyntaxTree.Options ).InterceptorsPreviewNamespaces; var thisNamespaceNames = getNamespaceNames(); - var foundAnyMatch = interceptorsNamespaces.Any( - ns => isDeclaredInNamespace(thisNamespaceNames, ns) + var foundAnyMatch = interceptorsNamespaces.Any(ns => + isDeclaredInNamespace(thisNamespaceNames, ns) ); if (!foundAnyMatch) { @@ -1926,8 +1927,8 @@ BindingDiagnosticBag diagnostics var cancellationTokenType = DeclaringCompilation.GetWellKnownType( WellKnownType.System_Threading_CancellationToken ); - var enumeratorCancellationCount = Parameters.Count( - p => p.IsSourceParameterWithEnumeratorCancellationAttribute() + var enumeratorCancellationCount = Parameters.Count(p => + p.IsSourceParameterWithEnumeratorCancellationAttribute() ); if ( enumeratorCancellationCount == 0 diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs index 9437f7aa064..ded035b4469 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamedTypeSymbol.cs @@ -2480,15 +2480,14 @@ protected override void AfterMembersCompletedChecks(BindingDiagnosticBag diagnos if ( ObsoleteKind != ObsoleteAttributeKind.None || GetMembers() - .All( - m => - m - is not MethodSymbol - { - MethodKind: MethodKind.Constructor, - ObsoleteKind: ObsoleteAttributeKind.None - } method - || !method.ShouldCheckRequiredMembers() + .All(m => + m + is not MethodSymbol + { + MethodKind: MethodKind.Constructor, + ObsoleteKind: ObsoleteAttributeKind.None + } method + || !method.ShouldCheckRequiredMembers() ) ) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs index 9d2e1c2b23f..c04e483e5e4 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceNamespaceSymbol.cs @@ -150,8 +150,9 @@ out wasZeroWidthMatch private static readonly Func< SingleNamespaceDeclaration, SyntaxReference - > s_declaringSyntaxReferencesSelector = d => - new NamespaceDeclarationSyntaxReference(d.SyntaxReference); + > s_declaringSyntaxReferencesSelector = d => new NamespaceDeclarationSyntaxReference( + d.SyntaxReference + ); public override ImmutableArray DeclaringSyntaxReferences => ComputeDeclaringReferencesCore(); diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceTypeParameterSymbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceTypeParameterSymbol.cs index c0967ef827c..79b14ab5613 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceTypeParameterSymbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Source/SourceTypeParameterSymbol.cs @@ -340,8 +340,8 @@ private void EnsureAttributesFromConstraints(BindingDiagnosticBag diagnostics) { if ( DeclaringCompilation.ShouldEmitNativeIntegerAttributes() - && ConstraintTypesNoUseSiteDiagnostics.Any( - static t => t.ContainsNativeIntegerWrapperType() + && ConstraintTypesNoUseSiteDiagnostics.Any(static t => + t.ContainsNativeIntegerWrapperType() ) ) { diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Symbol.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Symbol.cs index 88711b15f70..ed11076bcb7 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Symbol.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Symbol.cs @@ -538,8 +538,8 @@ ImmutableArray locations SyntaxNode parent = location.SourceTree.GetRoot(); SyntaxNode found = null; foreach ( - var descendant in parent.DescendantNodesAndSelf( - c => c.Location.SourceSpan.Contains(location.SourceSpan) + var descendant in parent.DescendantNodesAndSelf(c => + c.Location.SourceSpan.Contains(location.SourceSpan) ) ) { @@ -754,9 +754,9 @@ internal bool CanBeReferencedByNameIgnoringIllegalCharacters return true; case MethodKind.PropertyGet: case MethodKind.PropertySet: - return ( - (PropertySymbol)method.AssociatedSymbol - ).CanCallMethodsDirectly(); + return ((PropertySymbol)method.AssociatedSymbol).CanCallMethodsDirectly( + + ); default: return false; } diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordDeconstruct.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordDeconstruct.cs index 3e1fa390e6a..c29014f660b 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordDeconstruct.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/Synthesized/Records/SynthesizedRecordDeconstruct.cs @@ -34,8 +34,8 @@ int memberOffset ) { Debug.Assert( - positionalMembers.All( - p => p is PropertySymbol { GetMethod: not null } or FieldSymbol + positionalMembers.All(p => + p is PropertySymbol { GetMethod: not null } or FieldSymbol ) ); _ctor = ctor; diff --git a/roslyn/src/Compilers/CSharp/Portable/Symbols/VarianceSafety.cs b/roslyn/src/Compilers/CSharp/Portable/Symbols/VarianceSafety.cs index f544d1fb462..4d7fce5d9b3 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Symbols/VarianceSafety.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Symbols/VarianceSafety.cs @@ -201,8 +201,9 @@ private static bool SkipVarianceSafetyChecks(Symbol member) { if (member.IsStatic && !member.IsAbstract && !member.IsVirtual) { - return MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion() - <= member.DeclaringCompilation.LanguageVersion; + return MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion( + + ) <= member.DeclaringCompilation.LanguageVersion; } return false; @@ -587,7 +588,9 @@ MessageID expectedVariance actualVariance.Localize(), expectedVariance.Localize(), new CSharpRequiredLanguageVersion( - MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion() + MessageID.IDS_FeatureVarianceSafetyForStaticInterfaceMembers.RequiredVersion( + + ) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs b/roslyn/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs index 584cf80d9f1..c52743d5940 100644 --- a/roslyn/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs +++ b/roslyn/src/Compilers/CSharp/Portable/Syntax/LambdaUtilities.cs @@ -412,11 +412,11 @@ out SyntaxNode? lambdaBody2 public static bool AreEquivalentIgnoringLambdaBodies(SyntaxNode oldNode, SyntaxNode newNode) { // all tokens that don't belong to a lambda body: - var oldTokens = oldNode.DescendantTokens( - node => node == oldNode || !IsLambdaBodyStatementOrExpression(node) + var oldTokens = oldNode.DescendantTokens(node => + node == oldNode || !IsLambdaBodyStatementOrExpression(node) ); - var newTokens = newNode.DescendantTokens( - node => node == newNode || !IsLambdaBodyStatementOrExpression(node) + var newTokens = newNode.DescendantTokens(node => + node == newNode || !IsLambdaBodyStatementOrExpression(node) ); return oldTokens.SequenceEqual(newTokens, SyntaxFactory.AreEquivalent); diff --git a/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs b/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs index dfdf78a2044..183250a920d 100644 --- a/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs @@ -73,8 +73,8 @@ static CommandLineTests() var dotnetExe = DotNetCoreSdk.ExePath; var netStandardDllPath = AppDomain .CurrentDomain.GetAssemblies() - .FirstOrDefault( - assembly => !assembly.IsDynamic && assembly.Location.EndsWith("netstandard.dll") + .FirstOrDefault(assembly => + !assembly.IsDynamic && assembly.Location.EndsWith("netstandard.dll") ) .Location; var netStandardDllDir = Path.GetDirectoryName(netStandardDllPath); @@ -3343,8 +3343,8 @@ public void Embed() parsedArgs.Errors.Verify(); ; AssertEx.Equal( - new[] { "a.txt", "a.cs", "b.cs", "c.cs" }.Select( - f => Path.Combine(WorkingDirectory, f) + new[] { "a.txt", "a.cs", "b.cs", "c.cs" }.Select(f => + Path.Combine(WorkingDirectory, f) ), parsedArgs.EmbeddedFiles.Select(f => f.Path) ); @@ -7896,8 +7896,8 @@ private static void AssertSpecificDiagnostics( CSharpCommandLineArguments args ) { - var actualOrdered = args.CompilationOptions.SpecificDiagnosticOptions.OrderBy( - entry => entry.Key + var actualOrdered = args.CompilationOptions.SpecificDiagnosticOptions.OrderBy(entry => + entry.Key ); AssertEx.Equal( diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs index 58fd536b47e..77ef23e74e2 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncLocalsTests.cs @@ -1050,10 +1050,9 @@ public static void Main() .Single(s => s.Name.StartsWith("", StringComparison.Ordinal)); IEnumerable> spillFieldsByType = stateMachineClass .GetMembers() - .Where( - m => - m.Kind == SymbolKind.Field - && m.Name.StartsWith("<>7__wrap", StringComparison.Ordinal) + .Where(m => + m.Kind == SymbolKind.Field + && m.Name.StartsWith("<>7__wrap", StringComparison.Ordinal) ) .Cast() .GroupBy(x => x.Type); @@ -1062,13 +1061,12 @@ public static void Main() Assert.Equal( 1, spillFieldsByType - .Single( - x => - TypeSymbol.Equals( - x.Key, - comp.GetSpecialType(SpecialType.System_Int32), - TypeCompareKind.ConsiderEverything2 - ) + .Single(x => + TypeSymbol.Equals( + x.Key, + comp.GetSpecialType(SpecialType.System_Int32), + TypeCompareKind.ConsiderEverything2 + ) ) .Count() ); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs index 7452bbdcced..e0da90e0d2b 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs @@ -5344,8 +5344,8 @@ private static void VerifyParamArrayAttribute( var allAttributes = ( (PEModuleSymbol)parameter.ContainingModule ).GetCustomAttributesForToken(peParameter.Handle); - var paramArrayAttributes = allAttributes.Where( - a => a.AttributeClass.ToTestDisplayString() == "System.ParamArrayAttribute" + var paramArrayAttributes = allAttributes.Where(a => + a.AttributeClass.ToTestDisplayString() == "System.ParamArrayAttribute" ); if (expected) diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/DestructorTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/DestructorTests.cs index dada4af4333..1b53de81dcf 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/DestructorTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/DestructorTests.cs @@ -940,18 +940,14 @@ public class A // Find the handle and row for A. var pairA = peFileReader .TypeDefinitions.AsEnumerable() - .Select( - handle => - new - { - handle = handle, - row = peFileReader.GetTypeDefinition(handle) - } - ) - .Single( - pair => - peFileReader.GetString(pair.row.Name) == "A" - && string.IsNullOrEmpty(peFileReader.GetString(pair.row.Namespace)) + .Select(handle => new + { + handle = handle, + row = peFileReader.GetTypeDefinition(handle) + }) + .Single(pair => + peFileReader.GetString(pair.row.Name) == "A" + && string.IsNullOrEmpty(peFileReader.GetString(pair.row.Namespace)) ); TypeDefinitionHandle handleA = pairA.handle; TypeDefinition typeA = pairA.row; @@ -960,43 +956,37 @@ public class A MethodDefinitionHandle handleDestructorA = typeA .GetMethods() .AsEnumerable() - .Single( - handle => - peFileReader.GetString( - peFileReader.GetMethodDefinition(handle).Name - ) == WellKnownMemberNames.DestructorName + .Single(handle => + peFileReader.GetString(peFileReader.GetMethodDefinition(handle).Name) + == WellKnownMemberNames.DestructorName ); // Find the handle for System.Object. TypeReferenceHandle handleObject = peFileReader .TypeReferences.AsEnumerable() - .Select( - handle => - new { handle = handle, row = peFileReader.GetTypeReference(handle) } - ) - .Single( - pair => - peFileReader.GetString(pair.row.Name) == "Object" - && peFileReader.GetString(pair.row.Namespace) == "System" + .Select(handle => new + { + handle = handle, + row = peFileReader.GetTypeReference(handle) + }) + .Single(pair => + peFileReader.GetString(pair.row.Name) == "Object" + && peFileReader.GetString(pair.row.Namespace) == "System" ) .handle; // Find the handle for System.Object's destructor. MemberReferenceHandle handleDestructorObject = peFileReader .MemberReferences.AsEnumerable() - .Select( - handle => - new - { - handle = handle, - row = peFileReader.GetMemberReference(handle) - } - ) - .Single( - pair => - pair.row.Parent == (EntityHandle)handleObject - && peFileReader.GetString(pair.row.Name) - == WellKnownMemberNames.DestructorName + .Select(handle => new + { + handle = handle, + row = peFileReader.GetMemberReference(handle) + }) + .Single(pair => + pair.row.Parent == (EntityHandle)handleObject + && peFileReader.GetString(pair.row.Name) + == WellKnownMemberNames.DestructorName ) .handle; diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs index 1402542cbe6..cb6ad9d20f0 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/CodeGen/SwitchTests.cs @@ -3179,12 +3179,11 @@ .locals init (string V_0, //value var pid = ( (NamedTypeSymbol) comp.GlobalNamespace.GetMembers() - .Single( - s => - s.Name.StartsWith( - "", - StringComparison.Ordinal - ) + .Single(s => + s.Name.StartsWith( + "", + StringComparison.Ordinal + ) ) ); var member = pid.GetMembers( diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs index aec9ffb0c82..133929e291e 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/CompilationEmitTests.cs @@ -1185,12 +1185,8 @@ public void RefAssembly_HasReferenceAssemblyAttribute() "MemberReference:Void System.Diagnostics.DebuggableAttribute..ctor(DebuggingModes)", "MemberReference:Void System.Runtime.CompilerServices.ReferenceAssemblyAttribute..ctor()" }, - attributes.Select( - a => - MetadataReaderUtils.Dump( - reader, - reader.GetCustomAttribute(a).Constructor - ) + attributes.Select(a => + MetadataReaderUtils.Dump(reader, reader.GetCustomAttribute(a).Constructor) ) ); }; @@ -1214,12 +1210,8 @@ public void RefAssembly_HandlesMissingReferenceAssemblyAttribute() var reader = assembly.GetMetadataReader(); var attributes = reader.GetAssemblyDefinition().GetCustomAttributes(); AssertEx.SetEqual( - attributes.Select( - a => - MetadataReaderUtils.Dump( - reader, - reader.GetCustomAttribute(a).Constructor - ) + attributes.Select(a => + MetadataReaderUtils.Dump(reader, reader.GetCustomAttribute(a).Constructor) ), new string[] { @@ -1260,12 +1252,8 @@ public void RefAssembly_ReferenceAssemblyAttributeAlsoInSource() "MemberReference:Void System.Diagnostics.DebuggableAttribute..ctor(DebuggingModes)", "MemberReference:Void System.Runtime.CompilerServices.ReferenceAssemblyAttribute..ctor()" }, - attributes.Select( - a => - MetadataReaderUtils.Dump( - reader, - reader.GetCustomAttribute(a).Constructor - ) + attributes.Select(a => + MetadataReaderUtils.Dump(reader, reader.GetCustomAttribute(a).Constructor) ) ); }; @@ -3778,8 +3766,8 @@ public class Class1 : CppCli.CppBase2, CppCli.CppInterface1 var cciExplicit = class1TypeDef.GetExplicitImplementationOverrides(context); var cciMethods = class1TypeDef .GetMethods(context) - .Where( - m => ((MethodSymbol)m.GetInternalSymbol()).MethodKind != MethodKind.Constructor + .Where(m => + ((MethodSymbol)m.GetInternalSymbol()).MethodKind != MethodKind.Constructor ); context.Diagnostics.Verify(); @@ -7118,6 +7106,7 @@ public static void Main(string[] args) ); // Before the bug was fixed, the PrivateImplementationDetails classes clashed, resulting in the commented-out error below. comp3.VerifyDiagnostics( + ////// error CS0101: The namespace '' already contains a definition for '' ////Diagnostic(ErrorCode.ERR_DuplicateNameInNS).WithArguments("", "").WithLocation(1, 1) ); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs index 358f7adc494..b1eed7eae52 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs @@ -75,8 +75,8 @@ public C() SemanticEditKind.Delete, symbolProvider: c => c.GetMember("C") - .InstanceConstructors.FirstOrDefault( - c => c.Parameters.Length == 1 + .InstanceConstructors.FirstOrDefault(c => + c.Parameters.Length == 1 ), newSymbolProvider: c => c.GetMember("C") ), @@ -143,8 +143,8 @@ class C SemanticEditKind.Delete, symbolProvider: c => c.GetMember("C") - .InstanceConstructors.FirstOrDefault( - c => c.Parameters.Length == 1 + .InstanceConstructors.FirstOrDefault(c => + c.Parameters.Length == 1 ), newSymbolProvider: c => c.GetMember("C") ), @@ -7514,12 +7514,11 @@ class C Assert.Equal(7, baseAttributeCount); Assert.Equal(2, baseParameterCount); - var attributeTypeDefHandle = reader0.TypeDefinitions.Single( - d => - reader0.StringComparer.Equals( - reader0.GetTypeDefinition(d).Name, - "MetadataUpdateOriginalTypeAttribute" - ) + var attributeTypeDefHandle = reader0.TypeDefinitions.Single(d => + reader0.StringComparer.Equals( + reader0.GetTypeDefinition(d).Name, + "MetadataUpdateOriginalTypeAttribute" + ) ); var attributeCtorDefHandle = reader0.MethodDefinitions.Single(d => { @@ -15546,8 +15545,8 @@ class C // No CDIs should be emitted, specifically not PortableCustomDebugInfoKinds.TypeDefinitionDocuments Assert.Empty( - pdbReader.CustomDebugInformation.Select( - cdi => pdbReader.GetGuid(pdbReader.GetCustomDebugInformation(cdi).Kind) + pdbReader.CustomDebugInformation.Select(cdi => + pdbReader.GetGuid(pdbReader.GetCustomDebugInformation(cdi).Kind) ) ); } @@ -21927,10 +21926,9 @@ class C SemanticEditKind.Delete, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetParameterTypes()[0].SpecialType - == SpecialType.System_Int32 + .FirstOrDefault(m => + m.GetParameterTypes()[0].SpecialType + == SpecialType.System_Int32 ) ?.ISymbol, newSymbolProvider: c => c.GetMember("C") @@ -21939,10 +21937,9 @@ class C SemanticEditKind.Insert, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetParameterTypes()[0].SpecialType - == SpecialType.System_Boolean + .FirstOrDefault(m => + m.GetParameterTypes()[0].SpecialType + == SpecialType.System_Boolean ) ?.ISymbol ), @@ -22007,10 +22004,9 @@ class C SemanticEditKind.Delete, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetParameterTypes()[0].SpecialType - == SpecialType.System_Boolean + .FirstOrDefault(m => + m.GetParameterTypes()[0].SpecialType + == SpecialType.System_Boolean ) ?.ISymbol, newSymbolProvider: c => c.GetMember("C") @@ -22019,10 +22015,9 @@ class C SemanticEditKind.Insert, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetParameterTypes()[0].SpecialType - == SpecialType.System_Int32 + .FirstOrDefault(m => + m.GetParameterTypes()[0].SpecialType + == SpecialType.System_Int32 ) ?.ISymbol ), @@ -22105,10 +22100,9 @@ class C SemanticEditKind.Delete, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetTypeOrReturnType().SpecialType - == SpecialType.System_String + .FirstOrDefault(m => + m.GetTypeOrReturnType().SpecialType + == SpecialType.System_String ) ?.ISymbol, newSymbolProvider: c => c.GetMember("C") @@ -22117,10 +22111,9 @@ class C SemanticEditKind.Insert, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetTypeOrReturnType().SpecialType - == SpecialType.System_Int32 + .FirstOrDefault(m => + m.GetTypeOrReturnType().SpecialType + == SpecialType.System_Int32 ) ?.ISymbol ), @@ -22188,10 +22181,9 @@ class C SemanticEditKind.Delete, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetTypeOrReturnType().SpecialType - == SpecialType.System_Int32 + .FirstOrDefault(m => + m.GetTypeOrReturnType().SpecialType + == SpecialType.System_Int32 ) ?.ISymbol, newSymbolProvider: c => c.GetMember("C") @@ -22200,10 +22192,9 @@ class C SemanticEditKind.Insert, symbolProvider: c => c.GetMembers("C.M") - .FirstOrDefault( - m => - m.GetTypeOrReturnType().SpecialType - == SpecialType.System_String + .FirstOrDefault(m => + m.GetTypeOrReturnType().SpecialType + == SpecialType.System_String ) ?.ISymbol ), diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.cs index 0d20f67aa7f..f761760c332 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/SymbolMatcherTests.cs @@ -2074,16 +2074,16 @@ class A .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); var members0 = compilation0 .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); Assert.Equal(6, members1.Length); @@ -2133,16 +2133,16 @@ class A .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); var members0 = compilation0 .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); Assert.Equal(6, members1.Length); @@ -2202,16 +2202,16 @@ class A .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); var members0 = compilation0 .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); Assert.Equal(3, members1.Length); @@ -2266,8 +2266,8 @@ class A .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); Assert.Equal(6, members1.Length); @@ -2318,8 +2318,8 @@ class A .GetMember("A") .GetMembers() .OfType() - .Where( - m => m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) + .Where(m => + m.MethodKind is (MethodKind.Conversion or MethodKind.UserDefinedOperator) ) .ToArray(); Assert.Equal(6, members1.Length); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs index 74ce76be030..06a675ffd00 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit/PDB/PDBSourceLinkTests.cs @@ -209,8 +209,10 @@ public static void Main() rebuildData: null, testData: new CompilationTestData() { - SymWriterFactory = metadataProvider => - new SymUnmanagedWriterWithoutSourceLinkSupport(metadataProvider) + SymWriterFactory = + metadataProvider => new SymUnmanagedWriterWithoutSourceLinkSupport( + metadataProvider + ) } ); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Assembly.cs b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Assembly.cs index 8097fbea9ee..dbf88d8e125 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Assembly.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Assembly.cs @@ -1890,9 +1890,8 @@ string attrTypeName var sourceAttributes = compilation .Assembly.GetAttributes() - .Where( - a => - string.Equals(a.AttributeClass.Name, attrTypeName, StringComparison.Ordinal) + .Where(a => + string.Equals(a.AttributeClass.Name, attrTypeName, StringComparison.Ordinal) ); Assert.Equal(expectedSrcAttrCount, sourceAttributes.Count()); @@ -1909,13 +1908,12 @@ string attrTypeName var metadataAttributes = module .ContainingAssembly.GetAttributes() - .Where( - a => - string.Equals( - a.AttributeClass.Name, - attrTypeName, - StringComparison.Ordinal - ) + .Where(a => + string.Equals( + a.AttributeClass.Name, + attrTypeName, + StringComparison.Ordinal + ) ); Assert.Equal(expectedEmittedAttrsCount, metadataAttributes.Count()); @@ -3447,9 +3445,8 @@ AssemblySymbol assembly { return assembly .GetAttributes() - .Where( - data => - data.IsTargetAttribute(AttributeDescription.AssemblyDescriptionAttribute) + .Where(data => + data.IsTargetAttribute(AttributeDescription.AssemblyDescriptionAttribute) ); } @@ -3656,11 +3653,8 @@ public void Bug649346() symbolValidator: (ModuleSymbol m) => { var attrs = m.ContainingAssembly.GetAttributes(); - var attrlist = attrs.Where( - a => - a.IsTargetAttribute( - AttributeDescription.AssemblyFileVersionAttribute - ) + var attrlist = attrs.Where(a => + a.IsTargetAttribute(AttributeDescription.AssemblyFileVersionAttribute) ); Assert.Equal(1, attrlist.Count()); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Nullable.cs b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Nullable.cs index 0e34bba1251..e5b1b255742 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Nullable.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Nullable.cs @@ -81,8 +81,8 @@ public interface I0 : I1 AssertEx.SetEqual( new[] { "I1", "I2" }, - imc1.AllInterfacesNoUseSiteDiagnostics.Select( - i => i.ToTestDisplayString(includeNonNullable: true) + imc1.AllInterfacesNoUseSiteDiagnostics.Select(i => + i.ToTestDisplayString(includeNonNullable: true) ) ); @@ -113,8 +113,8 @@ public void M(I0 imc) AssertEx.SetEqual( new[] { "I1", "I2" }, - imc2.AllInterfacesNoUseSiteDiagnostics.Select( - i => i.ToTestDisplayString(includeNonNullable: true) + imc2.AllInterfacesNoUseSiteDiagnostics.Select(i => + i.ToTestDisplayString(includeNonNullable: true) ) ); } @@ -168,8 +168,8 @@ public class C0 : I1 AssertEx.SetEqual( new[] { "I1", "I2" }, - lib2_c0.AllInterfacesNoUseSiteDiagnostics.Select( - i => i.ToTestDisplayString(includeNonNullable: true) + lib2_c0.AllInterfacesNoUseSiteDiagnostics.Select(i => + i.ToTestDisplayString(includeNonNullable: true) ) ); @@ -228,8 +228,8 @@ public class C1 : C0 AssertEx.SetEqual( new[] { "I1", "I2" }, - lib3_c0.AllInterfacesNoUseSiteDiagnostics.Select( - i => i.ToTestDisplayString(includeNonNullable: true) + lib3_c0.AllInterfacesNoUseSiteDiagnostics.Select(i => + i.ToTestDisplayString(includeNonNullable: true) ) ); @@ -250,16 +250,15 @@ void assertType(MetadataReader reader, bool exists, string name) { if (exists) { - _ = reader.TypeDefinitions.Single( - h => reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) + _ = reader.TypeDefinitions.Single(h => + reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) ); } else { Assert.False( - reader.TypeDefinitions.Any( - h => - reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) + reader.TypeDefinitions.Any(h => + reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) ) ); } @@ -377,8 +376,8 @@ public interface I0 : I1 "I1", "I2" }, - imc1.AllInterfacesNoUseSiteDiagnostics.Select( - i => i.ToTestDisplayString(includeNonNullable: true) + imc1.AllInterfacesNoUseSiteDiagnostics.Select(i => + i.ToTestDisplayString(includeNonNullable: true) ) ); } @@ -6416,8 +6415,7 @@ public void Tuples() .ToArray(); // Nested tuple - var field = fieldDefs.Single( - f => reader.StringComparer.Equals(f.Name, "Nested") + var field = fieldDefs.Single(f => reader.StringComparer.Equals(f.Name, "Nested") ); var customAttributes = field.GetCustomAttributes(); AssertAttributes( @@ -7240,18 +7238,17 @@ private static CSharpAttributeData GetNullableAttribute( ImmutableArray attributes ) { - return attributes.Single( - a => - a.AttributeClass.ToTestDisplayString() - == "System.Runtime.CompilerServices.NullableAttribute" + return attributes.Single(a => + a.AttributeClass.ToTestDisplayString() + == "System.Runtime.CompilerServices.NullableAttribute" ); } private static TypeDefinition GetTypeDefinitionByName(MetadataReader reader, string name) { return reader.GetTypeDefinition( - reader.TypeDefinitions.Single( - h => reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) + reader.TypeDefinitions.Single(h => + reader.StringComparer.Equals(reader.GetTypeDefinition(h).Name, name) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Synthesized.cs b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Synthesized.cs index 8571c344d44..228bfec150c 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Synthesized.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/AttributeTests_Synthesized.cs @@ -171,12 +171,11 @@ class C var pid = (NamedTypeSymbol) comp.GlobalNamespace.GetMembers() - .Where( - s => - s.Name.StartsWith( - "", - StringComparison.Ordinal - ) + .Where(s => + s.Name.StartsWith( + "", + StringComparison.Ordinal + ) ) .Single(); diff --git a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/InternalsVisibleToAndStrongNameTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/InternalsVisibleToAndStrongNameTests.cs index 58533ed1af4..34b91102eb6 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/InternalsVisibleToAndStrongNameTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit2/Attributes/InternalsVisibleToAndStrongNameTests.cs @@ -3706,11 +3706,10 @@ public void Bug1095618(CSharpParseOptions parseOptions) Assert.False( assembly .GetAttributes() - .Any( - attr => - attr.IsTargetAttribute( - AttributeDescription.InternalsVisibleToAttribute - ) + .Any(attr => + attr.IsTargetAttribute( + AttributeDescription.InternalsVisibleToAttribute + ) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Emit2/Semantics/PatternMatchingTests.cs b/roslyn/src/Compilers/CSharp/Test/Emit2/Semantics/PatternMatchingTests.cs index 8ce1a86d53f..33ffdd09098 100644 --- a/roslyn/src/Compilers/CSharp/Test/Emit2/Semantics/PatternMatchingTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Emit2/Semantics/PatternMatchingTests.cs @@ -5616,16 +5616,15 @@ public void MultiFuzz() int dt = (int)Math.Abs(DateTime.Now.Ticks % 1000000000); var tasks = Enumerable .Range(0, numTasks) - .Select( - t => - Task.Run(() => + .Select(t => + Task.Run(() => + { + int k = dt + t * numTestsPerTask; + for (int i = 1; i < numTestsPerTask; i++) { - int k = dt + t * numTestsPerTask; - for (int i = 1; i < numTestsPerTask; i++) - { - PatternMatchingFuzz(i + k); - } - }) + PatternMatchingFuzz(i + k); + } + }) ); Task.WaitAll(tasks.ToArray()); } @@ -13123,9 +13122,8 @@ class Program .OfType() .ToArray(); var types = locals - .Select( - local => - ((ILocalSymbol)model.GetDeclaredSymbol(local)).Type.ToTestDisplayString() + .Select(local => + ((ILocalSymbol)model.GetDeclaredSymbol(local)).Type.ToTestDisplayString() ) .ToArray(); AssertEx.Equal( diff --git a/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests.cs b/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests.cs index d44a5d169bc..d444548a6c1 100644 --- a/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests.cs @@ -842,14 +842,13 @@ public class C Enumerable .Range(0, nTasks) .AsParallel() - .ForAll( - _ => - Assert.Equal( - "System.String System.String.op_Addition(System.String left, System.String right)", - model - .GetSymbolInfo(fieldInitializer) - .Symbol.ToTestDisplayString(includeNonNullable: false) - ) + .ForAll(_ => + Assert.Equal( + "System.String System.String.op_Addition(System.String left, System.String right)", + model + .GetSymbolInfo(fieldInitializer) + .Symbol.ToTestDisplayString(includeNonNullable: false) + ) ); } } diff --git a/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IDelegateCreationExpression.cs b/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IDelegateCreationExpression.cs index f058a6c99b3..51dee66ed7e 100644 --- a/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IDelegateCreationExpression.cs +++ b/roslyn/src/Compilers/CSharp/Test/IOperation/IOperation/IOperationTests_IDelegateCreationExpression.cs @@ -2095,7 +2095,9 @@ void Main() source, expectedOperationTree, expectedDiagnostics, - additionalOperationTreeVerifier: new IOperationTests_IConversionExpression.ExpectedSymbolVerifier().Verify + additionalOperationTreeVerifier: new IOperationTests_IConversionExpression.ExpectedSymbolVerifier( + + ).Verify ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ConstantTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ConstantTests.cs index 432477ec401..e1a184b40a3 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ConstantTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ConstantTests.cs @@ -1531,11 +1531,10 @@ Func predicate .Where(predicate) .OfType() .Where(node => node.ConstantValueOpt != null) - .Select( - node => - node.Syntax.ToFullString().Trim() - + " --> " - + ExtractValue(node.ConstantValueOpt) + .Select(node => + node.Syntax.ToFullString().Trim() + + " --> " + + ExtractValue(node.ConstantValueOpt) ); var result = string.Join(Environment.NewLine, constants); return result; @@ -3233,13 +3232,12 @@ class C{0} var source = string.Join( Environment.NewLine, - range.Select( - i => - i == 0 - ? string.Format(template, i, i + 1, i + 1) - : i == (numConstants - 1) - ? string.Format(template, i, i - 1, i - 1) - : string.Format(template, i, i - 1, i + 1) + range.Select(i => + i == 0 + ? string.Format(template, i, i + 1, i + 1) + : i == (numConstants - 1) + ? string.Format(template, i, i - 1, i - 1) + : string.Format(template, i, i - 1, i + 1) ) ); @@ -3333,13 +3331,12 @@ enum E{0} var source = string.Join( Environment.NewLine, - range.Select( - i => - i == 0 - ? string.Format(template, i, i + 1, i + 1) - : i == (numConstants - 1) - ? string.Format(template, i, i - 1, i - 1) - : string.Format(template, i, i - 1, i + 1) + range.Select(i => + i == 0 + ? string.Format(template, i, i + 1, i + 1) + : i == (numConstants - 1) + ? string.Format(template, i, i - 1, i - 1) + : string.Format(template, i, i - 1, i + 1) ) ); @@ -3457,13 +3454,12 @@ enum E{0} var source = string.Join( Environment.NewLine, - range.Select( - i => - i == 0 - ? string.Format(template, i, i + 1, i + 1) - : i == (numEnums - 1) - ? string.Format(template, i, i - 1, i - 1) - : string.Format(template, i, i - 1, i + 1) + range.Select(i => + i == 0 + ? string.Format(template, i, i + 1, i + 1) + : i == (numEnums - 1) + ? string.Format(template, i, i - 1, i - 1) + : string.Format(template, i, i - 1, i + 1) ) ); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs index aea5640c2d5..5b863ef5ca9 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/DelegateTypeTests.cs @@ -13338,8 +13338,8 @@ .maxstack 2 var identifiers = nodes .OfType() - .Where( - i => i.Expression is IdentifierNameSyntax id && id.Identifier.Text == "Report" + .Where(i => + i.Expression is IdentifierNameSyntax id && id.Identifier.Text == "Report" ) .Select(i => i.ArgumentList.Arguments[0].Expression) .ToArray(); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ImportsTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ImportsTests.cs index 4b6c270cf76..d2146847486 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ImportsTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/ImportsTests.cs @@ -183,9 +183,8 @@ private static Imports[] GetImports(params string[] sources) comp.GetDiagnostics().Where(d => d.Severity == DiagnosticSeverity.Error).Verify(); var factories = trees.Select(tree => comp.GetBinderFactory(tree)); - var binders = factories.Select( - factory => - factory.GetInNamespaceBinder((CSharpSyntaxNode)factory.SyntaxTree.GetRoot()) + var binders = factories.Select(factory => + factory.GetInNamespaceBinder((CSharpSyntaxNode)factory.SyntaxTree.GetRoot()) ); var imports = binders.Select(binder => binder.ImportChain.Imports); Assert.DoesNotContain(Imports.Empty, imports); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs index 01faf10cf0e..71d1c5c9c56 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LambdaTests.cs @@ -4553,8 +4553,8 @@ params string[] expectedAttributeNames ) { var actualAttributes = attributes.SelectAsArray(a => a.AttributeClass.GetSymbol()); - var expectedAttributes = expectedAttributeNames.Select( - n => comp.GetTypeByMetadataName(n) + var expectedAttributes = expectedAttributeNames.Select(n => + comp.GetTypeByMetadataName(n) ); AssertEx.Equal(expectedAttributes, actualAttributes); } @@ -7826,15 +7826,13 @@ private void VerifyParameter(CSharpCompilation comp, int index) .DescendantNodes() .OfType() .Where(i => i.Identifier.ValueText == "parameter") - .Where( - i => - i.Ancestors() - .Any( - a => - a.IsKind(SyntaxKind.Attribute) - || a.IsKind(SyntaxKind.DefaultExpression) - || a.IsKind(SyntaxKind.InvocationExpression) - ) + .Where(i => + i.Ancestors() + .Any(a => + a.IsKind(SyntaxKind.Attribute) + || a.IsKind(SyntaxKind.DefaultExpression) + || a.IsKind(SyntaxKind.InvocationExpression) + ) ) .ToArray(); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LookupTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LookupTests.cs index dff21076917..4471edd2f69 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LookupTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/LookupTests.cs @@ -386,8 +386,8 @@ public class Test // Get the list of LookupSymbols at the location of the CSharpSyntaxNode enclosed within the tags var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -471,8 +471,8 @@ public void TestMeth(int i, int j) lookupResult.Free(); return result; }); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -541,8 +541,8 @@ private void F(int i, int j) // Get the list of LookupSymbols at the location of the CSharpSyntaxNode enclosed within the tags var actual_lookupSymbols = GetLookupSymbols(testSrc, name: "F", arity: 0); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -667,11 +667,11 @@ class Test // Get the list of LookupSymbols at the location of the CSharpSyntaxNode enclosed within the tags var actual_lookupSymbols = model.LookupSymbols(GetPositionForBinding(tree)); var actual_lookupSymbols_ignoreAcc = model.LookupSymbols(GetPositionForBinding(tree)); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); - var actual_lookupSymbols_ignoreAcc_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_ignoreAcc_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.DoesNotContain(not_expected_in_lookup[0], actual_lookupNames); @@ -768,8 +768,8 @@ static public void Main() // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Equal('{', testSrc[GetPositionForBinding(testSrc)]); @@ -812,8 +812,8 @@ static public void Main() // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Equal('}', testSrc[GetPositionForBinding(testSrc)]); @@ -861,8 +861,8 @@ public MyClass(int j, int k) // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -902,8 +902,8 @@ static void Main() // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.DoesNotContain(not_expected_in_lookupNames[0], actual_lookupNames); @@ -941,8 +941,8 @@ static void Main() // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.DoesNotContain(not_expected_in_lookupNames[0], actual_lookupNames); @@ -977,8 +977,8 @@ public MyClass(int j, int k) :this(/*pos*/k) // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -1014,8 +1014,8 @@ class C // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.NotEmpty(actual_lookupNames); @@ -1051,8 +1051,8 @@ static void Main(string[] args) // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -1183,8 +1183,8 @@ static void Main(string[] args) // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -1218,8 +1218,8 @@ from s1 in /*pos*/ // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.Contains(expected_in_lookupNames[0], actual_lookupNames); @@ -1267,8 +1267,8 @@ public void LookupInsideQueryExprOutsideTypeDecl() // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.NotEmpty(actual_lookupNames); @@ -1299,8 +1299,8 @@ static void Main(string[] args) // Get the list of LookupSymbols at the location at the end of the /*pos*/ tag var actual_lookupSymbols = GetLookupSymbols(testSrc); - var actual_lookupSymbols_as_string = actual_lookupSymbols.Select( - e => e.ToTestDisplayString() + var actual_lookupSymbols_as_string = actual_lookupSymbols.Select(e => + e.ToTestDisplayString() ); Assert.NotEmpty(actual_lookupNames); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs index 3444ccce661..cab776c3f79 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/NameOfTests.cs @@ -1171,8 +1171,8 @@ static ImmutableArray getNameOfCalls(SyntaxTree tree return tree.GetRoot() .DescendantNodes() .OfType() - .Where( - e => e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } + .Where(e => + e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } ) .ToImmutableArray(); } @@ -1275,8 +1275,8 @@ static ImmutableArray getNameOfCalls(SyntaxTree tree return tree.GetRoot() .DescendantNodes() .OfType() - .Where( - e => e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } + .Where(e => + e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } ) .ToImmutableArray(); } @@ -1386,8 +1386,8 @@ static ImmutableArray getNameOfCalls(SyntaxTree tree return tree.GetRoot() .DescendantNodes() .OfType() - .Where( - e => e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } + .Where(e => + e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } ) .ToImmutableArray(); } @@ -1498,8 +1498,8 @@ static ImmutableArray getNameOfCalls(SyntaxTree tree return tree.GetRoot() .DescendantNodes() .OfType() - .Where( - e => e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } + .Where(e => + e.Expression is IdentifierNameSyntax { Identifier.ValueText: "nameof" } ) .ToImmutableArray(); } diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs index dfe4759fefe..e641d3a8534 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/OperatorTests.cs @@ -7543,12 +7543,11 @@ bool Test(S1? s1) var expectedOperator = comp.GlobalNamespace.GetMember("S1") .GetMembers(WellKnownMemberNames.EqualityOperatorName) .OfType() - .Single( - m => - m.ParameterTypesWithAnnotations[0].Equals( - m.ParameterTypesWithAnnotations[1], - TypeCompareKind.ConsiderEverything - ) + .Single(m => + m.ParameterTypesWithAnnotations[0].Equals( + m.ParameterTypesWithAnnotations[1], + TypeCompareKind.ConsiderEverything + ) ); var tree = comp.SyntaxTrees.Single(); @@ -7993,8 +7992,8 @@ static void Main() var diagnostics = DiagnosticBag.GetInstance(); var block = binder.BindEmbeddedBlock(methodBody, diagnostics); diagnostics.Free(); - var exprs = block.Statements.SelectAsArray( - stmt => ((BoundExpressionStatement)stmt).Expression + var exprs = block.Statements.SelectAsArray(stmt => + ((BoundExpressionStatement)stmt).Expression ); Assert.Equal(32, exprs.Length); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs index b0fa659760b..ab18d23ed31 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/SemanticErrorTests.cs @@ -27840,6 +27840,7 @@ internal static bool IsNull(this string val) parseOptions: TestOptions.Regular7_3 ) .VerifyDiagnostics( + // Do not report the following warning: // (5,34): warning CS1720: Expression will always cause a System.NullReferenceException because the default value of 'string' is null // System.Console.WriteLine(default(string).IsNull()); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs index 005fa515e22..fc3b97d28e2 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/TopLevelStatementsTests.cs @@ -4118,10 +4118,8 @@ void local() .GetRoot() .DescendantNodes() .OfType() - .Where( - id => - id.Identifier.ValueText == "alias1" - && !id.Parent.IsKind(SyntaxKind.NameEquals) + .Where(id => + id.Identifier.ValueText == "alias1" && !id.Parent.IsKind(SyntaxKind.NameEquals) ) .Single(); @@ -4164,10 +4162,8 @@ void local() .GetRoot() .DescendantNodes() .OfType() - .Where( - id => - id.Identifier.ValueText == "alias2" - && !id.Parent.IsKind(SyntaxKind.NameEquals) + .Where(id => + id.Identifier.ValueText == "alias2" && !id.Parent.IsKind(SyntaxKind.NameEquals) ) .Single(); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs index 1f21fb77960..6102ea14523 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/Semantics/UnsafeTests.cs @@ -9203,8 +9203,7 @@ static void Main() Assert.Equal(stringSymbol, summary2.Type.GetSymbol()); var accessSymbolInfos = dereferences - .Select( - syntax => model.GetSymbolInfo(((PrefixUnaryExpressionSyntax)syntax).Operand) + .Select(syntax => model.GetSymbolInfo(((PrefixUnaryExpressionSyntax)syntax).Operand) ) .ToArray(); diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/GeneratorDriverFuzzTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/GeneratorDriverFuzzTests.cs index 32de6fae541..3c6cbd81a0c 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/GeneratorDriverFuzzTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/GeneratorDriverFuzzTests.cs @@ -149,18 +149,17 @@ IncrementalValuesProvider provider .Apply(provider) .SelectMany( (additionalText, _) => - Logics.Select( - logic => - (AdditionalText) - new InMemoryAdditionalText( - HintNameProvider.GetNextHintName(), - additionalText.GetText()!.ToString() switch - { - "a" when logic.TransformAs => "b", - "c" when logic.TransformCs => "d", - var other => other - } - ) + Logics.Select(logic => + (AdditionalText) + new InMemoryAdditionalText( + HintNameProvider.GetNextHintName(), + additionalText.GetText()!.ToString() switch + { + "a" when logic.TransformAs => "b", + "c" when logic.TransformCs => "d", + var other => other + } + ) ) ); } @@ -207,15 +206,14 @@ public override IncrementalValuesProvider Apply( IncrementalValuesProvider provider ) { - var provider1 = provider.Where( - additionalText => - additionalText.GetText()!.ToString() is var textString - && ( - (IncludeAs && textString == "a") - || (IncludeBs && textString == "b") - || (IncludeCs && textString == "c") - || (IncludeDs && textString == "d") - ) + var provider1 = provider.Where(additionalText => + additionalText.GetText()!.ToString() is var textString + && ( + (IncludeAs && textString == "a") + || (IncludeBs && textString == "b") + || (IncludeCs && textString == "c") + || (IncludeDs && textString == "d") + ) ); return Source.Apply(provider1); } diff --git a/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs b/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs index 277a3d17fd9..e072da89388 100644 --- a/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Semantic/SourceGeneration/StateTableTests.cs @@ -1653,8 +1653,7 @@ public void RecordedStep_Tree_Includes_Most_Recent_Recording_Of_Run_Even_When_Al public void Modified_Entry_Removing_Outputs_Records_Removed_Step_State() { ImmutableArray values = ImmutableArray.Create(1, 2, 3); - var inputNode = new InputNode>( - _ => ImmutableArray.Create(values) + var inputNode = new InputNode>(_ => ImmutableArray.Create(values) ).WithTrackingName("Input"); var transformNode = new TransformNode, int>( inputNode, @@ -1697,8 +1696,7 @@ public void Modified_Entry_Removing_Outputs_Records_Removed_Step_State() public void Modified_Entry_Adding_Outputs_Records_Added_Step_State() { ImmutableArray values = ImmutableArray.Empty; - var inputNode = new InputNode>( - _ => ImmutableArray.Create(values) + var inputNode = new InputNode>(_ => ImmutableArray.Create(values) ).WithTrackingName("Input"); var transformNode = new TransformNode, int>( inputNode, diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/GetUnusedImportDirectivesTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/GetUnusedImportDirectivesTests.cs index 0777a19f675..219de2d54da 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/GetUnusedImportDirectivesTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/GetUnusedImportDirectivesTests.cs @@ -495,6 +495,7 @@ partial void M([Out] [In] ref int x) { } model .GetDiagnostics() .Verify( + //// (1,1): hidden CS8019: Unnecessary using directive. //// using System.Runtime.InteropServices; //Diagnostic(ErrorCode.HDN_UnusedUsingDirective, "using System.Runtime.InteropServices;").WithLocation(1, 1) @@ -525,6 +526,7 @@ partial void M(ref int x) { } model .GetDiagnostics() .Verify( + //// (1,1): hidden CS8019: Unnecessary using directive. //// using System.Runtime.InteropServices; //Diagnostic(ErrorCode.HDN_UnusedUsingDirective, "using System.Runtime.InteropServices;").WithLocation(1, 1) diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetDeclaredSymbolAPITests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetDeclaredSymbolAPITests.cs index 1d7d904a17d..96510d6719d 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetDeclaredSymbolAPITests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/SemanticModelGetDeclaredSymbolAPITests.cs @@ -1546,10 +1546,9 @@ interface C : B Assert.Equal( 9, symbolsInC - .Where( - s => - s.ContainingType == null - || s.ContainingType.SpecialType != SpecialType.System_Object + .Where(s => + s.ContainingType == null + || s.ContainingType.SpecialType != SpecialType.System_Object ) .Count() ); @@ -1557,27 +1556,23 @@ interface C : B Assert.True(symbolsInC.Any(s => s.Name == "B" && s.Kind == SymbolKind.NamedType)); Assert.True(symbolsInC.Any(s => s.Name == "C" && s.Kind == SymbolKind.NamedType)); Assert.True( - symbolsInC.Any( - s => - s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "A" + symbolsInC.Any(s => + s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "A" ) ); Assert.True( - symbolsInC.Any( - s => - s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "B" + symbolsInC.Any(s => + s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "B" ) ); Assert.True( - symbolsInC.Any( - s => - s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C" + symbolsInC.Any(s => + s.Name == "M" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C" ) ); Assert.True( - symbolsInC.Any( - s => - s.Name == "F" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C" + symbolsInC.Any(s => + s.Name == "F" && s.Kind == SymbolKind.Method && s.ContainingType.Name == "C" ) ); Assert.True(symbolsInC.Any(s => s.Name == "System" && s.Kind == SymbolKind.Namespace)); diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/UsedAssembliesTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/UsedAssembliesTests.cs index dcd25c305f4..049b52f03a4 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/UsedAssembliesTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Compilation/UsedAssembliesTests.cs @@ -137,30 +137,28 @@ MetadataReference[] specificReferencesToAssert var comp2 = comp.RemoveAllReferences() .AddReferences( used.Concat( - comp.References.Where( - r => r.Properties.Kind == MetadataImageKind.Module + comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Module ) ) ); if ( - !after.Any( - d => ErrorFacts.GetSeverity((ErrorCode)d.Code) == DiagnosticSeverity.Error + !after.Any(d => + ErrorFacts.GetSeverity((ErrorCode)d.Code) == DiagnosticSeverity.Error ) ) { CompileAndVerify(comp2, verify: Verification.Skipped) - .Diagnostics.Where( - d => d.Code != (int)ErrorCode.WRN_NoRuntimeMetadataVersion + .Diagnostics.Where(d => + d.Code != (int)ErrorCode.WRN_NoRuntimeMetadataVersion ) .Verify(after); if (specificReferencesToAssert is object) { - var tryRemove = specificReferencesToAssert.Where( - reference => - reference.Properties.Kind == MetadataImageKind.Assembly - && !used.Contains(reference) + var tryRemove = specificReferencesToAssert.Where(reference => + reference.Properties.Kind == MetadataImageKind.Assembly + && !used.Contains(reference) ); if (tryRemove.Count() > 1) { @@ -168,8 +166,8 @@ MetadataReference[] specificReferencesToAssert { var comp3 = comp.RemoveReferences(reference); CompileAndVerify(comp3, verify: Verification.Skipped) - .Diagnostics.Where( - d => d.Code != (int)ErrorCode.WRN_NoRuntimeMetadataVersion + .Diagnostics.Where(d => + d.Code != (int)ErrorCode.WRN_NoRuntimeMetadataVersion ) .Verify(after); } @@ -523,10 +521,9 @@ ImmutableArray compileWithUsedAssemblyReferences( if (specificReferencesToAssert is object) { - var tryRemove = specificReferencesToAssert.Where( - reference => - reference.Properties.Kind == MetadataImageKind.Assembly - && !used.Contains(reference) + var tryRemove = specificReferencesToAssert.Where(reference => + reference.Properties.Kind == MetadataImageKind.Assembly + && !used.Contains(reference) ); if (tryRemove.Count() > 1) { @@ -546,8 +543,7 @@ ImmutableArray compileWithUsedAssemblyReferences( var comp2 = comp.RemoveAllReferences() .AddReferences( used.Concat( - comp.References.Where( - r => r.Properties.Kind == MetadataImageKind.Module + comp.References.Where(r => r.Properties.Kind == MetadataImageKind.Module ) ) ); diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/CrefTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/CrefTests.cs index 35db4f5ecc4..8f42d0fb05f 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/CrefTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/CrefTests.cs @@ -1816,8 +1816,7 @@ void M(int t) { } .GlobalNamespace.GetMember("B") .GetMembers("M") .OfType() - .Single( - method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter + .Single(method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); Assert.Equal(expectedOriginalDefinitionSymbol, actualSymbol.OriginalDefinition); @@ -2003,8 +2002,7 @@ class U { } .GlobalNamespace.GetMember("A") .GetMembers("M") .OfType() - .Single( - method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter + .Single(method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -2038,8 +2036,7 @@ void M(int u) { } .GlobalNamespace.GetMember("A") .GetMembers("M") .OfType() - .Single( - method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter + .Single(method => method.Parameters.Single().Type.TypeKind == TypeKind.TypeParameter ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -2846,10 +2843,9 @@ public static bool op_LogicalNot(int x) .GlobalNamespace.GetMember("C") .GetMembers(WellKnownMemberNames.LogicalNotOperatorName) .OfType() - .Single( - method => - method.ParameterTypesWithAnnotations.Single().SpecialType - == SpecialType.System_Int32 + .Single(method => + method.ParameterTypesWithAnnotations.Single().SpecialType + == SpecialType.System_Int32 ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -3068,10 +3064,9 @@ public static bool op_Division(int x, int x) .GlobalNamespace.GetMember("C") .GetMembers(WellKnownMemberNames.DivisionOperatorName) .OfType() - .Single( - method => - method.ParameterTypesWithAnnotations.First().SpecialType - == SpecialType.System_Int32 + .Single(method => + method.ParameterTypesWithAnnotations.First().SpecialType + == SpecialType.System_Int32 ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -3318,10 +3313,9 @@ public static int op_Implicit(int x) .GlobalNamespace.GetMember("C") .GetMembers(WellKnownMemberNames.ImplicitConversionName) .OfType() - .Single( - method => - method.ParameterTypesWithAnnotations.Single().SpecialType - == SpecialType.System_Int32 + .Single(method => + method.ParameterTypesWithAnnotations.Single().SpecialType + == SpecialType.System_Int32 ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -3362,11 +3356,10 @@ public static int op_Implicit(int x) .GlobalNamespace.GetMember("C") .GetMembers(WellKnownMemberNames.ImplicitConversionName) .OfType() - .Single( - method => - method.ParameterTypesWithAnnotations.Single().SpecialType - == SpecialType.System_Int32 - && method.ReturnType.SpecialType == SpecialType.System_Int32 + .Single(method => + method.ParameterTypesWithAnnotations.Single().SpecialType + == SpecialType.System_Int32 + && method.ReturnType.SpecialType == SpecialType.System_Int32 ); var actualSymbol = GetReferencedSymbol(crefSyntax, compilation); @@ -6985,10 +6978,9 @@ enum E { } var expectedSymbol = compilation .GetSpecialType(SpecialType.System_String) - .InstanceConstructors.Single( - ctor => - ctor.Parameters.Length == 1 - && ctor.GetParameterType(0).Kind == SymbolKind.ArrayType + .InstanceConstructors.Single(ctor => + ctor.Parameters.Length == 1 + && ctor.GetParameterType(0).Kind == SymbolKind.ArrayType ); var cref = GetCrefSyntaxes(compilation).Single(); @@ -7869,12 +7861,11 @@ internal static IEnumerable GetCrefSyntaxes(CSharpCompilation compil .DescendantTrivia() .Select(trivia => trivia.GetStructure()) .OfType(); - return docComments.SelectMany( - docComment => - docComment - .DescendantNodes() - .OfType() - .Select(attr => attr.Cref) + return docComments.SelectMany(docComment => + docComment + .DescendantNodes() + .OfType() + .Select(attr => attr.Cref) ); }); } diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/DocumentationModeTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/DocumentationModeTests.cs index ae76e6152d7..4704454f93a 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/DocumentationModeTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/DocumentationComments/DocumentationModeTests.cs @@ -410,13 +410,12 @@ class {1} {{ }} partial class Partial {{ }} "; - var trees = AllModes.Select( - mode => - Parse( - string.Format(sourceTemplate, xml, mode), - string.Format("{0}.cs", mode), - GetOptions(mode) - ) + var trees = AllModes.Select(mode => + Parse( + string.Format(sourceTemplate, xml, mode), + string.Format("{0}.cs", mode), + GetOptions(mode) + ) ); var comp = CreateCompilation(trees.ToArray(), assemblyName: "Test"); @@ -468,13 +467,12 @@ class {1} {{ }} partial class Partial {{ }} "; - var trees = AllModes.Select( - mode => - Parse( - string.Format(sourceTemplate, includeElement, mode), - string.Format("{0}.cs", mode), - GetOptions(mode) - ) + var trees = AllModes.Select(mode => + Parse( + string.Format(sourceTemplate, includeElement, mode), + string.Format("{0}.cs", mode), + GetOptions(mode) + ) ); var comp = CreateCompilation( diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/CheckedUserDefinedOperatorsTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/CheckedUserDefinedOperatorsTests.cs index 4026bf38d7d..a2b81961eca 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/CheckedUserDefinedOperatorsTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/CheckedUserDefinedOperatorsTests.cs @@ -3427,14 +3427,13 @@ var options in new[] { compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (4,30): error CS9150: User-defined operator '%' cannot be declared checked @@ -3497,14 +3496,13 @@ public static C operator checked " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (5,30): error CS9150: User-defined operator '%' cannot be declared checked @@ -3591,14 +3589,13 @@ public static C operator " ); compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify(expected); @@ -3617,14 +3614,13 @@ is not ( { compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (3,20): warning CS1584: XML comment has syntactically incorrect cref attribute 'operator checked }}' @@ -3686,14 +3682,13 @@ is not ( ); compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify(expected); @@ -3770,14 +3765,13 @@ public static C operator " ); compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify(expected); @@ -3796,14 +3790,13 @@ is not ( { compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (3,20): warning CS1584: XML comment has syntactically incorrect cref attribute 'operator checked }}(C, int)' @@ -3868,14 +3861,13 @@ is not ( ); compilation .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify(expected); diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/InterfaceImplementationTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/InterfaceImplementationTests.cs index 93d752f299f..321a757d311 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/InterfaceImplementationTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/InterfaceImplementationTests.cs @@ -353,8 +353,8 @@ class Class : Interface var @class = (NamedTypeSymbol)global.GetMembers("Class").Single(); var classImplicitImplementation = @class.Indexers.Single(p => p.Parameters.Length == 2); - var classImplicitImplementationBase = @class.Indexers.Single( - p => p.Parameters.Length == 1 + var classImplicitImplementationBase = @class.Indexers.Single(p => + p.Parameters.Length == 1 ); var implementingIndexer = @class.FindImplementationForInterfaceMember(interfaceIndexer); @@ -2572,10 +2572,8 @@ Explicit implementation .GetMembers() .OfType() .Where(m => m.MethodKind == MethodKind.ExplicitInterfaceImplementation) - .Single( - m => - m.ExplicitInterfaceImplementations.Single().MethodKind - == MethodKind.EventAdd + .Single(m => + m.ExplicitInterfaceImplementations.Single().MethodKind == MethodKind.EventAdd ); Assert.Equal( diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Metadata/PE/TypeForwarders.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Metadata/PE/TypeForwarders.cs index 19113dc2d86..c185011bde5 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Metadata/PE/TypeForwarders.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Metadata/PE/TypeForwarders.cs @@ -1291,12 +1291,11 @@ class Test ); var actualNamespaces = EnumerateNamespaces(compilation) - .Where( - ns => - !ns.StartsWith("System", StringComparison.Ordinal) - && !ns.StartsWith("Windows", StringComparison.Ordinal) - && !ns.StartsWith("FxResources", StringComparison.Ordinal) - && !ns.StartsWith("Microsoft", StringComparison.Ordinal) + .Where(ns => + !ns.StartsWith("System", StringComparison.Ordinal) + && !ns.StartsWith("Windows", StringComparison.Ordinal) + && !ns.StartsWith("FxResources", StringComparison.Ordinal) + && !ns.StartsWith("Microsoft", StringComparison.Ordinal) ); var expectedNamespaces = new[] { "Ns", "Ns.Ms" }; Assert.True( @@ -1371,12 +1370,11 @@ class Test ); var actualNamespaces = EnumerateNamespaces(compilation) - .Where( - ns => - !ns.StartsWith("System", StringComparison.Ordinal) - && !ns.StartsWith("Windows", StringComparison.Ordinal) - && !ns.StartsWith("FxResources", StringComparison.Ordinal) - && !ns.StartsWith("Microsoft", StringComparison.Ordinal) + .Where(ns => + !ns.StartsWith("System", StringComparison.Ordinal) + && !ns.StartsWith("Windows", StringComparison.Ordinal) + && !ns.StartsWith("FxResources", StringComparison.Ordinal) + && !ns.StartsWith("Microsoft", StringComparison.Ordinal) ); var expectedNamespaces = new[] { "N1", "N1.N2", "N1.N2.N3" }; Assert.True( @@ -1451,12 +1449,11 @@ class Test ); var actualNamespaces = EnumerateNamespaces(compilation) - .Where( - ns => - !ns.StartsWith("System", StringComparison.Ordinal) - && !ns.StartsWith("Windows", StringComparison.Ordinal) - && !ns.StartsWith("FxResources", StringComparison.Ordinal) - && !ns.StartsWith("Microsoft", StringComparison.Ordinal) + .Where(ns => + !ns.StartsWith("System", StringComparison.Ordinal) + && !ns.StartsWith("Windows", StringComparison.Ordinal) + && !ns.StartsWith("FxResources", StringComparison.Ordinal) + && !ns.StartsWith("Microsoft", StringComparison.Ordinal) ); var expectedNamespaces = new[] { "N1", "N1.N2", "N1.N2.N3" }; Assert.True( diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs index 99c5fa3b97e..78b1df41cdd 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/MissingSpecialMember.cs @@ -117,6 +117,7 @@ public IEnumerable M() ); comp.VerifyEmitDiagnostics( + // the DebuggerHidden attribute is optional. ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs index 56e4b95ce74..203a96fa6ab 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/Source/PropertyTests.cs @@ -2157,21 +2157,20 @@ static void Main() Assert.Equal(1, getters.Count(getter => getter.Parameters.Length == 2)); Assert.True( - getters.Any( - getter => getter.Parameters[0].Type.SpecialType == SpecialType.System_Int32 + getters.Any(getter => + getter.Parameters[0].Type.SpecialType == SpecialType.System_Int32 ) ); Assert.True( - getters.Any( - getter => getter.Parameters[0].Type.SpecialType == SpecialType.System_String + getters.Any(getter => + getter.Parameters[0].Type.SpecialType == SpecialType.System_String ) ); Assert.True( - getters.Any( - getter => - getter.Parameters.Length == 2 - && getter.Parameters[0].Type.SpecialType == SpecialType.System_Int32 - && getter.Parameters[1].Type.SpecialType == SpecialType.System_String + getters.Any(getter => + getter.Parameters.Length == 2 + && getter.Parameters[0].Type.SpecialType == SpecialType.System_Int32 + && getter.Parameters[1].Type.SpecialType == SpecialType.System_String ) ); }; @@ -2979,9 +2978,8 @@ PropertySymbol interfaceProperty var explicitOverrides = typeDef.GetExplicitImplementationOverrides(context); Assert.Equal(2, explicitOverrides.Count()); Assert.True( - explicitOverrides.All( - @override => - ReferenceEquals(@class, @override.ContainingType.GetInternalSymbol()) + explicitOverrides.All(@override => + ReferenceEquals(@class, @override.ContainingType.GetInternalSymbol()) ) ); @@ -3055,9 +3053,8 @@ PropertySymbol interfaceProperty var explicitOverrides = typeDef.GetExplicitImplementationOverrides(context); Assert.Equal(1, explicitOverrides.Count()); Assert.True( - explicitOverrides.All( - @override => - ReferenceEquals(@class, @override.ContainingType.GetInternalSymbol()) + explicitOverrides.All(@override => + ReferenceEquals(@class, @override.ContainingType.GetInternalSymbol()) ) ); diff --git a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs index b8369fc5000..fb77fabaa45 100644 --- a/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Symbol/Symbols/StaticAbstractMembersInInterfacesTests.cs @@ -9612,13 +9612,12 @@ interface I13 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0562: The parameter of a unary operator must be the containing type @@ -10125,15 +10124,13 @@ interface I13 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int) - ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type @@ -10295,15 +10292,13 @@ interface I13 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int) - ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type @@ -10475,13 +10470,12 @@ interface I14 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0564: The first operand of an overloaded shift operator must have the same type as the containing type @@ -11086,15 +11080,13 @@ interface I13 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int) - ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type @@ -11265,15 +11257,13 @@ interface I13 ); compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int) - ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators - or (int)ErrorCode.ERR_UnimplementedInterfaceMember - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_InterfacesCantContainConversionOrEqualityOperators + or (int)ErrorCode.ERR_UnimplementedInterfaceMember + ) ) .Verify( // (4,26): error CS0563: One of the parameters of a binary operator must be the containing type @@ -13929,8 +13919,8 @@ public partial interface I1 { compilation1 .GetDiagnostics() - .Where( - d => d.Code is not (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + .Where(d => + d.Code is not (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature ) .Verify( // (8,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. @@ -14534,14 +14524,13 @@ static void MT2() where T : I1 compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - or (int) - ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + or (int) + ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers + ) ) .Verify( // (12,13): error CS8926: A static virtual or abstract interface member can be accessed only on a type parameter. @@ -17074,14 +17063,13 @@ static void M02(T x, int y) where T : I1 compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (12,33): error CS8919: Target runtime doesn't support static abstract members in interfaces. @@ -17257,11 +17245,10 @@ static void M02(T x, T y) where T : I1 compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not (int) - ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation + .Where(d => + d.Code + is not (int) + ErrorCode.ERR_RuntimeDoesNotSupportDefaultInterfaceImplementation ) .Verify(builder.ToArrayAndFree()); } @@ -17591,13 +17578,12 @@ static void M02(T x, int y) where T : I1 { compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (12,33): error CS8703: The modifier 'virtual' is not valid for this item in C# 10.0. Please use language version '11.0' or greater. @@ -24824,15 +24810,14 @@ static C10 I2.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_BadIncDecRetType - or (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_BadIncDecRetType + or (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.operator +(C1)' @@ -25086,15 +25071,14 @@ static C10 I2.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_BadIncDecRetType - or (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_BadIncDecRetType + or (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify( // (14,24): error CS0558: User-defined operator 'C2.operator +(C2)' must be declared static and public @@ -25328,15 +25312,14 @@ static C10 I2.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (8,10): error CS0535: 'C1' does not implement interface member 'I1.operator >>(C1, int)' @@ -25609,15 +25592,14 @@ static C10 I2.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (14,24): error CS0558: User-defined operator 'C2.operator >>(C2, int)' must be declared static and public @@ -25798,14 +25780,13 @@ abstract static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + ) ) .Verify( // (12,17): error CS0558: User-defined operator 'I3.operator +(I1)' must be declared static and public @@ -26071,14 +26052,13 @@ virtual static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + ) ) .Verify( // (12,17): error CS0558: User-defined operator 'I3.operator +(I1)' must be declared static and public @@ -26469,13 +26449,12 @@ abstract static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + ) ) .Verify(expected); @@ -26839,13 +26818,12 @@ virtual static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + ) ) .Verify(expected); @@ -27063,14 +27041,13 @@ public static Test2 operator " compilation2 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify(expected2); @@ -27148,14 +27125,13 @@ is not ( compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify(expected3); } @@ -27264,14 +27240,13 @@ public static Test2 operator " { compilation2 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (4,15): error CS8936: Feature 'static abstract members in interfaces' is not available in C# 10.0. Please use language version 11.0 or greater. @@ -27336,14 +27311,13 @@ is not ( { compilation2 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (4,15): error CS8936: Feature 'static abstract members in interfaces' is not available in C# 10.0. Please use language version 11.0 or greater. @@ -27392,15 +27366,14 @@ is not ( { compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (4,15): error CS8936: Feature 'static abstract members in interfaces' is not available in C# 10.0. Please use language version 11.0 or greater. @@ -27465,14 +27438,13 @@ is not ( { compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (4,15): error CS8936: Feature 'static abstract members in interfaces' is not available in C# 10.0. Please use language version 11.0 or greater. @@ -27573,14 +27545,13 @@ public static Test1 operator " compilation2 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify( // (4,34): error CS8929: 'Test1.operator +(Test1)' cannot implement interface member 'I1.operator +(Test1)' in type 'Test1' because the target runtime doesn't support static abstract members in interfaces. @@ -27606,14 +27577,13 @@ is not ( compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + ) ) .Verify( // (9,32): error CS8919: Target runtime doesn't support static abstract members in interfaces. @@ -27704,15 +27674,14 @@ public static Test1 operator " compilation2 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (4,34): error CS8929: 'Test1.operator >>(Test1, int)' cannot implement interface member 'I1.operator >>(Test1, int)' in type 'Test1' because the target runtime doesn't support static abstract members in interfaces. @@ -27738,15 +27707,14 @@ is not ( compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + ) ) .Verify( // (9,32): error CS8919: Target runtime doesn't support static abstract members in interfaces. @@ -27832,14 +27800,13 @@ static I1 I1.operator " compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_OpTFRetType - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_OpTFRetType + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + ) ) .Verify( // (4,27): error CS8919: Target runtime doesn't support static abstract members in interfaces. @@ -27951,14 +27918,13 @@ static I1 I1.operator " compilation3 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_CheckedOperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (4,27): error CS8919: Target runtime doesn't support static abstract members in interfaces. @@ -32428,14 +32394,13 @@ sealed static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.WRN_ExternMethodNoImplementation - or (int)ErrorCode.ERR_OpTFRetType - or (int)ErrorCode.ERR_OperatorNeedsMatch - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.WRN_ExternMethodNoImplementation + or (int)ErrorCode.ERR_OpTFRetType + or (int)ErrorCode.ERR_OperatorNeedsMatch + ) ) .Verify( // (16,35): error CS0106: The modifier 'private' is not valid for this item @@ -32674,14 +32639,13 @@ sealed static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.WRN_ExternMethodNoImplementation - or (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.WRN_ExternMethodNoImplementation + or (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (16,35): error CS0106: The modifier 'private' is not valid for this item @@ -32784,14 +32748,13 @@ static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OpTFRetType - or (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OpTFRetType + or (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (9,20): error CS0540: 'C1.I1.operator -(I1)': containing type does not implement interface 'I1' @@ -32880,13 +32843,12 @@ static I1 I1.operator " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (9,23): error CS0540: 'C1.I1.operator %(I1, int)': containing type does not implement interface 'I1' @@ -44044,11 +44006,10 @@ class C compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not (int) - ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers + .Where(d => + d.Code + is not (int) + ErrorCode.ERR_GenericConstraintNotSatisfiedInterfaceWithStaticAbstractMembers ) .Verify( // (4,39): error CS0552: 'I1.implicit operator bool(I1)': user-defined conversions to or from an interface are not allowed @@ -47320,15 +47281,14 @@ public static " compilation1 .GetDiagnostics() - .Where( - d => - d.Code - is not ( - (int)ErrorCode.ERR_OperatorNeedsMatch - or (int)ErrorCode.WRN_EqualityOpWithoutEquals - or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode - or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature - ) + .Where(d => + d.Code + is not ( + (int)ErrorCode.ERR_OperatorNeedsMatch + or (int)ErrorCode.WRN_EqualityOpWithoutEquals + or (int)ErrorCode.WRN_EqualityOpWithoutGetHashCode + or (int)ErrorCode.ERR_BadAbstractEqualityOperatorSignature + ) ) .Verify( // (4,39): error CS9150: User-defined operator '%' cannot be declared checked diff --git a/roslyn/src/Compilers/CSharp/Test/Syntax/Diagnostics/LocationsTests.cs b/roslyn/src/Compilers/CSharp/Test/Syntax/Diagnostics/LocationsTests.cs index bc6a89322c1..62b47d5449a 100644 --- a/roslyn/src/Compilers/CSharp/Test/Syntax/Diagnostics/LocationsTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Syntax/Diagnostics/LocationsTests.cs @@ -81,9 +81,8 @@ private static IEnumerable InspectLineMapping(SyntaxTree tree) { var text = tree.GetText(); return tree.GetLineMappings() - .Select( - mapping => - $"[|{text.GetSubText(text.Lines.GetTextSpan(mapping.Span))}|] -> {(mapping.IsHidden ? "" : mapping.MappedSpan)}" + .Select(mapping => + $"[|{text.GetSubText(text.Lines.GetTextSpan(mapping.Span))}|] -> {(mapping.IsHidden ? "" : mapping.MappedSpan)}" ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs b/roslyn/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs index 6bbb9e480a4..879974547ec 100644 --- a/roslyn/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Syntax/LexicalAndXml/LexicalTests.cs @@ -3618,10 +3618,9 @@ void M() Assert.False( tree.GetRoot() .DescendantTokens() - .Any( - t => - t.LeadingTrivia.Any(SyntaxKind.ConflictMarkerTrivia) - || t.TrailingTrivia.Any(SyntaxKind.ConflictMarkerTrivia) + .Any(t => + t.LeadingTrivia.Any(SyntaxKind.ConflictMarkerTrivia) + || t.TrailingTrivia.Any(SyntaxKind.ConflictMarkerTrivia) ) ); } diff --git a/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LanguageVersionTests.cs b/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LanguageVersionTests.cs index f54271c4b4a..180e20af524 100644 --- a/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LanguageVersionTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LanguageVersionTests.cs @@ -17,11 +17,10 @@ public void CurrentVersion() { var highest = Enum.GetValues(typeof(LanguageVersion)) .Cast() - .Where( - x => - x != LanguageVersion.Latest - && x != LanguageVersion.Preview - && x != LanguageVersion.LatestMajor + .Where(x => + x != LanguageVersion.Latest + && x != LanguageVersion.Preview + && x != LanguageVersion.LatestMajor ) .Max(); diff --git a/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LocalFunctionParsingTests.cs b/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LocalFunctionParsingTests.cs index b58ec9134f8..deb332aad75 100644 --- a/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LocalFunctionParsingTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Syntax/Parsing/LocalFunctionParsingTests.cs @@ -1404,8 +1404,8 @@ void m2() Assert.NotNull(file); Assert.True( file.DescendantNodes() - .Any( - n => n.Kind() == SyntaxKind.LocalFunctionStatement && !n.ContainsDiagnostics + .Any(n => + n.Kind() == SyntaxKind.LocalFunctionStatement && !n.ContainsDiagnostics ) ); Assert.False(file.HasErrors); diff --git a/roslyn/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs b/roslyn/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs index dc9791743ad..cef7d3b3869 100644 --- a/roslyn/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs +++ b/roslyn/src/Compilers/CSharp/Test/Syntax/Syntax/StructuredTriviaTests.cs @@ -125,8 +125,8 @@ public void TestStructuredTrivia() Assert.Equal(identTrivia, foundTrivia); // make sure FindLeafNodesOverlappingWithSpan does not dig into the structured trivia. - var resultList = identExpr.DescendantTokens( - t => t.FullSpan.OverlapsWith(new TextSpan(3, 18)) + var resultList = identExpr.DescendantTokens(t => + t.FullSpan.OverlapsWith(new TextSpan(3, 18)) ); Assert.Equal(1, resultList.Count()); } diff --git a/roslyn/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdDumpTest.cs b/roslyn/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdDumpTest.cs index e2eaa99b290..6046401d213 100644 --- a/roslyn/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdDumpTest.cs +++ b/roslyn/src/Compilers/CSharp/Test/WinRT/Metadata/WinMdDumpTest.cs @@ -35,11 +35,15 @@ public class WinMdDumpTest : CSharpTestBase ); private readonly MetadataReference _windowsRuntimeUIXamlRef = MetadataReference.CreateFromImage( - ProprietaryTestResources.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml.AsImmutableOrNull() + ProprietaryTestResources.v4_0_30319_17929.System_Runtime_WindowsRuntime_UI_Xaml.AsImmutableOrNull( + + ) ); private readonly MetadataReference _interopServicesWindowsRuntimeRef = MetadataReference.CreateFromImage( - TestMetadata.ResourcesNet451.SystemRuntimeInteropServicesWindowsRuntime.AsImmutableOrNull() + TestMetadata.ResourcesNet451.SystemRuntimeInteropServicesWindowsRuntime.AsImmutableOrNull( + + ) ); private void AppendMembers( diff --git a/roslyn/src/Compilers/Core/AnalyzerDriver/DeclarationComputer.cs b/roslyn/src/Compilers/Core/AnalyzerDriver/DeclarationComputer.cs index c36d49768f4..49387e79cb9 100644 --- a/roslyn/src/Compilers/Core/AnalyzerDriver/DeclarationComputer.cs +++ b/roslyn/src/Compilers/Core/AnalyzerDriver/DeclarationComputer.cs @@ -111,8 +111,8 @@ declaredSymbol is INamespaceSymbol namespaceSymbol { var assemblyToScope = model.Compilation.Assembly; var assemblyScopedNamespaceSymbol = - namespaceSymbol.ConstituentNamespaces.FirstOrDefault( - ns => ns.ContainingAssembly == assemblyToScope + namespaceSymbol.ConstituentNamespaces.FirstOrDefault(ns => + ns.ContainingAssembly == assemblyToScope ); if (assemblyScopedNamespaceSymbol != null) { diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs index 1f6aa43ee8f..db4ed3107bf 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs @@ -433,13 +433,12 @@ private static void VerifyAssemblies( .Select(x => (x.simpleName, x.version, getExpectedLoadPath(x.path))) .ToArray(), assemblies - .Select( - assembly => - ( - assembly.GetName().Name!, - assembly.GetName().Version!.ToString(), - assembly.Location - ) + .Select(assembly => + ( + assembly.GetName().Name!, + assembly.GetName().Version!.ToString(), + assembly.Location + ) ) .OrderBy(static x => x) .ToArray() diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs index 2cfc540c0ed..0c051ddada7 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerConfigTests.cs @@ -369,8 +369,8 @@ public void ReservedValues() var config = ParseConfigFile( string.Join( Environment.NewLine, - AnalyzerConfig.ReservedValues.Select( - v => "MY_KEY" + (index++) + " = " + v.ToUpperInvariant() + AnalyzerConfig.ReservedValues.Select(v => + "MY_KEY" + (index++) + " = " + v.ToUpperInvariant() ) ) ); diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerFileReferenceTests.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerFileReferenceTests.cs index 50e5f529126..8ec634efcc0 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerFileReferenceTests.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Analyzers/AnalyzerFileReferenceTests.cs @@ -217,10 +217,9 @@ public void TestLoadErrors1() Assert.Equal(2, errors.Count); var failedTypes = errors - .Where( - e => - e.ErrorCode - == AnalyzerLoadFailureEventArgs.FailureErrorCode.UnableToCreateAnalyzer + .Where(e => + e.ErrorCode + == AnalyzerLoadFailureEventArgs.FailureErrorCode.UnableToCreateAnalyzer ) .Select(e => e.TypeName); Assert.Contains("Microsoft.CodeAnalysis.UnitTests.AbstractAnalyzer", failedTypes); diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/DebuggerAttributes.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/DebuggerAttributes.cs index 8ff1f0f5362..70c50f2123a 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/DebuggerAttributes.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/DebuggerAttributes.cs @@ -91,9 +91,8 @@ public static IEnumerable GetDebuggerVisibleFields(Type debuggerAttri // The debugger doesn't evaluate non-public members of type proxies. IEnumerable visibleFields = debuggerAttributeType .GetFields() - .Where( - fi => - fi.IsPublic && GetDebuggerBrowsableState(fi) != DebuggerBrowsableState.Never + .Where(fi => + fi.IsPublic && GetDebuggerBrowsableState(fi) != DebuggerBrowsableState.Never ); return visibleFields; } @@ -105,10 +104,9 @@ Type debuggerAttributeType // The debugger doesn't evaluate non-public members of type proxies. GetGetMethod returns null if the getter is non-public. IEnumerable visibleProperties = debuggerAttributeType .GetProperties() - .Where( - pi => - pi.GetGetMethod() != null - && GetDebuggerBrowsableState(pi) != DebuggerBrowsableState.Never + .Where(pi => + pi.GetGetMethod() != null + && GetDebuggerBrowsableState(pi) != DebuggerBrowsableState.Never ); return visibleProperties; } diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedDictionaryTest.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedDictionaryTest.cs index 083dfde489b..f4babec6aa8 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedDictionaryTest.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedDictionaryTest.cs @@ -323,10 +323,9 @@ public void DebuggerAttributesValid() "_root" ) ?? throw new InvalidOperationException(); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute()!.State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute()!.State + == DebuggerBrowsableState.RootHidden ); KeyValuePair[]? items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedListTest.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedListTest.cs index a77aebd9e58..ea7f8ad4a8c 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedListTest.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Collections/ImmutableSegmentedListTest.cs @@ -191,8 +191,9 @@ public void AddRangeTest() public void AddRange_IOrderedCollection() { var list = ImmutableSegmentedList.Empty; - ImmutableSegmentedList.Builder builder = - ImmutableSegmentedList.CreateBuilder(); + ImmutableSegmentedList.Builder builder = ImmutableSegmentedList.CreateBuilder( + + ); builder.Add(1); list = list.AddRange(builder); @@ -977,10 +978,9 @@ public void DebuggerAttributesValid() "_root" )!; DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute()!.State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute()!.State + == DebuggerBrowsableState.RootHidden ); double[]? items = itemProperty.GetValue(info.Instance) as double[]; Assert.Equal(list, items); diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/Emit/EmitBaselineTests.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/Emit/EmitBaselineTests.cs index 035b2a3cec2..b5450bc5cdc 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/Emit/EmitBaselineTests.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/Emit/EmitBaselineTests.cs @@ -23,8 +23,8 @@ public unsafe void CreateInitialBaseline_Errors() MethodDefinitionHandle, EditAndContinueMethodDebugInformation >(_ => default); - var localSigProvider = new Func( - _ => default + var localSigProvider = new Func(_ => + default ); var peModule = ModuleMetadata.CreateFromImage(TestResources.Basic.Members); var peReader = peModule.Module.PEReaderOpt; diff --git a/roslyn/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataHelpersTests.cs b/roslyn/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataHelpersTests.cs index 451c4f0ec37..db6479b39b9 100644 --- a/roslyn/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataHelpersTests.cs +++ b/roslyn/src/Compilers/Core/CodeAnalysisTest/MetadataReferences/MetadataHelpersTests.cs @@ -98,8 +98,9 @@ private static TypeNameConfig[] GenerateTypeNameConfigs(int typeParamStackDepth) { foreach (ArrayKind arrayKind in Enum.GetValues(typeof(ArrayKind))) { - var genericParamsConfigBuilder = - ArrayBuilder.GetInstance(); + var genericParamsConfigBuilder = ArrayBuilder.GetInstance( + + ); genericParamsConfigBuilder.Add(null); if (typeParamStackDepth < 2) { @@ -109,7 +110,9 @@ private static TypeNameConfig[] GenerateTypeNameConfigs(int typeParamStackDepth) } foreach ( - var genericParamsConfig in genericParamsConfigBuilder.ToImmutableAndFree() + var genericParamsConfig in genericParamsConfigBuilder.ToImmutableAndFree( + + ) ) { builder.Add( diff --git a/roslyn/src/Compilers/Core/MSBuildTask/GenerateMSBuildEditorConfig.cs b/roslyn/src/Compilers/Core/MSBuildTask/GenerateMSBuildEditorConfig.cs index c6aa146db30..2452f14f9ae 100644 --- a/roslyn/src/Compilers/Core/MSBuildTask/GenerateMSBuildEditorConfig.cs +++ b/roslyn/src/Compilers/Core/MSBuildTask/GenerateMSBuildEditorConfig.cs @@ -80,8 +80,8 @@ public override bool Execute() } // group the metadata items by their full path - var groupedItems = MetadataItems.GroupBy( - i => NormalizeWithForwardSlash(i.GetMetadata("FullPath")) + var groupedItems = MetadataItems.GroupBy(i => + NormalizeWithForwardSlash(i.GetMetadata("FullPath")) ); foreach (var group in groupedItems) diff --git a/roslyn/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs b/roslyn/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs index a3828dc8225..66894ee631f 100644 --- a/roslyn/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs +++ b/roslyn/src/Compilers/Core/Portable/CodeGen/ILBuilder.cs @@ -746,10 +746,9 @@ private bool DropUnreachableBlocks() // All blocks should be reachable or, if not reachable, then blocked by finally. Debug.Assert( - AllBlocks( - block => - (block.Reachability == Reachability.Reachable) - || (block.Reachability == Reachability.BlockedByFinally) + AllBlocks(block => + (block.Reachability == Reachability.Reachable) + || (block.Reachability == Reachability.BlockedByFinally) ) ); diff --git a/roslyn/src/Compilers/Core/Portable/Collections/IdentifierCollection.Collection.cs b/roslyn/src/Compilers/Core/Portable/Collections/IdentifierCollection.Collection.cs index bde60d0acd4..5855df2886c 100644 --- a/roslyn/src/Compilers/Core/Portable/Collections/IdentifierCollection.Collection.cs +++ b/roslyn/src/Compilers/Core/Portable/Collections/IdentifierCollection.Collection.cs @@ -42,8 +42,8 @@ public int Count { if (_count == -1) { - _count = this.IdentifierCollection._map.Values.Sum( - o => o is string ? 1 : ((ISet)o).Count + _count = this.IdentifierCollection._map.Values.Sum(o => + o is string ? 1 : ((ISet)o).Count ); } diff --git a/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs b/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs index 361ceaca96d..c86badec719 100644 --- a/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs +++ b/roslyn/src/Compilers/Core/Portable/CommandLine/CommonCompiler.cs @@ -1180,8 +1180,8 @@ out analyzerConfigSet } globalConfigOptions = analyzerConfigSet.GlobalConfigOptions; - sourceFileAnalyzerConfigOptions = Arguments.SourceFiles.SelectAsArray( - f => analyzerConfigSet.GetOptionsForSourcePath(f.Path) + sourceFileAnalyzerConfigOptions = Arguments.SourceFiles.SelectAsArray(f => + analyzerConfigSet.GetOptionsForSourcePath(f.Path) ); foreach (var sourceFileAnalyzerConfigOption in sourceFileAnalyzerConfigOptions) @@ -1370,8 +1370,8 @@ ImmutableArray sourceFileAnalyzerConfigOptions // https://github.com/dotnet/roslyn/issues/31916: The compiler currently doesn't support // configuring diagnostic reporting on additional text files individually. ImmutableArray additionalFileAnalyzerOptions = - additionalTextFiles.SelectAsArray( - f => analyzerConfigSet.GetOptionsForSourcePath(f.Path) + additionalTextFiles.SelectAsArray(f => + analyzerConfigSet.GetOptionsForSourcePath(f.Path) ); foreach (var result in additionalFileAnalyzerOptions) @@ -2153,15 +2153,12 @@ out IEnumerable errors ); errors = diagnostics .ToReadOnlyAndFree() - .SelectAsArray( - diag => - new DiagnosticInfo( - messageProvider, - diag.IsWarningAsError, - diag.Code, - (object[])diag.Arguments - ) - ); + .SelectAsArray(diag => new DiagnosticInfo( + messageProvider, + diag.IsWarningAsError, + diag.Code, + (object[])diag.Arguments + )); return stream; } diff --git a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs index dd9bbed60c5..2ba4734b50f 100644 --- a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs +++ b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerDriver.cs @@ -1483,12 +1483,11 @@ CancellationToken cancellationToken // 1. Diagnostics which are already suppressed in source via pragma/suppress message attribute. // 2. Diagnostics explicitly tagged as not configurable by analyzer authors - this includes compiler error diagnostics. // 3. Diagnostics which are marked as error by default by diagnostic authors. - var suppressableDiagnostics = reportedDiagnostics.Where( - d => - !d.IsSuppressed - && !d.IsNotConfigurable() - && d.DefaultSeverity != DiagnosticSeverity.Error - && !_diagnosticsProcessedForProgrammaticSuppressions.Contains(d) + var suppressableDiagnostics = reportedDiagnostics.Where(d => + !d.IsSuppressed + && !d.IsNotConfigurable() + && d.DefaultSeverity != DiagnosticSeverity.Error + && !_diagnosticsProcessedForProgrammaticSuppressions.Contains(d) ); if (suppressableDiagnostics.IsEmpty()) @@ -1613,8 +1612,8 @@ DiagnosticSuppressor suppressor foreach (var diagnostic in reportedDiagnostics) { if ( - supportedSuppressions.Contains( - s => s.SuppressedDiagnosticId == diagnostic.Id + supportedSuppressions.Contains(s => + s.SuppressedDiagnosticId == diagnostic.Id ) ) { @@ -1943,18 +1942,17 @@ CancellationToken cancellationToken static bool containsGeneratedCodeToken(SyntaxNode root) { return root.DescendantTokens() - .Any( - static token => - string.Equals( - token.ValueText, - "GeneratedCode", - StringComparison.Ordinal - ) - || string.Equals( - token.ValueText, - nameof(GeneratedCodeAttribute), - StringComparison.Ordinal - ) + .Any(static token => + string.Equals( + token.ValueText, + "GeneratedCode", + StringComparison.Ordinal + ) + || string.Equals( + token.ValueText, + nameof(GeneratedCodeAttribute), + StringComparison.Ordinal + ) ); } } @@ -2109,12 +2107,11 @@ internal TimeSpan ResetAnalyzerExecutionTime(DiagnosticAnalyzer analyzer) => DiagnosticAnalyzer, ImmutableArray> )>.GetInstance(); - var actionsByAnalyzers = analyzerActions.SymbolActions.GroupBy( - action => action.Analyzer + var actionsByAnalyzers = analyzerActions.SymbolActions.GroupBy(action => action.Analyzer + ); + var actionsByKindBuilder = ArrayBuilder>.GetInstance( + ); - var actionsByKindBuilder = ArrayBuilder< - ArrayBuilder - >.GetInstance(); foreach (var analyzerAndActions in actionsByAnalyzers) { actionsByKindBuilder.Clear(); @@ -4141,8 +4138,8 @@ bool arePerSymbolActions var filteredOperationsToAnalyze = declarationAnalysisData.IsPartialAnalysis && !groupedActionsForAnalyzer.HasOperationBlockStartActions - ? operationsToAnalyze.WhereAsArray( - operation => analysisScope.ShouldAnalyze(operation.Syntax) + ? operationsToAnalyze.WhereAsArray(operation => + analysisScope.ShouldAnalyze(operation.Syntax) ) : operationsToAnalyze; diff --git a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs index e7cda82997c..d22e5272709 100644 --- a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs +++ b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.TargetSymbolResolver.cs @@ -241,8 +241,8 @@ var method in GetMatchingMethods( switch (_scope) { case TargetScope.Namespace: - singleResult = candidateMembers.FirstOrDefault( - s => s.Kind == SymbolKind.Namespace + singleResult = candidateMembers.FirstOrDefault(s => + s.Kind == SymbolKind.Namespace ); break; @@ -260,17 +260,14 @@ var method in GetMatchingMethods( } else if (isEvent) { - singleResult = candidateMembers.FirstOrDefault( - s => s.Kind == SymbolKind.Event + singleResult = candidateMembers.FirstOrDefault(s => + s.Kind == SymbolKind.Event ); } else { - singleResult = candidateMembers.FirstOrDefault( - s => - s.Kind - is not SymbolKind.Namespace - and not SymbolKind.NamedType + singleResult = candidateMembers.FirstOrDefault(s => + s.Kind is not SymbolKind.Namespace and not SymbolKind.NamedType ); } break; @@ -915,8 +912,8 @@ int arity ) { return (INamedTypeSymbol) - candidateMembers.FirstOrDefault( - s => s.Kind == SymbolKind.NamedType && ((INamedTypeSymbol)s).Arity == arity + candidateMembers.FirstOrDefault(s => + s.Kind == SymbolKind.NamedType && ((INamedTypeSymbol)s).Arity == arity ); } @@ -925,8 +922,8 @@ ImmutableArray candidateMembers ) { return (INamespaceOrTypeSymbol) - candidateMembers.FirstOrDefault( - s => s.Kind is SymbolKind.Namespace or SymbolKind.NamedType + candidateMembers.FirstOrDefault(s => + s.Kind is SymbolKind.Namespace or SymbolKind.NamedType ); } diff --git a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs index 998edb30686..70eac411b00 100644 --- a/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs +++ b/roslyn/src/Compilers/Core/Portable/DiagnosticAnalyzer/SuppressMessageAttributeState.cs @@ -121,10 +121,9 @@ internal SuppressMessageAttributeState(Compilation compilation) { _compilation = compilation; _localSuppressionsBySymbol = - new ConcurrentDictionary< - ISymbol, - ImmutableDictionary - >(); + new ConcurrentDictionary>( + + ); } public Diagnostic ApplySourceSuppressions(Diagnostic diagnostic) diff --git a/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceDefinition.cs b/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceDefinition.cs index 3a615bbd4e5..a3d9597d1fc 100644 --- a/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceDefinition.cs +++ b/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/DeletedSourceDefinition.cs @@ -56,9 +56,10 @@ protected ImmutableArray WrapParameters( ImmutableArray parameters ) { - return parameters.SelectAsArray( - p => new DeletedSourceParameterDefinition(p, _typesUsedByDeletedMembers) - ); + return parameters.SelectAsArray(p => new DeletedSourceParameterDefinition( + p, + _typesUsedByDeletedMembers + )); } [return: NotNullIfNotNull(nameof(typeReference))] diff --git a/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/SymbolMatcher.cs b/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/SymbolMatcher.cs index 16638091f96..d690b1378ab 100644 --- a/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/SymbolMatcher.cs +++ b/roslyn/src/Compilers/Core/Portable/Emit/EditAndContinue/SymbolMatcher.cs @@ -181,15 +181,12 @@ private ImmutableSegmentedDictionary< { builder.Add( key, - values.SelectAsArray( - value => - new AnonymousTypeValue( - value.Name, - value.UniqueIndex, - (Cci.ITypeDefinition?)MapDefinition(value.Type) - ?? throw ExceptionUtilities.UnexpectedValue(value.Type) - ) - ) + values.SelectAsArray(value => new AnonymousTypeValue( + value.Name, + value.UniqueIndex, + (Cci.ITypeDefinition?)MapDefinition(value.Type) + ?? throw ExceptionUtilities.UnexpectedValue(value.Type) + )) ); } diff --git a/roslyn/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs b/roslyn/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs index 8bb6d038ee0..f8a08666c09 100644 --- a/roslyn/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs +++ b/roslyn/src/Compilers/Core/Portable/MetadataReader/MetadataDecoder.cs @@ -603,8 +603,9 @@ private TypeSymbol GetTypeOfTypeRef(TypeReferenceHandle typeRef, out bool isNoPi { // This is a cache similar to one used by native compiler in MetaImport::GetTypeOfTypeRef. // TypeRef tokens are unique only within a Module - ConcurrentDictionary cache = - GetTypeRefHandleToTypeMap(); + ConcurrentDictionary cache = GetTypeRefHandleToTypeMap( + + ); TypeSymbol result; if (cache != null && cache.TryGetValue(typeRef, out result)) diff --git a/roslyn/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs b/roslyn/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs index fa88fc17c40..05de63a4234 100644 --- a/roslyn/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs +++ b/roslyn/src/Compilers/Core/Portable/Operations/ControlFlowGraphBuilder.cs @@ -1514,13 +1514,12 @@ private void AddStatement(IOperation? statement #if DEBUG Debug.Assert( spillingTheStack - || _evalStack.All( - slot => - slot.operationOpt == null - || slot.operationOpt.Kind == OperationKind.FlowCaptureReference - || slot.operationOpt.Kind == OperationKind.DeclarationExpression - || slot.operationOpt.Kind == OperationKind.Discard - || slot.operationOpt.Kind == OperationKind.OmittedArgument + || _evalStack.All(slot => + slot.operationOpt == null + || slot.operationOpt.Kind == OperationKind.FlowCaptureReference + || slot.operationOpt.Kind == OperationKind.DeclarationExpression + || slot.operationOpt.Kind == OperationKind.Discard + || slot.operationOpt.Kind == OperationKind.OmittedArgument ) ); #endif @@ -4773,12 +4772,11 @@ private IOperation VisitConditionalAccessTestExpression(IOperation testExpressio var predecessors = ArrayBuilder.GetInstance(); handlerRegion.FirstBlock.GetPredecessors(predecessors); Debug.Assert( - predecessors.All( - p => - filterAndHandlerRegion.Regions[0].FirstBlock!.Ordinal - <= p.Ordinal - && filterAndHandlerRegion.Regions[0].LastBlock!.Ordinal - >= p.Ordinal + predecessors.All(p => + filterAndHandlerRegion.Regions[0].FirstBlock!.Ordinal + <= p.Ordinal + && filterAndHandlerRegion.Regions[0].LastBlock!.Ordinal + >= p.Ordinal ) ); predecessors.Free(); diff --git a/roslyn/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs b/roslyn/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs index c2b21546600..8112be8517e 100644 --- a/roslyn/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs +++ b/roslyn/src/Compilers/Core/Portable/ReferenceManager/CommonReferenceManager.State.cs @@ -590,8 +590,9 @@ out Dictionary< } } - aliasesOfReferencedAssemblies = - aliasesOfReferencedAssembliesBuilder.ToImmutableAndFree(); + aliasesOfReferencedAssemblies = aliasesOfReferencedAssembliesBuilder.ToImmutableAndFree( + + ); } /// @@ -774,12 +775,11 @@ internal sealed override IEnumerable< KeyValuePair > GetReferencedAssemblies() { - return ReferencedAssembliesMap.Select( - ra => - KeyValuePairUtil.Create( - ra.Key, - (IAssemblySymbolInternal)ReferencedAssemblies[ra.Value] - ) + return ReferencedAssembliesMap.Select(ra => + KeyValuePairUtil.Create( + ra.Key, + (IAssemblySymbolInternal)ReferencedAssemblies[ra.Value] + ) ); } diff --git a/roslyn/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs b/roslyn/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs index 29c6b47fd08..ac168d28ccd 100644 --- a/roslyn/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs +++ b/roslyn/src/Compilers/Core/Portable/SourceGeneration/GeneratorDriver.cs @@ -365,9 +365,10 @@ internal GeneratorDriverState RunGeneratorsCore( // the generator is initialized, but we need to reparse the post-init trees as the parse options have changed var reparsedInitSources = ParseAdditionalSources( sourceGenerator, - generatorState.PostInitTrees.SelectAsArray( - t => new GeneratedSourceText(t.HintName, t.Text) - ), + generatorState.PostInitTrees.SelectAsArray(t => new GeneratedSourceText( + t.HintName, + t.Text + )), cancellationToken ); generatorState = new GeneratorState( @@ -677,14 +678,13 @@ private static ImmutableArray GetIncrementalGenerators( string sourceExtension ) { - return generators.SelectAsArray( - g => - g switch - { - IncrementalGeneratorWrapper igw => igw.Generator, - IIncrementalGenerator ig => ig, - _ => new SourceGeneratorAdaptor(g, sourceExtension) - } + return generators.SelectAsArray(g => + g switch + { + IncrementalGeneratorWrapper igw => igw.Generator, + IIncrementalGenerator ig => ig, + _ => new SourceGeneratorAdaptor(g, sourceExtension) + } ); } diff --git a/roslyn/src/Compilers/Core/Portable/SourceGeneration/Nodes/SharedInputNodes.cs b/roslyn/src/Compilers/Core/Portable/SourceGeneration/Nodes/SharedInputNodes.cs index 712c6e25e3f..1b8199ae977 100644 --- a/roslyn/src/Compilers/Core/Portable/SourceGeneration/Nodes/SharedInputNodes.cs +++ b/roslyn/src/Compilers/Core/Portable/SourceGeneration/Nodes/SharedInputNodes.cs @@ -15,8 +15,8 @@ namespace Microsoft.CodeAnalysis /// internal static class SharedInputNodes { - public static readonly InputNode Compilation = new InputNode( - b => ImmutableArray.Create(b.Compilation) + public static readonly InputNode Compilation = new InputNode(b => + ImmutableArray.Create(b.Compilation) ); public static readonly InputNode CompilationOptions = @@ -32,13 +32,13 @@ internal static class SharedInputNodes public static readonly InputNode AdditionalTexts = new InputNode(b => b.DriverState.AdditionalTexts); - public static readonly InputNode SyntaxTrees = new InputNode( - b => b.Compilation.SyntaxTrees.ToImmutableArray() + public static readonly InputNode SyntaxTrees = new InputNode(b => + b.Compilation.SyntaxTrees.ToImmutableArray() ); public static readonly InputNode AnalyzerConfigOptions = - new InputNode( - b => ImmutableArray.Create(b.DriverState.OptionsProvider) + new InputNode(b => + ImmutableArray.Create(b.DriverState.OptionsProvider) ); public static readonly InputNode MetadataReferences = diff --git a/roslyn/src/Compilers/Core/Portable/Syntax/GreenNode.cs b/roslyn/src/Compilers/Core/Portable/Syntax/GreenNode.cs index 232c95b342d..f220ce9200d 100644 --- a/roslyn/src/Compilers/Core/Portable/Syntax/GreenNode.cs +++ b/roslyn/src/Compilers/Core/Portable/Syntax/GreenNode.cs @@ -41,8 +41,9 @@ private static readonly ConditionalWeakTable< > s_annotationsTable = new ConditionalWeakTable(); private static readonly DiagnosticInfo[] s_noDiagnostics = Array.Empty(); - private static readonly SyntaxAnnotation[] s_noAnnotations = - Array.Empty(); + private static readonly SyntaxAnnotation[] s_noAnnotations = Array.Empty( + + ); private static readonly IEnumerable s_noAnnotationsEnumerable = SpecializedCollections.EmptyEnumerable(); diff --git a/roslyn/src/Compilers/Core/Portable/Syntax/SyntaxNode.cs b/roslyn/src/Compilers/Core/Portable/Syntax/SyntaxNode.cs index f5f4637e0e2..d0659665cfa 100644 --- a/roslyn/src/Compilers/Core/Portable/Syntax/SyntaxNode.cs +++ b/roslyn/src/Compilers/Core/Portable/Syntax/SyntaxNode.cs @@ -1845,8 +1845,8 @@ internal bool HasErrors private bool HasErrorsSlow() { - return new Syntax.InternalSyntax.SyntaxDiagnosticInfoList(this.Green).Any( - info => info.Severity == DiagnosticSeverity.Error + return new Syntax.InternalSyntax.SyntaxDiagnosticInfoList(this.Green).Any(info => + info.Severity == DiagnosticSeverity.Error ); } diff --git a/roslyn/src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs b/roslyn/src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs index 40d7c159d8a..03bfc528ebc 100644 --- a/roslyn/src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs +++ b/roslyn/src/Compilers/Core/RebuildTest/CSharpRebuildTests.cs @@ -41,8 +41,8 @@ public void TopLevelStatements() var compilationFactory = CompilationFactory.Create("test.exe", optionsReader); var sources = original - .SyntaxTrees.Select( - x => compilationFactory.CreateSyntaxTree(x.FilePath, x.GetText()) + .SyntaxTrees.Select(x => + compilationFactory.CreateSyntaxTree(x.FilePath, x.GetText()) ) .ToImmutableArray(); var references = original.References.ToImmutableArray(); diff --git a/roslyn/src/Compilers/Core/RebuildTest/CompilationRebuildArtifactResolver.cs b/roslyn/src/Compilers/Core/RebuildTest/CompilationRebuildArtifactResolver.cs index 82e028ad899..a5864bb8fc3 100644 --- a/roslyn/src/Compilers/Core/RebuildTest/CompilationRebuildArtifactResolver.cs +++ b/roslyn/src/Compilers/Core/RebuildTest/CompilationRebuildArtifactResolver.cs @@ -21,10 +21,9 @@ public CompilationRebuildArtifactResolver(Compilation compilation) public MetadataReference ResolveMetadataReference( MetadataReferenceInfo metadataReferenceInfo ) => - Compilation.References.Single( - x => - x.GetModuleVersionId() == metadataReferenceInfo.ModuleVersionId - && x.Properties.Aliases.SingleOrDefault() == metadataReferenceInfo.ExternAlias + Compilation.References.Single(x => + x.GetModuleVersionId() == metadataReferenceInfo.ModuleVersionId + && x.Properties.Aliases.SingleOrDefault() == metadataReferenceInfo.ExternAlias ); public SourceText ResolveSourceText(SourceTextInfo sourceTextInfo) => diff --git a/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs b/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs index b5fb2319337..31c9797b4ff 100644 --- a/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs +++ b/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs @@ -346,8 +346,8 @@ public static void EqualOrDiff(string expected, string actual, string message = ); if ( - !diff.Lines.Any( - line => line.Type == ChangeType.Inserted || line.Type == ChangeType.Deleted + !diff.Lines.Any(line => + line.Type == ChangeType.Inserted || line.Type == ChangeType.Deleted ) ) { @@ -864,8 +864,8 @@ public static string GetAssertMessage( } else { - itemInspector = new Func( - obj => (obj != null) ? obj.ToString() : "" + itemInspector = new Func(obj => + (obj != null) ? obj.ToString() : "" ); } } @@ -945,8 +945,8 @@ public static string GetAssertMessage( } else { - itemInspector = new Func( - obj => (obj != null) ? obj.ToString() : "" + itemInspector = new Func(obj => + (obj != null) ? obj.ToString() : "" ); } } diff --git a/roslyn/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs b/roslyn/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs index acecdf3352a..e648ecd4804 100644 --- a/roslyn/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs +++ b/roslyn/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs @@ -219,9 +219,8 @@ params string[] expectedAssembliesAndAliases var actual = compilation .GetBoundReferenceManager() .GetReferencedAssemblyAliases() - .Select( - t => - $"{t.Item1.Identity.Name}, Version={t.Item1.Identity.Version}{(t.Item2.IsEmpty ? "" : ": " + string.Join(",", t.Item2))}" + .Select(t => + $"{t.Item1.Identity.Name}, Version={t.Item1.Identity.Version}{(t.Item2.IsEmpty ? "" : ": " + string.Join(",", t.Item2))}" ); AssertEx.Equal(expectedAssembliesAndAliases, actual, itemInspector: s => '"' + s + '"'); @@ -235,9 +234,8 @@ params string[] expectedAssembliesAndAliases var actual = compilation .GetBoundReferenceManager() .GetReferencedAssemblyAliases() - .Select( - t => - $"{t.Item1.Identity.Name}{(t.Item2.IsEmpty ? "" : ": " + string.Join(",", t.Item2))}" + .Select(t => + $"{t.Item1.Identity.Name}{(t.Item2.IsEmpty ? "" : ": " + string.Join(",", t.Item2))}" ); AssertEx.Equal(expectedAssembliesAndAliases, actual, itemInspector: s => '"' + s + '"'); @@ -379,10 +377,9 @@ public static void ValidateIOperations(Func createCompilation) } var compilation = createCompilation(); - var roots = ArrayBuilder<( - IOperation operation, - ISymbol associatedSymbol - )>.GetInstance(); + var roots = ArrayBuilder<(IOperation operation, ISymbol associatedSymbol)>.GetInstance( + + ); var stopWatch = new Stopwatch(); if (!System.Diagnostics.Debugger.IsAttached) { diff --git a/roslyn/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs b/roslyn/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs index 18000bc3005..caf3004e91b 100644 --- a/roslyn/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs +++ b/roslyn/src/Compilers/Test/Core/Compilation/ControlFlowGraphVerifier.cs @@ -429,12 +429,11 @@ ISymbol associatedSymbol if ( model .GetDiagnostics(graph.OriginalOperation.Syntax.Span) - .Any( - d => - d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoWith - || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoFor - || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoSyncLock - || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoUsing + .Any(d => + d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoWith + || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoFor + || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoSyncLock + || d.Code == (int)VisualBasic.ERRID.ERR_GotoIntoUsing ) ) { @@ -683,8 +682,8 @@ IFlowCaptureReferenceOperation reference in lastOperation AssertTrueWithGraph( referencesAfter.Length > 0 - && referencesAfter.All( - r => isLongLivedCaptureReferenceSyntax(r.Syntax) + && referencesAfter.All(r => + isLongLivedCaptureReferenceSyntax(r.Syntax) ), $"Capture [{id.Value}] is not used in region [{getRegionId(region)}] before leaving it after block [{getBlockId(block)}]", finalGraph @@ -817,15 +816,12 @@ is VisualBasic.Syntax.ConditionalAccessExpressionSyntax conditional && conditional.Expression == syntax && conditional .WhenNotNull.DescendantNodesAndSelf() - .Any( - n => - n.IsKind(VisualBasic.SyntaxKind.XmlElementAccessExpression) - || n.IsKind( - VisualBasic.SyntaxKind.XmlDescendantAccessExpression - ) - || n.IsKind( - VisualBasic.SyntaxKind.XmlAttributeAccessExpression - ) + .Any(n => + n.IsKind(VisualBasic.SyntaxKind.XmlElementAccessExpression) + || n.IsKind( + VisualBasic.SyntaxKind.XmlDescendantAccessExpression + ) + || n.IsKind(VisualBasic.SyntaxKind.XmlAttributeAccessExpression) ) ) { diff --git a/roslyn/src/Compilers/Test/Core/Compilation/TestOperationVisitor.cs b/roslyn/src/Compilers/Test/Core/Compilation/TestOperationVisitor.cs index eae6193a898..6046a4e50bf 100644 --- a/roslyn/src/Compilers/Test/Core/Compilation/TestOperationVisitor.cs +++ b/roslyn/src/Compilers/Test/Core/Compilation/TestOperationVisitor.cs @@ -1770,8 +1770,9 @@ operation.Syntax as CSharp.Syntax.RecursivePatternSyntax Assert.True(subpat is IPropertySubpatternOperation); } - IEnumerable children = - operation.DeconstructionSubpatterns.Cast(); + IEnumerable children = operation.DeconstructionSubpatterns.Cast( + + ); children = children.Concat(operation.PropertySubpatterns); AssertEx.Equal(children, operation.ChildOperations); diff --git a/roslyn/src/Compilers/Test/Core/CompilationVerifier.cs b/roslyn/src/Compilers/Test/Core/CompilationVerifier.cs index 7ac88463096..807cfc31e13 100644 --- a/roslyn/src/Compilers/Test/Core/CompilationVerifier.cs +++ b/roslyn/src/Compilers/Test/Core/CompilationVerifier.cs @@ -519,11 +519,10 @@ MetadataReader metadataReader { return string.Join( Environment.NewLine, - result.Select( - r => - printMethod(r.Method, metadataReader) - + r.Message - + printErrorArguments(r.ErrorArguments) + result.Select(r => + printMethod(r.Method, metadataReader) + + r.Message + + printErrorArguments(r.ErrorArguments) ) ); } diff --git a/roslyn/src/Compilers/Test/Core/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs b/roslyn/src/Compilers/Test/Core/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs index 232ebea1c0c..1f9cf47bf15 100644 --- a/roslyn/src/Compilers/Test/Core/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs +++ b/roslyn/src/Compilers/Test/Core/Diagnostics/CouldHaveMoreSpecificTypeAnalyzer.cs @@ -177,7 +177,9 @@ is IVariableDeclarationOperation multiVariableDeclaration ) { foreach ( - ILocalSymbol local in multiVariableDeclaration.GetDeclaredVariables() + ILocalSymbol local in multiVariableDeclaration.GetDeclaredVariables( + + ) ) { AssignTo( diff --git a/roslyn/src/Compilers/Test/Core/Diagnostics/OperationTestAnalyzer.cs b/roslyn/src/Compilers/Test/Core/Diagnostics/OperationTestAnalyzer.cs index 1cb2b7d009d..1d3bb59f11f 100644 --- a/roslyn/src/Compilers/Test/Core/Diagnostics/OperationTestAnalyzer.cs +++ b/roslyn/src/Compilers/Test/Core/Diagnostics/OperationTestAnalyzer.cs @@ -1145,8 +1145,8 @@ public sealed override void Initialize(AnalysisContext context) } foreach ( - var decl in declarationStatement.Declarations.SelectMany( - multiDecl => multiDecl.Declarators + var decl in declarationStatement.Declarations.SelectMany(multiDecl => + multiDecl.Declarators ) ) { diff --git a/roslyn/src/Compilers/Test/Core/Diagnostics/SuppressMessageAttributeTests.DiagnosticAnalyzers.cs b/roslyn/src/Compilers/Test/Core/Diagnostics/SuppressMessageAttributeTests.DiagnosticAnalyzers.cs index 49e872851c9..e89540e9691 100644 --- a/roslyn/src/Compilers/Test/Core/Diagnostics/SuppressMessageAttributeTests.DiagnosticAnalyzers.cs +++ b/roslyn/src/Compilers/Test/Core/Diagnostics/SuppressMessageAttributeTests.DiagnosticAnalyzers.cs @@ -247,11 +247,10 @@ public override void Initialize(AnalysisContext analysisContext) var comments = context .Tree.GetRoot() .DescendantTrivia() - .Where( - t => - t.IsKind(SyntaxKind.SingleLineCommentTrivia) - || t.IsKind(SyntaxKind.MultiLineCommentTrivia) - || t.IsKind(VisualBasic.SyntaxKind.CommentTrivia) + .Where(t => + t.IsKind(SyntaxKind.SingleLineCommentTrivia) + || t.IsKind(SyntaxKind.MultiLineCommentTrivia) + || t.IsKind(VisualBasic.SyntaxKind.CommentTrivia) ); foreach (var comment in comments) @@ -337,8 +336,8 @@ public override ImmutableArray SupportedDiagnostics public override void Initialize(AnalysisContext analysisContext) { - analysisContext.RegisterCompilationStartAction( - context => AssemblyName = context.Compilation.AssemblyName + analysisContext.RegisterCompilationStartAction(context => + AssemblyName = context.Compilation.AssemblyName ); analysisContext.RegisterSymbolAction( diff --git a/roslyn/src/Compilers/Test/Core/Diagnostics/ThrowingDiagnosticAnalyzer.cs b/roslyn/src/Compilers/Test/Core/Diagnostics/ThrowingDiagnosticAnalyzer.cs index d854698d6d3..5b767c5b0f7 100644 --- a/roslyn/src/Compilers/Test/Core/Diagnostics/ThrowingDiagnosticAnalyzer.cs +++ b/roslyn/src/Compilers/Test/Core/Diagnostics/ThrowingDiagnosticAnalyzer.cs @@ -80,8 +80,8 @@ public static async Task VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync( Func> runAnalysis ) { - await VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync( - a => Task.FromResult(runAnalysis(a)) + await VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync(a => + Task.FromResult(runAnalysis(a)) ); } diff --git a/roslyn/src/Compilers/Test/Core/Metadata/ILBuilderVisualizer.cs b/roslyn/src/Compilers/Test/Core/Metadata/ILBuilderVisualizer.cs index 078142dcfbd..02c30e93a41 100644 --- a/roslyn/src/Compilers/Test/Core/Metadata/ILBuilderVisualizer.cs +++ b/roslyn/src/Compilers/Test/Core/Metadata/ILBuilderVisualizer.cs @@ -175,8 +175,12 @@ internal static string ILBuilderToString( var ilStream = builder.RealizedIL; if (mapLocal == null) { - mapLocal = local => - new LocalInfo(local.Name, local.Type, local.IsPinned, local.IsReference); + mapLocal = local => new LocalInfo( + local.Name, + local.Type, + local.IsPinned, + local.IsReference + ); } var locals = builder.LocalSlotManager.LocalsInOrder().SelectAsArray(mapLocal); @@ -222,8 +226,12 @@ internal static string LocalSignatureToString( if (mapLocal == null) { - mapLocal = local => - new LocalInfo(local.Name, local.Type, local.IsPinned, local.IsReference); + mapLocal = local => new LocalInfo( + local.Name, + local.Type, + local.IsPinned, + local.IsReference + ); } var locals = builder.LocalSlotManager.LocalsInOrder().SelectAsArray(mapLocal); diff --git a/roslyn/src/Compilers/Test/Core/Metadata/MetadataReaderUtils.cs b/roslyn/src/Compilers/Test/Core/Metadata/MetadataReaderUtils.cs index e77110f5dc7..4622daa8465 100644 --- a/roslyn/src/Compilers/Test/Core/Metadata/MetadataReaderUtils.cs +++ b/roslyn/src/Compilers/Test/Core/Metadata/MetadataReaderUtils.cs @@ -385,8 +385,8 @@ public static IEnumerable DumpAssemblyReferences(this MetadataReader rea { return reader .AssemblyReferences.Select(r => reader.GetAssemblyReference(r)) - .Select( - row => $"{reader.GetString(row.Name)} {row.Version.Major}.{row.Version.Minor}" + .Select(row => + $"{reader.GetString(row.Name)} {row.Version.Major}.{row.Version.Minor}" ); } @@ -394,9 +394,8 @@ public static IEnumerable DumpTypeReferences(this MetadataReader reader) { return reader .TypeReferences.Select(t => reader.GetTypeReference(t)) - .Select( - t => - $"{reader.GetString(t.Name)}, {reader.GetString(t.Namespace)}, {reader.Dump(t.ResolutionScope)}" + .Select(t => + $"{reader.GetString(t.Name)}, {reader.GetString(t.Namespace)}, {reader.Dump(t.ResolutionScope)}" ); } @@ -608,11 +607,11 @@ string[] attributes AssertEx.SetEqual( metadataReader - .CustomAttributes.Select( - a => metadataReader.GetCustomAttribute(a).Constructor + .CustomAttributes.Select(a => + metadataReader.GetCustomAttribute(a).Constructor ) - .Select( - c => metadataReader.GetMemberReference((MemberReferenceHandle)c).Parent + .Select(c => + metadataReader.GetMemberReference((MemberReferenceHandle)c).Parent ) .Select(p => metadataReader.GetTypeReference((TypeReferenceHandle)p).Name) .Select(n => metadataReader.GetString(n)), diff --git a/roslyn/src/Compilers/Test/Core/Platform/Custom/SigningTestHelpers.cs b/roslyn/src/Compilers/Test/Core/Platform/Custom/SigningTestHelpers.cs index a8771e7bb03..92660061ff8 100644 --- a/roslyn/src/Compilers/Test/Core/Platform/Custom/SigningTestHelpers.cs +++ b/roslyn/src/Compilers/Test/Core/Platform/Custom/SigningTestHelpers.cs @@ -71,8 +71,9 @@ private static unsafe void InstallKey(byte[] keyBlob, string keyName) { try { - IClrStrongName strongName = - new DesktopStrongNameProvider().GetStrongNameInterface(); + IClrStrongName strongName = new DesktopStrongNameProvider().GetStrongNameInterface( + + ); //EDMAURER use marshal to be safe? fixed (byte* p = keyBlob) diff --git a/roslyn/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/roslyn/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 3c1b7df76c2..5d735c74f8b 100644 --- a/roslyn/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/roslyn/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -1567,8 +1567,8 @@ private static CSharpCompilation CreateCompilationCore( private static CSharpCompilationOptions CheckForTopLevelStatements(SyntaxTree[] syntaxTrees) { - bool hasTopLevelStatements = syntaxTrees.Any( - s => s.GetRoot().ChildNodes().OfType().Any() + bool hasTopLevelStatements = syntaxTrees.Any(s => + s.GetRoot().ChildNodes().OfType().Any() ); var options = hasTopLevelStatements ? TestOptions.ReleaseExe : TestOptions.ReleaseDll; @@ -1597,8 +1597,8 @@ Func createCompilationLambda var compileDiagnostics = comp.GetDiagnostics(); var emitDiagnostics = comp.GetEmitDiagnostics(); - var resolvedReferences = comp.References.Where( - r => r.Properties.Kind == MetadataImageKind.Assembly + var resolvedReferences = comp.References.Where(r => + r.Properties.Kind == MetadataImageKind.Assembly ); if ( @@ -1611,18 +1611,17 @@ Func createCompilationLambda assertSubset(used, resolvedReferences); if ( - !compileDiagnostics.Any( - d => - d.Code == (int)ErrorCode.HDN_UnusedExternAlias - || d.Code == (int)ErrorCode.HDN_UnusedUsingDirective + !compileDiagnostics.Any(d => + d.Code == (int)ErrorCode.HDN_UnusedExternAlias + || d.Code == (int)ErrorCode.HDN_UnusedUsingDirective ) ) { var comp2 = comp.RemoveAllReferences() .AddReferences( used.Concat( - comp.References.Where( - r => r.Properties.Kind == MetadataImageKind.Module + comp.References.Where(r => + r.Properties.Kind == MetadataImageKind.Module ) ) ); @@ -1632,15 +1631,12 @@ Func createCompilationLambda .Verify( emitDiagnostics .Where(d => shouldCompare(d)) - .Select( - d => - new DiagnosticDescription( - d, - errorCodeOnly: false, - includeDefaultSeverity: false, - includeEffectiveSeverity: false - ) - ) + .Select(d => new DiagnosticDescription( + d, + errorCodeOnly: false, + includeDefaultSeverity: false, + includeEffectiveSeverity: false + )) .ToArray() ); } diff --git a/roslyn/src/Compilers/Test/Utilities/CSharp/CompilationTestUtils.cs b/roslyn/src/Compilers/Test/Utilities/CSharp/CompilationTestUtils.cs index fc817957966..065d169f533 100644 --- a/roslyn/src/Compilers/Test/Utilities/CSharp/CompilationTestUtils.cs +++ b/roslyn/src/Compilers/Test/Utilities/CSharp/CompilationTestUtils.cs @@ -76,8 +76,7 @@ params string[] descriptions { Assert.Equal(descriptions.Length, symbols.Length); AssertEx.SetEqual( - symbols.Select( - s => s.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat) + symbols.Select(s => s.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat) ), descriptions ); @@ -573,12 +572,8 @@ internal static void VerifyTypes(this CSharpCompilation compilation, SyntaxTree var model = compilation.GetSemanticModel(tree); var annotationsByMethod = allAnnotations - .GroupBy( - annotation => - annotation - .Expression.Ancestors() - .OfType() - .First() + .GroupBy(annotation => + annotation.Expression.Ancestors().OfType().First() ) .ToArray(); foreach (var annotations in annotationsByMethod) diff --git a/roslyn/src/Compilers/Test/Utilities/CSharp/FunctionPointerUtilities.cs b/roslyn/src/Compilers/Test/Utilities/CSharp/FunctionPointerUtilities.cs index 7f9ff80eab4..5a498bb9a5b 100644 --- a/roslyn/src/Compilers/Test/Utilities/CSharp/FunctionPointerUtilities.cs +++ b/roslyn/src/Compilers/Test/Utilities/CSharp/FunctionPointerUtilities.cs @@ -229,8 +229,8 @@ public static void VerifyFunctionPointerSemanticInfo( { AssertEx.Equal( expectedSymbolCandidates, - semanticInfo.MemberGroup.Select( - s => s.ToTestDisplayString(includeNonNullable: false) + semanticInfo.MemberGroup.Select(s => + s.ToTestDisplayString(includeNonNullable: false) ) ); } @@ -276,8 +276,8 @@ CompilationUtils.SemanticInfoSummary semanticInfo Assert.Equal(expectedReason, semanticInfo.CandidateReason); AssertEx.Equal( expectedSymbolCandidates, - semanticInfo.CandidateSymbols.Select( - s => s.ToTestDisplayString(includeNonNullable: false) + semanticInfo.CandidateSymbols.Select(s => + s.ToTestDisplayString(includeNonNullable: false) ) ); } diff --git a/roslyn/src/Dependencies/Collections/SegmentedDictionary`2.cs b/roslyn/src/Dependencies/Collections/SegmentedDictionary`2.cs index 2ea79d097e2..8f64085e2ad 100644 --- a/roslyn/src/Dependencies/Collections/SegmentedDictionary`2.cs +++ b/roslyn/src/Dependencies/Collections/SegmentedDictionary`2.cs @@ -548,7 +548,9 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior) { // The chain of entries forms a loop; which means a concurrent update has happened. // Break out of the loop and throw, rather than looping forever. - ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); + ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported( + + ); } } } @@ -593,7 +595,9 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior) { // The chain of entries forms a loop; which means a concurrent update has happened. // Break out of the loop and throw, rather than looping forever. - ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); + ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported( + + ); } } } @@ -632,7 +636,9 @@ private bool TryInsert(TKey key, TValue value, InsertionBehavior behavior) { // The chain of entries forms a loop; which means a concurrent update has happened. // Break out of the loop and throw, rather than looping forever. - ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); + ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported( + + ); } } } @@ -773,7 +779,9 @@ public bool Remove(TKey key) { // The chain of entries forms a loop; which means a concurrent update has happened. // Break out of the loop and throw, rather than looping forever. - ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); + ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported( + + ); } } } @@ -856,7 +864,9 @@ public bool Remove(TKey key, [MaybeNullWhen(false)] out TValue value) { // The chain of entries forms a loop; which means a concurrent update has happened. // Break out of the loop and throw, rather than looping forever. - ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); + ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported( + + ); } } } @@ -1248,7 +1258,9 @@ readonly object? IEnumerator.Current { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } if (_getEnumeratorRetType == DictEntry) @@ -1277,7 +1289,9 @@ readonly DictionaryEntry IDictionaryEnumerator.Entry { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return new DictionaryEntry(_current.Key, _current.Value); @@ -1290,7 +1304,9 @@ readonly object IDictionaryEnumerator.Key { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return _current.Key; @@ -1303,7 +1319,9 @@ readonly object? IDictionaryEnumerator.Value { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return _current.Value; @@ -1469,7 +1487,9 @@ public bool MoveNext() { if (_version != _dictionary._version) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion( + + ); } while ((uint)_index < (uint)_dictionary._count) @@ -1496,7 +1516,9 @@ readonly object? IEnumerator.Current { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return _currentKey; @@ -1507,7 +1529,9 @@ void IEnumerator.Reset() { if (_version != _dictionary._version) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion( + + ); } _index = 0; @@ -1674,7 +1698,9 @@ public bool MoveNext() { if (_version != _dictionary._version) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion( + + ); } while ((uint)_index < (uint)_dictionary._count) @@ -1700,7 +1726,9 @@ readonly object? IEnumerator.Current { if (_index == 0 || (_index == _dictionary._count + 1)) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return _currentValue; @@ -1711,7 +1739,9 @@ void IEnumerator.Reset() { if (_version != _dictionary._version) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion( + + ); } _index = 0; diff --git a/roslyn/src/Dependencies/Collections/SegmentedList`1.cs b/roslyn/src/Dependencies/Collections/SegmentedList`1.cs index 818debbd44c..08f68693245 100644 --- a/roslyn/src/Dependencies/Collections/SegmentedList`1.cs +++ b/roslyn/src/Dependencies/Collections/SegmentedList`1.cs @@ -1244,7 +1244,9 @@ readonly object? IEnumerator.Current { if (_index == 0 || _index == _list._size + 1) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumOpCantHappen( + + ); } return Current; } diff --git a/roslyn/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs b/roslyn/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs index 174c7dec1b6..1e87a1ae560 100644 --- a/roslyn/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs +++ b/roslyn/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs @@ -746,11 +746,10 @@ parent is AccessorListSyntax accessorListNode .ToImmutableArray(); if (!otherAccessors.IsEmpty) { - return !otherAccessors.Any( - static accessor => - accessor.Body == null - && accessor.ExpressionBody == null - && !accessor.SemicolonToken.IsMissing + return !otherAccessors.Any(static accessor => + accessor.Body == null + && accessor.ExpressionBody == null + && !accessor.SemicolonToken.IsMissing ); } } diff --git a/roslyn/src/EditorFeatures/CSharp/EventHookup/EventHookupCommandHandler_TabKeyCommand.cs b/roslyn/src/EditorFeatures/CSharp/EventHookup/EventHookupCommandHandler_TabKeyCommand.cs index a18d519bc0b..227e99aad70 100644 --- a/roslyn/src/EditorFeatures/CSharp/EventHookup/EventHookupCommandHandler_TabKeyCommand.cs +++ b/roslyn/src/EditorFeatures/CSharp/EventHookup/EventHookupCommandHandler_TabKeyCommand.cs @@ -376,8 +376,9 @@ CancellationToken cancellationToken return null; } - var typeInference = - semanticDocument.Document.GetLanguageService(); + var typeInference = semanticDocument.Document.GetLanguageService( + + ); var delegateType = typeInference.InferDelegateType( semanticModel, eventHookupExpression.Right, diff --git a/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/KnownSourcePasteProcessor.cs b/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/KnownSourcePasteProcessor.cs index 195224d2d27..201cc113448 100644 --- a/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/KnownSourcePasteProcessor.cs +++ b/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/KnownSourcePasteProcessor.cs @@ -218,8 +218,8 @@ out ImmutableArray contentSpansAfterBasicPaste textAfterBasicPaste = snapshotAfterTrivialEdit.AsText(); contentSpansAfterBasicPaste = - StringExpressionBeforePasteInfo.ContentSpans.SelectAsArray( - ts => MapSpan(ts, snapshotBeforeTrivialEdit, snapshotAfterTrivialEdit) + StringExpressionBeforePasteInfo.ContentSpans.SelectAsArray(ts => + MapSpan(ts, snapshotBeforeTrivialEdit, snapshotAfterTrivialEdit) ); } diff --git a/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler_CutCopy.cs b/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler_CutCopy.cs index adc513d246e..767754d4404 100644 --- a/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler_CutCopy.cs +++ b/roslyn/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler_CutCopy.cs @@ -97,8 +97,9 @@ IStringCopyPasteService service CancellationToken cancellationToken ) { - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) return default; diff --git a/roslyn/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs b/roslyn/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs index bb2b1526719..16303a3c45c 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/ChangeSignature/RemoveParametersTests.cs @@ -275,8 +275,8 @@ void M() Assert.Null(result.ChangeSignatureFailureKind); foreach ( - var updatedDocument in testState.Workspace.Documents.Select( - d => result.UpdatedSolution.GetDocument(d.Id) + var updatedDocument in testState.Workspace.Documents.Select(d => + result.UpdatedSolution.GetDocument(d.Id) ) ) { @@ -383,8 +383,8 @@ void M() Assert.Null(result.ChangeSignatureFailureKind); foreach ( - var updatedDocument in testState.Workspace.Documents.Select( - d => result.UpdatedSolution.GetDocument(d.Id) + var updatedDocument in testState.Workspace.Documents.Select(d => + result.UpdatedSolution.GetDocument(d.Id) ) ) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs b/roslyn/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs index 3f295db162a..856a07415b9 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/CommentSelection/CSharpToggleBlockCommentCommandHandlerTests.cs @@ -234,9 +234,8 @@ TestWorkspace workspace return (AbstractCommentSelectionBase) workspace .ExportProvider.GetExportedValues() - .First( - export => - typeof(CSharpToggleBlockCommentCommandHandler).Equals(export.GetType()) + .First(export => + typeof(CSharpToggleBlockCommentCommandHandler).Equals(export.GetType()) ); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/Completion/ArgumentProviders/ArgumentProviderOrderTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Completion/ArgumentProviders/ArgumentProviderOrderTests.cs index f827cff406e..db8e79f7692 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Completion/ArgumentProviders/ArgumentProviderOrderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Completion/ArgumentProviders/ArgumentProviderOrderTests.cs @@ -25,14 +25,16 @@ public class ArgumentProviderOrderTests public void TestArgumentProviderOrder() { var exportProvider = - EditorTestCompositions.EditorFeaturesWpf.ExportProviderFactory.CreateExportProvider(); + EditorTestCompositions.EditorFeaturesWpf.ExportProviderFactory.CreateExportProvider( + + ); var argumentProviderExports = exportProvider.GetExports< ArgumentProvider, CompletionProviderMetadata >(); var orderedCSharpArgumentProviders = ExtensionOrderer.Order( - argumentProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + argumentProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); @@ -73,8 +75,8 @@ public void TestArgumentProviderOrderMetadata() CompletionProviderMetadata >(); var orderedCSharpArgumentProviders = ExtensionOrderer.Order( - argumentProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + argumentProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); @@ -133,8 +135,8 @@ public void TestArgumentProviderFirstNameMetadata() CompletionProviderMetadata >(); var orderedCSharpArgumentProviders = ExtensionOrderer.Order( - argumentProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + argumentProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); var firstArgumentProvider = orderedCSharpArgumentProviders.First(); @@ -152,8 +154,8 @@ public void TestArgumentProviderLastNameMetadata() CompletionProviderMetadata >(); var orderedCSharpArgumentProviders = ExtensionOrderer.Order( - argumentProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + argumentProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); var lastArgumentProvider = orderedCSharpArgumentProviders.Last(); @@ -170,8 +172,8 @@ public void TestArgumentProviderNameMetadata() ArgumentProvider, CompletionProviderMetadata >(); - var csharpArgumentProviders = argumentProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + var csharpArgumentProviders = argumentProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ); foreach (var export in csharpArgumentProviders) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs index 71aa8e78904..9a30316405f 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/AbstractCSharpCompletionProviderTests.cs @@ -417,8 +417,8 @@ bool expected position, RoslynTrigger.Invoke ); - var item = completionList.ItemsList.First( - i => (i.DisplayText + i.DisplayTextSuffix).StartsWith(textTypedSoFar) + var item = completionList.ItemsList.First(i => + (i.DisplayText + i.DisplayTextSuffix).StartsWith(textTypedSoFar) ); Assert.Equal( diff --git a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/CompletionProviderOrderTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/CompletionProviderOrderTests.cs index 0a467d755cd..cff8562d882 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/CompletionProviderOrderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/CompletionProviderOrderTests.cs @@ -26,14 +26,16 @@ public class CompletionProviderOrderTests public void TestCompletionProviderOrder() { var exportProvider = - EditorTestCompositions.EditorFeaturesWpf.ExportProviderFactory.CreateExportProvider(); + EditorTestCompositions.EditorFeaturesWpf.ExportProviderFactory.CreateExportProvider( + + ); var completionProviderExports = exportProvider.GetExports< CompletionProvider, CompletionProviderMetadata >(); var orderedCSharpCompletionProviders = ExtensionOrderer.Order( - completionProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + completionProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); @@ -104,8 +106,8 @@ public void TestCompletionProviderOrderMetadata() CompletionProviderMetadata >(); var orderedCSharpCompletionProviders = ExtensionOrderer.Order( - completionProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + completionProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); @@ -164,8 +166,8 @@ public void TestCompletionProviderFirstNameMetadata() CompletionProviderMetadata >(); var orderedCSharpCompletionProviders = ExtensionOrderer.Order( - completionProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + completionProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); var firstCompletionProvider = orderedCSharpCompletionProviders.First(); @@ -183,8 +185,8 @@ public void TestCompletionProviderLastNameMetadata() CompletionProviderMetadata >(); var orderedCSharpCompletionProviders = ExtensionOrderer.Order( - completionProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + completionProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ) ); var lastCompletionProvider = orderedCSharpCompletionProviders.Last(); @@ -201,8 +203,8 @@ public void TestCompletionProviderNameMetadata() CompletionProvider, CompletionProviderMetadata >(); - var csharpCompletionProviders = completionProviderExports.Where( - export => export.Metadata.Language == LanguageNames.CSharp + var csharpCompletionProviders = completionProviderExports.Where(export => + export.Metadata.Language == LanguageNames.CSharp ); foreach (var export in csharpCompletionProviders) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs index afd6862ee70..757e579c0e2 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/ExtensionMethodImportCompletionProviderTests.cs @@ -579,9 +579,10 @@ await VerifyImportItemExistsAsync( public static IEnumerable DerivableTypeKindsWithReferenceTypeData => CombineWithReferenceTypeData( - (new[] { "class", "interface", "abstract class" }).Select( - kind => new List() { kind } - ) + (new[] { "class", "interface", "abstract class" }).Select(kind => new List() + { + kind + }) ); [MemberData(nameof(DerivableTypeKindsWithReferenceTypeData))] diff --git a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs index d215d7be86d..3d2da89b2c9 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Completion/CompletionProviders/OverrideCompletionProviderTests.cs @@ -2918,8 +2918,8 @@ public override void set_Bar(int bay, int value) position, triggerInfo ); - var completionItem = completionList.ItemsList.First( - i => CompareItems(i.DisplayText, "Bar[int bay]") + var completionItem = completionList.ItemsList.First(i => + CompareItems(i.DisplayText, "Bar[int bay]") ); if ( @@ -3242,8 +3242,8 @@ public override bool Equals(object obj) position, triggerInfo ); - var completionItem = completionList.ItemsList.First( - i => CompareItems(i.DisplayText, "Equals(object obj)") + var completionItem = completionList.ItemsList.First(i => + CompareItems(i.DisplayText, "Equals(object obj)") ); if ( @@ -3329,8 +3329,8 @@ public override bool Equals(object obj) cursorPosition, triggerInfo ); - var completionItem = completionList.ItemsList.First( - i => CompareItems(i.DisplayText, "Equals(object obj)") + var completionItem = completionList.ItemsList.First(i => + CompareItems(i.DisplayText, "Equals(object obj)") ); if ( diff --git a/roslyn/src/EditorFeatures/CSharpTest/Debugging/Resources/ProximityExpressionsGetterTestFile.cs b/roslyn/src/EditorFeatures/CSharpTest/Debugging/Resources/ProximityExpressionsGetterTestFile.cs index e50402927eb..6b3d17e9737 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Debugging/Resources/ProximityExpressionsGetterTestFile.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Debugging/Resources/ProximityExpressionsGetterTestFile.cs @@ -234,8 +234,8 @@ ref ExpressionType expressionType if (arrayCreation.InitializerOpt != null) { var flags = ExpressionType.Invalid; - arrayCreation.InitializerOpt.Expressions.Do( - e => CollectExpressionTerms(position, e, terms, ref flags) + arrayCreation.InitializerOpt.Expressions.Do(e => + CollectExpressionTerms(position, e, terms, ref flags) ); validTerm &= (flags & ExpressionType.ValidTerm) == ExpressionType.ValidTerm; diff --git a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs index 744f70ca549..f383b08452f 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/DiagnosticAnalyzerDriver/DiagnosticAnalyzerDriverTests.cs @@ -132,29 +132,27 @@ await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync( foreach (var method in methodNames) { Assert.False( - ideEngineAnalyzer.CallLog.Any( - e => - e.CallerName == method - && e.MethodKind == MethodKind.DelegateInvoke - && e.ReturnsVoid + ideEngineAnalyzer.CallLog.Any(e => + e.CallerName == method + && e.MethodKind == MethodKind.DelegateInvoke + && e.ReturnsVoid ) ); Assert.False( - ideEngineAnalyzer.CallLog.Any( - e => - e.CallerName == method - && e.MethodKind == MethodKind.DelegateInvoke - && !e.ReturnsVoid + ideEngineAnalyzer.CallLog.Any(e => + e.CallerName == method + && e.MethodKind == MethodKind.DelegateInvoke + && !e.ReturnsVoid ) ); Assert.True( - ideEngineAnalyzer.CallLog.Any( - e => e.CallerName == method && e.SymbolKind == SymbolKind.NamedType + ideEngineAnalyzer.CallLog.Any(e => + e.CallerName == method && e.SymbolKind == SymbolKind.NamedType ) ); Assert.False( - ideEngineAnalyzer.CallLog.Any( - e => e.CallerName == method && e.SymbolKind == SymbolKind.Property + ideEngineAnalyzer.CallLog.Any(e => + e.CallerName == method && e.SymbolKind == SymbolKind.Property ) ); } @@ -174,29 +172,27 @@ await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync( foreach (var method in methodNames) { Assert.False( - compilerEngineAnalyzer.CallLog.Any( - e => - e.CallerName == method - && e.MethodKind == MethodKind.DelegateInvoke - && e.ReturnsVoid + compilerEngineAnalyzer.CallLog.Any(e => + e.CallerName == method + && e.MethodKind == MethodKind.DelegateInvoke + && e.ReturnsVoid ) ); Assert.False( - compilerEngineAnalyzer.CallLog.Any( - e => - e.CallerName == method - && e.MethodKind == MethodKind.DelegateInvoke - && !e.ReturnsVoid + compilerEngineAnalyzer.CallLog.Any(e => + e.CallerName == method + && e.MethodKind == MethodKind.DelegateInvoke + && !e.ReturnsVoid ) ); Assert.True( - compilerEngineAnalyzer.CallLog.Any( - e => e.CallerName == method && e.SymbolKind == SymbolKind.NamedType + compilerEngineAnalyzer.CallLog.Any(e => + e.CallerName == method && e.SymbolKind == SymbolKind.NamedType ) ); Assert.False( - compilerEngineAnalyzer.CallLog.Any( - e => e.CallerName == method && e.SymbolKind == SymbolKind.Property + compilerEngineAnalyzer.CallLog.Any(e => + e.CallerName == method && e.SymbolKind == SymbolKind.Property ) ); } @@ -207,26 +203,32 @@ public async Task DiagnosticAnalyzerDriverIsSafeAgainstAnalyzerExceptions() { var source = TestResource.AllInOneCSharpCode; - await ThrowingDiagnosticAnalyzer.VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync(async analyzer => - { - using var workspace = TestWorkspace.CreateCSharp( - source, - TestOptions.Regular, - composition: s_compositionWithMockDiagnosticUpdateSourceRegistrationService - ); + await ThrowingDiagnosticAnalyzer.VerifyAnalyzerEngineIsSafeAgainstExceptionsAsync( + async analyzer => + { + using var workspace = TestWorkspace.CreateCSharp( + source, + TestOptions.Regular, + composition: s_compositionWithMockDiagnosticUpdateSourceRegistrationService + ); - var analyzerReference = new AnalyzerImageReference(ImmutableArray.Create(analyzer)); - workspace.TryApplyChanges( - workspace.CurrentSolution.WithAnalyzerReferences(new[] { analyzerReference }) - ); + var analyzerReference = new AnalyzerImageReference( + ImmutableArray.Create(analyzer) + ); + workspace.TryApplyChanges( + workspace.CurrentSolution.WithAnalyzerReferences( + new[] { analyzerReference } + ) + ); - var document = workspace.CurrentSolution.Projects.Single().Documents.Single(); - return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync( - workspace, - document, - new TextSpan(0, document.GetTextAsync().Result.Length) - ); - }); + var document = workspace.CurrentSolution.Projects.Single().Documents.Single(); + return await DiagnosticProviderTestUtilities.GetAllDiagnosticsAsync( + workspace, + document, + new TextSpan(0, document.GetTextAsync().Result.Length) + ); + } + ); } [Fact, WorkItem("http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/908621")] @@ -425,8 +427,8 @@ void F(int x = 0) ideEngineDocument, new TextSpan(0, ideEngineDocument.GetTextAsync().Result.Length) ); - var diagnosticsFromAnalyzer = diagnostics.Where( - d => d.Id == CodeBlockAnalyzerFactory.Descriptor.Id + var diagnosticsFromAnalyzer = diagnostics.Where(d => + d.Id == CodeBlockAnalyzerFactory.Descriptor.Id ); Assert.Equal(2, diagnosticsFromAnalyzer.Count()); } @@ -457,8 +459,8 @@ void F(int x = 0, int y = 1, int z = 2) var diagnostics = compilerEngineCompilation.GetAnalyzerDiagnostics( new[] { analyzer } ); - var diagnosticsFromAnalyzer = diagnostics.Where( - d => d.Id == CodeBlockAnalyzerFactory.Descriptor.Id + var diagnosticsFromAnalyzer = diagnostics.Where(d => + d.Id == CodeBlockAnalyzerFactory.Descriptor.Id ); Assert.Equal(4, diagnosticsFromAnalyzer.Count()); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/EditorConfigNamingStyleParserTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/EditorConfigNamingStyleParserTests.cs index f59f089f51b..1818c1b8b9c 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/EditorConfigNamingStyleParserTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/NamingStyles/EditorConfigNamingStyleParserTests.cs @@ -596,19 +596,19 @@ public static void TestRequiredModifiersParse() var vbResult = ParseDictionary(vbRule); Assert.Equal( - csharpResult.SymbolSpecifications.SelectMany( - x => x.RequiredModifierList.Select(y => y.Modifier) + csharpResult.SymbolSpecifications.SelectMany(x => + x.RequiredModifierList.Select(y => y.Modifier) ), - vbResult.SymbolSpecifications.SelectMany( - x => x.RequiredModifierList.Select(y => y.Modifier) + vbResult.SymbolSpecifications.SelectMany(x => + x.RequiredModifierList.Select(y => y.Modifier) ) ); Assert.Equal( - csharpResult.SymbolSpecifications.SelectMany( - x => x.RequiredModifierList.Select(y => y.ModifierKindWrapper) + csharpResult.SymbolSpecifications.SelectMany(x => + x.RequiredModifierList.Select(y => y.ModifierKindWrapper) ), - vbResult.SymbolSpecifications.SelectMany( - x => x.RequiredModifierList.Select(y => y.ModifierKindWrapper) + vbResult.SymbolSpecifications.SelectMany(x => + x.RequiredModifierList.Select(y => y.ModifierKindWrapper) ) ); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs index ffd6cb1ccd6..6fa64bea28d 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/RemoveUnnecessaryPragmaSuppressionsTests.cs @@ -150,8 +150,8 @@ protected sealed class CompilationEndDiagnosticAnalyzer : DiagnosticAnalyzer ImmutableArray.Create(Descriptor); public override void Initialize(AnalysisContext context) => - context.RegisterCompilationStartAction( - context => context.RegisterCompilationEndAction(_ => { }) + context.RegisterCompilationStartAction(context => + context.RegisterCompilationEndAction(_ => { }) ); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs index 677faced707..3c69e3c1e86 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Diagnostics/Suppression/SuppressionTests.cs @@ -480,7 +480,9 @@ void Method() ); Assert.IsType( - workspace.ExportProvider.GetExportedValue() + workspace.ExportProvider.GetExportedValue( + + ) ); var diagnosticService = Assert.IsType( workspace.ExportProvider.GetExportedValue() @@ -1327,11 +1329,10 @@ public void AnalyzeNode(SyntaxNodeAnalysisContext context) foreach ( var trivia in context .Node.DescendantTrivia() - .Where( - t => - t.Kind() - is SyntaxKind.SingleLineCommentTrivia - or SyntaxKind.MultiLineCommentTrivia + .Where(t => + t.Kind() + is SyntaxKind.SingleLineCommentTrivia + or SyntaxKind.MultiLineCommentTrivia ) ) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs b/roslyn/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs index 431e239f2fc..dde08a377ce 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/EncapsulateField/EncapsulateFieldTestState.cs @@ -31,8 +31,8 @@ internal class EncapsulateFieldTestState : IDisposable public EncapsulateFieldTestState(TestWorkspace workspace) { Workspace = workspace; - _testDocument = Workspace.Documents.Single( - d => d.CursorPosition.HasValue || d.SelectedSpans.Any() + _testDocument = Workspace.Documents.Single(d => + d.CursorPosition.HasValue || d.SelectedSpans.Any() ); TargetDocument = Workspace.CurrentSolution.GetDocument(_testDocument.Id); diff --git a/roslyn/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs b/roslyn/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs index e848e5e2ffe..37aab8821a9 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs @@ -34,9 +34,10 @@ protected static async Task ExpectExtractMethodToFailAsync( ParseOptions parseOptions = null; if (features != null) { - var featuresMapped = features.Select( - x => new KeyValuePair(x, string.Empty) - ); + var featuresMapped = features.Select(x => new KeyValuePair( + x, + string.Empty + )); parseOptions = new CSharpParseOptions().WithFeatures(featuresMapped); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs b/roslyn/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs index db7ac5d3fc8..35d5b74dfe9 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/Intents/IntentTestsBase.cs @@ -152,7 +152,9 @@ internal static async Task> GetIntentsAsync( var currentDocument = currentTextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); var textDiffService = - workspace.CurrentSolution.Services.GetRequiredService(); + workspace.CurrentSolution.Services.GetRequiredService( + + ); var changes = await textDiffService .GetTextChangesAsync(currentDocument, priorDocument, CancellationToken.None) .ConfigureAwait(false); diff --git a/roslyn/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs b/roslyn/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs index f26ef9c5d7a..d62951466b8 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/NavigateTo/NavigateToTests.cs @@ -62,8 +62,8 @@ class Goo """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -91,8 +91,8 @@ record Goo """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -120,8 +120,8 @@ record class Goo """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -158,8 +158,8 @@ await TestAsync( content, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -195,8 +195,8 @@ await TestAsync( content, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -224,8 +224,8 @@ class @static """, async w => { - var item = (await _aggregator.GetItemsAsync("static")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("static")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -237,8 +237,8 @@ class @static ); // Check searching for @static too - item = (await _aggregator.GetItemsAsync("@static")).Single( - x => x.Kind != "Method" + item = (await _aggregator.GetItemsAsync("@static")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -272,8 +272,8 @@ internal class DogBed """, async w => { - var item = (await _aggregator.GetItemsAsync("DogBed")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("DogBed")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -343,8 +343,8 @@ class Goo where T : IEnumerable """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -469,8 +469,8 @@ class Goo """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -498,8 +498,7 @@ struct Bar """, async w => { - var item = (await _aggregator.GetItemsAsync("B")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("B")).Single(x => x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -530,8 +529,8 @@ enum Colors """, async w => { - var item = (await _aggregator.GetItemsAsync("Colors")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("Colors")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -996,8 +995,8 @@ public Goo() """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - t => t.Kind == NavigateToItemKind.Method + var item = (await _aggregator.GetItemsAsync("Goo")).Single(t => + t.Kind == NavigateToItemKind.Method ); VerifyNavigateToResultItem( item, @@ -1029,8 +1028,8 @@ public Goo(int i) """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - t => t.Kind == NavigateToItemKind.Method + var item = (await _aggregator.GetItemsAsync("Goo")).Single(t => + t.Kind == NavigateToItemKind.Method ); VerifyNavigateToResultItem( item, @@ -1062,8 +1061,8 @@ static Goo() """, async w => { - var item = (await _aggregator.GetItemsAsync("Goo")).Single( - t => t.Kind == NavigateToItemKind.Method && t.Name != ".ctor" + var item = (await _aggregator.GetItemsAsync("Goo")).Single(t => + t.Kind == NavigateToItemKind.Method && t.Name != ".ctor" ); VerifyNavigateToResultItem( item, @@ -1459,8 +1458,8 @@ namespace Goo """, async w => { - var item = (await _aggregator.GetItemsAsync("DoStuff")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("DoStuff")).Single(x => + x.Kind != "Method" ); VerifyNavigateToResultItem( item, @@ -1787,8 +1786,7 @@ await TestAsync( """, async w => { - var item = (await _aggregator.GetItemsAsync("G")).Single( - x => x.Kind != "Method" + var item = (await _aggregator.GetItemsAsync("G")).Single(x => x.Kind != "Method" ); var itemDisplay = item.DisplayFactory.CreateItemDisplay(item); @@ -1796,8 +1794,8 @@ await TestAsync( void assertDescription(string label, string value) { - var descriptionItem = descriptionItems.Single( - i => i.Category.Single().Text == label + var descriptionItem = descriptionItems.Single(i => + i.Category.Single().Text == label ); Assert.Equal(value, descriptionItem.Details.Single().Text); } @@ -2911,8 +2909,8 @@ record Goo(int Member) """, async w => { - var item = (await _aggregator.GetItemsAsync("Member")).Single( - x => x.Kind == NavigateToItemKind.Property + var item = (await _aggregator.GetItemsAsync("Member")).Single(x => + x.Kind == NavigateToItemKind.Property ); VerifyNavigateToResultItem( item, @@ -2942,8 +2940,8 @@ record Goo(int Member) """, async w => { - var item = (await _aggregator.GetItemsAsync("Member")).Single( - x => x.Kind == NavigateToItemKind.Property + var item = (await _aggregator.GetItemsAsync("Member")).Single(x => + x.Kind == NavigateToItemKind.Property ); VerifyNavigateToResultItem( item, @@ -2973,8 +2971,8 @@ record Goo(int Member) """, async w => { - var item = (await _aggregator.GetItemsAsync("Member")).Single( - x => x.Kind == NavigateToItemKind.Field + var item = (await _aggregator.GetItemsAsync("Member")).Single(x => + x.Kind == NavigateToItemKind.Field ); VerifyNavigateToResultItem( item, diff --git a/roslyn/src/EditorFeatures/CSharpTest/PdbSourceDocument/AbstractPdbSourceDocumentTests.cs b/roslyn/src/EditorFeatures/CSharpTest/PdbSourceDocument/AbstractPdbSourceDocumentTests.cs index b135b2245ef..62347946de9 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/PdbSourceDocument/AbstractPdbSourceDocumentTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/PdbSourceDocument/AbstractPdbSourceDocumentTests.cs @@ -46,18 +46,17 @@ protected static Task TestAsync( bool expectNullResult = false ) { - return RunTestAsync( - path => - TestAsync( - path, - pdbLocation, - sourceLocation, - metadataSource, - symbolMatcher, - preprocessorSymbols, - buildReferenceAssembly, - expectNullResult - ) + return RunTestAsync(path => + TestAsync( + path, + pdbLocation, + sourceLocation, + metadataSource, + symbolMatcher, + preprocessorSymbols, + buildReferenceAssembly, + expectNullResult + ) ); } diff --git a/roslyn/src/EditorFeatures/CSharpTest/RawStringLiteral/RawStringLiteralCommandHandlerTests.cs b/roslyn/src/EditorFeatures/CSharpTest/RawStringLiteral/RawStringLiteralCommandHandlerTests.cs index b1bce5a30b0..24a80dea577 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/RawStringLiteral/RawStringLiteralCommandHandlerTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/RawStringLiteral/RawStringLiteralCommandHandlerTests.cs @@ -78,8 +78,8 @@ out var spans TextView.Caret.Position.BufferPosition.Position ); - var virtualSpaces = spans.SingleOrDefault( - kvp => kvp.Key.StartsWith("VirtualSpaces#") + var virtualSpaces = spans.SingleOrDefault(kvp => + kvp.Key.StartsWith("VirtualSpaces#") ); if (virtualSpaces.Key != null) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/StringCopyPaste/StringCopyPasteCommandHandlerTests.cs b/roslyn/src/EditorFeatures/CSharpTest/StringCopyPaste/StringCopyPasteCommandHandlerTests.cs index b87a99cf3e2..64cad57ecc1 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/StringCopyPaste/StringCopyPasteCommandHandlerTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/StringCopyPaste/StringCopyPasteCommandHandlerTests.cs @@ -91,8 +91,8 @@ out ImmutableDictionary> spans Assert.Equal(massaged, TextView.TextSnapshot.GetText()); Assert.Equal(caretPosition, TextView.Caret.Position.BufferPosition.Position); - var virtualSpaces = spans.SingleOrDefault( - kvp => kvp.Key.StartsWith("VirtualSpaces#") + var virtualSpaces = spans.SingleOrDefault(kvp => + kvp.Key.StartsWith("VirtualSpaces#") ); if (virtualSpaces.Key != null) { @@ -120,8 +120,8 @@ string afterUndoMarkup as TestStringCopyPasteService; service?.TrySetClipboardData(StringCopyPasteCommandHandler.KeyAndVersion, ""); - var copyDocument = this.Workspace.Documents.FirstOrDefault( - d => d.AnnotatedSpans.ContainsKey("Copy") + var copyDocument = this.Workspace.Documents.FirstOrDefault(d => + d.AnnotatedSpans.ContainsKey("Copy") ); if (copyDocument != null) { diff --git a/roslyn/src/EditorFeatures/CSharpTest/SymbolKey/SymbolKeyTests.cs b/roslyn/src/EditorFeatures/CSharpTest/SymbolKey/SymbolKeyTests.cs index 074976b7991..e33c7f7eb2b 100644 --- a/roslyn/src/EditorFeatures/CSharpTest/SymbolKey/SymbolKeyTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest/SymbolKey/SymbolKeyTests.cs @@ -208,8 +208,8 @@ public async Task ResolveBodySymbolsInMultiProjectReferencesToOriginalProjectAsy var solution = workspace.CurrentSolution; var bodyProject = solution.Projects.Single(p => p.AssemblyName == "BodyProject"); - var referenceProject = solution.Projects.Single( - p => p.AssemblyName == "ReferenceProject" + var referenceProject = solution.Projects.Single(p => + p.AssemblyName == "ReferenceProject" ); var (bodyCompilation, referenceCompilation) = await GetCompilationsAsync( diff --git a/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs b/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs index 16fe1d9efa6..88f9656b6c4 100644 --- a/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/KeywordRecommenderTests.cs @@ -23,7 +23,9 @@ private static readonly Dictionary< static KeywordRecommenderTests() { foreach ( - var recommenderType in typeof(AbstractSyntacticSingleKeywordRecommender).Assembly.GetTypes() + var recommenderType in typeof(AbstractSyntacticSingleKeywordRecommender).Assembly.GetTypes( + + ) ) { if (recommenderType.IsSubclassOf(typeof(AbstractSyntacticSingleKeywordRecommender))) diff --git a/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/RecommenderTests.cs b/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/RecommenderTests.cs index 1f9455322b5..8dad525cdbc 100644 --- a/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/RecommenderTests.cs +++ b/roslyn/src/EditorFeatures/CSharpTest2/Recommendations/RecommenderTests.cs @@ -161,9 +161,9 @@ private async Task CheckResultAsync( } else { - var result = ( - await RecommendKeywordsAsync(position, context) - ).SingleOrDefault(); + var result = (await RecommendKeywordsAsync(position, context)).SingleOrDefault( + + ); AssertEx.NotNull(result); Assert.Equal(KeywordText, result!.Keyword); if (matchPriority != null) diff --git a/roslyn/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs b/roslyn/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs index cb4a48c8ea4..a15795658c8 100644 --- a/roslyn/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs +++ b/roslyn/src/EditorFeatures/Core.Wpf/InlineRename/UI/InlineRenameAdornmentProvider.cs @@ -93,21 +93,18 @@ Collection subjectBuffers ) { // Create it for the view if we don't already have one - textView.GetOrCreateAutoClosingProperty( - v => - new InlineRenameAdornmentManager( - _renameService, - _editorFormatMapService, - _dashboardColorUpdater, - v, - _globalOptionService, - _themeingService, - _asyncQuickInfoBroker, - _listenerProvider, - _threadingContext, - _smartRenameSessionFactory - ) - ); + textView.GetOrCreateAutoClosingProperty(v => new InlineRenameAdornmentManager( + _renameService, + _editorFormatMapService, + _dashboardColorUpdater, + v, + _globalOptionService, + _themeingService, + _asyncQuickInfoBroker, + _listenerProvider, + _threadingContext, + _smartRenameSessionFactory + )); } public void SubjectBuffersDisconnected( @@ -119,8 +116,8 @@ Collection subjectBuffers // Do we still have any buffers alive? if ( textView - .BufferGraph.GetTextBuffers( - b => b.ContentType.IsOfType(ContentTypeNames.RoslynContentType) + .BufferGraph.GetTextBuffers(b => + b.ContentType.IsOfType(ContentTypeNames.RoslynContentType) ) .Any() ) diff --git a/roslyn/src/EditorFeatures/Core.Wpf/NavigableSymbols/NavigableSymbolService.NavigableSymbolSource.cs b/roslyn/src/EditorFeatures/Core.Wpf/NavigableSymbols/NavigableSymbolService.NavigableSymbolSource.cs index c615a433d79..a8cb7c3a271 100644 --- a/roslyn/src/EditorFeatures/Core.Wpf/NavigableSymbols/NavigableSymbolService.NavigableSymbolSource.cs +++ b/roslyn/src/EditorFeatures/Core.Wpf/NavigableSymbols/NavigableSymbolService.NavigableSymbolSource.cs @@ -38,8 +38,9 @@ CancellationToken cancellationToken if (document == null) return null; - var definitionLocationService = - document.GetLanguageService(); + var definitionLocationService = document.GetLanguageService( + + ); if (definitionLocationService == null) return null; @@ -50,7 +51,9 @@ CancellationToken cancellationToken return null; var indicatorFactory = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); return new NavigableSymbol( service, diff --git a/roslyn/src/EditorFeatures/Core.Wpf/Preview/DifferenceViewerPreview.cs b/roslyn/src/EditorFeatures/Core.Wpf/Preview/DifferenceViewerPreview.cs index 4d0b96791c3..dad10de9d46 100644 --- a/roslyn/src/EditorFeatures/Core.Wpf/Preview/DifferenceViewerPreview.cs +++ b/roslyn/src/EditorFeatures/Core.Wpf/Preview/DifferenceViewerPreview.cs @@ -194,7 +194,9 @@ private void FilterThreadMessage(ref System.Windows.Interop.MSG msg, ref bool ha ), 0 /*scope count*/ , - Array.Empty() /*scopes*/ + Array.Empty( + + ) /*scopes*/ , out var cmdGuid, out var cmdId, @@ -215,7 +217,9 @@ out _ ), 0 /*scope count*/ , - Array.Empty() /*scopes*/ + Array.Empty( + + ) /*scopes*/ , out _, out _, diff --git a/roslyn/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs b/roslyn/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs index c2f00097382..f29c85bb7cc 100644 --- a/roslyn/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs +++ b/roslyn/src/EditorFeatures/Core/AddImports/AbstractAddImportsPasteCommandHandler.cs @@ -160,7 +160,9 @@ ITextView textView _threadingContext.ThrowIfNotOnUIThread(); var indicatorFactory = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); using var backgroundWorkContext = indicatorFactory.Create( textView, snapshotSpan, diff --git a/roslyn/src/EditorFeatures/Core/CodeActions/CodeActionEditHandlerService.cs b/roslyn/src/EditorFeatures/Core/CodeActions/CodeActionEditHandlerService.cs index 7353ad76fcb..6542205696f 100644 --- a/roslyn/src/EditorFeatures/Core/CodeActions/CodeActionEditHandlerService.cs +++ b/roslyn/src/EditorFeatures/Core/CodeActions/CodeActionEditHandlerService.cs @@ -492,7 +492,9 @@ await navigationService { var editorWorkspace = workspace; var navigationService = - editorWorkspace.Services.GetRequiredService(); + editorWorkspace.Services.GetRequiredService( + + ); if ( await navigationService diff --git a/roslyn/src/EditorFeatures/Core/CodeDefinitionWindow/DefinitionContextTracker.cs b/roslyn/src/EditorFeatures/Core/CodeDefinitionWindow/DefinitionContextTracker.cs index 30ae6035051..c9a61f95418 100644 --- a/roslyn/src/EditorFeatures/Core/CodeDefinitionWindow/DefinitionContextTracker.cs +++ b/roslyn/src/EditorFeatures/Core/CodeDefinitionWindow/DefinitionContextTracker.cs @@ -94,8 +94,8 @@ IReadOnlyCollection subjectBuffers if ( reason == ConnectionReason.TextViewLifetime || !textView - .BufferGraph.GetTextBuffers( - b => b.ContentType.IsOfType(ContentTypeNames.RoslynContentType) + .BufferGraph.GetTextBuffers(b => + b.ContentType.IsOfType(ContentTypeNames.RoslynContentType) ) .Any() ) diff --git a/roslyn/src/EditorFeatures/Core/CommentSelection/AbstractCommentSelectionBase.cs b/roslyn/src/EditorFeatures/Core/CommentSelection/AbstractCommentSelectionBase.cs index ffefe5caf8e..72190632497 100644 --- a/roslyn/src/EditorFeatures/Core/CommentSelection/AbstractCommentSelectionBase.cs +++ b/roslyn/src/EditorFeatures/Core/CommentSelection/AbstractCommentSelectionBase.cs @@ -173,26 +173,24 @@ CancellationToken cancellationToken if (edits.TrackingSpans.Any()) { // Create tracking spans to track the text changes. - var trackingSpans = edits.TrackingSpans.SelectAsArray( - textSpan => - ( - originalSpan: textSpan, - trackingSpan: CreateTrackingSpan( - edits.ResultOperation, - originalSnapshot, - textSpan.TrackingTextSpan - ) + var trackingSpans = edits.TrackingSpans.SelectAsArray(textSpan => + ( + originalSpan: textSpan, + trackingSpan: CreateTrackingSpan( + edits.ResultOperation, + originalSnapshot, + textSpan.TrackingTextSpan ) + ) ); // Convert the tracking spans into snapshot spans for formatting and selection. - var trackingSnapshotSpans = trackingSpans.Select( - s => - CreateSnapshotSpan( - subjectBuffer.CurrentSnapshot, - s.trackingSpan, - s.originalSpan - ) + var trackingSnapshotSpans = trackingSpans.Select(s => + CreateSnapshotSpan( + subjectBuffer.CurrentSnapshot, + s.trackingSpan, + s.originalSpan + ) ); if (edits.ResultOperation == Operation.Uncomment && document.SupportsSyntaxTree) @@ -214,12 +212,8 @@ CancellationToken cancellationToken document.Project.Services, explicitFormat: false ); - var formattingSpans = trackingSnapshotSpans.Select( - change => - CommonFormattingHelpers.GetFormattingSpan( - newRoot, - change.Span.ToTextSpan() - ) + var formattingSpans = trackingSnapshotSpans.Select(change => + CommonFormattingHelpers.GetFormattingSpan(newRoot, change.Span.ToTextSpan()) ); var formattedChanges = Formatter.GetFormattedTextChanges( newRoot, diff --git a/roslyn/src/EditorFeatures/Core/CommentSelection/ToggleLineCommentCommandHandler.cs b/roslyn/src/EditorFeatures/Core/CommentSelection/ToggleLineCommentCommandHandler.cs index f4653f6fe78..131c8d104ba 100644 --- a/roslyn/src/EditorFeatures/Core/CommentSelection/ToggleLineCommentCommandHandler.cs +++ b/roslyn/src/EditorFeatures/Core/CommentSelection/ToggleLineCommentCommandHandler.cs @@ -119,8 +119,8 @@ NormalizedSnapshotSpanCollection selectedSpans Operation operation; // If any of the lines are uncommented, add comments. if ( - linesInSelections.Values.Any( - lines => SelectionHasUncommentedLines(lines, commentInfo) + linesInSelections.Values.Any(lines => + SelectionHasUncommentedLines(lines, commentInfo) ) ) { diff --git a/roslyn/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs b/roslyn/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs index 3140d08151b..d8ca24e78ca 100644 --- a/roslyn/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs +++ b/roslyn/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.SingleDiagnosticKindPullTaggerProvider.cs @@ -162,10 +162,9 @@ out suppressedDiagnosticsSpans { var diagnosticSpans = _callback .GetLocationsToTag(diagnosticData) - .Select( - loc => - loc.UnmappedFileSpan.GetClampedTextSpan(sourceText) - .ToSnapshotSpan(snapshot) + .Select(loc => + loc.UnmappedFileSpan.GetClampedTextSpan(sourceText) + .ToSnapshotSpan(snapshot) ); foreach (var diagnosticSpan in diagnosticSpans) { diff --git a/roslyn/src/EditorFeatures/Core/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs b/roslyn/src/EditorFeatures/Core/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs index 9d1e2a0f82b..9542ecdc620 100644 --- a/roslyn/src/EditorFeatures/Core/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs +++ b/roslyn/src/EditorFeatures/Core/DocumentationComments/AbstractDocumentationCommentCommandHandler.cs @@ -140,15 +140,17 @@ CancellationToken cancellationToken return false; } - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return false; } - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); var parsedDocument = ParsedDocument.CreateSynchronously(document, cancellationToken); var options = subjectBuffer.GetDocumentationCommentOptions( _editorOptionsService, @@ -305,8 +307,9 @@ public CommandState GetCommandState(InsertCommentCommandArgs args) return CommandState.Unavailable; } - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); var isValidTargetMember = false; _uiThreadOperationExecutor.Execute( @@ -387,15 +390,17 @@ CommandExecutionContext context // Allow nextHandler() to run and then insert exterior trivia if necessary. nextHandler(); - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return; } - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); InsertExteriorTriviaIfNeeded( service, @@ -439,15 +444,17 @@ CommandExecutionContext context return; } - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return; } - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); // Allow nextHandler() to run and the insert exterior trivia if necessary. nextHandler(); @@ -473,8 +480,9 @@ CancellationToken cancellationToken return; } - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return; @@ -523,8 +531,9 @@ private bool CurrentLineStartsWithExteriorTrivia( CancellationToken cancellationToken ) { - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return false; diff --git a/roslyn/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs b/roslyn/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs index a22db549450..e7e092608b4 100644 --- a/roslyn/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs +++ b/roslyn/src/EditorFeatures/Core/EditAndContinue/EditAndContinueLanguageService.cs @@ -98,7 +98,9 @@ private RemoteDebuggingSessionProxy GetDebuggingSession() => _debuggingSession ?? throw new NoSessionException(); private IActiveStatementTrackingService GetActiveStatementTrackingService() => - WorkspaceProvider.Value.Workspace.Services.GetRequiredService(); + WorkspaceProvider.Value.Workspace.Services.GetRequiredService( + + ); internal void Disable() => _disabled = true; @@ -398,16 +400,17 @@ CancellationToken cancellationToken var designTimeSolution = workspace.CurrentSolution; var solution = GetCurrentCompileTimeSolution(designTimeSolution); var activeStatementSpanProvider = GetActiveStatementSpanProvider(solution); - var (moduleUpdates, diagnosticData, rudeEdits, syntaxError) = - await GetDebuggingSession() - .EmitSolutionUpdateAsync( - solution, - activeStatementSpanProvider, - _diagnosticService, - _diagnosticUpdateSource, - cancellationToken - ) - .ConfigureAwait(false); + var (moduleUpdates, diagnosticData, rudeEdits, syntaxError) = await GetDebuggingSession( + + ) + .EmitSolutionUpdateAsync( + solution, + activeStatementSpanProvider, + _diagnosticService, + _diagnosticUpdateSource, + cancellationToken + ) + .ConfigureAwait(false); // Only store the solution if we have any changes to apply, otherwise CommitUpdatesAsync/DiscardUpdatesAsync won't be called. if (moduleUpdates.Status == ModuleUpdateStatus.Ready) diff --git a/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Aggregator/SettingsAggregator.cs b/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Aggregator/SettingsAggregator.cs index 42ac58e4c18..a7fbb490088 100644 --- a/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Aggregator/SettingsAggregator.cs +++ b/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Aggregator/SettingsAggregator.cs @@ -85,12 +85,11 @@ private static ISettingsProviderFactory GetOptionsProviderFactory(Workspac >(); providers.Add(commonProvider); var solution = workspace.CurrentSolution; - var supportsCSharp = solution.Projects.Any( - p => p.Language.Equals(LanguageNames.CSharp, StringComparison.OrdinalIgnoreCase) + var supportsCSharp = solution.Projects.Any(p => + p.Language.Equals(LanguageNames.CSharp, StringComparison.OrdinalIgnoreCase) ); - var supportsVisualBasic = solution.Projects.Any( - p => - p.Language.Equals(LanguageNames.VisualBasic, StringComparison.OrdinalIgnoreCase) + var supportsVisualBasic = solution.Projects.Any(p => + p.Language.Equals(LanguageNames.VisualBasic, StringComparison.OrdinalIgnoreCase) ); if (supportsCSharp) { diff --git a/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Data/AnalyzerSetting.cs b/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Data/AnalyzerSetting.cs index b42ed88ee41..71cb745f527 100644 --- a/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Data/AnalyzerSetting.cs +++ b/roslyn/src/EditorFeatures/Core/EditorConfigSettings/Data/AnalyzerSetting.cs @@ -35,8 +35,8 @@ SettingLocation location IsEnabled = enabled; Severity = effectiveSeverity; Language = language; - IsNotConfigurable = descriptor.CustomTags.Any( - t => t == WellKnownDiagnosticTags.NotConfigurable + IsNotConfigurable = descriptor.CustomTags.Any(t => + t == WellKnownDiagnosticTags.NotConfigurable ); Location = location; } diff --git a/roslyn/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractEditorNavigationBarItemService.cs b/roslyn/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractEditorNavigationBarItemService.cs index cc738edce66..ccd61c1cf17 100644 --- a/roslyn/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractEditorNavigationBarItemService.cs +++ b/roslyn/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractEditorNavigationBarItemService.cs @@ -42,7 +42,9 @@ CancellationToken cancellationToken ) { var service = - document.GetRequiredLanguageService(); + document.GetRequiredLanguageService( + + ); var items = await service .GetItemsAsync( document, @@ -51,8 +53,8 @@ CancellationToken cancellationToken cancellationToken ) .ConfigureAwait(false); - return items.SelectAsArray( - v => (NavigationBarItem)new WrappedNavigationBarItem(textVersion, v) + return items.SelectAsArray(v => + (NavigationBarItem)new WrappedNavigationBarItem(textVersion, v) ); } diff --git a/roslyn/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs b/roslyn/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs index 8270b4c11d5..4563d6cba41 100644 --- a/roslyn/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs +++ b/roslyn/src/EditorFeatures/Core/ExternalAccess/UnitTestGenerator/Api/UnitTestGeneratorAddMissingImportsFeatureServiceAccessor.cs @@ -34,8 +34,9 @@ CancellationToken cancellationToken ) { var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); - var service = - document.Project.GetRequiredLanguageService(); + var service = document.Project.GetRequiredLanguageService( + + ); // Unfortunately, the unit testing system doesn't have a way to report progress. return await service @@ -56,8 +57,9 @@ CancellationToken cancellationToken ) { var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); - var service = - document.Project.GetRequiredLanguageService(); + var service = document.Project.GetRequiredLanguageService( + + ); var result = await service .AnalyzeAsync(document, textSpan, options, cancellationToken) .ConfigureAwait(false); @@ -73,8 +75,9 @@ CancellationToken cancellationToken ) { var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); - var service = - document.Project.GetRequiredLanguageService(); + var service = document.Project.GetRequiredLanguageService( + + ); var unwrappedResult = new AddMissingImportsAnalysisResult( analysisResult.AddImportFixDatas.SelectAsArray(result => result.Underlying) ); diff --git a/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptBlockStructureService.cs b/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptBlockStructureService.cs index 00a8abe5421..939d5524f4a 100644 --- a/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptBlockStructureService.cs +++ b/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptBlockStructureService.cs @@ -34,19 +34,16 @@ CancellationToken cancellationToken .ConfigureAwait(false); return new BlockStructure( - blockStructure.Spans.SelectAsArray( - x => - new BlockSpan( - x.Type!, - x.IsCollapsible, - x.TextSpan, - x.HintSpan, - primarySpans: null, - x.BannerText, - x.AutoCollapse, - x.IsDefaultCollapsed - ) - ) + blockStructure.Spans.SelectAsArray(x => new BlockSpan( + x.Type!, + x.IsCollapsible, + x.TextSpan, + x.HintSpan, + primarySpans: null, + x.BannerText, + x.AutoCollapse, + x.IsDefaultCollapsed + )) ); } } diff --git a/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptNavigableItemsServiceFactory.cs b/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptNavigableItemsServiceFactory.cs index 35472a5a46f..f11a6596a23 100644 --- a/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptNavigableItemsServiceFactory.cs +++ b/roslyn/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptNavigableItemsServiceFactory.cs @@ -48,8 +48,7 @@ CancellationToken cancellationToken if (items is null) return ImmutableArray.Empty; - return items.SelectAsArray( - i => (INavigableItem)new VSTypeScriptNavigableItemWrapper(i) + return items.SelectAsArray(i => (INavigableItem)new VSTypeScriptNavigableItemWrapper(i) ); } } diff --git a/roslyn/src/EditorFeatures/Core/Formatting/FormatCommandHandler.Paste.cs b/roslyn/src/EditorFeatures/Core/Formatting/FormatCommandHandler.Paste.cs index 6c957ea65fc..6233aab13bf 100644 --- a/roslyn/src/EditorFeatures/Core/Formatting/FormatCommandHandler.Paste.cs +++ b/roslyn/src/EditorFeatures/Core/Formatting/FormatCommandHandler.Paste.cs @@ -75,8 +75,9 @@ CancellationToken cancellationToken return; } - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) return; diff --git a/roslyn/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs b/roslyn/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs index 1d15f5e77a0..0d9cf40a37e 100644 --- a/roslyn/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs +++ b/roslyn/src/EditorFeatures/Core/GoToDefinition/GoToDefinitionCommandHandler.cs @@ -115,7 +115,9 @@ SnapshotPoint position bool succeeded; var indicatorFactory = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); // TODO: prior logic was to get a tracking span of length 1 here. Preserving that, though it's unclear if // that is necessary for the BWI to work properly. diff --git a/roslyn/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs b/roslyn/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs index ad6608e2a28..3ca7bbea5b8 100644 --- a/roslyn/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs +++ b/roslyn/src/EditorFeatures/Core/InlineRename/InlineRenameSession.OpenTextBufferManager.cs @@ -88,8 +88,8 @@ var view in session._textBufferAssociatedViewService.GetAssociatedTextViews( session ); - _isBufferReadOnly = new DynamicReadOnlyRegionQuery( - isEdit => !_session._isApplyingEdit + _isBufferReadOnly = new DynamicReadOnlyRegionQuery(isEdit => + !_session._isApplyingEdit ); UpdateReadOnlyRegions(); } @@ -131,8 +131,9 @@ private void UpdateReadOnlyRegions(bool removeOnly = false) { // We will compute the new read only regions to be all spans that are not currently in an editable span var editableSpans = GetEditableSpansForSnapshot(_subjectBuffer.CurrentSnapshot); - var entireBufferSpan = - _subjectBuffer.CurrentSnapshot.GetSnapshotSpanCollection(); + var entireBufferSpan = _subjectBuffer.CurrentSnapshot.GetSnapshotSpanCollection( + + ); var newReadOnlySpans = NormalizedSnapshotSpanCollection.Difference( entireBufferSpan, new NormalizedSnapshotSpanCollection(editableSpans) @@ -252,15 +253,14 @@ internal void SetReferenceSpans(IEnumerable spans) _activeSpan.HasValue && spans.Contains(_activeSpan.Value) ? _activeSpan : spans - .Where( - s => - // in tests `ActiveTextview` can be null so don't depend on it - ActiveTextView == null - || ActiveTextView - .GetSpanInView( - _subjectBuffer.CurrentSnapshot.GetSpan(s.ToSpan()) - ) - .Count != 0 + .Where(s => + // in tests `ActiveTextview` can be null so don't depend on it + ActiveTextView == null + || ActiveTextView + .GetSpanInView( + _subjectBuffer.CurrentSnapshot.GetSpan(s.ToSpan()) + ) + .Count != 0 ) // spans were successfully projected .FirstOrNull(); // filter to spans that have a projection @@ -324,10 +324,9 @@ private void OnTextBufferChanged(object sender, TextContentChangedEventArgs args var singleTrackingSpanTouched = trackingSpansTouched.Single(); _activeSpan = _referenceSpanToLinkedRenameSpanMap - .Where( - kvp => - kvp.Value.TrackingSpan.GetSpan(args.After) - .Contains(boundingIntersectionSpan) + .Where(kvp => + kvp.Value.TrackingSpan.GetSpan(args.After) + .Contains(boundingIntersectionSpan) ) .Single() .Key; @@ -347,19 +346,15 @@ private bool AreAllReferenceSpansMappable() // in tests `ActiveTextview` could be null so don't depend on it return ActiveTextView == null || _referenceSpanToLinkedRenameSpanMap - .Values.Select( - renameTrackingSpan => - renameTrackingSpan.TrackingSpan.GetSpan( - _subjectBuffer.CurrentSnapshot - ) + .Values.Select(renameTrackingSpan => + renameTrackingSpan.TrackingSpan.GetSpan(_subjectBuffer.CurrentSnapshot) ) - .All( - s => - s.End <= _subjectBuffer.CurrentSnapshot.Length - && // span is valid for the snapshot - ActiveTextView - .GetSpanInView(_subjectBuffer.CurrentSnapshot.GetSpan(s)) - .Count != 0 + .All(s => + s.End <= _subjectBuffer.CurrentSnapshot.Length + && // span is valid for the snapshot + ActiveTextView + .GetSpanInView(_subjectBuffer.CurrentSnapshot.GetSpan(s)) + .Count != 0 ); // spans were successfully projected } @@ -472,22 +467,19 @@ CancellationToken cancellationToken _conflictResolutionRenameTrackingSpans.Clear(); var documentReplacements = documents - .Select( - document => - ( - document, - conflictResolution - .GetReplacements(document.Id) - .Where( - r => GetRenameSpanKind(r.Kind) != RenameSpanKind.None - ) - .ToImmutableArray() - ) + .Select(document => + ( + document, + conflictResolution + .GetReplacements(document.Id) + .Where(r => GetRenameSpanKind(r.Kind) != RenameSpanKind.None) + .ToImmutableArray() + ) ) .ToImmutableArray(); - var firstDocumentReplacements = documentReplacements.FirstOrDefault( - d => !d.Item2.IsEmpty + var firstDocumentReplacements = documentReplacements.FirstOrDefault(d => + !d.Item2.IsEmpty ); var bufferContainsLinkedDocuments = documentReplacements.Length > 1 @@ -547,9 +539,8 @@ CancellationToken cancellationToken .NewSolution.GetDocument(firstDocumentReplacements.document.Id) .GetTextSynchronously(cancellationToken); var firstDocumentNewSpanText = - firstDocumentReplacements.Item2.SelectAsArray( - replacement => - firstDocumentNewText.ToString(replacement.NewSpan) + firstDocumentReplacements.Item2.SelectAsArray(replacement => + firstDocumentNewText.ToString(replacement.NewSpan) ); foreach (var (document, replacements) in documentReplacements) { @@ -610,8 +601,9 @@ CancellationToken cancellationToken document.Id, out var mergeConflictComments ); - mergeConflictComments ??= - SpecializedCollections.EmptyEnumerable(); + mergeConflictComments ??= SpecializedCollections.EmptyEnumerable( + + ); foreach (var conflict in mergeConflictComments) { @@ -646,7 +638,9 @@ out var mergeConflictComments GetWithoutAttributeSuffix( _session.ReplacementText, document - .GetLanguageService() + .GetLanguageService( + + ) .IsCaseSensitive ), cancellationToken @@ -655,8 +649,8 @@ out var mergeConflictComments if (linkedRenameSpan.HasValue) { if ( - !mergeConflictComments.Any( - s => replacement.NewSpan.IntersectsWith(s) + !mergeConflictComments.Any(s => + replacement.NewSpan.IntersectsWith(s) ) ) { @@ -697,8 +691,8 @@ out var mergeConflictComments else { if ( - !mergeConflictComments.Any( - s => replacement.NewSpan.IntersectsWith(s) + !mergeConflictComments.Any(s => + replacement.NewSpan.IntersectsWith(s) ) ) { @@ -795,7 +789,9 @@ private static async Task< } var textDiffService = - oldDocument.Project.Solution.Services.GetService(); + oldDocument.Project.Solution.Services.GetService( + + ); return await textDiffService .GetTextChangesAsync(oldDocument, newDocument, cancellationToken) .ConfigureAwait(false); @@ -818,7 +814,9 @@ CancellationToken cancellationToken _session._threadingContext.ThrowIfNotOnUIThread(); var textDiffService = - preMergeDocument.Project.Solution.Services.GetService(); + preMergeDocument.Project.Solution.Services.GetService( + + ); var contentType = preMergeDocument .Project.Services.GetService() .GetDefaultContentType(); @@ -1027,8 +1025,8 @@ out var renameTrackingSpan ) ? renameTrackingSpan.TrackingSpan.GetEndPoint(snapshot) : _openTextBufferManager - ._referenceSpanToLinkedRenameSpanMap.First( - kvp => kvp.Key.OverlapsWith(span) + ._referenceSpanToLinkedRenameSpanMap.First(kvp => + kvp.Key.OverlapsWith(span) ) .Value.TrackingSpan.GetEndPoint(snapshot); return _openTextBufferManager diff --git a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CommitManager.cs b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CommitManager.cs index 103adb07847..8a14b66a8c2 100644 --- a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CommitManager.cs +++ b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CommitManager.cs @@ -108,8 +108,9 @@ CancellationToken cancellationToken // We can make changes to buffers. We would like to be sure nobody can change them at the same time. _threadingContext.ThrowIfNotOnUIThread(); - var document = - subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = subjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return CommitResultUnhandled; @@ -194,7 +195,9 @@ out MultiDictionary excludedCommitCharactersMap } var triggerDocument = - itemData.TriggerLocation.Value.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); + itemData.TriggerLocation.Value.Snapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (triggerDocument == null) { return CommitResultUnhandled; diff --git a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CompletionSource.cs b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CompletionSource.cs index 46827052ac1..1d07c0e6ce4 100644 --- a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CompletionSource.cs +++ b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/CompletionSource.cs @@ -114,8 +114,9 @@ CancellationToken cancellationToken return AsyncCompletionData.CompletionStartData.DoesNotParticipateInCompletion; } - var document = - triggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = triggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return AsyncCompletionData.CompletionStartData.DoesNotParticipateInCompletion; @@ -277,8 +278,9 @@ CancellationToken cancellationToken if (session is null) throw new ArgumentNullException(nameof(session)); - var document = - triggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = triggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) return VSCompletionContext.Empty; @@ -475,7 +477,9 @@ CancellationToken cancellationToken // We only reach here when expanded items are disabled, but user requested them explicitly via expander. // In this case, enable expanded items and trigger the completion only for them. var document = - initialTriggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges(); + initialTriggerLocation.Snapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document != null) { // User selected expander explicitly, which means we need to collect and return @@ -553,8 +557,8 @@ CancellationToken cancellationToken document.Project.Language is LanguageNames.CSharp or LanguageNames.VisualBasic ); var completionItemList = session.CreateCompletionList( - completionList.ItemsList.Select( - i => Convert(document, i, filterSet, triggerLocation, cancellationToken) + completionList.ItemsList.Select(i => + Convert(document, i, filterSet, triggerLocation, cancellationToken) ) ); diff --git a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs index 384d2c4201e..dff45454cc3 100644 --- a/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs +++ b/roslyn/src/EditorFeatures/Core/IntelliSense/AsyncCompletion/ItemManager.cs @@ -175,7 +175,9 @@ CancellationToken cancellationToken ); } - AsyncCompletionLogger.LogSessionWithDelayedImportCompletionIncludedInUpdate(); + AsyncCompletionLogger.LogSessionWithDelayedImportCompletionIncludedInUpdate( + + ); } } diff --git a/roslyn/src/EditorFeatures/Core/Interactive/CommandHandlers/ExecuteInInteractiveCommandHandler.cs b/roslyn/src/EditorFeatures/Core/Interactive/CommandHandlers/ExecuteInInteractiveCommandHandler.cs index 4f46772d5ef..cc1aba5e935 100644 --- a/roslyn/src/EditorFeatures/Core/Interactive/CommandHandlers/ExecuteInInteractiveCommandHandler.cs +++ b/roslyn/src/EditorFeatures/Core/Interactive/CommandHandlers/ExecuteInInteractiveCommandHandler.cs @@ -45,8 +45,7 @@ private readonly IEnumerable< private Lazy GetCommandHandler(ITextBuffer textBuffer) { return _executeInInteractiveHandlers - .Where( - handler => handler.Metadata.ContentTypes.Any(textBuffer.ContentType.IsOfType) + .Where(handler => handler.Metadata.ContentTypes.Any(textBuffer.ContentType.IsOfType) ) .SingleOrDefault(); } diff --git a/roslyn/src/EditorFeatures/Core/Shared/Extensions/IProjectionBufferFactoryServiceExtensions.cs b/roslyn/src/EditorFeatures/Core/Shared/Extensions/IProjectionBufferFactoryServiceExtensions.cs index df77fe60046..247452bd747 100644 --- a/roslyn/src/EditorFeatures/Core/Shared/Extensions/IProjectionBufferFactoryServiceExtensions.cs +++ b/roslyn/src/EditorFeatures/Core/Shared/Extensions/IProjectionBufferFactoryServiceExtensions.cs @@ -62,8 +62,7 @@ IEnumerable exposedSpans var buffer = spans.First().Snapshot.TextBuffer; var currentSnapshot = buffer.CurrentSnapshot; spans = new NormalizedSnapshotSpanCollection( - spans.Select( - s => s.TranslateTo(currentSnapshot, SpanTrackingMode.EdgeExclusive) + spans.Select(s => s.TranslateTo(currentSnapshot, SpanTrackingMode.EdgeExclusive) ) ); } diff --git a/roslyn/src/EditorFeatures/Core/Shared/Utilities/LinkedEditsTracker.cs b/roslyn/src/EditorFeatures/Core/Shared/Utilities/LinkedEditsTracker.cs index 39509f535dd..5738e74b305 100644 --- a/roslyn/src/EditorFeatures/Core/Shared/Utilities/LinkedEditsTracker.cs +++ b/roslyn/src/EditorFeatures/Core/Shared/Utilities/LinkedEditsTracker.cs @@ -53,13 +53,12 @@ public void AddSpans(IEnumerable spans) public void AddSpans(NormalizedSnapshotSpanCollection snapshotSpanCollection) { // TODO: custom tracking spans! - var newTrackingSpans = snapshotSpanCollection.Select( - ss => - ss.Snapshot.CreateTrackingSpan( - ss, - SpanTrackingMode.EdgeInclusive, - TrackingFidelityMode.Forward - ) + var newTrackingSpans = snapshotSpanCollection.Select(ss => + ss.Snapshot.CreateTrackingSpan( + ss, + SpanTrackingMode.EdgeInclusive, + TrackingFidelityMode.Forward + ) ); AddSpans(newTrackingSpans); } @@ -112,8 +111,7 @@ public bool TryGetTextChanged( from trackingSpan in _trackingSpans let mappedSpan = trackingSpan.GetSpan(args.After) where - intersection.All( - intersectionSpan => mappedSpan.IntersectsWith(intersectionSpan) + intersection.All(intersectionSpan => mappedSpan.IntersectsWith(intersectionSpan) ) select trackingSpan; diff --git a/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs b/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs index 83a0892d2c3..2c66801cb84 100644 --- a/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs +++ b/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs @@ -356,8 +356,8 @@ private void ResumeIfVisible() private ITaggerEventSource CreateEventSource() { Contract.ThrowIfTrue( - _dataSource.Options.Any( - o => o is not Option2 and not PerLanguageOption2 + _dataSource.Options.Any(o => + o is not Option2 and not PerLanguageOption2 ), "All options must be Option2 or PerLanguageOption2" ); @@ -368,12 +368,11 @@ private ITaggerEventSource CreateEventSource() // notifications for when those options change. var optionChangedEventSources = _dataSource .Options.Concat(_dataSource.FeatureOptions) - .Select( - globalOption => - TaggerEventSources.OnGlobalOptionChanged( - _dataSource.GlobalOptions, - globalOption - ) + .Select(globalOption => + TaggerEventSources.OnGlobalOptionChanged( + _dataSource.GlobalOptions, + globalOption + ) ) .ToList(); diff --git a/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs b/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs index 97cd144bf03..1afcb52d86b 100644 --- a/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs +++ b/roslyn/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource_ProduceTags.cs @@ -175,8 +175,8 @@ private void RemoveTagsThatIntersectEdit(TextContentChangedEventArgs e) var snapshot = e.After; - var tagsToRemove = e.Changes.SelectMany( - c => treeForBuffer.GetIntersectingSpans(new SnapshotSpan(snapshot, c.NewSpan)) + var tagsToRemove = e.Changes.SelectMany(c => + treeForBuffer.GetIntersectingSpans(new SnapshotSpan(snapshot, c.NewSpan)) ); if (!tagsToRemove.Any()) return; @@ -531,10 +531,9 @@ private bool ShouldSkipTagProduction() var languageName = _subjectBuffer.GetLanguageName(); return _dataSource .Options.OfType>() - .Any( - option => - languageName == null - || !_dataSource.GlobalOptions.GetOption(option, languageName) + .Any(option => + languageName == null + || !_dataSource.GlobalOptions.GetOption(option, languageName) ); } diff --git a/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/ChangeSignatureTestState.cs b/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/ChangeSignatureTestState.cs index c69356b0a84..32e05dcda15 100644 --- a/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/ChangeSignatureTestState.cs +++ b/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/ChangeSignature/ChangeSignatureTestState.cs @@ -98,7 +98,9 @@ public TestChangeSignatureOptionsService TestChangeSignatureOptionsService get { return (TestChangeSignatureOptionsService) - InvocationDocument.Project.Solution.Services.GetRequiredService(); + InvocationDocument.Project.Solution.Services.GetRequiredService( + + ); } } diff --git a/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionAllCodeTests.cs b/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionAllCodeTests.cs index f50d78c85cc..1e0b800e543 100644 --- a/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionAllCodeTests.cs +++ b/roslyn/src/EditorFeatures/DiagnosticsTestUtilities/Diagnostics/AbstractSuppressionAllCodeTests.cs @@ -186,8 +186,8 @@ private static CodeAction GetFix(IEnumerable fixes, bool pragma) { if (pragma) { - return fixes.FirstOrDefault( - f => f is AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction + return fixes.FirstOrDefault(f => + f is AbstractSuppressionCodeFixProvider.PragmaWarningCodeAction ); } diff --git a/roslyn/src/EditorFeatures/Test/AssemblyReferenceTests.cs b/roslyn/src/EditorFeatures/Test/AssemblyReferenceTests.cs index 71b90500550..3b12534b598 100644 --- a/roslyn/src/EditorFeatures/Test/AssemblyReferenceTests.cs +++ b/roslyn/src/EditorFeatures/Test/AssemblyReferenceTests.cs @@ -34,8 +34,8 @@ public void TestNoReferenceToImagingInterop() typeof(Microsoft.CodeAnalysis.Editor.Shared.Extensions.GlyphExtensions).Assembly; var dependencies = editorsFeatureAssembly.GetReferencedAssemblies(); Assert.Empty( - dependencies.Where( - a => a.FullName.Contains("Microsoft.VisualStudio.Imaging.Interop") + dependencies.Where(a => + a.FullName.Contains("Microsoft.VisualStudio.Imaging.Interop") ) ); } diff --git a/roslyn/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs b/roslyn/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs index d25df67a6b3..3e679a5beb3 100644 --- a/roslyn/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs +++ b/roslyn/src/EditorFeatures/Test/CodeFixes/CodeFixServiceTests.cs @@ -549,13 +549,13 @@ IErrorLoggerService errorLogger string code = "class Program { }" ) { - var fixers = codefixers.Select( - codefix => - new Lazy( - () => throwExceptionInFixerCreation ? throw new Exception() : codefix, - new CodeChangeProviderMetadata("Test", languages: LanguageNames.CSharp) - ) - ); + var fixers = codefixers.Select(codefix => new Lazy< + CodeFixProvider, + CodeChangeProviderMetadata + >( + () => throwExceptionInFixerCreation ? throw new Exception() : codefix, + new CodeChangeProviderMetadata("Test", languages: LanguageNames.CSharp) + )); var workspace = TestWorkspace.CreateCSharp( code, @@ -1060,8 +1060,8 @@ MockAnalyzerReference.MockDiagnosticAnalyzer diagnosticAnalyzer await GetNuGetAndVsixCodeFixersCoreAsync(nugetFixer, vsixFixer, diagnosticAnalyzer) ).SelectMany(fixCollection => fixCollection.Fixes); - var nugetFixerRegisteredActions = fixes.Where( - f => f.Action.Title == nameof(NuGetCodeFixProvider) + var nugetFixerRegisteredActions = fixes.Where(f => + f.Action.Title == nameof(NuGetCodeFixProvider) ); var actualDiagnosticIdsWithRegisteredCodeActionsByNuGetFixer = nugetFixerRegisteredActions.SelectMany(a => a.Diagnostics).Select(d => d.Id); @@ -1071,8 +1071,8 @@ await GetNuGetAndVsixCodeFixersCoreAsync(nugetFixer, vsixFixer, diagnosticAnalyz ) ); - var vsixFixerRegisteredActions = fixes.Where( - f => f.Action.Title == nameof(VsixCodeFixProvider) + var vsixFixerRegisteredActions = fixes.Where(f => + f.Action.Title == nameof(VsixCodeFixProvider) ); var actualDiagnosticIdsWithRegisteredCodeActionsByVsixFixer = vsixFixerRegisteredActions .SelectMany(a => a.Diagnostics) @@ -1187,8 +1187,8 @@ string name public override Task RegisterCodeFixesAsync(CodeFixContext context) { - var fixableDiagnostics = context.Diagnostics.WhereAsArray( - d => FixableDiagnosticIds.Contains(d.Id) + var fixableDiagnostics = context.Diagnostics.WhereAsArray(d => + FixableDiagnosticIds.Contains(d.Id) ); context.RegisterCodeFix( CodeAction.Create(_name, ct => Task.FromResult(context.Document)), diff --git a/roslyn/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.cs b/roslyn/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.cs index e2952284b11..94575609998 100644 --- a/roslyn/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.cs +++ b/roslyn/src/EditorFeatures/Test/CodeGeneration/CodeGenerationTests.cs @@ -238,17 +238,16 @@ internal static async Task TestAddOperatorsAsync( var parameterSymbols = GetParameterSymbols(parameters, testContext); var parsedStatements = testContext.ParseStatements(statements); - var methods = operatorKinds.Select( - kind => - CodeGenerationSymbolFactory.CreateOperatorSymbol( - attributes: default, - accessibility, - modifiers, - GetTypeSymbol(returnType)(testContext.SemanticModel), - kind, - parameterSymbols, - parsedStatements - ) + var methods = operatorKinds.Select(kind => + CodeGenerationSymbolFactory.CreateOperatorSymbol( + attributes: default, + accessibility, + modifiers, + GetTypeSymbol(returnType)(testContext.SemanticModel), + kind, + parameterSymbols, + parsedStatements + ) ); testContext.Result = await testContext.Service.AddMembersAsync( diff --git a/roslyn/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs b/roslyn/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs index fd0830bf500..110d38b9d42 100644 --- a/roslyn/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs +++ b/roslyn/src/EditorFeatures/Test/CodeRefactorings/CodeRefactoringServiceTest.cs @@ -63,10 +63,8 @@ public async Task TestProjectRefactoringAsync() CancellationToken.None ); - var stubRefactoringAction = refactorings.Single( - refactoring => - refactoring.CodeActions.FirstOrDefault().action?.Title - == nameof(StubRefactoring) + var stubRefactoringAction = refactorings.Single(refactoring => + refactoring.CodeActions.FirstOrDefault().action?.Title == nameof(StubRefactoring) ); Assert.True(stubRefactoringAction is object); } @@ -232,8 +230,7 @@ public async Task TestAdditionalDocumentRefactoringAsync() .Project; // Verify available refactorings for .txt additional document - var txtAdditionalDocument = project.AdditionalDocuments.Single( - t => t.Name == "test.txt" + var txtAdditionalDocument = project.AdditionalDocuments.Single(t => t.Name == "test.txt" ); var txtRefactorings = await refactoringService.GetRefactoringsAsync( txtAdditionalDocument, @@ -269,8 +266,7 @@ public async Task TestAdditionalDocumentRefactoringAsync() ); // Verify available refactorings for .log additional document - var logAdditionalDocument = project.AdditionalDocuments.Single( - t => t.Name == "test.log" + var logAdditionalDocument = project.AdditionalDocuments.Single(t => t.Name == "test.log" ); var logRefactorings = await refactoringService.GetRefactoringsAsync( logAdditionalDocument, @@ -318,8 +314,7 @@ public async Task TestAnalyzerConfigDocumentRefactoringAsync() .Project; // Verify available refactorings for .editorconfig document - var editorConfig = project.AnalyzerConfigDocuments.Single( - t => t.Name == ".editorconfig" + var editorConfig = project.AnalyzerConfigDocuments.Single(t => t.Name == ".editorconfig" ); var editorConfigRefactorings = await refactoringService.GetRefactoringsAsync( editorConfig, @@ -353,8 +348,7 @@ public async Task TestAnalyzerConfigDocumentRefactoringAsync() ); // Verify available refactorings for .globalconfig document - var globalConfig = project.AnalyzerConfigDocuments.Single( - t => t.Name == ".globalconfig" + var globalConfig = project.AnalyzerConfigDocuments.Single(t => t.Name == ".globalconfig" ); var globalConfigRefactorings = await refactoringService.GetRefactoringsAsync( globalConfig, diff --git a/roslyn/src/EditorFeatures/Test/CommentSelection/CommentUncommentSelectionCommandHandlerTests.cs b/roslyn/src/EditorFeatures/Test/CommentSelection/CommentUncommentSelectionCommandHandlerTests.cs index 0cb9b2ffd37..2a25016c719 100644 --- a/roslyn/src/EditorFeatures/Test/CommentSelection/CommentUncommentSelectionCommandHandlerTests.cs +++ b/roslyn/src/EditorFeatures/Test/CommentSelection/CommentUncommentSelectionCommandHandlerTests.cs @@ -893,8 +893,9 @@ private static void CommentOrUncommentSelection( Operation operation ) { - var textUndoHistoryRegistry = - exportProvider.GetExportedValue(); + var textUndoHistoryRegistry = exportProvider.GetExportedValue( + + ); var editorOperationsFactory = exportProvider.GetExportedValue(); var editorOptionsService = exportProvider.GetExportedValue(); @@ -917,13 +918,12 @@ Operation operation AssertEx.SetEqual(expectedChanges, edits.TextChanges); var trackingSpans = edits - .TrackingSpans.Select( - textSpan => - AbstractCommentSelectionBase.CreateTrackingSpan( - edits.ResultOperation, - textView.TextBuffer.CurrentSnapshot, - textSpan.TrackingTextSpan - ) + .TrackingSpans.Select(textSpan => + AbstractCommentSelectionBase.CreateTrackingSpan( + edits.ResultOperation, + textView.TextBuffer.CurrentSnapshot, + textSpan.TrackingTextSpan + ) ) .ToList(); diff --git a/roslyn/src/EditorFeatures/Test/Completion/CompletionServiceTests.cs b/roslyn/src/EditorFeatures/Test/Completion/CompletionServiceTests.cs index 5706df418d3..13497b14f36 100644 --- a/roslyn/src/EditorFeatures/Test/Completion/CompletionServiceTests.cs +++ b/roslyn/src/EditorFeatures/Test/Completion/CompletionServiceTests.cs @@ -77,8 +77,8 @@ void Method() { Assert.NotEmpty(completions.ItemsList); var item = Assert.Single( - completions.ItemsList.Where( - item => item.ProviderName == typeof(DebugAssertTestCompletionProvider).FullName + completions.ItemsList.Where(item => + item.ProviderName == typeof(DebugAssertTestCompletionProvider).FullName ) ); Assert.Equal(nameof(DebugAssertTestCompletionProvider), item.DisplayText); diff --git a/roslyn/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs b/roslyn/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs index 589b28c8467..921ade5cfc0 100644 --- a/roslyn/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs +++ b/roslyn/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs @@ -60,7 +60,9 @@ private static AdhocWorkspace CreateWorkspace(Type[] additionalParts = null) => ); private static IGlobalOptionService GetGlobalOptions(Workspace workspace) => - workspace.Services.SolutionServices.ExportProvider.GetExportedValue(); + workspace.Services.SolutionServices.ExportProvider.GetExportedValue( + + ); private static void OpenDocumentAndMakeActive(Document document, Workspace workspace) { @@ -1021,10 +1023,9 @@ await incrementalAnalyzer.AnalyzeProjectAsync( analyzer = (AdditionalFileAnalyzer)analyzers[i]; foreach (var additionalDoc in project.AdditionalDocuments) { - var applicableDiagnostics = diagnostics.Where( - d => - d.Id == analyzer.Descriptor.Id - && d.DataLocation.UnmappedFileSpan.Path == additionalDoc.FilePath + var applicableDiagnostics = diagnostics.Where(d => + d.Id == analyzer.Descriptor.Id + && d.DataLocation.UnmappedFileSpan.Path == additionalDoc.FilePath ); var text = await additionalDoc.GetTextAsync(); @@ -1311,8 +1312,8 @@ void M() foreach (var e in eCollection) { diagnostics.AddRange( - e.Diagnostics.Where( - d => d.Id == IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId + e.Diagnostics.Where(d => + d.Id == IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId ) .OrderBy(d => d.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text)) ); @@ -1805,8 +1806,8 @@ TestHost testHost ); var globalOptions = workspace.GetService(); - var generator = new DiagnosticProducingGenerator( - c => Location.Create(c.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10)) + var generator = new DiagnosticProducingGenerator(c => + Location.Create(c.Compilation.SyntaxTrees.Single(), new TextSpan(0, 10)) ); Assert.True( workspace.TryApplyChanges( @@ -2003,29 +2004,26 @@ private class Analyzer : DiagnosticAnalyzer public override void Initialize(AnalysisContext context) { - context.RegisterSyntaxTreeAction( - c => - c.ReportDiagnostic( - Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) - ) + context.RegisterSyntaxTreeAction(c => + c.ReportDiagnostic( + Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) + ) ); - context.RegisterSemanticModelAction( - c => - c.ReportDiagnostic( - Diagnostic.Create( - s_semanticRule, - c.SemanticModel.SyntaxTree.GetRoot().GetLocation() - ) + context.RegisterSemanticModelAction(c => + c.ReportDiagnostic( + Diagnostic.Create( + s_semanticRule, + c.SemanticModel.SyntaxTree.GetRoot().GetLocation() ) + ) ); - context.RegisterCompilationAction( - c => - c.ReportDiagnostic( - Diagnostic.Create( - s_compilationRule, - c.Compilation.SyntaxTrees.First().GetRoot().GetLocation() - ) + context.RegisterCompilationAction(c => + c.ReportDiagnostic( + Diagnostic.Create( + s_compilationRule, + c.Compilation.SyntaxTrees.First().GetRoot().GetLocation() ) + ) ); } } @@ -2063,29 +2061,26 @@ private class DisabledByDefaultAnalyzer : DiagnosticAnalyzer public override void Initialize(AnalysisContext context) { - context.RegisterSyntaxTreeAction( - c => - c.ReportDiagnostic( - Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) - ) + context.RegisterSyntaxTreeAction(c => + c.ReportDiagnostic( + Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) + ) ); - context.RegisterSemanticModelAction( - c => - c.ReportDiagnostic( - Diagnostic.Create( - s_semanticRule, - c.SemanticModel.SyntaxTree.GetRoot().GetLocation() - ) + context.RegisterSemanticModelAction(c => + c.ReportDiagnostic( + Diagnostic.Create( + s_semanticRule, + c.SemanticModel.SyntaxTree.GetRoot().GetLocation() ) + ) ); - context.RegisterCompilationAction( - c => - c.ReportDiagnostic( - Diagnostic.Create( - s_compilationRule, - c.Compilation.SyntaxTrees.First().GetRoot().GetLocation() - ) + context.RegisterCompilationAction(c => + c.ReportDiagnostic( + Diagnostic.Create( + s_compilationRule, + c.Compilation.SyntaxTrees.First().GetRoot().GetLocation() ) + ) ); } } @@ -2105,11 +2100,10 @@ private class OpenFileOnlyAnalyzer : DiagnosticAnalyzer, IBuiltInAnalyzer ImmutableArray.Create(s_syntaxRule); public override void Initialize(AnalysisContext context) => - context.RegisterSyntaxTreeAction( - c => - c.ReportDiagnostic( - Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) - ) + context.RegisterSyntaxTreeAction(c => + c.ReportDiagnostic( + Diagnostic.Create(s_syntaxRule, c.Tree.GetRoot().GetLocation()) + ) ); public DiagnosticAnalyzerCategory GetAnalyzerCategory() => diff --git a/roslyn/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs b/roslyn/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs index 6ee2b365863..08cabcb35ed 100644 --- a/roslyn/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs +++ b/roslyn/src/EditorFeatures/Test/EditAndContinue/ActiveStatementsMapTests.cs @@ -283,8 +283,8 @@ string fileName "[127..131) -> (5,0)-(5,4) #4", "[134..138) -> (6,0)-(6,4) #1" }, - oldSpans.Select( - s => $"{s.UnmappedSpan} -> {s.Statement.Span} #{s.Statement.Ordinal}" + oldSpans.Select(s => + $"{s.UnmappedSpan} -> {s.Statement.Span} #{s.Statement.Ordinal}" ) ); } diff --git a/roslyn/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs b/roslyn/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs index e76afab0234..53efe99d02d 100644 --- a/roslyn/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs +++ b/roslyn/src/EditorFeatures/Test/EditAndContinue/EditSessionActiveStatementsTests.cs @@ -316,8 +316,8 @@ static void Main() AssertEx.Equal( new[] { $"[{document1.FilePath}: (4,8)-(4,46)]", "[]", }, - oldActiveStatements1.Select( - s => "[" + string.Join(", ", s.ExceptionRegions.Spans) + "]" + oldActiveStatements1.Select(s => + "[" + string.Join(", ", s.ExceptionRegions.Spans) + "]" ) ); @@ -331,8 +331,8 @@ static void Main() "[]", $"[{document2.FilePath}: (26,35)-(26,46)]", }, - oldActiveStatements2.Select( - s => "[" + string.Join(", ", s.ExceptionRegions.Spans) + "]" + oldActiveStatements2.Select(s => + "[" + string.Join(", ", s.ExceptionRegions.Spans) + "]" ) ); @@ -351,8 +351,8 @@ static void Main() statements[4] ), newExceptionRegions: ImmutableArray.Create( - oldActiveStatements2[0].ExceptionRegions.Spans.SelectAsArray( - es => es.AddLineDelta(+1) + oldActiveStatements2[0].ExceptionRegions.Spans.SelectAsArray(es => + es.AddLineDelta(+1) ), oldActiveStatements2[1].ExceptionRegions.Spans, oldActiveStatements2[2].ExceptionRegions.Spans @@ -383,8 +383,8 @@ out var exceptionRegionUpdates $"0x06000003 v1 | AS {document2.FilePath}: (21,14)-(21,24) => (21,14)-(21,24)", $"0x06000005 v1 | AS {document2.FilePath}: (26,20)-(26,25) => (26,20)-(26,25)" }, - nonRemappableRegions.Select( - r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" + nonRemappableRegions.Select(r => + $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" ) ); @@ -482,16 +482,15 @@ static void F2() // Note that the spans correspond to the base snapshot (V2). AssertEx.Equal( new[] { $"[{document.FilePath}: (8,8)-(12,9) 'catch (Exception) {{']", "[]", }, - oldActiveStatements.Select( - s => - "[" - + string.Join( - ", ", - s.ExceptionRegions.Spans.Select( - span => $"{span} '{GetFirstLineText(span.Span, baseText)}'" - ) + oldActiveStatements.Select(s => + "[" + + string.Join( + ", ", + s.ExceptionRegions.Spans.Select(span => + $"{span} '{GetFirstLineText(span.Span, baseText)}'" ) - + "]" + ) + + "]" ) ); @@ -536,8 +535,8 @@ out var exceptionRegionUpdates }, nonRemappableRegions .OrderBy(r => r.Region.OldSpan.Span.Start.Line) - .Select( - r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" + .Select(r => + $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" ) ); @@ -548,9 +547,8 @@ out var exceptionRegionUpdates AssertEx.Equal( new[] { "0x06000001 v1 IL_0000: (6,18)-(6,23) 'F2();'" }, - activeStatementsInUpdatedMethods.Select( - update => - $"{InspectActiveStatementUpdate(update)} '{GetFirstLineText(update.NewSpan.ToLinePositionSpan(), updatedText)}'" + activeStatementsInUpdatedMethods.Select(update => + $"{InspectActiveStatementUpdate(update)} '{GetFirstLineText(update.NewSpan.ToLinePositionSpan(), updatedText)}'" ) ); } @@ -750,8 +748,8 @@ static void F4() $"2: {document.FilePath}: (29,22)-(29,26) flags=[NonLeafFrame] mvid=11111111-1111-1111-1111-111111111111 0x06000003 v1 IL_0000 '{{ M();'", $"3: {document.FilePath}: (53,22)-(53,26) flags=[NonLeafFrame] mvid=11111111-1111-1111-1111-111111111111 0x06000004 v1 IL_0000 'M();'" }, - baseActiveStatements.Select( - s => InspectActiveStatementAndInstruction(s, sourceTextV2) + baseActiveStatements.Select(s => + InspectActiveStatementAndInstruction(s, sourceTextV2) ) ); @@ -773,16 +771,15 @@ static void F4() $"[{document.FilePath}: (38,16)-(40,9) 'catch', {document.FilePath}: (34,20)-(36,13) 'finally']", $"[{document.FilePath}: (56,16)-(58,9) 'catch', {document.FilePath}: (51,20)-(54,13) 'catch']", }, - oldActiveStatements.Select( - s => - "[" - + string.Join( - ", ", - s.ExceptionRegions.Spans.Select( - span => $"{span} '{GetFirstLineText(span.Span, sourceTextV2)}'" - ) + oldActiveStatements.Select(s => + "[" + + string.Join( + ", ", + s.ExceptionRegions.Spans.Select(span => + $"{span} '{GetFirstLineText(span.Span, sourceTextV2)}'" ) - + "]" + ) + + "]" ) ); @@ -806,12 +803,12 @@ static void F4() ), newExceptionRegions: ImmutableArray.Create( oldActiveStatements[0].ExceptionRegions.Spans, - oldActiveStatements[1].ExceptionRegions.Spans.SelectAsArray( - es => es.AddLineDelta(-1) + oldActiveStatements[1].ExceptionRegions.Spans.SelectAsArray(es => + es.AddLineDelta(-1) ), oldActiveStatements[2].ExceptionRegions.Spans, - oldActiveStatements[3].ExceptionRegions.Spans.SelectAsArray( - es => es.AddLineDelta(+2) + oldActiveStatements[3].ExceptionRegions.Spans.SelectAsArray(es => + es.AddLineDelta(+2) ) ) ) @@ -844,8 +841,8 @@ out var exceptionRegionUpdates }, nonRemappableRegions .OrderBy(r => r.Region.OldSpan.Span.Start.Line) - .Select( - r => $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" + .Select(r => + $"{r.Method.GetDebuggerDisplay()} | {r.Region.GetDebuggerDisplay()}" ) ); @@ -869,9 +866,8 @@ out var exceptionRegionUpdates $"0x06000002 v2 IL_0000: (19,18)-(19,22) 'M();'", $"0x06000004 v1 IL_0000: (55,22)-(55,26) 'M();'" }, - activeStatementsInUpdatedMethods.Select( - update => - $"{InspectActiveStatementUpdate(update)} '{GetFirstLineText(update.NewSpan.ToLinePositionSpan(), sourceTextV3)}'" + activeStatementsInUpdatedMethods.Select(update => + $"{InspectActiveStatementUpdate(update)} '{GetFirstLineText(update.NewSpan.ToLinePositionSpan(), sourceTextV3)}'" ) ); } @@ -975,8 +971,8 @@ static void F() AssertEx.Equal( new[] { $"[{document.FilePath}: (8,8)-(10,9)]", "[]" }, - oldActiveStatements.Select( - s => "[" + string.Join(",", s.ExceptionRegions.Spans) + "]" + oldActiveStatements.Select(s => + "[" + string.Join(",", s.ExceptionRegions.Spans) + "]" ) ); } diff --git a/roslyn/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs b/roslyn/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs index d1355b412b1..4fb3ddfd7be 100644 --- a/roslyn/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs +++ b/roslyn/src/EditorFeatures/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs @@ -222,11 +222,10 @@ ImmutableArray args localWorkspace.CurrentSolution, debuggerService: new MockManagedEditAndContinueDebuggerService() { - IsEditAndContinueAvailable = _ => - new ManagedHotReloadAvailability( - ManagedHotReloadAvailabilityStatus.NotAllowedForModule, - "can't do enc" - ), + IsEditAndContinueAvailable = _ => new ManagedHotReloadAvailability( + ManagedHotReloadAvailabilityStatus.NotAllowedForModule, + "can't do enc" + ), GetActiveStatementsImpl = () => ImmutableArray.Create(as1) }, sourceTextProvider: NullPdbMatchingSourceTextProvider.Instance, diff --git a/roslyn/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs b/roslyn/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs index 058ecacefdf..150e7c5cfc5 100644 --- a/roslyn/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs +++ b/roslyn/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs @@ -149,8 +149,9 @@ public async Task TestPreviewServices() using var previewWorkspace = new PreviewWorkspace( EditorTestCompositions.EditorFeatures.GetHostServices() ); - var service = - previewWorkspace.Services.GetService(); + var service = previewWorkspace.Services.GetService( + + ); var registrationService = Assert.IsType(service); Assert.False(registrationService.Register(previewWorkspace)); @@ -259,13 +260,13 @@ public async Task TestPreviewDiagnosticTaggerInPreviewPane() // set up tagger for both buffers var leftBuffer = diffView - .Viewer.LeftView.BufferGraph.GetTextBuffers( - t => t.ContentType.IsOfType(ContentTypeNames.CSharpContentType) + .Viewer.LeftView.BufferGraph.GetTextBuffers(t => + t.ContentType.IsOfType(ContentTypeNames.CSharpContentType) ) .First(); var rightBuffer = diffView - .Viewer.RightView.BufferGraph.GetTextBuffers( - t => t.ContentType.IsOfType(ContentTypeNames.CSharpContentType) + .Viewer.RightView.BufferGraph.GetTextBuffers(t => + t.ContentType.IsOfType(ContentTypeNames.CSharpContentType) ) .First(); diff --git a/roslyn/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs b/roslyn/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs index 287cb14bf21..fca08cfc653 100644 --- a/roslyn/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs +++ b/roslyn/src/EditorFeatures/Test/SolutionCrawler/WorkCoordinatorTests.cs @@ -2078,7 +2078,9 @@ public async Task FileFromSameProjectTogetherTest() // block solution cralwer from processing. var globalOperation = - workspace.Services.SolutionServices.ExportProvider.GetExportedValue(); + workspace.Services.SolutionServices.ExportProvider.GetExportedValue( + + ); using (var operation = globalOperation.Start("Block SolutionCrawler")) { // make sure global operaiton is actually started @@ -2104,17 +2106,15 @@ public async Task FileFromSameProjectTogetherTest() // // since asyncToken doesn't distinguish whether (1) certain event is happened but all processed or (2) it never happened yet, // to check (1), we must wait for first item, and then wait for all items to be processed. - await crawlerListener.WaitUntilConditionIsMetAsync( - pendingTokens => - pendingTokens.Any( - token => - token.Tag == (object)SolutionCrawlerRegistrationService.EnqueueItem - ) + await crawlerListener.WaitUntilConditionIsMetAsync(pendingTokens => + pendingTokens.Any(token => + token.Tag == (object)SolutionCrawlerRegistrationService.EnqueueItem + ) ); // and then wait them to be processed - await crawlerListener.WaitUntilConditionIsMetAsync( - pendingTokens => pendingTokens.Where(token => token.Tag == workspace).IsEmpty() + await crawlerListener.WaitUntilConditionIsMetAsync(pendingTokens => + pendingTokens.Where(token => token.Tag == workspace).IsEmpty() ); } @@ -2456,7 +2456,9 @@ public static WorkCoordinatorWorkspace CreateWithAnalysisScope( ); var globalOptions = - workspace.Services.SolutionServices.ExportProvider.GetExportedValue(); + workspace.Services.SolutionServices.ExportProvider.GetExportedValue( + + ); globalOptions.SetGlobalOption( SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp, diff --git a/roslyn/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs b/roslyn/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs index b62795324d2..ecf8633fe69 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/AbstractCommandHandlerTestState.cs @@ -86,8 +86,8 @@ public AbstractCommandHandlerTestState( } else { - var cursorDocument = Workspace.Documents.First( - d => d.CursorPosition.HasValue || d.SelectedSpans.Any(ss => ss.IsEmpty) + var cursorDocument = Workspace.Documents.First(d => + d.CursorPosition.HasValue || d.SelectedSpans.Any(ss => ss.IsEmpty) ); _textView = cursorDocument.GetTextView(); _subjectBuffer = cursorDocument.GetTextBuffer(); diff --git a/roslyn/src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs b/roslyn/src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs index d4398e33119..068502c3485 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/ChangeSignature/TestChangeSignatureOptionsService.cs @@ -38,11 +38,10 @@ ParameterConfiguration parameters var updateParameters = UpdatedSignature != null ? UpdatedSignature - .Select( - item => - item.IsExisting - ? list[item.OldIndex ?? -1] - : item.GetAddedParameter(document) + .Select(item => + item.IsExisting + ? list[item.OldIndex ?? -1] + : item.GetAddedParameter(document) ) .ToImmutableArray() : new ImmutableArray(); diff --git a/roslyn/src/EditorFeatures/TestUtilities/CommentSelection/AbstractToggleCommentTestBase.cs b/roslyn/src/EditorFeatures/TestUtilities/CommentSelection/AbstractToggleCommentTestBase.cs index efe98a47c53..fa144f3eab6 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/CommentSelection/AbstractToggleCommentTestBase.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/CommentSelection/AbstractToggleCommentTestBase.cs @@ -132,8 +132,8 @@ out var expectedSpans { AssertEx.Equal( expectedSpans, - textView.Selection.SelectedSpans.Select( - snapshotSpan => TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End) + textView.Selection.SelectedSpans.Select(snapshotSpan => + TextSpan.FromBounds(snapshotSpan.Start, snapshotSpan.End) ) ); } diff --git a/roslyn/src/EditorFeatures/TestUtilities/Completion/AbstractArgumentProviderTests`1.cs b/roslyn/src/EditorFeatures/TestUtilities/Completion/AbstractArgumentProviderTests`1.cs index 9d7e5a0312a..1a03d0ff010 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Completion/AbstractArgumentProviderTests`1.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Completion/AbstractArgumentProviderTests`1.cs @@ -141,9 +141,8 @@ CancellationToken cancellationToken var index = arguments.Any() ? arguments.IndexOf( - arguments.Single( - argument => - argument.FullSpan.Start <= position && argument.FullSpan.End >= position + arguments.Single(argument => + argument.FullSpan.Start <= position && argument.FullSpan.End >= position ) ) : 0; diff --git a/roslyn/src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs b/roslyn/src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs index 075095de276..56e93902dde 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Diagnostics/TestAnalyzerReferenceByLanguage.cs @@ -48,13 +48,10 @@ IEnumerable analyzers ) { var newAnalyzersMap = ImmutableDictionary.CreateRange( - _analyzersMap.Select( - kvp => - new KeyValuePair>( - kvp.Key, - kvp.Key == language ? kvp.Value.AddRange(analyzers) : kvp.Value - ) - ) + _analyzersMap.Select(kvp => new KeyValuePair< + string, + ImmutableArray + >(kvp.Key, kvp.Key == language ? kvp.Value.AddRange(analyzers) : kvp.Value)) ); return new(newAnalyzersMap); } diff --git a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs index ed7183daf9e..b0430892af7 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/ActiveStatementsDescription.cs @@ -62,11 +62,10 @@ public ActiveStatementsDescription( e => e.Value.OrderBy(ActiveStatementsMap.Comparer).ToImmutableArray() ), instructionMap: OldStatements.ToDictionary( - s => - new ManagedInstructionId( - new ManagedMethodId(Guid.NewGuid(), 0x060000001, version: 1), - ilOffset: 0 - ), + s => new ManagedInstructionId( + new ManagedMethodId(Guid.NewGuid(), 0x060000001, version: 1), + ilOffset: 0 + ), s => s.Statement ) ); @@ -107,8 +106,8 @@ public ActiveStatementsDescription( newMappedSpans[ordinal] = newTree.GetMappedLineSpan(unmappedSpan); newMappedRegions[ordinal] = (ordinal < newExceptionRegionMarkers.Length) - ? newExceptionRegionMarkers[ordinal].SelectAsArray( - span => (SourceFileSpan)newTree.GetMappedLineSpan(span) + ? newExceptionRegionMarkers[ordinal].SelectAsArray(span => + (SourceFileSpan)newTree.GetMappedLineSpan(span) ) : ImmutableArray.Empty; } @@ -234,31 +233,28 @@ internal static ImmutableArray GetActiveStateme return activeStatements .Select(s => s.Statement) - .SelectAsArray( - statement => - new ManagedActiveStatementDebugInfo( - new ManagedInstructionId( - new ManagedMethodId( - (modules != null) ? modules[statement.Ordinal] : moduleId, - new ManagedModuleMethodId( - token: 0x06000000 - | ( - methodRowIds != null - ? methodRowIds[statement.Ordinal] - : statement.Ordinal + 1 - ), - version: (methodVersions != null) - ? methodVersions[statement.Ordinal] - : 1 - ) - ), - ilOffset: (ilOffsets != null) ? ilOffsets[statement.Ordinal] : 0 - ), - documentName: statement.FilePath, - sourceSpan: statement.Span.ToSourceSpan(), - flags: statement.Flags - ) - ); + .SelectAsArray(statement => new ManagedActiveStatementDebugInfo( + new ManagedInstructionId( + new ManagedMethodId( + (modules != null) ? modules[statement.Ordinal] : moduleId, + new ManagedModuleMethodId( + token: 0x06000000 + | ( + methodRowIds != null + ? methodRowIds[statement.Ordinal] + : statement.Ordinal + 1 + ), + version: (methodVersions != null) + ? methodVersions[statement.Ordinal] + : 1 + ) + ), + ilOffset: (ilOffsets != null) ? ilOffsets[statement.Ordinal] : 0 + ), + documentName: statement.FilePath, + sourceSpan: statement.Span.ToSourceSpan(), + flags: statement.Flags + )); } } } diff --git a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs index 32ab90edc1b..cde272f4a54 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/EditAndContinueTestHelpers.cs @@ -402,13 +402,11 @@ SymbolKey CreateSymbolKey(SemanticEditDescription edit) => // string comparison to simplify understanding why a test failed: AssertEx.Equal( - expectedSemanticEdits.Select( - e => - $"{e.Kind}: {e.SymbolProvider((e.Kind == SemanticEditKind.Delete ? oldCompilation : newCompilation))}" + expectedSemanticEdits.Select(e => + $"{e.Kind}: {e.SymbolProvider((e.Kind == SemanticEditKind.Delete ? oldCompilation : newCompilation))}" ), - actualSemanticEdits.Select( - e => - $"{e.Kind}: {e.Symbol.Resolve(e.Kind == SemanticEditKind.Delete ? oldCompilation : newCompilation).Symbol}" + actualSemanticEdits.Select(e => + $"{e.Kind}: {e.Symbol.Resolve(e.Kind == SemanticEditKind.Delete ? oldCompilation : newCompilation).Symbol}" ), message: message ); @@ -676,20 +674,11 @@ IEnumerable> matches matches .OrderBy(partners => partners.Key.GetLocation().SourceSpan.Start) .ThenByDescending(partners => partners.Key.Span.Length) - .Select( - partners => - new MatchingPair - { - Old = partners - .Key.ToString() - .Replace("\r\n", " ") - .Replace("\n", " "), - New = partners - .Value.ToString() - .Replace("\r\n", " ") - .Replace("\n", " ") - } - ) + .Select(partners => new MatchingPair + { + Old = partners.Key.ToString().Replace("\r\n", " ").Replace("\n", " "), + New = partners.Value.ToString().Replace("\r\n", " ").Replace("\n", " ") + }) ); } } diff --git a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs index ad15188b45a..98f033e50bf 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/EditAndContinue/RudeEditDiagnosticDescription.cs @@ -61,8 +61,8 @@ public string ToString(Func? tryGetResource) { (_squiggle != null) ? "\"" + _squiggle.Replace("\r\n", "\\r\\n") + "\"" : "null" }.Concat( - _arguments.Select( - a => tryGetResource?.Invoke(a) is { } ? $"GetResource(\"{a}\")" : $"\"{a}\"" + _arguments.Select(a => + tryGetResource?.Invoke(a) is { } ? $"GetResource(\"{a}\")" : $"\"{a}\"" ) ); diff --git a/roslyn/src/EditorFeatures/TestUtilities/Extensions/ExportProviderExtensions.cs b/roslyn/src/EditorFeatures/TestUtilities/Extensions/ExportProviderExtensions.cs index 37afa0adbe5..153f8c83e82 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Extensions/ExportProviderExtensions.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Extensions/ExportProviderExtensions.cs @@ -19,10 +19,9 @@ string name ) where TCommandHandler : ICommandHandler { - var lazyCommandHandlers = exportProvider.GetExports< - ICommandHandler, - OrderableMetadata - >(); + var lazyCommandHandlers = exportProvider.GetExports( + + ); return Assert.IsType( lazyCommandHandlers .Single(lazyCommandHandler => lazyCommandHandler.Metadata.Name == name) @@ -43,10 +42,9 @@ string contentType >(); return Assert.IsType( lazyCommandHandlers - .Single( - lazyCommandHandler => - lazyCommandHandler.Metadata.Name == name - && lazyCommandHandler.Metadata.ContentTypes.Contains(contentType) + .Single(lazyCommandHandler => + lazyCommandHandler.Metadata.Name == name + && lazyCommandHandler.Metadata.ContentTypes.Contains(contentType) ) .Value ); diff --git a/roslyn/src/EditorFeatures/TestUtilities/Formatting/CoreFormatterTestsBase.cs b/roslyn/src/EditorFeatures/TestUtilities/Formatting/CoreFormatterTestsBase.cs index 2a85d901c77..06635d9367d 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Formatting/CoreFormatterTestsBase.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Formatting/CoreFormatterTestsBase.cs @@ -107,20 +107,21 @@ bool useTabs var snapshot = textBuffer.CurrentSnapshot; var bufferGraph = new Mock(MockBehavior.Strict); bufferGraph - .Setup( - x => - x.MapUpToSnapshot( - It.IsAny(), - It.IsAny(), - It.IsAny(), - It.IsAny() - ) + .Setup(x => + x.MapUpToSnapshot( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny() + ) ) .Returns( (p, m, a, s) => { if ( - workspace.Services.GetService() + workspace.Services.GetService( + + ) is TestFormattingRuleFactoryServiceFactory.Factory factory && factory.BaseIndentation != 0 && factory.TextSpan.Contains(p.Position) diff --git a/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 4fa0b1c650e..fa2299fb264 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -105,14 +105,11 @@ CancellationToken cancellationToken if (document.Name == GeneratedFileName) { mappedResult = spans - .Select( - span => - new MappedSpanResult( - s_mappedFilePath, - s_mappedLinePosition, - new TextSpan(0, 5) - ) - ) + .Select(span => new MappedSpanResult( + s_mappedFilePath, + s_mappedLinePosition, + new TextSpan(0, 5) + )) .ToImmutableArray(); } @@ -657,13 +654,12 @@ public static async Task< new List() ); locationsForName.AddRange( - spans.Select( - span => - ConvertTextSpanWithTextToLocation( - span, - text, - ProtocolConversions.CreateAbsoluteUri(document.FilePath) - ) + spans.Select(span => + ConvertTextSpanWithTextToLocation( + span, + text, + ProtocolConversions.CreateAbsoluteUri(document.FilePath) + ) ) ); @@ -714,14 +710,11 @@ private static LSP.DidChangeTextDocumentParams CreateDidChangeTextDocumentParams ) { var changeEvents = changes - .Select( - change => - new LSP.TextDocumentContentChangeEvent - { - Text = change.Text, - Range = change.Range, - } - ) + .Select(change => new LSP.TextDocumentContentChangeEvent + { + Text = change.Text, + Range = change.Range, + }) .ToArray(); return new LSP.DidChangeTextDocumentParams() @@ -776,7 +769,9 @@ private TestLspServer( ClientCapabilities = clientCapabilities; _locations = locations; _codeAnalysisService = - testWorkspace.Services.GetRequiredService(); + testWorkspace.Services.GetRequiredService( + + ); LanguageServer = target; @@ -913,7 +908,9 @@ ILspServiceLogger logger var capabilitiesProvider = workspace.ExportProvider.GetExportedValue(); var servicesProvider = - workspace.ExportProvider.GetExportedValue(); + workspace.ExportProvider.GetExportedValue( + + ); var jsonRpc = new JsonRpc( new HeaderDelimitedMessageHandler( @@ -1027,24 +1024,23 @@ public Task InsertTextAsync( return ReplaceTextAsync( documentUri, changes - .Select( - change => - ( - new LSP.Range + .Select(change => + ( + new LSP.Range + { + Start = new LSP.Position { - Start = new LSP.Position - { - Line = change.Line, - Character = change.Column - }, - End = new LSP.Position - { - Line = change.Line, - Character = change.Column - } + Line = change.Line, + Character = change.Column }, - change.Text - ) + End = new LSP.Position + { + Line = change.Line, + Character = change.Column + } + }, + change.Text + ) ) .ToArray() ); @@ -1058,24 +1054,23 @@ public Task DeleteTextAsync( return ReplaceTextAsync( documentUri, changes - .Select( - change => - ( - new LSP.Range + .Select(change => + ( + new LSP.Range + { + Start = new LSP.Position { - Start = new LSP.Position - { - Line = change.StartLine, - Character = change.StartColumn - }, - End = new LSP.Position - { - Line = change.EndLine, - Character = change.EndColumn - } + Line = change.StartLine, + Character = change.StartColumn }, - string.Empty - ) + End = new LSP.Position + { + Line = change.EndLine, + Character = change.EndColumn + } + }, + string.Empty + ) ) .ToArray() ); @@ -1161,7 +1156,9 @@ public async ValueTask DisposeAsync() .Deregister(GetManagerAccessor().GetLspMiscellaneousFilesWorkspace()); var solutionCrawlerRegistrationService = (SolutionCrawlerRegistrationService) - TestWorkspace.Services.GetRequiredService(); + TestWorkspace.Services.GetRequiredService( + + ); solutionCrawlerRegistrationService.Unregister(TestWorkspace); // Some tests will manually call shutdown and exit, so attempting to call this during dispose diff --git a/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLspBuildOnlyDiagnosticsTests.cs b/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLspBuildOnlyDiagnosticsTests.cs index f01a23e1a31..41b4bef8f4c 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLspBuildOnlyDiagnosticsTests.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLspBuildOnlyDiagnosticsTests.cs @@ -26,7 +26,9 @@ public abstract class AbstractLspBuildOnlyDiagnosticsTests public void TestExportedDiagnosticIds() { var attribute = - this.LspBuildOnlyDiagnosticsType.GetCustomAttribute(); + this.LspBuildOnlyDiagnosticsType.GetCustomAttribute( + + ); var actualDiagnosticCodes = attribute.BuildOnlyDiagnostics; var missing = ExpectedDiagnosticCodes @@ -43,8 +45,8 @@ public void TestExportedDiagnosticIds() var enumMembers = ErrorCodeType.GetFields( BindingFlags.Public | BindingFlags.Static ); - var enumMember = enumMembers.First( - m => Convert.ToInt32(m.GetValue(null)) == codeValue + var enumMember = enumMembers.First(m => + Convert.ToInt32(m.GetValue(null)) == codeValue ); errorMessage.AppendLine( diff --git a/roslyn/src/EditorFeatures/TestUtilities/Semantics/SpeculationAnalyzerTestsBase.cs b/roslyn/src/EditorFeatures/TestUtilities/Semantics/SpeculationAnalyzerTestsBase.cs index 9d11b062d6d..4425c2d4013 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Semantics/SpeculationAnalyzerTestsBase.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Semantics/SpeculationAnalyzerTestsBase.cs @@ -42,20 +42,18 @@ protected void Test( var initialNode = initialTree .GetRoot() .DescendantNodes() - .First( - n => - IsExpressionNode(n) - && n.ToString() == (expressionToAnalyze ?? initialExpression) + .First(n => + IsExpressionNode(n) + && n.ToString() == (expressionToAnalyze ?? initialExpression) ); var replacementTree = Parse(UnderTestRegex.Replace(code, replacementExpression)); var replacementNode = replacementTree .GetRoot() .DescendantNodes() - .First( - n => - IsExpressionNode(n) - && n.ToString() == (expressionToAnalyze ?? replacementExpression) + .First(n => + IsExpressionNode(n) + && n.ToString() == (expressionToAnalyze ?? replacementExpression) ); var initialCompilation = CreateCompilation(initialTree); diff --git a/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs b/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs index b679b785ebb..b5fcfadffa2 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace.cs @@ -301,15 +301,12 @@ public TServiceInterface GetService(string contentType) public TServiceInterface GetService(string contentType, string name) { - var values = ExportProvider.GetExports< - TServiceInterface, - OrderableContentTypeMetadata - >(); + var values = ExportProvider.GetExports( + + ); return values - .Single( - value => - value.Metadata.Name == name - && value.Metadata.ContentTypes.Contains(contentType) + .Single(value => + value.Metadata.Name == name && value.Metadata.ContentTypes.Contains(contentType) ) .Value; } @@ -673,8 +670,8 @@ out var markupSpans } // Find and insert the span from the corresponding document - var documentWithSpan = baseDocuments.FirstOrDefault( - d => d.AnnotatedSpans.ContainsKey(spanName) + var documentWithSpan = baseDocuments.FirstOrDefault(d => + d.AnnotatedSpans.ContainsKey(spanName) ); if (documentWithSpan == null) { diff --git a/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs b/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs index ac0988abb46..b854b13832e 100644 --- a/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs +++ b/roslyn/src/EditorFeatures/TestUtilities/Workspaces/TestWorkspace_XmlConsumption.cs @@ -581,12 +581,11 @@ XAttribute preprocessorSymbolsAttribute return new VisualBasicParseOptions( preprocessorSymbols: preprocessorSymbolsAttribute .Value.Split(',') - .Select( - v => - KeyValuePairUtil.Create( - v.Split('=').ElementAt(0), - (object)v.Split('=').ElementAt(1) - ) + .Select(v => + KeyValuePairUtil.Create( + v.Split('=').ElementAt(0), + (object)v.Split('=').ElementAt(1) + ) ) .ToImmutableArray() ); diff --git a/roslyn/src/EditorFeatures/Text/Extensions.SnapshotSourceText.cs b/roslyn/src/EditorFeatures/Text/Extensions.SnapshotSourceText.cs index 4d65b35e004..0d2784c247f 100644 --- a/roslyn/src/EditorFeatures/Text/Extensions.SnapshotSourceText.cs +++ b/roslyn/src/EditorFeatures/Text/Extensions.SnapshotSourceText.cs @@ -108,13 +108,12 @@ ITextSnapshot editorSnapshot var tempTextBufferCloneService = textBufferCloneService; snapshot = s_textSnapshotMap.GetValue( editorSnapshot, - s => - new SnapshotSourceText( - tempTextBufferCloneService, - s, - SourceHashAlgorithms.OpenDocumentChecksumAlgorithm, - container - ) + s => new SnapshotSourceText( + tempTextBufferCloneService, + s, + SourceHashAlgorithms.OpenDocumentChecksumAlgorithm, + container + ) ); } @@ -138,13 +137,12 @@ TextBufferContainer container Contract.ThrowIfFalse(editorSnapshot.TextBuffer == container.GetTextBuffer()); return s_textSnapshotMap.GetValue( editorSnapshot, - s => - new SnapshotSourceText( - textBufferCloneService, - s, - SourceHashAlgorithms.OpenDocumentChecksumAlgorithm, - container - ) + s => new SnapshotSourceText( + textBufferCloneService, + s, + SourceHashAlgorithms.OpenDocumentChecksumAlgorithm, + container + ) ); } diff --git a/roslyn/src/EditorFeatures/XunitHook/XunitDisposeHook.cs b/roslyn/src/EditorFeatures/XunitHook/XunitDisposeHook.cs index 3d1a9a71d47..f34d58da38b 100644 --- a/roslyn/src/EditorFeatures/XunitHook/XunitDisposeHook.cs +++ b/roslyn/src/EditorFeatures/XunitHook/XunitDisposeHook.cs @@ -24,8 +24,7 @@ public void Execute() var xunitUtilities = AppDomain .CurrentDomain.GetAssemblies() - .Where( - static assembly => assembly.GetName().Name.StartsWith("xunit.runner.utility") + .Where(static assembly => assembly.GetName().Name.StartsWith("xunit.runner.utility") ) .ToArray(); foreach (var xunitUtility in xunitUtilities) diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CompilationContext.cs b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CompilationContext.cs index 31030673662..81d0bca44be 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CompilationContext.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/CompilationContext.cs @@ -147,8 +147,8 @@ out _displayClassVariables // Assert that the cheap check for "this" is equivalent to the expensive check for "this". Debug.Assert( (GetThisProxy(_displayClassVariables) != null) - == _displayClassVariables.Values.Any( - v => v.Kind == DisplayClassVariableKind.This + == _displayClassVariables.Values.Any(v => + v.Kind == DisplayClassVariableKind.This ) ); } @@ -2035,8 +2035,8 @@ out ImmutableDictionary displayClassVariables if ( checkForPrimaryConstructor - && displayClassVariablesBuilder.Values.FirstOrDefault( - v => v.Kind == DisplayClassVariableKind.This + && displayClassVariablesBuilder.Values.FirstOrDefault(v => + v.Kind == DisplayClassVariableKind.This ) is { } thisProxy ) @@ -2451,8 +2451,8 @@ internal static DisplayClassVariable GetThisProxy( ImmutableDictionary displayClassVariables ) { - return displayClassVariables.Values.FirstOrDefault( - v => v.Kind == DisplayClassVariableKind.This + return displayClassVariables.Values.FirstOrDefault(v => + v.Kind == DisplayClassVariableKind.This ); } @@ -2670,12 +2670,11 @@ internal DisplayClassInstanceAndFields(DisplayClassInstance instance) || instance .Type.GetMembers() .OfType() - .Any( - static f => - GeneratedNameParser.TryParsePrimaryConstructorParameterFieldName( - f.Name, - out _ - ) + .Any(static f => + GeneratedNameParser.TryParsePrimaryConstructorParameterFieldName( + f.Name, + out _ + ) ) ); } diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EvaluationContext.cs b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EvaluationContext.cs index 6c4ed0f7710..f93d2e3b605 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EvaluationContext.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/EvaluationContext.cs @@ -250,8 +250,8 @@ out ImmutableArray errorMessages ) { var diagnostics = DiagnosticBag.GetInstance(); - var syntaxNodes = expressions.SelectAsArray( - expr => Parse(expr, treatAsExpression: true, diagnostics, out var formatSpecifiers) + var syntaxNodes = expressions.SelectAsArray(expr => + Parse(expr, treatAsExpression: true, diagnostics, out var formatSpecifiers) ); byte[]? assembly = null; if (!diagnostics.HasAnyErrors()) @@ -305,13 +305,12 @@ out var moduleBuilder diagnostics .AsEnumerable() .Where(d => d.Severity == DiagnosticSeverity.Error) - .Select( - d => - GetErrorMessage( - d, - CSharpDiagnosticFormatter.Instance, - preferredUICulture: null - ) + .Select(d => + GetErrorMessage( + d, + CSharpDiagnosticFormatter.Instance, + preferredUICulture: null + ) ) ); } @@ -639,8 +638,8 @@ AssemblyIdentity linqLibrary arguments.Count == 2 && arguments[0] is string namespaceName && arguments[1] is NamespaceSymbol containingNamespace - && containingNamespace.ConstituentNamespaces.Any( - static n => n.ContainingAssembly.Identity.IsWindowsAssemblyIdentity() + && containingNamespace.ConstituentNamespaces.Any(static n => + n.ContainingAssembly.Identity.IsWindowsAssemblyIdentity() ) ) { diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/ObjectIdLocalSymbol.cs b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/ObjectIdLocalSymbol.cs index 52b1fd31d17..776b813635b 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/ObjectIdLocalSymbol.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Symbols/ObjectIdLocalSymbol.cs @@ -104,24 +104,21 @@ internal override BoundExpression GetAddress(BoundPseudoVariable variable) method.ContainingType, method.Name, m => - method.TypeParameters.SelectAsArray( - t => - (TypeParameterSymbol) - new SimpleTypeParameterSymbol(m, t.Ordinal, t.Name) + method.TypeParameters.SelectAsArray(t => + (TypeParameterSymbol)new SimpleTypeParameterSymbol(m, t.Ordinal, t.Name) ), m => m.TypeParameters[0], // return type is <>T& m => - method.Parameters.SelectAsArray( - p => - SynthesizedParameterSymbol.Create( - m, - p.TypeWithAnnotations, - p.Ordinal, - p.RefKind, - p.Name, - p.EffectiveScope, - refCustomModifiers: p.RefCustomModifiers - ) + method.Parameters.SelectAsArray(p => + SynthesizedParameterSymbol.Create( + m, + p.TypeWithAnnotations, + p.Ordinal, + p.RefKind, + p.Name, + p.EffectiveScope, + refCustomModifiers: p.RefCustomModifiers + ) ) ); var local = variable.LocalSymbol; diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs index 7b5a8ea6c8a..bdc15f0cfd2 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/ExpressionCompilerTests.cs @@ -5852,9 +5852,9 @@ void M() var methodData = testData.GetMethodData("<>x.<>m0"); Assert.Equal( "int?", - ( - (MethodSymbol)methodData.Method - ).ReturnTypeWithAnnotations.ToDisplayString() + ((MethodSymbol)methodData.Method).ReturnTypeWithAnnotations.ToDisplayString( + + ) ); methodData.VerifyIL( @"{ @@ -5879,9 +5879,9 @@ .locals init (int? V_0) methodData = testData.GetMethodData("<>x.<>m0"); Assert.Equal( "int?", - ( - (MethodSymbol)methodData.Method - ).ReturnTypeWithAnnotations.ToDisplayString() + ((MethodSymbol)methodData.Method).ReturnTypeWithAnnotations.ToDisplayString( + + ) ); testData = new CompilationTestData(); diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/HoistedThisTests.cs b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/HoistedThisTests.cs index b7332053d13..99a5cb3f048 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/HoistedThisTests.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/HoistedThisTests.cs @@ -959,10 +959,9 @@ .maxstack 1 var displayClassMethod in displayClassType .GetMembers() .OfType() - .Where( - m => - GeneratedNameParser.GetKind(m.Name) - == GeneratedNameKind.LambdaMethod + .Where(m => + GeneratedNameParser.GetKind(m.Name) + == GeneratedNameKind.LambdaMethod ) ) { @@ -1052,10 +1051,9 @@ static event Action E var displayClassMethod in displayClassType .GetMembers() .OfType() - .Where( - m => - GeneratedNameParser.GetKind(m.Name) - == GeneratedNameKind.LambdaMethod + .Where(m => + GeneratedNameParser.GetKind(m.Name) + == GeneratedNameKind.LambdaMethod ) ) { @@ -1704,8 +1702,8 @@ Func isDesiredOverload var stateMachineType = originalType .GetMembers() .OfType() - .Single( - t => GeneratedNameParser.GetKind(t.Name) == GeneratedNameKind.StateMachineType + .Single(t => + GeneratedNameParser.GetKind(t.Name) == GeneratedNameKind.StateMachineType ); var moveNextMethod = stateMachineType.GetMember("MoveNext"); diff --git a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs index ef34ffc2dc8..c84508197db 100644 --- a/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs +++ b/roslyn/src/ExpressionEvaluator/CSharp/Test/ExpressionCompiler/UsingDebugInfoTests.cs @@ -655,12 +655,11 @@ public static void Main() using (var peReader = new PEReader(peImage)) { var metadataReader = peReader.GetMetadataReader(); - var methodHandle = metadataReader.MethodDefinitions.Single( - h => - metadataReader.StringComparer.Equals( - metadataReader.GetMethodDefinition(h).Name, - "Main" - ) + var methodHandle = metadataReader.MethodDefinitions.Single(h => + metadataReader.StringComparer.Equals( + metadataReader.GetMethodDefinition(h).Name, + "Main" + ) ); var methodToken = metadataReader.GetToken(methodHandle); @@ -715,12 +714,11 @@ public static void Main() using (var peReader = new PEReader(peImage)) { var metadataReader = peReader.GetMetadataReader(); - var methodHandle = metadataReader.MethodDefinitions.Single( - h => - metadataReader.StringComparer.Equals( - metadataReader.GetMethodDefinition(h).Name, - "Main" - ) + var methodHandle = metadataReader.MethodDefinitions.Single(h => + metadataReader.StringComparer.Equals( + metadataReader.GetMethodDefinition(h).Name, + "Main" + ) ); var methodToken = metadataReader.GetToken(methodHandle); @@ -772,12 +770,11 @@ public static void Main() using (var peReader = new PEReader(peImage)) { var metadataReader = peReader.GetMetadataReader(); - var methodHandle = metadataReader.MethodDefinitions.Single( - h => - metadataReader.StringComparer.Equals( - metadataReader.GetMethodDefinition(h).Name, - "Main" - ) + var methodHandle = metadataReader.MethodDefinitions.Single(h => + metadataReader.StringComparer.Equals( + metadataReader.GetMethodDefinition(h).Name, + "Main" + ) ); var methodToken = metadataReader.GetToken(methodHandle); diff --git a/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/InstructionDecoder.cs b/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/InstructionDecoder.cs index 89f0675aa77..fb9bce1c9d7 100644 --- a/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/InstructionDecoder.cs +++ b/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/InstructionDecoder.cs @@ -36,8 +36,9 @@ internal abstract class InstructionDecoder< internal InstructionDecoder() { // Should be passed by the ExpressionCompiler as an argument to this constructor. - _useReferencedAssembliesOnly = - ExpressionCompiler.GetUseReferencedAssembliesOnlySetting(); + _useReferencedAssembliesOnly = ExpressionCompiler.GetUseReferencedAssembliesOnlySetting( + + ); } internal MakeAssemblyReferencesKind GetMakeAssemblyReferencesKind() diff --git a/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/PDB/MethodDebugInfo.Native.cs b/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/PDB/MethodDebugInfo.Native.cs index b79c8822212..8ad3ffebb14 100644 --- a/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/PDB/MethodDebugInfo.Native.cs +++ b/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/PDB/MethodDebugInfo.Native.cs @@ -176,9 +176,10 @@ out externAliasRecords { hoistedLocalScopeRecords = CustomDebugInfoReader .DecodeStateMachineHoistedLocalScopesRecord(customDebugInfoRecord) - .SelectAsArray( - s => new HoistedLocalScopeRecord(s.StartOffset, s.Length) - ); + .SelectAsArray(s => new HoistedLocalScopeRecord( + s.StartOffset, + s.Length + )); } GetCSharpDynamicLocalInfo( @@ -794,13 +795,10 @@ bool isEndInclusive return MethodContextReuseConstraints.CalculateReuseSpan( ilOffset, ILSpan.MaxValue, - scopes.Select( - scope => - new ILSpan( - (uint)scope.GetStartOffset(), - (uint)(scope.GetEndOffset() + (isEndInclusive ? 1 : 0)) - ) - ) + scopes.Select(scope => new ILSpan( + (uint)scope.GetStartOffset(), + (uint)(scope.GetEndOffset() + (isEndInclusive ? 1 : 0)) + )) ); } diff --git a/roslyn/src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs b/roslyn/src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs index a00d3058187..a1047dd89ed 100644 --- a/roslyn/src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs +++ b/roslyn/src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs @@ -675,8 +675,9 @@ bool isPointerDereference ) { // Generate the declared type name without tuple element names. - var declaredTypeInfoNoTupleElementNames = - declaredTypeInfo.WithNoTupleElementNames(); + var declaredTypeInfoNoTupleElementNames = declaredTypeInfo.WithNoTupleElementNames( + + ); var declaredTypeNameNoTupleElementNames = (declaredTypeInfo == declaredTypeInfoNoTupleElementNames) ? declaredTypeName diff --git a/roslyn/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs b/roslyn/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs index 969c2cbc054..a821abef6fd 100644 --- a/roslyn/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs +++ b/roslyn/src/ExpressionEvaluator/Core/Test/ExpressionCompiler/ExpressionCompilerTestHelpers.cs @@ -394,9 +394,8 @@ string methodName { return typeDef .GetMethods() - .First( - h => - reader.StringComparer.Equals(reader.GetMethodDefinition(h).Name, methodName) + .First(h => + reader.StringComparer.Equals(reader.GetMethodDefinition(h).Name, methodName) ); } @@ -557,15 +556,12 @@ bool isEndInclusive } var scopes = ArrayBuilder.GetInstance(); method.GetAllScopes(scopes); - var result = scopes.SelectAsArray( - s => - new Scope( - s.GetStartOffset(), - s.GetEndOffset(), - ImmutableArray.CreateRange(s.GetLocals().Select(l => l.GetName())), - isEndInclusive - ) - ); + var result = scopes.SelectAsArray(s => new Scope( + s.GetStartOffset(), + s.GetEndOffset(), + ImmutableArray.CreateRange(s.GetLocals().Select(l => l.GetName())), + isEndInclusive + )); scopes.Free(); return result; } @@ -751,12 +747,11 @@ params string[] importStrings using (var peReader = new PEReader(peImage)) { var metadataReader = peReader.GetMetadataReader(); - var methodHandle = metadataReader.MethodDefinitions.Single( - h => - metadataReader.StringComparer.Equals( - metadataReader.GetMethodDefinition(h).Name, - methodName - ) + var methodHandle = metadataReader.MethodDefinitions.Single(h => + metadataReader.StringComparer.Equals( + metadataReader.GetMethodDefinition(h).Name, + methodName + ) ); var methodToken = metadataReader.GetToken(methodHandle); diff --git a/roslyn/src/Features/CSharp/Portable/BraceCompletion/LessAndGreaterThanBraceCompletionService.cs b/roslyn/src/Features/CSharp/Portable/BraceCompletion/LessAndGreaterThanBraceCompletionService.cs index 9f08e751adf..278fcd8505e 100644 --- a/roslyn/src/Features/CSharp/Portable/BraceCompletion/LessAndGreaterThanBraceCompletionService.cs +++ b/roslyn/src/Features/CSharp/Portable/BraceCompletion/LessAndGreaterThanBraceCompletionService.cs @@ -51,8 +51,8 @@ CancellationToken cancellationToken if ( token.CheckParent(n => n.LessThanToken == token) || token.CheckParent(n => n.LessThanToken == token) - || token.CheckParent( - n => n.LessThanToken == token + || token.CheckParent(n => + n.LessThanToken == token ) ) { diff --git a/roslyn/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs b/roslyn/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs index aa3c4e7c431..5690cd51790 100644 --- a/roslyn/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs +++ b/roslyn/src/Features/CSharp/Portable/ChangeSignature/CSharpChangeSignatureService.cs @@ -896,13 +896,13 @@ SyntaxNode oldArgument ) { var oldTrivia = oldArgument.GetLeadingTrivia(); - var oldOnlyHasWhitespaceTrivia = oldTrivia.All( - t => t.IsKind(SyntaxKind.WhitespaceTrivia) + var oldOnlyHasWhitespaceTrivia = oldTrivia.All(t => + t.IsKind(SyntaxKind.WhitespaceTrivia) ); var newTrivia = newArgument.GetLeadingTrivia(); - var newOnlyHasWhitespaceTrivia = newTrivia.All( - t => t.IsKind(SyntaxKind.WhitespaceTrivia) + var newOnlyHasWhitespaceTrivia = newTrivia.All(t => + t.IsKind(SyntaxKind.WhitespaceTrivia) ); if (oldOnlyHasWhitespaceTrivia && newOnlyHasWhitespaceTrivia) @@ -1039,10 +1039,8 @@ CancellationToken cancellationToken var paramNodes = node.DescendantNodes(descendIntoTrivia: true) .OfType() - .Where( - e => - e.StartTag.Name.ToString() - == DocumentationCommentXmlNames.ParameterElementName + .Where(e => + e.StartTag.Name.ToString() == DocumentationCommentXmlNames.ParameterElementName ); var permutedParamNodes = VerifyAndPermuteParamNodes( @@ -1093,8 +1091,8 @@ SignatureChange updatedSignature var i = 0; foreach (var paramNode in paramNodes) { - var nameAttribute = paramNode.StartTag.Attributes.FirstOrDefault( - a => a.Name.ToString().Equals("name", StringComparison.OrdinalIgnoreCase) + var nameAttribute = paramNode.StartTag.Attributes.FirstOrDefault(a => + a.Name.ToString().Equals("name", StringComparison.OrdinalIgnoreCase) ); if (nameAttribute == null) { diff --git a/roslyn/src/Features/CSharp/Portable/CodeFixes/GenerateMethod/GenerateDeconstructMethodCodeFixProvider.cs b/roslyn/src/Features/CSharp/Portable/CodeFixes/GenerateMethod/GenerateDeconstructMethodCodeFixProvider.cs index bd160886b81..451130a5727 100644 --- a/roslyn/src/Features/CSharp/Portable/CodeFixes/GenerateMethod/GenerateDeconstructMethodCodeFixProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/CodeFixes/GenerateMethod/GenerateDeconstructMethodCodeFixProvider.cs @@ -63,12 +63,11 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) var deconstruction = token .GetAncestors() - .FirstOrDefault( - n => - n.Kind() - is SyntaxKind.SimpleAssignmentExpression - or SyntaxKind.ForEachVariableStatement - or SyntaxKind.PositionalPatternClause + .FirstOrDefault(n => + n.Kind() + is SyntaxKind.SimpleAssignmentExpression + or SyntaxKind.ForEachVariableStatement + or SyntaxKind.PositionalPatternClause ); if (deconstruction is null) @@ -122,8 +121,8 @@ or SyntaxKind.PositionalPatternClause // Subpatterns are cast to ConstantPatternSyntax for use of GenerateNameForExpression and GetTypeInfo if ( deconstruction is PositionalPatternClauseSyntax positionalPatternClause - && positionalPatternClause.Subpatterns.Any( - p => p.Pattern is not ConstantPatternSyntax + && positionalPatternClause.Subpatterns.Any(p => + p.Pattern is not ConstantPatternSyntax ) ) { diff --git a/roslyn/src/Features/CSharp/Portable/CodeRefactorings/ConvertLocalFunctionToMethod/CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs b/roslyn/src/Features/CSharp/Portable/CodeRefactorings/ConvertLocalFunctionToMethod/CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs index f043e256133..06d65130570 100644 --- a/roslyn/src/Features/CSharp/Portable/CodeRefactorings/ConvertLocalFunctionToMethod/CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/CodeRefactorings/ConvertLocalFunctionToMethod/CSharpConvertLocalFunctionToMethodCodeRefactoringProvider.cs @@ -126,17 +126,16 @@ CancellationToken cancellationToken // We also make a `ref` parameter here for each capture that is being written into inside the function var capturesAsParameters = captures .Where(capture => !capture.IsThisParameter()) - .Select( - capture => - CodeGenerationSymbolFactory.CreateParameterSymbol( - attributes: default, - refKind: dataFlow.WrittenInside.Contains(capture) - ? RefKind.Ref - : RefKind.None, - isParams: false, - type: capture.GetSymbolType(), - name: capture.Name - ) + .Select(capture => + CodeGenerationSymbolFactory.CreateParameterSymbol( + attributes: default, + refKind: dataFlow.WrittenInside.Contains(capture) + ? RefKind.Ref + : RefKind.None, + isParams: false, + type: capture.GetSymbolType(), + name: capture.Name + ) ) .ToList(); @@ -147,8 +146,8 @@ CancellationToken cancellationToken // We're going to remove unreferenced type parameters but we explicitly preserve // captures' types, just in case that they were not spelt out in the function body - var captureTypes = captures.SelectMany( - capture => capture.GetSymbolType().GetReferencedTypeParameters() + var captureTypes = captures.SelectMany(capture => + capture.GetSymbolType().GetReferencedTypeParameters() ); RemoveUnusedTypeParameters( localFunction, @@ -254,8 +253,8 @@ await document if (hasAdditionalTypeArguments) { - var existingTypeArguments = symbol.TypeArguments.Select( - s => s.GenerateTypeSyntax() + var existingTypeArguments = symbol.TypeArguments.Select(s => + s.GenerateTypeSyntax() ); // Prepend additional type arguments to preserve lexical order in which they are defined var typeArguments = additionalTypeArguments.Concat(existingTypeArguments); @@ -272,13 +271,8 @@ await document && invocation.ArgumentList.Arguments.Any(arg => arg.NameColon != null); var additionalArguments = capturesAsParameters - .Select( - p => - (ArgumentSyntax)GenerateArgument( - p, - p.Name, - shouldUseNamedArguments - ) + .Select(p => + (ArgumentSyntax)GenerateArgument(p, p.Name, shouldUseNamedArguments) ) .ToArray(); @@ -335,8 +329,8 @@ await document parameterNames, (p, name) => GenerateArgument(p, name) ); - var additionalArguments = capturesAsParameters.Select( - p => GenerateArgument(p, p.Name) + var additionalArguments = capturesAsParameters.Select(p => + GenerateArgument(p, p.Name) ); var newNode = generator.ValueReturningLambdaExpression( lambdaParameters, diff --git a/roslyn/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs b/roslyn/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs index 54aabdc49cd..820560b5b3c 100644 --- a/roslyn/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs +++ b/roslyn/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpChangeNamespaceService.cs @@ -484,8 +484,8 @@ CancellationToken cancellationToken return container; static bool ContainsNamespaceDeclaration(SyntaxNode node) => - node.DescendantNodes( - n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax + node.DescendantNodes(n => + n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax ) .OfType() .Any(); diff --git a/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialMethodCompletionProvider.cs b/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialMethodCompletionProvider.cs index 0bcd6023cd0..cf80f9035e6 100644 --- a/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialMethodCompletionProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialMethodCompletionProvider.cs @@ -97,8 +97,8 @@ protected override bool IsPartial(IMethodSymbol method) var declarations = method .DeclaringSyntaxReferences.Select(r => r.GetSyntax()) .OfType(); - return declarations.Any( - d => d.Body == null && d.Modifiers.Any(SyntaxKind.PartialKeyword) + return declarations.Any(d => + d.Body == null && d.Modifiers.Any(SyntaxKind.PartialKeyword) ); } diff --git a/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/SnippetCompletionProvider.cs b/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/SnippetCompletionProvider.cs index 422d22d5388..c670c9b051b 100644 --- a/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/SnippetCompletionProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/Completion/CompletionProviders/SnippetCompletionProvider.cs @@ -237,17 +237,16 @@ bool isPreProcessorContext var snippets = service.GetSnippetsIfAvailable(); if (context.CompletionOptions.ShouldShowNewSnippetExperience(context.Document)) { - snippets = snippets.Where( - snippet => !s_snippetsWithReplacements.Contains(snippet.Shortcut) + snippets = snippets.Where(snippet => + !s_snippetsWithReplacements.Contains(snippet.Shortcut) ); } if (isPreProcessorContext) { - snippets = snippets.Where( - snippet => - snippet.Shortcut != null - && snippet.Shortcut.StartsWith("#", StringComparison.Ordinal) + snippets = snippets.Where(snippet => + snippet.Shortcut != null + && snippet.Shortcut.StartsWith("#", StringComparison.Ordinal) ); } diff --git a/roslyn/src/Features/CSharp/Portable/Completion/KeywordRecommenders/CheckedKeywordRecommender.cs b/roslyn/src/Features/CSharp/Portable/Completion/KeywordRecommenders/CheckedKeywordRecommender.cs index 15a1f1f4eca..8928e568d05 100644 --- a/roslyn/src/Features/CSharp/Portable/Completion/KeywordRecommenders/CheckedKeywordRecommender.cs +++ b/roslyn/src/Features/CSharp/Portable/Completion/KeywordRecommenders/CheckedKeywordRecommender.cs @@ -46,7 +46,9 @@ CancellationToken cancellationToken SyntaxToken previousToken; if ( - previousPossiblySkippedToken.IsLastTokenOfNode() + previousPossiblySkippedToken.IsLastTokenOfNode( + + ) ) { var firstSpecifierToken = previousPossiblySkippedToken diff --git a/roslyn/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs b/roslyn/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs index 9ef7c1f8cbf..a11087c98e2 100644 --- a/roslyn/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs @@ -87,16 +87,15 @@ public bool TryConvert(out DocumentUpdateInfo documentUpdateInfo) if ( _source .DescendantTrivia() - .Any( - trivia => - trivia - is - ( - kind: SyntaxKind.SingleLineCommentTrivia - or SyntaxKind.MultiLineCommentTrivia - or SyntaxKind.MultiLineDocumentationCommentTrivia - ) - || _source.ContainsDirectives + .Any(trivia => + trivia + is + ( + kind: SyntaxKind.SingleLineCommentTrivia + or SyntaxKind.MultiLineCommentTrivia + or SyntaxKind.MultiLineDocumentationCommentTrivia + ) + || _source.ContainsDirectives ) ) { @@ -129,9 +128,8 @@ out documentUpdateInfo && // second attempt: at least to a local function !_semanticModel .GetDiagnostics(_source.Span, _cancellationToken) - .Any( - static diagnostic => - diagnostic.DefaultSeverity == DiagnosticSeverity.Error + .Any(static diagnostic => + diagnostic.DefaultSeverity == DiagnosticSeverity.Error ) ) { @@ -295,7 +293,9 @@ out StatementSyntax extraStatementToAddAbove joinClause.LeftExpression ), SyntaxFactory.Argument( - joinClause.RightExpression.WithoutTrailingTrivia() + joinClause.RightExpression.WithoutTrailingTrivia( + + ) ) } ) diff --git a/roslyn/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/DefaultConverter.cs b/roslyn/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/DefaultConverter.cs index ad078cb95af..5bbe3d1be92 100644 --- a/roslyn/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/DefaultConverter.cs +++ b/roslyn/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/DefaultConverter.cs @@ -31,20 +31,20 @@ CancellationToken cancellationToken // Filter out identifiers which are not used in statements. var variableNamesReadInside = new HashSet( ForEachInfo - .Statements.SelectMany( - statement => ForEachInfo.SemanticModel.AnalyzeDataFlow(statement).ReadInside + .Statements.SelectMany(statement => + ForEachInfo.SemanticModel.AnalyzeDataFlow(statement).ReadInside ) .Select(symbol => symbol.Name) ); - var identifiersUsedInStatements = ForEachInfo.Identifiers.Where( - identifier => variableNamesReadInside.Contains(identifier.ValueText) + var identifiersUsedInStatements = ForEachInfo.Identifiers.Where(identifier => + variableNamesReadInside.Contains(identifier.ValueText) ); // If there is a single statement and it is a block, leave it as is. // Otherwise, wrap with a block. var block = WrapWithBlockIfNecessary( - ForEachInfo.Statements.SelectAsArray( - statement => statement.KeepCommentsAndAddElasticMarkers() + ForEachInfo.Statements.SelectAsArray(statement => + statement.KeepCommentsAndAddElasticMarkers() ) ); @@ -100,9 +100,8 @@ bool convertToQuery { var tupleForSelectExpression = SyntaxFactory.TupleExpression( SyntaxFactory.SeparatedList( - identifiers.Select( - identifier => - SyntaxFactory.Argument(SyntaxFactory.IdentifierName(identifier)) + identifiers.Select(identifier => + SyntaxFactory.Argument(SyntaxFactory.IdentifierName(identifier)) ) ) ); @@ -110,8 +109,8 @@ bool convertToQuery VarNameIdentifier, SyntaxFactory.ParenthesizedVariableDesignation( SyntaxFactory.SeparatedList( - identifiers.Select( - identifier => SyntaxFactory.SingleVariableDesignation(identifier) + identifiers.Select(identifier => + SyntaxFactory.SingleVariableDesignation(identifier) ) ) ) diff --git a/roslyn/src/Features/CSharp/Portable/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs b/roslyn/src/Features/CSharp/Portable/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs index 0b68a4bf355..cfebec7c309 100644 --- a/roslyn/src/Features/CSharp/Portable/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/ConvertPrimaryToRegularConstructor/ConvertPrimaryToRegularConstructorCodeRefactoringProvider.cs @@ -118,8 +118,8 @@ CancellationToken cancellationToken // Get the named type and all its parameters for use during the rewrite. var namedType = semanticModel.GetRequiredDeclaredSymbol(typeDeclaration, cancellationToken); - var parameters = parameterList.Parameters.SelectAsArray( - p => semanticModel.GetRequiredDeclaredSymbol(p, cancellationToken) + var parameters = parameterList.Parameters.SelectAsArray(p => + semanticModel.GetRequiredDeclaredSymbol(p, cancellationToken) ); // We may have to update multiple files (in the case of a partial type). Use a solution-editor to make that @@ -134,8 +134,8 @@ CancellationToken cancellationToken is [PrimaryConstructorBaseTypeSyntax type, ..] ? type : null; - var methodTargetingAttributes = typeDeclaration.AttributeLists.Where( - list => list.Target?.Identifier.ValueText == "method" + var methodTargetingAttributes = typeDeclaration.AttributeLists.Where(list => + list.Target?.Identifier.ValueText == "method" ); // Find the references to all the parameters. This will help us determine how they're used and what change we @@ -271,8 +271,8 @@ member is IFieldSymbol n => namedType.Name != n && !namedType.GetMembers(n).Any() ); - var isWrittenTo = parameterReferences[parameter].Any( - r => r.IsWrittenTo(semanticModel, cancellationToken) + var isWrittenTo = parameterReferences[parameter].Any(r => + r.IsWrittenTo(semanticModel, cancellationToken) ); var synthesizedField = CodeGenerationSymbolFactory.CreateFieldSymbol( existingField, @@ -401,11 +401,10 @@ void AddNewFields() { var currentTypeDeclaration = (TypeDeclarationSyntax)current; var fieldsInOrder = parameters - .Select( - p => - parameterToSynthesizedFields.TryGetValue(p, out var field) - ? field - : null + .Select(p => + parameterToSynthesizedFields.TryGetValue(p, out var field) + ? field + : null ) .WhereNotNull(); var codeGenService = @@ -434,10 +433,9 @@ void AddConstructorDeclaration() .WithAdditionalAnnotations(constructorAnnotation); // If there is an existing non-static constructor, place it before that - var firstConstructorIndex = currentTypeDeclaration.Members.IndexOf( - m => - m is ConstructorDeclarationSyntax c - && !c.Modifiers.Any(SyntaxKind.StaticKeyword) + var firstConstructorIndex = currentTypeDeclaration.Members.IndexOf(m => + m is ConstructorDeclarationSyntax c + && !c.Modifiers.Any(SyntaxKind.StaticKeyword) ); if (firstConstructorIndex >= 0) { @@ -450,12 +448,12 @@ m is ConstructorDeclarationSyntax c } // No constructors. Place after any fields if present, or any properties if there are no fields. - var lastFieldOrProperty = currentTypeDeclaration.Members.LastIndexOf( - m => m is FieldDeclarationSyntax + var lastFieldOrProperty = currentTypeDeclaration.Members.LastIndexOf(m => + m is FieldDeclarationSyntax ); if (lastFieldOrProperty < 0) - lastFieldOrProperty = currentTypeDeclaration.Members.LastIndexOf( - m => m is PropertyDeclarationSyntax + lastFieldOrProperty = currentTypeDeclaration.Members.LastIndexOf(m => + m is PropertyDeclarationSyntax ); if (lastFieldOrProperty >= 0) @@ -654,8 +652,8 @@ ConstructorDeclarationSyntax CreateConstructorDeclaration() // Next, actually assign to all the fields/properties that were previously referencing any primary // constructor parameters. foreach ( - var (fieldOrProperty, initializer) in initializedFieldsAndProperties.OrderBy( - i => i.initializer.SpanStart + var (fieldOrProperty, initializer) in initializedFieldsAndProperties.OrderBy(i => + i.initializer.SpanStart ) ) { @@ -681,11 +679,10 @@ ConstructorDeclarationSyntax CreateConstructorDeclaration() var constructorDeclaration = ConstructorDeclaration( List( - methodTargetingAttributes.Select( - a => - a.WithTarget(null) - .WithoutTrivia() - .WithAdditionalAnnotations(Formatter.Annotation) + methodTargetingAttributes.Select(a => + a.WithTarget(null) + .WithoutTrivia() + .WithAdditionalAnnotations(Formatter.Annotation) ) ), TokenList(Token(SyntaxKind.PublicKeyword).WithAppendedTrailingTrivia(Space)), diff --git a/roslyn/src/Features/CSharp/Portable/ConvertProgram/ConvertProgramTransform_ProgramMain.cs b/roslyn/src/Features/CSharp/Portable/ConvertProgram/ConvertProgramTransform_ProgramMain.cs index 07a1c0807cb..f3cae8fcba0 100644 --- a/roslyn/src/Features/CSharp/Portable/ConvertProgram/ConvertProgramTransform_ProgramMain.cs +++ b/roslyn/src/Features/CSharp/Portable/ConvertProgram/ConvertProgramTransform_ProgramMain.cs @@ -227,10 +227,9 @@ private static TSyntaxNode FixupComments(TSyntaxNode node) // Remove comment explaining top level statements as it isn't relevant if the user switches back to full // Program.Main form. var leadingTrivia = node.GetLeadingTrivia(); - var comment = leadingTrivia.FirstOrNull( - c => - c.Kind() is SyntaxKind.SingleLineCommentTrivia - && c.ToString().Contains("https://aka.ms/new-console-template") + var comment = leadingTrivia.FirstOrNull(c => + c.Kind() is SyntaxKind.SingleLineCommentTrivia + && c.ToString().Contains("https://aka.ms/new-console-template") ); if (comment == null) return node; diff --git a/roslyn/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs b/roslyn/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs index 64aebc1a3a8..8806d62baee 100644 --- a/roslyn/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs +++ b/roslyn/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService_ExpressionTermCollector.cs @@ -298,8 +298,8 @@ ref ExpressionType expressionType if (arrayCreationExpression.Initializer != null) { var flags = ExpressionType.Invalid; - arrayCreationExpression.Initializer.Expressions.Do( - e => AddSubExpressionTerms(e, terms, ref flags) + arrayCreationExpression.Initializer.Expressions.Do(e => + AddSubExpressionTerms(e, terms, ref flags) ); validTerm &= IsValidTerm(flags); diff --git a/roslyn/src/Features/CSharp/Portable/DocumentationComments/CSharpDocumentationCommentSnippetService.cs b/roslyn/src/Features/CSharp/Portable/DocumentationComments/CSharpDocumentationCommentSnippetService.cs index 95f2430bd1d..08083a071d3 100644 --- a/roslyn/src/Features/CSharp/Portable/DocumentationComments/CSharpDocumentationCommentSnippetService.cs +++ b/roslyn/src/Features/CSharp/Portable/DocumentationComments/CSharpDocumentationCommentSnippetService.cs @@ -92,14 +92,13 @@ protected override bool SupportsDocumentationComments(MemberDeclarationSyntax me protected override bool HasDocumentationComment(MemberDeclarationSyntax member) => member .GetFirstToken() - .LeadingTrivia.Any( - t => - t - is - ( - kind: SyntaxKind.SingleLineDocumentationCommentTrivia - or SyntaxKind.MultiLineDocumentationCommentTrivia - ) + .LeadingTrivia.Any(t => + t + is + ( + kind: SyntaxKind.SingleLineDocumentationCommentTrivia + or SyntaxKind.MultiLineDocumentationCommentTrivia + ) ); protected override int GetPrecedingDocumentationCommentCount(MemberDeclarationSyntax member) @@ -194,8 +193,8 @@ private static IEnumerable GetExceptions(SyntaxNode member) .Where(n => n.Kind() is SyntaxKind.ThrowExpression or SyntaxKind.ThrowStatement); var usings = member.GetEnclosingUsingDirectives(); - var hasUsingSystem = usings.Any( - u => u.Name is IdentifierNameSyntax { Identifier.ValueText: nameof(System) } + var hasUsingSystem = usings.Any(u => + u.Name is IdentifierNameSyntax { Identifier.ValueText: nameof(System) } ); using var _ = PooledHashSet.GetInstance(out var seenExceptionTypes); diff --git a/roslyn/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs b/roslyn/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs index fc6c9eb0c1b..61309035875 100644 --- a/roslyn/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs +++ b/roslyn/src/Features/CSharp/Portable/EditAndContinue/CSharpEditAndContinueAnalyzer.cs @@ -1039,11 +1039,11 @@ private static bool HasEquivalentUsingDeclarations( BlockSyntax newBlock ) { - var oldUsingDeclarations = oldBlock.Statements.Where( - s => s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default + var oldUsingDeclarations = oldBlock.Statements.Where(s => + s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default ); - var newUsingDeclarations = newBlock.Statements.Where( - s => s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default + var newUsingDeclarations = newBlock.Statements.Where(s => + s is LocalDeclarationStatementSyntax l && l.UsingKeyword != default ); return oldUsingDeclarations.SequenceEqual( @@ -1091,8 +1091,8 @@ SwitchStatementSyntax newNode } // Check that switch statement decision tree has not changed. - var hasDecitionTree = oldNode.Sections.Any( - s => s.Labels.Any(l => l is CasePatternSwitchLabelSyntax) + var hasDecitionTree = oldNode.Sections.Any(s => + s.Labels.Any(l => l is CasePatternSwitchLabelSyntax) ); return !hasDecitionTree || AreEquivalentSwitchStatementDecisionTrees(oldNode, newNode); } @@ -1313,10 +1313,9 @@ CancellationToken cancellationToken var recordType = (INamedTypeSymbol?) model.GetDeclaredSymbol(declaration.Parent, cancellationToken); Contract.ThrowIfNull(recordType); - return recordType.InstanceConstructors.Single( - ctor => - ctor.DeclaringSyntaxReferences is [var syntaxRef] - && syntaxRef.GetSyntax(cancellationToken) == declaration.Parent + return recordType.InstanceConstructors.Single(ctor => + ctor.DeclaringSyntaxReferences is [var syntaxRef] + && syntaxRef.GetSyntax(cancellationToken) == declaration.Parent ); } diff --git a/roslyn/src/Features/CSharp/Portable/EditAndContinue/SyntaxUtilities.cs b/roslyn/src/Features/CSharp/Portable/EditAndContinue/SyntaxUtilities.cs index a4273cd97f9..fb4863e2ce8 100644 --- a/roslyn/src/Features/CSharp/Portable/EditAndContinue/SyntaxUtilities.cs +++ b/roslyn/src/Features/CSharp/Portable/EditAndContinue/SyntaxUtilities.cs @@ -260,8 +260,8 @@ public static bool HasBackingField(PropertyDeclarationSyntax property) } return property.ExpressionBody == null - && property.AccessorList!.Accessors.Any( - e => e.Body == null && e.ExpressionBody == null + && property.AccessorList!.Accessors.Any(e => + e.Body == null && e.ExpressionBody == null ); } diff --git a/roslyn/src/Features/CSharp/Portable/ExternalAccess/Pythia/PythiaDeclarationNameRecommender.cs b/roslyn/src/Features/CSharp/Portable/ExternalAccess/Pythia/PythiaDeclarationNameRecommender.cs index c03c94a487e..046121f4bc0 100644 --- a/roslyn/src/Features/CSharp/Portable/ExternalAccess/Pythia/PythiaDeclarationNameRecommender.cs +++ b/roslyn/src/Features/CSharp/Portable/ExternalAccess/Pythia/PythiaDeclarationNameRecommender.cs @@ -46,15 +46,14 @@ CancellationToken cancellationToken .ConfigureAwait(false); // We just pick the first possible symbol kind for glyph. - return result.SelectAsArray( - name => - ( - name, - NameDeclarationInfo.GetGlyph( - NameDeclarationInfo.GetSymbolKind(nameInfo.PossibleSymbolKinds[0]), - nameInfo.DeclaredAccessibility - ) + return result.SelectAsArray(name => + ( + name, + NameDeclarationInfo.GetGlyph( + NameDeclarationInfo.GetSymbolKind(nameInfo.PossibleSymbolKinds[0]), + nameInfo.DeclaredAccessibility ) + ) ); } } diff --git a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs index ff25afb6429..30a299ad06d 100644 --- a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs +++ b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.CSharpCodeGenerator.cs @@ -419,8 +419,8 @@ CancellationToken cancellationToken cancellationToken ); - statements = statements.SelectAsArray( - s => FixDeclarationExpressionsAndDeclarationPatterns(s, variableToRemoveMap) + statements = statements.SelectAsArray(s => + FixDeclarationExpressionsAndDeclarationPatterns(s, variableToRemoveMap) ); foreach (var statement in statements) @@ -551,11 +551,10 @@ HashSet variablesToRemove var declarations = statement .DescendantNodes() - .Where( - n => - n.Kind() - is SyntaxKind.DeclarationExpression - or SyntaxKind.DeclarationPattern + .Where(n => + n.Kind() + is SyntaxKind.DeclarationExpression + or SyntaxKind.DeclarationPattern ); foreach (var node in declarations) @@ -768,16 +767,15 @@ protected override ExpressionSyntax CreateCallSignature() if ( AnalyzerResult .ReturnType.GetMembers() - .Any( - static x => - x - is IMethodSymbol - { - Name: nameof(Task.ConfigureAwait), - Parameters: [ - { Type.SpecialType: SpecialType.System_Boolean } - ], - } + .Any(static x => + x + is IMethodSymbol + { + Name: nameof(Task.ConfigureAwait), + Parameters: [ + { Type.SpecialType: SpecialType.System_Boolean } + ], + } ) ) { @@ -989,15 +987,14 @@ static bool ReturnOperationBelongsToMethod( SyntaxNode methodSyntax ) { - var enclosingMethod = returnOperationSyntax.FirstAncestorOrSelf( - n => - n switch - { - BaseMethodDeclarationSyntax _ => true, - AnonymousFunctionExpressionSyntax _ => true, - LocalFunctionStatementSyntax _ => true, - _ => false - } + var enclosingMethod = returnOperationSyntax.FirstAncestorOrSelf(n => + n switch + { + BaseMethodDeclarationSyntax _ => true, + AnonymousFunctionExpressionSyntax _ => true, + LocalFunctionStatementSyntax _ => true, + _ => false + } ); return enclosingMethod == methodSyntax; diff --git a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.TriviaResult.cs b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.TriviaResult.cs index d874855bff5..0df630d842d 100644 --- a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.TriviaResult.cs +++ b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpMethodExtractor.TriviaResult.cs @@ -25,7 +25,9 @@ CancellationToken cancellationToken ) { var preservationService = - selectionResult.SemanticDocument.Document.Project.Services.GetService(); + selectionResult.SemanticDocument.Document.Project.Services.GetService( + + ); var root = selectionResult.SemanticDocument.Root; var result = preservationService.SaveTriviaAroundSelection( root, diff --git a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionResult.ExpressionResult.cs b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionResult.ExpressionResult.cs index c5e63778d72..4484eb65d35 100644 --- a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionResult.ExpressionResult.cs +++ b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionResult.ExpressionResult.cs @@ -69,8 +69,9 @@ public override (ITypeSymbol? returnType, bool returnsByRef) GetReturnType() // special case for array initializer and explicit cast if (node.IsArrayInitializer()) { - var variableDeclExpression = - node.GetAncestorOrThis(); + var variableDeclExpression = node.GetAncestorOrThis( + + ); if (variableDeclExpression != null) return ( model.GetTypeInfo(variableDeclExpression.Type).Type, diff --git a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs index 551ff2af86a..e1963ac9ed9 100644 --- a/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs +++ b/roslyn/src/Features/CSharp/Portable/ExtractMethod/CSharpSelectionValidator.cs @@ -72,12 +72,11 @@ CancellationToken cancellationToken ); if (statementRange == null) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Cannot_determine_valid_range_of_statements_to_extract - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Cannot_determine_valid_range_of_statements_to_extract + ) ); return (null, selectionInfo.Status); } @@ -93,12 +92,8 @@ CancellationToken cancellationToken // check control flow only if we are extracting statement level, not expression // level. you can not have goto that moves control out of scope in expression level // (even in lambda) - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: true, - CSharpFeaturesResources.Not_all_code_paths_return - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With(succeeded: true, CSharpFeaturesResources.Not_all_code_paths_return) ); } } @@ -141,24 +136,22 @@ bool localFunction // Cannot extract a local function from a global statement in script code if (localFunction && options is { Kind: SourceCodeKind.Script }) { - return selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Selection_cannot_include_global_statements - ) + return selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Selection_cannot_include_global_statements + ) ); } // Cannot extract a method from a top-level statement in normal code if (!localFunction && options is { Kind: SourceCodeKind.Regular }) { - return selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Selection_cannot_include_top_level_statements - ) + return selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Selection_cannot_include_top_level_statements + ) ); } } @@ -175,12 +168,11 @@ is SyntaxKind.BaseConstructorInitializer or SyntaxKind.ThisConstructorInitializer ) { - return selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Selection_cannot_be_in_constructor_initializer - ) + return selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Selection_cannot_be_in_constructor_initializer + ) ); } @@ -214,17 +206,11 @@ or SyntaxKind.ThisConstructorInitializer return AssignFinalSpan( selectionInfo - .With( - s => - s.FirstTokenInFinalSpan = assign.Right.GetFirstToken( - includeZeroWidth: true - ) + .With(s => + s.FirstTokenInFinalSpan = assign.Right.GetFirstToken(includeZeroWidth: true) ) - .With( - s => - s.LastTokenInFinalSpan = assign.Right.GetLastToken( - includeZeroWidth: true - ) + .With(s => + s.LastTokenInFinalSpan = assign.Right.GetLastToken(includeZeroWidth: true) ), text ); @@ -268,13 +254,10 @@ CancellationToken cancellationToken { // couldn't find any valid node return selectionInfo - .WithStatus( - s => - new OperationStatus( - succeeded: false, - CSharpFeaturesResources.Selection_does_not_contain_a_valid_node - ) - ) + .WithStatus(s => new OperationStatus( + succeeded: false, + CSharpFeaturesResources.Selection_does_not_contain_a_valid_node + )) .With(s => s.FirstTokenInFinalSpan = default) .With(s => s.LastTokenInFinalSpan = default); } @@ -287,15 +270,11 @@ CancellationToken cancellationToken return selectionInfo .With(s => s.SelectionInExpression = firstValidNode is ExpressionSyntax) .With(s => s.SelectionInSingleStatement = firstValidNode is StatementSyntax) - .With( - s => - s.FirstTokenInFinalSpan = firstValidNode.GetFirstToken( - includeZeroWidth: true - ) + .With(s => + s.FirstTokenInFinalSpan = firstValidNode.GetFirstToken(includeZeroWidth: true) ) - .With( - s => - s.LastTokenInFinalSpan = firstValidNode.GetLastToken(includeZeroWidth: true) + .With(s => + s.LastTokenInFinalSpan = firstValidNode.GetLastToken(includeZeroWidth: true) ); } @@ -430,9 +409,8 @@ SyntaxNode root || selectionInfo.LastTokenInFinalSpan.IsMissing ) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With(succeeded: false, CSharpFeaturesResources.Contains_invalid_selection) + selectionInfo = selectionInfo.WithStatus(s => + s.With(succeeded: false, CSharpFeaturesResources.Contains_invalid_selection) ); } @@ -446,48 +424,44 @@ SyntaxNode root && commonNode.HasDiagnostics() ) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.The_selection_contains_syntactic_errors - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.The_selection_contains_syntactic_errors + ) ); } var tokens = root.DescendantTokens(selectionInfo.FinalSpan); if (tokens.ContainPreprocessorCrossOver(selectionInfo.FinalSpan)) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: true, - CSharpFeaturesResources.Selection_can_not_cross_over_preprocessor_directives - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: true, + CSharpFeaturesResources.Selection_can_not_cross_over_preprocessor_directives + ) ); } // TODO : check whether this can be handled by control flow analysis engine if (tokens.Any(t => t.Kind() == SyntaxKind.YieldKeyword)) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: true, - CSharpFeaturesResources.Selection_can_not_contain_a_yield_statement - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: true, + CSharpFeaturesResources.Selection_can_not_contain_a_yield_statement + ) ); } // TODO : check behavior of control flow analysis engine around exception and exception handling. if (tokens.ContainArgumentlessThrowWithoutEnclosingCatch(selectionInfo.FinalSpan)) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: true, - CSharpFeaturesResources.Selection_can_not_contain_throw_statement - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: true, + CSharpFeaturesResources.Selection_can_not_contain_throw_statement + ) ); } @@ -496,23 +470,21 @@ SyntaxNode root && commonNode.PartOfConstantInitializerExpression() ) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Selection_can_not_be_part_of_constant_initializer_expression - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Selection_can_not_be_part_of_constant_initializer_expression + ) ); } if (commonNode.IsUnsafeContext()) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - s.Succeeded, - CSharpFeaturesResources.The_selected_code_is_inside_an_unsafe_context - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + s.Succeeded, + CSharpFeaturesResources.The_selected_code_is_inside_an_unsafe_context + ) ); } @@ -521,12 +493,11 @@ SyntaxNode root // https://github.com/dotnet/roslyn/issues/9244 if (commonNode.Kind() == SyntaxKind.IsPatternExpression) { - selectionInfo = selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.Selection_can_not_contain_a_pattern_expression - ) + selectionInfo = selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.Selection_can_not_contain_a_pattern_expression + ) ); } @@ -546,17 +517,15 @@ CancellationToken cancellationToken { // simple expression case return selectionInfo - .With( - s => - s.FirstTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetFirstToken( - includeZeroWidth: true - ) + .With(s => + s.FirstTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetFirstToken( + includeZeroWidth: true + ) ) - .With( - s => - s.LastTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetLastToken( - includeZeroWidth: true - ) + .With(s => + s.LastTokenInFinalSpan = s.CommonRootFromOriginalSpan.GetLastToken( + includeZeroWidth: true + ) ); } @@ -572,12 +541,11 @@ CancellationToken cancellationToken if (range == null) { - return selectionInfo.WithStatus( - s => - s.With( - succeeded: false, - CSharpFeaturesResources.No_valid_statement_range_to_extract - ) + return selectionInfo.WithStatus(s => + s.With( + succeeded: false, + CSharpFeaturesResources.No_valid_statement_range_to_extract + ) ); } @@ -593,42 +561,33 @@ CancellationToken cancellationToken { return selectionInfo .With(s => s.SelectionInExpression = true) - .With( - s => - s.FirstTokenInFinalSpan = expression.GetFirstToken( - includeZeroWidth: true - ) + .With(s => + s.FirstTokenInFinalSpan = expression.GetFirstToken( + includeZeroWidth: true + ) ) - .With( - s => - s.LastTokenInFinalSpan = expression.GetLastToken( - includeZeroWidth: true - ) + .With(s => + s.LastTokenInFinalSpan = expression.GetLastToken(includeZeroWidth: true) ); } // single statement case return selectionInfo .With(s => s.SelectionInSingleStatement = true) - .With( - s => - s.FirstTokenInFinalSpan = statement1.GetFirstToken( - includeZeroWidth: true - ) + .With(s => + s.FirstTokenInFinalSpan = statement1.GetFirstToken(includeZeroWidth: true) ) - .With( - s => - s.LastTokenInFinalSpan = statement1.GetLastToken(includeZeroWidth: true) + .With(s => + s.LastTokenInFinalSpan = statement1.GetLastToken(includeZeroWidth: true) ); } // move only statements inside of the block return selectionInfo - .With( - s => s.FirstTokenInFinalSpan = statement1.GetFirstToken(includeZeroWidth: true) + .With(s => + s.FirstTokenInFinalSpan = statement1.GetFirstToken(includeZeroWidth: true) ) - .With( - s => s.LastTokenInFinalSpan = statement2.GetLastToken(includeZeroWidth: true) + .With(s => s.LastTokenInFinalSpan = statement2.GetLastToken(includeZeroWidth: true) ); } @@ -654,8 +613,8 @@ private static SelectionInfo AssignFinalSpan(SelectionInfo selectionInfo, Source ) : selectionInfo.LastTokenInFinalSpan.FullSpan.End; - return selectionInfo.With( - s => s.FinalSpan = GetAdjustedSpan(text, TextSpan.FromBounds(start, end)) + return selectionInfo.With(s => + s.FinalSpan = GetAdjustedSpan(text, TextSpan.FromBounds(start, end)) ); } @@ -680,14 +639,13 @@ IEnumerable jumpsOutOfRegion } var returnableConstructPairs = returnStatements - .Select( - r => - ( - r, - r.GetAncestors() - .Where(a => a.IsReturnableConstruct()) - .FirstOrDefault() - ) + .Select(r => + ( + r, + r.GetAncestors() + .Where(a => a.IsReturnableConstruct()) + .FirstOrDefault() + ) ) .Where(p => p.Item2 != null); diff --git a/roslyn/src/Features/CSharp/Portable/ExtractMethod/Extensions.cs b/roslyn/src/Features/CSharp/Portable/ExtractMethod/Extensions.cs index 8cfba12521b..18619e93637 100644 --- a/roslyn/src/Features/CSharp/Portable/ExtractMethod/Extensions.cs +++ b/roslyn/src/Features/CSharp/Portable/ExtractMethod/Extensions.cs @@ -128,11 +128,10 @@ public static bool UnderValidContext(this SyntaxToken token) => public static bool PartOfConstantInitializerExpression(this SyntaxNode node) { - return node.PartOfConstantInitializerExpression( - n => n.Modifiers + return node.PartOfConstantInitializerExpression(n => n.Modifiers ) - || node.PartOfConstantInitializerExpression( - n => n.Modifiers + || node.PartOfConstantInitializerExpression(n => + n.Modifiers ); } diff --git a/roslyn/src/Features/CSharp/Portable/GenerateConstructor/CSharpGenerateConstructorService.cs b/roslyn/src/Features/CSharp/Portable/GenerateConstructor/CSharpGenerateConstructorService.cs index caa6acb8288..b155b43d697 100644 --- a/roslyn/src/Features/CSharp/Portable/GenerateConstructor/CSharpGenerateConstructorService.cs +++ b/roslyn/src/Features/CSharp/Portable/GenerateConstructor/CSharpGenerateConstructorService.cs @@ -86,27 +86,20 @@ out INamedTypeSymbol typeToGenerateIn private static ImmutableArray GetArguments( SeparatedSyntaxList arguments ) => - arguments.SelectAsArray( - a => - new Argument( - a.GetRefKind(), - a.NameColon?.Name.Identifier.ValueText, - a.Expression - ) - ); + arguments.SelectAsArray(a => new Argument( + a.GetRefKind(), + a.NameColon?.Name.Identifier.ValueText, + a.Expression + )); private static ImmutableArray GetArguments( SeparatedSyntaxList arguments ) => - arguments.SelectAsArray( - a => - new Argument( - refKind: RefKind.None, - a.NameEquals?.Name.Identifier.ValueText - ?? a.NameColon?.Name.Identifier.ValueText, - a.Expression - ) - ); + arguments.SelectAsArray(a => new Argument( + refKind: RefKind.None, + a.NameEquals?.Name.Identifier.ValueText ?? a.NameColon?.Name.Identifier.ValueText, + a.Expression + )); protected override bool TryInitializeSimpleNameGenerationState( SemanticDocument document, diff --git a/roslyn/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs b/roslyn/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs index cf1b355211d..24a5e0c4ea1 100644 --- a/roslyn/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementationCodeRefactoringProvider.cs @@ -144,8 +144,8 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex if (offerForSameInterface) { - var interfaceNames = interfaceTypes.Select( - i => i.ToDisplayString(NameAndTypeParametersFormat) + var interfaceNames = interfaceTypes.Select(i => + i.ToDisplayString(NameAndTypeParametersFormat) ); nestedActions.Add( CodeAction.Create( @@ -344,8 +344,8 @@ await UpdateReferencesAsync( editor.ReplaceNode( decl, (currentDecl, g) => - interfaceMembers.Select( - s => ChangeImplementation(g, currentDecl, implMember, s) + interfaceMembers.Select(s => + ChangeImplementation(g, currentDecl, implMember, s) ) ); } diff --git a/roslyn/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs b/roslyn/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs index 92952050793..8cf8f6d3b56 100644 --- a/roslyn/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromPrimaryConstructorParameterCodeRefactoringProvider.cs @@ -416,8 +416,8 @@ CancellationToken cancellationToken ) { foreach ( - var group in parameter.ContainingType.DeclaringSyntaxReferences.GroupBy( - r => r.SyntaxTree + var group in parameter.ContainingType.DeclaringSyntaxReferences.GroupBy(r => + r.SyntaxTree ) ) { diff --git a/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs b/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs index e0afb0cd2e3..8c84d9e42af 100644 --- a/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceLocalForExpressionCodeRefactoringProvider.cs @@ -187,14 +187,13 @@ ExpressionSyntax CreateDeclarationExpression() // otherwise, emit as `(T1 x, T2 y, T3 z) = ...`. Note, the 'T's will get simplified to 'var' if that matches the user's preference. return TupleExpression( SeparatedList( - localTypesAndDesignations.SelectAsArray( - t => - Argument( - DeclarationExpression( - t.type.GenerateTypeSyntax(), - t.designation - ) + localTypesAndDesignations.SelectAsArray(t => + Argument( + DeclarationExpression( + t.type.GenerateTypeSyntax(), + t.designation ) + ) ) ) ); @@ -207,8 +206,8 @@ bool CanUseVar() var varPreference = simplifierOptions.GetUseVarPreference(); // If the user likes 'var' for intrinsics, and all the elements would be intrinsic. Then use - var isIntrinsic = tupleType.TupleElements.All( - f => f.Type?.SpecialType != SpecialType.None + var isIntrinsic = tupleType.TupleElements.All(f => + f.Type?.SpecialType != SpecialType.None ); if (isIntrinsic) return varPreference.HasFlag(UseVarPreference.ForBuiltInTypes); diff --git a/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs b/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs index 4bf95d38645..0ae5675be38 100644 --- a/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs +++ b/roslyn/src/Features/CSharp/Portable/IntroduceVariable/CSharpIntroduceVariableService_IntroduceLocal.cs @@ -32,8 +32,8 @@ CancellationToken cancellationToken { var containerToGenerateInto = expression .Ancestors() - .FirstOrDefault( - s => s is BlockSyntax or ArrowExpressionClauseSyntax or LambdaExpressionSyntax + .FirstOrDefault(s => + s is BlockSyntax or ArrowExpressionClauseSyntax or LambdaExpressionSyntax ); var newLocalNameToken = GenerateUniqueLocalName( @@ -552,10 +552,9 @@ int firstStatementAffectedIndex // Find all the local functions within the scope that will use the new declaration. var localFunctions = innermostCommonBlock .DescendantNodes() - .Where( - node => - node.IsKind(SyntaxKind.LocalFunctionStatement) - && matches.Any(match => match.Span.OverlapsWith(node.Span)) + .Where(node => + node.IsKind(SyntaxKind.LocalFunctionStatement) + && matches.Any(match => match.Span.OverlapsWith(node.Span)) ); if (localFunctions.IsEmpty()) @@ -563,23 +562,22 @@ int firstStatementAffectedIndex return firstStatementAffectedIndex; } - var localFunctionIdentifiers = localFunctions.Select( - node => ((LocalFunctionStatementSyntax)node).Identifier.ValueText + var localFunctionIdentifiers = localFunctions.Select(node => + ((LocalFunctionStatementSyntax)node).Identifier.ValueText ); // Find all calls to the applicable local functions within the scope. var localFunctionCalls = innermostCommonBlock .DescendantNodes() - .Where( - node => - node is InvocationExpressionSyntax invocationExpression - && invocationExpression.Expression.GetRightmostName() != null - && !invocationExpression.Expression.IsKind( - SyntaxKind.SimpleMemberAccessExpression - ) - && localFunctionIdentifiers.Contains( - invocationExpression.Expression.GetRightmostName().Identifier.ValueText - ) + .Where(node => + node is InvocationExpressionSyntax invocationExpression + && invocationExpression.Expression.GetRightmostName() != null + && !invocationExpression.Expression.IsKind( + SyntaxKind.SimpleMemberAccessExpression + ) + && localFunctionIdentifiers.Contains( + invocationExpression.Expression.GetRightmostName().Identifier.ValueText + ) ); if (localFunctionCalls.IsEmpty()) @@ -593,8 +591,8 @@ node is InvocationExpressionSyntax invocationExpression var statementsInBlock = GetStatements(innermostCommonBlock); // Check if our earliest call is before all local function declarations and all matches, and if so, place our new declaration there. - var earliestLocalFunctionCallIndex = statementsInBlock.IndexOf( - s => s.Span.Contains(earliestLocalFunctionCall) + var earliestLocalFunctionCallIndex = statementsInBlock.IndexOf(s => + s.Span.Contains(earliestLocalFunctionCall) ); return Math.Min(earliestLocalFunctionCallIndex, firstStatementAffectedIndex); } @@ -612,8 +610,8 @@ int statementIndex // Grab all the trivia before the line the next statement is on and move it to the new node. var nextStatementLeading = nextStatement.GetLeadingTrivia(); - var precedingEndOfLine = nextStatementLeading.LastOrDefault( - t => t.Kind() == SyntaxKind.EndOfLineTrivia + var precedingEndOfLine = nextStatementLeading.LastOrDefault(t => + t.Kind() == SyntaxKind.EndOfLineTrivia ); if (precedingEndOfLine == default) { diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs index 079d8fe2af1..a56f25359a1 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/AttributeSignatureHelpProvider.cs @@ -144,17 +144,16 @@ is not INamedTypeSymbol attributeType return CreateSignatureHelpItems( accessibleConstructors - .Select( - c => - Convert( - c, - within, - attribute, - semanticModel, - structuralTypeDisplayService, - documentationCommentFormatter, - cancellationToken - ) + .Select(c => + Convert( + c, + within, + attribute, + semanticModel, + structuralTypeDisplayService, + documentationCommentFormatter, + cancellationToken + ) ) .ToList(), textSpan, diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs index 0599756d4f8..d359f05d2dc 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/ElementAccessExpressionSignatureHelpProvider.cs @@ -168,8 +168,8 @@ out expressionType return null; } - var accessibleIndexers = indexers.WhereAsArray( - m => m.IsAccessibleWithin(within, throughType: expressionType) + var accessibleIndexers = indexers.WhereAsArray(m => + m.IsAccessibleWithin(within, throughType: expressionType) ); if (!accessibleIndexers.Any()) { @@ -192,15 +192,14 @@ out expressionType return CreateSignatureHelpItems( accessibleIndexers - .Select( - p => - Convert( - p, - openBrace, - semanticModel, - structuralTypeDisplayService, - documentationCommentFormattingService - ) + .Select(p => + Convert( + p, + openBrace, + semanticModel, + structuralTypeDisplayService, + documentationCommentFormattingService + ) ) .ToList(), textSpan, @@ -379,14 +378,8 @@ IDocumentationCommentFormattingService documentationCommentFormattingService GetSeparatorParts(), GetPostambleParts(), indexer - .Parameters.Select( - p => - Convert( - p, - semanticModel, - position, - documentationCommentFormattingService - ) + .Parameters.Select(p => + Convert(p, semanticModel, position, documentationCommentFormattingService) ) .ToList() ); diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs index 78b415a8f70..a717f234892 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/GenericNameSignatureHelpProvider.cs @@ -174,15 +174,14 @@ out var lessThanToken return CreateSignatureHelpItems( accessibleSymbols - .Select( - s => - Convert( - s, - lessThanToken, - semanticModel, - structuralTypeDisplayService, - documentationCommentFormattingService - ) + .Select(s => + Convert( + s, + lessThanToken, + semanticModel, + structuralTypeDisplayService, + documentationCommentFormattingService + ) ) .ToList(), textSpan, @@ -272,14 +271,13 @@ IDocumentationCommentFormattingService documentationCommentFormattingService GetSeparatorParts(), GetPostambleParts(), namedType - .TypeParameters.Select( - p => - Convert( - p, - semanticModel, - position, - documentationCommentFormattingService - ) + .TypeParameters.Select(p => + Convert( + p, + semanticModel, + position, + documentationCommentFormattingService + ) ) .ToList() ); @@ -304,14 +302,13 @@ IDocumentationCommentFormattingService documentationCommentFormattingService GetSeparatorParts(), GetPostambleParts(method, semanticModel, position), method - .TypeParameters.Select( - p => - Convert( - p, - semanticModel, - position, - documentationCommentFormattingService - ) + .TypeParameters.Select(p => + Convert( + p, + semanticModel, + position, + documentationCommentFormattingService + ) ) .ToList() ); diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs index ad8948daa55..b4b872b5979 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProvider.cs @@ -177,8 +177,8 @@ out var parameterIndexOverride // if the symbol could be bound, replace that item in the symbol list if (currentSymbol?.IsGenericMethod == true) { - methods = methods.SelectAsArray( - m => Equals(currentSymbol.OriginalDefinition, m) ? currentSymbol : m + methods = methods.SelectAsArray(m => + Equals(currentSymbol.OriginalDefinition, m) ? currentSymbol : m ); } diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs index 2fb5777a742..fd3f698d3fb 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/InvocationExpressionSignatureHelpProviderBase_MethodGroup.cs @@ -30,14 +30,13 @@ internal partial class InvocationExpressionSignatureHelpProviderBase CancellationToken cancellationToken ) { - var items = accessibleMethods.SelectAsArray( - method => - ConvertMethodGroupMethod( - document, - method, - invocationExpression.SpanStart, - semanticModel - ) + var items = accessibleMethods.SelectAsArray(method => + ConvertMethodGroupMethod( + document, + method, + invocationExpression.SpanStart, + semanticModel + ) ); var selectedItemIndex = TryGetSelectedIndex(accessibleMethods, currentSymbol); return Task.FromResult((items, selectedItemIndex)); @@ -109,8 +108,8 @@ throughSymbol is INamedTypeSymbol ); Contract.ThrowIfFalse(includeInstance || includeStatic); - methodGroup = methodGroup.Where( - m => (m.IsStatic && includeStatic) || (!m.IsStatic && includeInstance) + methodGroup = methodGroup.Where(m => + (m.IsStatic && includeStatic) || (!m.IsStatic && includeInstance) ); } else if ( @@ -119,8 +118,8 @@ invocationExpression.Expression is SimpleNameSyntax ) { // We always need to include local functions regardless of whether they are static. - methodGroup = methodGroup.Where( - m => m.IsStatic || m is IMethodSymbol { MethodKind: MethodKind.LocalFunction } + methodGroup = methodGroup.Where(m => + m.IsStatic || m is IMethodSymbol { MethodKind: MethodKind.LocalFunction } ); } diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs index a0675235896..bb8bf1b1df4 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/PrimaryConstructorBaseTypeSignatureHelpProvider.cs @@ -133,8 +133,8 @@ is not INamedTypeSymbol baseType var accessibleConstructors = baseType .InstanceConstructors.WhereAsArray(c => c.IsAccessibleWithin(within)) - .WhereAsArray( - c => c.IsEditorBrowsable(options.HideAdvancedMembers, semanticModel.Compilation) + .WhereAsArray(c => + c.IsEditorBrowsable(options.HideAdvancedMembers, semanticModel.Compilation) ) .Sort(semanticModel, baseTypeSyntax.SpanStart); @@ -153,15 +153,14 @@ is not INamedTypeSymbol baseType return CreateSignatureHelpItems( accessibleConstructors - .SelectAsArray( - c => - Convert( - c, - baseTypeSyntax.ArgumentList.OpenParenToken, - semanticModel, - structuralTypeDisplayService, - documentationCommentFormattingService - ) + .SelectAsArray(c => + Convert( + c, + baseTypeSyntax.ArgumentList.OpenParenToken, + semanticModel, + structuralTypeDisplayService, + documentationCommentFormattingService + ) ) .ToList(), textSpan, @@ -222,8 +221,8 @@ IDocumentationCommentFormattingService documentationCommentFormattingService GetSeparatorParts(), GetPostambleParts(), constructor - .Parameters.Select( - p => Convert(p, semanticModel, position, documentationCommentFormattingService) + .Parameters.Select(p => + Convert(p, semanticModel, position, documentationCommentFormattingService) ) .ToList() ); diff --git a/roslyn/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs b/roslyn/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs index 8657c5b6f5d..695840d3df3 100644 --- a/roslyn/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/SignatureHelp/TupleConstructionSignatureHelpProvider.cs @@ -288,16 +288,15 @@ CancellationToken cancellationToken var separatorParts = GetSeparatorParts().ToTaggedText(); var items = tupleTypes - .Select( - tupleType => - Convert( - tupleType, - prefixParts, - suffixParts, - separatorParts, - semanticModel, - position - ) + .Select(tupleType => + Convert( + tupleType, + prefixParts, + suffixParts, + separatorParts, + semanticModel, + position + ) ) .ToList(); diff --git a/roslyn/src/Features/CSharp/Portable/UseAutoProperty/CSharpUseAutoPropertyCodeFixProvider.cs b/roslyn/src/Features/CSharp/Portable/UseAutoProperty/CSharpUseAutoPropertyCodeFixProvider.cs index 9b1ca6164ae..2970fe98dc2 100644 --- a/roslyn/src/Features/CSharp/Portable/UseAutoProperty/CSharpUseAutoPropertyCodeFixProvider.cs +++ b/roslyn/src/Features/CSharp/Portable/UseAutoProperty/CSharpUseAutoPropertyCodeFixProvider.cs @@ -91,8 +91,8 @@ CancellationToken cancellationToken } var modifiers = SyntaxFactory.TokenList( - updatedProperty.Modifiers.Where( - token => !token.IsKind(SyntaxKind.ReadOnlyKeyword) + updatedProperty.Modifiers.Where(token => + !token.IsKind(SyntaxKind.ReadOnlyKeyword) ) ); diff --git a/roslyn/src/Features/CSharpTest/AddUsing/AddUsingNuGetTests.cs b/roslyn/src/Features/CSharpTest/AddUsing/AddUsingNuGetTests.cs index 1add37a22cc..bcc133bde4d 100644 --- a/roslyn/src/Features/CSharpTest/AddUsing/AddUsingNuGetTests.cs +++ b/roslyn/src/Features/CSharpTest/AddUsing/AddUsingNuGetTests.cs @@ -83,30 +83,28 @@ public async Task TestSearchPackageCustomFeedName() .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(packageSources); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult(true)); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -115,14 +113,13 @@ public async Task TestSearchPackageCustomFeedName() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -168,30 +165,28 @@ public async Task TestSearchPackageFakeNugetFeed() .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(packageSources); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(Task.FromResult(true)); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -200,14 +195,13 @@ public async Task TestSearchPackageFakeNugetFeed() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - "nuget.org", - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + "nuget.org", + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -249,30 +243,28 @@ public async Task TestSearchPackageSingleName() .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(SpecializedTasks.True); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -281,14 +273,13 @@ public async Task TestSearchPackageSingleName() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -330,30 +321,28 @@ public async Task TestSearchPackageMultipleNames() .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - It.IsAny(), - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + It.IsAny(), + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(SpecializedTasks.True); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -362,14 +351,13 @@ public async Task TestSearchPackageMultipleNames() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -410,13 +398,12 @@ public async Task TestMissingIfPackageAlreadyInstalled() var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -425,14 +412,13 @@ public async Task TestMissingIfPackageAlreadyInstalled() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -466,23 +452,13 @@ public async Task TestOptionsOffered() .Setup(i => i.IsInstalled(It.IsAny(), "NuGetPackage")) .Returns(false); installerServiceMock - .Setup( - i => - i.GetProjectsWithInstalledPackage( - It.IsAny(), - "NuGetPackage", - "1.0" - ) + .Setup(i => + i.GetProjectsWithInstalledPackage(It.IsAny(), "NuGetPackage", "1.0") ) .Returns(ImmutableArray.Empty); installerServiceMock - .Setup( - i => - i.GetProjectsWithInstalledPackage( - It.IsAny(), - "NuGetPackage", - "2.0" - ) + .Setup(i => + i.GetProjectsWithInstalledPackage(It.IsAny(), "NuGetPackage", "2.0") ) .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); @@ -492,13 +468,12 @@ public async Task TestOptionsOffered() var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -507,14 +482,13 @@ public async Task TestOptionsOffered() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -567,30 +541,28 @@ public async Task TestInstallGetsCalledNoVersion() .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", /*versionOpt*/ - null, - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", /*versionOpt*/ + null, + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(SpecializedTasks.True); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -599,14 +571,13 @@ public async Task TestInstallGetsCalledNoVersion() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -645,13 +616,8 @@ public async Task TestInstallGetsCalledWithVersion() .Setup(i => i.IsInstalled(It.IsAny(), "NuGetPackage")) .Returns(false); installerServiceMock - .Setup( - i => - i.GetProjectsWithInstalledPackage( - It.IsAny(), - "NuGetPackage", - "1.0" - ) + .Setup(i => + i.GetProjectsWithInstalledPackage(It.IsAny(), "NuGetPackage", "1.0") ) .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); @@ -659,30 +625,28 @@ public async Task TestInstallGetsCalledWithVersion() .Setup(s => s.GetInstalledVersions("NuGetPackage")) .Returns(ImmutableArray.Create("1.0")); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - "1.0", - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + "1.0", + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(SpecializedTasks.True); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -691,14 +655,13 @@ public async Task TestInstallGetsCalledWithVersion() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -737,13 +700,8 @@ public async Task TestFailedInstallRollsBackFile() .Setup(i => i.IsInstalled(It.IsAny(), "NuGetPackage")) .Returns(false); installerServiceMock - .Setup( - i => - i.GetProjectsWithInstalledPackage( - It.IsAny(), - "NuGetPackage", - "1.0" - ) + .Setup(i => + i.GetProjectsWithInstalledPackage(It.IsAny(), "NuGetPackage", "1.0") ) .Returns(ImmutableArray.Empty); installerServiceMock.Setup(i => i.TryGetPackageSources()).Returns(NugetPackageSources); @@ -751,30 +709,28 @@ public async Task TestFailedInstallRollsBackFile() .Setup(s => s.GetInstalledVersions("NuGetPackage")) .Returns(ImmutableArray.Create("1.0")); installerServiceMock - .Setup( - s => - s.TryInstallPackageAsync( - It.IsAny(), - It.IsAny(), - It.IsAny(), - "NuGetPackage", - "1.0", - It.IsAny(), - It.IsAny>(), - It.IsAny() - ) + .Setup(s => + s.TryInstallPackageAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + "NuGetPackage", + "1.0", + It.IsAny(), + It.IsAny>(), + It.IsAny() + ) ) .Returns(SpecializedTasks.False); var packageServiceMock = new Mock(MockBehavior.Strict); packageServiceMock - .Setup( - s => - s.FindReferenceAssembliesWithTypeAsync( - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindReferenceAssembliesWithTypeAsync( + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => @@ -783,14 +739,13 @@ public async Task TestFailedInstallRollsBackFile() ) ); packageServiceMock - .Setup( - s => - s.FindPackagesWithTypeAsync( - PackageSourceHelper.NugetOrgSourceName, - "NuGetType", - 0, - It.IsAny() - ) + .Setup(s => + s.FindPackagesWithTypeAsync( + PackageSourceHelper.NugetOrgSourceName, + "NuGetType", + 0, + It.IsAny() + ) ) .Returns( () => diff --git a/roslyn/src/Features/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs b/roslyn/src/Features/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs index 1ba12fc2908..5e9b1658dad 100644 --- a/roslyn/src/Features/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs +++ b/roslyn/src/Features/CSharpTest/GenerateFromMembers/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs @@ -2368,10 +2368,9 @@ public override bool Equals(object obj) MemberNames = default, OptionsCallback = options => Assert.Null( - options.FirstOrDefault( - i => - i.Id - == GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.GenerateOperatorsId + options.FirstOrDefault(i => + i.Id + == GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.GenerateOperatorsId ) ), LanguageVersion = LanguageVersion.CSharp6, @@ -3099,10 +3098,9 @@ public override bool Equals(object obj) MemberNames = default, OptionsCallback = options => Assert.Null( - options.FirstOrDefault( - i => - i.Id - == GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.ImplementIEquatableId + options.FirstOrDefault(i => + i.Id + == GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider.ImplementIEquatableId ) ), LanguageVersion = LanguageVersion.CSharp6, diff --git a/roslyn/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs b/roslyn/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs index 498b8fe590d..beab224f665 100644 --- a/roslyn/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs +++ b/roslyn/src/Features/Core/Portable/AddImport/SymbolReferenceFinder.cs @@ -280,11 +280,10 @@ out var looksGeneric .ConfigureAwait(false); symbols = symbols.AddRange( - attributeSymbols.Select( - r => - r.WithDesiredName( - r.DesiredName.GetWithoutAttributeSuffix(isCaseSensitive: false) - ) + attributeSymbols.Select(r => + r.WithDesiredName( + r.DesiredName.GetWithoutAttributeSuffix(isCaseSensitive: false) + ) ) ); } @@ -295,42 +294,41 @@ out var looksGeneric // Only keep symbols which are accessible from the current location and that are allowed by the current // editor browsable rules. - var accessibleTypeSymbols = typeSymbols.WhereAsArray( - s => - ArityAccessibilityAndAttributeContextAreCorrect( - s.Symbol, - arity, - inAttributeContext, - hasIncompleteParentMember, - looksGeneric - ) - && s.Symbol.IsEditorBrowsable( - _options.HideAdvancedMembers, - _semanticModel.Compilation, - editorBrowserInfo - ) + var accessibleTypeSymbols = typeSymbols.WhereAsArray(s => + ArityAccessibilityAndAttributeContextAreCorrect( + s.Symbol, + arity, + inAttributeContext, + hasIncompleteParentMember, + looksGeneric + ) + && s.Symbol.IsEditorBrowsable( + _options.HideAdvancedMembers, + _semanticModel.Compilation, + editorBrowserInfo + ) ); // These types may be contained within namespaces, or they may be nested // inside generic types. Record these namespaces/types if it would be // legal to add imports for them. - var typesContainedDirectlyInNamespaces = accessibleTypeSymbols.WhereAsArray( - s => s.Symbol.ContainingSymbol is INamespaceSymbol + var typesContainedDirectlyInNamespaces = accessibleTypeSymbols.WhereAsArray(s => + s.Symbol.ContainingSymbol is INamespaceSymbol ); - var typesContainedDirectlyInTypes = accessibleTypeSymbols.WhereAsArray( - s => s.Symbol.ContainingType != null + var typesContainedDirectlyInTypes = accessibleTypeSymbols.WhereAsArray(s => + s.Symbol.ContainingType != null ); var namespaceReferences = GetNamespaceSymbolReferences( searchScope, - typesContainedDirectlyInNamespaces.SelectAsArray( - r => r.WithSymbol(r.Symbol.ContainingNamespace) + typesContainedDirectlyInNamespaces.SelectAsArray(r => + r.WithSymbol(r.Symbol.ContainingNamespace) ) ); - var typeReferences = typesContainedDirectlyInTypes.SelectAsArray( - r => searchScope.CreateReference(r.WithSymbol(r.Symbol.ContainingType)) + var typeReferences = typesContainedDirectlyInTypes.SelectAsArray(r => + searchScope.CreateReference(r.WithSymbol(r.Symbol.ContainingType)) ); return namespaceReferences.Concat(typeReferences); @@ -476,12 +474,11 @@ propertyOrFieldType is INamedTypeSymbol propertyType var namedTypeSymbols = OfType(symbolResults); var name = nameNode.GetFirstToken().ValueText; var namespaceResults = namedTypeSymbols - .WhereAsArray( - sr => - HasAccessibleStaticFieldOrProperty(sr.Symbol, name) + .WhereAsArray(sr => + HasAccessibleStaticFieldOrProperty(sr.Symbol, name) ) - .SelectAsArray( - sr => sr.WithSymbol(sr.Symbol.ContainingNamespace) + .SelectAsArray(sr => + sr.WithSymbol(sr.Symbol.ContainingNamespace) ); return GetNamespaceSymbolReferences( @@ -571,8 +568,8 @@ out var arity cancellationToken ); - var namespaceSymbols = extensionMethodSymbols.SelectAsArray( - s => s.WithSymbol(s.Symbol.ContainingNamespace) + var namespaceSymbols = extensionMethodSymbols.SelectAsArray(s => + s.WithSymbol(s.Symbol.ContainingNamespace) ); return GetNamespaceSymbolReferences(searchScope, namespaceSymbols); } @@ -589,15 +586,14 @@ CancellationToken cancellationToken ) { return GetViableExtensionMethodsWorker(methodSymbols) - .WhereAsArray( - s => - _owner.IsViableExtensionMethod( - s.Symbol, - expression, - _semanticModel, - _syntaxFacts, - cancellationToken - ) + .WhereAsArray(s => + _owner.IsViableExtensionMethod( + s.Symbol, + expression, + _semanticModel, + _syntaxFacts, + cancellationToken + ) ); } @@ -614,10 +610,9 @@ private ImmutableArray> GetViableExtensionMethodsWor ImmutableArray> methodSymbols ) { - return methodSymbols.WhereAsArray( - s => - s.Symbol.IsExtensionMethod - && s.Symbol.IsAccessibleWithin(_semanticModel.Compilation.Assembly) + return methodSymbols.WhereAsArray(s => + s.Symbol.IsExtensionMethod + && s.Symbol.IsAccessibleWithin(_semanticModel.Compilation.Assembly) ); } @@ -861,13 +856,13 @@ CancellationToken cancellationToken if (predicate != null) { - viableExtensionMethods = viableExtensionMethods.WhereAsArray( - s => predicate(s.Symbol) + viableExtensionMethods = viableExtensionMethods.WhereAsArray(s => + predicate(s.Symbol) ); } - var namespaceSymbols = viableExtensionMethods.SelectAsArray( - s => s.WithSymbol(s.Symbol.ContainingNamespace) + var namespaceSymbols = viableExtensionMethods.SelectAsArray(s => + s.WithSymbol(s.Symbol.ContainingNamespace) ); return GetNamespaceSymbolReferences(searchScope, namespaceSymbols); diff --git a/roslyn/src/Features/Core/Portable/AddMissingReference/AddMissingReferenceCodeAction.cs b/roslyn/src/Features/Core/Portable/AddMissingReference/AddMissingReferenceCodeAction.cs index e390b25f479..d582f35e75f 100644 --- a/roslyn/src/Features/Core/Portable/AddMissingReference/AddMissingReferenceCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/AddMissingReference/AddMissingReferenceCodeAction.cs @@ -128,7 +128,9 @@ CancellationToken cancellationToken { // We didn't have any project, so we need to try adding a metadata reference var factoryService = - _project.Solution.Services.GetRequiredService(); + _project.Solution.Services.GetRequiredService( + + ); var operation = factoryService.CreateAddMetadataReferenceOperation( _project.Id, _missingAssemblyIdentity diff --git a/roslyn/src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs b/roslyn/src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs index f17368a49e6..5a9047ecc55 100644 --- a/roslyn/src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs +++ b/roslyn/src/Features/Core/Portable/ChangeSignature/AbstractChangeSignatureService.cs @@ -333,7 +333,9 @@ ChangeSignatureAnalyzedContext context } var changeSignatureOptionsService = - succeededContext.Solution.Services.GetRequiredService(); + succeededContext.Solution.Services.GetRequiredService( + + ); return changeSignatureOptionsService.GetChangeSignatureOptions( succeededContext.Document, @@ -1008,8 +1010,8 @@ Func createNewParameterMethod var newParam = reorderedParameters[index]; if (newParam is ExistingParameter existingParameter) { - var pos = originalParameters.IndexOf( - p => p is ExistingParameter ep && ep.Symbol.Equals(existingParameter.Symbol) + var pos = originalParameters.IndexOf(p => + p is ExistingParameter ep && ep.Symbol.Equals(existingParameter.Symbol) ); var param = list[pos]; @@ -1325,8 +1327,8 @@ CancellationToken cancellationToken .OrderByDescending(s => s.Locations.First().SourceSpan.Start); // No particular ordering preference for properties/fields. - var orderedPropertiesAndFields = sourceSymbols.Where( - s => s.IsKind(SymbolKind.Property) || s.IsKind(SymbolKind.Field) + var orderedPropertiesAndFields = sourceSymbols.Where(s => + s.IsKind(SymbolKind.Property) || s.IsKind(SymbolKind.Field) ); var fullyOrderedSymbols = orderedLocalAndParameterSymbols.Concat( diff --git a/roslyn/src/Features/Core/Portable/ChangeSignature/SignatureChange.cs b/roslyn/src/Features/Core/Portable/ChangeSignature/SignatureChange.cs index f51c3a72be0..501172d12ea 100644 --- a/roslyn/src/Features/Core/Portable/ChangeSignature/SignatureChange.cs +++ b/roslyn/src/Features/Core/Portable/ChangeSignature/SignatureChange.cs @@ -36,8 +36,8 @@ ParameterConfiguration updatedConfiguration var parameter = originalParameterList[i]; if (parameter is ExistingParameter existingParameter) { - var updatedIndex = updatedParameterList.IndexOf( - p => p is ExistingParameter ep && ep.Symbol.Equals(existingParameter.Symbol) + var updatedIndex = updatedParameterList.IndexOf(p => + p is ExistingParameter ep && ep.Symbol.Equals(existingParameter.Symbol) ); if (updatedIndex >= 0) { @@ -70,8 +70,8 @@ internal void LogTelemetry() ChangeSignatureLogger.LogTransformationInformation( numOriginalParameters: originalListOfParameters.Length, numParametersAdded: updatedListOfParameters.Count(p => p is AddedParameter), - numParametersRemoved: originalListOfParameters.Count( - p => !updatedListOfParameters.Contains(p) + numParametersRemoved: originalListOfParameters.Count(p => + !updatedListOfParameters.Contains(p) ), anyParametersReordered: AnyParametersReordered( originalListOfParameters, diff --git a/roslyn/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs b/roslyn/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs index 51c76f2b791..2a57b0bb259 100644 --- a/roslyn/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs +++ b/roslyn/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs @@ -259,15 +259,14 @@ FixAllContext fixAllContext { var projects = projectsAndDiagnosticsToFixMap.Keys; var tasks = projects - .Select( - p => - AddProjectFixesAsync( - p, - projectsAndDiagnosticsToFixMap[p], - bag, - fixAllState, - cancellationToken - ) + .Select(p => + AddProjectFixesAsync( + p, + projectsAndDiagnosticsToFixMap[p], + bag, + fixAllState, + cancellationToken + ) ) .ToArray(); diff --git a/roslyn/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs b/roslyn/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs index 9b1a56ddabe..76e44ff2bad 100644 --- a/roslyn/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs +++ b/roslyn/src/Features/Core/Portable/CodeLens/CodeLensReferencesService.cs @@ -311,13 +311,12 @@ CancellationToken cancellationToken async progress => { var referenceTasks = progress - .Locations.Select( - location => - GetDescriptorOfEnclosingSymbolAsync( - solution, - location, - cancellationToken - ) + .Locations.Select(location => + GetDescriptorOfEnclosingSymbolAsync( + solution, + location, + cancellationToken + ) ) .ToArray(); @@ -408,9 +407,8 @@ CancellationToken cancellationToken async progress => { var descriptorTasks = progress - .Locations.Select( - location => - TryGetMethodDescriptorAsync(location, solution, cancellationToken) + .Locations.Select(location => + TryGetMethodDescriptorAsync(location, solution, cancellationToken) ) .ToArray(); diff --git a/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.MoveTypeEditor.cs b/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.MoveTypeEditor.cs index f9b17ae9e01..aa61e1d51ef 100644 --- a/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.MoveTypeEditor.cs +++ b/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.MoveTypeEditor.cs @@ -105,7 +105,9 @@ DocumentId documentWithMovedTypeId var syntaxFacts = documentWithMovedType.GetRequiredLanguageService(); var removeUnnecessaryImports = - documentWithMovedType.GetRequiredLanguageService(); + documentWithMovedType.GetRequiredLanguageService( + + ); // Remove all unnecessary imports from the new document we've created. documentWithMovedType = await removeUnnecessaryImports @@ -352,7 +354,9 @@ bool removeTypeInheritance ) { var semanticFacts = - State.SemanticDocument.Document.GetRequiredLanguageService(); + State.SemanticDocument.Document.GetRequiredLanguageService( + + ); var typeChain = State.TypeNode.Ancestors().OfType(); foreach (var node in typeChain) @@ -402,9 +406,13 @@ TTypeDeclarationSyntax currentTypeNode ) { var syntaxFacts = - State.SemanticDocument.Document.GetRequiredLanguageService(); + State.SemanticDocument.Document.GetRequiredLanguageService( + + ); var bannerService = - State.SemanticDocument.Document.GetRequiredLanguageService(); + State.SemanticDocument.Document.GetRequiredLanguageService( + + ); var withoutBlankLines = bannerService.GetNodeWithoutLeadingBlankLines( currentTypeNode diff --git a/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.State.cs b/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.State.cs index 024d22dfae5..7febb6432c5 100644 --- a/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.State.cs +++ b/roslyn/src/Features/Core/Portable/CodeRefactorings/MoveType/AbstractMoveTypeService.State.cs @@ -66,8 +66,9 @@ CancellationToken cancellationToken var tree = SemanticDocument.SyntaxTree; var root = SemanticDocument.Root; - var syntaxFacts = - SemanticDocument.Document.GetLanguageService(); + var syntaxFacts = SemanticDocument.Document.GetLanguageService( + + ); // compiler declared types, anonymous types, types defined in metadata should be filtered out. if ( diff --git a/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs b/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs index 9726194a3d1..9dee3eceaad 100644 --- a/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs +++ b/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractChangeNamespaceService.cs @@ -627,13 +627,12 @@ CancellationToken cancellationToken var refLocationsInOtherDocuments = new List(); var refLocations = await Task.WhenAll( - declaredSymbols.Select( - declaredSymbol => - FindReferenceLocationsForSymbolAsync( - document, - declaredSymbol, - cancellationToken - ) + declaredSymbols.Select(declaredSymbol => + FindReferenceLocationsForSymbolAsync( + document, + declaredSymbol, + cancellationToken + ) ) ) .ConfigureAwait(false); @@ -677,9 +676,8 @@ CancellationToken cancellationToken FatalError.ReportNonFatalError( new SyncNamespaceDocumentsNotInSolutionException( refLocationsInOtherDocuments - .Where( - loc => - !solutionWithChangedNamespace.ContainsDocument(loc.Document.Id) + .Where(loc => + !solutionWithChangedNamespace.ContainsDocument(loc.Document.Id) ) .Distinct() .SelectAsArray(loc => loc.Document.Id) @@ -690,17 +688,14 @@ CancellationToken cancellationToken var refLocationGroups = refLocationsInSolution.GroupBy(loc => loc.Document.Id); var fixedDocuments = await Task.WhenAll( - refLocationGroups.Select( - refInOneDocument => - FixReferencingDocumentAsync( - solutionWithChangedNamespace.GetRequiredDocument( - refInOneDocument.Key - ), - refInOneDocument, - newNamespace, - fallbackOptions, - cancellationToken - ) + refLocationGroups.Select(refInOneDocument => + FixReferencingDocumentAsync( + solutionWithChangedNamespace.GetRequiredDocument(refInOneDocument.Key), + refInOneDocument, + newNamespace, + fallbackOptions, + cancellationToken + ) ) ) .ConfigureAwait(false); @@ -762,13 +757,10 @@ CancellationToken cancellationToken referencedSymbols .Where(refSymbol => refSymbol.Definition.Equals(symbol)) .SelectMany(refSymbol => refSymbol.Locations) - .Select( - location => - new LocationForAffectedSymbol( - location, - isReferenceToExtensionMethod: false - ) - ) + .Select(location => new LocationForAffectedSymbol( + location, + isReferenceToExtensionMethod: false + )) ); // So far we only have references to types declared in affected namespace. We also need to @@ -792,13 +784,10 @@ CancellationToken cancellationToken builder.AddRange( referencedMethodSymbols .SelectMany(refSymbol => refSymbol.Locations) - .Select( - location => - new LocationForAffectedSymbol( - location, - isReferenceToExtensionMethod: true - ) - ) + .Select(location => new LocationForAffectedSymbol( + location, + isReferenceToExtensionMethod: true + )) ); } } @@ -1114,12 +1103,11 @@ out var newNode .ConfigureAwait(false); var result = ( fixedDocument, - containers.SelectAsArray( - c => - root.GetCurrentNode(c) - ?? throw new InvalidOperationException( - "Can't get SyntaxNode from GetCurrentNode." - ) + containers.SelectAsArray(c => + root.GetCurrentNode(c) + ?? throw new InvalidOperationException( + "Can't get SyntaxNode from GetCurrentNode." + ) ) ); @@ -1160,13 +1148,12 @@ CancellationToken cancellationToken var documentsToProcess = documentsToProcessBuilder.ToImmutableAndFree(); var changeDocuments = await Task.WhenAll( - documentsToProcess.Select( - doc => - RemoveUnnecessaryImportsWorkerAsync( - doc, - CreateImports(doc, names, withFormatterAnnotation: false), - cancellationToken - ) + documentsToProcess.Select(doc => + RemoveUnnecessaryImportsWorkerAsync( + doc, + CreateImports(doc, names, withFormatterAnnotation: false), + cancellationToken + ) ) ) .ConfigureAwait(false); @@ -1193,8 +1180,8 @@ CancellationToken token .RemoveUnnecessaryImportsAsync( doc, import => - importsToRemove.Any( - importToRemove => syntaxFacts.AreEquivalent(importToRemove, import) + importsToRemove.Any(importToRemove => + syntaxFacts.AreEquivalent(importToRemove, import) ), formattingOptions, token diff --git a/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs b/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs index c0d71d3042f..7e7f07d250c 100644 --- a/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs @@ -97,9 +97,10 @@ public static ImmutableArray Create(State state) parts, ImmutableArray.Empty ); - return candidateFolders.SelectAsArray( - folders => new MoveFileCodeAction(state, folders) - ); + return candidateFolders.SelectAsArray(folders => new MoveFileCodeAction( + state, + folders + )); } /// @@ -152,12 +153,11 @@ ImmutableArray currentFolder // "\A\B\C\D" as the default path. var defaultPathBasedOnCurrentFolder = currentFolder.AddRange(parts); if ( - builder.All( - folders => - !folders.SequenceEqual( - defaultPathBasedOnCurrentFolder, - PathUtilities.Comparer - ) + builder.All(folders => + !folders.SequenceEqual( + defaultPathBasedOnCurrentFolder, + PathUtilities.Comparer + ) ) ) { diff --git a/roslyn/src/Features/Core/Portable/Completion/CompletionService.cs b/roslyn/src/Features/Core/Portable/Completion/CompletionService.cs index e6422837e70..99796a5747b 100644 --- a/roslyn/src/Features/Core/Portable/Completion/CompletionService.cs +++ b/roslyn/src/Features/Core/Portable/Completion/CompletionService.cs @@ -184,21 +184,20 @@ or CompletionTriggerKind.InvokeAndCommitIfUnique languageServices.SolutionServices.GetRequiredService(); var providers = _providerManager.GetFilteredProviders(project, roles, trigger, options); - return providers.Any( - p => - extensionManager.PerformFunction( - p, - () => - p.ShouldTriggerCompletion( - languageServices, - text, - caretPosition, - trigger, - options, - passThroughOptions - ), - defaultValue: false - ) + return providers.Any(p => + extensionManager.PerformFunction( + p, + () => + p.ShouldTriggerCompletion( + languageServices, + text, + caretPosition, + trigger, + options, + passThroughOptions + ), + defaultValue: false + ) ); } @@ -270,7 +269,9 @@ public virtual TextSpan GetDefaultCompletionListSpan(SourceText text, int caretP return CompletionDescription.Empty; var extensionManager = - document.Project.Solution.Workspace.Services.GetRequiredService(); + document.Project.Solution.Workspace.Services.GetRequiredService( + + ); // We don't need SemanticModel here, just want to make sure it won't get GC'd before CompletionProviders are able to get it. (document, var semanticModel) = await GetDocumentWithFrozenPartialSemanticsAsync( @@ -316,7 +317,9 @@ public virtual async Task GetChangeAsync( if (provider != null) { var extensionManager = - document.Project.Solution.Workspace.Services.GetRequiredService(); + document.Project.Solution.Workspace.Services.GetRequiredService( + + ); // We don't need SemanticModel here, just want to make sure it won't get GC'd before CompletionProviders are able to get it. (document, var semanticModel) = await GetDocumentWithFrozenPartialSemanticsAsync( @@ -372,13 +375,12 @@ string filterText { using var helper = new PatternMatchHelper(filterText); var filterDataList = new SegmentedList( - items.Select( - item => - helper.GetMatchResult( - item, - includeMatchSpans: false, - CultureInfo.CurrentCulture - ) + items.Select(item => + helper.GetMatchResult( + item, + includeMatchSpans: false, + CultureInfo.CurrentCulture + ) ) ); @@ -419,13 +421,12 @@ IList builder using var completionPatternMatchers = new PatternMatchHelper(filterText); builder.AddRange( - filteredItems.Select( - item => - completionPatternMatchers.GetMatchResult( - item, - includeMatchSpans: false, - CultureInfo.CurrentCulture - ) + filteredItems.Select(item => + completionPatternMatchers.GetMatchResult( + item, + includeMatchSpans: false, + CultureInfo.CurrentCulture + ) ) ); } diff --git a/roslyn/src/Features/Core/Portable/Completion/CompletionService_GetCompletions.cs b/roslyn/src/Features/Core/Portable/Completion/CompletionService_GetCompletions.cs index 5a91a179cbd..f029966ddde 100644 --- a/roslyn/src/Features/Core/Portable/Completion/CompletionService_GetCompletions.cs +++ b/roslyn/src/Features/Core/Portable/Completion/CompletionService_GetCompletions.cs @@ -215,16 +215,15 @@ SourceText text ) { var triggeredProviders = providers - .Where( - p => - p.ShouldTriggerCompletion( - document.Project.Services, - text, - caretPosition, - trigger, - options, - passThroughOptions - ) + .Where(p => + p.ShouldTriggerCompletion( + document.Project.Services, + text, + caretPosition, + trigger, + options, + passThroughOptions + ) ) .ToImmutableArrayOrEmpty(); @@ -260,7 +259,9 @@ CancellationToken cancellationToken ) { var extensionManager = - document.Project.Solution.Workspace.Services.GetRequiredService(); + document.Project.Solution.Workspace.Services.GetRequiredService( + + ); var additionalAugmentingProviders = ArrayBuilder.GetInstance( triggeredProviders.Length ); @@ -497,7 +498,9 @@ CancellationToken cancellationToken ) { var extensionManager = - document.Project.Solution.Workspace.Services.GetRequiredService(); + document.Project.Solution.Workspace.Services.GetRequiredService( + + ); var context = new CompletionContext( provider, diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs index b414a456860..e461b5fed08 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractDocCommentCompletionProvider.cs @@ -194,16 +194,15 @@ ISet existingAttributes ) { return s_attributeMap - .Where( - x => x.elementName == tagName && !existingAttributes.Contains(x.attributeName) + .Where(x => + x.elementName == tagName && !existingAttributes.Contains(x.attributeName) ) - .Select( - x => - CreateCompletionItem( - x.attributeName, - beforeCaretText: x.text, - afterCaretText: "\"" - ) + .Select(x => + CreateCompletionItem( + x.attributeName, + beforeCaretText: x.text, + afterCaretText: "\"" + ) ); } @@ -260,13 +259,12 @@ private IEnumerable GetParamRefItems(ISymbol symbol) { var names = GetParameters(symbol).Select(p => p.Name); - return names.Select( - p => - CreateCompletionItem( - displayText: FormatParameter(ParameterReferenceElementName, p), - beforeCaretText: FormatParameterRefTag(ParameterReferenceElementName, p), - afterCaretText: string.Empty - ) + return names.Select(p => + CreateCompletionItem( + displayText: FormatParameter(ParameterReferenceElementName, p), + beforeCaretText: FormatParameterRefTag(ParameterReferenceElementName, p), + afterCaretText: string.Empty + ) ); } @@ -274,16 +272,12 @@ private IEnumerable GetTypeParamRefItems(ISymbol symbol) { var names = symbol.GetAllTypeParameters().Select(t => t.Name); - return names.Select( - t => - CreateCompletionItem( - displayText: FormatParameter(TypeParameterReferenceElementName, t), - beforeCaretText: FormatParameterRefTag( - TypeParameterReferenceElementName, - t - ), - afterCaretText: string.Empty - ) + return names.Select(t => + CreateCompletionItem( + displayText: FormatParameter(TypeParameterReferenceElementName, t), + beforeCaretText: FormatParameterRefTag(TypeParameterReferenceElementName, t), + afterCaretText: string.Empty + ) ); } diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractPartialMethodCompletionProvider.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractPartialMethodCompletionProvider.cs index 0a0d5bd1636..9c557b669b8 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractPartialMethodCompletionProvider.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/AbstractPartialMethodCompletionProvider.cs @@ -112,15 +112,14 @@ CancellationToken cancellationToken explicitInterfaceImplementations: default, name: member.Name, typeParameters: method.TypeParameters, - parameters: method.Parameters.SelectAsArray( - p => - CodeGenerationSymbolFactory.CreateParameterSymbol( - p.GetAttributes(), - p.RefKind, - p.IsParams, - p.Type, - p.Name - ) + parameters: method.Parameters.SelectAsArray(p => + CodeGenerationSymbolFactory.CreateParameterSymbol( + p.GetAttributes(), + p.RefKind, + p.IsParams, + p.Type, + p.Name + ) ), statements: syntaxFactory.CreateThrowNotImplementedStatementBlock( semanticModel.Compilation diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs index b38f71ae97c..710bbff3483 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractImportCompletionProvider.cs @@ -231,7 +231,9 @@ CancellationToken cancellationToken // TODO: fallback options https://github.com/dotnet/roslyn/issues/60786 var globalOptions = - document.Project.Solution.Services.GetService(); + document.Project.Solution.Services.GetService( + + ); var fallbackOptions = globalOptions?.Provider ?? CodeActionOptions.DefaultProvider; var addImportsOptions = await document diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs index a6a84911e10..146e67035ab 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/AbstractTypeImportCompletionService.cs @@ -155,7 +155,9 @@ out var nonGlobalAliasedProjectReferencesSet () => new EditorBrowsableInfo(originCompilation) ); foreach ( - var peReference in currentProject.MetadataReferences.OfType() + var peReference in currentProject.MetadataReferences.OfType( + + ) ) { // Can't cache items for reference with null key. We don't want risk potential perf regression by diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.cs index c586d0506de..be9622666b6 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/ImportCompletionProvider/ExtensionMethodImportCompletionHelper.cs @@ -77,8 +77,8 @@ CancellationToken cancellationToken receiverTypeSymbol, cancellationToken ); - var targetTypesSymbolKeyData = targetTypesSymbols.SelectAsArray( - s => SymbolKey.CreateString(s, cancellationToken) + var targetTypesSymbolKeyData = targetTypesSymbols.SelectAsArray(s => + SymbolKey.CreateString(s, cancellationToken) ); // Call the project overload. Add-import-for-extension-method doesn't search outside of the current diff --git a/roslyn/src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs b/roslyn/src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs index b19ae376000..aa5f4b4c181 100644 --- a/roslyn/src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs +++ b/roslyn/src/Features/Core/Portable/Completion/Providers/SymbolCompletionItem.cs @@ -280,8 +280,7 @@ private static Document FindAppropriateDocumentForDescriptionContext( { var contextId = document .GetLinkedDocumentIds() - .FirstOrDefault( - id => !supportedPlatforms.InvalidProjects.Contains(id.ProjectId) + .FirstOrDefault(id => !supportedPlatforms.InvalidProjects.Contains(id.ProjectId) ); if (contextId != null) { diff --git a/roslyn/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs index 0065100cafc..df6de6830f2 100644 --- a/roslyn/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToClassCodeRefactoringProvider.cs @@ -330,8 +330,8 @@ TAnonymousObjectCreationExpressionSyntax childCreation : (TNameSyntax) g.GenericName( classNameToken, - classSymbol.TypeParameters.Select( - tp => g.IdentifierName(tp.Name) + classSymbol.TypeParameters.Select(tp => + g.IdentifierName(tp.Name) ) ); @@ -374,9 +374,8 @@ CancellationToken cancellationToken Accessibility.Public, modifiers: default, typeName, - properties.SelectAsArray( - prop => - CodeGenerationSymbolFactory.CreateParameterSymbol(prop.Type, prop.Name) + properties.SelectAsArray(prop => + CodeGenerationSymbolFactory.CreateParameterSymbol(prop.Type, prop.Name) ), isPrimaryConstructor: true ); @@ -475,8 +474,7 @@ ImmutableDictionary propertyMap .GetMembers() .OfType() .ToImmutableArray(); - var newProperties = originalProperties.SelectAsArray( - p => GenerateProperty(document, p) + var newProperties = originalProperties.SelectAsArray(p => GenerateProperty(document, p) ); // If we changed the names of any properties, record that name mapping. We'll diff --git a/roslyn/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs index 18021843382..e8775c2aaff 100644 --- a/roslyn/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/ConvertIfToSwitch/AbstractConvertIfToSwitchCodeRefactoringProvider.cs @@ -157,8 +157,8 @@ private bool ShouldOfferRefactoring( // if-chains/checks and easily converting them over to a switch. So not offering the // feature on simple if-statements seems like an acceptable compromise to take to ensure // the overall user experience isn't degraded. - var labelCount = sections.Sum( - section => section.Labels.IsDefault ? 1 : section.Labels.Length + var labelCount = sections.Sum(section => + section.Labels.IsDefault ? 1 : section.Labels.Length ); if (labelCount < 2) { @@ -179,15 +179,15 @@ ImmutableArray sections // There must be at least one return statement if ( - !sections.Any( - static section => GetSwitchArmKind(section.Body) == OperationKind.Return + !sections.Any(static section => + GetSwitchArmKind(section.Body) == OperationKind.Return ) ) return false; if ( - !sections.All( - section => CanConvertSectionForSwitchExpression(supportsOrPattern, section) + !sections.All(section => + CanConvertSectionForSwitchExpression(supportsOrPattern, section) ) ) return false; diff --git a/roslyn/src/Features/Core/Portable/ConvertToInterpolatedString/AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/ConvertToInterpolatedString/AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs index 4455adcf1f4..56ce25c98fa 100644 --- a/roslyn/src/Features/Core/Portable/ConvertToInterpolatedString/AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/ConvertToInterpolatedString/AbstractConvertConcatenationToInterpolatedStringRefactoringProvider.cs @@ -81,10 +81,9 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex CollectPiecesDown(syntaxFacts, pieces, top, semanticModel, cancellationToken); var stringLiterals = pieces - .Where( - x => - syntaxFacts.IsStringLiteralExpression(x) - || syntaxFacts.IsCharacterLiteralExpression(x) + .Where(x => + syntaxFacts.IsStringLiteralExpression(x) + || syntaxFacts.IsCharacterLiteralExpression(x) ) .ToImmutableArray(); diff --git a/roslyn/src/Features/Core/Portable/Diagnostics/AbstractHostDiagnosticUpdateSource.cs b/roslyn/src/Features/Core/Portable/Diagnostics/AbstractHostDiagnosticUpdateSource.cs index 6fa51d768af..b59ed406ff8 100644 --- a/roslyn/src/Features/Core/Portable/Diagnostics/AbstractHostDiagnosticUpdateSource.cs +++ b/roslyn/src/Features/Core/Portable/Diagnostics/AbstractHostDiagnosticUpdateSource.cs @@ -158,8 +158,8 @@ ProjectId projectId } // Check if analyzer is shared by analyzer references from different projects. - var sharedAnalyzer = existing.Contains( - d => d.ProjectId != null && d.ProjectId != projectId + var sharedAnalyzer = existing.Contains(d => + d.ProjectId != null && d.ProjectId != projectId ); if (sharedAnalyzer) { diff --git a/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs b/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs index 9f634b3d382..5a64a0dc882 100644 --- a/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs +++ b/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSession.cs @@ -786,8 +786,9 @@ out var documentIndicesByMappedPath Debug.Assert(oldProject.SupportsEditAndContinue()); Debug.Assert(newProject.SupportsEditAndContinue()); - var analyzer = - newProject.Services.GetRequiredService(); + var analyzer = newProject.Services.GetRequiredService( + + ); await foreach ( var documentId in EditSession @@ -876,8 +877,8 @@ out var spans // translate active statements from base solution to the new solution, if the documents they are contained in changed: foreach (var (projectId, index) in indices) { - spans[index] = - documentBaseActiveStatements.SelectAsArray(activeStatement => + spans[index] = documentBaseActiveStatements.SelectAsArray( + activeStatement => { LinePositionSpan span; DocumentId? unmappedDocumentId; @@ -889,8 +890,8 @@ out var newSpans ) ) { - (unmappedDocumentId, span) = newSpans.Single( - ns => ns.unmappedDocumentId.ProjectId == projectId + (unmappedDocumentId, span) = newSpans.Single(ns => + ns.unmappedDocumentId.ProjectId == projectId ); } else diff --git a/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSessionTelemetry.cs b/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSessionTelemetry.cs index 71805a4d9c9..cd4db775eaa 100644 --- a/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSessionTelemetry.cs +++ b/roslyn/src/Features/Core/Portable/EditAndContinue/DebuggingSessionTelemetry.cs @@ -85,12 +85,11 @@ public static void Log(Data data, Action log, Func map["SolutionSessionId"] = data.SolutionSessionId.ToString("B") .ToUpperInvariant(); map[SessionId] = debugSessionId; - map["SessionCount"] = data.EditSessionData.Count( - session => session.InBreakState + map["SessionCount"] = data.EditSessionData.Count(session => session.InBreakState ); map["EmptySessionCount"] = data.EmptyEditSessionCount; - map["HotReloadSessionCount"] = data.EditSessionData.Count( - session => !session.InBreakState + map["HotReloadSessionCount"] = data.EditSessionData.Count(session => + !session.InBreakState ); map["EmptyHotReloadSessionCount"] = data.EmptyHotReloadEditSessionCount; }) diff --git a/roslyn/src/Features/Core/Portable/EditAndContinue/EditAndContinueDocumentAnalysesCache.cs b/roslyn/src/Features/Core/Portable/EditAndContinue/EditAndContinueDocumentAnalysesCache.cs index b48996fd726..02a60a9bd7b 100644 --- a/roslyn/src/Features/Core/Portable/EditAndContinue/EditAndContinueDocumentAnalysesCache.cs +++ b/roslyn/src/Features/Core/Portable/EditAndContinue/EditAndContinueDocumentAnalysesCache.cs @@ -55,20 +55,19 @@ CancellationToken cancellationToken return ImmutableArray.Empty; } - var tasks = documents.Select( - document => - Task.Run( - () => - GetDocumentAnalysisAsync( - oldSolution, - document.oldDocument, - document.newDocument, - activeStatementSpanProvider, - cancellationToken - ) - .AsTask(), - cancellationToken - ) + var tasks = documents.Select(document => + Task.Run( + () => + GetDocumentAnalysisAsync( + oldSolution, + document.oldDocument, + document.newDocument, + activeStatementSpanProvider, + cancellationToken + ) + .AsTask(), + cancellationToken + ) ); var allResults = await Task.WhenAll(tasks).ConfigureAwait(false); @@ -232,9 +231,8 @@ out var newMappedDocumentSpans ); // TODO: optimize - var newLineMappingContainingActiveSpan = newLineMappings.FirstOrDefault( - mapping => - mapping.MappedSpan.Span.Contains(newMappedDocumentActiveSpan.LineSpan) + var newLineMappingContainingActiveSpan = newLineMappings.FirstOrDefault(mapping => + mapping.MappedSpan.Span.Contains(newMappedDocumentActiveSpan.LineSpan) ); var unmappedSpan = newLineMappingContainingActiveSpan.MappedSpan.IsValid @@ -273,13 +271,15 @@ ImmutableArray activeStatementSpans return analysis.results; } - var lazyResults = - AsyncLazy.Create(asynchronousComputeFunction: async cancellationToken => + var lazyResults = AsyncLazy.Create( + asynchronousComputeFunction: async cancellationToken => { try { var analyzer = - document.Project.Services.GetRequiredService(); + document.Project.Services.GetRequiredService( + + ); return await analyzer .AnalyzeDocumentAsync( baseProject, @@ -296,7 +296,8 @@ ImmutableArray activeStatementSpans { throw ExceptionUtilities.Unreachable(); } - }); + } + ); // Previous results for this document id are discarded as they are no longer relevant. // The only relevant analysis is for the latest base and document snapshots. diff --git a/roslyn/src/Features/Core/Portable/EditAndContinue/EditSession.cs b/roslyn/src/Features/Core/Portable/EditAndContinue/EditSession.cs index 1e9a6373d12..fe499146b88 100644 --- a/roslyn/src/Features/Core/Portable/EditAndContinue/EditSession.cs +++ b/roslyn/src/Features/Core/Portable/EditAndContinue/EditSession.cs @@ -151,8 +151,8 @@ CancellationToken cancellationToken { // If the runtime doesn't support adding new types then we expect every row number for any type that is // emitted will be less than or equal to the number of rows in the original metadata. - var highestEmittedTypeDefRow = emitResult.ChangedTypes.Max( - t => MetadataTokens.GetRowNumber(t) + var highestEmittedTypeDefRow = emitResult.ChangedTypes.Max(t => + MetadataTokens.GetRowNumber(t) ); var highestExistingTypeDefRow = emitResult .Baseline.OriginalMetadata.GetMetadataReader() @@ -1090,8 +1090,8 @@ or SemanticEditKind.Replace foreach (var partialTypeEdits in updatesByPartialType) { Debug.Assert( - partialTypeEdits.All( - edit => edit.SyntaxMapTree is null == edit.SyntaxMap is null + partialTypeEdits.All(edit => + edit.SyntaxMapTree is null == edit.SyntaxMap is null ) ); @@ -1520,11 +1520,11 @@ await GetUnsupportedChangesDiagnosticAsync( } else { - var updatedMethodTokens = emitResult.UpdatedMethods.SelectAsArray( - h => MetadataTokens.GetToken(h) + var updatedMethodTokens = emitResult.UpdatedMethods.SelectAsArray(h => + MetadataTokens.GetToken(h) ); - var changedTypeTokens = emitResult.ChangedTypes.SelectAsArray( - h => MetadataTokens.GetToken(h) + var changedTypeTokens = emitResult.ChangedTypes.SelectAsArray(h => + MetadataTokens.GetToken(h) ); // Determine all active statements whose span changed and exception region span deltas. @@ -1936,12 +1936,11 @@ out var newSpan // new = old – delta exceptionRegionUpdates = nonRemappableRegions.SelectAsArray( r => r.Region.IsExceptionRegion, - r => - new ManagedExceptionRegionUpdate( - r.Method, - -r.Region.OldSpan.Span.GetLineDelta(r.Region.NewSpan.Span), - r.Region.NewSpan.Span.ToSourceSpan() - ) + r => new ManagedExceptionRegionUpdate( + r.Method, + -r.Region.OldSpan.Span.GetLineDelta(r.Region.NewSpan.Span), + r.Region.NewSpan.Span.ToSourceSpan() + ) ); } } diff --git a/roslyn/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs b/roslyn/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs index 906f9acb44b..47e1f79bd27 100644 --- a/roslyn/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs +++ b/roslyn/src/Features/Core/Portable/EmbeddedLanguages/AbstractEmbeddedLanguageFeatureService.cs @@ -65,8 +65,8 @@ IEnumerable> allServices .ToImmutableArray(); // Grab out the services that handle unannotated literals and APIs. - _legacyServices = orderedFeatureProviders.WhereAsArray( - c => c.Metadata.SupportsUnannotatedAPIs + _legacyServices = orderedFeatureProviders.WhereAsArray(c => + c.Metadata.SupportsUnannotatedAPIs ); using var _ = PooledDictionary< diff --git a/roslyn/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs b/roslyn/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs index e85116bb168..5c1daa52505 100644 --- a/roslyn/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs +++ b/roslyn/src/Features/Core/Portable/EmbeddedLanguages/Json/JsonParser.cs @@ -191,8 +191,8 @@ JsonCompilationUnit compilationUnit // as we only parse when we have a non-empty sequence of virtual chars to begin with. if ( text.Length > 0 - && compilationUnit.EndOfFileToken.LeadingTrivia.All( - t => t.Kind is JsonKind.WhitespaceTrivia or JsonKind.EndOfLineTrivia + && compilationUnit.EndOfFileToken.LeadingTrivia.All(t => + t.Kind is JsonKind.WhitespaceTrivia or JsonKind.EndOfLineTrivia ) ) { diff --git a/roslyn/src/Features/Core/Portable/Emit/CompilationOutputFilesWithImplicitPdbPath.cs b/roslyn/src/Features/Core/Portable/Emit/CompilationOutputFilesWithImplicitPdbPath.cs index fb0c73b5e26..6c7622422b5 100644 --- a/roslyn/src/Features/Core/Portable/Emit/CompilationOutputFilesWithImplicitPdbPath.cs +++ b/roslyn/src/Features/Core/Portable/Emit/CompilationOutputFilesWithImplicitPdbPath.cs @@ -56,8 +56,8 @@ public CompilationOutputFilesWithImplicitPdbPath(string? assemblyFilePath = null using (var peReader = new PEReader(assemblyStream)) { var debugDirectory = peReader.ReadDebugDirectory(); - var embeddedPdbEntry = debugDirectory.FirstOrDefault( - e => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb + var embeddedPdbEntry = debugDirectory.FirstOrDefault(e => + e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb ); if (embeddedPdbEntry.DataSize != 0) { @@ -66,8 +66,8 @@ public CompilationOutputFilesWithImplicitPdbPath(string? assemblyFilePath = null ); } - var codeViewEntry = debugDirectory.FirstOrDefault( - e => e.Type == DebugDirectoryEntryType.CodeView + var codeViewEntry = debugDirectory.FirstOrDefault(e => + e.Type == DebugDirectoryEntryType.CodeView ); if (codeViewEntry.DataSize == 0) { diff --git a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingSearchHelpers.cs b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingSearchHelpers.cs index 80ca13d1200..7c4c034d191 100644 --- a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingSearchHelpers.cs +++ b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/API/UnitTestingSearchHelpers.cs @@ -253,17 +253,16 @@ CancellationToken cancellationToken var syntaxFacts = project.GetRequiredLanguageService(); var comparer = syntaxFacts.StringComparer; - var streams = project.Documents.SelectAsArray( - d => - GetSourceLocationsInProcessAsync( - d, - comparer, - container, - symbolName, - symbolArity, - query, - cancellationToken - ) + var streams = project.Documents.SelectAsArray(d => + GetSourceLocationsInProcessAsync( + d, + comparer, + container, + symbolName, + symbolArity, + query, + cancellationToken + ) ); return streams.MergeAsync(cancellationToken); } diff --git a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs index c4dbc50e80b..5fcc773e9d5 100644 --- a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs +++ b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingIncrementalAnalyzerProcessor.cs @@ -106,7 +106,9 @@ CancellationToken shutdownToken // event and worker queues _documentTracker = - _registration.Services.GetRequiredService(); + _registration.Services.GetRequiredService( + + ); var globalNotificationService = _registration .Services.ExportProvider.GetExports() @@ -565,8 +567,8 @@ List items ._normalPriorityProcessor.GetTestAccessor() .WaitUntilCompletion(analyzers, items); - var projectItems = items.Select( - i => i.ToProjectWorkItem(EmptyAsyncToken.Instance) + var projectItems = items.Select(i => + i.ToProjectWorkItem(EmptyAsyncToken.Instance) ); _incrementalAnalyzerProcessor ._lowPriorityProcessor.GetTestAccessor() diff --git a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs index f101fa4b2b5..9b06426dbec 100644 --- a/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs +++ b/roslyn/src/Features/Core/Portable/ExternalAccess/UnitTesting/SolutionCrawler/UnitTestingWorkCoordinator.UnitTestingNormalPriorityProcessor.cs @@ -257,7 +257,9 @@ private IEnumerable GetPrioritizedPendingDocuments() // Now any visible documents foreach ( - var visibleDocumentId in Processor._documentTracker.GetVisibleDocuments() + var visibleDocumentId in Processor._documentTracker.GetVisibleDocuments( + + ) ) { yield return visibleDocumentId; diff --git a/roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs b/roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs index 90f5430cce2..3ec933322f7 100644 --- a/roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs +++ b/roslyn/src/Features/Core/Portable/ExternalAccess/VSTypeScript/VSTypeScriptDocumentDiagnosticAnalyzer.cs @@ -22,7 +22,9 @@ CancellationToken cancellationToken ) { var analyzer = document - .Project.Services.GetRequiredService() + .Project.Services.GetRequiredService( + + ) .Implementation; if (analyzer == null) { @@ -38,7 +40,9 @@ CancellationToken cancellationToken ) { var analyzer = document - .Project.Services.GetRequiredService() + .Project.Services.GetRequiredService( + + ) .Implementation; if (analyzer == null) { diff --git a/roslyn/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs b/roslyn/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs index 989feed646a..924666c5e45 100644 --- a/roslyn/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs +++ b/roslyn/src/Features/Core/Portable/ExternalAccess/Watch/Api/WatchHotReloadService.cs @@ -140,17 +140,14 @@ ImmutableArray diagnostics _encService.CommitSolutionUpdate(sessionId, out _); } - var updates = results.ModuleUpdates.Updates.SelectAsArray( - update => - new Update( - update.Module, - update.ILDelta, - update.MetadataDelta, - update.PdbDelta, - update.UpdatedTypes, - update.RequiredCapabilities - ) - ); + var updates = results.ModuleUpdates.Updates.SelectAsArray(update => new Update( + update.Module, + update.ILDelta, + update.MetadataDelta, + update.PdbDelta, + update.UpdatedTypes, + update.RequiredCapabilities + )); var diagnostics = await results .GetAllDiagnosticsAsync(solution, cancellationToken) diff --git a/roslyn/src/Features/Core/Portable/ExtractMethod/MethodExtractor.CodeGenerator.cs b/roslyn/src/Features/Core/Portable/ExtractMethod/MethodExtractor.CodeGenerator.cs index ef3c5ed7cb6..eccce256fc7 100644 --- a/roslyn/src/Features/Core/Portable/ExtractMethod/MethodExtractor.CodeGenerator.cs +++ b/roslyn/src/Features/Core/Portable/ExtractMethod/MethodExtractor.CodeGenerator.cs @@ -411,8 +411,8 @@ protected ImmutableArray CreateDeclarationStatements( CancellationToken cancellationToken ) { - return variables.SelectAsArray( - v => CreateDeclarationStatement(v, initialValue: null, cancellationToken) + return variables.SelectAsArray(v => + CreateDeclarationStatement(v, initialValue: null, cancellationToken) ); } diff --git a/roslyn/src/Features/Core/Portable/Formatting/FormattingRuleUtilities.cs b/roslyn/src/Features/Core/Portable/Formatting/FormattingRuleUtilities.cs index 584e64fdeb4..84f5457dfd6 100644 --- a/roslyn/src/Features/Core/Portable/Formatting/FormattingRuleUtilities.cs +++ b/roslyn/src/Features/Core/Portable/Formatting/FormattingRuleUtilities.cs @@ -17,7 +17,9 @@ public static ImmutableArray GetFormattingRules( ) { var formattingRuleFactory = - document.SolutionServices.GetRequiredService(); + document.SolutionServices.GetRequiredService( + + ); // Not sure why this is being done... there aren't any docs on CreateRule either. var position = (span.Start + span.End) / 2; diff --git a/roslyn/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs b/roslyn/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs index 9d228e4ea5e..710a9ede4aa 100644 --- a/roslyn/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs +++ b/roslyn/src/Features/Core/Portable/FullyQualify/AbstractFullyQualifyService.cs @@ -210,20 +210,19 @@ ImmutableArray matchingTypes var validSymbols = matchingTypes .OfType() - .Where( - s => - IsValidNamedTypeSearchResult( - semanticModel, - arity, - inAttributeContext, - looksGeneric, - s - ) - && s.IsEditorBrowsable( - hideAdvancedMembers, - semanticModel.Compilation, - editorBrowserInfo - ) + .Where(s => + IsValidNamedTypeSearchResult( + semanticModel, + arity, + inAttributeContext, + looksGeneric, + s + ) + && s.IsEditorBrowsable( + hideAdvancedMembers, + semanticModel.Compilation, + editorBrowserInfo + ) ) .ToImmutableArray(); @@ -233,8 +232,8 @@ ImmutableArray matchingTypes var currentSymbolInfo = semanticModel.GetSymbolInfo(simpleName, cancellationToken); if (currentSymbolInfo.CandidateReason == CandidateReason.WrongArity) { - validSymbols = validSymbols.WhereAsArray( - s => !currentSymbolInfo.CandidateSymbols.Contains(s) + validSymbols = validSymbols.WhereAsArray(s => + !currentSymbolInfo.CandidateSymbols.Contains(s) ); } @@ -266,20 +265,15 @@ ImmutableArray symbols return symbols .OfType() - .Where( - n => - !n.IsGlobalNamespace - && HasAccessibleTypes(n, semanticModel, cancellationToken) - ) - .Select( - n => - new SymbolResult( - n, - BindsWithoutErrors(n, rightName, isAttributeName) - ? NamespaceWithNoErrorsWeight - : NamespaceWithErrorsWeight - ) + .Where(n => + !n.IsGlobalNamespace && HasAccessibleTypes(n, semanticModel, cancellationToken) ) + .Select(n => new SymbolResult( + n, + BindsWithoutErrors(n, rightName, isAttributeName) + ? NamespaceWithNoErrorsWeight + : NamespaceWithErrorsWeight + )) .ToImmutableArray(); } } @@ -457,8 +451,8 @@ Compilation compilation private static IEnumerable FilterAndSort(IEnumerable symbols) => symbols .Distinct() - .Where( - n => n.Symbol is INamedTypeSymbol or INamespaceSymbol { IsGlobalNamespace: false } + .Where(n => + n.Symbol is INamedTypeSymbol or INamespaceSymbol { IsGlobalNamespace: false } ) .Order(); } diff --git a/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs b/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs index 97daa636e4e..c39a6f0ac26 100644 --- a/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.GenerateConstructorWithDialogCodeAction.cs @@ -51,7 +51,9 @@ public override object GetOptions(CancellationToken cancellationToken) { var service = _service._pickMembersService_forTesting - ?? _document.Project.Solution.Services.GetRequiredService(); + ?? _document.Project.Solution.Services.GetRequiredService( + + ); return service.PickMembers( FeaturesResources.Pick_members_to_be_used_as_constructor_parameters, @@ -72,14 +74,15 @@ CancellationToken cancellationToken return SpecializedCollections.EmptyEnumerable(); } - var addNullChecksOption = result.Options.FirstOrDefault( - o => o.Id == AddNullChecksId + var addNullChecksOption = result.Options.FirstOrDefault(o => o.Id == AddNullChecksId ); if (addNullChecksOption != null) { // ILegacyGlobalOptionsWorkspaceService is guaranteed to be not null here because we have checked it before the code action is provided. var globalOptions = - _document.Project.Solution.Services.GetRequiredService(); + _document.Project.Solution.Services.GetRequiredService( + + ); // If we presented the 'Add null check' option, then persist whatever value // the user chose. That way we'll keep that as the default for the next time diff --git a/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs index dc65c0f6ba1..2590598d052 100644 --- a/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/GenerateConstructorFromMembers/AbstractGenerateConstructorFromMembersCodeRefactoringProvider.cs @@ -334,15 +334,16 @@ is null } using var _ = ArrayBuilder.GetInstance(out var pickMemberOptions); - var canAddNullCheck = viableMembers.Any( - static m => m.GetSymbolType().CanAddNullCheck() + var canAddNullCheck = viableMembers.Any(static m => m.GetSymbolType().CanAddNullCheck() ); if (canAddNullCheck) { // ILegacyGlobalOptionsWorkspaceService is not provided in LSP, so don't give the code action with Dialog if it is null var globalOptions = - document.Project.Solution.Services.GetService(); + document.Project.Solution.Services.GetService( + + ); if (globalOptions == null) { return null; diff --git a/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorCodeFixProvider.cs b/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorCodeFixProvider.cs index c621047e939..8941b05d27f 100644 --- a/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorCodeFixProvider.cs +++ b/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/AbstractGenerateDefaultConstructorCodeFixProvider.cs @@ -44,8 +44,9 @@ out var typeDecl if (typeName == null) return; - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); var actions = await service .GenerateDefaultConstructorsAsync( document, diff --git a/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/GenerateDefaultConstructorsCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/GenerateDefaultConstructorsCodeRefactoringProvider.cs index dd0fe5b728e..194b4121336 100644 --- a/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/GenerateDefaultConstructorsCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/GenerateDefaultConstructors/GenerateDefaultConstructorsCodeRefactoringProvider.cs @@ -53,8 +53,9 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte if (document.Project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles) return; - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); var actions = await service .GenerateDefaultConstructorsAsync( document, diff --git a/roslyn/src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs b/roslyn/src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs index 1453acf5924..5fe9859b559 100644 --- a/roslyn/src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndHashWithDialogCodeAction.cs @@ -51,7 +51,9 @@ public override object GetOptions(CancellationToken cancellationToken) { var service = _service._pickMembersService_forTestingPurposes - ?? _document.Project.Solution.Services.GetRequiredService(); + ?? _document.Project.Solution.Services.GetRequiredService( + + ); return service.PickMembers( FeaturesResources.Pick_members_to_be_used_in_Equals_GetHashCode, _viableMembers, @@ -74,11 +76,11 @@ CancellationToken cancellationToken // If we presented the user any options, then persist whatever values // the user chose to the global options. That way we'll keep that as the default for the // next time the user opens the dialog. - var implementIEqutableOption = result.Options.FirstOrDefault( - o => o.Id == ImplementIEquatableId + var implementIEqutableOption = result.Options.FirstOrDefault(o => + o.Id == ImplementIEquatableId ); - var generateOperatorsOption = result.Options.FirstOrDefault( - o => o.Id == GenerateOperatorsId + var generateOperatorsOption = result.Options.FirstOrDefault(o => + o.Id == GenerateOperatorsId ); if (generateOperatorsOption != null || implementIEqutableOption != null) { diff --git a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs index 4caf437b9ea..58852ee482c 100644 --- a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs +++ b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateConstructor/AbstractGenerateConstructorService.cs @@ -332,13 +332,8 @@ CancellationToken cancellationToken var parameterNames = reservedNames .Concat( - arguments.Select( - a => - this.GenerateNameForArgument( - document.SemanticModel, - a, - cancellationToken - ) + arguments.Select(a => + this.GenerateNameForArgument(document.SemanticModel, a, cancellationToken) ) ) .ToImmutableArray(); diff --git a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs index 78d7fb8a1ae..ee488cfbceb 100644 --- a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs +++ b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.MethodSignatureInfo.cs @@ -54,9 +54,10 @@ protected override ImmutableArray DetermineParameterNames( CancellationToken cancellationToken ) => _parameterNames.IsDefault - ? _methodSymbol.Parameters.SelectAsArray( - p => new ParameterName(p.Name, isFixed: true) - ) + ? _methodSymbol.Parameters.SelectAsArray(p => new ParameterName( + p.Name, + isFixed: true + )) : _parameterNames.SelectAsArray(p => new ParameterName(p, isFixed: true)); protected override ImmutableArray DetermineTypeArguments( diff --git a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs index ffed4abd29d..1656ab30aba 100644 --- a/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs +++ b/roslyn/src/Features/Core/Portable/GenerateMember/GenerateParameterizedMember/AbstractGenerateParameterizedMemberService.State.cs @@ -120,15 +120,14 @@ await SymbolFinder var generatedMethod = await SignatureInfo .GenerateMethodAsync(syntaxFactory, false, cancellationToken) .ConfigureAwait(false); - return !existingMethods.Any( - m => - SignatureComparer.Instance.HaveSameSignature( - m, - generatedMethod, - caseSensitive: syntaxFacts.IsCaseSensitive, - compareParameterName: true, - isParameterCaseSensitive: syntaxFacts.IsCaseSensitive - ) + return !existingMethods.Any(m => + SignatureComparer.Instance.HaveSameSignature( + m, + generatedMethod, + caseSensitive: syntaxFacts.IsCaseSensitive, + compareParameterName: true, + isParameterCaseSensitive: syntaxFacts.IsCaseSensitive + ) ); } } diff --git a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.CodeAction.cs b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.CodeAction.cs index 3d5e06e7fa0..0597f2deb89 100644 --- a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.CodeAction.cs +++ b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.CodeAction.cs @@ -143,7 +143,9 @@ CleanCodeGenerationOptionsProvider fallbackOptions public override object GetOptions(CancellationToken cancellationToken) { var generateTypeOptionsService = - _document.Project.Solution.Services.GetRequiredService(); + _document.Project.Solution.Services.GetRequiredService( + + ); var notificationService = _document.Project.Solution.Services.GetService(); var projectManagementService = diff --git a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.Editor.cs b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.Editor.cs index ae787a3ef45..5bd65f6d468 100644 --- a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.Editor.cs +++ b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.Editor.cs @@ -166,7 +166,9 @@ public async Task> GetOperationsAsync() // Get the cross language service _targetLanguageService = - _generateTypeOptionsResult.Project.Services.GetService(); + _generateTypeOptionsResult.Project.Services.GetService( + + ); } if (_generateTypeOptionsResult.IsNewFile) @@ -510,8 +512,8 @@ Solution updatedSolution if (projectToBeUpdated != triggeringProject) { if ( - !triggeringProject.ProjectReferences.Any( - pr => pr.ProjectId == projectToBeUpdated.Id + !triggeringProject.ProjectReferences.Any(pr => + pr.ProjectId == projectToBeUpdated.Id ) ) { @@ -820,13 +822,12 @@ private ImmutableArray GetArgumentTypes( IList argumentList ) { - var types = argumentList.Select( - a => - _service.DetermineArgumentType( - _semanticDocument.SemanticModel, - a, - _cancellationToken - ) + var types = argumentList.Select(a => + _service.DetermineArgumentType( + _semanticDocument.SemanticModel, + a, + _cancellationToken + ) ); return types.SelectAsArray(FixType); } @@ -837,8 +838,8 @@ IList argumentList { var syntaxFacts = _semanticDocument.Document.GetRequiredLanguageService(); - return argumentList.SelectAsArray( - a => (TExpressionSyntax)syntaxFacts.GetExpressionOfArgument(a) + return argumentList.SelectAsArray(a => + (TExpressionSyntax)syntaxFacts.GetExpressionOfArgument(a) ); } @@ -870,8 +871,8 @@ where IsViableFieldOrProperty(parameterType, m) var membersArray = members.ToImmutableArray(); var symbol = - membersArray.FirstOrDefault( - m => m.Name.Equals(expectedFieldName, StringComparison.Ordinal) + membersArray.FirstOrDefault(m => + m.Name.Equals(expectedFieldName, StringComparison.Ordinal) ) ?? membersArray.FirstOrDefault(); if (symbol != null) { diff --git a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs index 3c8a3e9810d..948e1aa45fc 100644 --- a/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs +++ b/roslyn/src/Features/Core/Portable/GenerateType/AbstractGenerateTypeService.State.cs @@ -276,8 +276,9 @@ CancellationToken cancellationToken // then we don't really want to infer a base type for 'Goo'. // However, there are a few other cases were we can infer a base type. - var syntaxFacts = - document.Document.GetRequiredLanguageService(); + var syntaxFacts = document.Document.GetRequiredLanguageService( + + ); if (service.IsInCatchDeclaration(NameOrMemberAccessExpression)) { SetBaseType(this.Compilation.ExceptionType()); diff --git a/roslyn/src/Features/Core/Portable/GoToBase/AbstractGoToBaseService.cs b/roslyn/src/Features/Core/Portable/GoToBase/AbstractGoToBaseService.cs index 277213f8968..271b2a6283c 100644 --- a/roslyn/src/Features/Core/Portable/GoToBase/AbstractGoToBaseService.cs +++ b/roslyn/src/Features/Core/Portable/GoToBase/AbstractGoToBaseService.cs @@ -26,10 +26,9 @@ CancellationToken cancellationToken if (baseType is null) return null; - return baseType.InstanceConstructors.FirstOrDefault( - baseConstructor => - baseConstructor.IsAccessibleWithin(constructor.ContainingType) - && baseConstructor.Parameters.All(p => p.IsOptional || p.IsParams) + return baseType.InstanceConstructors.FirstOrDefault(baseConstructor => + baseConstructor.IsAccessibleWithin(constructor.ContainingType) + && baseConstructor.Parameters.All(p => p.IsOptional || p.IsParams) ); } diff --git a/roslyn/src/Features/Core/Portable/Highlighting/HighlightingService.cs b/roslyn/src/Features/Core/Portable/Highlighting/HighlightingService.cs index 09aef51a2e8..5129223bf23 100644 --- a/roslyn/src/Features/Core/Portable/Highlighting/HighlightingService.cs +++ b/roslyn/src/Features/Core/Portable/Highlighting/HighlightingService.cs @@ -37,8 +37,7 @@ CancellationToken cancellationToken using (s_listPool.GetPooledObject(out var tempHighlights)) { foreach ( - var highlighter in _highlighters.Where( - h => h.Metadata.Language == root.Language + var highlighter in _highlighters.Where(h => h.Metadata.Language == root.Language ) ) { diff --git a/roslyn/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs b/roslyn/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs index 59b2f785442..4c529992a46 100644 --- a/roslyn/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.DisposePatternCodeAction.cs @@ -192,8 +192,8 @@ CancellationToken cancellationToken // First, implement all the interfaces (except for IDisposable). var docWithCoreMembers = await GetUpdatedDocumentAsync( document, - unimplementedMembers.WhereAsArray( - m => !m.type.Equals(disposeMethod.ContainingType) + unimplementedMembers.WhereAsArray(m => + !m.type.Equals(disposeMethod.ContainingType) ), classType, classDecl, diff --git a/roslyn/src/Features/Core/Portable/InitializeParameter/AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs b/roslyn/src/Features/Core/Portable/InitializeParameter/AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs index f466d4e1e2d..70d42d40ec7 100644 --- a/roslyn/src/Features/Core/Portable/InitializeParameter/AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs +++ b/roslyn/src/Features/Core/Portable/InitializeParameter/AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs @@ -251,11 +251,11 @@ CodeGenerationOptionsProvider fallbackOptions if (parameters.Length < 2) return default; - var fields = parameters.SelectAsArray( - p => (ISymbol)CreateField(p, accessibilityModifiersRequired, rules) + var fields = parameters.SelectAsArray(p => + (ISymbol)CreateField(p, accessibilityModifiersRequired, rules) ); - var properties = parameters.SelectAsArray( - p => (ISymbol)CreateProperty(p, accessibilityModifiersRequired, rules) + var properties = parameters.SelectAsArray(p => + (ISymbol)CreateProperty(p, accessibilityModifiersRequired, rules) ); var allFieldsAction = CodeAction.Create( diff --git a/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs b/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs index 796609c2e1d..d527d396f63 100644 --- a/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs +++ b/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.MethodParametersInfo.cs @@ -266,10 +266,9 @@ CancellationToken cancellationToken // { // DoSomething(i, j); // } - var operationsWithLiteralArgument = allArgumentOperations.WhereAsArray( - argument => - _syntaxFacts.IsLiteralExpression(argument.Value.Syntax) - && argument.ArgumentKind == ArgumentKind.Explicit + var operationsWithLiteralArgument = allArgumentOperations.WhereAsArray(argument => + _syntaxFacts.IsLiteralExpression(argument.Value.Syntax) + && argument.ArgumentKind == ArgumentKind.Explicit ); // 4. Find the default value parameters. Similarly to 3, they should be replaced by the default value. @@ -292,8 +291,8 @@ CancellationToken cancellationToken // { // DoSomething(i, j); // } - var operationsWithDefaultValue = allArgumentOperations.WhereAsArray( - argument => argument.ArgumentKind == ArgumentKind.DefaultValue + var operationsWithDefaultValue = allArgumentOperations.WhereAsArray(argument => + argument.ArgumentKind == ArgumentKind.DefaultValue ); // 5. All the remaining arguments, which might includes method call and a lot of other expressions. @@ -358,9 +357,8 @@ CancellationToken cancellationToken operationsToGenerateFreshVariablesFor.RemoveRange(operationsReadOnlyOnce); var parametersToGenerateFreshVariablesFor = operationsToGenerateFreshVariablesFor // We excluded arglist callees, so Parameter will always be non null - .SelectAsArray( - argument => - (argument.Parameter!, GenerateArgumentExpression(syntaxGenerator, argument)) + .SelectAsArray(argument => + (argument.Parameter!, GenerateArgumentExpression(syntaxGenerator, argument)) ); var parameterToReplaceMap = operationsWithLiteralArgument @@ -394,15 +392,14 @@ CancellationToken cancellationToken // 'y' might becomes the first declaration if using dictionary instead of array. var parametersWithVariableDeclarationArgument = operationsWithVariableDeclarationArgument - .Select( - argument => - ( - argument.Parameter, - callerSemanticModel - .GetSymbolInfo(argument.Value.Syntax, cancellationToken) - .GetAnySymbol() - ?.Name - ) + .Select(argument => + ( + argument.Parameter, + callerSemanticModel + .GetSymbolInfo(argument.Value.Syntax, cancellationToken) + .GetAnySymbol() + ?.Name + ) ) .Where(parameterAndArgumentName => parameterAndArgumentName.Name != null) .ToImmutableArray(); @@ -431,10 +428,9 @@ await ShouldMergeInlineContentAndVariableDeclarationArgumentAsync( // This such case, just use the argument expression to parameter. // Note: this might also cause semantics changes but is acceptable for a refactoring var parameterToReplaceMap = allArgumentOperations - .Where( - argument => - argument.Value.Syntax is TExpressionSyntax - && !_syntaxFacts.IsDeclarationExpression(argument.Value.Syntax) + .Where(argument => + argument.Value.Syntax is TExpressionSyntax + && !_syntaxFacts.IsDeclarationExpression(argument.Value.Syntax) ) .ToImmutableDictionary( // We excluded arglist callees, so Parameter will always be non null @@ -516,15 +512,14 @@ CancellationToken cancellationToken // the 'i' in the caller will be considered as the referenced location var allReferencedLocations = allReferences .SelectMany(@ref => @ref.Locations) - .Where( - location => - !location.IsImplicit - && calleeMethodNode.Contains( - location.Location.FindNode( - getInnermostNodeForTie: true, - cancellationToken - ) + .Where(location => + !location.IsImplicit + && calleeMethodNode.Contains( + location.Location.FindNode( + getInnermostNodeForTie: true, + cancellationToken ) + ) ) .ToImmutableArray(); diff --git a/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs index 80d502df3ea..73138936453 100644 --- a/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs @@ -367,10 +367,9 @@ CancellationToken cancellationToken var statementContainsInvocation = calleeInvocationNode .GetAncestors() - .TakeWhile( - node => - !_syntaxFacts.IsAnonymousFunctionExpression(node) - && !_syntaxFacts.IsLocalFunctionStatement(node) + .TakeWhile(node => + !_syntaxFacts.IsAnonymousFunctionExpression(node) + && !_syntaxFacts.IsLocalFunctionStatement(node) ) .FirstOrDefault(node => node is TStatementSyntax) as TStatementSyntax; diff --git a/roslyn/src/Features/Core/Portable/IntroduceParameter/AbstractIntroduceParameterCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/IntroduceParameter/AbstractIntroduceParameterCodeRefactoringProvider.cs index a3ff6f08696..f7c10f0c472 100644 --- a/roslyn/src/Features/Core/Portable/IntroduceParameter/AbstractIntroduceParameterCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/IntroduceParameter/AbstractIntroduceParameterCodeRefactoringProvider.cs @@ -71,8 +71,8 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex if (!IsValidExpression(expression, syntaxFacts)) return; - var containingMethod = expression.FirstAncestorOrSelf( - node => generator.GetParameterListNode(node) is not null + var containingMethod = expression.FirstAncestorOrSelf(node => + generator.GetParameterListNode(node) is not null ); if (containingMethod is null) return; @@ -175,8 +175,8 @@ ISyntaxFactsService syntaxFacts // Need to special case for expressions that are contained within a parameter or attribute argument // because it is technically "contained" within a method, but does not make // sense to introduce. - var invalidNode = expression.FirstAncestorOrSelf( - node => syntaxFacts.IsAttributeArgument(node) || syntaxFacts.IsParameter(node) + var invalidNode = expression.FirstAncestorOrSelf(node => + syntaxFacts.IsAttributeArgument(node) || syntaxFacts.IsParameter(node) ); return invalidNode is null; } diff --git a/roslyn/src/Features/Core/Portable/IntroduceUsingStatement/AbstractIntroduceUsingStatementCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/IntroduceUsingStatement/AbstractIntroduceUsingStatementCodeRefactoringProvider.cs index b5cf5ceab88..d395b5582cc 100644 --- a/roslyn/src/Features/Core/Portable/IntroduceUsingStatement/AbstractIntroduceUsingStatementCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/IntroduceUsingStatement/AbstractIntroduceUsingStatementCodeRefactoringProvider.cs @@ -498,12 +498,11 @@ CancellationToken cancellationToken { var identifierName = syntaxFactsService.GetIdentifierOfSimpleName(node).ValueText; - var variable = localVariables.FirstOrDefault( - localVariable => - syntaxFactsService.StringComparer.Equals(localVariable.Name, identifierName) - && localVariable.Equals( - semanticModel.GetSymbolInfo(node, cancellationToken).Symbol - ) + var variable = localVariables.FirstOrDefault(localVariable => + syntaxFactsService.StringComparer.Equals(localVariable.Name, identifierName) + && localVariable.Equals( + semanticModel.GetSymbolInfo(node, cancellationToken).Symbol + ) ); if (variable is object) diff --git a/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.State.cs b/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.State.cs index 81a42bef832..35c26029294 100644 --- a/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.State.cs +++ b/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.State.cs @@ -97,8 +97,9 @@ CancellationToken cancellationToken return false; // Too noisy to offer introduce-local on `this/me`. - var syntaxFacts = - document.Document.GetRequiredLanguageService(); + var syntaxFacts = document.Document.GetRequiredLanguageService( + + ); if (syntaxFacts.IsThisExpression(Expression)) return false; @@ -248,10 +249,9 @@ TExpressionSyntax expression var declaration = equalsValue .AncestorsAndSelf() - .FirstOrDefault( - n => - syntaxFacts.IsLocalDeclarationStatement(n) - || syntaxFacts.IsFieldDeclaration(n) + .FirstOrDefault(n => + syntaxFacts.IsLocalDeclarationStatement(n) + || syntaxFacts.IsFieldDeclaration(n) ); if (declaration == null) return false; diff --git a/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs b/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs index 7669c96066d..8e255e4281c 100644 --- a/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs +++ b/roslyn/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs @@ -509,8 +509,9 @@ protected static SyntaxToken GenerateUniqueFieldName( CancellationToken cancellationToken ) { - var semanticFacts = - semanticDocument.Document.GetLanguageService(); + var semanticFacts = semanticDocument.Document.GetLanguageService( + + ); var semanticModel = semanticDocument.SemanticModel; var baseName = semanticFacts.GenerateNameForExpression( @@ -540,8 +541,9 @@ CancellationToken cancellationToken { var semanticModel = semanticDocument.SemanticModel; - var semanticFacts = - semanticDocument.Document.GetLanguageService(); + var semanticFacts = semanticDocument.Document.GetLanguageService( + + ); var baseName = semanticFacts.GenerateNameForExpression( semanticModel, expression, diff --git a/roslyn/src/Features/Core/Portable/MetadataAsSource/DocumentationCommentUtilities.cs b/roslyn/src/Features/Core/Portable/MetadataAsSource/DocumentationCommentUtilities.cs index e940591c9b2..b563b62c836 100644 --- a/roslyn/src/Features/Core/Portable/MetadataAsSource/DocumentationCommentUtilities.cs +++ b/roslyn/src/Features/Core/Portable/MetadataAsSource/DocumentationCommentUtilities.cs @@ -13,9 +13,9 @@ namespace Microsoft.CodeAnalysis.MetadataAsSource { internal static class DocumentationCommentUtilities { - private static readonly ObjectPool> s_pool = SharedPools.Default< - List - >(); + private static readonly ObjectPool> s_pool = SharedPools.Default>( + + ); public static string ExtractXMLFragment(string input, string docCommentPrefix) { diff --git a/roslyn/src/Features/Core/Portable/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs index fe388145347..b6c5b622a33 100644 --- a/roslyn/src/Features/Core/Portable/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceCodeRefactoringProvider.cs @@ -38,8 +38,9 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte return; } - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); if ( !await service .CanMoveDeclarationNearReferenceAsync(document, declaration, cancellationToken) @@ -66,8 +67,9 @@ private static async Task MoveDeclarationNearReferenceAsync( CancellationToken cancellationToken ) { - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); return await service .MoveDeclarationNearReferenceAsync(document, statement, cancellationToken) .ConfigureAwait(false); diff --git a/roslyn/src/Features/Core/Portable/MoveStaticMembers/MoveStaticMembersWithDialogCodeAction.cs b/roslyn/src/Features/Core/Portable/MoveStaticMembers/MoveStaticMembersWithDialogCodeAction.cs index e687332165a..a6dcfa789ed 100644 --- a/roslyn/src/Features/Core/Portable/MoveStaticMembers/MoveStaticMembersWithDialogCodeAction.cs +++ b/roslyn/src/Features/Core/Portable/MoveStaticMembers/MoveStaticMembersWithDialogCodeAction.cs @@ -147,8 +147,8 @@ CancellationToken cancellationToken cancellationToken ) .ConfigureAwait(false); - var projectToLocations = memberReferenceLocations.ToLookup( - loc => loc.location.Document.Project.Id + var projectToLocations = memberReferenceLocations.ToLookup(loc => + loc.location.Document.Project.Id ); var solutionWithFixedReferences = await RefactorReferencesAsync( projectToLocations, @@ -171,8 +171,8 @@ CancellationToken cancellationToken var members = memberNodes .Select(node => root.GetCurrentNode(node)) .WhereNotNull() - .SelectAsArray( - node => (semanticModel.GetDeclaredSymbol(node, cancellationToken), false) + .SelectAsArray(node => + (semanticModel.GetDeclaredSymbol(node, cancellationToken), false) ); var pullMembersUpOptions = PullMembersUpOptionsBuilder.BuildPullMembersUpOptions( @@ -243,8 +243,8 @@ CancellationToken cancellationToken cancellationToken ) .ConfigureAwait(false); - var projectToLocations = memberReferenceLocations.ToLookup( - loc => loc.location.Document.Project.Id + var projectToLocations = memberReferenceLocations.ToLookup(loc => + loc.location.Document.Project.Id ); var solutionWithFixedReferences = await RefactorReferencesAsync( projectToLocations, @@ -267,8 +267,8 @@ CancellationToken cancellationToken var members = oldMemberNodes .Select(node => root.GetCurrentNode(node)) .WhereNotNull() - .SelectAsArray( - node => (semanticModel.GetDeclaredSymbol(node, cancellationToken), false) + .SelectAsArray(node => + (semanticModel.GetDeclaredSymbol(node, cancellationToken), false) ); newTypeDoc = solutionWithFixedReferences.GetRequiredDocument(newTypeDoc.Id); @@ -318,8 +318,8 @@ CancellationToken cancellationToken var compilation = await project .GetCompilationAsync(cancellationToken) .ConfigureAwait(false); - var documentToLocations = referencesForProject.ToLookup( - reference => reference.location.Document.Id + var documentToLocations = referencesForProject.ToLookup(reference => + reference.location.Document.Id ); foreach (var (docId, referencesForDoc) in documentToLocations) { @@ -354,12 +354,8 @@ CancellationToken cancellationToken var syntaxFacts = doc.GetRequiredLanguageService(); // keep extension method flag attached to node through dict - var trackNodesDict = referenceLocations.ToImmutableDictionary( - refLoc => - refLoc.location.Location.FindNode( - getInnermostNodeForTie: true, - cancellationToken - ) + var trackNodesDict = referenceLocations.ToImmutableDictionary(refLoc => + refLoc.location.Location.FindNode(getInnermostNodeForTie: true, cancellationToken) ); var docEditor = await DocumentEditor @@ -486,17 +482,16 @@ private static async Task< CancellationToken cancellationToken ) { - var tasks = members.Select( - symbol => SymbolFinder.FindReferencesAsync(symbol, solution, cancellationToken) + var tasks = members.Select(symbol => + SymbolFinder.FindReferencesAsync(symbol, solution, cancellationToken) ); var symbolRefs = await Task.WhenAll(tasks).ConfigureAwait(false); return symbolRefs .Flatten() - .SelectMany( - refSymbol => - refSymbol - .Locations.Where(loc => !loc.IsCandidateLocation && !loc.IsImplicit) - .Select(loc => (loc, refSymbol.Definition.IsExtensionMethod())) + .SelectMany(refSymbol => + refSymbol + .Locations.Where(loc => !loc.IsCandidateLocation && !loc.IsImplicit) + .Select(loc => (loc, refSymbol.Definition.IsExtensionMethod())) ) .ToImmutableArrayOrEmpty(); } diff --git a/roslyn/src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs b/roslyn/src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs index 0cdc6c984e9..9fe633ab0ca 100644 --- a/roslyn/src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs +++ b/roslyn/src/Features/Core/Portable/MoveToNamespace/AbstractMoveToNamespaceService.cs @@ -300,8 +300,8 @@ CancellationToken cancellationToken var namespaceMembers = syntaxFacts.GetMembersOfBaseNamespaceDeclaration( namespaceNode ); - return namespaceMembers.SelectAsArray( - member => semanticModel.GetDeclaredSymbol(member, cancellationToken) + return namespaceMembers.SelectAsArray(member => + semanticModel.GetDeclaredSymbol(member, cancellationToken) ); case TCompilationUnitSyntax compilationUnit: var compilationUnitMembers = syntaxFacts.GetMembersOfCompilationUnit( @@ -311,8 +311,8 @@ CancellationToken cancellationToken // This is supported if the selected type is the only member declared in the global namespace in this document. // (See `TryAnalyzeNamedTypeAsync`) Debug.Assert(compilationUnitMembers.Count == 1); - return compilationUnitMembers.SelectAsArray( - member => semanticModel.GetDeclaredSymbol(member, cancellationToken) + return compilationUnitMembers.SelectAsArray(member => + semanticModel.GetDeclaredSymbol(member, cancellationToken) ); default: @@ -483,10 +483,9 @@ CancellationToken cancellationToken return compilation .GlobalNamespace.GetAllNamespaces(cancellationToken) - .Where( - n => - n.NamespaceKind == NamespaceKind.Module - && n.ContainingAssembly == compilation.Assembly + .Where(n => + n.NamespaceKind == NamespaceKind.Module + && n.ContainingAssembly == compilation.Assembly ) .Select(GetQualifiedName); } diff --git a/roslyn/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs b/roslyn/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs index 4064f18cec9..f4b0622c3cd 100644 --- a/roslyn/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs +++ b/roslyn/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs @@ -88,8 +88,8 @@ CancellationToken cancellationToken cancellationToken ); - var documentKeys = projects.SelectManyAsArray( - p => p.Documents.Select(DocumentKey.ToDocumentKey) + var documentKeys = projects.SelectManyAsArray(p => + p.Documents.Select(DocumentKey.ToDocumentKey) ); var priorityDocumentKeys = priorityDocuments.SelectAsArray(DocumentKey.ToDocumentKey); @@ -292,15 +292,14 @@ CancellationToken cancellationToken var asyncLazy = cachedIndexMap.GetOrAdd( (storageService, documentKey, stringTable), static t => - AsyncLazy.Create( - c => - TopLevelSyntaxTreeIndex.LoadAsync( - t.service, - t.documentKey, - checksum: null, - t.stringTable, - c - ) + AsyncLazy.Create(c => + TopLevelSyntaxTreeIndex.LoadAsync( + t.service, + t.documentKey, + checksum: null, + t.stringTable, + c + ) ) ); return asyncLazy.GetValueAsync(cancellationToken); diff --git a/roslyn/src/Features/Core/Portable/NavigateTo/INavigateToSearcherHost.cs b/roslyn/src/Features/Core/Portable/NavigateTo/INavigateToSearcherHost.cs index 4b86e52843f..617c17a0b4e 100644 --- a/roslyn/src/Features/Core/Portable/NavigateTo/INavigateToSearcherHost.cs +++ b/roslyn/src/Features/Core/Portable/NavigateTo/INavigateToSearcherHost.cs @@ -101,8 +101,8 @@ private Task GetRemoteHostHydrateTask() { // If there are no projects in this solution that use OOP, then there's nothing we need to do. if ( - _solution.Projects.All( - p => !RemoteSupportedLanguages.IsSupported(p.Language) + _solution.Projects.All(p => + !RemoteSupportedLanguages.IsSupported(p.Language) ) ) { diff --git a/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs b/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs index b9a5e19f642..757574aa931 100644 --- a/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs +++ b/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToSearcher.cs @@ -280,8 +280,7 @@ private ImmutableArray> GetOrderedProjectsToProcess() // service. No point examining them or adding progress items for them. foreach (var group in GetOrderedProjectsToProcessWorker()) { - var groupCopy = group.WhereAsArray( - p => _host.GetNavigateToSearchService(p) != null + var groupCopy = group.WhereAsArray(p => _host.GetNavigateToSearchService(p) != null ); if (!groupCopy.IsEmpty) result.Add(groupCopy); @@ -373,10 +372,8 @@ CancellationToken cancellationToken // rest of the results following soon after as best as we can find them. foreach (var projectGroup in orderedProjects) { - var groups = projectGroup.GroupBy( - p => - _host.GetNavigateToSearchService(p) - ?? throw ExceptionUtilities.Unreachable() + var groups = projectGroup.GroupBy(p => + _host.GetNavigateToSearchService(p) ?? throw ExceptionUtilities.Unreachable() ); if (!parallel) diff --git a/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToUtilities.cs b/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToUtilities.cs index 21be1ff65e8..21a1c5f2e1f 100644 --- a/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToUtilities.cs +++ b/roslyn/src/Features/Core/Portable/NavigateTo/NavigateToUtilities.cs @@ -18,8 +18,9 @@ public static ImmutableHashSet GetKindsProvided(Solution solution) var result = ImmutableHashSet.CreateBuilder(StringComparer.Ordinal); foreach (var project in solution.Projects) { - var navigateToSearchService = - project.GetLanguageService(); + var navigateToSearchService = project.GetLanguageService( + + ); if (navigateToSearchService != null) result.UnionWith(navigateToSearchService.KindsProvided); } diff --git a/roslyn/src/Features/Core/Portable/Navigation/NavigableItemFactory.cs b/roslyn/src/Features/Core/Portable/Navigation/NavigableItemFactory.cs index 0b12173642d..3ed57151420 100644 --- a/roslyn/src/Features/Core/Portable/Navigation/NavigableItemFactory.cs +++ b/roslyn/src/Features/Core/Portable/Navigation/NavigableItemFactory.cs @@ -34,8 +34,8 @@ CancellationToken cancellationToken ) { var locations = GetPreferredSourceLocations(solution, symbol, cancellationToken); - return locations.SelectAsArray( - loc => GetItemFromSymbolLocation(solution, symbol, loc, displayTaggedParts) + return locations.SelectAsArray(loc => + GetItemFromSymbolLocation(solution, symbol, loc, displayTaggedParts) ); } diff --git a/roslyn/src/Features/Core/Portable/Organizing/AbstractOrganizingService.cs b/roslyn/src/Features/Core/Portable/Organizing/AbstractOrganizingService.cs index 0f6739aea54..f9cf53111bb 100644 --- a/roslyn/src/Features/Core/Portable/Organizing/AbstractOrganizingService.cs +++ b/roslyn/src/Features/Core/Portable/Organizing/AbstractOrganizingService.cs @@ -48,8 +48,7 @@ IEnumerable getter(Type t1) from o in organizers where !o.SyntaxNodeTypes.Any() - || o.SyntaxNodeTypes.Any( - t2 => t1 == t2 || t1.GetTypeInfo().IsSubclassOf(t2) + || o.SyntaxNodeTypes.Any(t2 => t1 == t2 || t1.GetTypeInfo().IsSubclassOf(t2) ) select o ).Distinct(); diff --git a/roslyn/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs b/roslyn/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs index 5e580bd9e77..83cd7b2cb70 100644 --- a/roslyn/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs +++ b/roslyn/src/Features/Core/Portable/PdbSourceDocument/PdbSourceDocumentMetadataAsSourceFileProvider.cs @@ -158,7 +158,9 @@ out dllPath // we have is from the reference assembly. To do this we create an empty compilation, // add our DLL as a reference, and use SymbolKey to map the type across. var documentationProvider = - sourceWorkspace.Services.GetRequiredService(); + sourceWorkspace.Services.GetRequiredService( + + ); var dllReference = IOUtilities.PerformIO( () => MetadataReference.CreateFromFile( @@ -304,16 +306,15 @@ out var fallbackEncodingString var useExtendedTimeout = _sourceLinkEnabledProjects.Contains(projectId); var encoding = defaultEncoding ?? Encoding.UTF8; var sourceFileInfoTasks = sourceDocuments - .Select( - sd => - _pdbSourceDocumentLoaderService.LoadSourceDocumentAsync( - tempFilePath, - sd, - encoding, - telemetryMessage, - useExtendedTimeout, - cancellationToken - ) + .Select(sd => + _pdbSourceDocumentLoaderService.LoadSourceDocumentAsync( + tempFilePath, + sd, + encoding, + telemetryMessage, + useExtendedTimeout, + cancellationToken + ) ) .ToArray(); var sourceFileInfos = await Task.WhenAll(sourceFileInfoTasks).ConfigureAwait(false); @@ -340,10 +341,9 @@ out var fallbackEncodingString // to the document passed in, which we just use the first document for. // TODO: Support results from multiple source files: https://github.com/dotnet/roslyn/issues/55834 var firstDocumentFilePath = sourceFileInfos[0]!.FilePath; - var firstDocument = navigateProject.Documents.First( - d => - d.FilePath?.Equals(firstDocumentFilePath, StringComparison.OrdinalIgnoreCase) - ?? false + var firstDocument = navigateProject.Documents.First(d => + d.FilePath?.Equals(firstDocumentFilePath, StringComparison.OrdinalIgnoreCase) + ?? false ); var navigateLocation = await MetadataAsSourceHelpers .GetLocationInGeneratedSourceAsync(symbolId, firstDocument, cancellationToken) @@ -355,12 +355,11 @@ out var fallbackEncodingString Contract.ThrowIfNull(navigateDocument); var sourceDescription = sourceFileInfos - .FirstOrDefault( - sfi => - sfi!.FilePath?.Equals( - navigateDocument.FilePath, - StringComparison.OrdinalIgnoreCase - ) ?? false + .FirstOrDefault(sfi => + sfi!.FilePath?.Equals( + navigateDocument.FilePath, + StringComparison.OrdinalIgnoreCase + ) ?? false ) ?.SourceDescription ?? FeaturesResources.from_metadata; diff --git a/roslyn/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs b/roslyn/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs index d742ca0e5f5..10a0b169484 100644 --- a/roslyn/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs +++ b/roslyn/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs @@ -444,7 +444,9 @@ CancellationToken cancellationToken using var _ = PooledHashSet.GetInstance(out var sourceImports); var syntaxFacts = - destinationEditor.OriginalDocument.GetRequiredLanguageService(); + destinationEditor.OriginalDocument.GetRequiredLanguageService( + + ); // Remove some original members since we are pulling members into class. // Note: If the user chooses to make the member abstract, then the original member will be changed to an override, @@ -475,16 +477,13 @@ CancellationToken cancellationToken sourceImports.AddRange( GetImports(syntax, syntaxFacts) - .Select( - import => - import - .WithoutLeadingTrivia() - .WithTrailingTrivia( - originalMemberEditor - .Generator - .ElasticCarriageReturnLineFeed - ) - .WithAdditionalAnnotations(s_removableImportAnnotation) + .Select(import => + import + .WithoutLeadingTrivia() + .WithTrailingTrivia( + originalMemberEditor.Generator.ElasticCarriageReturnLineFeed + ) + .WithAdditionalAnnotations(s_removableImportAnnotation) ) ); @@ -514,9 +513,8 @@ CancellationToken cancellationToken // Change the destination to abstract class if needed. if ( !result.Destination.IsAbstract - && result.MemberAnalysisResults.Any( - static analysis => - analysis.Member.IsAbstract || analysis.MakeMemberDeclarationAbstract + && result.MemberAnalysisResults.Any(static analysis => + analysis.Member.IsAbstract || analysis.MakeMemberDeclarationAbstract ) ) { @@ -559,7 +557,9 @@ CancellationToken cancellationToken ); var removeImportsService = - destinationEditor.OriginalDocument.GetRequiredLanguageService(); + destinationEditor.OriginalDocument.GetRequiredLanguageService( + + ); var destinationDocument = await removeImportsService .RemoveUnnecessaryImportsAsync( destinationEditor.GetChangedDocument(), @@ -643,16 +643,13 @@ ISyntaxFactsService syntaxFacts { return start .AncestorsAndSelf() - .Where( - node => - node is ICompilationUnitSyntax - || syntaxFacts.IsBaseNamespaceDeclaration(node) + .Where(node => + node is ICompilationUnitSyntax || syntaxFacts.IsBaseNamespaceDeclaration(node) ) - .SelectMany( - node => - node is ICompilationUnitSyntax - ? syntaxFacts.GetImportsOfCompilationUnit(node) - : syntaxFacts.GetImportsOfBaseNamespaceDeclaration(node) + .SelectMany(node => + node is ICompilationUnitSyntax + ? syntaxFacts.GetImportsOfCompilationUnit(node) + : syntaxFacts.GetImportsOfBaseNamespaceDeclaration(node) ) .ToImmutableArray(); } diff --git a/roslyn/src/Features/Core/Portable/QuickInfo/QuickInfoServiceWithProviders.cs b/roslyn/src/Features/Core/Portable/QuickInfo/QuickInfoServiceWithProviders.cs index fc3c07c8398..5ea4f1af2c2 100644 --- a/roslyn/src/Features/Core/Portable/QuickInfo/QuickInfoServiceWithProviders.cs +++ b/roslyn/src/Features/Core/Portable/QuickInfo/QuickInfoServiceWithProviders.cs @@ -58,8 +58,9 @@ private ImmutableArray GetProviders() CancellationToken cancellationToken ) { - var extensionManager = - _services.SolutionServices.GetRequiredService(); + var extensionManager = _services.SolutionServices.GetRequiredService( + + ); // returns the first non-empty quick info found (based on provider order) foreach (var provider in GetProviders()) @@ -95,8 +96,9 @@ CancellationToken cancellationToken CancellationToken cancellationToken ) { - var extensionManager = - _services.SolutionServices.GetRequiredService(); + var extensionManager = _services.SolutionServices.GetRequiredService( + + ); // returns the first non-empty quick info found (based on provider order) foreach (var provider in GetProviders().OfType()) diff --git a/roslyn/src/Features/Core/Portable/Rename/SymbolicRenameInfo.cs b/roslyn/src/Features/Core/Portable/Rename/SymbolicRenameInfo.cs index 6b9d6f3f7d0..b6716154856 100644 --- a/roslyn/src/Features/Core/Portable/Rename/SymbolicRenameInfo.cs +++ b/roslyn/src/Features/Core/Portable/Rename/SymbolicRenameInfo.cs @@ -92,8 +92,9 @@ bool IsRenamingAttributeTypeWithAttributeSuffix() public string GetWithoutAttributeSuffix(string value) { Contract.ThrowIfTrue(this.IsError); - var isCaseSensitive = - this.Document.GetRequiredLanguageService().IsCaseSensitive; + var isCaseSensitive = this.Document.GetRequiredLanguageService( + + ).IsCaseSensitive; return value.GetWithoutAttributeSuffix(isCaseSensitive)!; } @@ -101,8 +102,9 @@ private bool HasAttributeSuffix(string value) { Contract.ThrowIfTrue(this.IsError); - var isCaseSensitive = - this.Document.GetRequiredLanguageService().IsCaseSensitive; + var isCaseSensitive = this.Document.GetRequiredLanguageService( + + ).IsCaseSensitive; return value.TryGetWithoutAttributeSuffix(isCaseSensitive, result: out var _); } @@ -299,12 +301,9 @@ out var langError var projectIdOfLocation = sourceDocument.Project.Id; if ( - solution.Projects.Any( - p => - p.IsSubmission - && p.ProjectReferences.Any( - r => r.ProjectId == projectIdOfLocation - ) + solution.Projects.Any(p => + p.IsSubmission + && p.ProjectReferences.Any(r => r.ProjectId == projectIdOfLocation) ) ) return new SymbolicRenameInfo( diff --git a/roslyn/src/Features/Core/Portable/ReplacePropertyWithMethods/ReplacePropertyWithMethodsCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/ReplacePropertyWithMethods/ReplacePropertyWithMethodsCodeRefactoringProvider.cs index 21eb319dc15..c4715d32987 100644 --- a/roslyn/src/Features/Core/Portable/ReplacePropertyWithMethods/ReplacePropertyWithMethodsCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/ReplacePropertyWithMethods/ReplacePropertyWithMethodsCodeRefactoringProvider.cs @@ -205,10 +205,9 @@ private static bool HasAnyMatchingSetMethods(IPropertySymbol property, string na && property .ContainingType.GetMembers(SetPrefix + name) .OfType() - .Any( - m => - m.Parameters.Length == 1 - && comparer.Equals(m.Parameters[0].Type, property.Type) + .Any(m => + m.Parameters.Length == 1 + && comparer.Equals(m.Parameters[0].Type, property.Type) ); } @@ -338,8 +337,9 @@ CancellationToken cancellationToken { if (references != null) { - var syntaxFacts = - originalDocument.GetRequiredLanguageService(); + var syntaxFacts = originalDocument.GetRequiredLanguageService( + + ); // We may hit a location multiple times due to how we do FAR for linked symbols, but each linked symbol // is allowed to report the entire set of references it think it is compatible with. So ensure we're diff --git a/roslyn/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs b/roslyn/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs index 57685a4ef13..b00a5e9d94f 100644 --- a/roslyn/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs +++ b/roslyn/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs @@ -59,13 +59,12 @@ CancellationToken cancellationToken var syntaxFacts = document.GetLanguageService(); var memberAccessNodes = diagnostics - .Select( - d => - (TMemberAccessExpressionSyntax) - d.AdditionalLocations[0].FindNode( - getInnermostNodeForTie: true, - cancellationToken - ) + .Select(d => + (TMemberAccessExpressionSyntax) + d.AdditionalLocations[0].FindNode( + getInnermostNodeForTie: true, + cancellationToken + ) ) .ToSet(); diff --git a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs index 667224f4d77..a697c75463d 100644 --- a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs +++ b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs @@ -90,10 +90,14 @@ CancellationToken shutdownToken // event and worker queues _documentTracker = - _registration.Workspace.Services.GetRequiredService(); + _registration.Workspace.Services.GetRequiredService( + + ); var globalNotificationService = _registration - .Workspace.Services.SolutionServices.ExportProvider.GetExports() + .Workspace.Services.SolutionServices.ExportProvider.GetExports( + + ) .FirstOrDefault() ?.Value; @@ -581,8 +585,8 @@ List items ._normalPriorityProcessor.GetTestAccessor() .WaitUntilCompletion(analyzers, items); - var projectItems = items.Select( - i => i.ToProjectWorkItem(EmptyAsyncToken.Instance) + var projectItems = items.Select(i => + i.ToProjectWorkItem(EmptyAsyncToken.Instance) ); _incrementalAnalyzerProcessor ._lowPriorityProcessor.GetTestAccessor() @@ -628,14 +632,11 @@ bool onlyHighPriorityAnalyzer { // Sort list so DiagnosticIncrementalAnalyzers (if any) come first. analyzers = _analyzerProviders - .Select( - p => - ( - analyzer: p.Value.CreateIncrementalAnalyzer( - workspace - ), - highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile - ) + .Select(p => + ( + analyzer: p.Value.CreateIncrementalAnalyzer(workspace), + highPriorityForActiveFile: p.Metadata.HighPriorityForActiveFile + ) ) .Where(t => t.analyzer != null) .OrderBy(t => t.analyzer!.Priority) diff --git a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs index 51f6a78192e..d04e505370e 100644 --- a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs +++ b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.NormalPriorityProcessor.cs @@ -236,7 +236,9 @@ private IEnumerable GetPrioritizedPendingDocuments() // Now any visible documents foreach ( - var visibleDocumentId in Processor._documentTracker.GetVisibleDocuments() + var visibleDocumentId in Processor._documentTracker.GetVisibleDocuments( + + ) ) { yield return visibleDocumentId; diff --git a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs index 643f9740095..87e4dadf3e1 100644 --- a/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs +++ b/roslyn/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs @@ -534,15 +534,15 @@ await EnqueueChangedDocumentWorkItemAsync( .GetSourceGeneratedDocumentsAsync(_shutdownToken) .ConfigureAwait(false); var oldProjectSourceGeneratedDocumentsById = - oldProjectSourceGeneratedDocuments.ToDictionary( - static document => document.Id + oldProjectSourceGeneratedDocuments.ToDictionary(static document => + document.Id ); var newProjectSourceGeneratedDocuments = await newProject .GetSourceGeneratedDocumentsAsync(_shutdownToken) .ConfigureAwait(false); var newProjectSourceGeneratedDocumentsById = - newProjectSourceGeneratedDocuments.ToDictionary( - static document => document.Id + newProjectSourceGeneratedDocuments.ToDictionary(static document => + document.Id ); foreach ( @@ -864,8 +864,9 @@ private async Task EnqueueChangedDocumentWorkItemAsync( Document newDocument ) { - var differenceService = - newDocument.GetLanguageService(); + var differenceService = newDocument.GetLanguageService( + + ); if (differenceService == null) { diff --git a/roslyn/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs b/roslyn/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs index d2b076bb1f8..601038a4c0c 100644 --- a/roslyn/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs +++ b/roslyn/src/Features/Core/Portable/SpellCheck/AbstractSpellCheckSpanService.cs @@ -35,8 +35,9 @@ CancellationToken cancellationToken ImmutableArray GetSpans() { var syntaxFacts = document.GetRequiredLanguageService(); - var classifier = - document.GetRequiredLanguageService(); + var classifier = document.GetRequiredLanguageService( + + ); var virtualCharService = document.GetRequiredLanguageService(); diff --git a/roslyn/src/Features/Core/Portable/SplitOrMergeIfStatements/AbstractMergeIfStatementsCodeRefactoringProvider.cs b/roslyn/src/Features/Core/Portable/SplitOrMergeIfStatements/AbstractMergeIfStatementsCodeRefactoringProvider.cs index 9455742b53e..018fdd557e3 100644 --- a/roslyn/src/Features/Core/Portable/SplitOrMergeIfStatements/AbstractMergeIfStatementsCodeRefactoringProvider.cs +++ b/roslyn/src/Features/Core/Portable/SplitOrMergeIfStatements/AbstractMergeIfStatementsCodeRefactoringProvider.cs @@ -138,8 +138,8 @@ SyntaxNode root ) { var innerMatch = root.FindNode(span, getInnermostNodeForTie: true); - return innerMatch?.FirstAncestorOrSelf( - node => ifGenerator.IsIfOrElseIf(node) && node.Span == span + return innerMatch?.FirstAncestorOrSelf(node => + ifGenerator.IsIfOrElseIf(node) && node.Span == span ); } } diff --git a/roslyn/src/Features/Core/Portable/SyncNamespaces/AbstractSyncNamespacesService.cs b/roslyn/src/Features/Core/Portable/SyncNamespaces/AbstractSyncNamespacesService.cs index f1bcaf5c906..48bd4fb2702 100644 --- a/roslyn/src/Features/Core/Portable/SyncNamespaces/AbstractSyncNamespacesService.cs +++ b/roslyn/src/Features/Core/Portable/SyncNamespaces/AbstractSyncNamespacesService.cs @@ -235,8 +235,8 @@ CancellationToken cancellationToken ) .ConfigureAwait(false); return projectDiagnostics - .Where( - diagnostic => diagnostic.Location.SourceTree?.FilePath == document.FilePath + .Where(diagnostic => + diagnostic.Location.SourceTree?.FilePath == document.FilePath ) .ToImmutableArray(); } diff --git a/roslyn/src/Features/Core/Portable/UnusedReferences/ProjectAssets/ProjectAssetsReader.cs b/roslyn/src/Features/Core/Portable/UnusedReferences/ProjectAssets/ProjectAssetsReader.cs index 370f655c123..37c405860e3 100644 --- a/roslyn/src/Features/Core/Portable/UnusedReferences/ProjectAssets/ProjectAssetsReader.cs +++ b/roslyn/src/Features/Core/Portable/UnusedReferences/ProjectAssets/ProjectAssetsReader.cs @@ -46,11 +46,10 @@ public static ImmutableArray AddDependencyHierarchies( .Project?.Frameworks ?.Values .Where(framework => framework.Dependencies != null) - .SelectMany( - framework => - framework.Dependencies!.Keys.Where( - key => framework.Dependencies[key].AutoReferenced - ) + .SelectMany(framework => + framework.Dependencies!.Keys.Where(key => + framework.Dependencies[key].AutoReferenced + ) ) .Distinct() .ToImmutableHashSet(); @@ -66,15 +65,14 @@ public static ImmutableArray AddDependencyHierarchies( var builtReferences = new Dictionary(); var references = projectReferences - .Select( - projectReference => - EnhanceReference( - projectAssets, - projectReference, - autoReferences, - targetLibraryKeys, - builtReferences - ) + .Select(projectReference => + EnhanceReference( + projectAssets, + projectReference, + autoReferences, + targetLibraryKeys, + builtReferences + ) ) .WhereNotNull() .ToImmutableArray(); @@ -204,15 +202,14 @@ public static ImmutableArray AddDependencyHierarchies( } var dependencies = dependencyNames - .Select( - dependency => - BuildReference( - projectAssets, - dependency, - treatAsUsed: false, - targetLibraryKeys, - builtReferences - ) + .Select(dependency => + BuildReference( + projectAssets, + dependency, + treatAsUsed: false, + targetLibraryKeys, + builtReferences + ) ) .WhereNotNull() .ToImmutableArray(); diff --git a/roslyn/src/Features/Core/Portable/ValueTracking/ValueTracker.OperationCollector.cs b/roslyn/src/Features/Core/Portable/ValueTracking/ValueTracker.OperationCollector.cs index d9dda14a7d5..df4d7cbc3ea 100644 --- a/roslyn/src/Features/Core/Portable/ValueTracking/ValueTracker.OperationCollector.cs +++ b/roslyn/src/Features/Core/Portable/ValueTracking/ValueTracker.OperationCollector.cs @@ -290,9 +290,8 @@ CancellationToken cancellationToken .Select(argument => (collector: Clone(), argument)) .ToImmutableArray(); - var tasks = collectorsAndArgumentMap.Select( - pair => - Task.Run(() => pair.collector.VisitAsync(pair.argument, cancellationToken)) + var tasks = collectorsAndArgumentMap.Select(pair => + Task.Run(() => pair.collector.VisitAsync(pair.argument, cancellationToken)) ); await Task.WhenAll(tasks).ConfigureAwait(false); diff --git a/roslyn/src/Features/Core/Portable/Wrapping/AbstractWrapper.cs b/roslyn/src/Features/Core/Portable/Wrapping/AbstractWrapper.cs index 278f3a2167f..213e0cc7138 100644 --- a/roslyn/src/Features/Core/Portable/Wrapping/AbstractWrapper.cs +++ b/roslyn/src/Features/Core/Portable/Wrapping/AbstractWrapper.cs @@ -79,10 +79,9 @@ TextSpan headerSpan ) => declaration .GetDiagnostics() - .Any( - d => - d.Severity == DiagnosticSeverity.Error - && d.Location.SourceSpan.OverlapsWith(headerSpan) + .Any(d => + d.Severity == DiagnosticSeverity.Error + && d.Location.SourceSpan.OverlapsWith(headerSpan) ); } } diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs index 739c9b56d1f..a0c9c4ebc5f 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs @@ -57,8 +57,9 @@ CancellationToken cancellationToken new(new NoOpAuthorizationService()) ); - var mefServiceBroker = - exportProvider.GetExportedValue(); + var mefServiceBroker = exportProvider.GetExportedValue( + + ); mefServiceBroker.SetContainer(container); // Register local mef services. diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerFactory.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerFactory.cs index b93af04b6ca..9e56015e0b5 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerFactory.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/ServiceBrokerFactory.cs @@ -29,8 +29,9 @@ internal class ServiceBrokerFactory private BrokeredServiceContainer? _container; private readonly ExportProvider _exportProvider; private Task _bridgeCompletionTask; - private readonly CancellationTokenSource _cancellationTokenSource = - new CancellationTokenSource(); + private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource( + + ); [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/Services/BrokeredServiceBridgeManifest/BrokeredServiceBridgeManifestService.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/Services/BrokeredServiceBridgeManifest/BrokeredServiceBridgeManifestService.cs index 0d0b8954157..e8273a95361 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/Services/BrokeredServiceBridgeManifest/BrokeredServiceBridgeManifestService.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/Services/BrokeredServiceBridgeManifest/BrokeredServiceBridgeManifestService.cs @@ -59,20 +59,19 @@ CancellationToken cancellationToken .GetRequiredServiceBrokerContainer() .GetRegisteredServices() .Select(s => s.Key) - .Where( - s => - s.Name.StartsWith( - "Microsoft.CodeAnalysis.LanguageServer.", - StringComparison.Ordinal - ) - || s.Name.StartsWith( - "Microsoft.VisualStudio.LanguageServer.", - StringComparison.Ordinal - ) - || s.Name.StartsWith( - "Microsoft.VisualStudio.LanguageServices.", - StringComparison.Ordinal - ) + .Where(s => + s.Name.StartsWith( + "Microsoft.CodeAnalysis.LanguageServer.", + StringComparison.Ordinal + ) + || s.Name.StartsWith( + "Microsoft.VisualStudio.LanguageServer.", + StringComparison.Ordinal + ) + || s.Name.StartsWith( + "Microsoft.VisualStudio.LanguageServices.", + StringComparison.Ordinal + ) ) .ToImmutableArray(); _logger.LogDebug( diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs index 8e931892216..90d94a12421 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/LspFileChangeWatcher.cs @@ -91,19 +91,16 @@ LspFileChangeWatcher lspFileChangeWatcher if (watchedDirectories.Any()) { var directoryWatches = watchedDirectories - .Select( - d => - new FileSystemWatcher - { - GlobPattern = new RelativePattern - { - BaseUri = ProtocolConversions.CreateAbsoluteUri(d.Path), - Pattern = d.ExtensionFilter is not null - ? "**/*" + d.ExtensionFilter - : "**/*" - } - } - ) + .Select(d => new FileSystemWatcher + { + GlobPattern = new RelativePattern + { + BaseUri = ProtocolConversions.CreateAbsoluteUri(d.Path), + Pattern = d.ExtensionFilter is not null + ? "**/*" + d.ExtensionFilter + : "**/*" + } + }) .ToArray(); _directoryWatchRegistration = new LspFileWatchRegistration( diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs index e74c6c34c1c..56501923a2f 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/LanguageServerProjectSystem.cs @@ -333,8 +333,8 @@ out var languageName foreach (var loadedProjectInfo in loadedProjectInfos) { // If we already have the project, just update it - var existingProject = existingProjects.Find( - p => p.GetTargetFramework() == loadedProjectInfo.TargetFramework + var existingProject = existingProjects.Find(p => + p.GetTargetFramework() == loadedProjectInfo.TargetFramework ); if (existingProject != null) @@ -436,8 +436,7 @@ logItem.Kind is WorkspaceDiagnosticKind.Failure ); } - return diagnosticLogItems.Any( - logItem => logItem.Kind is WorkspaceDiagnosticKind.Failure + return diagnosticLogItems.Any(logItem => logItem.Kind is WorkspaceDiagnosticKind.Failure ) ? LSP.MessageType.Error : LSP.MessageType.Warning; diff --git a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs index d5255ea3462..07280b98230 100644 --- a/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs +++ b/roslyn/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Program.cs @@ -50,9 +50,8 @@ CancellationToken cancellationToken builder.SetMinimumLevel(serverConfiguration.MinimumLogLevel); builder.AddConsole(); // The console logger outputs control characters on unix for colors which don't render correctly in VSCode. - builder.AddSimpleConsole( - formatterOptions => - formatterOptions.ColorBehavior = LoggerColorBehavior.Disabled + builder.AddSimpleConsole(formatterOptions => + formatterOptions.ColorBehavior = LoggerColorBehavior.Disabled ); }) ) @@ -112,10 +111,9 @@ CancellationToken cancellationToken var analyzerPaths = new DirectoryInfo(AppContext.BaseDirectory) .GetFiles("*.dll") - .Where( - f => - f.Name.StartsWith("Microsoft.CodeAnalysis.", StringComparison.Ordinal) - && !f.Name.Contains("LanguageServer", StringComparison.Ordinal) + .Where(f => + f.Name.StartsWith("Microsoft.CodeAnalysis.", StringComparison.Ordinal) + && !f.Name.Contains("LanguageServer", StringComparison.Ordinal) ) .Select(f => f.FullName) .ToImmutableArray(); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs b/roslyn/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs index 8ba7209e999..a792a307803 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs @@ -180,7 +180,9 @@ CancellationToken cancellationToken } var buildOnlyDiagnosticsService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); allDiagnostics = allDiagnostics.AddRange( buildOnlyDiagnosticsService.GetBuildOnlyDiagnostics(document.Id) ); @@ -308,7 +310,9 @@ [EnumeratorCancellation] CancellationToken cancellationToken } var buildOnlyDiagnosticsService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); var buildOnlyDiagnostics = buildOnlyDiagnosticsService.GetBuildOnlyDiagnostics( document.Id ); @@ -465,8 +469,8 @@ CancellationToken cancellationToken .ConfigureAwait(false); } - diagnostics = diagnostics.WhereAsArray( - d => d.Severity.IsMoreSevereThanOrEqualTo(minimumSeverity) + diagnostics = diagnostics.WhereAsArray(d => + d.Severity.IsMoreSevereThanOrEqualTo(minimumSeverity) ); if (!diagnostics.Any()) return null; @@ -652,8 +656,9 @@ private bool TryGetWorkspaceFixer( // Log exception and show info bar, if needed. if (logExceptionWithInfoBar) { - var errorReportingService = - services.GetRequiredService(); + var errorReportingService = services.GetRequiredService( + + ); var message = lazyFixer.Metadata.Name != null ? string.Format( @@ -760,8 +765,9 @@ [EnumeratorCancellation] CancellationToken cancellationToken if (TryGetWorkspaceFixersPriorityMap(document, out var fixersForLanguage)) allFixers = allFixers.Sort(new FixerComparer(allFixers, fixersForLanguage.Value)); - var extensionManager = - document.Project.Solution.Services.GetService(); + var extensionManager = document.Project.Solution.Services.GetService( + + ); // Run each CodeFixProvider to gather individual CodeFixes for reported diagnostics. // Ensure that no diagnostic has registered code actions from different code fix providers with same equivalance key. @@ -1090,8 +1096,8 @@ out var lazyConfigurationProviders cancellationToken ) .ConfigureAwait(false); - return fixes.WhereAsArray( - f => registeredConfigurationFixTitles.Add(f.Action.Title) + return fixes.WhereAsArray(f => + registeredConfigurationFixTitles.Add(f.Action.Title) ); }, fallbackOptions, @@ -1467,8 +1473,9 @@ private ImmutableDictionary< ImmutableArray > ComputeProjectFixers(TextDocument document) { - var extensionManager = - document.Project.Solution.Services.GetService(); + var extensionManager = document.Project.Solution.Services.GetService( + + ); using var _ = PooledDictionary>.GetInstance( out var builder diff --git a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs index 7a5763044b0..5bbc38a97da 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.Executor.cs @@ -171,12 +171,11 @@ DocumentAnalysisData previousData return true; return isOpenDocument - && previousData.Items.Any( - static d => - d.Severity - is DiagnosticSeverity.Error - or DiagnosticSeverity.Warning - or DiagnosticSeverity.Info + && previousData.Items.Any(static d => + d.Severity + is DiagnosticSeverity.Error + or DiagnosticSeverity.Warning + or DiagnosticSeverity.Info ); } } @@ -379,10 +378,9 @@ var openDocumentId in project.Solution.Workspace.GetOpenDocumentIds() } else if (!analyzersFullAnalysisEnabled) { - stateSets = stateSets.WhereAsArray( - s => - s.Analyzer.IsCompilerAnalyzer() - || s.Analyzer.IsWorkspaceDiagnosticAnalyzer() + stateSets = stateSets.WhereAsArray(s => + s.Analyzer.IsCompilerAnalyzer() + || s.Analyzer.IsWorkspaceDiagnosticAnalyzer() ); } diff --git a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs index ac612424540..9c910339678 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs @@ -319,10 +319,9 @@ CancellationToken cancellationToken var analyzers = documentAnalysisScope?.Analyzers - ?? compilationWithAnalyzers.Analyzers.Where( - a => - forceExecuteAllAnalyzers - || !a.IsOpenFileOnly(ideOptions.CleanupOptions?.SimplifierOptions) + ?? compilationWithAnalyzers.Analyzers.Where(a => + forceExecuteAllAnalyzers + || !a.IsOpenFileOnly(ideOptions.CleanupOptions?.SimplifierOptions) ); analyzerMap.AppendAnalyzerMap(analyzers); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs index 5e6f5bee0b0..bf633a176be 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.HostStates.cs @@ -118,8 +118,8 @@ ImmutableHashSet excludedAnalyzers var stateSetMap = StateSetMap .Where(kvp => !excludedAnalyzers.Contains(kvp.Key)) .ToImmutableDictionary(); - var orderedStateSets = OrderedStateSets.WhereAsArray( - stateSet => !excludedAnalyzers.Contains(stateSet.Analyzer) + var orderedStateSets = OrderedStateSets.WhereAsArray(stateSet => + !excludedAnalyzers.Contains(stateSet.Analyzer) ); return new HostAnalyzerStateSets(stateSetMap, orderedStateSets); } diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHelper.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHelper.cs index a095ee8f9c3..8b5b5974ceb 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHelper.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeActions/CodeActionResolveHelper.cs @@ -147,15 +147,13 @@ is not { .Any(docId => HasDocumentNameChange(docId, newSolution, solution)) || projectChange .GetChangedAdditionalDocuments() - .Any( - docId => - HasDocumentNameChange(docId, newSolution, solution) - || projectChange - .GetChangedAnalyzerConfigDocuments() - .Any( - docId => - HasDocumentNameChange(docId, newSolution, solution) - ) + .Any(docId => + HasDocumentNameChange(docId, newSolution, solution) + || projectChange + .GetChangedAnalyzerConfigDocuments() + .Any(docId => + HasDocumentNameChange(docId, newSolution, solution) + ) ) ) { diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs index f073a8c988c..5431c4c066b 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensHandler.cs @@ -162,8 +162,7 @@ LSP.TextDocumentIdentifier textDocumentIdentifier // Find any test container members based on the test method members we found (e.g. find the class containing the test methods). var testContainerNodes = testMethodMembers.Select(member => member.Node.Parent); - var testContainerMembers = members.Where( - member => testContainerNodes.Contains(member.Node) + var testContainerMembers = members.Where(member => testContainerNodes.Contains(member.Node) ); // Create code lenses for all test methods. diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueueFactory.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueueFactory.cs index 720c8a2f910..0af7992f221 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueueFactory.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/CodeLens/CodeLensRefreshQueueFactory.cs @@ -35,8 +35,9 @@ public ILspService CreateILspService( WellKnownLspServerKinds serverKind ) { - var notificationManager = - lspServices.GetRequiredService(); + var notificationManager = lspServices.GetRequiredService( + + ); var lspWorkspaceManager = lspServices.GetRequiredService(); return new CodeLensRefreshQueue( diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs index 42982472f12..27c3c44ae21 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/AbstractLspCompletionResultCreationService.cs @@ -96,7 +96,9 @@ CancellationToken cancellationToken >(CommitCharacterArrayComparer.Instance); var creationService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); var completionService = document.GetRequiredLanguageService(); var defaultSpan = list.Span; diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs index e912c47009f..51f5f1f3929 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionHandler.cs @@ -114,7 +114,9 @@ is not LSP.CompletionTriggerKind.TriggerForIncompleteCompletions var (list, isIncomplete, resultId) = completionListResult.Value; var creationService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); return await creationService .ConvertToLspCompletionListAsync( document, @@ -321,9 +323,8 @@ out var matchResult .Concat( matchResultsBuilder .Skip(completionListMaxSize) - .Where( - match => - match.CompletionItem.Rules.MatchPriority == MatchPriority.Preselect + .Where(match => + match.CompletionItem.Rules.MatchPriority == MatchPriority.Preselect ) ) .Select(matchResult => matchResult.CompletionItem) diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs index 826ee679b5f..9ebb715f4f1 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Completion/CompletionResolveHandler.cs @@ -63,8 +63,9 @@ CancellationToken cancellationToken } var document = context.GetRequiredDocument(); - var completionService = - document.Project.Services.GetRequiredService(); + var completionService = document.Project.Services.GetRequiredService( + + ); // Find the matching completion item in the completion list var selectedItem = cacheEntry.CompletionList.ItemsList.FirstOrDefault( @@ -80,7 +81,9 @@ CancellationToken cancellationToken if (selectedItem is not null) { var creationService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); await creationService .ResolveAsync( completionItem, diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractWorkspacePullDiagnosticsHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractWorkspacePullDiagnosticsHandler.cs index 5341b5eaa14..04451d4e3e5 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractWorkspacePullDiagnosticsHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractWorkspacePullDiagnosticsHandler.cs @@ -166,7 +166,9 @@ CancellationToken cancellationToken .Services.GetService() ?.EnableDiagnosticsInSourceGeneratedFiles == true; var codeAnalysisService = - solution.Workspace.Services.GetRequiredService(); + solution.Workspace.Services.GetRequiredService( + + ); foreach (var project in GetProjectsInPriorityOrder(solution, context.SupportedLanguages)) await AddDocumentsAndProjectAsync(project, cancellationToken).ConfigureAwait(false); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs index 3044df4a553..152c677cdfb 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DiagnosticsRefreshQueue.cs @@ -39,8 +39,9 @@ public ILspService CreateILspService( WellKnownLspServerKinds serverKind ) { - var notificationManager = - lspServices.GetRequiredService(); + var notificationManager = lspServices.GetRequiredService( + + ); var lspWorkspaceManager = lspServices.GetRequiredService(); return new DiagnosticsRefreshQueue( diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs index aee7d2379d5..7757bfc7d3b 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/FoldingRanges/FoldingRangesHandler.cs @@ -69,8 +69,9 @@ public static async Task GetFoldingRangesAsync( CancellationToken cancellationToken ) { - var blockStructureService = - document.GetRequiredLanguageService(); + var blockStructureService = document.GetRequiredLanguageService( + + ); var blockStructure = await blockStructureService .GetBlockStructureAsync(document, options, cancellationToken) .ConfigureAwait(false); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs index 7005af77ba3..9cadbbd9279 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/Hover/HoverHandler.cs @@ -86,7 +86,9 @@ CancellationToken cancellationToken return null; var hoverService = - document.Project.Solution.Services.GetRequiredService(); + document.Project.Solution.Services.GetRequiredService( + + ); return await hoverService .CreateHoverAsync(document, info, clientCapabilities, cancellationToken) .ConfigureAwait(false); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueueFactory.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueueFactory.cs index 0a6a2bcfe30..c212ac8b929 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueueFactory.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/InlayHint/InlayHintRefreshQueueFactory.cs @@ -36,8 +36,9 @@ public ILspService CreateILspService( WellKnownLspServerKinds serverKind ) { - var notificationManager = - lspServices.GetRequiredService(); + var notificationManager = lspServices.GetRequiredService( + + ); var lspWorkspaceManager = lspServices.GetRequiredService(); return new InlayHintRefreshQueue( diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs index 02f188f6322..87e8e1978f8 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/InlineCompletions/InlineCompletionsHandler.cs @@ -147,8 +147,8 @@ out var wordOnLeft return null; } - var matchingSnippetInfo = snippetInfo.First( - s => wordText.Equals(s.Shortcut, StringComparison.OrdinalIgnoreCase) + var matchingSnippetInfo = snippetInfo.First(s => + wordText.Equals(s.Shortcut, StringComparison.OrdinalIgnoreCase) ); var parsedSnippet = _xmlSnippetParser.GetParsedXmlSnippet(matchingSnippetInfo, context); diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/MapCode/MapCodeHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/MapCode/MapCodeHandler.cs index 2fb36b24273..75e184c9b07 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/MapCode/MapCodeHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/MapCode/MapCodeHandler.cs @@ -72,17 +72,14 @@ is true return new WorkspaceEdit { DocumentChanges = uriToEditsMap - .Select( - kvp => - new TextDocumentEdit - { - TextDocument = new OptionalVersionedTextDocumentIdentifier - { - Uri = kvp.Key - }, - Edits = kvp.Value, - } - ) + .Select(kvp => new TextDocumentEdit + { + TextDocument = new OptionalVersionedTextDocumentIdentifier + { + Uri = kvp.Key + }, + Edits = kvp.Value, + }) .ToArray() }; } diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs index 224fb689bf3..0eeb41de891 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs @@ -69,8 +69,9 @@ CancellationToken cancellationToken if (document == null) return null; - var service = - document.GetRequiredLanguageService(); + var service = document.GetRequiredLanguageService( + + ); // We should use the options passed in by LSP instead of the document's options. var formattingOptions = await ProtocolConversions diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs index fc014be5881..6ed550af94d 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensHelpers.cs @@ -136,8 +136,9 @@ private static async Task GetClassifiedSpansForDocumentAsync( CancellationToken cancellationToken ) { - var classificationService = - document.GetRequiredLanguageService(); + var classificationService = document.GetRequiredLanguageService( + + ); // We always return both syntactic and semantic classifications. If there is a syntactic classifier running on the client // then the semantic token classifications will override them. @@ -157,8 +158,8 @@ CancellationToken cancellationToken // about the 'text' classification. It's added for everything between real classifications (including // whitespace), and just means 'don't classify this'. No need for us to actually include that in // semantic tokens as it just wastes space in the result. - var nonEmptySpans = spans.Where( - s => !s.TextSpan.IsEmpty && s.ClassificationType != ClassificationTypeNames.Text + var nonEmptySpans = spans.Where(s => + !s.TextSpan.IsEmpty && s.ClassificationType != ClassificationTypeNames.Text ); classifiedSpans.AddRange(nonEmptySpans); } diff --git a/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs b/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs index 391aea276ea..92ab24b81b1 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensSchema.cs @@ -68,11 +68,8 @@ internal readonly struct SemanticTokensSchema private static readonly SemanticTokensSchema s_vsTokenSchema = new( ClassificationTypeNames - .AllTypeNames.Where( - classificationTypeName => - !ClassificationTypeNames.AdditiveTypeNames.Contains( - classificationTypeName - ) + .AllTypeNames.Where(classificationTypeName => + !ClassificationTypeNames.AdditiveTypeNames.Contains(classificationTypeName) ) .ToImmutableDictionary( classificationTypeName => classificationTypeName, @@ -92,11 +89,8 @@ internal readonly struct SemanticTokensSchema private static readonly SemanticTokensSchema s_pureLspTokenSchema = new( ClassificationTypeNames - .AllTypeNames.Where( - classificationTypeName => - !ClassificationTypeNames.AdditiveTypeNames.Contains( - classificationTypeName - ) + .AllTypeNames.Where(classificationTypeName => + !ClassificationTypeNames.AdditiveTypeNames.Contains(classificationTypeName) ) .ToImmutableDictionary( classificationTypeName => classificationTypeName, diff --git a/roslyn/src/Features/LanguageServer/Protocol/LspServices/LspServices.cs b/roslyn/src/Features/LanguageServer/Protocol/LspServices/LspServices.cs index b13f097bb8a..abebad9cdbe 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/LspServices/LspServices.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/LspServices/LspServices.cs @@ -46,21 +46,17 @@ ImmutableDictionary>> baseServic ) { // Convert MEF exported service factories to the lazy LSP services that they create. - var servicesFromFactories = mefLspServiceFactories.Select( - lz => - new Lazy( - () => lz.Value.CreateILspService(this, serverKind), - lz.Metadata - ) - ); + var servicesFromFactories = mefLspServiceFactories.Select(lz => new Lazy< + ILspService, + LspServiceMetadataView + >(() => lz.Value.CreateILspService(this, serverKind), lz.Metadata)); var services = mefLspServices.Concat(servicesFromFactories); // Make sure that we only include services exported for the specified server kind (or NotSpecified). - services = services.Where( - lazyService => - lazyService.Metadata.ServerKind == serverKind - || lazyService.Metadata.ServerKind == WellKnownLspServerKinds.Any + services = services.Where(lazyService => + lazyService.Metadata.ServerKind == serverKind + || lazyService.Metadata.ServerKind == WellKnownLspServerKinds.Any ); // This will throw if the same service is registered twice diff --git a/roslyn/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs b/roslyn/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs index 731a2298968..8eedd42d9e9 100644 --- a/roslyn/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs +++ b/roslyn/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs @@ -340,8 +340,8 @@ private async Task< registeredWorkspaces = registeredWorkspaces .Where(workspace => workspace.Kind != WorkspaceKind.MiscellaneousFiles) .Concat( - registeredWorkspaces.Where( - workspace => workspace.Kind == WorkspaceKind.MiscellaneousFiles + registeredWorkspaces.Where(workspace => + workspace.Kind == WorkspaceKind.MiscellaneousFiles ) ) .ToImmutableArray(); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs index af8e501f4bc..cfaa4bf537e 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeActions/CodeActionsTests.cs @@ -71,8 +71,8 @@ void M() testLspServer, CreateCodeActionParams(caretLocation) ); - var useImplicitType = results.FirstOrDefault( - r => r.Title == CSharpAnalyzersResources.Use_implicit_type + var useImplicitType = results.FirstOrDefault(r => + r.Title == CSharpAnalyzersResources.Use_implicit_type ); AssertJsonEquals(expected, useImplicitType); @@ -129,10 +129,9 @@ void M() FeaturesResources.Introduce_constant + '|' + string.Format(FeaturesResources.Introduce_constant_for_0, "1"); - var introduceConstant = topLevelAction.Children.FirstOrDefault( - r => - ((JObject)r.Data!).ToObject()!.UniqueIdentifier - == expectedChildActionTitle + var introduceConstant = topLevelAction.Children.FirstOrDefault(r => + ((JObject)r.Data!).ToObject()!.UniqueIdentifier + == expectedChildActionTitle ); AssertJsonEquals(expected, introduceConstant); @@ -171,8 +170,8 @@ void M() }; var results = await RunGetCodeActionsAsync(testLspServer, codeActionParams); - var addImport = results.FirstOrDefault( - r => r.Title.Contains($"using System.Threading.Tasks") + var addImport = results.FirstOrDefault(r => + r.Title.Contains($"using System.Threading.Tasks") ); Assert.Equal(1, addImport.Diagnostics!.Length); Assert.Equal(AddImportDiagnosticIds.CS0103, addImport.Diagnostics.Single().Code!.Value); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs index fa930a8b264..0aefaff9eff 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/CodeLens/AbstractCodeLensTests.cs @@ -46,8 +46,8 @@ private protected static async Task VerifyCodeLensAsync( AssertEx.NotNull(actualCodeLenses); Assert.NotEmpty(actualCodeLenses); - var matchingCodeLenses = actualCodeLenses.Where( - actualCodeLens => actualCodeLens.Range == expectedCodeLens.Range + var matchingCodeLenses = actualCodeLenses.Where(actualCodeLens => + actualCodeLens.Range == expectedCodeLens.Range ); Assert.Single(matchingCodeLenses); @@ -86,11 +86,10 @@ params string[] commandTitles var matchingCodeLenses = actualCodeLenses .Where(actualCodeLens => actualCodeLens.Range == expectedCodeLens.Range) - .Where( - actualCodeLens => - actualCodeLens.Command != null - && actualCodeLens.Command.CommandIdentifier - == CodeLensHandler.RunTestsCommandIdentifier + .Where(actualCodeLens => + actualCodeLens.Command != null + && actualCodeLens.Command.CommandIdentifier + == CodeLensHandler.RunTestsCommandIdentifier ); foreach (var title in commandTitles) { diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs index 968e6007861..b648eeac7ca 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Completion/CompletionResolveTests.cs @@ -518,8 +518,8 @@ string label Assert.NotNull(vsCompletionList.Data); } - var serverCompletionItem = completionList.Items.FirstOrDefault( - item => item.Label == label + var serverCompletionItem = completionList.Items.FirstOrDefault(item => + item.Label == label ); var clientCompletionItem = ConvertToClientCompletionItem((T)serverCompletionItem); return clientCompletionItem; diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs index 02e788b0b64..0ae88f061e5 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Configuration/DidChangeConfigurationNotificationHandlerTest.cs @@ -181,13 +181,12 @@ List expectedValues supportedOptions.Sum(option => option is IPerLanguageValuedOption ? 2 : 1), expectedValues.Count ); - var optionsAndLanguageToVerify = supportedOptions.SelectManyAsArray( - option => - option is IPerLanguageValuedOption - ? DidChangeConfigurationNotificationHandler.SupportedLanguages.SelectAsArray( - lang => (option, lang) - ) - : SpecializedCollections.SingletonEnumerable((option, string.Empty)) + var optionsAndLanguageToVerify = supportedOptions.SelectManyAsArray(option => + option is IPerLanguageValuedOption + ? DidChangeConfigurationNotificationHandler.SupportedLanguages.SelectAsArray( + lang => (option, lang) + ) + : SpecializedCollections.SingletonEnumerable((option, string.Empty)) ); for (var i = 0; i < expectedValues.Count; i++) @@ -254,8 +253,8 @@ CancellationToken _ { ReceivedWorkspaceConfigurationRequest = true; var expectConfigurationItemsNumber = - DidChangeConfigurationNotificationHandler.SupportedOptions.Sum( - option => option is IPerLanguageValuedOption ? 2 : 1 + DidChangeConfigurationNotificationHandler.SupportedOptions.Sum(option => + option is IPerLanguageValuedOption ? 2 : 1 ); Assert.Equal(expectConfigurationItemsNumber, configurationParams!.Items.Length); Assert.Equal(expectConfigurationItemsNumber, MockClientSideValues.Count); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs index ae15750a197..110aa340345 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs @@ -53,9 +53,8 @@ bool mutatingLspWorkspace @$"C:\Test.txt: [{MockAdditionalFileDiagnosticAnalyzer.Id}]", @"C:\CSProj1.csproj: []" }, - results.Select( - r => - $"{r.Uri.LocalPath}: [{string.Join(", ", r.Diagnostics.Select(d => d.Code?.Value?.ToString()))}]" + results.Select(r => + $"{r.Uri.LocalPath}: [{string.Join(", ", r.Diagnostics.Select(d => d.Code?.Value?.ToString()))}]" ) ); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs index 01aaf7c08bf..aa80689d4ea 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/FoldingRanges/FoldingRangesTests.cs @@ -32,9 +32,8 @@ public async Task TestGetFoldingRangeAsync_Imports(bool mutatingLspWorkspace) ); var expected = testLspServer .GetLocations("foldingRange") - .Select( - location => - CreateFoldingRange(LSP.FoldingRangeKind.Imports, location.Range, "...") + .Select(location => + CreateFoldingRange(LSP.FoldingRangeKind.Imports, location.Range, "...") ) .ToArray(); @@ -55,8 +54,8 @@ public async Task TestGetFoldingRangeAsync_Comments(bool mutatingLspWorkspace) ); var expected = testLspServer .GetLocations("foldingRange") - .Select( - location => CreateFoldingRange(LSP.FoldingRangeKind.Comment, location.Range, "") + .Select(location => + CreateFoldingRange(LSP.FoldingRangeKind.Comment, location.Range, "") ) .ToArray(); @@ -77,9 +76,8 @@ public async Task TestGetFoldingRangeAsync_Regions(bool mutatingLspWorkspace) ); var expected = testLspServer .GetLocations("foldingRange") - .Select( - location => - CreateFoldingRange(LSP.FoldingRangeKind.Region, location.Range, "ARegion") + .Select(location => + CreateFoldingRange(LSP.FoldingRangeKind.Region, location.Range, "ARegion") ) .ToArray(); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs index 03a2a5f6d10..d04f284cf6d 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Hover/HoverTests.cs @@ -568,8 +568,8 @@ out var classifiedTextElements ); var content = string.Join( "|", - classifiedTextElements.Select( - cte => string.Join(string.Empty, cte.Runs.Select(ctr => ctr.Text)) + classifiedTextElements.Select(cte => + string.Join(string.Empty, cte.Runs.Select(ctr => ctr.Text)) ) ); Assert.Equal(expectedContent, content); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs index 425e9a44c2f..2eb90430683 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlayHint/AbstractInlayHintTests.cs @@ -52,8 +52,8 @@ private protected static async Task VerifyInlayHintAsync( foreach (var location in locations) { - var matchingInlayHints = actualInlayHints.Where( - actualInlayHints => actualInlayHints.Position == location.Range.Start + var matchingInlayHints = actualInlayHints.Where(actualInlayHints => + actualInlayHints.Position == location.Range.Start ); Assert.Single(matchingInlayHints); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/TestSnippetInfoService.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/TestSnippetInfoService.cs index cc75d4efa79..9af8de083cb 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/TestSnippetInfoService.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/InlineCompletions/TestSnippetInfoService.cs @@ -44,9 +44,12 @@ public IEnumerable GetSnippetsIfAvailable() var snippets = XmlSnippetParser.CodeSnippet.ReadSnippets(testSnippetsXml); Contract.ThrowIfNull(snippets); - var snippetInfos = snippets.Value.Select( - s => new SnippetInfo(s.Shortcut, s.Title, s.Title, snippetsFile) - ); + var snippetInfos = snippets.Value.Select(s => new SnippetInfo( + s.Shortcut, + s.Title, + s.Title, + snippetsFile + )); return snippetInfos; } diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs index a6e438d2596..eb3cc943dfc 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerTests.cs @@ -475,29 +475,26 @@ int expectedReferenceCount ) { var actualDefinitionCount = referenceItems - .Select( - item => - ((ClassifiedTextElement)item.Text).Runs.Where( - run => run.MarkerTagType == DefinitionHighlightTag.TagId - ) + .Select(item => + ((ClassifiedTextElement)item.Text).Runs.Where(run => + run.MarkerTagType == DefinitionHighlightTag.TagId + ) ) .Where(i => i.Any()) .Count(); var actualWrittenReferenceCount = referenceItems - .Select( - item => - ((ClassifiedTextElement)item.Text).Runs.Where( - run => run.MarkerTagType == WrittenReferenceHighlightTag.TagId - ) + .Select(item => + ((ClassifiedTextElement)item.Text).Runs.Where(run => + run.MarkerTagType == WrittenReferenceHighlightTag.TagId + ) ) .Where(i => i.Any()) .Count(); var actualReferenceCount = referenceItems - .Select( - item => - ((ClassifiedTextElement)item.Text).Runs.Where( - run => run.MarkerTagType == ReferenceHighlightTag.TagId - ) + .Select(item => + ((ClassifiedTextElement)item.Text).Runs.Where(run => + run.MarkerTagType == ReferenceHighlightTag.TagId + ) ) .Where(i => i.Any()) .Count(); diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs index 83951600661..8bfd3deead0 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/SemanticTokens/SemanticTokensRangeTests.cs @@ -1596,8 +1596,8 @@ public void TestGetSemanticTokensRange_AssertCustomTokenTypes(bool isVS) capabilities.HasVisualStudioLspCapability() ); - var expectedNames = ClassificationTypeNames.AllTypeNames.Where( - s => !ClassificationTypeNames.AdditiveTypeNames.Contains(s) + var expectedNames = ClassificationTypeNames.AllTypeNames.Where(s => + !ClassificationTypeNames.AdditiveTypeNames.Contains(s) ); foreach (var expectedClassificationName in expectedNames) { diff --git a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs index 8ca824140da..980a004c49b 100644 --- a/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs +++ b/roslyn/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs @@ -29,7 +29,9 @@ public async Task TestDisposedWorkspaceDeregistered(bool mutatingLspWorkspace) ) { registrationService = (TestWorkspaceRegistrationService) - testLspServer.TestWorkspace.ExportProvider.GetExportedValue(); + testLspServer.TestWorkspace.ExportProvider.GetExportedValue( + + ); } Assert.Empty(registrationService.GetAllRegistrations()); diff --git a/roslyn/src/Scripting/Core/Hosting/AssemblyLoader/InteractiveAssemblyLoader.cs b/roslyn/src/Scripting/Core/Hosting/AssemblyLoader/InteractiveAssemblyLoader.cs index 5296ae927c6..340b25e5c85 100644 --- a/roslyn/src/Scripting/Core/Hosting/AssemblyLoader/InteractiveAssemblyLoader.cs +++ b/roslyn/src/Scripting/Core/Hosting/AssemblyLoader/InteractiveAssemblyLoader.cs @@ -330,8 +330,8 @@ internal Assembly ResolveAssembly(AssemblyIdentity identity, string loadDirector if (!identity.IsStrongName) { - conflictingLoadedAssemblyOpt = loadedInfos.FirstOrDefault( - info => !info.Identity.IsStrongName + conflictingLoadedAssemblyOpt = loadedInfos.FirstOrDefault(info => + !info.Identity.IsStrongName ); } diff --git a/roslyn/src/Scripting/Core/Script.cs b/roslyn/src/Scripting/Core/Script.cs index 96d0c85444f..71dec8c8420 100644 --- a/roslyn/src/Scripting/Core/Script.cs +++ b/roslyn/src/Scripting/Core/Script.cs @@ -436,8 +436,8 @@ CancellationToken cancellationToken catch (CompilationErrorException e) { return ImmutableArray.CreateRange( - e.Diagnostics.Where( - d => d.Severity is DiagnosticSeverity.Error or DiagnosticSeverity.Warning + e.Diagnostics.Where(d => + d.Severity is DiagnosticSeverity.Error or DiagnosticSeverity.Warning ) ); } diff --git a/roslyn/src/Scripting/CoreTestUtilities/ScriptingTestHelpers.cs b/roslyn/src/Scripting/CoreTestUtilities/ScriptingTestHelpers.cs index 929545b7fa1..dbdfdd04f4d 100644 --- a/roslyn/src/Scripting/CoreTestUtilities/ScriptingTestHelpers.cs +++ b/roslyn/src/Scripting/CoreTestUtilities/ScriptingTestHelpers.cs @@ -131,8 +131,8 @@ params DiagnosticDescription[] expectedDiagnostics catch (CompilationErrorException e) { e.Diagnostics.Verify(expectedDiagnostics); - e.Diagnostics.Any( - d => d.Severity == DiagnosticSeverity.Error && e.Message == d.ToString() + e.Diagnostics.Any(d => + d.Severity == DiagnosticSeverity.Error && e.Message == d.ToString() ); } catch (Exception e) diff --git a/roslyn/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs b/roslyn/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs index d563ecff8d4..eff4ed13444 100644 --- a/roslyn/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs +++ b/roslyn/src/Test/PdbUtilities/EditAndContinue/EditAndContinueTest.GenerationVerifier.cs @@ -99,12 +99,8 @@ internal void VerifyPropertyDefNames(params string[] expected) internal void VerifyDeletedMembers(params string[] expected) { - var actual = _generationInfo.Baseline.DeletedMembers.Select( - e => - e.Key.ToString() - + ": {" - + string.Join(", ", e.Value.Select(v => v.Name)) - + "}" + var actual = _generationInfo.Baseline.DeletedMembers.Select(e => + e.Key.ToString() + ": {" + string.Join(", ", e.Value.Select(v => v.Name)) + "}" ); AssertEx.SetEqual( expected, @@ -178,12 +174,8 @@ internal void VerifyCustomAttributes(IEnumerable? expected = public void VerifySynthesizedMembers(params string[] expected) { - var actual = _generationInfo.Baseline.SynthesizedMembers.Select( - e => - e.Key.ToString() - + ": {" - + string.Join(", ", e.Value.Select(v => v.Name)) - + "}" + var actual = _generationInfo.Baseline.SynthesizedMembers.Select(e => + e.Key.ToString() + ": {" + string.Join(", ", e.Value.Select(v => v.Name)) + "}" ); AssertEx.SetEqual( diff --git a/roslyn/src/Test/PdbUtilities/Reader/MethodDebugInfoBytes.cs b/roslyn/src/Test/PdbUtilities/Reader/MethodDebugInfoBytes.cs index 0e63d6ca7ab..8268d750e7e 100644 --- a/roslyn/src/Test/PdbUtilities/Reader/MethodDebugInfoBytes.cs +++ b/roslyn/src/Test/PdbUtilities/Reader/MethodDebugInfoBytes.cs @@ -57,13 +57,10 @@ public Builder( importStringGroups == null ? default(ImmutableArray) : importStringGroups - .SelectMany( - names => - names.Select( - name => - (ISymUnmanagedNamespace) - new MockSymUnmanagedNamespace(name) - ) + .SelectMany(names => + names.Select(name => + (ISymUnmanagedNamespace)new MockSymUnmanagedNamespace(name) + ) ) .ToImmutableArray(); var childScope = new MockSymUnmanagedScope( diff --git a/roslyn/src/Test/PdbUtilities/Reader/PdbValidation.cs b/roslyn/src/Test/PdbUtilities/Reader/PdbValidation.cs index 733728ee9f0..21efdb24cdc 100644 --- a/roslyn/src/Test/PdbUtilities/Reader/PdbValidation.cs +++ b/roslyn/src/Test/PdbUtilities/Reader/PdbValidation.cs @@ -475,8 +475,7 @@ bool originalIsPortable ) { var pdbStreamConverted = new MemoryStream(); - var converter = new PdbConverter( - diagnostic => Assert.True(false, diagnostic.ToString()) + var converter = new PdbConverter(diagnostic => Assert.True(false, diagnostic.ToString()) ); peStreamOriginal.Position = 0; @@ -680,10 +679,9 @@ from e in expectedNativePdb.DescendantsAndSelf() || e.Name == "defunct" || e.Name == "local" && e.Attributes() - .Any( - a => - a.Name.LocalName == "name" - && a.Value.StartsWith("$VB$ResumableLocal_") + .Any(a => + a.Name.LocalName == "name" + && a.Value.StartsWith("$VB$ResumableLocal_") ) select e ); diff --git a/roslyn/src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs b/roslyn/src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs index 885e368459f..8e33cfdbe97 100644 --- a/roslyn/src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs +++ b/roslyn/src/Tools/AnalyzerRunner/DiagnosticAnalyzerRunner.cs @@ -226,9 +226,8 @@ var group in allDiagnostics if (!string.IsNullOrWhiteSpace(_options.LogFileName)) { WriteDiagnosticResults( - analysisResult.SelectManyAsArray( - pair => - pair.Value.GetAllDiagnostics().Select(j => Tuple.Create(pair.Key, j)) + analysisResult.SelectManyAsArray(pair => + pair.Value.GetAllDiagnostics().Select(j => Tuple.Create(pair.Key, j)) ), _options.LogFileName ); @@ -386,8 +385,8 @@ Options options else if (options.AnalyzerNames.Count == 0) { if ( - analyzer.SupportedDiagnostics.Any( - static diagnosticDescriptor => diagnosticDescriptor.IsEnabledByDefault + analyzer.SupportedDiagnostics.Any(static diagnosticDescriptor => + diagnosticDescriptor.IsEnabledByDefault ) ) { diff --git a/roslyn/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs b/roslyn/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs index 7b7d882e032..bbd035d1ace 100644 --- a/roslyn/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs +++ b/roslyn/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs @@ -90,25 +90,21 @@ public async Task RunAsync(CancellationToken cancellationToken) { var incrementalAnalyzerProvider = incrementalAnalyzerProviders .Where(x => x.Metadata.Name == incrementalAnalyzerName) - .SingleOrDefault( - provider => - provider.Metadata.WorkspaceKinds?.Contains(_workspace.Kind) ?? false + .SingleOrDefault(provider => + provider.Metadata.WorkspaceKinds?.Contains(_workspace.Kind) ?? false ) ?.Value; incrementalAnalyzerProvider ??= incrementalAnalyzerProviders .Where(x => x.Metadata.Name == incrementalAnalyzerName) - .SingleOrDefault( - provider => - provider.Metadata.WorkspaceKinds?.Contains(WorkspaceKind.Host) ?? false + .SingleOrDefault(provider => + provider.Metadata.WorkspaceKinds?.Contains(WorkspaceKind.Host) ?? false ) ?.Value; incrementalAnalyzerProvider ??= incrementalAnalyzerProviders .Where(x => x.Metadata.Name == incrementalAnalyzerName) - .SingleOrDefault( - provider => - provider.Metadata.WorkspaceKinds?.Contains( - WorkspaceKind.RemoteWorkspace - ) ?? false + .SingleOrDefault(provider => + provider.Metadata.WorkspaceKinds?.Contains(WorkspaceKind.RemoteWorkspace) + ?? false ) ?.Value; incrementalAnalyzerProvider ??= incrementalAnalyzerProviders diff --git a/roslyn/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs b/roslyn/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs index 2781e79db11..b743243e28d 100644 --- a/roslyn/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs +++ b/roslyn/src/Tools/ExternalAccess/FSharp/Internal/Editor/FSharpEditorInlineRenameService.cs @@ -82,14 +82,11 @@ public IEnumerable GetReplacements(DocumentId documentI { return _info .GetReplacements(documentId) - ?.Select( - x => - new InlineRenameReplacement( - FSharpInlineRenameReplacementKindHelpers.ConvertTo(x.Kind), - x.OriginalSpan, - x.NewSpan - ) - ); + ?.Select(x => new InlineRenameReplacement( + FSharpInlineRenameReplacementKindHelpers.ConvertTo(x.Kind), + x.OriginalSpan, + x.NewSpan + )); } } @@ -102,9 +99,10 @@ internal class FSharpInlineRenameLocationSetLegacyWrapper : IInlineRenameLocatio public FSharpInlineRenameLocationSetLegacyWrapper(IFSharpInlineRenameLocationSet set) { _set = set; - _locations = set.Locations?.Select( - x => new InlineRenameLocation(x.Document, x.TextSpan) - ) + _locations = set.Locations?.Select(x => new InlineRenameLocation( + x.Document, + x.TextSpan + )) .ToList(); } diff --git a/roslyn/src/Tools/ExternalAccess/FSharp/Internal/InlineHints/FSharpInlineHintsService.cs b/roslyn/src/Tools/ExternalAccess/FSharp/Internal/InlineHints/FSharpInlineHintsService.cs index 18a17bb83f1..aaa6cc9d9f6 100644 --- a/roslyn/src/Tools/ExternalAccess/FSharp/Internal/InlineHints/FSharpInlineHintsService.cs +++ b/roslyn/src/Tools/ExternalAccess/FSharp/Internal/InlineHints/FSharpInlineHintsService.cs @@ -42,9 +42,11 @@ CancellationToken cancellationToken var hints = await _service .GetInlineHintsAsync(document, textSpan, cancellationToken) .ConfigureAwait(false); - return hints.SelectAsArray( - h => new InlineHint(h.Span, h.DisplayParts, (d, c) => h.GetDescriptionAsync(d, c)) - ); + return hints.SelectAsArray(h => new InlineHint( + h.Span, + h.DisplayParts, + (d, c) => h.GetDescriptionAsync(d, c) + )); } } } diff --git a/roslyn/src/Tools/ExternalAccess/FSharp/LanguageServices/FSharpVisualStudioWorkspaceExtensions.cs b/roslyn/src/Tools/ExternalAccess/FSharp/LanguageServices/FSharpVisualStudioWorkspaceExtensions.cs index 5b87a69224d..97c945fb16c 100644 --- a/roslyn/src/Tools/ExternalAccess/FSharp/LanguageServices/FSharpVisualStudioWorkspaceExtensions.cs +++ b/roslyn/src/Tools/ExternalAccess/FSharp/LanguageServices/FSharpVisualStudioWorkspaceExtensions.cs @@ -31,13 +31,8 @@ public static bool TryGetProjectIdByBinPath( ) { var projects = workspace - .CurrentSolution.Projects.Where( - p => - string.Equals( - p.OutputFilePath, - filePath, - StringComparison.OrdinalIgnoreCase - ) + .CurrentSolution.Projects.Where(p => + string.Equals(p.OutputFilePath, filePath, StringComparison.OrdinalIgnoreCase) ) .ToList(); diff --git a/roslyn/src/Tools/ExternalAccess/OmniSharp/InlineHints/OmniSharpInlineHintsService.cs b/roslyn/src/Tools/ExternalAccess/OmniSharp/InlineHints/OmniSharpInlineHintsService.cs index a0a1aba53a8..81784ed796b 100644 --- a/roslyn/src/Tools/ExternalAccess/OmniSharp/InlineHints/OmniSharpInlineHintsService.cs +++ b/roslyn/src/Tools/ExternalAccess/OmniSharp/InlineHints/OmniSharpInlineHintsService.cs @@ -33,16 +33,13 @@ CancellationToken cancellationToken cancellationToken ) .ConfigureAwait(false); - return hints.SelectAsArray( - static h => - new OmniSharpInlineHint( - h.Span, - h.Ranking, - h.DisplayParts, - h.ReplacementTextChange, - h.GetDescriptionAsync - ) - ); + return hints.SelectAsArray(static h => new OmniSharpInlineHint( + h.Span, + h.Ranking, + h.DisplayParts, + h.ReplacementTextChange, + h.GetDescriptionAsync + )); } } diff --git a/roslyn/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs b/roslyn/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs index 9eba9a3f7b3..d44871f6e54 100644 --- a/roslyn/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs +++ b/roslyn/src/Tools/ExternalAccess/Razor/RazorDocumentServiceProviderWrapper.cs @@ -62,7 +62,9 @@ IRazorDocumentServiceProvider innerDocumentServiceProvider static documentServiceProvider => { var impl = - documentServiceProvider.GetService(); + documentServiceProvider.GetService( + + ); return (impl != null) ? new RazorDocumentExcerptServiceWrapper(impl) : null; }, _innerDocumentServiceProvider diff --git a/roslyn/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs b/roslyn/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs index 8bf528ee88a..31303b33f90 100644 --- a/roslyn/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs +++ b/roslyn/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs @@ -186,13 +186,12 @@ public async Task RunProjectParallelIndexing() foreach (var project in _workspace.CurrentSolution.Projects) { var tasks = project - .Documents.Select( - d => - Task.Run(async () => - { - // await WalkTree(d); - await TopLevelSyntaxTreeIndex.GetIndexAsync(d, default); - }) + .Documents.Select(d => + Task.Run(async () => + { + // await WalkTree(d); + await TopLevelSyntaxTreeIndex.GetIndexAsync(d, default); + }) ) .ToList(); await Task.WhenAll(tasks); @@ -221,16 +220,15 @@ public async Task RunFullParallelIndexing() var indexTime = TimeSpan.Zero; var tasks = _workspace .CurrentSolution.Projects.SelectMany(p => p.Documents) - .Select( - d => - Task.Run(async () => - { - var tree = await d.GetSyntaxRootAsync(); - var stopwatch = SharedStopwatch.StartNew(); - await TopLevelSyntaxTreeIndex.GetIndexAsync(d, default); - await SyntaxTreeIndex.GetIndexAsync(d, default); - indexTime += stopwatch.Elapsed; - }) + .Select(d => + Task.Run(async () => + { + var tree = await d.GetSyntaxRootAsync(); + var stopwatch = SharedStopwatch.StartNew(); + await TopLevelSyntaxTreeIndex.GetIndexAsync(d, default); + await SyntaxTreeIndex.GetIndexAsync(d, default); + indexTime += stopwatch.Elapsed; + }) ) .ToList(); await Task.WhenAll(tasks); @@ -251,17 +249,16 @@ public async Task RunNavigateTo() var solution = _workspace.CurrentSolution; var searchTasks = solution .Projects.GroupBy(p => p.Services.GetService()) - .Select( - g => - Task.Run( - () => - SearchAsync( - solution, - g, - priorityDocuments: ImmutableArray.Empty - ), - CancellationToken.None - ) + .Select(g => + Task.Run( + () => + SearchAsync( + solution, + g, + priorityDocuments: ImmutableArray.Empty + ), + CancellationToken.None + ) ) .ToArray(); diff --git a/roslyn/src/Tools/PrepareTests/MinimizeUtil.cs b/roslyn/src/Tools/PrepareTests/MinimizeUtil.cs index 2d49c8ac492..28bd6111b41 100644 --- a/roslyn/src/Tools/PrepareTests/MinimizeUtil.cs +++ b/roslyn/src/Tools/PrepareTests/MinimizeUtil.cs @@ -70,8 +70,8 @@ Dictionary> initialWalk() var idToFilePathMap = directories .AsParallel() - .SelectMany( - unitDirPath => walkDirectory(unitDirPath, sourceDirectory, destinationDirectory) + .SelectMany(unitDirPath => + walkDirectory(unitDirPath, sourceDirectory, destinationDirectory) ) .GroupBy(pair => pair.mvid) .ToDictionary( diff --git a/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs b/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs index 77394c1f8b2..64723a4557e 100644 --- a/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs +++ b/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/SourceWriter.cs @@ -768,11 +768,10 @@ List nodeFields Write( CommaJoin( nd.Kinds.Count == 1 ? $"SyntaxKind.{nd.Kinds[0].Name}" : "kind", - nodeFields.Select( - f => - f.Type == "SyntaxList" || IsAnyList(f.Type) - ? $"{CamelCase(f.Name)}.Node" - : CamelCase(f.Name) + nodeFields.Select(f => + f.Type == "SyntaxList" || IsAnyList(f.Type) + ? $"{CamelCase(f.Name)}.Node" + : CamelCase(f.Name) ), // values are at end valueFields.Select(f => CamelCase(f.Name)), @@ -1100,8 +1099,8 @@ private void WriteRedType(TreeType node) var relevantNodes = nodeFields .Select((field, index) => (field, index)) - .Where( - t => t.field.Type is not "SyntaxToken" and not "SyntaxList" + .Where(t => + t.field.Type is not "SyntaxToken" and not "SyntaxList" ); if (!relevantNodes.Any()) { @@ -1154,8 +1153,8 @@ private void WriteRedType(TreeType node) var relevantNodes = nodeFields .Select((field, index) => (field, index)) - .Where( - t => t.field.Type is not "SyntaxToken" and not "SyntaxList" + .Where(t => + t.field.Type is not "SyntaxToken" and not "SyntaxList" ); if (!relevantNodes.Any()) { @@ -1890,11 +1889,10 @@ private void WriteRedFactoryWithNoAutoCreatableTokens(Node nd) Write( CommaJoin( nd.Kinds.Count > 1 ? "kind" : "", - nd.Fields.Select( - f => - factoryWithNoAutoCreatableTokenFields.Contains(f) - ? CamelCase(f.Name) - : GetDefaultValue(nd, f) + nd.Fields.Select(f => + factoryWithNoAutoCreatableTokenFields.Contains(f) + ? CamelCase(f.Name) + : GetDefaultValue(nd, f) ) ) ); @@ -1905,13 +1903,12 @@ private void WriteRedFactoryWithNoAutoCreatableTokens(Node nd) private Field DetermineMinimalOptionalField(Node nd) { // first if there is a single list, then choose the list because it would not have been optional - int listCount = nd.Fields.Count( - f => IsAnyNodeList(f.Type) && !IsAttributeOrModifiersList(f) + int listCount = nd.Fields.Count(f => + IsAnyNodeList(f.Type) && !IsAttributeOrModifiersList(f) ); if (listCount == 1) { - return nd.Fields.First( - f => IsAnyNodeList(f.Type) && !IsAttributeOrModifiersList(f) + return nd.Fields.First(f => IsAnyNodeList(f.Type) && !IsAttributeOrModifiersList(f) ); } else @@ -1966,8 +1963,8 @@ private void WriteRedMinimalFactory(Node nd, bool withStringNames = false) if ( withStringNames - && minimalFactoryfields.Count( - f => IsRequiredFactoryField(nd, f) && CanAutoConvertFromString(f) + && minimalFactoryfields.Count(f => + IsRequiredFactoryField(nd, f) && CanAutoConvertFromString(f) ) == 0 ) return; // no string-name overload necessary diff --git a/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs b/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs index 6ecd7579474..98b77f1778d 100644 --- a/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs +++ b/roslyn/src/Tools/Source/CompilerGeneratorTools/Source/IOperationGenerator/IOperationClassWriter.cs @@ -359,14 +359,13 @@ private void WriteOperationKind() // 3. No internal nodes. List elementsToKind = _tree .Types.OfType() - .Where( - n => - ( - (n is Node && (n.OperationKind?.Include != false)) - || n.OperationKind?.Include == true - ) - && (n.OperationKind?.Entries is null || n.OperationKind?.Entries.Count == 0) - && !n.IsInternal + .Where(n => + ( + (n is Node && (n.OperationKind?.Include != false)) + || n.OperationKind?.Include == true + ) + && (n.OperationKind?.Entries is null || n.OperationKind?.Entries.Count == 0) + && !n.IsInternal ) .ToList(); @@ -644,8 +643,8 @@ bool multipleValidKinds Outdent(); - List propsToInitialize = type.Properties.Where( - p => !p.SkipGeneration && !p.MakeAbstract + List propsToInitialize = type.Properties.Where(p => + !p.SkipGeneration && !p.MakeAbstract ) .ToList(); @@ -1246,8 +1245,8 @@ private List GetAllProperties( bool includeSkipGenerationProperties = false ) { - var properties = node.Properties.Where( - p => !p.SkipGeneration || includeSkipGenerationProperties + var properties = node.Properties.Where(p => + !p.SkipGeneration || includeSkipGenerationProperties ) .ToList(); @@ -1259,8 +1258,7 @@ private List GetAllProperties( if (@base is null) break; properties.AddRange( - @base.Properties.Where( - p => !p.SkipGeneration || includeSkipGenerationProperties + @base.Properties.Where(p => !p.SkipGeneration || includeSkipGenerationProperties ) ); } diff --git a/roslyn/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs b/roslyn/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs index b7f408d2e34..37e7bd0a037 100644 --- a/roslyn/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs +++ b/roslyn/src/VisualStudio/CSharp/Impl/CodeModel/CSharpCodeModelService.cs @@ -644,8 +644,9 @@ SyntaxNode node return (EnvDTE.CodeElement) CodeEvent.Create(state, fileCodeModel, nodeKey, (int)node.Kind()); case SyntaxKind.VariableDeclarator: - var baseFieldDeclaration = - node.FirstAncestorOrSelf(); + var baseFieldDeclaration = node.FirstAncestorOrSelf( + + ); if (baseFieldDeclaration != null) { if (baseFieldDeclaration.Kind() == SyntaxKind.FieldDeclaration) @@ -1511,8 +1512,8 @@ var line in value.Split( { // In this case, we're going to replace the existing comment. var firstIndex = leadingTriviaList.FindIndex(t => t == commentList[0]); - var lastIndex = leadingTriviaList.FindIndex( - t => t == commentList[commentList.Count - 1] + var lastIndex = leadingTriviaList.FindIndex(t => + t == commentList[commentList.Count - 1] ); var count = lastIndex - firstIndex + 1; @@ -1657,8 +1658,7 @@ var line in child if (documentationComment != null) { // In this case, we're going to replace the existing XML doc comment. - var index = leadingTriviaList.FindIndex( - t => t == documentationComment.ParentTrivia + var index = leadingTriviaList.FindIndex(t => t == documentationComment.ParentTrivia ); leadingTriviaList.RemoveAt(index); @@ -3847,8 +3847,8 @@ private static SyntaxNode EnsureAfterEndRegion(int index, SyntaxNode container) var triviaList = nextToken.LeadingTrivia; - var lastNonWhitespaceTrivia = triviaList.LastOrDefault( - trivia => !trivia.IsWhitespaceOrEndOfLine() + var lastNonWhitespaceTrivia = triviaList.LastOrDefault(trivia => + !trivia.IsWhitespaceOrEndOfLine() ); if (lastNonWhitespaceTrivia.Kind() == SyntaxKind.EndRegionDirectiveTrivia) { diff --git a/roslyn/src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.ICSharpProjectSite.cs b/roslyn/src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.ICSharpProjectSite.cs index 09723a22edc..e0aede7b655 100644 --- a/roslyn/src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.ICSharpProjectSite.cs +++ b/roslyn/src/VisualStudio/CSharp/Impl/ProjectSystemShim/CSharpProjectShim.ICSharpProjectSite.cs @@ -149,13 +149,12 @@ public int GetValidStartupClasses(IntPtr[] classNames, ref int count) { // We return S_FALSE if we have more entrypoints than places in the array. var entryPointNames = entryPoints - .Select( - e => - e.ToDisplayString( - SymbolDisplayFormat.FullyQualifiedFormat.WithGlobalNamespaceStyle( - SymbolDisplayGlobalNamespaceStyle.Omitted - ) + .Select(e => + e.ToDisplayString( + SymbolDisplayFormat.FullyQualifiedFormat.WithGlobalNamespaceStyle( + SymbolDisplayGlobalNamespaceStyle.Omitted ) + ) ) .ToArray(); diff --git a/roslyn/src/VisualStudio/CSharp/Test/CodeModel/FileCodeModelTestHelpers.cs b/roslyn/src/VisualStudio/CSharp/Test/CodeModel/FileCodeModelTestHelpers.cs index bd2cec91e08..72f40890830 100644 --- a/roslyn/src/VisualStudio/CSharp/Test/CodeModel/FileCodeModelTestHelpers.cs +++ b/roslyn/src/VisualStudio/CSharp/Test/CodeModel/FileCodeModelTestHelpers.cs @@ -51,10 +51,13 @@ EnvDTE.FileCodeModel fileCodeModel workspace.ExportProvider.GetExportedValue(); visualStudioWorkspaceMock.SetWorkspace(workspace); - var threadingContext = - workspace.ExportProvider.GetExportedValue(); + var threadingContext = workspace.ExportProvider.GetExportedValue( + + ); var listenerProvider = - workspace.ExportProvider.GetExportedValue(); + workspace.ExportProvider.GetExportedValue( + + ); var state = new CodeModelState( threadingContext, diff --git a/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerDependencyChecker.cs b/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerDependencyChecker.cs index f7904e684dc..8ae7bc45d79 100644 --- a/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerDependencyChecker.cs +++ b/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerDependencyChecker.cs @@ -87,9 +87,8 @@ CancellationToken cancellationToken : reference; if ( - !ignorableAssemblyLists.Any( - ignorableAssemblyList => - ignorableAssemblyList.Includes(redirectedReference) + !ignorableAssemblyLists.Any(ignorableAssemblyList => + ignorableAssemblyList.Includes(redirectedReference) ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerFileWatcherService.cs b/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerFileWatcherService.cs index 2f9d27dcf1a..ac07478469c 100644 --- a/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerFileWatcherService.cs +++ b/roslyn/src/VisualStudio/Core/Def/AnalyzerDependency/AnalyzerFileWatcherService.cs @@ -191,8 +191,8 @@ private void Tracker_UpdatedOnDisk(object sender, EventArgs e) project.AnalyzerReferences.OfType(); if ( - analyzerFileReferences.Any( - a => a.FullPath.Equals(filePath, StringComparison.OrdinalIgnoreCase) + analyzerFileReferences.Any(a => + a.FullPath.Equals(filePath, StringComparison.OrdinalIgnoreCase) ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/AbstractCallFinder.cs b/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/AbstractCallFinder.cs index 7e25af32dc0..4bd11d303be 100644 --- a/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/AbstractCallFinder.cs +++ b/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/AbstractCallFinder.cs @@ -204,14 +204,11 @@ CancellationToken cancellationToken if (caller.CallingSymbol.Kind == SymbolKind.Field) { initializerLocations.AddRange( - caller.Locations.Select( - loc => - new CallHierarchyDetail( - this.Provider, - loc, - project.Solution.Workspace - ) - ) + caller.Locations.Select(loc => new CallHierarchyDetail( + this.Provider, + loc, + project.Solution.Workspace + )) ); } else diff --git a/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/ImplementerFinder.cs b/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/ImplementerFinder.cs index 6cecdceb740..cecbd4256e8 100644 --- a/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/ImplementerFinder.cs +++ b/roslyn/src/VisualStudio/Core/Def/CallHierarchy/Finders/ImplementerFinder.cs @@ -58,12 +58,12 @@ CancellationToken cancellationToken foreach (var implementation in implementations) { var sourceLocations = implementation - .DeclaringSyntaxReferences.Select( - d => project.Solution.GetDocument(d.SyntaxTree) + .DeclaringSyntaxReferences.Select(d => + project.Solution.GetDocument(d.SyntaxTree) ) .WhereNotNull(); - var bestLocation = sourceLocations.FirstOrDefault( - d => documents == null || documents.Contains(d) + var bestLocation = sourceLocations.FirstOrDefault(d => + documents == null || documents.Contains(d) ); if (bestLocation != null) { diff --git a/roslyn/src/VisualStudio/Core/Def/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs b/roslyn/src/VisualStudio/Core/Def/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs index 6fd2d66ebbf..6d89417828d 100644 --- a/roslyn/src/VisualStudio/Core/Def/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs +++ b/roslyn/src/VisualStudio/Core/Def/ChangeSignature/ChangeSignatureDialogViewModel.ParameterViewModels.cs @@ -76,7 +76,9 @@ public bool NeedsBottomBorder if ( this - == ChangeSignatureDialogViewModel._parametersWithoutDefaultValues.LastOrDefault() + == ChangeSignatureDialogViewModel._parametersWithoutDefaultValues.LastOrDefault( + + ) && ( ChangeSignatureDialogViewModel._parametersWithDefaultValues.Any() || ChangeSignatureDialogViewModel._paramsParameter != null @@ -88,7 +90,9 @@ public bool NeedsBottomBorder if ( this - == ChangeSignatureDialogViewModel._parametersWithDefaultValues.LastOrDefault() + == ChangeSignatureDialogViewModel._parametersWithDefaultValues.LastOrDefault( + + ) && ChangeSignatureDialogViewModel._paramsParameter != null ) { diff --git a/roslyn/src/VisualStudio/Core/Def/CodeCleanup/AbstractCodeCleanUpFixer.cs b/roslyn/src/VisualStudio/Core/Def/CodeCleanup/AbstractCodeCleanUpFixer.cs index 636292b02fc..fdf653fcf99 100644 --- a/roslyn/src/VisualStudio/Core/Def/CodeCleanup/AbstractCodeCleanUpFixer.cs +++ b/roslyn/src/VisualStudio/Core/Def/CodeCleanup/AbstractCodeCleanUpFixer.cs @@ -292,8 +292,9 @@ ICodeCleanUpExecutionContext context ) ) { - var workspaceStatusService = - workspace.Services.GetService(); + var workspaceStatusService = workspace.Services.GetService( + + ); if (workspaceStatusService != null) { await workspaceStatusService diff --git a/roslyn/src/VisualStudio/Core/Def/CommonControls/MemberSelectionViewModel.cs b/roslyn/src/VisualStudio/Core/Def/CommonControls/MemberSelectionViewModel.cs index 989204d5f9b..60246428025 100644 --- a/roslyn/src/VisualStudio/Core/Def/CommonControls/MemberSelectionViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Def/CommonControls/MemberSelectionViewModel.cs @@ -41,8 +41,8 @@ public MemberSelectionViewModel( // Use public property to hook property change events up Members = members.OrderBy(s => s.SymbolName).ToImmutableArray(); _symbolToDependentsMap = dependentsMap; - _symbolToMemberViewMap = members.ToImmutableDictionary( - memberViewModel => memberViewModel.Symbol + _symbolToMemberViewMap = members.ToImmutableDictionary(memberViewModel => + memberViewModel.Symbol ); UpdateMembersBasedOnDestinationKind(destinationTypeKind); @@ -113,8 +113,8 @@ public void SelectDependents() { Contract.ThrowIfFalse(ShowCheckDependentsButton); - var checkedMembers = Members.WhereAsArray( - member => member.IsChecked && member.IsCheckable + var checkedMembers = Members.WhereAsArray(member => + member.IsChecked && member.IsCheckable ); var result = _uiThreadOperationExecutor.Execute( @@ -144,27 +144,25 @@ public void SelectDependents() public ImmutableArray<(ISymbol member, bool makeAbstract)> GetSelectedMembers() => Members - .Where( - memberSymbolView => memberSymbolView.IsChecked && memberSymbolView.IsCheckable + .Where(memberSymbolView => + memberSymbolView.IsChecked && memberSymbolView.IsCheckable ) - .SelectAsArray( - memberViewModel => - ( - member: memberViewModel.Symbol, - makeAbstract: memberViewModel.IsMakeAbstractCheckable - && memberViewModel.MakeAbstract - ) + .SelectAsArray(memberViewModel => + ( + member: memberViewModel.Symbol, + makeAbstract: memberViewModel.IsMakeAbstractCheckable + && memberViewModel.MakeAbstract + ) ); public void UpdateMembersBasedOnDestinationKind(TypeKind destinationType) { - var fields = Members.WhereAsArray( - memberViewModel => memberViewModel.Symbol.IsKind(SymbolKind.Field) + var fields = Members.WhereAsArray(memberViewModel => + memberViewModel.Symbol.IsKind(SymbolKind.Field) ); - var makeAbstractEnabledCheckboxes = Members.WhereAsArray( - memberViewModel => - !memberViewModel.Symbol.IsKind(SymbolKind.Field) - && !memberViewModel.Symbol.IsAbstract + var makeAbstractEnabledCheckboxes = Members.WhereAsArray(memberViewModel => + !memberViewModel.Symbol.IsKind(SymbolKind.Field) + && !memberViewModel.Symbol.IsAbstract ); var isInterface = destinationType == TypeKind.Interface; diff --git a/roslyn/src/VisualStudio/Core/Def/DebuggerIntelliSense/DebuggerTextView.HACK_CompletionSession.cs b/roslyn/src/VisualStudio/Core/Def/DebuggerIntelliSense/DebuggerTextView.HACK_CompletionSession.cs index 69d152005eb..6ebb09e0989 100644 --- a/roslyn/src/VisualStudio/Core/Def/DebuggerIntelliSense/DebuggerTextView.HACK_CompletionSession.cs +++ b/roslyn/src/VisualStudio/Core/Def/DebuggerIntelliSense/DebuggerTextView.HACK_CompletionSession.cs @@ -52,8 +52,7 @@ private void HACK_SetShimCompletionSessionWorker(ICompletionSession completionSe { var propertyList = _innerTextView.Properties.PropertyList; var shimController = propertyList - .Single( - x => x.Value != null && x.Value.GetType().Name == "ShimCompletionController" + .Single(x => x.Value != null && x.Value.GetType().Name == "ShimCompletionController" ) .Value; var shimControllerType = shimController.GetType(); diff --git a/roslyn/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerProvider.WorkspaceEventListener.cs b/roslyn/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerProvider.WorkspaceEventListener.cs index 02075e0b4e9..d0660764d82 100644 --- a/roslyn/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerProvider.WorkspaceEventListener.cs +++ b/roslyn/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerProvider.WorkspaceEventListener.cs @@ -49,8 +49,9 @@ IVisualStudioDiagnosticAnalyzerProviderFactory providerFactory public void StartListening(Workspace workspace, object serviceOpt) { - var setter = - workspace.Services.GetService(); + var setter = workspace.Services.GetService( + + ); if (setter != null) { // fire and forget @@ -73,8 +74,8 @@ ISolutionAnalyzerSetterWorkspaceService setter var references = provider.GetAnalyzerReferencesInExtensions(); LogWorkspaceAnalyzerCount(references.Length); setter.SetAnalyzerReferences( - references.SelectAsArray( - referenceAndId => (AnalyzerReference)referenceAndId.reference + references.SelectAsArray(referenceAndId => + (AnalyzerReference)referenceAndId.reference ) ); } diff --git a/roslyn/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs b/roslyn/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs index effff6682c4..9cc522343a8 100644 --- a/roslyn/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs +++ b/roslyn/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs @@ -60,7 +60,9 @@ JToken ParameterFunction(ITextSnapshot snapshot) textBuffer: textBuffer, method: Methods.TextDocumentDocumentSymbolName, capabilitiesFilter: _ => true, - languageServerName: WellKnownLspServerKinds.AlwaysActiveVSLspServer.ToUserVisibleString(), + languageServerName: WellKnownLspServerKinds.AlwaysActiveVSLspServer.ToUserVisibleString( + + ), parameterFactory: ParameterFunction, cancellationToken: cancellationToken ) diff --git a/roslyn/src/VisualStudio/Core/Def/ExtractClass/VisualStudioExtractClassOptionsService.cs b/roslyn/src/VisualStudio/Core/Def/ExtractClass/VisualStudioExtractClassOptionsService.cs index 5e5aaa2021f..21b28036612 100644 --- a/roslyn/src/VisualStudio/Core/Def/ExtractClass/VisualStudioExtractClassOptionsService.cs +++ b/roslyn/src/VisualStudio/Core/Def/ExtractClass/VisualStudioExtractClassOptionsService.cs @@ -64,21 +64,17 @@ CancellationToken cancellationToken .GetMembers() .WhereAsArray(MemberAndDestinationValidator.IsMemberValid); - var memberViewModels = membersInType.SelectAsArray( - member => - new MemberSymbolViewModel(member, _glyphService) - { - // The member(s) user selected will be checked at the beginning. - IsChecked = selectedMembers.Any( - SymbolEquivalenceComparer.Instance.Equals, - member - ), - MakeAbstract = false, - IsMakeAbstractCheckable = - !member.IsKind(SymbolKind.Field) && !member.IsAbstract, - IsCheckable = true - } - ); + var memberViewModels = membersInType.SelectAsArray(member => new MemberSymbolViewModel( + member, + _glyphService + ) + { + // The member(s) user selected will be checked at the beginning. + IsChecked = selectedMembers.Any(SymbolEquivalenceComparer.Instance.Equals, member), + MakeAbstract = false, + IsMakeAbstractCheckable = !member.IsKind(SymbolKind.Field) && !member.IsAbstract, + IsCheckable = true + }); var memberToDependentsMap = SymbolDependentsBuilder.FindMemberToDependentsMap( membersInType, diff --git a/roslyn/src/VisualStudio/Core/Def/FindReferences/IFindAllReferencesWindowExtensions.cs b/roslyn/src/VisualStudio/Core/Def/FindReferences/IFindAllReferencesWindowExtensions.cs index b1116a83b63..6054258ae28 100644 --- a/roslyn/src/VisualStudio/Core/Def/FindReferences/IFindAllReferencesWindowExtensions.cs +++ b/roslyn/src/VisualStudio/Core/Def/FindReferences/IFindAllReferencesWindowExtensions.cs @@ -13,8 +13,8 @@ internal static class IFindAllReferencesWindowExtensions public static ColumnState2 GetDefinitionColumn(this IFindAllReferencesWindow window) { return (ColumnState2) - window.TableControl.ColumnStates.First( - s => s.Name == StandardTableColumnDefinitions2.Definition + window.TableControl.ColumnStates.First(s => + s.Name == StandardTableColumnDefinitions2.Definition ); } } diff --git a/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs b/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs index 07f999d5e1f..1312cbe0f8c 100644 --- a/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs +++ b/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs @@ -452,8 +452,9 @@ CancellationToken cancellationToken .ConfigureAwait(true); // Call out to various new document formatters to tweak what they want - var formattingService = - addedDocument.GetLanguageService(); + var formattingService = addedDocument.GetLanguageService( + + ); if (formattingService is not null) { addedDocument = await formattingService diff --git a/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractVsTextViewFilter.cs b/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractVsTextViewFilter.cs index c9afcec8227..5cd587cb2e7 100644 --- a/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractVsTextViewFilter.cs +++ b/roslyn/src/VisualStudio/Core/Def/Implementation/AbstractVsTextViewFilter.cs @@ -121,13 +121,16 @@ out string pbstrText var textSpan = pSpan[0]; var textSnapshot = subjectBuffer.CurrentSnapshot; - var document = - textSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = textSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document != null) { var languageDebugInfo = - document.Project.Services.GetService(); + document.Project.Services.GetService( + + ); if (languageDebugInfo != null) { var spanOpt = textSnapshot.TryGetSpan(textSpan); diff --git a/roslyn/src/VisualStudio/Core/Def/Implementation/HierarchyItemToProjectIdMap.cs b/roslyn/src/VisualStudio/Core/Def/Implementation/HierarchyItemToProjectIdMap.cs index a49016c39a0..683544b05a2 100644 --- a/roslyn/src/VisualStudio/Core/Def/Implementation/HierarchyItemToProjectIdMap.cs +++ b/roslyn/src/VisualStudio/Core/Def/Implementation/HierarchyItemToProjectIdMap.cs @@ -71,10 +71,8 @@ public bool TryGetProjectId( // from CPS to see if this matches. if (targetFrameworkMoniker != null) { - var matchingProject = candidateProjects.FirstOrDefault( - p => - _workspace.TryGetDependencyNodeTargetIdentifier(p.Id) - == targetFrameworkMoniker + var matchingProject = candidateProjects.FirstOrDefault(p => + _workspace.TryGetDependencyNodeTargetIdentifier(p.Id) == targetFrameworkMoniker ); if (matchingProject != null) @@ -91,8 +89,8 @@ public bool TryGetProjectId( foreach (var candidateProject in candidateProjects) { if ( - !candidateProject.DocumentIds.Any( - id => ContainedDocument.TryGetContainedDocument(id) != null + !candidateProject.DocumentIds.Any(id => + ContainedDocument.TryGetContainedDocument(id) != null ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginViewMarginProvider.cs b/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginViewMarginProvider.cs index af1333c7c85..7fd5ea1001b 100644 --- a/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginViewMarginProvider.cs +++ b/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginViewMarginProvider.cs @@ -79,7 +79,9 @@ IWpfTextViewMargin marginContainer var editorFormatMap = _editorFormatMapService.GetEditorFormatMap(textView); var document = - wpfTextViewHost.TextView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + wpfTextViewHost.TextView.TextBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document == null) { return null; diff --git a/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/MarginGlyph/InheritanceMarginGlyph.cs b/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/MarginGlyph/InheritanceMarginGlyph.cs index d13f4fb3e63..ee03a3a80c8 100644 --- a/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/MarginGlyph/InheritanceMarginGlyph.cs +++ b/roslyn/src/VisualStudio/Core/Def/InheritanceMargin/MarginGlyph/InheritanceMarginGlyph.cs @@ -203,8 +203,8 @@ is ContextMenu { DataContext: InheritanceMarginGlyphViewModel inheritanceMarginViewModel } - && inheritanceMarginViewModel.MenuItemViewModels.Any( - static vm => vm is TargetMenuItemViewModel + && inheritanceMarginViewModel.MenuItemViewModels.Any(static vm => + vm is TargetMenuItemViewModel ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/Interactive/VsInteractiveWindowPackage.cs b/roslyn/src/VisualStudio/Core/Def/Interactive/VsInteractiveWindowPackage.cs index d149f1dc30d..daa7546f317 100644 --- a/roslyn/src/VisualStudio/Core/Def/Interactive/VsInteractiveWindowPackage.cs +++ b/roslyn/src/VisualStudio/Core/Def/Interactive/VsInteractiveWindowPackage.cs @@ -79,7 +79,9 @@ IProgress progress SetErrorHandlers(typeof(IVsInteractiveWindow).Assembly, fatalHandler, nonFatalHandler); _interactiveWindowProvider = - _componentModel.DefaultExportProvider.GetExportedValue(); + _componentModel.DefaultExportProvider.GetExportedValue( + + ); InitializeMenuCommands(menuCommandService); } diff --git a/roslyn/src/VisualStudio/Core/Def/Interactive/VsResetInteractive.cs b/roslyn/src/VisualStudio/Core/Def/Interactive/VsResetInteractive.cs index d805c44c8f7..388205bcda9 100644 --- a/roslyn/src/VisualStudio/Core/Def/Interactive/VsResetInteractive.cs +++ b/roslyn/src/VisualStudio/Core/Def/Interactive/VsResetInteractive.cs @@ -195,8 +195,8 @@ out var extensibilityObject } internal Project GetProjectFromHierarchy(IVsHierarchy hierarchy) => - _workspace.CurrentSolution.Projects.FirstOrDefault( - proj => _workspace.GetHierarchy(proj.Id) == hierarchy + _workspace.CurrentSolution.Projects.FirstOrDefault(proj => + _workspace.GetHierarchy(proj.Id) == hierarchy ); private static InteractiveHostPlatform? GetInteractiveHostPlatform( @@ -356,10 +356,12 @@ IInteractiveWindow interactiveWindow ) { var document = - interactiveWindow.CurrentLanguageBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + interactiveWindow.CurrentLanguageBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); var compilation = await document.Project.GetCompilationAsync().ConfigureAwait(true); - return namespacesToImport.Where( - ns => compilation.GlobalNamespace.GetQualifiedNamespace(ns) != null + return namespacesToImport.Where(ns => + compilation.GlobalNamespace.GetQualifiedNamespace(ns) != null ); } } diff --git a/roslyn/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs b/roslyn/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs index 47bbdad8cc1..784b7669b69 100644 --- a/roslyn/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs +++ b/roslyn/src/VisualStudio/Core/Def/LanguageService/AbstractLanguageService`2.VsCodeWindowManager.cs @@ -201,7 +201,9 @@ private void AddDropdownBar(IVsDropdownBarManager dropdownManager) buffer ); var controllerFactoryService = - _languageService.Package.ComponentModel.GetService(); + _languageService.Package.ComponentModel.GetService( + + ); var newController = controllerFactoryService.CreateController( navigationBarClient, textBuffer @@ -315,12 +317,16 @@ private void GetOutline(out IntPtr phwnd) var languageServiceBroker = _languageService.Package.ComponentModel.GetService(); var asyncListenerProvider = - _languageService.Package.ComponentModel.GetService(); + _languageService.Package.ComponentModel.GetService( + + ); var asyncListener = asyncListenerProvider.GetListener( FeatureAttribute.DocumentOutline ); var editorAdaptersFactoryService = - _languageService.Package.ComponentModel.GetService(); + _languageService.Package.ComponentModel.GetService( + + ); var outliningManagerService = _languageService.Package.ComponentModel.GetService(); diff --git a/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/StaticMemberSelectionViewModel.cs b/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/StaticMemberSelectionViewModel.cs index 5d500492860..c766b9656bb 100644 --- a/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/StaticMemberSelectionViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/StaticMemberSelectionViewModel.cs @@ -33,8 +33,8 @@ ImmutableDictionary>> dependentsMap _uiThreadOperationExecutor = uiThreadOperationExecutor; _members = members; _symbolToDependentsMap = dependentsMap; - _symbolToMemberViewMap = members.ToImmutableDictionary( - memberViewModel => memberViewModel.Symbol + _symbolToMemberViewMap = members.ToImmutableDictionary(memberViewModel => + memberViewModel.Symbol ); } diff --git a/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/VisualStudioMoveStaticMembersOptionsService.cs b/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/VisualStudioMoveStaticMembersOptionsService.cs index 1586113fd60..ec780c05a1f 100644 --- a/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/VisualStudioMoveStaticMembersOptionsService.cs +++ b/roslyn/src/VisualStudio/Core/Def/MoveStaticMembers/VisualStudioMoveStaticMembersOptionsService.cs @@ -94,8 +94,7 @@ bool dialogResult language == LanguageNames.CSharp ? ".cs" : ".vb" ); var selectedMembers = - viewModel.MemberSelectionViewModel.CheckedMembers.SelectAsArray( - vm => vm.Symbol + viewModel.MemberSelectionViewModel.CheckedMembers.SelectAsArray(vm => vm.Symbol ); if (viewModel.DestinationName.IsNew) @@ -130,20 +129,19 @@ IUIThreadOperationExecutor uiThreadOperationExecutor { var membersInType = selectedType .GetMembers() - .WhereAsArray( - member => MemberAndDestinationValidator.IsMemberValid(member) && member.IsStatic + .WhereAsArray(member => + MemberAndDestinationValidator.IsMemberValid(member) && member.IsStatic ); var memberViewModels = membersInType.SelectAsArray( - member => - new SymbolViewModel(member, glyphService) - { - // The member(s) user selected will be checked at the beginning. - IsChecked = selectedNodeSymbols.Any( - SymbolEquivalenceComparer.Instance.Equals, - member - ), - } + member => new SymbolViewModel(member, glyphService) + { + // The member(s) user selected will be checked at the beginning. + IsChecked = selectedNodeSymbols.Any( + SymbolEquivalenceComparer.Instance.Equals, + member + ), + } ); using var cancellationTokenSource = new CancellationTokenSource(); @@ -223,21 +221,17 @@ CancellationToken cancellationToken .GetAllTypes(cancellationToken) // only take symbols that are the same kind of type (class, module) // and remove non-static types only when the current type is static - .Where( - t => - t.TypeKind == currentType.TypeKind - && (t.IsStaticType() || !currentType.IsStaticType()) + .Where(t => + t.TypeKind == currentType.TypeKind + && (t.IsStaticType() || !currentType.IsStaticType()) ) .SelectMany(t => { // for partially declared classes, we may want multiple entries for a single type. // filter to those actually in a real file, and that is not our current location. - return t.Locations.Where( - l => - l.IsInSource - && ( - currentType.Name != t.Name || GetFile(l) != currentDocument.FilePath - ) + return t.Locations.Where(l => + l.IsInSource + && (currentType.Name != t.Name || GetFile(l) != currentDocument.FilePath) ) .Select(l => new TypeNameItem(history.Contains(t), GetFile(l), t)); }) diff --git a/roslyn/src/VisualStudio/Core/Def/NavigateTo/RoslynNavigateToSearchCallback.cs b/roslyn/src/VisualStudio/Core/Def/NavigateTo/RoslynNavigateToSearchCallback.cs index eb4831f089d..64e309d9811 100644 --- a/roslyn/src/VisualStudio/Core/Def/NavigateTo/RoslynNavigateToSearchCallback.cs +++ b/roslyn/src/VisualStudio/Core/Def/NavigateTo/RoslynNavigateToSearchCallback.cs @@ -59,15 +59,12 @@ CancellationToken cancellationToken ) { // Convert roslyn pattern matches to the platform type. - var matches = result.Matches.SelectAsArray( - static m => - new PatternMatch( - ConvertKind(m.Kind), - punctuationStripped: false, - m.IsCaseSensitive, - m.MatchedSpans.SelectAsArray(static s => s.ToSpan()) - ) - ); + var matches = result.Matches.SelectAsArray(static m => new PatternMatch( + ConvertKind(m.Kind), + punctuationStripped: false, + m.IsCaseSensitive, + m.MatchedSpans.SelectAsArray(static s => s.ToSpan()) + )); // Weight the items based on the overall pattern matching weights. We want the items that have the best // pattern matches (low .Kind values) to have the highest float values (as higher is better for the VS diff --git a/roslyn/src/VisualStudio/Core/Def/Preview/PreviewEngine.cs b/roslyn/src/VisualStudio/Core/Def/Preview/PreviewEngine.cs index 4e6b00078a5..c30124b85f7 100644 --- a/roslyn/src/VisualStudio/Core/Def/Preview/PreviewEngine.cs +++ b/roslyn/src/VisualStudio/Core/Def/Preview/PreviewEngine.cs @@ -142,12 +142,11 @@ public int GetRootChangesList(out object ppIUnknownPreviewChangesList) // Documents // (exclude unchangeable ones if they will be ignored when applied to workspace.) - var changedDocuments = projectChanges.SelectMany( - p => - p.GetChangedDocuments( - onlyGetDocumentsWithTextChanges: true, - _oldSolution.Workspace.IgnoreUnchangeableDocumentsWhenApplyingChanges - ) + var changedDocuments = projectChanges.SelectMany(p => + p.GetChangedDocuments( + onlyGetDocumentsWithTextChanges: true, + _oldSolution.Workspace.IgnoreUnchangeableDocumentsWhenApplyingChanges + ) ); var addedDocuments = projectChanges.SelectMany(p => p.GetAddedDocuments()); var removedDocuments = projectChanges.SelectMany(p => p.GetRemovedDocuments()); @@ -158,14 +157,14 @@ public int GetRootChangesList(out object ppIUnknownPreviewChangesList) allDocumentsWithChanges.AddRange(removedDocuments); // Additional Documents - var changedAdditionalDocuments = projectChanges.SelectMany( - p => p.GetChangedAdditionalDocuments() + var changedAdditionalDocuments = projectChanges.SelectMany(p => + p.GetChangedAdditionalDocuments() ); - var addedAdditionalDocuments = projectChanges.SelectMany( - p => p.GetAddedAdditionalDocuments() + var addedAdditionalDocuments = projectChanges.SelectMany(p => + p.GetAddedAdditionalDocuments() ); - var removedAdditionalDocuments = projectChanges.SelectMany( - p => p.GetRemovedAdditionalDocuments() + var removedAdditionalDocuments = projectChanges.SelectMany(p => + p.GetRemovedAdditionalDocuments() ); allDocumentsWithChanges.AddRange(changedAdditionalDocuments); @@ -173,14 +172,14 @@ public int GetRootChangesList(out object ppIUnknownPreviewChangesList) allDocumentsWithChanges.AddRange(removedAdditionalDocuments); // AnalyzerConfig Documents - var changedAnalyzerConfigDocuments = projectChanges.SelectMany( - p => p.GetChangedAnalyzerConfigDocuments() + var changedAnalyzerConfigDocuments = projectChanges.SelectMany(p => + p.GetChangedAnalyzerConfigDocuments() ); - var addedAnalyzerConfigDocuments = projectChanges.SelectMany( - p => p.GetAddedAnalyzerConfigDocuments() + var addedAnalyzerConfigDocuments = projectChanges.SelectMany(p => + p.GetAddedAnalyzerConfigDocuments() ); - var removedAnalyzerConfigDocuments = projectChanges.SelectMany( - p => p.GetRemovedAnalyzerConfigDocuments() + var removedAnalyzerConfigDocuments = projectChanges.SelectMany(p => + p.GetRemovedAnalyzerConfigDocuments() ); allDocumentsWithChanges.AddRange(changedAnalyzerConfigDocuments); diff --git a/roslyn/src/VisualStudio/Core/Def/Preview/PreviewUpdater.Tagger.cs b/roslyn/src/VisualStudio/Core/Def/Preview/PreviewUpdater.Tagger.cs index f274cf19c70..7589462f0bf 100644 --- a/roslyn/src/VisualStudio/Core/Def/Preview/PreviewUpdater.Tagger.cs +++ b/roslyn/src/VisualStudio/Core/Def/Preview/PreviewUpdater.Tagger.cs @@ -43,8 +43,8 @@ public IEnumerable> GetTags( NormalizedSnapshotSpanCollection spans ) { - var lines = _textBuffer.CurrentSnapshot.Lines.Where( - line => line.Extent.OverlapsWith(_span) + var lines = _textBuffer.CurrentSnapshot.Lines.Where(line => + line.Extent.OverlapsWith(_span) ); foreach (var line in lines) diff --git a/roslyn/src/VisualStudio/Core/Def/Preview/ReferenceChange.cs b/roslyn/src/VisualStudio/Core/Def/Preview/ReferenceChange.cs index 01febd77e85..df135ed1b9e 100644 --- a/roslyn/src/VisualStudio/Core/Def/Preview/ReferenceChange.cs +++ b/roslyn/src/VisualStudio/Core/Def/Preview/ReferenceChange.cs @@ -49,90 +49,72 @@ ArrayBuilder builder // Metadata references var addedMetadataReferenceChanges = projectChanges .GetAddedMetadataReferences() - .Select( - r => - new MetadataReferenceChange( - r, - projectId, - projectName, - isAdded: true, - engine: engine - ) - ); + .Select(r => new MetadataReferenceChange( + r, + projectId, + projectName, + isAdded: true, + engine: engine + )); builder.AddRange(addedMetadataReferenceChanges); var removedMetadataReferenceChanges = projectChanges .GetRemovedMetadataReferences() - .Select( - r => - new MetadataReferenceChange( - r, - projectId, - projectName, - isAdded: false, - engine: engine - ) - ); + .Select(r => new MetadataReferenceChange( + r, + projectId, + projectName, + isAdded: false, + engine: engine + )); builder.AddRange(removedMetadataReferenceChanges); // Project references var addedProjectReferenceChanges = projectChanges .GetAddedProjectReferences() - .Select( - r => - new ProjectReferenceChange( - r, - newSolution.GetProject(r.ProjectId).Name, - projectId, - projectName, - isAdded: true, - engine: engine - ) - ); + .Select(r => new ProjectReferenceChange( + r, + newSolution.GetProject(r.ProjectId).Name, + projectId, + projectName, + isAdded: true, + engine: engine + )); builder.AddRange(addedProjectReferenceChanges); var removedProjectReferenceChanges = projectChanges .GetRemovedProjectReferences() - .Select( - r => - new ProjectReferenceChange( - r, - oldSolution.GetProject(r.ProjectId).Name, - projectId, - projectName, - isAdded: false, - engine: engine - ) - ); + .Select(r => new ProjectReferenceChange( + r, + oldSolution.GetProject(r.ProjectId).Name, + projectId, + projectName, + isAdded: false, + engine: engine + )); builder.AddRange(removedProjectReferenceChanges); // Analyzer references var addedAnalyzerReferenceChanges = projectChanges .GetAddedAnalyzerReferences() - .Select( - r => - new AnalyzerReferenceChange( - r, - projectId, - projectName, - isAdded: true, - engine: engine - ) - ); + .Select(r => new AnalyzerReferenceChange( + r, + projectId, + projectName, + isAdded: true, + engine: engine + )); builder.AddRange(addedAnalyzerReferenceChanges); var removedAnalyzerReferenceChanges = projectChanges .GetRemovedAnalyzerReferences() - .Select( - r => - new AnalyzerReferenceChange( - r, - projectId, - projectName, - isAdded: false, - engine: engine - ) - ); + .Select(r => new AnalyzerReferenceChange( + r, + projectId, + projectName, + isAdded: false, + engine: engine + )); builder.AddRange(removedAnalyzerReferenceChanges); } } diff --git a/roslyn/src/VisualStudio/Core/Def/Progression/GraphProvider.cs b/roslyn/src/VisualStudio/Core/Def/Progression/GraphProvider.cs index fb9ec34c056..9a574e762b9 100644 --- a/roslyn/src/VisualStudio/Core/Def/Progression/GraphProvider.cs +++ b/roslyn/src/VisualStudio/Core/Def/Progression/GraphProvider.cs @@ -226,17 +226,16 @@ public IEnumerable GetCommands(IEnumerable nodes) // Only show 'Base Types' and 'Derived Types' on a class or interface. if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.NamedType) - && IsAnyTypeKind( - n, - TypeKind.Class, - TypeKind.Interface, - TypeKind.Struct, - TypeKind.Enum, - TypeKind.Delegate - ) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.NamedType) + && IsAnyTypeKind( + n, + TypeKind.Class, + TypeKind.Interface, + TypeKind.Struct, + TypeKind.Enum, + TypeKind.Delegate + ) ) ) { @@ -257,15 +256,14 @@ public IEnumerable GetCommands(IEnumerable nodes) // Only show 'Calls' on an applicable member in a class or struct if ( - nodes.Any( - n => - IsAnySymbolKind( - n, - SymbolKind.Event, - SymbolKind.Method, - SymbolKind.Property, - SymbolKind.Field - ) + nodes.Any(n => + IsAnySymbolKind( + n, + SymbolKind.Event, + SymbolKind.Method, + SymbolKind.Property, + SymbolKind.Field + ) ) ) { @@ -279,10 +277,9 @@ public IEnumerable GetCommands(IEnumerable nodes) // Only show 'Is Called By' on an applicable member in a class or struct if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) - && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) + && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) ) ) { @@ -304,10 +301,9 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Implements' on a class or struct, or an applicable member in a class or struct. if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.NamedType) - && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.NamedType) + && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) ) ) { @@ -322,17 +318,16 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Implements' on public, non-static members of a class or struct. Note: we should // also show it on explicit interface impls in C#. if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) - && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) - && !GetModifiers(n).IsStatic + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) + && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) + && !GetModifiers(n).IsStatic ) ) { if ( - nodes.Any( - n => CheckAccessibility(n, Accessibility.Public) || HasExplicitInterfaces(n) + nodes.Any(n => + CheckAccessibility(n, Accessibility.Public) || HasExplicitInterfaces(n) ) ) { @@ -347,10 +342,8 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Implemented By' on an interface. if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.NamedType) - && IsAnyTypeKind(n, TypeKind.Interface) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.NamedType) && IsAnyTypeKind(n, TypeKind.Interface) ) ) { @@ -364,10 +357,9 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Implemented By' on any member of an interface. if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) - && IsAnyTypeKind(n, TypeKind.Interface) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) + && IsAnyTypeKind(n, TypeKind.Interface) ) ) { @@ -381,11 +373,10 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Overrides' on any applicable member of a class or struct if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) - && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) - && GetModifiers(n).IsOverride + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) + && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) + && GetModifiers(n).IsOverride ) ) { @@ -399,11 +390,10 @@ public IEnumerable GetCommands(IEnumerable nodes) // Show 'Overridden By' on any applicable member of a class or struct if ( - nodes.Any( - n => - IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) - && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) - && IsOverridable(n) + nodes.Any(n => + IsAnySymbolKind(n, SymbolKind.Event, SymbolKind.Method, SymbolKind.Property) + && IsAnyTypeKind(n, TypeKind.Class, TypeKind.Struct) + && IsOverridable(n) ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/Progression/GraphQueries/InheritsGraphQuery.cs b/roslyn/src/VisualStudio/Core/Def/Progression/GraphQueries/InheritsGraphQuery.cs index 5ef776ec609..ad7a74b5d78 100644 --- a/roslyn/src/VisualStudio/Core/Def/Progression/GraphQueries/InheritsGraphQuery.cs +++ b/roslyn/src/VisualStudio/Core/Def/Progression/GraphQueries/InheritsGraphQuery.cs @@ -65,7 +65,9 @@ CancellationToken cancellationToken ) { foreach ( - var baseNode in namedType.OriginalDefinition.AllInterfaces.Distinct() + var baseNode in namedType.OriginalDefinition.AllInterfaces.Distinct( + + ) ) { var baseTypeNode = await graphBuilder diff --git a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/FileChangeWatcher.cs b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/FileChangeWatcher.cs index ad65944c2a8..c8d19cf3f9d 100644 --- a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/FileChangeWatcher.cs +++ b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/FileChangeWatcher.cs @@ -454,14 +454,13 @@ ImmutableArray watchedDirectories foreach (var watchedDirectory in watchedDirectories) { _fileChangeWatcher._taskQueue.AddWork( - watchedDirectories.Select( - watchedDirectory => - WatcherOperation.WatchDirectory( - watchedDirectory.Path, - watchedDirectory.ExtensionFilter, - this, - _directoryWatchCookies - ) + watchedDirectories.Select(watchedDirectory => + WatcherOperation.WatchDirectory( + watchedDirectory.Path, + watchedDirectory.ExtensionFilter, + this, + _directoryWatchCookies + ) ) ); } diff --git a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs index c1abd6a5726..dcc1ac61cfe 100644 --- a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs +++ b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs @@ -84,9 +84,13 @@ CancellationToken cancellationToken // moved off we'll need to fix up it's constructor to be free-threaded. await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - _visualStudioWorkspaceImpl.Services.GetRequiredService(); + _visualStudioWorkspaceImpl.Services.GetRequiredService( - _visualStudioWorkspaceImpl.SubscribeExternalErrorDiagnosticUpdateSourceToSolutionBuildEvents(); + ); + + _visualStudioWorkspaceImpl.SubscribeExternalErrorDiagnosticUpdateSourceToSolutionBuildEvents( + + ); #pragma warning disable CA2007 // Consider calling ConfigureAwait on the awaited task // Since we're on the UI thread here anyways, use that as an opportunity to grab the diff --git a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs index 98affaf1eb8..a225f454abe 100644 --- a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs +++ b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.OpenFileTracker.cs @@ -372,8 +372,8 @@ out var contextProjectNameObject // At this point, we should hopefully have only one project that matches by hierarchy. If there's multiple, at this point we can't figure anything // out better. - var matchingProjectId = projectIds.FirstOrDefault( - id => projectToHierarchyMap.GetValueOrDefault(id, null) == hierarchy + var matchingProjectId = projectIds.FirstOrDefault(id => + projectToHierarchyMap.GetValueOrDefault(id, null) == hierarchy ); if (matchingProjectId != null) diff --git a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs index febb4a7e96d..ef7246bf989 100644 --- a/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs +++ b/roslyn/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.RemoveMetadataReferenceUndoUnit.cs @@ -35,8 +35,8 @@ public override void Do(IOleUndoManager pUndoManager) { var reference = fromProject .MetadataReferences.OfType() - .FirstOrDefault( - p => StringComparer.OrdinalIgnoreCase.Equals(p.FilePath!, _filePath) + .FirstOrDefault(p => + StringComparer.OrdinalIgnoreCase.Equals(p.FilePath!, _filePath) ); if (reference != null) diff --git a/roslyn/src/VisualStudio/Core/Def/PullMemberUp/VisualStudioPullMemberUpService.cs b/roslyn/src/VisualStudio/Core/Def/PullMemberUp/VisualStudioPullMemberUpService.cs index 7f0ba378254..18c1bde633a 100644 --- a/roslyn/src/VisualStudio/Core/Def/PullMemberUp/VisualStudioPullMemberUpService.cs +++ b/roslyn/src/VisualStudio/Core/Def/PullMemberUp/VisualStudioPullMemberUpService.cs @@ -50,21 +50,17 @@ ImmutableArray selectedMembers var membersInType = containingType .GetMembers() .WhereAsArray(MemberAndDestinationValidator.IsMemberValid); - var memberViewModels = membersInType.SelectAsArray( - member => - new MemberSymbolViewModel(member, _glyphService) - { - // The member user selected will be checked at the beginning. - IsChecked = selectedMembers.Any( - SymbolEquivalenceComparer.Instance.Equals, - member - ), - MakeAbstract = false, - IsMakeAbstractCheckable = - !member.IsKind(SymbolKind.Field) && !member.IsAbstract, - IsCheckable = true - } - ); + var memberViewModels = membersInType.SelectAsArray(member => new MemberSymbolViewModel( + member, + _glyphService + ) + { + // The member user selected will be checked at the beginning. + IsChecked = selectedMembers.Any(SymbolEquivalenceComparer.Instance.Equals, member), + MakeAbstract = false, + IsMakeAbstractCheckable = !member.IsKind(SymbolKind.Field) && !member.IsAbstract, + IsCheckable = true + }); using var cancellationTokenSource = new CancellationTokenSource(); var baseTypeRootViewModel = BaseTypeTreeNodeViewModel.CreateBaseTypeTree( diff --git a/roslyn/src/VisualStudio/Core/Def/Snippets/AbstractSnippetExpansionClient.cs b/roslyn/src/VisualStudio/Core/Def/Snippets/AbstractSnippetExpansionClient.cs index 4abc9c806af..307f0977712 100644 --- a/roslyn/src/VisualStudio/Core/Def/Snippets/AbstractSnippetExpansionClient.cs +++ b/roslyn/src/VisualStudio/Core/Def/Snippets/AbstractSnippetExpansionClient.cs @@ -681,8 +681,9 @@ private bool TryInsertArgumentCompletionSnippet( CancellationToken cancellationToken ) { - var document = - SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document is null) { // Couldn't identify the current document @@ -946,8 +947,9 @@ private void OnModelUpdated(object sender, ModelUpdatedEventsArgs e) return; } - var document = - SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document is null) { // It's unclear if/how this state would occur, but if it does we would throw an exception trying to @@ -1044,8 +1046,9 @@ public void MoveToSpecificMethod(IMethodSymbol method, CancellationToken cancell return; } - var document = - SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges(); + var document = SubjectBuffer.CurrentSnapshot.GetOpenDocumentInCurrentContextWithChanges( + + ); if (document is null) { // Couldn't identify the current document @@ -1402,8 +1405,8 @@ private static void AddReferences(Project originalProject, XElement snippetNode) return; } - var existingReferenceNames = originalProject.MetadataReferences.Select( - r => Path.GetFileNameWithoutExtension(r.Display) + var existingReferenceNames = originalProject.MetadataReferences.Select(r => + Path.GetFileNameWithoutExtension(r.Display) ); var workspace = originalProject.Solution.Workspace; var projectId = originalProject.Id; diff --git a/roslyn/src/VisualStudio/Core/Def/Storage/CloudCachePersistentStorage.cs b/roslyn/src/VisualStudio/Core/Def/Storage/CloudCachePersistentStorage.cs index 71dce685112..242aebe889c 100644 --- a/roslyn/src/VisualStudio/Core/Def/Storage/CloudCachePersistentStorage.cs +++ b/roslyn/src/VisualStudio/Core/Def/Storage/CloudCachePersistentStorage.cs @@ -61,11 +61,10 @@ string databaseFilePath : base(workingFolderPath, relativePathBase, databaseFilePath) { _cacheService = cacheService; - _projectToContainerKeyCacheCallback = ps => - new ProjectContainerKeyCache( - relativePathBase, - ProjectKey.ToProjectKey(solutionKey, ps) - ); + _projectToContainerKeyCacheCallback = ps => new ProjectContainerKeyCache( + relativePathBase, + ProjectKey.ToProjectKey(solutionKey, ps) + ); } public sealed override void Dispose() => (_cacheService as IDisposable)?.Dispose(); diff --git a/roslyn/src/VisualStudio/Core/Def/SymbolSearch/AbstractDelayStartedService.cs b/roslyn/src/VisualStudio/Core/Def/SymbolSearch/AbstractDelayStartedService.cs index b392b941b65..bb13f8c9e3c 100644 --- a/roslyn/src/VisualStudio/Core/Def/SymbolSearch/AbstractDelayStartedService.cs +++ b/roslyn/src/VisualStudio/Core/Def/SymbolSearch/AbstractDelayStartedService.cs @@ -95,12 +95,11 @@ private async ValueTask ProcessOptionChangesAsync(CancellationToken arg) return; // If feature isn't enabled for any registered language, do nothing. - var languageEnabled = _registeredLanguages.Any( - lang => - _perLanguageOptions.Any( - static (option, arg) => arg.self._globalOptions.GetOption(option, arg.lang), - (self: this, lang) - ) + var languageEnabled = _registeredLanguages.Any(lang => + _perLanguageOptions.Any( + static (option, arg) => arg.self._globalOptions.GetOption(option, arg.lang), + (self: this, lang) + ) ); if (!languageEnabled) return; @@ -112,8 +111,9 @@ private async ValueTask ProcessOptionChangesAsync(CancellationToken arg) // Don't both kicking off delay-started services prior to the actual workspace being fully loaded. We don't // want them using CPU/memory in the BG while we're loading things for the user. - var statusService = - this.Workspace.Services.GetRequiredService(); + var statusService = this.Workspace.Services.GetRequiredService( + + ); await statusService.WaitUntilFullyLoadedAsync(this.DisposalToken).ConfigureAwait(false); await this.EnableServiceAsync(this.DisposalToken).ConfigureAwait(false); diff --git a/roslyn/src/VisualStudio/Core/Def/TableDataSource/AbstractTableEntriesSnapshot.cs b/roslyn/src/VisualStudio/Core/Def/TableDataSource/AbstractTableEntriesSnapshot.cs index fe9670211af..4d1335f1d25 100644 --- a/roslyn/src/VisualStudio/Core/Def/TableDataSource/AbstractTableEntriesSnapshot.cs +++ b/roslyn/src/VisualStudio/Core/Def/TableDataSource/AbstractTableEntriesSnapshot.cs @@ -224,10 +224,9 @@ CancellationToken cancellationToken ); var projectDirectory = Path.GetDirectoryName(project.FilePath); documentId = documents - .FirstOrDefault( - document => - Path.Combine(projectDirectory, document.FilePath) - == item.GetOriginalFilePath() + .FirstOrDefault(document => + Path.Combine(projectDirectory, document.FilePath) + == item.GetOriginalFilePath() ) ?.Id; if (documentId is null) diff --git a/roslyn/src/VisualStudio/Core/Def/TableDataSource/OpenDocumentTracker.cs b/roslyn/src/VisualStudio/Core/Def/TableDataSource/OpenDocumentTracker.cs index 95a05c12a5b..ab5a8659383 100644 --- a/roslyn/src/VisualStudio/Core/Def/TableDataSource/OpenDocumentTracker.cs +++ b/roslyn/src/VisualStudio/Core/Def/TableDataSource/OpenDocumentTracker.cs @@ -39,10 +39,9 @@ AbstractTableEntriesSnapshot snapshot if (!_map.TryGetValue(documentId, out var secondMap)) { secondMap = - new Dictionary< - object, - WeakReference> - >(); + new Dictionary>>( + + ); _map.Add(documentId, secondMap); } @@ -71,8 +70,8 @@ private void StopTracking(Solution solution, ProjectId? projectId = null) lock (_gate) { foreach ( - var documentId in _map.Keys.Where( - d => projectId == null ? true : d.ProjectId == projectId + var documentId in _map.Keys.Where(d => + projectId == null ? true : d.ProjectId == projectId ) .ToList() ) diff --git a/roslyn/src/VisualStudio/Core/Def/TableDataSource/VisualStudioDiagnosticListTable.BuildTableDataSource.cs b/roslyn/src/VisualStudio/Core/Def/TableDataSource/VisualStudioDiagnosticListTable.BuildTableDataSource.cs index dd7f94274dd..d877e9e0eec 100644 --- a/roslyn/src/VisualStudio/Core/Def/TableDataSource/VisualStudioDiagnosticListTable.BuildTableDataSource.cs +++ b/roslyn/src/VisualStudio/Core/Def/TableDataSource/VisualStudioDiagnosticListTable.BuildTableDataSource.cs @@ -338,10 +338,9 @@ CancellationToken cancellationToken { var projectDirectory = Path.GetDirectoryName(project.FilePath); documentId = documents - .FirstOrDefault( - document => - Path.Combine(projectDirectory, document.FilePath) - == item.GetOriginalFilePath() + .FirstOrDefault(document => + Path.Combine(projectDirectory, document.FilePath) + == item.GetOriginalFilePath() ) ?.Id; if (documentId is not null) diff --git a/roslyn/src/VisualStudio/Core/Def/Telemetry/TelemetryLogger.cs b/roslyn/src/VisualStudio/Core/Def/Telemetry/TelemetryLogger.cs index c757007d95d..79a69f7f468 100644 --- a/roslyn/src/VisualStudio/Core/Def/Telemetry/TelemetryLogger.cs +++ b/roslyn/src/VisualStudio/Core/Def/Telemetry/TelemetryLogger.cs @@ -249,11 +249,10 @@ KeyValueLogMessage logMessage PiiValue pii => new TelemetryPiiProperty(pii.Value), IEnumerable items => new TelemetryComplexProperty( - items.Select( - item => - (item is PiiValue pii) - ? new TelemetryPiiProperty(pii.Value) - : item + items.Select(item => + (item is PiiValue pii) + ? new TelemetryPiiProperty(pii.Value) + : item ) ), _ => value diff --git a/roslyn/src/VisualStudio/Core/Def/ValueTracking/ValueTrackingCommandHandler.cs b/roslyn/src/VisualStudio/Core/Def/ValueTracking/ValueTrackingCommandHandler.cs index d631dc36152..9c6a59ad450 100644 --- a/roslyn/src/VisualStudio/Core/Def/ValueTracking/ValueTrackingCommandHandler.cs +++ b/roslyn/src/VisualStudio/Core/Def/ValueTracking/ValueTrackingCommandHandler.cs @@ -142,8 +142,9 @@ CancellationToken cancellationToken var classificationFormatMap = _classificationFormatMapService.GetClassificationFormatMap(textView); var solution = document.Project.Solution; - var valueTrackingService = - solution.Services.GetRequiredService(); + var valueTrackingService = solution.Services.GetRequiredService( + + ); var rootItemMap = items.GroupBy( i => i.Parent, resultSelector: (key, items) => (parent: key, children: items) diff --git a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedDocument.cs b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedDocument.cs index 84cf5720a25..e034ca90130 100644 --- a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedDocument.cs +++ b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedDocument.cs @@ -151,8 +151,8 @@ private HostType GetHostType() // RazorCSharp has an HTMLX base type but should not be associated with // the HTML host type, so we check for it first. if ( - projectionBuffer.SourceBuffers.Any( - b => b.ContentType.IsOfType(Razor) || b.ContentType.IsOfType(LegacyRazor) + projectionBuffer.SourceBuffers.Any(b => + b.ContentType.IsOfType(Razor) || b.ContentType.IsOfType(LegacyRazor) ) ) { @@ -162,11 +162,10 @@ private HostType GetHostType() // For TypeScript hosted in HTML the source buffers will have type names // HTMLX and TypeScript. if ( - projectionBuffer.SourceBuffers.Any( - b => - b.ContentType.IsOfType(HTML) - || b.ContentType.IsOfType(WebForms) - || b.ContentType.IsOfType(HTMLX) + projectionBuffer.SourceBuffers.Any(b => + b.ContentType.IsOfType(HTML) + || b.ContentType.IsOfType(WebForms) + || b.ContentType.IsOfType(HTMLX) ) ) { diff --git a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedCode.cs b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedCode.cs index 60370ef4dd6..3ade335a8ee 100644 --- a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedCode.cs +++ b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedCode.cs @@ -60,22 +60,18 @@ CancellationToken cancellationToken return document .GetVisibleCodeBlocks(cancellationToken) - .Select( - tuple => - new TextSpanAndCookie - { - CodeSpan = new VsTextSpan - { - iStartLine = snapshot.GetLineNumberFromPosition(tuple.Item1.Start), - iStartIndex = 0, - iEndLine = snapshot.GetLineNumberFromPosition(tuple.Item1.End), - iEndIndex = - tuple.Item1.End - - snapshot.GetLineFromPosition(tuple.Item1.End).Start, - }, - ulHTMLCookie = tuple.Item2, - } - ) + .Select(tuple => new TextSpanAndCookie + { + CodeSpan = new VsTextSpan + { + iStartLine = snapshot.GetLineNumberFromPosition(tuple.Item1.Start), + iStartIndex = 0, + iEndLine = snapshot.GetLineNumberFromPosition(tuple.Item1.End), + iEndIndex = + tuple.Item1.End - snapshot.GetLineFromPosition(tuple.Item1.End).Start, + }, + ulHTMLCookie = tuple.Item2, + }) .ToArray(); } } diff --git a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedLanguageCodeSupport.cs b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedLanguageCodeSupport.cs index eeb2a68394b..78482d7a33a 100644 --- a/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedLanguageCodeSupport.cs +++ b/roslyn/src/VisualStudio/Core/Def/Venus/ContainedLanguage.IVsContainedLanguageCodeSupport.cs @@ -287,7 +287,9 @@ public int OnRenamed(ContainedLanguageRenameType clrt, string bstrOldID, string action: c => { var refactorNotifyServices = - this.ComponentModel.DefaultExportProvider.GetExportedValues(); + this.ComponentModel.DefaultExportProvider.GetExportedValues( + + ); if ( !ContainedLanguageCodeSupport.TryRenameElement( diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPage.cs b/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPage.cs index a61b41a7c41..2042ebc90a1 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPage.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPage.cs @@ -112,8 +112,8 @@ public override void SaveSettingsToStorage() OptionLogger.Log(changedOptions); s_optionStore.GlobalOptions.SetGlobalOptions( - changedOptions.SelectAsArray( - entry => KeyValuePairUtil.Create(entry.key, entry.newValue) + changedOptions.SelectAsArray(entry => + KeyValuePairUtil.Create(entry.key, entry.newValue) ) ); diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs b/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs index e4c4326e27d..1d30cca43a5 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/AbstractOptionPreviewViewModel.cs @@ -66,8 +66,9 @@ string language _contentTypeRegistryService = _componentModel.GetService(); _textBufferFactoryService = _componentModel.GetService(); _textEditorFactoryService = _componentModel.GetService(); - _projectionBufferFactory = - _componentModel.GetService(); + _projectionBufferFactory = _componentModel.GetService( + + ); _editorOptions = _componentModel.GetService(); this.Language = language; @@ -135,15 +136,11 @@ public void UpdatePreview(string text) var referenceAssemblies = Thread .GetDomain() .GetAssemblies() - .Where( - x => references.Contains(x.GetName(true).Name, StringComparer.OrdinalIgnoreCase) + .Where(x => + references.Contains(x.GetName(true).Name, StringComparer.OrdinalIgnoreCase) ) - .Select( - a => - metadataService.GetReference( - a.Location, - MetadataReferenceProperties.Assembly - ) + .Select(a => + metadataService.GetReference(a.Location, MetadataReferenceProperties.Assembly) ); project = project.WithMetadataReferences(referenceAssemblies); diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/Style/BooleanCodeStyleOptionViewModel.cs b/roslyn/src/VisualStudio/Core/Impl/Options/Style/BooleanCodeStyleOptionViewModel.cs index 2eb1f12411e..cfc97eb5db6 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/Style/BooleanCodeStyleOptionViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/Style/BooleanCodeStyleOptionViewModel.cs @@ -45,11 +45,11 @@ public BooleanCodeStyleOptionViewModel( ); _selectedPreference = Preferences.Single(c => c.IsChecked == codeStyleOption.Value); - var notificationViewModel = NotificationPreferences.Single( - i => i.Notification.Severity == codeStyleOption.Notification.Severity + var notificationViewModel = NotificationPreferences.Single(i => + i.Notification.Severity == codeStyleOption.Notification.Severity ); - _selectedNotificationPreference = NotificationPreferences.Single( - p => p.Notification.Severity == notificationViewModel.Notification.Severity + _selectedNotificationPreference = NotificationPreferences.Single(p => + p.Notification.Severity == notificationViewModel.Notification.Severity ); NotifyPropertyChanged(nameof(SelectedPreference)); diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/Style/EnumCodeStyleOptionViewModel.cs b/roslyn/src/VisualStudio/Core/Impl/Options/Style/EnumCodeStyleOptionViewModel.cs index 953bed7a2ce..3e4aae5dfe3 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/Style/EnumCodeStyleOptionViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/Style/EnumCodeStyleOptionViewModel.cs @@ -65,11 +65,11 @@ List preferences _selectedPreference = Preferences[enumIndex]; - var notificationViewModel = NotificationPreferences.Single( - i => i.Notification.Severity == codeStyleOption.Notification.Severity + var notificationViewModel = NotificationPreferences.Single(i => + i.Notification.Severity == codeStyleOption.Notification.Severity ); - _selectedNotificationPreference = NotificationPreferences.Single( - p => p.Notification.Severity == notificationViewModel.Notification.Severity + _selectedNotificationPreference = NotificationPreferences.Single(p => + p.Notification.Severity == notificationViewModel.Notification.Severity ); NotifyPropertyChanged(nameof(SelectedPreference)); diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyles/ManageNamingStylesDialogViewModel.cs b/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyles/ManageNamingStylesDialogViewModel.cs index 31a724b84ec..d6240fe0e68 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyles/ManageNamingStylesDialogViewModel.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/NamingStyles/ManageNamingStylesDialogViewModel.cs @@ -32,14 +32,11 @@ INotificationService notificationService _notificationService = notificationService; Items = new ObservableCollection( - namingStyles.Select( - style => - new NamingStyleViewModel( - style.Clone(), - !namingRules.Any(rule => rule.SelectedStyle?.ID == style.ID), - notificationService - ) - ) + namingStyles.Select(style => new NamingStyleViewModel( + style.Clone(), + !namingRules.Any(rule => rule.SelectedStyle?.ID == style.ID), + notificationService + )) ); } diff --git a/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/SymbolSpecification/SymbolSpecificationDialog.xaml.cs b/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/SymbolSpecification/SymbolSpecificationDialog.xaml.cs index 586cb6bd802..b49a025f426 100644 --- a/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/SymbolSpecification/SymbolSpecificationDialog.xaml.cs +++ b/roslyn/src/VisualStudio/Core/Impl/Options/Style/NamingPreferences/SymbolSpecification/SymbolSpecificationDialog.xaml.cs @@ -99,19 +99,25 @@ string itemsSourceName private void HandleSymbolKindsPreviewKeyDown(object sender, KeyEventArgs e) => HandlePreviewKeyDown( e, - symbolKindsListView.SelectedItems.OfType() + symbolKindsListView.SelectedItems.OfType( + + ) ); private void HandleAccessibilitiesPreviewKeyDown(object sender, KeyEventArgs e) => HandlePreviewKeyDown( e, - accessibilitiesListView.SelectedItems.OfType() + accessibilitiesListView.SelectedItems.OfType( + + ) ); private void HandleModifiersPreviewKeyDown(object sender, KeyEventArgs e) => HandlePreviewKeyDown( e, - modifiersListView.SelectedItems.OfType() + modifiersListView.SelectedItems.OfType( + + ) ); private static void HandlePreviewKeyDown(KeyEventArgs e, IEnumerable selectedItems) @@ -132,7 +138,9 @@ private static void HandlePreviewKeyDown(KeyEventArgs e, IEnumerable selec private void SelectAllSymbolKinds(object sender, RoutedEventArgs e) { foreach ( - var item in symbolKindsListView.Items.OfType() + var item in symbolKindsListView.Items.OfType( + + ) ) { item.IsChecked = true; @@ -142,7 +150,9 @@ private void SelectAllSymbolKinds(object sender, RoutedEventArgs e) private void DeselectAllSymbolKinds(object sender, RoutedEventArgs e) { foreach ( - var item in symbolKindsListView.Items.OfType() + var item in symbolKindsListView.Items.OfType( + + ) ) { item.IsChecked = false; @@ -152,7 +162,9 @@ private void DeselectAllSymbolKinds(object sender, RoutedEventArgs e) private void SelectAllAccessibilities(object sender, RoutedEventArgs e) { foreach ( - var item in accessibilitiesListView.Items.OfType() + var item in accessibilitiesListView.Items.OfType( + + ) ) { item.IsChecked = true; @@ -162,7 +174,9 @@ private void SelectAllAccessibilities(object sender, RoutedEventArgs e) private void DeselectAllAccessibilities(object sender, RoutedEventArgs e) { foreach ( - var item in accessibilitiesListView.Items.OfType() + var item in accessibilitiesListView.Items.OfType( + + ) ) { item.IsChecked = false; @@ -172,7 +186,9 @@ private void DeselectAllAccessibilities(object sender, RoutedEventArgs e) private void SelectAllModifiers(object sender, RoutedEventArgs e) { foreach ( - var item in modifiersListView.Items.OfType() + var item in modifiersListView.Items.OfType( + + ) ) { item.IsChecked = true; @@ -182,7 +198,9 @@ private void SelectAllModifiers(object sender, RoutedEventArgs e) private void DeselectAllModifiers(object sender, RoutedEventArgs e) { foreach ( - var item in modifiersListView.Items.OfType() + var item in modifiersListView.Items.OfType( + + ) ) { item.IsChecked = false; diff --git a/roslyn/src/VisualStudio/Core/Test.Next/Options/VisualStudioSettingsOptionPersisterTests.cs b/roslyn/src/VisualStudio/Core/Test.Next/Options/VisualStudioSettingsOptionPersisterTests.cs index 7fe54ff2835..d8cd7fada7d 100644 --- a/roslyn/src/VisualStudio/Core/Test.Next/Options/VisualStudioSettingsOptionPersisterTests.cs +++ b/roslyn/src/VisualStudio/Core/Test.Next/Options/VisualStudioSettingsOptionPersisterTests.cs @@ -180,7 +180,9 @@ private static bool IsDefaultImmutableArray(object array) => public void SettingsChangeEvent() { var exportProvider = - VisualStudioTestCompositions.LanguageServices.ExportProviderFactory.CreateExportProvider(); + VisualStudioTestCompositions.LanguageServices.ExportProviderFactory.CreateExportProvider( + + ); var fallbacks = exportProvider .GetExports() .ToImmutableDictionary(item => item.Metadata.ConfigName, item => item); diff --git a/roslyn/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs b/roslyn/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs index 0195e64775a..6f2c8bdf08e 100644 --- a/roslyn/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs +++ b/roslyn/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests.cs @@ -1162,11 +1162,11 @@ private static (Project project, Document document) GetProjectAndDocument( string documentName ) { - var project = solution.Projects.First( - p => string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase) + var project = solution.Projects.First(p => + string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase) ); - var document = project.Documents.First( - d => string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase) + var document = project.Documents.First(d => + string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase) ); return (project, document); @@ -1178,14 +1178,13 @@ private static (Project project, ImmutableArray documents) GetProjectA ImmutableArray documentNames ) { - var project = solution.Projects.First( - p => string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase) + var project = solution.Projects.First(p => + string.Equals(p.Name, projectName, StringComparison.OrdinalIgnoreCase) ); - var documents = documentNames.SelectAsArray( - documentName => - project.Documents.First( - d => string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase) - ) + var documents = documentNames.SelectAsArray(documentName => + project.Documents.First(d => + string.Equals(d.Name, documentName, StringComparison.OrdinalIgnoreCase) + ) ); return (project, documents); diff --git a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpCodeActions.cs b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpCodeActions.cs index 18690202546..570e27408f6 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpCodeActions.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpCodeActions.cs @@ -665,10 +665,9 @@ await TestServices.Editor.GetLightBulbPreviewClassificationsAsync( HangMitigatingCancellationToken ); Assert.True( - classifiedTokens.Any( - c => - c.Span.GetText().ToString() == "void" - && c.ClassificationType.Classification == "keyword" + classifiedTokens.Any(c => + c.Span.GetText().ToString() == "void" + && c.ClassificationType.Classification == "keyword" ) ); } diff --git a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs index 755132d4450..5988d1ff2e4 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpGoToImplementation.cs @@ -98,9 +98,8 @@ await TestServices.Shell.GetActiveWindowCaptionAsync( $": class Implementation : IGoo", string.Join( Environment.NewLine, - results.Select( - result => - $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" + results.Select(result => + $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" ) ) ); @@ -213,9 +212,8 @@ await TestServices.Shell.GetActiveWindowCaptionAsync( $": class Implementation : IBar", string.Join( Environment.NewLine, - results.Select( - result => - $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" + results.Select(result => + $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" ) ) ); @@ -314,17 +312,16 @@ await TestServices.Shell.GetActiveWindowCaptionAsync( ); // This test includes results from metadata on this path, so filter those out - results = results.WhereAsArray( - result => result.GetItemOrigin() != ItemOrigin.ExactMetadata + results = results.WhereAsArray(result => + result.GetItemOrigin() != ItemOrigin.ExactMetadata ); AssertEx.EqualOrDiff( $": class Implementation : IDisposable", string.Join( Environment.NewLine, - results.Select( - result => - $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" + results.Select(result => + $"{result.GetItemOrigin()?.ToString() ?? ""}: {result.GetText()}" ) ) ); diff --git a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs index bd9c0e7a909..aa26bd6c821 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpRename.cs @@ -86,9 +86,10 @@ static void TestMethod(int y) var tags = await TestServices.Editor.GetRenameTagsAsync( HangMitigatingCancellationToken ); - var tagSpans = tags.SelectAsArray( - tag => new TextSpan(tag.Span.Start, tag.Span.Length) - ); + var tagSpans = tags.SelectAsArray(tag => new TextSpan( + tag.Span.Start, + tag.Span.Length + )); AssertEx.SetEqual(renameSpans, tagSpans); await TestServices.Input.SendWithoutActivateAsync( diff --git a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/WorkspaceInProcess.cs b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/WorkspaceInProcess.cs index 8246a5d7189..c656293dc92 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/WorkspaceInProcess.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/WorkspaceInProcess.cs @@ -251,8 +251,9 @@ await GetComponentModelServiceAsync( if (featureNames.Contains(FeatureAttribute.NavigateTo)) { - var statusService = - workspace.Services.GetRequiredService(); + var statusService = workspace.Services.GetRequiredService( + + ); Contract.ThrowIfFalse(await statusService.IsFullyLoadedAsync(cancellationToken)); // Make sure the "priming" operation has started for Nav To diff --git a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/ChangeSignatureDialog_InProc.cs b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/ChangeSignatureDialog_InProc.cs index 5cbff088bba..7d305dd54c6 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/ChangeSignatureDialog_InProc.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/ChangeSignatureDialog_InProc.cs @@ -182,8 +182,7 @@ await JoinableTaskFactory.SwitchToMainThreadAsync( var members = dialog.GetTestAccessor().Members; members.SelectedItem = dialog .GetTestAccessor() - .ViewModel.AllParameters.Single( - p => p.ShortAutomationText == parameterName + .ViewModel.AllParameters.Single(p => p.ShortAutomationText == parameterName ); }); } diff --git a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs index 271fadf6e91..2b9e66650a8 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/Editor_InProc.cs @@ -309,8 +309,8 @@ private string[] GetTags(Predicate? filter = null) .GetTags(new SnapshotSpan(view.TextSnapshot, 0, view.TextSnapshot.Length)) .Where(t => filter(t.Tag)) .Cast>(); - return tags.Select( - tag => $"{tag.Tag}:{PrintSpan(tag.Span.GetSpans(view.TextBuffer).Single())}" + return tags.Select(tag => + $"{tag.Tag}:{PrintSpan(tag.Span.GetSpans(view.TextBuffer).Single())}" ) .ToArray(); }); @@ -458,13 +458,10 @@ IViewClassifierAggregatorService viewClassifierAggregator ) ); return classifiedSpans - .Select( - x => - new ClassifiedToken( - x.Span.GetText().ToString(), - x.ClassificationType.Classification - ) - ) + .Select(x => new ClassifiedToken( + x.Span.GetText().ToString(), + x.ClassificationType.Classification + )) .ToArray(); } diff --git a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs index 8493966469b..97c331fc115 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/SolutionExplorer_InProc.cs @@ -564,18 +564,11 @@ private EnvDTE.Project GetProject(string nameOrFileName) Contract.ThrowIfNull(_solution); return _solution .Projects.OfType() - .First( - p => - string.Compare( - p.FileName, - nameOrFileName, - StringComparison.OrdinalIgnoreCase - ) == 0 - || string.Compare( - p.Name, - nameOrFileName, - StringComparison.OrdinalIgnoreCase - ) == 0 + .First(p => + string.Compare(p.FileName, nameOrFileName, StringComparison.OrdinalIgnoreCase) + == 0 + || string.Compare(p.Name, nameOrFileName, StringComparison.OrdinalIgnoreCase) + == 0 ); } @@ -724,10 +717,9 @@ private static EnvDTE.OutputWindowPane GetBuildOutputWindowPane() public void WaitForBuildToFinish() { - var buildManager = GetGlobalService< - SVsSolutionBuildManager, - IVsSolutionBuildManager2 - >(); + var buildManager = GetGlobalService( + + ); using (var semaphore = new SemaphoreSlim(1)) using (var solutionEvents = new UpdateSolutionEvents(buildManager)) { @@ -1059,8 +1051,7 @@ private EnvDTE.ProjectItem GetProjectItem(string projectName, string relativeFil var fullFilePath = Path.Combine(projectPath, relativeFilePath); var projectItems = project.ProjectItems.Cast(); - var document = projectItems.FirstOrDefault( - d => d.get_FileNames(1).Equals(fullFilePath) + var document = projectItems.FirstOrDefault(d => d.get_FileNames(1).Equals(fullFilePath) ); if (document == null) @@ -1113,9 +1104,8 @@ public bool RestoreNuGetPackages(string projectName) Helper.HangMitigatingTimeout ); - var solutionRestoreService = InvokeOnUIThread( - cancellationToken => - GetComponentModel().GetExtensions().Single() + var solutionRestoreService = InvokeOnUIThread(cancellationToken => + GetComponentModel().GetExtensions().Single() ); var nominateProjectTask = solutionRestoreService.NominateProjectAsync( GetProject(projectName).FullName, diff --git a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs index 2b63eb6d4cd..be9d3886aef 100644 --- a/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs +++ b/roslyn/src/VisualStudio/IntegrationTest/TestUtilities/InProcess/VisualStudioWorkspace_InProc.cs @@ -44,32 +44,30 @@ public bool IsPrettyListingOn(string languageName) => _globalOptions.GetOption(LineCommitOptionsStorage.PrettyListing, languageName); public void SetPrettyListing(string languageName, bool value) => - InvokeOnUIThread( - _ => - _globalOptions.SetGlobalOption( - LineCommitOptionsStorage.PrettyListing, - languageName, - value - ) + InvokeOnUIThread(_ => + _globalOptions.SetGlobalOption( + LineCommitOptionsStorage.PrettyListing, + languageName, + value + ) ); public void SetFileScopedNamespaces(bool value) => - InvokeOnUIThread( - _ => - _globalOptions.SetGlobalOption( - Microsoft - .CodeAnalysis - .CSharp - .CodeStyle - .CSharpCodeStyleOptions - .NamespaceDeclarations, - new CodeStyleOption2( - value - ? NamespaceDeclarationPreference.FileScoped - : NamespaceDeclarationPreference.BlockScoped, - NotificationOption2.Suggestion - ) + InvokeOnUIThread(_ => + _globalOptions.SetGlobalOption( + Microsoft + .CodeAnalysis + .CSharp + .CodeStyle + .CSharpCodeStyleOptions + .NamespaceDeclarations, + new CodeStyleOption2( + value + ? NamespaceDeclarationPreference.FileScoped + : NamespaceDeclarationPreference.BlockScoped, + NotificationOption2.Suggestion ) + ) ); public void SetGlobalOption( @@ -113,7 +111,9 @@ public void WaitForAllAsyncOperationsOrFail(TimeSpan timeout, params string[] fe catch (Exception e) { var listenerProvider = GetComponentModel() - .DefaultExportProvider.GetExportedValue(); + .DefaultExportProvider.GetExportedValue( + + ); var messageBuilder = new StringBuilder( "Failed to clean up listeners in a timely manner." ); @@ -135,8 +135,8 @@ var token in ( private static void WaitForProjectSystem(TimeSpan timeout) { - var operationProgressStatus = InvokeOnUIThread( - _ => GetGlobalService() + var operationProgressStatus = InvokeOnUIThread(_ => + GetGlobalService() ); var stageStatus = operationProgressStatus.GetStageStatus( CommonOperationProgressStageIds.Intellisense @@ -159,7 +159,9 @@ public void CleanUpWorkspace() => LoadRoslynPackage(); var hook = - _visualStudioWorkspace.Services.GetRequiredService(); + _visualStudioWorkspace.Services.GetRequiredService( + + ); hook.IsPartialSolutionDisabled = true; }); @@ -202,7 +204,9 @@ public void CleanUpWaitingService() => InvokeOnUIThread(cancellationToken => { var provider = GetComponentModel() - .DefaultExportProvider.GetExportedValue(); + .DefaultExportProvider.GetExportedValue( + + ); if (provider == null) { diff --git a/roslyn/src/VisualStudio/LiveShare/Impl/Client/Projects/RoslynRemoteProjectInfoProvider.cs b/roslyn/src/VisualStudio/LiveShare/Impl/Client/Projects/RoslynRemoteProjectInfoProvider.cs index f75fed7eb99..6f973fb3777 100644 --- a/roslyn/src/VisualStudio/LiveShare/Impl/Client/Projects/RoslynRemoteProjectInfoProvider.cs +++ b/roslyn/src/VisualStudio/LiveShare/Impl/Client/Projects/RoslynRemoteProjectInfoProvider.cs @@ -94,16 +94,15 @@ CancellationToken cancellationToken // This is also the case for files for which TypeScript adds the generated TypeScript buffer to a different project. var filesTasks = project .SourceFiles.Where(f => f.Scheme != SystemUriSchemeExternal) - .Where( - f => !_secondaryBufferFileExtensions.Any(ext => f.LocalPath.EndsWith(ext)) + .Where(f => + !_secondaryBufferFileExtensions.Any(ext => f.LocalPath.EndsWith(ext)) ) - .Select( - f => - lspClient.ProtocolConverter.FromProtocolUriAsync( - f, - false, - cancellationToken - ) + .Select(f => + lspClient.ProtocolConverter.FromProtocolUriAsync( + f, + false, + cancellationToken + ) ); var files = await Task.WhenAll(filesTasks).ConfigureAwait(false); var projectInfo = CreateProjectInfo( @@ -128,18 +127,17 @@ SolutionServices services var projectId = ProjectId.CreateNewId(); var checksumAlgorithm = SourceHashAlgorithms.Default; - var docInfos = files.SelectAsArray( - path => - DocumentInfo.Create( - DocumentId.CreateNewId(projectId), - name: Path.GetFileNameWithoutExtension(path), - loader: new WorkspaceFileTextLoaderNoException( - services, - path, - defaultEncoding: null - ), - filePath: path - ) + var docInfos = files.SelectAsArray(path => + DocumentInfo.Create( + DocumentId.CreateNewId(projectId), + name: Path.GetFileNameWithoutExtension(path), + loader: new WorkspaceFileTextLoaderNoException( + services, + path, + defaultEncoding: null + ), + filePath: path + ) ); return ProjectInfo.Create( diff --git a/roslyn/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs b/roslyn/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs index aa17463790e..62767e9b34c 100644 --- a/roslyn/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs +++ b/roslyn/src/VisualStudio/LiveShare/Impl/ProjectsHandler.cs @@ -50,8 +50,8 @@ await requestContext { Name = project.Name, SourceFiles = project - .Documents.Select( - d => requestContext.ProtocolConverter.ToProtocolUri(new Uri(d.FilePath)) + .Documents.Select(d => + requestContext.ProtocolConverter.ToProtocolUri(new Uri(d.FilePath)) ) .ToArray(), Language = project.Language diff --git a/roslyn/src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagger.cs b/roslyn/src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagger.cs index bb49c2589d5..371ba5f42c5 100644 --- a/roslyn/src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagger.cs +++ b/roslyn/src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagger.cs @@ -72,13 +72,10 @@ NormalizedSnapshotSpanCollection spans return allSpans .Where(s => spans.Any(ss => ss.IntersectsWith(s))) - .Select( - s => - new TagSpan( - new SnapshotSpan(spans.First().Snapshot, s), - ProjectionSpanTag.Instance - ) - ); + .Select(s => new TagSpan( + new SnapshotSpan(spans.First().Snapshot, s), + ProjectionSpanTag.Instance + )); } public void Dispose() diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs index 94836a0bddc..6ead9ca445d 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionHandler.cs @@ -94,16 +94,15 @@ request.Context is VSInternalCompletionContext completionContext return new VSInternalCompletionList { Items = completionResult - .Completions.Select( - c => - CreateCompletionItem( - c, - document.Id, - text, - request.Position, - request.TextDocument, - commitCharactersCache - ) + .Completions.Select(c => + CreateCompletionItem( + c, + document.Id, + text, + request.Position, + request.TextDocument, + commitCharactersCache + ) ) .ToArray(), SuggestionMode = false, @@ -197,14 +196,11 @@ private static SumType GetCommitCharacter var xamlCommitCharacters = completionItem.XamlCommitCharacters.Value; var commitCharacters = xamlCommitCharacters - .Characters.Select( - c => - new VSInternalCommitCharacter - { - Character = c.ToString(), - Insert = !xamlCommitCharacters.NonInsertCharacters.Contains(c) - } - ) + .Characters.Select(c => new VSInternalCommitCharacter + { + Character = c.ToString(), + Insert = !xamlCommitCharacters.NonInsertCharacters.Contains(c) + }) .ToImmutableArray(); commitCharactersCache.Add(completionItem.Kind, commitCharacters); return commitCharacters.ToArray(); diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs index 97295f0ced3..a1af62132a4 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Completion/CompletionResolveHandler.cs @@ -106,9 +106,10 @@ CancellationToken cancellationToken .ConfigureAwait(false); vsCompletionItem.Description = new ClassifiedTextElement( - description.Select( - tp => new ClassifiedTextRun(tp.Tag.ToClassificationTypeName(), tp.Text) - ) + description.Select(tp => new ClassifiedTextRun( + tp.Tag.ToClassificationTypeName(), + tp.Text + )) ); return vsCompletionItem; } diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index 78eac3b39d7..9d8da8bc05c 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -156,33 +156,30 @@ SourceText text var project = document.Project; return xamlDiagnostics - .Value.Select( - d => - new VSDiagnostic() + .Value.Select(d => new VSDiagnostic() + { + Code = d.Code, + Message = d.Message ?? string.Empty, + ExpandedMessage = d.ExtendedMessage, + Severity = ConvertDiagnosticSeverity(d.Severity), + Range = ProtocolConversions.TextSpanToRange( + new TextSpan(d.Offset, d.Length), + text + ), + Tags = ConvertTags(d), + Source = d.Tool, + CodeDescription = ProtocolConversions.HelpLinkToCodeDescription( + d.GetHelpLinkUri() + ), + Projects = + [ + new VSDiagnosticProjectInformation { - Code = d.Code, - Message = d.Message ?? string.Empty, - ExpandedMessage = d.ExtendedMessage, - Severity = ConvertDiagnosticSeverity(d.Severity), - Range = ProtocolConversions.TextSpanToRange( - new TextSpan(d.Offset, d.Length), - text - ), - Tags = ConvertTags(d), - Source = d.Tool, - CodeDescription = ProtocolConversions.HelpLinkToCodeDescription( - d.GetHelpLinkUri() - ), - Projects = - [ - new VSDiagnosticProjectInformation - { - ProjectIdentifier = project.Id.Id.ToString(), - ProjectName = project.Name, - }, - ], - } - ) + ProjectIdentifier = project.Id.Id.ToString(), + ProjectName = project.Name, + }, + ], + }) .ToArray(); } diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs index 082e95565fc..1a0fdfbd375 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/AbstractFormatDocumentHandlerBase.cs @@ -62,8 +62,8 @@ CancellationToken cancellationToken .GetFormattingChangesAsync(document, options, textSpan, cancellationToken) .ConfigureAwait(false); edits.AddRange( - textChanges.Select( - change => ProtocolConversions.TextChangeToTextEdit(change, text) + textChanges.Select(change => + ProtocolConversions.TextChangeToTextEdit(change, text) ) ); } diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs index 6e043e286c1..cfa577d309c 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Formatting/FormatDocumentOnTypeHandler.cs @@ -78,8 +78,8 @@ CancellationToken cancellationToken .GetValueTextAsync(cancellationToken) .ConfigureAwait(false); edits.AddRange( - textChanges.Select( - change => ProtocolConversions.TextChangeToTextEdit(change, text) + textChanges.Select(change => + ProtocolConversions.TextChangeToTextEdit(change, text) ) ); } diff --git a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs index 87e2f1ca93a..6dd730a6bff 100644 --- a/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs +++ b/roslyn/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Hover/HoverHandler.cs @@ -108,9 +108,10 @@ CancellationToken cancellationToken Value = GetMarkdownString(descriptionBuilder) }, RawContent = new ClassifiedTextElement( - descriptionBuilder.Select( - tp => new ClassifiedTextRun(tp.Tag.ToClassificationTypeName(), tp.Text) - ) + descriptionBuilder.Select(tp => new ClassifiedTextRun( + tp.Tag.ToClassificationTypeName(), + tp.Text + )) ) }; diff --git a/roslyn/src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs b/roslyn/src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs index 3101e81d145..5291f72ebd6 100644 --- a/roslyn/src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs +++ b/roslyn/src/Workspaces/CSharp/Portable/Extensions/SemanticModelExtensions.cs @@ -84,8 +84,8 @@ CancellationToken cancellationToken var parameterNames = reservedNames .Concat( - arguments.Select( - a => semanticModel.GenerateNameForArgument(a, cancellationToken) + arguments.Select(a => + semanticModel.GenerateNameForArgument(a, cancellationToken) ) ) .ToImmutableArray(); @@ -121,8 +121,8 @@ CancellationToken cancellationToken var parameterNames = reservedNames .Concat( - arguments.Select( - a => semanticModel.GenerateNameForArgument(a, cancellationToken) + arguments.Select(a => + semanticModel.GenerateNameForArgument(a, cancellationToken) ) ) .ToImmutableArray(); diff --git a/roslyn/src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs b/roslyn/src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs index 9d2bb06b4a5..74c7a5d0769 100644 --- a/roslyn/src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs +++ b/roslyn/src/Workspaces/CSharp/Portable/Rename/CSharpRenameRewriterLanguageService.cs @@ -146,15 +146,19 @@ public RenameRewriter(RenameRewriterParameters parameters) _renameAnnotations = parameters.RenameAnnotations; _aliasSymbol = _renamedSymbol as IAliasSymbol; - _renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault( - loc => loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree + _renamableDeclarationLocation = _renamedSymbol.Locations.FirstOrDefault(loc => + loc.IsInSource && loc.SourceTree == _semanticModel.SyntaxTree ); _isVerbatim = _replacementText.StartsWith("@", StringComparison.Ordinal); _simplificationService = - parameters.Document.Project.Services.GetRequiredService(); + parameters.Document.Project.Services.GetRequiredService( + + ); _semanticFactsService = - parameters.Document.Project.Services.GetRequiredService(); + parameters.Document.Project.Services.GetRequiredService( + + ); } public override SyntaxNode? Visit(SyntaxNode? node) @@ -165,8 +169,8 @@ public RenameRewriter(RenameRewriterParameters parameters) } var isInConflictLambdaBody = false; - var lambdas = node.GetAncestorsOrThis( - n => n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax + var lambdas = node.GetAncestorsOrThis(n => + n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax ); if (lambdas.Count() != 0) { @@ -325,11 +329,8 @@ private SyntaxNode Complexify(SyntaxNode originalNode, SyntaxNode newNode) var oldSpan = originalNode.Span; var expandParameter = originalNode - .GetAncestorsOrThis( - n => - n - is SimpleLambdaExpressionSyntax - or ParenthesizedLambdaExpressionSyntax + .GetAncestorsOrThis(n => + n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax ) .Count() == 0; @@ -1028,10 +1029,9 @@ token.Parent is ExpressionSyntax(SyntaxKind.IdentifierName) expression // or parameter. Report a conflict if the matching local/parameter is not // a delegate type. - var relevantLocals = newReferencedSymbols.Where( - s => - s.MatchesKind(SymbolKind.Local, SymbolKind.Parameter) - && s.Name == token.ValueText + var relevantLocals = newReferencedSymbols.Where(s => + s.MatchesKind(SymbolKind.Local, SymbolKind.Parameter) + && s.Name == token.ValueText ); if (relevantLocals.Count() != 1) @@ -1110,8 +1110,8 @@ or SymbolKind.RangeVariable visitor.Visit(memberDeclaration); conflicts.AddRange( - visitor.ConflictingTokens.Select( - t => reverseMappedLocations[t.GetLocation()] + visitor.ConflictingTokens.Select(t => + reverseMappedLocations[t.GetLocation()] ) ); @@ -1134,8 +1134,8 @@ renamedSymbol is IParameterSymbol renamedParameterSymbol visitor = new LocalConflictVisitor(token); visitor.Visit(memberDeclaration); conflicts.AddRange( - visitor.ConflictingTokens.Select( - t => reverseMappedLocations[t.GetLocation()] + visitor.ConflictingTokens.Select(t => + reverseMappedLocations[t.GetLocation()] ) ); } @@ -1148,8 +1148,8 @@ renamedSymbol is IParameterSymbol renamedParameterSymbol visitor.Visit(memberDeclaration); conflicts.AddRange( - visitor.ConflictingTokens.Select( - t => reverseMappedLocations[t.GetLocation()] + visitor.ConflictingTokens.Select(t => + reverseMappedLocations[t.GetLocation()] ) ); } @@ -1602,11 +1602,8 @@ ICollection possibleNameConflicts var possibleLambdaExpression = enclosingStatement == null ? token - .GetAncestors( - n => - n - is SimpleLambdaExpressionSyntax - or ParenthesizedLambdaExpressionSyntax + .GetAncestors(n => + n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax ) .FirstOrDefault() : null; @@ -1721,8 +1718,8 @@ SemanticModel originalSemanticModel return originalSemanticModel; } - var nodeToSpeculate = node.GetAncestorsOrThis( - n => SpeculationAnalyzer.CanSpeculateOnNode(n) + var nodeToSpeculate = node.GetAncestorsOrThis(n => + SpeculationAnalyzer.CanSpeculateOnNode(n) ) .LastOrDefault(); if (nodeToSpeculate == null) diff --git a/roslyn/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs b/roslyn/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs index eff5205f216..9c8267306ef 100644 --- a/roslyn/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs +++ b/roslyn/src/Workspaces/CSharp/Portable/Simplification/CSharpSimplificationService.Expander.cs @@ -226,8 +226,8 @@ out var newLambdaExpressionBodyWithCast if (parameters.Length > 0 && parameters.Any(p => p.Type == null)) { - var parameterSymbols = node.ParameterList.Parameters.Select( - p => _semanticModel.GetDeclaredSymbol(p, _cancellationToken) + var parameterSymbols = node.ParameterList.Parameters.Select(p => + _semanticModel.GetDeclaredSymbol(p, _cancellationToken) ) .ToArray(); @@ -1019,13 +1019,10 @@ ISymbol symbol ((IdentifierNameSyntax)newNode).Identifier, SyntaxFactory.TypeArgumentList( SyntaxFactory.SeparatedList( - typeArguments.Select( - p => - SyntaxFactory.ParseTypeName( - p.ToDisplayString( - s_typeNameFormatWithGenerics - ) - ) + typeArguments.Select(p => + SyntaxFactory.ParseTypeName( + p.ToDisplayString(s_typeNameFormatWithGenerics) + ) ) ) ) diff --git a/roslyn/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpEscapingReducer.cs b/roslyn/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpEscapingReducer.cs index 27d9515c12f..89b1116ed5a 100644 --- a/roslyn/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpEscapingReducer.cs +++ b/roslyn/src/Workspaces/CSharp/Portable/Simplification/Reducers/CSharpEscapingReducer.cs @@ -66,13 +66,8 @@ CancellationToken cancellationToken ) { var enclosingLambdaExpression = parent - .GetAncestorsOrThis( - n => - ( - n - is SimpleLambdaExpressionSyntax - or ParenthesizedLambdaExpressionSyntax - ) + .GetAncestorsOrThis(n => + (n is SimpleLambdaExpressionSyntax or ParenthesizedLambdaExpressionSyntax) ) .FirstOrDefault(); if (enclosingLambdaExpression != null) diff --git a/roslyn/src/Workspaces/CSharp/Portable/Simplification/Simplifiers/AbstractCSharpSimplifier.cs b/roslyn/src/Workspaces/CSharp/Portable/Simplification/Simplifiers/AbstractCSharpSimplifier.cs index f958cae1816..4ee27f533cc 100644 --- a/roslyn/src/Workspaces/CSharp/Portable/Simplification/Simplifiers/AbstractCSharpSimplifier.cs +++ b/roslyn/src/Workspaces/CSharp/Portable/Simplification/Simplifiers/AbstractCSharpSimplifier.cs @@ -503,15 +503,16 @@ protected static bool InsideNameOfExpression( SemanticModel semanticModel ) { - var nameOfInvocationExpr = - expression.FirstAncestorOrSelf(invocationExpr => + var nameOfInvocationExpr = expression.FirstAncestorOrSelf( + invocationExpr => { return invocationExpr.Expression is IdentifierNameSyntax identifierName && identifierName.Identifier.Text == "nameof" && semanticModel.GetConstantValue(invocationExpr).HasValue && semanticModel.GetTypeInfo(invocationExpr).Type.SpecialType == SpecialType.System_String; - }); + } + ); return nameOfInvocationExpr != null; } diff --git a/roslyn/src/Workspaces/Core/MSBuild.BuildHost/Program.cs b/roslyn/src/Workspaces/Core/MSBuild.BuildHost/Program.cs index 4685417beee..b956be57b5d 100644 --- a/roslyn/src/Workspaces/Core/MSBuild.BuildHost/Program.cs +++ b/roslyn/src/Workspaces/Core/MSBuild.BuildHost/Program.cs @@ -36,17 +36,16 @@ internal static async Task Main(string[] args) // Create a console logger that logs everything to standard error instead of standard out; by setting the threshold to Trace // everything will go to standard error. - var loggerFactory = LoggerFactory.Create( - builder => - builder.AddConsole(configure => - { - // DisableColors is deprecated in favor of us moving to simple console, but that loses the LogToStandardErrorThreshold - // which we also need + var loggerFactory = LoggerFactory.Create(builder => + builder.AddConsole(configure => + { + // DisableColors is deprecated in favor of us moving to simple console, but that loses the LogToStandardErrorThreshold + // which we also need #pragma warning disable CS0618 - configure.DisableColors = true; + configure.DisableColors = true; #pragma warning restore CS0618 - configure.LogToStandardErrorThreshold = LogLevel.Trace; - }) + configure.LogToStandardErrorThreshold = LogLevel.Trace; + }) ); var logger = loggerFactory.CreateLogger(typeof(Program)); diff --git a/roslyn/src/Workspaces/Core/MSBuild/Rpc/RpcClient.cs b/roslyn/src/Workspaces/Core/MSBuild/Rpc/RpcClient.cs index 833077fa339..dd96f773ef7 100644 --- a/roslyn/src/Workspaces/Core/MSBuild/Rpc/RpcClient.cs +++ b/roslyn/src/Workspaces/Core/MSBuild/Rpc/RpcClient.cs @@ -199,8 +199,8 @@ CancellationToken cancellationToken Id = requestId, TargetObject = targetObject, Method = methodName, - Parameters = parameters.SelectAsArray( - static p => p is not null ? JToken.FromObject(p) : JValue.CreateNull() + Parameters = parameters.SelectAsArray(static p => + p is not null ? JToken.FromObject(p) : JValue.CreateNull() ) }; diff --git a/roslyn/src/Workspaces/Core/Portable/Classification/Classifier.cs b/roslyn/src/Workspaces/Core/Portable/Classification/Classifier.cs index a8ede9f58c8..c1315faa06e 100644 --- a/roslyn/src/Workspaces/Core/Portable/Classification/Classifier.cs +++ b/roslyn/src/Workspaces/Core/Portable/Classification/Classifier.cs @@ -160,8 +160,8 @@ CancellationToken cancellationToken var semanticSet = semanticClassifications.Select(s => s.TextSpan).ToSet(); allClassifications.AddRange( - syntacticClassifications.Where( - s => s.TextSpan.OverlapsWith(textSpan) && !semanticSet.Contains(s.TextSpan) + syntacticClassifications.Where(s => + s.TextSpan.OverlapsWith(textSpan) && !semanticSet.Contains(s.TextSpan) ) ); allClassifications.Sort((s1, s2) => s1.TextSpan.Start - s2.TextSpan.Start); diff --git a/roslyn/src/Workspaces/Core/Portable/CodeFixes/CodeFix.cs b/roslyn/src/Workspaces/Core/Portable/CodeFixes/CodeFix.cs index 232d0dcc1ec..effdd87f792 100644 --- a/roslyn/src/Workspaces/Core/Portable/CodeFixes/CodeFix.cs +++ b/roslyn/src/Workspaces/Core/Portable/CodeFixes/CodeFix.cs @@ -69,8 +69,8 @@ internal DiagnosticData GetPrimaryDiagnosticData() } else if (diagnostic.Location.Kind == LocationKind.ExternalFile) { - var document = Project.Documents.FirstOrDefault( - d => d.FilePath == diagnostic.Location.GetLineSpan().Path + var document = Project.Documents.FirstOrDefault(d => + d.FilePath == diagnostic.Location.GetLineSpan().Path ); if (document != null) { diff --git a/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs b/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs index 37abae7140e..195fcb576aa 100644 --- a/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs +++ b/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs @@ -255,8 +255,8 @@ out var changedDocuments .GetProjectChanges() .SelectMany(p => p.GetChangedDocuments()); changedDocuments.AddRange( - changedDocumentIds.Select( - id => changedSolution.GetRequiredDocument(id) + changedDocumentIds.Select(id => + changedSolution.GetRequiredDocument(id) ) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs b/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs index 3b1abdcdfb0..aa64e5a693d 100644 --- a/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs +++ b/roslyn/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/FixAllContext.cs @@ -283,14 +283,13 @@ private static async Task> GetFilteredDiagnosticsAsyn if (diagnostics != null) { return diagnostics - .Where( - d => - d != null - && diagnosticIds.Contains(d.Id) - && ( - filterSpan == null - || filterSpan.Value.Contains(d.Location.SourceSpan) - ) + .Where(d => + d != null + && diagnosticIds.Contains(d.Id) + && ( + filterSpan == null + || filterSpan.Value.Contains(d.Location.SourceSpan) + ) ) .ToImmutableArray(); } diff --git a/roslyn/src/Workspaces/Core/Portable/CodeFixesAndRefactorings/FixAllLogger.cs b/roslyn/src/Workspaces/Core/Portable/CodeFixesAndRefactorings/FixAllLogger.cs index 86970d46435..e7c9a06218c 100644 --- a/roslyn/src/Workspaces/Core/Portable/CodeFixesAndRefactorings/FixAllLogger.cs +++ b/roslyn/src/Workspaces/Core/Portable/CodeFixesAndRefactorings/FixAllLogger.cs @@ -91,8 +91,8 @@ public static void LogState(IFixAllState fixAllState, bool isInternalProvider) break; case CodeFixes.FixAllScope.Solution: - m[DocumentCount] = fixAllState.Solution.Projects.Sum( - p => p.DocumentIds.Count + m[DocumentCount] = fixAllState.Solution.Projects.Sum(p => + p.DocumentIds.Count ); break; } @@ -193,8 +193,8 @@ public static void LogDiagnosticsStats( { m[CorrelationId] = correlationId; m[DocumentsWithDiagnosticsToFix] = documentsAndDiagnosticsToFixMap.Count; - m[TotalDiagnosticsToFix] = documentsAndDiagnosticsToFixMap.Values.Sum( - v => v.Length + m[TotalDiagnosticsToFix] = documentsAndDiagnosticsToFixMap.Values.Sum(v => + v.Length ); }) ); @@ -211,8 +211,8 @@ ImmutableDictionary> projectsAndDiagnosticsT { m[CorrelationId] = correlationId; m[ProjectsWithDiagnosticsToFix] = projectsAndDiagnosticsToFixMap.Count; - m[TotalDiagnosticsToFix] = projectsAndDiagnosticsToFixMap.Values.Sum( - v => v.Length + m[TotalDiagnosticsToFix] = projectsAndDiagnosticsToFixMap.Values.Sum(v => + v.Length ); }) ); diff --git a/roslyn/src/Workspaces/Core/Portable/CodeRefactorings/FixAllOccurences/FixAllState.cs b/roslyn/src/Workspaces/Core/Portable/CodeRefactorings/FixAllOccurences/FixAllState.cs index ae1fb05bed5..aa2221a3daa 100644 --- a/roslyn/src/Workspaces/Core/Portable/CodeRefactorings/FixAllOccurences/FixAllState.cs +++ b/roslyn/src/Workspaces/Core/Portable/CodeRefactorings/FixAllOccurences/FixAllState.cs @@ -134,8 +134,9 @@ internal async Task< case FixAllScope.ContainingType or FixAllScope.ContainingMember: Contract.ThrowIfNull(Document); - var spanMappingService = - Document.GetLanguageService(); + var spanMappingService = Document.GetLanguageService( + + ); if (spanMappingService is null) return ImmutableDictionary< Document, @@ -146,12 +147,11 @@ internal async Task< .GetFixAllSpansAsync(Document, _selectionSpan, Scope, cancellationToken) .ConfigureAwait(false); return spansByDocument - .Select( - kvp => - KeyValuePairUtil.Create( - kvp.Key, - new Optional>(kvp.Value) - ) + .Select(kvp => + KeyValuePairUtil.Create( + kvp.Key, + new Optional>(kvp.Value) + ) ) .ToImmutableDictionaryOrEmpty(); diff --git a/roslyn/src/Workspaces/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs b/roslyn/src/Workspaces/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs index 991c6467b82..ac39e37339c 100644 --- a/roslyn/src/Workspaces/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs +++ b/roslyn/src/Workspaces/Core/Portable/Diagnostics/HostDiagnosticAnalyzers.cs @@ -230,8 +230,8 @@ private ImmutableDictionary CreateProjectAnalyzerRefe IReadOnlyList projectAnalyzerReferences ) => CreateAnalyzerReferencesMap( - projectAnalyzerReferences.Where( - reference => !_hostAnalyzerReferencesMap.ContainsKey(reference.Id) + projectAnalyzerReferences.Where(reference => + !_hostAnalyzerReferencesMap.ContainsKey(reference.Id) ) ); diff --git a/roslyn/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs b/roslyn/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs index 2badebec12a..6c8460f8f0a 100644 --- a/roslyn/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs +++ b/roslyn/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs @@ -226,11 +226,10 @@ private IEnumerable GetDeclarations(ISymbol symbol) { return symbol .DeclaringSyntaxReferences.Select(sr => sr.GetSyntax()) - .Select( - n => - SyntaxGenerator - .GetGenerator(_originalSolution.Workspace, n.Language) - .GetDeclaration(n) + .Select(n => + SyntaxGenerator + .GetGenerator(_originalSolution.Workspace, n.Language) + .GetDeclaration(n) ) .Where(d => d != null); } @@ -503,13 +502,10 @@ public async Task EditOneDeclarationAsync( // get first symbol declaration that encompasses at least one of the member declarations var memberDecls = this.GetDeclarations(currentMember).ToList(); var declaration = this.GetDeclarations(currentSymbol) - .FirstOrDefault( - d => - memberDecls.Any( - md => - md.SyntaxTree == d.SyntaxTree - && d.FullSpan.IntersectsWith(md.FullSpan) - ) + .FirstOrDefault(d => + memberDecls.Any(md => + md.SyntaxTree == d.SyntaxTree && d.FullSpan.IntersectsWith(md.FullSpan) + ) ); if (declaration == null) diff --git a/roslyn/src/Workspaces/Core/Portable/Editing/SyntaxGenerator.cs b/roslyn/src/Workspaces/Core/Portable/Editing/SyntaxGenerator.cs index fbc54613b84..d5cfc11aecb 100644 --- a/roslyn/src/Workspaces/Core/Portable/Editing/SyntaxGenerator.cs +++ b/roslyn/src/Workspaces/Core/Portable/Editing/SyntaxGenerator.cs @@ -267,10 +267,9 @@ bool HasNullableAnnotation(ITypeParameterSymbol typeParameter, IMethodSymbol met return method .ReturnType.GetReferencedTypeParameters() .Any(t => IsNullableAnnotatedTypeParameter(typeParameter, t)) - || method.Parameters.Any( - p => - p.Type.GetReferencedTypeParameters() - .Any(t => IsNullableAnnotatedTypeParameter(typeParameter, t)) + || method.Parameters.Any(p => + p.Type.GetReferencedTypeParameters() + .Any(t => IsNullableAnnotatedTypeParameter(typeParameter, t)) ); } @@ -1004,8 +1003,8 @@ is null ? DelegateDeclaration( type.Name, typeParameters: type.TypeParameters.Select(TypeParameter), - parameters: invoke.Parameters.Select( - p => ParameterDeclaration(p) + parameters: invoke.Parameters.Select(p => + ParameterDeclaration(p) ), returnType: invoke.ReturnsVoid ? null @@ -1325,12 +1324,12 @@ public SyntaxNode Attribute(AttributeData attribute) Contract.ThrowIfNull(attribute.AttributeClass); var args = attribute - .ConstructorArguments.Select( - a => this.AttributeArgument(this.TypedConstantExpression(a)) + .ConstructorArguments.Select(a => + this.AttributeArgument(this.TypedConstantExpression(a)) ) .Concat( - attribute.NamedArguments.Select( - n => this.AttributeArgument(n.Key, this.TypedConstantExpression(n.Value)) + attribute.NamedArguments.Select(n => + this.AttributeArgument(n.Key, this.TypedConstantExpression(n.Value)) ) ) .ToBoxedImmutableArray(); @@ -1876,11 +1875,10 @@ internal static SyntaxTokenList Merge(SyntaxTokenList original, SyntaxTokenList { // return tokens from newList, but use original tokens of kind matches return new SyntaxTokenList( - newList.Select( - token => - Any(original, token.RawKind) - ? original.First(tk => tk.RawKind == token.RawKind) - : token + newList.Select(token => + Any(original, token.RawKind) + ? original.First(tk => tk.RawKind == token.RawKind) + : token ) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_SourceDeclarations.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_SourceDeclarations.cs index 097ca304231..040e1e2a0be 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_SourceDeclarations.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/Declarations/DeclarationFinder_SourceDeclarations.cs @@ -374,8 +374,8 @@ Func>> searchAsync containerPart ); - return symbolAndProjectIds.WhereAsArray( - t => containerPatternMatcher.Matches(GetContainer(t)) + return symbolAndProjectIds.WhereAsArray(t => + containerPatternMatcher.Matches(GetContainer(t)) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs index a64847becd5..9618b91b2b4 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs @@ -624,8 +624,8 @@ IEnumerable projectsThatCouldReferenceType // and we're passed in 'B, C, E' as the project to search, then this set // will be A, B, C, E. var allProjectsThatTheseProjectsDependOn = projects - .SelectMany( - p => dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(p.Id) + .SelectMany(p => + dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(p.Id) ) .Concat(projects.Select(p => p.Id)) .ToSet(); diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder_ProjectIndex.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder_ProjectIndex.cs index 2891c4b116a..37fd9d2f402 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder_ProjectIndex.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder_ProjectIndex.cs @@ -85,8 +85,8 @@ CancellationToken cancellationToken var allStates = regularDocumentStates .States.Select(kvp => (kvp.Key, kvp.Value)) .Concat( - sourceGeneratorDocumentStates.States.Select( - kvp => (kvp.Key, (DocumentState)kvp.Value) + sourceGeneratorDocumentStates.States.Select(kvp => + (kvp.Key, (DocumentState)kvp.Value) ) ); diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs index 0b2580847a1..237f4ef9a1e 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs @@ -159,10 +159,9 @@ CancellationToken cancellationToken var directivesChecksum = s_ppDirectivesToChecksum.GetValue( project.ParseOptions!, - static parseOptions => - new StrongBox( - CodeAnalysis.Checksum.Create(parseOptions.PreprocessorSymbolNames) - ) + static parseOptions => new StrongBox( + CodeAnalysis.Checksum.Create(parseOptions.PreprocessorSymbolNames) + ) ); var textChecksum = CodeAnalysis.Checksum.Create( diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Helpers.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Helpers.cs index a9e00646769..5074edd8b11 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Helpers.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Helpers.cs @@ -209,12 +209,11 @@ CancellationToken cancellationToken // Must contain equivalents named types residing in different assemblies. Contract.ThrowIfFalse( - equivalentTypesWithDifferingAssemblies.All( - kvp => - !SymbolEquivalenceComparer.Instance.Equals( - kvp.Key.ContainingAssembly, - kvp.Value.ContainingAssembly - ) + equivalentTypesWithDifferingAssemblies.All(kvp => + !SymbolEquivalenceComparer.Instance.Equals( + kvp.Key.ContainingAssembly, + kvp.Value.ContainingAssembly + ) ) ); diff --git a/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs b/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs index b4e6e893cf6..8bdd1ea8fe4 100644 --- a/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs +++ b/roslyn/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs @@ -189,15 +189,14 @@ CancellationToken cancellationToken var asyncLazy = s_peReferenceToInfo.GetValue( reference, id => - AsyncLazy.Create( - c => - CreateMetadataSymbolTreeInfoAsync( - services, - solutionKey, - reference, - checksum, - c - ) + AsyncLazy.Create(c => + CreateMetadataSymbolTreeInfoAsync( + services, + solutionKey, + reference, + checksum, + c + ) ) ); @@ -219,22 +218,20 @@ CancellationToken cancellationToken var asyncLazy = s_metadataIdToSymbolTreeInfo.GetValue( metadataId, metadataId => - AsyncLazy.Create( - cancellationToken => - LoadOrCreateAsync( - services, - solutionKey, - checksum, - createAsync: checksum => - new ValueTask( - new MetadataInfoCreator( - checksum, - GetMetadataNoThrow(reference) - ).Create() - ), - keySuffix: GetMetadataKeySuffix(reference), - cancellationToken - ) + AsyncLazy.Create(cancellationToken => + LoadOrCreateAsync( + services, + solutionKey, + checksum, + createAsync: checksum => new ValueTask( + new MetadataInfoCreator( + checksum, + GetMetadataNoThrow(reference) + ).Create() + ), + keySuffix: GetMetadataKeySuffix(reference), + cancellationToken + ) ) ); diff --git a/roslyn/src/Workspaces/Core/Portable/LinkedFileDiffMerging/AbstractLinkedFileMergeConflictCommentAdditionService.cs b/roslyn/src/Workspaces/Core/Portable/LinkedFileDiffMerging/AbstractLinkedFileMergeConflictCommentAdditionService.cs index e3e1bcc6cd1..386323dd495 100644 --- a/roslyn/src/Workspaces/Core/Portable/LinkedFileDiffMerging/AbstractLinkedFileMergeConflictCommentAdditionService.cs +++ b/roslyn/src/Workspaces/Core/Portable/LinkedFileDiffMerging/AbstractLinkedFileMergeConflictCommentAdditionService.cs @@ -108,16 +108,13 @@ SourceText oldDocumentText var oldText = oldDocumentText.GetSubText( TextSpan.FromBounds(startLineStartPosition, endLineEndPosition) ); - var adjustedChanges = changePartition.Select( - c => - new TextChange( - TextSpan.FromBounds( - c.Span.Start - startLineStartPosition, - c.Span.End - startLineStartPosition - ), - c.NewText - ) - ); + var adjustedChanges = changePartition.Select(c => new TextChange( + TextSpan.FromBounds( + c.Span.Start - startLineStartPosition, + c.Span.End - startLineStartPosition + ), + c.NewText + )); var newText = oldText.WithChanges(adjustedChanges); var warningText = GetConflictCommentText( diff --git a/roslyn/src/Workspaces/Core/Portable/Options/SolutionOptionSet.cs b/roslyn/src/Workspaces/Core/Portable/Options/SolutionOptionSet.cs index 12a28a4306c..8434f2c7064 100644 --- a/roslyn/src/Workspaces/Core/Portable/Options/SolutionOptionSet.cs +++ b/roslyn/src/Workspaces/Core/Portable/Options/SolutionOptionSet.cs @@ -94,12 +94,11 @@ internal override OptionSet WithChangedOptionInternal( { var internallyDefined = _changedOptionKeys .Where(key => key.Option is IOption2) - .SelectAsArray( - key => - KeyValuePairUtil.Create( - new OptionKey2((IOption2)key.Option, key.Language), - _values[key] - ) + .SelectAsArray(key => + KeyValuePairUtil.Create( + new OptionKey2((IOption2)key.Option, key.Language), + _values[key] + ) ); var externallyDefined = _changedOptionKeys .Where(key => key.Option is not IOption2) diff --git a/roslyn/src/Workspaces/Core/Portable/PatternMatching/ContainerPatternMatcher.cs b/roslyn/src/Workspaces/Core/Portable/PatternMatching/ContainerPatternMatcher.cs index e887ad1833b..802b569f987 100644 --- a/roslyn/src/Workspaces/Core/Portable/PatternMatching/ContainerPatternMatcher.cs +++ b/roslyn/src/Workspaces/Core/Portable/PatternMatching/ContainerPatternMatcher.cs @@ -28,10 +28,10 @@ public ContainerPatternMatcher( _containerSplitCharacters = containerSplitCharacters; _patternSegments = patternParts - .Select( - text => - new PatternSegment(text.Trim(), allowFuzzyMatching: allowFuzzyMatching) - ) + .Select(text => new PatternSegment( + text.Trim(), + allowFuzzyMatching: allowFuzzyMatching + )) .ToArray(); _invalidPattern = diff --git a/roslyn/src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs b/roslyn/src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs index 56f8dd315b6..534d4695e16 100644 --- a/roslyn/src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs +++ b/roslyn/src/Workspaces/Core/Portable/Recommendations/AbstractRecommendationServiceRunner.cs @@ -192,16 +192,15 @@ out var explicitLambdaParameterType if (!parameterTypeSymbols.Contains(parameter.Type, SymbolEqualityComparer.Default)) parameterTypeSymbols = parameterTypeSymbols.Concat(parameter.Type); - return parameterTypeSymbols.SelectManyAsArray( - parameterTypeSymbol => - GetMemberSymbols( - parameterTypeSymbol, - position, - excludeInstance: false, - useBaseReferenceAccessibility: false, - unwrapNullable, - isForDereference - ) + return parameterTypeSymbols.SelectManyAsArray(parameterTypeSymbol => + GetMemberSymbols( + parameterTypeSymbol, + position, + excludeInstance: false, + useBaseReferenceAccessibility: false, + unwrapNullable, + isForDereference + ) ); } @@ -343,8 +342,8 @@ out ITypeSymbol parameterType if (!string.IsNullOrEmpty(argumentName)) { parameterType = method - .Parameters.FirstOrDefault( - p => _stringComparerForLanguage.Equals(p.Name, argumentName) + .Parameters.FirstOrDefault(p => + _stringComparerForLanguage.Equals(p.Name, argumentName) ) ?.Type; return parameterType != null; @@ -389,9 +388,8 @@ protected ImmutableArray GetSymbolsForNamespaceDeclarationNameContext - IsNonIntersectingNamespace(recommendationSymbol, declarationSyntax) + .WhereAsArray(recommendationSymbol => + IsNonIntersectingNamespace(recommendationSymbol, declarationSyntax) ); return symbols; @@ -442,8 +440,8 @@ void AddSpecialTypeSymbolAndItsAliases(string name, SpecialType specialType) { var specialTypeSymbol = _context .SemanticModel.LookupNamespacesAndTypes(_context.Position, container, name) - .FirstOrDefault( - s => s is INamedTypeSymbol namedType && namedType.SpecialType == specialType + .FirstOrDefault(s => + s is INamedTypeSymbol namedType && namedType.SpecialType == specialType ); builder.AddIfNotNull(specialTypeSymbol); diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs b/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs index 5223c6b5762..df919645ea8 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/ConflictResolver.Session.cs @@ -195,14 +195,13 @@ await AnnotateAndRename_WorkerAsync( ); conflictLocations = conflictResolution - .RelatedLocations.Where( - loc => - documentIdsThatGetsAnnotatedAndRenamed.Contains( - loc.DocumentId - ) - && loc.Type - == RelatedLocationType.PossiblyResolvableConflict - && loc.IsReference + .RelatedLocations.Where(loc => + documentIdsThatGetsAnnotatedAndRenamed.Contains( + loc.DocumentId + ) + && loc.Type + == RelatedLocationType.PossiblyResolvableConflict + && loc.IsReference ) .Select(loc => new ConflictLocationInfo(loc)) .ToImmutableHashSet(); @@ -219,13 +218,12 @@ await AnnotateAndRename_WorkerAsync( conflictLocations = conflictLocations .Concat( conflictResolution - .RelatedLocations.Where( - loc => - documentIdsThatGetsAnnotatedAndRenamed.Contains( - loc.DocumentId - ) - && loc.Type - == RelatedLocationType.PossiblyResolvableConflict + .RelatedLocations.Where(loc => + documentIdsThatGetsAnnotatedAndRenamed.Contains( + loc.DocumentId + ) + && loc.Type + == RelatedLocationType.PossiblyResolvableConflict ) .Select(loc => new ConflictLocationInfo(loc)) ) @@ -242,22 +240,20 @@ await AnnotateAndRename_WorkerAsync( { // After phase 2, if there are still conflicts then remove the conflict locations from being expanded var unresolvedLocations = conflictResolution - .RelatedLocations.Where( - l => (l.Type & RelatedLocationType.UnresolvedConflict) != 0 + .RelatedLocations.Where(l => + (l.Type & RelatedLocationType.UnresolvedConflict) != 0 ) - .Select( - l => Tuple.Create(l.ComplexifiedTargetSpan, l.DocumentId) + .Select(l => + Tuple.Create(l.ComplexifiedTargetSpan, l.DocumentId) ) .Distinct(); conflictLocations = conflictLocations - .Where( - l => - !unresolvedLocations.Any( - c => - c.Item2 == l.DocumentId - && c.Item1.Contains(l.OriginalIdentifierSpan) - ) + .Where(l => + !unresolvedLocations.Any(c => + c.Item2 == l.DocumentId + && c.Item1.Contains(l.OriginalIdentifierSpan) + ) ) .ToImmutableHashSet(); } @@ -344,11 +340,8 @@ await DebugVerifyNoErrorsAsync( { var definitionLocations = _renameLocationSet.Symbol.Locations; var definitionDocuments = definitionLocations - .Select( - l => - conflictResolution.OldSolution.GetRequiredDocument( - l.SourceTree! - ) + .Select(l => + conflictResolution.OldSolution.GetRequiredDocument(l.SourceTree!) ) .Distinct(); @@ -402,8 +395,8 @@ await originalDoc // only check if rename thinks it was successful if ( conflictResolution.ReplacementTextValid - && conflictResolution.RelatedLocations.All( - loc => (loc.Type & RelatedLocationType.UnresolvableConflict) == 0 + && conflictResolution.RelatedLocations.All(loc => + (loc.Type & RelatedLocationType.UnresolvableConflict) == 0 ) ) { @@ -708,8 +701,8 @@ await AddDeclarationConflictsAsync( .ConfigureAwait(false); } - return conflictResolution.RelatedLocations.Any( - r => r.Type == RelatedLocationType.PossiblyResolvableConflict + return conflictResolution.RelatedLocations.Any(r => + r.Type == RelatedLocationType.PossiblyResolvableConflict ); } catch (Exception e) @@ -766,14 +759,8 @@ RenameActionAnnotation annotation return syntaxRoot .DescendantNodesAndTokens(descendIntoTrivia: true) .Where(_renameAnnotations.HasAnnotations) - .Select( - s => - ( - s, - _renameAnnotations - .GetAnnotations(s) - .Single() - ) + .Select(s => + (s, _renameAnnotations.GetAnnotations(s).Single()) ); } @@ -806,14 +793,9 @@ ImmutableArray newReferencedSymbols hasConflict = true; - var newLocationTasks = newReferencedSymbols.Select( - async symbol => - await GetSymbolLocationAsync( - solution, - symbol, - _cancellationToken - ) - .ConfigureAwait(false) + var newLocationTasks = newReferencedSymbols.Select(async symbol => + await GetSymbolLocationAsync(solution, symbol, _cancellationToken) + .ConfigureAwait(false) ); var newLocations = ( await Task.WhenAll(newLocationTasks).ConfigureAwait(false) @@ -832,8 +814,8 @@ var originalReference in conflictAnnotation.RenameDeclarationLocationReferences. originalReference.DocumentId ); if ( - newLocations.Any( - loc => loc.SourceSpan.Start == adjustedStartPosition + newLocations.Any(loc => + loc.SourceSpan.Start == adjustedStartPosition ) ) { @@ -952,8 +934,8 @@ var originalReference in conflictAnnotation.RenameDeclarationLocationReferences. overridingSymbol.GetOverriddenMember(); if ( overriddenSymbol == null - || !overriddenSymbol.Locations.All( - loc => loc.IsInMetadata + || !overriddenSymbol.Locations.All(loc => + loc.IsInMetadata ) ) { @@ -1034,8 +1016,8 @@ SyntaxNodeOrToken tokenOrNode // When using (not declaring) an alias, the alias symbol and the target symbol are returned // by GetSymbolsTouchingPosition if (newReferencedSymbols.Length >= 2) - newReferencedSymbols = newReferencedSymbols.WhereAsArray( - a => a.Kind != SymbolKind.Alias + newReferencedSymbols = newReferencedSymbols.WhereAsArray(a => + a.Kind != SymbolKind.Alias ); return newReferencedSymbols; @@ -1212,10 +1194,9 @@ ImmutableArray possibleNameConflicts // Get all rename locations for the current document. var allTextSpansInSingleSourceTree = renameLocations - .Where( - l => - l.DocumentId == documentId - && ShouldIncludeLocation(renameLocations, l) + .Where(l => + l.DocumentId == documentId + && ShouldIncludeLocation(renameLocations, l) ) .ToImmutableDictionary(l => l.Location.SourceSpan); diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/MutableConflictResolution.cs b/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/MutableConflictResolution.cs index 70199a55393..1e0b28d46c3 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/MutableConflictResolution.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/ConflictEngine/MutableConflictResolution.cs @@ -150,10 +150,9 @@ internal void AddRelatedLocation(RelatedLocation location) => internal void AddOrReplaceRelatedLocation(RelatedLocation location) { var existingRelatedLocation = RelatedLocations - .Where( - rl => - rl.ConflictCheckSpan == location.ConflictCheckSpan - && rl.DocumentId == location.DocumentId + .Where(rl => + rl.ConflictCheckSpan == location.ConflictCheckSpan + && rl.DocumentId == location.DocumentId ) .FirstOrNull(); if (existingRelatedLocation != null) diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs b/roslyn/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs index c7b844a71f7..5c653901f6c 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/LightweightRenameLocations.cs @@ -175,12 +175,11 @@ out var serializedSymbol options, fallbackOptions, renameLocations.Locations, - renameLocations.ImplicitLocations.SelectAsArray( - loc => SerializableReferenceLocation.Dehydrate(loc, cancellationToken) + renameLocations.ImplicitLocations.SelectAsArray(loc => + SerializableReferenceLocation.Dehydrate(loc, cancellationToken) ), - renameLocations.ReferencedSymbols.SelectAsArray( - sym => - SerializableSymbolAndProjectId.Dehydrate(solution, sym, cancellationToken) + renameLocations.ReferencedSymbols.SelectAsArray(sym => + SerializableSymbolAndProjectId.Dehydrate(solution, sym, cancellationToken) ) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/RenameUtilities.cs b/roslyn/src/Workspaces/Core/Portable/Rename/RenameUtilities.cs index 62de6521f9c..95245a0bc6c 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/RenameUtilities.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/RenameUtilities.cs @@ -125,8 +125,8 @@ IEnumerable renameLocations .Except(projectIdsOfRenameSymbolDeclaration) .IsEmpty(); Contract.ThrowIfFalse(isSubset); - return projectIdsOfRenameSymbolDeclaration.SelectMany( - p => solution.GetRequiredProject(p).Documents + return projectIdsOfRenameSymbolDeclaration.SelectMany(p => + solution.GetRequiredProject(p).Documents ); } else @@ -135,16 +135,14 @@ IEnumerable renameLocations // the rename symbol. Other projects should not be affected by the rename. var relevantProjects = projectIdsOfRenameSymbolDeclaration .Concat( - projectIdsOfRenameSymbolDeclaration.SelectMany( - p => - solution - .GetProjectDependencyGraph() - .GetProjectsThatDirectlyDependOnThisProject(p) + projectIdsOfRenameSymbolDeclaration.SelectMany(p => + solution + .GetProjectDependencyGraph() + .GetProjectsThatDirectlyDependOnThisProject(p) ) ) .Distinct(); - return relevantProjects.SelectMany( - p => solution.GetRequiredProject(p).Documents + return relevantProjects.SelectMany(p => solution.GetRequiredProject(p).Documents ); } } diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/Renamer.RenameDocumentActionSet.cs b/roslyn/src/Workspaces/Core/Portable/Rename/Renamer.RenameDocumentActionSet.cs index 82b37ebf7c2..e4d24001ead 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/Renamer.RenameDocumentActionSet.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/Renamer.RenameDocumentActionSet.cs @@ -153,8 +153,8 @@ private Document GetDocument(Solution solution) // https://github.com/dotnet/roslyn/issues/43729 tracks designing a more elagent system that can help alleviate // this issue. var project = solution.GetRequiredProject(_documentId.ProjectId); - return project.Documents.FirstOrDefault( - d => d.Name == _documentName && d.Folders.SequenceEqual(_documentFolders) + return project.Documents.FirstOrDefault(d => + d.Name == _documentName && d.Folders.SequenceEqual(_documentFolders) ) ?? throw new InvalidOperationException( WorkspaceExtensionsResources.The_solution_does_not_contain_the_specified_document diff --git a/roslyn/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.ReferenceProcessing.cs b/roslyn/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.ReferenceProcessing.cs index dd87feba45b..65344a978af 100644 --- a/roslyn/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.ReferenceProcessing.cs +++ b/roslyn/src/Workspaces/Core/Portable/Rename/SymbolicRenameLocations.ReferenceProcessing.cs @@ -529,10 +529,9 @@ CancellationToken cancellationToken var renameTextLength = renameText.Length; var renameStringsAndPositions = root.DescendantTokens() - .Where( - t => - syntaxFactsService.IsStringLiteralOrInterpolatedStringLiteral(t) - && t.Span.Length >= renameTextLength + .Where(t => + syntaxFactsService.IsStringLiteralOrInterpolatedStringLiteral(t) + && t.Span.Length >= renameTextLength ) .Select(t => Tuple.Create(t.ToString(), t.Span.Start, t.Span)); diff --git a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/ILanguageMetadataExtensions.cs b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/ILanguageMetadataExtensions.cs index b3d9a6edbb6..9eeda3eef44 100644 --- a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/ILanguageMetadataExtensions.cs +++ b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/ILanguageMetadataExtensions.cs @@ -59,13 +59,10 @@ this IEnumerable> services } return builder - .Select( - kvp => - new KeyValuePair>>( - kvp.Key, - kvp.Value.ToImmutableAndFree() - ) - ) + .Select(kvp => new KeyValuePair< + string, + ImmutableArray> + >(kvp.Key, kvp.Value.ToImmutableAndFree())) .ToImmutableDictionary(); } diff --git a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs index 648aadf7cbb..a0fb4a12e13 100644 --- a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs +++ b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs @@ -91,18 +91,17 @@ ImmutableArray newNames method.ExplicitInterfaceImplementations, method.Name, updatedTypeParameters, - method.Parameters.SelectAsArray( - p => - CodeGenerationSymbolFactory.CreateParameterSymbol( - p.GetAttributes(), - p.RefKind, - p.IsParams, - p.Type.SubstituteTypes(mapping, typeGenerator), - p.Name, - p.IsOptional, - p.HasExplicitDefaultValue, - p.HasExplicitDefaultValue ? p.ExplicitDefaultValue : null - ) + method.Parameters.SelectAsArray(p => + CodeGenerationSymbolFactory.CreateParameterSymbol( + p.GetAttributes(), + p.RefKind, + p.IsParams, + p.Type.SubstituteTypes(mapping, typeGenerator), + p.Name, + p.IsOptional, + p.HasExplicitDefaultValue, + p.HasExplicitDefaultValue ? p.ExplicitDefaultValue : null + ) ) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxGeneratorExtensions_CreateEqualsMethod.cs b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxGeneratorExtensions_CreateEqualsMethod.cs index 4ab22e25a4a..cbb33ff2ce1 100644 --- a/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxGeneratorExtensions_CreateEqualsMethod.cs +++ b/roslyn/src/Workspaces/Core/Portable/Shared/Extensions/SyntaxGeneratorExtensions_CreateEqualsMethod.cs @@ -41,8 +41,8 @@ SyntaxAnnotation statementAnnotation symbols, localNameOpt ); - statements = statements.SelectAsArray( - s => s.WithAdditionalAnnotations(statementAnnotation) + statements = statements.SelectAsArray(s => + s.WithAdditionalAnnotations(statementAnnotation) ); return CreateEqualsMethod(compilation, statements); @@ -92,8 +92,8 @@ SyntaxAnnotation statementAnnotation containingType, symbols ); - statements = statements.SelectAsArray( - s => s.WithAdditionalAnnotations(statementAnnotation) + statements = statements.SelectAsArray(s => + s.WithAdditionalAnnotations(statementAnnotation) ); var methodSymbol = constructedEquatableType diff --git a/roslyn/src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider.cs b/roslyn/src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider.cs index 77eea7b2929..aa994a563ad 100644 --- a/roslyn/src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider.cs +++ b/roslyn/src/Workspaces/Core/Portable/Shared/TestHooks/AsynchronousOperationListenerProvider.cs @@ -82,8 +82,10 @@ public AsynchronousOperationListenerProvider() concurrencyLevel: 2, capacity: 20 ); - _createCallback = name => - new AsynchronousOperationListener(name, DiagnosticTokensEnabled); + _createCallback = name => new AsynchronousOperationListener( + name, + DiagnosticTokensEnabled + ); } public IAsynchronousOperationListener GetListener(string featureName) diff --git a/roslyn/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs b/roslyn/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs index 33f1a537d21..2f4c091a864 100644 --- a/roslyn/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs +++ b/roslyn/src/Workspaces/Core/Portable/Shared/Utilities/DocumentationComment.cs @@ -308,8 +308,9 @@ private void ParseCallback(XmlReader reader) ) { ( - _typeParameterNamesBuilder ??= - ImmutableArray.CreateBuilder() + _typeParameterNamesBuilder ??= ImmutableArray.CreateBuilder( + + ) ).Add(name); _comment._typeParameterTexts.Add(name, TrimEachLine(typeParamText)); } @@ -327,8 +328,9 @@ private void ParseCallback(XmlReader reader) ) { ( - _exceptionTypesBuilder ??= - ImmutableArray.CreateBuilder() + _exceptionTypesBuilder ??= ImmutableArray.CreateBuilder( + + ) ).Add(type); ( _exceptionTextBuilders ??= diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/CommandLineProject.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/CommandLineProject.cs index 6b21434325a..30dcc2675b6 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/CommandLineProject.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/CommandLineProject.cs @@ -39,8 +39,9 @@ public static ProjectInfo CreateProjectInfo( throw new ArgumentException(WorkspacesResources.Unrecognized_language_name); } - var commandLineParser = - languageServices.GetRequiredService(); + var commandLineParser = languageServices.GetRequiredService( + + ); var commandLineArguments = commandLineParser.Parse( commandLineArgs, projectDirectory, @@ -89,8 +90,8 @@ public static ProjectInfo CreateProjectInfo( .ResolveMetadataReferences(commandLineMetadataReferenceResolver) .Distinct() .ToList(); - var unresolvedMetadataReferences = boundMetadataReferences.FirstOrDefault( - r => r is UnresolvedMetadataReference + var unresolvedMetadataReferences = boundMetadataReferences.FirstOrDefault(r => + r is UnresolvedMetadataReference ); if (unresolvedMetadataReferences != null) { @@ -114,8 +115,8 @@ public static ProjectInfo CreateProjectInfo( .ResolveAnalyzerReferences(analyzerLoader) .Distinct() .ToList(); - var unresolvedAnalyzerReferences = boundAnalyzerReferences.FirstOrDefault( - r => r is UnresolvedAnalyzerReference + var unresolvedAnalyzerReferences = boundAnalyzerReferences.FirstOrDefault(r => + r is UnresolvedAnalyzerReference ); if (unresolvedAnalyzerReferences != null) { diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs index ce449cd90dc..4b59a88da29 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Host/PersistentStorage/NoOpPersistentStorage.cs @@ -13,8 +13,9 @@ namespace Microsoft.CodeAnalysis.Host { internal class NoOpPersistentStorage : IChecksummedPersistentStorage { - private static readonly IChecksummedPersistentStorage Instance = - new NoOpPersistentStorage(); + private static readonly IChecksummedPersistentStorage Instance = new NoOpPersistentStorage( + + ); private NoOpPersistentStorage() { } diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.BatchingDocumentCollection.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.BatchingDocumentCollection.cs index d4c8d796334..788b79f7218 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.BatchingDocumentCollection.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSystemProject.BatchingDocumentCollection.cs @@ -154,8 +154,8 @@ ImmutableArray folders } else { - _project._projectSystemProjectFactory.ApplyChangeToWorkspace( - w => _documentAddAction(w, documentInfo) + _project._projectSystemProjectFactory.ApplyChangeToWorkspace(w => + _documentAddAction(w, documentInfo) ); _project ._projectSystemProjectFactory.RaiseOnDocumentsAddedMaybeAsync( @@ -287,8 +287,8 @@ ImmutableArray folders else { // right now, assumption is dynamically generated file can never be opened in editor - _project._projectSystemProjectFactory.ApplyChangeToWorkspace( - w => _documentAddAction(w, documentInfo) + _project._projectSystemProjectFactory.ApplyChangeToWorkspace(w => + _documentAddAction(w, documentInfo) ); } } @@ -374,8 +374,8 @@ private void RemoveFileInternal(DocumentId documentId, string fullPath) } else { - _project._projectSystemProjectFactory.ApplyChangeToWorkspace( - w => _documentRemoveAction(w, documentId) + _project._projectSystemProjectFactory.ApplyChangeToWorkspace(w => + _documentRemoveAction(w, documentId) ); } } @@ -541,28 +541,30 @@ ImmutableSegmentedList filePaths } await _project - ._projectSystemProjectFactory.ApplyBatchChangeToWorkspaceAsync(solutionChanges => - { - foreach (var (documentId, textLoader) in documentsToChange) + ._projectSystemProjectFactory.ApplyBatchChangeToWorkspaceAsync( + solutionChanges => { - if ( - !_project._projectSystemProjectFactory.Workspace.IsDocumentOpen( - documentId - ) - ) + foreach (var (documentId, textLoader) in documentsToChange) { - solutionChanges.UpdateSolutionForDocumentAction( - _documentTextLoaderChangedAction( - solutionChanges.Solution, - documentId, - textLoader - ), - _documentChangedWorkspaceKind, - SpecializedCollections.SingletonEnumerable(documentId) - ); + if ( + !_project._projectSystemProjectFactory.Workspace.IsDocumentOpen( + documentId + ) + ) + { + solutionChanges.UpdateSolutionForDocumentAction( + _documentTextLoaderChangedAction( + solutionChanges.Solution, + documentId, + textLoader + ), + _documentChangedWorkspaceKind, + SpecializedCollections.SingletonEnumerable(documentId) + ); + } } } - }) + ) .ConfigureAwait(false); documentsToChange.Free(); diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs index e31fe5506ac..0d825131833 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/DocumentState.cs @@ -689,8 +689,9 @@ internal DocumentState UpdateTree(SyntaxNode newRoot, PreservationMode mode) encoding = null; } - var syntaxTreeFactory = - LanguageServices.GetRequiredService(); + var syntaxTreeFactory = LanguageServices.GetRequiredService( + + ); Contract.ThrowIfNull(_options); var (text, treeAndVersion) = CreateTreeWithLazyText( diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/FileTextLoader.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/FileTextLoader.cs index 60b0786d85c..3d0c3b9ddff 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/FileTextLoader.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/FileTextLoader.cs @@ -72,11 +72,10 @@ public FileTextLoader(string path, Encoding? defaultEncoding) s_isObsoleteCreateTextOverriden .GetValue( GetType(), - _ => - new StrongBox( - new Func(CreateText).Method.DeclaringType - != typeof(FileTextLoader) - ) + _ => new StrongBox( + new Func(CreateText).Method.DeclaringType + != typeof(FileTextLoader) + ) ) .Value; #pragma warning restore diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph.cs index 62cd32955f4..1ce5c20df82 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectDependencyGraph.cs @@ -261,13 +261,10 @@ private ImmutableDictionary< } return reverseReferencesMap - .Select( - kvp => - new KeyValuePair>( - kvp.Key, - kvp.Value.ToImmutableHashSet() - ) - ) + .Select(kvp => new KeyValuePair>( + kvp.Key, + kvp.Value.ToImmutableHashSet() + )) .ToImmutableDictionary(); } diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs index 430e1e55ac3..8f674deb974 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectInfo.cs @@ -266,7 +266,9 @@ public static ProjectInfo Create( metadataReferences, analyzerReferences, additionalDocuments, - analyzerConfigDocuments: SpecializedCollections.EmptyBoxedImmutableArray(), + analyzerConfigDocuments: SpecializedCollections.EmptyBoxedImmutableArray( + + ), hostObjectType ); } diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs index 953224d98ab..3c473c524b4 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/ProjectState.cs @@ -107,12 +107,11 @@ public ProjectState(LanguageServices languageServices, ProjectInfo projectInfo) // We need to compute our AnalyerConfigDocumentStates first, since we use those to produce our DocumentStates AnalyzerConfigDocumentStates = new TextDocumentStates( projectInfoFixed.AnalyzerConfigDocuments, - info => - new AnalyzerConfigDocumentState( - languageServices.SolutionServices, - info, - loadTextOptions - ) + info => new AnalyzerConfigDocumentState( + languageServices.SolutionServices, + info, + loadTextOptions + ) ); _lazyAnalyzerConfigOptions = ComputeAnalyzerConfigOptionsValueSource( @@ -137,24 +136,22 @@ public ProjectState(LanguageServices languageServices, ProjectInfo projectInfo) ); AdditionalDocumentStates = new TextDocumentStates( projectInfoFixed.AdditionalDocuments, - info => - new AdditionalDocumentState( - languageServices.SolutionServices, - info, - loadTextOptions - ) + info => new AdditionalDocumentState( + languageServices.SolutionServices, + info, + loadTextOptions + ) ); - _lazyLatestDocumentVersion = AsyncLazy.Create( - c => ComputeLatestDocumentVersionAsync(DocumentStates, AdditionalDocumentStates, c) + _lazyLatestDocumentVersion = AsyncLazy.Create(c => + ComputeLatestDocumentVersionAsync(DocumentStates, AdditionalDocumentStates, c) ); - _lazyLatestDocumentTopLevelChangeVersion = AsyncLazy.Create( - c => - ComputeLatestDocumentTopLevelChangeVersionAsync( - DocumentStates, - AdditionalDocumentStates, - c - ) + _lazyLatestDocumentTopLevelChangeVersion = AsyncLazy.Create(c => + ComputeLatestDocumentTopLevelChangeVersionAsync( + DocumentStates, + AdditionalDocumentStates, + c + ) ); // ownership of information on document has moved to project state. clear out documentInfo the state is @@ -243,19 +240,18 @@ TextDocumentStates newAdditionalDocumentStates { if (_lazyLatestDocumentTopLevelChangeVersion.TryGetValue(out var oldVersion)) { - return AsyncLazy.Create( - c => ComputeTopLevelChangeTextVersionAsync(oldVersion, newDocument, c) + return AsyncLazy.Create(c => + ComputeTopLevelChangeTextVersionAsync(oldVersion, newDocument, c) ); } else { - return AsyncLazy.Create( - c => - ComputeLatestDocumentTopLevelChangeVersionAsync( - newDocumentStates, - newAdditionalDocumentStates, - c - ) + return AsyncLazy.Create(c => + ComputeLatestDocumentTopLevelChangeVersionAsync( + newDocumentStates, + newAdditionalDocumentStates, + c + ) ); } } @@ -326,8 +322,8 @@ LoadTextOptions loadTextOptions public AnalyzerOptions AnalyzerOptions => _lazyAnalyzerOptions ??= new AnalyzerOptions( - additionalFiles: AdditionalDocumentStates.SelectAsArray( - static documentState => documentState.AdditionalText + additionalFiles: AdditionalDocumentStates.SelectAsArray(static documentState => + documentState.AdditionalText ), optionsProvider: new ProjectAnalyzerConfigOptionsProvider(this) ); @@ -604,8 +600,8 @@ TextDocumentStates analyzerConfigDocumentStates return new AsyncLazy( asynchronousComputeFunction: async cancellationToken => { - var tasks = analyzerConfigDocumentStates.States.Values.Select( - a => a.GetAnalyzerConfigAsync(cancellationToken) + var tasks = analyzerConfigDocumentStates.States.Values.Select(a => + a.GetAnalyzerConfigAsync(cancellationToken) ); var analyzerConfigs = await Task.WhenAll(tasks).ConfigureAwait(false); @@ -617,8 +613,8 @@ TextDocumentStates analyzerConfigDocumentStates }, synchronousComputeFunction: cancellationToken => { - var analyzerConfigs = analyzerConfigDocumentStates.SelectAsArray( - a => a.GetAnalyzerConfig(cancellationToken) + var analyzerConfigs = analyzerConfigDocumentStates.SelectAsArray(a => + a.GetAnalyzerConfig(cancellationToken) ); return new AnalyzerConfigOptionsCache( AnalyzerConfigSet.Create(analyzerConfigs) @@ -631,8 +627,8 @@ private readonly struct AnalyzerConfigOptionsCache(AnalyzerConfigSet configSet) { private readonly ConcurrentDictionary _sourcePathToResult = new(); - private readonly Func _computeFunction = path => - new AnalyzerConfigData(configSet.GetOptionsForSourcePath(path)); + private readonly Func _computeFunction = + path => new AnalyzerConfigData(configSet.GetOptionsForSourcePath(path)); private readonly Lazy _global = new Lazy( () => new AnalyzerConfigData(configSet.GlobalConfigOptions) ); @@ -1243,26 +1239,24 @@ out var semanticVersion } dependentDocumentVersion = recalculateDocumentVersion - ? AsyncLazy.Create( - c => - ComputeLatestDocumentVersionAsync( - newDocumentStates, - newAdditionalDocumentStates, - c - ) + ? AsyncLazy.Create(c => + ComputeLatestDocumentVersionAsync( + newDocumentStates, + newAdditionalDocumentStates, + c + ) ) : contentChanged ? AsyncLazy.Create(newDocument.GetTextVersionAsync) : _lazyLatestDocumentVersion; dependentSemanticVersion = recalculateSemanticVersion - ? AsyncLazy.Create( - c => - ComputeLatestDocumentTopLevelChangeVersionAsync( - newDocumentStates, - newAdditionalDocumentStates, - c - ) + ? AsyncLazy.Create(c => + ComputeLatestDocumentTopLevelChangeVersionAsync( + newDocumentStates, + newAdditionalDocumentStates, + c + ) ) : contentChanged ? CreateLazyLatestDocumentTopLevelChangeVersion( diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs index db4e78925c5..7fc71bb5860 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs @@ -2343,8 +2343,8 @@ bool ignoreExistingReferences var isSubmission = projectState.IsSubmission; var hasSubmissionReference = !ignoreExistingReferences - && projectState.ProjectReferences.Any( - p => _state.GetRequiredProjectState(p.ProjectId).IsSubmission + && projectState.ProjectReferences.Any(p => + _state.GetRequiredProjectState(p.ProjectId).IsSubmission ); foreach (var projectReference in projectReferences) diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationAndGeneratorDriverTranslationAction_Actions.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationAndGeneratorDriverTranslationAction_Actions.cs index 81f7edb2f50..a464ac4a845 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationAndGeneratorDriverTranslationAction_Actions.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationAndGeneratorDriverTranslationAction_Actions.cs @@ -312,8 +312,8 @@ GeneratorDriver generatorDriver ) { return generatorDriver.AddAdditionalTexts( - additionalDocuments.SelectAsArray( - static documentState => documentState.AdditionalText + additionalDocuments.SelectAsArray(static documentState => + documentState.AdditionalText ) ); } @@ -334,8 +334,8 @@ GeneratorDriver generatorDriver ) { return generatorDriver.RemoveAdditionalTexts( - additionalDocuments.SelectAsArray( - static documentState => documentState.AdditionalText + additionalDocuments.SelectAsArray(static documentState => + documentState.AdditionalText ) ); } diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker_Generators.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker_Generators.cs index 2e395318802..029a4e5e8b3 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker_Generators.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker_Generators.cs @@ -207,8 +207,8 @@ CancellationToken cancellationToken infos.Length == generatorInfo.Documents.Count && documentsToAddOrUpdate.Count == 0 && compilationWithStaleGeneratedTrees != null - && generatorInfo.Documents.States.All( - kvp => kvp.Value.ParseOptions.Equals(this.ProjectState.ParseOptions) + && generatorInfo.Documents.States.All(kvp => + kvp.Value.ParseOptions.Equals(this.ProjectState.ParseOptions) ) ) { @@ -341,7 +341,9 @@ CancellationToken cancellationToken static documentState => documentState.AdditionalText ); var compilationFactory = - this.ProjectState.LanguageServices.GetRequiredService(); + this.ProjectState.LanguageServices.GetRequiredService( + + ); generatorInfo = generatorInfo.WithDriver( compilationFactory.CreateGeneratorDriver( @@ -429,8 +431,8 @@ await documentState // and the prior generated trees are identical. if (compilationWithStaleGeneratedTrees != null) { - var generatedTreeCount = runResult.Results.Sum( - r => IsGeneratorRunResultToIgnore(r) ? 0 : r.GeneratedSources.Length + var generatedTreeCount = runResult.Results.Sum(r => + IsGeneratorRunResultToIgnore(r) ? 0 : r.GeneratedSources.Length ); if (generatorInfo.Documents.Count != generatedTreeCount) diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.SkeletonReferenceCache.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.SkeletonReferenceCache.cs index b5379aa557c..bad9c51774d 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.SkeletonReferenceCache.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.SkeletonReferenceCache.cs @@ -211,11 +211,8 @@ CancellationToken cancellationToken var lazy = s_compilationToSkeletonSet.GetValue( compilation, compilation => - AsyncLazy.Create( - cancellationToken => - Task.FromResult( - CreateSkeletonSet(services, compilation, cancellationToken) - ) + AsyncLazy.Create(cancellationToken => + Task.FromResult(CreateSkeletonSet(services, compilation, cancellationToken)) ) ); diff --git a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState_Checksum.cs b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState_Checksum.cs index b5ddf2c0f79..bd36183b54b 100644 --- a/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState_Checksum.cs +++ b/roslyn/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState_Checksum.cs @@ -154,13 +154,12 @@ CancellationToken cancellationToken // requested set of projects if applicable. var orderedProjectIds = GetOrCreateSortedProjectIds(ProjectIds); var projectChecksumTasks = orderedProjectIds - .Select( - id => - ( - state: ProjectStates[id], - mustCompute: projectsToInclude == null - || projectsToInclude.Contains(id) - ) + .Select(id => + ( + state: ProjectStates[id], + mustCompute: projectsToInclude == null + || projectsToInclude.Contains(id) + ) ) .Where(t => RemoteSupportedLanguages.IsSupported(t.state.Language)) .Select(async t => diff --git a/roslyn/src/Workspaces/CoreTest/CodeCleanup/FixIncorrectTokenTests.cs b/roslyn/src/Workspaces/CoreTest/CodeCleanup/FixIncorrectTokenTests.cs index a364b70470b..6d3f7fea450 100644 --- a/roslyn/src/Workspaces/CoreTest/CodeCleanup/FixIncorrectTokenTests.cs +++ b/roslyn/src/Workspaces/CoreTest/CodeCleanup/FixIncorrectTokenTests.cs @@ -787,11 +787,10 @@ private static async Task VerifyAsync(string codeWithMarker, string expectedResu var document = CreateDocument(codeWithoutMarker, LanguageNames.VisualBasic); var codeCleanups = CodeCleaner .GetDefaultProviders(document) - .WhereAsArray( - p => - p.Name - is PredefinedCodeCleanupProviderNames.FixIncorrectTokens - or PredefinedCodeCleanupProviderNames.Format + .WhereAsArray(p => + p.Name + is PredefinedCodeCleanupProviderNames.FixIncorrectTokens + or PredefinedCodeCleanupProviderNames.Format ); var cleanDocument = await CodeCleaner.CleanupAsync( diff --git a/roslyn/src/Workspaces/CoreTest/CodeCleanup/NormalizeModifiersOrOperatorsTests.cs b/roslyn/src/Workspaces/CoreTest/CodeCleanup/NormalizeModifiersOrOperatorsTests.cs index 63601d566ad..650c9d23229 100644 --- a/roslyn/src/Workspaces/CoreTest/CodeCleanup/NormalizeModifiersOrOperatorsTests.cs +++ b/roslyn/src/Workspaces/CoreTest/CodeCleanup/NormalizeModifiersOrOperatorsTests.cs @@ -1109,11 +1109,10 @@ private static async Task VerifyAsync(string codeWithMarker, string expectedResu var document = CreateDocument(codeWithoutMarker, LanguageNames.VisualBasic); var codeCleanups = CodeCleaner .GetDefaultProviders(document) - .WhereAsArray( - p => - p.Name - is PredefinedCodeCleanupProviderNames.NormalizeModifiersOrOperators - or PredefinedCodeCleanupProviderNames.Format + .WhereAsArray(p => + p.Name + is PredefinedCodeCleanupProviderNames.NormalizeModifiersOrOperators + or PredefinedCodeCleanupProviderNames.Format ); var cleanDocument = await CodeCleaner.CleanupAsync( diff --git a/roslyn/src/Workspaces/CoreTest/CodeCleanup/RemoveUnnecessaryLineContinuationTests.cs b/roslyn/src/Workspaces/CoreTest/CodeCleanup/RemoveUnnecessaryLineContinuationTests.cs index ef3930f301f..9a8b1ab987c 100644 --- a/roslyn/src/Workspaces/CoreTest/CodeCleanup/RemoveUnnecessaryLineContinuationTests.cs +++ b/roslyn/src/Workspaces/CoreTest/CodeCleanup/RemoveUnnecessaryLineContinuationTests.cs @@ -1520,11 +1520,10 @@ private static async Task VerifyAsync( ); var codeCleanups = CodeCleaner .GetDefaultProviders(document) - .WhereAsArray( - p => - p.Name - is PredefinedCodeCleanupProviderNames.RemoveUnnecessaryLineContinuation - or PredefinedCodeCleanupProviderNames.Format + .WhereAsArray(p => + p.Name + is PredefinedCodeCleanupProviderNames.RemoveUnnecessaryLineContinuation + or PredefinedCodeCleanupProviderNames.Format ); var cleanDocument = await CodeCleaner.CleanupAsync( diff --git a/roslyn/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs b/roslyn/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs index 663f682e680..468ddb0f19f 100644 --- a/roslyn/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs +++ b/roslyn/src/Workspaces/CoreTest/Remote/ServiceDescriptorTests.cs @@ -54,16 +54,15 @@ public class ServiceDescriptorTests public static IEnumerable AllServiceDescriptors => ServiceDescriptors .Instance.GetTestAccessor() - .Descriptors.Select( - descriptor => - new object[] - { - descriptor.Key, - descriptor.Value.descriptor64, - descriptor.Value.descriptor64ServerGC, - descriptor.Value.descriptorCoreClr64, - descriptor.Value.descriptorCoreClr64ServerGC - } + .Descriptors.Select(descriptor => + new object[] + { + descriptor.Key, + descriptor.Value.descriptor64, + descriptor.Value.descriptor64ServerGC, + descriptor.Value.descriptorCoreClr64, + descriptor.Value.descriptorCoreClr64ServerGC + } ); private static Dictionary GetAllParameterTypesOfRemoteApis() @@ -412,14 +411,11 @@ public void TypesUsedInRemoteApisMustBeMessagePackSerializable() { // custom abstract types must be explicitly listed in MessagePackFormatters.AbstractTypeFormatters if ( - !MessagePackFormatters.Formatters.Any( - formatter => - formatter.GetType() - is { IsGenericType: true } - and var formatterType - && formatterType.GetGenericTypeDefinition() - == typeof(ForceTypelessFormatter<>) - && formatterType.GenericTypeArguments[0] == type + !MessagePackFormatters.Formatters.Any(formatter => + formatter.GetType() is { IsGenericType: true } and var formatterType + && formatterType.GetGenericTypeDefinition() + == typeof(ForceTypelessFormatter<>) + && formatterType.GenericTypeArguments[0] == type ) ) { @@ -483,8 +479,8 @@ public void CallbackDispatchers() .Descriptors.Where(d => d.Value.descriptor64.ClientInterface != null) .Select(d => d.Key); - var callbackDispatcherServiceTypes = callbackDispatchers.Select( - d => d.Metadata.ServiceInterface + var callbackDispatcherServiceTypes = callbackDispatchers.Select(d => + d.Metadata.ServiceInterface ); AssertEx.SetEqual(descriptorsWithCallbackServiceTypes, callbackDispatcherServiceTypes); } diff --git a/roslyn/src/Workspaces/CoreTest/SolutionTests/ProjectDependencyGraphTests.cs b/roslyn/src/Workspaces/CoreTest/SolutionTests/ProjectDependencyGraphTests.cs index 1d45f72c9b1..74af497560b 100644 --- a/roslyn/src/Workspaces/CoreTest/SolutionTests/ProjectDependencyGraphTests.cs +++ b/roslyn/src/Workspaces/CoreTest/SolutionTests/ProjectDependencyGraphTests.cs @@ -104,13 +104,12 @@ private static void VerifyDependencySets(Solution solution, string expectedResul var actualResult = string.Join( " ", projectIds - .Select( - group => - string.Concat( - group - .Select(p => solution.GetRequiredProject(p).AssemblyName) - .OrderBy(n => n) - ) + .Select(group => + string.Concat( + group + .Select(p => solution.GetRequiredProject(p).AssemblyName) + .OrderBy(n => n) + ) ) .OrderBy(n => n) ); @@ -718,8 +717,7 @@ public void TestSameDependencyGraphAfterOneOfMultipleReferencesRemoved() Assert.Same(dependencyGraph, solution.State.GetProjectDependencyGraph()); b = solution.GetProjectsByName("B").Single(); - var remainingBToC = b.ProjectReferences.Single( - reference => reference.ProjectId == c.Id + var remainingBToC = b.ProjectReferences.Single(reference => reference.ProjectId == c.Id ); solution = solution.RemoveProjectReference(b.Id, remainingBToC); Assert.NotSame(dependencyGraph, solution.State.GetProjectDependencyGraph()); diff --git a/roslyn/src/Workspaces/CoreTest/SolutionTests/SolutionWithSourceGeneratorTests.cs b/roslyn/src/Workspaces/CoreTest/SolutionTests/SolutionWithSourceGeneratorTests.cs index c37b2797dcc..72b4b62097a 100644 --- a/roslyn/src/Workspaces/CoreTest/SolutionTests/SolutionWithSourceGeneratorTests.cs +++ b/roslyn/src/Workspaces/CoreTest/SolutionTests/SolutionWithSourceGeneratorTests.cs @@ -1027,8 +1027,8 @@ await workspace // Fetch the compilation from the other project, it should have a compilation reference that // contains the generated tree - var projectWithReference = generatedDocument.Project.Solution.Projects.Single( - p => p.Id != projectIdWithGenerator + var projectWithReference = generatedDocument.Project.Solution.Projects.Single(p => + p.Id != projectIdWithGenerator ); var compilationWithReference = await projectWithReference.GetRequiredCompilationAsync( CancellationToken.None diff --git a/roslyn/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs b/roslyn/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs index c42a9402bf9..469a258560b 100644 --- a/roslyn/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs +++ b/roslyn/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs @@ -231,21 +231,20 @@ public void GetValueAsyncThatIsCancelledReturnsTaskCancelledWithCorrectToken() { var cancellationTokenSource = new CancellationTokenSource(); - var lazy = AsyncLazy.Create( - c => - Task.Run( - (Func)( - () => + var lazy = AsyncLazy.Create(c => + Task.Run( + (Func)( + () => + { + cancellationTokenSource.Cancel(); + while (true) { - cancellationTokenSource.Cancel(); - while (true) - { - c.ThrowIfCancellationRequested(); - } + c.ThrowIfCancellationRequested(); } - ), - c - ) + } + ), + c + ) ); var task = lazy.GetValueAsync(cancellationTokenSource.Token); diff --git a/roslyn/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs b/roslyn/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs index 985db16f112..b754587657d 100644 --- a/roslyn/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs +++ b/roslyn/src/Workspaces/CoreTest/WorkspaceServiceTests/TemporaryStorageServiceTests.cs @@ -197,7 +197,9 @@ public void TestTemporaryStorageMemoryMappedFileManagement() { for (var j = 1; j < 5; j++) { - using ITemporaryStreamStorageInternal storage1 = service.CreateTemporaryStreamStorage(), + using ITemporaryStreamStorageInternal storage1 = service.CreateTemporaryStreamStorage( + + ), storage2 = service.CreateTemporaryStreamStorage(); var storage3 = service.CreateTemporaryStreamStorage(); // let the finalizer run for this instance diff --git a/roslyn/src/Workspaces/CoreTestUtilities/GenerateFileForEachAdditionalFileWithContentsCommented.cs b/roslyn/src/Workspaces/CoreTestUtilities/GenerateFileForEachAdditionalFileWithContentsCommented.cs index 187248195ce..bdbfd391b0c 100644 --- a/roslyn/src/Workspaces/CoreTestUtilities/GenerateFileForEachAdditionalFileWithContentsCommented.cs +++ b/roslyn/src/Workspaces/CoreTestUtilities/GenerateFileForEachAdditionalFileWithContentsCommented.cs @@ -37,9 +37,10 @@ CancellationToken cancellationToken var sourceText = file.GetText(cancellationToken); Contract.ThrowIfNull(sourceText, "Failed to fetch the text of an additional file."); - var changes = sourceText.Lines.SelectAsArray( - l => new TextChange(new TextSpan(l.Start, length: 0), "// ") - ); + var changes = sourceText.Lines.SelectAsArray(l => new TextChange( + new TextSpan(l.Start, length: 0), + "// " + )); var generatedText = sourceText.WithChanges(changes); return SourceText.From(generatedText.ToString(), encoding: Encoding.UTF8); diff --git a/roslyn/src/Workspaces/CoreTestUtilities/Remote/TestSerializerService.cs b/roslyn/src/Workspaces/CoreTestUtilities/Remote/TestSerializerService.cs index f6528d65d35..5a03a9b0cca 100644 --- a/roslyn/src/Workspaces/CoreTestUtilities/Remote/TestSerializerService.cs +++ b/roslyn/src/Workspaces/CoreTestUtilities/Remote/TestSerializerService.cs @@ -39,8 +39,8 @@ private static readonly ImmutableDictionary< > s_wellKnownReferences = ImmutableDictionary .Create() .AddRange( - s_wellKnownReferenceNames.Select( - pair => KeyValuePairUtil.Create(pair.Value, pair.Key) + s_wellKnownReferenceNames.Select(pair => + KeyValuePairUtil.Create(pair.Value, pair.Key) ) ); diff --git a/roslyn/src/Workspaces/CoreTestUtilities/WorkspaceExtensions.cs b/roslyn/src/Workspaces/CoreTestUtilities/WorkspaceExtensions.cs index 4ca7e8e21f6..29cdc06ab44 100644 --- a/roslyn/src/Workspaces/CoreTestUtilities/WorkspaceExtensions.cs +++ b/roslyn/src/Workspaces/CoreTestUtilities/WorkspaceExtensions.cs @@ -71,8 +71,8 @@ public static DocumentId CreateDocumentId( } public static IEnumerable GetProjectsByName(this Solution solution, string name) => - solution.Projects.Where( - p => string.Compare(p.Name, name, StringComparison.OrdinalIgnoreCase) == 0 + solution.Projects.Where(p => + string.Compare(p.Name, name, StringComparison.OrdinalIgnoreCase) == 0 ); internal static EventWaiter VerifyWorkspaceChangedEvent( diff --git a/roslyn/src/Workspaces/MSBuildTest/NetCoreTests.cs b/roslyn/src/Workspaces/MSBuildTest/NetCoreTests.cs index b9cfff5691a..0a9a1c1ae13 100644 --- a/roslyn/src/Workspaces/MSBuildTest/NetCoreTests.cs +++ b/roslyn/src/Workspaces/MSBuildTest/NetCoreTests.cs @@ -367,8 +367,8 @@ private static async Task AssertNetCoreMultiTFMProject(string projectFilePath) ); // Verify that the projects reference the correct TFMs - var projects = workspace.CurrentSolution.Projects.Where( - p => p.FilePath.EndsWith("Project.csproj") + var projects = workspace.CurrentSolution.Projects.Where(p => + p.FilePath.EndsWith("Project.csproj") ); foreach (var project in projects) { diff --git a/roslyn/src/Workspaces/MSBuildTest/SolutionGeneration.cs b/roslyn/src/Workspaces/MSBuildTest/SolutionGeneration.cs index 64ca60b1d00..a7756a821fd 100644 --- a/roslyn/src/Workspaces/MSBuildTest/SolutionGeneration.cs +++ b/roslyn/src/Workspaces/MSBuildTest/SolutionGeneration.cs @@ -98,8 +98,8 @@ params IBuilder[] inputs { if (projectReference.Guid == Guid.Empty) { - var referencedProject = projectBuilders.First( - p => p.Name == projectReference.ProjectName + var referencedProject = projectBuilders.First(p => + p.Name == projectReference.ProjectName ); projectReference.Guid = referencedProject.Guid; projectReference.ProjectFileName = diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Host/AssetProvider.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Host/AssetProvider.cs index e69487f5504..6760ea3162e 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Host/AssetProvider.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Host/AssetProvider.cs @@ -118,8 +118,7 @@ await syncer { Logger.Log( FunctionId.AssetService_Perf, - KeyValueLogMessage.Create( - map => map["SolutionSyncTime"] = timer.ElapsedMilliseconds + KeyValueLogMessage.Create(map => map["SolutionSyncTime"] = timer.ElapsedMilliseconds ) ); } diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/ConvertTupleToStructCodeRefactoringProvider/RemoteConvertTupleToStructCodeRefactoringService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/ConvertTupleToStructCodeRefactoringProvider/RemoteConvertTupleToStructCodeRefactoringService.cs index 2085543e7ef..62a32f121fe 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/ConvertTupleToStructCodeRefactoringProvider/RemoteConvertTupleToStructCodeRefactoringService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/ConvertTupleToStructCodeRefactoringProvider/RemoteConvertTupleToStructCodeRefactoringService.cs @@ -75,7 +75,9 @@ CancellationToken cancellationToken var document = solution.GetRequiredDocument(documentId); var service = - document.GetRequiredLanguageService(); + document.GetRequiredLanguageService( + + ); var fallbackOptions = GetClientOptionsProvider(callbackId); var updatedSolution = await service diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/PerformanceTrackerService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/PerformanceTrackerService.cs index 5c3c7455b7e..eb9f5d39fdb 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/PerformanceTrackerService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/DiagnosticAnalyzer/PerformanceTrackerService.cs @@ -158,8 +158,8 @@ bool forSpanAnalysis } foreach ( - var (analyzerId, average, stddev) in rawPerformanceData.OrderByDescending( - k => k.average + var (analyzerId, average, stddev) in rawPerformanceData.OrderByDescending(k => + k.average ) ) { diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/DocumentHighlights/RemoteDocumentHighlightsService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/DocumentHighlights/RemoteDocumentHighlightsService.cs index ef399622fbe..79fd1b4c456 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/DocumentHighlights/RemoteDocumentHighlightsService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/DocumentHighlights/RemoteDocumentHighlightsService.cs @@ -52,13 +52,12 @@ CancellationToken cancellationToken ) .ConfigureAwait(false); var documentsToSearch = await documentIdsToSearch - .SelectAsArrayAsync( - id => - solution.GetDocumentAsync( - id, - includeSourceGenerated: true, - cancellationToken - ) + .SelectAsArrayAsync(id => + solution.GetDocumentAsync( + id, + includeSourceGenerated: true, + cancellationToken + ) ) .ConfigureAwait(false); var documentsToSearchSet = ImmutableHashSet.CreateRange( diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/GlobalNotificationDelivery/RemoteGlobalNotificationDeliveryService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/GlobalNotificationDelivery/RemoteGlobalNotificationDeliveryService.cs index 4917a56d97d..b2959552b96 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/GlobalNotificationDelivery/RemoteGlobalNotificationDeliveryService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/GlobalNotificationDelivery/RemoteGlobalNotificationDeliveryService.cs @@ -33,8 +33,9 @@ public ValueTask OnGlobalOperationStartedAsync(CancellationToken cancellationTok return RunServiceAsync( cancellationToken => { - var globalOperationNotificationService = - GetGlobalOperationNotificationService(); + var globalOperationNotificationService = GetGlobalOperationNotificationService( + + ); globalOperationNotificationService.OnStarted(); return default; }, @@ -50,8 +51,9 @@ public ValueTask OnGlobalOperationStoppedAsync(CancellationToken cancellationTok return RunServiceAsync( cancellationToken => { - var globalOperationNotificationService = - GetGlobalOperationNotificationService(); + var globalOperationNotificationService = GetGlobalOperationNotificationService( + + ); globalOperationNotificationService.OnStopped(); return default; }, @@ -64,7 +66,9 @@ private RemoteGlobalOperationNotificationService GetGlobalOperationNotificationS => (RemoteGlobalOperationNotificationService) GetWorkspace() - .Services.SolutionServices.ExportProvider.GetExports() + .Services.SolutionServices.ExportProvider.GetExports( + + ) .Single() .Value; } diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs index a72e01a1215..0255f91ddb7 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs @@ -116,8 +116,8 @@ CancellationToken cancellationToken return classifiedSpans.IsDefault ? null : SerializableClassifiedSpans.Dehydrate( - classifiedSpans.WhereAsArray( - c => textSpanIntervalTree.HasIntervalThatIntersectsWith(c.TextSpan) + classifiedSpans.WhereAsArray(c => + textSpanIntervalTree.HasIntervalThatIntersectsWith(c.TextSpan) ) ); } @@ -315,8 +315,8 @@ out ImmutableArray classifiedSpans { lock (_cachedData) { - var data = _cachedData.FirstOrNull( - d => d.id == documentKey.Id && d.checksum == checksum + var data = _cachedData.FirstOrNull(d => + d.id == documentKey.Id && d.checksum == checksum ); if (data != null) { diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/UnitTesting/RemoteUnitTestingSearchService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/UnitTesting/RemoteUnitTestingSearchService.cs index c9966f23389..3e962e1537e 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/UnitTesting/RemoteUnitTestingSearchService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/UnitTesting/RemoteUnitTestingSearchService.cs @@ -75,16 +75,10 @@ CancellationToken cancellationToken .GetSourceLocationsAsync(project, query, cancellationToken) .ConfigureAwait(false); - return results.SelectAsArray( - r => - new UnitTestingSourceLocation( - new DocumentIdSpan( - r.DocumentSpan.Document.Id, - r.DocumentSpan.SourceSpan - ), - r.Span - ) - ); + return results.SelectAsArray(r => new UnitTestingSourceLocation( + new DocumentIdSpan(r.DocumentSpan.Document.Id, r.DocumentSpan.SourceSpan), + r.Span + )); }, cancellationToken ); diff --git a/roslyn/src/Workspaces/Remote/ServiceHub/Services/ValueTracking/RemoteValueTrackingService.cs b/roslyn/src/Workspaces/Remote/ServiceHub/Services/ValueTracking/RemoteValueTrackingService.cs index 224005bd5ad..aba1eef4fde 100644 --- a/roslyn/src/Workspaces/Remote/ServiceHub/Services/ValueTracking/RemoteValueTrackingService.cs +++ b/roslyn/src/Workspaces/Remote/ServiceHub/Services/ValueTracking/RemoteValueTrackingService.cs @@ -50,13 +50,8 @@ await ValueTracker .ConfigureAwait(false); var items = progress.GetItems(); - return items.SelectAsArray( - item => - SerializableValueTrackedItem.Dehydrate( - solution, - item, - cancellationToken - ) + return items.SelectAsArray(item => + SerializableValueTrackedItem.Dehydrate(solution, item, cancellationToken) ); }, cancellationToken @@ -92,13 +87,8 @@ await ValueTracker .ConfigureAwait(false); var items = progress.GetItems(); - return items.SelectAsArray( - item => - SerializableValueTrackedItem.Dehydrate( - solution, - item, - cancellationToken - ) + return items.SelectAsArray(item => + SerializableValueTrackedItem.Dehydrate(solution, item, cancellationToken) ); }, cancellationToken diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ITypeSymbolExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ITypeSymbolExtensions.cs index fe1be46f88c..4beaa21e849 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ITypeSymbolExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/ITypeSymbolExtensions.cs @@ -55,12 +55,11 @@ public static bool TryGetPrimaryConstructor( // if GetParameters extension method gets updated to handle records, we need to test EVERY usage // of the extension method and make sure the change is applicable to all these usages. - primaryConstructor = typeSymbol.InstanceConstructors.FirstOrDefault( - c => - c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() - is RecordDeclarationSyntax - or ClassDeclarationSyntax - or StructDeclarationSyntax + primaryConstructor = typeSymbol.InstanceConstructors.FirstOrDefault(c => + c.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() + is RecordDeclarationSyntax + or ClassDeclarationSyntax + or StructDeclarationSyntax ); return primaryConstructor is not null; } diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTriviaListExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTriviaListExtensions.cs index fe126724346..006b67623c2 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTriviaListExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTriviaListExtensions.cs @@ -31,15 +31,14 @@ internal static class SyntaxTriviaListExtensions return null; return triviaList - .Where( - t => - t - is - ( - kind: SyntaxKind.SingleLineCommentTrivia - or SyntaxKind.MultiLineCommentTrivia - or SyntaxKind.WhitespaceTrivia - ) + .Where(t => + t + is + ( + kind: SyntaxKind.SingleLineCommentTrivia + or SyntaxKind.MultiLineCommentTrivia + or SyntaxKind.WhitespaceTrivia + ) ) .LastOrNull(); } @@ -59,9 +58,8 @@ SyntaxTriviaList triviaList currentLine.Add(trivia); if (trivia.Kind() == SyntaxKind.EndOfLineTrivia) { - var currentLineIsBlank = currentLine.All( - static t => - t.Kind() is SyntaxKind.EndOfLineTrivia or SyntaxKind.WhitespaceTrivia + var currentLineIsBlank = currentLine.All(static t => + t.Kind() is SyntaxKind.EndOfLineTrivia or SyntaxKind.WhitespaceTrivia ); if (!currentLineIsBlank) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/ElasticTriviaFormattingRule.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/ElasticTriviaFormattingRule.cs index 7328b036460..3a906d4d4d1 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/ElasticTriviaFormattingRule.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/ElasticTriviaFormattingRule.cs @@ -352,8 +352,7 @@ private static bool TryGetOperationBeforeDocComment( { // see whether first non whitespace trivia after before the current member is a comment or not var triviaList = currentToken.LeadingTrivia; - var firstNonWhitespaceTrivia = triviaList.FirstOrDefault( - trivia => !IsWhitespace(trivia) + var firstNonWhitespaceTrivia = triviaList.FirstOrDefault(trivia => !IsWhitespace(trivia) ); if (!firstNonWhitespaceTrivia.IsRegularOrDocComment()) { @@ -655,12 +654,11 @@ private static bool IsWhitespace(SyntaxTrivia trivia) } private static int GetNumberOfLines(IEnumerable triviaList) => - triviaList.Sum( - t => - t.ToFullString() - .Replace("\r\n", "\r") - .Cast() - .Count(c => SyntaxFacts.IsNewLine(c)) + triviaList.Sum(t => + t.ToFullString() + .Replace("\r\n", "\r") + .Cast() + .Count(c => SyntaxFacts.IsNewLine(c)) ); } } diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SuppressFormattingRule.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SuppressFormattingRule.cs index 7cd6b3c7b04..d9ae3354565 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SuppressFormattingRule.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SuppressFormattingRule.cs @@ -453,8 +453,8 @@ structure is not PragmaWarningDirectiveTriviaSyntax pragmaWarningDirectiveTrivia includeDirectives: true ); - var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective( - trivia => IsFormatDirective(trivia, SyntaxKind.RestoreKeyword) + var endDirective = pragmaWarningDirectiveTrivia.GetNextDirective(trivia => + IsFormatDirective(trivia, SyntaxKind.RestoreKeyword) ); var endToken = endDirective is null ? ( diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SelectedMembers/CSharpSelectedMembers.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SelectedMembers/CSharpSelectedMembers.cs index a29eff2275f..f6579ff69a7 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SelectedMembers/CSharpSelectedMembers.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SelectedMembers/CSharpSelectedMembers.cs @@ -35,12 +35,12 @@ SyntaxToken identifier return member switch { FieldDeclarationSyntax fieldDeclaration - => fieldDeclaration.Declaration.Variables.SelectAsArray( - v => (declaration: (SyntaxNode)v, identifier: v.Identifier) + => fieldDeclaration.Declaration.Variables.SelectAsArray(v => + (declaration: (SyntaxNode)v, identifier: v.Identifier) ), EventFieldDeclarationSyntax eventFieldDeclaration - => eventFieldDeclaration.Declaration.Variables.SelectAsArray( - v => (declaration: (SyntaxNode)v, identifier: v.Identifier) + => eventFieldDeclaration.Declaration.Variables.SelectAsArray(v => + (declaration: (SyntaxNode)v, identifier: v.Identifier) ), _ => ImmutableArray.Create( diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/Simplifiers/CastSimplifier.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/Simplifiers/CastSimplifier.cs index cad83f7e98c..08aad087d9f 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/Simplifiers/CastSimplifier.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Simplification/Simplifiers/CastSimplifier.cs @@ -1758,8 +1758,8 @@ originalMemberSymbol is IMethodSymbol originalMethodSymbol var originalParameter = originalParameters[i]; var rewrittenParameter = rewrittenParameters[i]; - var argument = invocationOperation.Arguments.FirstOrDefault( - a => Equals(originalParameter, a.Parameter) + var argument = invocationOperation.Arguments.FirstOrDefault(a => + Equals(originalParameter, a.Parameter) ); var argumentSyntax = argument?.Syntax as ArgumentSyntax; diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs index 7c427685859..2211375a242 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpTypeStyleHelper.cs @@ -77,12 +77,11 @@ CancellationToken cancellationToken ) { if ( - typeName?.FirstAncestorOrSelf( - a => - a.Kind() - is SyntaxKind.DeclarationExpression - or SyntaxKind.VariableDeclaration - or SyntaxKind.ForEachStatement + typeName?.FirstAncestorOrSelf(a => + a.Kind() + is SyntaxKind.DeclarationExpression + or SyntaxKind.VariableDeclaration + or SyntaxKind.ForEachStatement ) is not { } declaration ) diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/DiagnosticDescriptorExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/DiagnosticDescriptorExtensions.cs index bb886d9fbed..5e836a34663 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/DiagnosticDescriptorExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/DiagnosticDescriptorExtensions.cs @@ -155,11 +155,10 @@ AnalyzerConfigOptions analyzerConfigOptions !descriptor.IsEnabledByDefault || descriptor .ImmutableCustomTags() - .Any( - static tag => - tag - is WellKnownDiagnosticTags.Compiler - or WellKnownDiagnosticTags.NotConfigurable + .Any(static tag => + tag + is WellKnownDiagnosticTags.Compiler + or WellKnownDiagnosticTags.NotConfigurable ) ) { @@ -250,11 +249,10 @@ out severity !descriptor.IsEnabledByDefault || descriptor .ImmutableCustomTags() - .Any( - static tag => - tag - is WellKnownDiagnosticTags.Compiler - or WellKnownDiagnosticTags.NotConfigurable + .Any(static tag => + tag + is WellKnownDiagnosticTags.Compiler + or WellKnownDiagnosticTags.NotConfigurable ) ) { @@ -309,11 +307,10 @@ out ReportDiagnostic severity !descriptor.IsEnabledByDefault || descriptor .ImmutableCustomTags() - .Any( - static tag => - tag - is WellKnownDiagnosticTags.Compiler - or WellKnownDiagnosticTags.NotConfigurable + .Any(static tag => + tag + is WellKnownDiagnosticTags.Compiler + or WellKnownDiagnosticTags.NotConfigurable ) ) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ITypeSymbolExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ITypeSymbolExtensions.cs index eaf82eacb78..e37adadd789 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ITypeSymbolExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ITypeSymbolExtensions.cs @@ -212,12 +212,8 @@ ITypeSymbol baseType (baseType.TypeKind == TypeKind.Interface) ? type.AllInterfaces : type.GetBaseTypes(); - return baseTypes.Contains( - t => - SymbolEquivalenceComparer.Instance.Equals( - t.OriginalDefinition, - originalBaseType - ) + return baseTypes.Contains(t => + SymbolEquivalenceComparer.Instance.Equals(t.OriginalDefinition, originalBaseType) ); } @@ -270,8 +266,8 @@ ITypeSymbol interfaceType public static bool Implements(this ITypeSymbol type, ITypeSymbol interfaceType) { - return type.AllInterfaces.Contains( - t => SymbolEquivalenceComparer.Instance.Equals(t, interfaceType) + return type.AllInterfaces.Contains(t => + SymbolEquivalenceComparer.Instance.Equals(t, interfaceType) ); } @@ -461,8 +457,8 @@ public static bool CanSupportCollectionInitializer( ISymbol within ) { - return typeSymbol.AllInterfaces.Any( - static i => i.SpecialType == SpecialType.System_Collections_IEnumerable + return typeSymbol.AllInterfaces.Any(static i => + i.SpecialType == SpecialType.System_Collections_IEnumerable ) && typeSymbol .GetBaseTypesAndThis() @@ -510,8 +506,8 @@ ISymbol within } var types = containingType.GetBaseTypes(); - return types.SelectMany( - x => x.GetMembers().OfType().Where(m => m.IsAccessibleWithin(within)) + return types.SelectMany(x => + x.GetMembers().OfType().Where(m => m.IsAccessibleWithin(within)) ); } @@ -578,8 +574,8 @@ ISymbol within return ImmutableArray.Empty; } - return types.SelectMany( - x => x.GetMembers().OfType().Where(m => m.IsAccessibleWithin(within)) + return types.SelectMany(x => + x.GetMembers().OfType().Where(m => m.IsAccessibleWithin(within)) ); } @@ -595,8 +591,8 @@ ISymbol within return ImmutableArray.Empty; } - return types.SelectMany( - x => x.GetMembers(memberName).OfType().Where(m => m.IsAccessibleWithin(within)) + return types.SelectMany(x => + x.GetMembers(memberName).OfType().Where(m => m.IsAccessibleWithin(within)) ); } @@ -865,10 +861,9 @@ public static bool IsInlineArray([NotNullWhen(true)] this ITypeSymbol? type) => type is INamedTypeSymbol namedType && namedType .OriginalDefinition.GetAttributes() - .Any( - static a => - a.AttributeClass?.SpecialType - == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute + .Any(static a => + a.AttributeClass?.SpecialType + == SpecialType.System_Runtime_CompilerServices_InlineArrayAttribute ); } } diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/OperationExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/OperationExtensions.cs index 22bb302989a..f656ec16367 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/OperationExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/OperationExtensions.cs @@ -411,8 +411,7 @@ public static bool HasAnyOperationDescendant( this ImmutableArray operationBlocks, OperationKind kind ) => - operationBlocks.HasAnyOperationDescendant( - predicate: operation => operation.Kind == kind + operationBlocks.HasAnyOperationDescendant(predicate: operation => operation.Kind == kind ); public static bool IsNumericLiteral(this IOperation operation) => diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs index cb83ea120b2..99068f0c966 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SyntaxNodeExtensions.cs @@ -1080,8 +1080,8 @@ CancellationToken cancellationToken var ifStack = pooledIfStack.Object; foreach ( - var token in root.DescendantTokens( - descendIntoChildren: static node => node.ContainsDirectives + var token in root.DescendantTokens(descendIntoChildren: static node => + node.ContainsDirectives ) ) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs index e8a1253cb57..39278eec620 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Context/FormattingContext.InitialContextFinder.cs @@ -68,10 +68,9 @@ SyntaxNode rootNode { Debug.Assert( initialSuppressOperations.IsEmpty() - || initialSuppressOperations.All( - o => - o.TextSpan.Contains(startToken.SpanStart) - || o.TextSpan.Contains(endToken.SpanStart) + || initialSuppressOperations.All(o => + o.TextSpan.Contains(startToken.SpanStart) + || o.TextSpan.Contains(endToken.SpanStart) ) ); } @@ -95,11 +94,8 @@ SyntaxToken endToken while (node != null) { // get all operations for the nodes that contains the formatting span, but not ones contained by the span - node.DescendantNodesAndSelf( - n => - n != previous - && n.Span.IntersectsWith(span) - && !span.Contains(n.Span) + node.DescendantNodesAndSelf(n => + n != previous && n.Span.IntersectsWith(span) && !span.Contains(n.Span) ) .Do(n => { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/AbstractAggregatedFormattingResult.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/AbstractAggregatedFormattingResult.cs index 6c825a1268e..0809f506bff 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/AbstractAggregatedFormattingResult.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/Engine/AbstractAggregatedFormattingResult.cs @@ -114,11 +114,10 @@ private SyntaxNode CreateFormattedRoot(CancellationToken cancellationToken) // create a map var map = new Dictionary, TriviaData>(); - _formattingResults.Do( - result => - result - .GetChanges(cancellationToken) - .Do(change => map.Add(change.Item1, change.Item2)) + _formattingResults.Do(result => + result + .GetChanges(cancellationToken) + .Do(change => map.Add(change.Item1, change.Item2)) ); return Rewriter(map, cancellationToken); diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/EditorConfig/EditorConfigNamingStyleParser_SymbolSpec.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/EditorConfig/EditorConfigNamingStyleParser_SymbolSpec.cs index 7ed6de14800..48ca5bce40c 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/EditorConfig/EditorConfigNamingStyleParser_SymbolSpec.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/NamingStyles/EditorConfig/EditorConfigNamingStyleParser_SymbolSpec.cs @@ -575,8 +575,8 @@ string languageName return string.Join( ", ", - accessibilities.Select( - accessibility => accessibility.ToEditorConfigString(languageName) + accessibilities.Select(accessibility => + accessibility.ToEditorConfigString(languageName) ) ); } diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs index 9424fc0cb4f..afa5bc6d1b4 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs @@ -107,22 +107,20 @@ AttributeData attribute var arguments = new List(); arguments.AddRange( - attribute.ConstructorArguments.Select( - c => - SyntaxFactory.AttributeArgument( - ExpressionGenerator.GenerateExpression(generator, c) - ) + attribute.ConstructorArguments.Select(c => + SyntaxFactory.AttributeArgument( + ExpressionGenerator.GenerateExpression(generator, c) + ) ) ); arguments.AddRange( - attribute.NamedArguments.Select( - kvp => - SyntaxFactory.AttributeArgument( - SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(kvp.Key)), - null, - ExpressionGenerator.GenerateExpression(generator, kvp.Value) - ) + attribute.NamedArguments.Select(kvp => + SyntaxFactory.AttributeArgument( + SyntaxFactory.NameEquals(SyntaxFactory.IdentifierName(kvp.Key)), + null, + ExpressionGenerator.GenerateExpression(generator, kvp.Value) + ) ) ); diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs index dc6312ec824..7646a125597 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs @@ -193,8 +193,8 @@ SyntaxList members public static MemberDeclarationSyntax? LastOperator( SyntaxList members ) => - members.LastOrDefault( - m => m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax + members.LastOrDefault(m => + m is OperatorDeclarationSyntax or ConversionOperatorDeclarationSyntax ); public static SyntaxList Insert( @@ -239,10 +239,9 @@ private static bool AreBracesMissing(TDeclaration declaration) where TDeclaration : SyntaxNode => declaration .ChildTokens() - .Where( - t => - t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken - && t.IsMissing + .Where(t => + t.Kind() is SyntaxKind.OpenBraceToken or SyntaxKind.CloseBraceToken + && t.IsMissing ) .Any(); diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs index 56154b2ba22..cb5bfcf3e62 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs @@ -42,10 +42,9 @@ FieldDeclarationSyntax fieldDeclaration var lastNormal = members .OfType() - .Where( - f => - !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) - && !f.Modifiers.Any(SyntaxKind.ConstKeyword) + .Where(f => + !f.Modifiers.Any(SyntaxKind.ReadOnlyKeyword) + && !f.Modifiers.Any(SyntaxKind.ConstKeyword) ) .LastOrDefault(); diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs index aaf62ca9946..97410b2d05c 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs @@ -99,10 +99,9 @@ CancellationToken cancellationToken // the method symbols for the getter and setter, we don't want to generate them twice. var members = GetMembers(namedType) - .Where( - s => - s.Kind != SymbolKind.Property - || PropertyGenerator.CanBeGenerated((IPropertySymbol)s) + .Where(s => + s.Kind != SymbolKind.Property + || PropertyGenerator.CanBeGenerated((IPropertySymbol)s) ) .ToImmutableArray(); if (namedType.IsRecord) @@ -166,10 +165,9 @@ CancellationToken cancellationToken members = members.Remove(primaryConstructor); // remove any fields/properties that were created by the primary constructor - members = members.WhereAsArray( - m => - m is not IPropertySymbol and not IFieldSymbol - || !primaryConstructor.Parameters.Any(static (p, m) => p.Name == m.Name, m) + members = members.WhereAsArray(m => + m is not IPropertySymbol and not IFieldSymbol + || !primaryConstructor.Parameters.Any(static (p, m) => p.Name == m.Name, m) ); } diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs index c2716e2f43c..7a6065029a8 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs @@ -1107,8 +1107,8 @@ SyntaxToken tokenOnLeftOfPosition { // Check if there's a 'new()' constraint. If there isn't, or we're before it, then // this is a type parameter constraint context. - var firstConstructorConstraint = constraintClause.Constraints.FirstOrDefault( - t => t is ConstructorConstraintSyntax + var firstConstructorConstraint = constraintClause.Constraints.FirstOrDefault(t => + t is ConstructorConstraintSyntax ); if ( firstConstructorConstraint == null @@ -2766,8 +2766,9 @@ SyntaxToken tokenOnLeftOfPosition } // void M() { const int i = | - var localDeclaration = - equalsValue.GetAncestor(); + var localDeclaration = equalsValue.GetAncestor( + + ); if (localDeclaration != null) { return localDeclaration.Modifiers.Any(SyntaxKind.ConstKeyword); @@ -3594,8 +3595,8 @@ public static bool IsNameOfContext( if ( parentMemberAccess.Parent.IsKind(SyntaxKind.Argument) - && parentMemberAccess.Parent.IsChildNode( - a => a.Arguments.FirstOrDefault() + && parentMemberAccess.Parent.IsChildNode(a => + a.Arguments.FirstOrDefault() ) ) { @@ -3616,8 +3617,8 @@ public static bool IsNameOfContext( if ( parentQualifiedName.Parent.IsKind(SyntaxKind.Argument) - && parentQualifiedName.Parent.IsChildNode( - a => a.Arguments.FirstOrDefault() + && parentQualifiedName.Parent.IsChildNode(a => + a.Arguments.FirstOrDefault() ) ) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs index 955a9a2f2e2..fb0ad8d2ed4 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ITypeSymbolExtensions.TypeSyntaxGeneratorVisitor.cs @@ -174,8 +174,8 @@ and not System.Reflection.Metadata.SignatureCallingConvention.VarArgs // syntax, so strip it off symbol.Signature.UnmanagedCallingConventionTypes.IsEmpty ? null - : symbol.Signature.UnmanagedCallingConventionTypes.Select( - type => GetConventionForString(type.Name["CallConv".Length..]) + : symbol.Signature.UnmanagedCallingConventionTypes.Select(type => + GetConventionForString(type.Name["CallConv".Length..]) ), _ @@ -202,14 +202,13 @@ string identifier } var parameters = symbol - .Signature.Parameters.Select( - p => - ( - p.Type, - RefKindModifiers: CSharpSyntaxGeneratorInternal.GetParameterModifiers( - p.RefKind - ) + .Signature.Parameters.Select(p => + ( + p.Type, + RefKindModifiers: CSharpSyntaxGeneratorInternal.GetParameterModifiers( + p.RefKind ) + ) ) .Concat( SpecializedCollections.SingletonEnumerable( @@ -222,11 +221,10 @@ string identifier ) ) ) - .SelectAsArray( - t => - SyntaxFactory - .FunctionPointerParameter(t.Type.GenerateTypeSyntax()) - .WithModifiers(t.RefKindModifiers) + .SelectAsArray(t => + SyntaxFactory + .FunctionPointerParameter(t.Type.GenerateTypeSyntax()) + .WithModifiers(t.RefKindModifiers) ); return AddInformationTo( diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs index e400e4f3b2e..e27693ddd8e 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs @@ -159,8 +159,9 @@ or SyntaxKind.InterpolatedStringTextToken is { RawKind: (int)SyntaxKind.CloseBraceToken, Parent: InterpolationSyntax } ) { - var interpolatedExpression = - token.GetAncestor(); + var interpolatedExpression = token.GetAncestor( + + ); Contract.ThrowIfNull(interpolatedExpression); if ( interpolatedExpression.StringStartToken.IsKind( diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs index 28616ea70a8..017ca89df2e 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs @@ -69,8 +69,8 @@ CancellationToken cancellationToken .ConfigureAwait(false); if ( unnecessaryImports == null - || unnecessaryImports.Any( - import => import.OverlapsHiddenPosition(cancellationToken) + || unnecessaryImports.Any(import => + import.OverlapsHiddenPosition(cancellationToken) ) ) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxGeneratorInternal.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxGeneratorInternal.cs index 0bcece9eae1..c32a60c13b4 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxGeneratorInternal.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxGeneratorInternal.cs @@ -28,8 +28,9 @@ internal sealed class CSharpSyntaxGeneratorInternal : SyntaxGeneratorInternal )] public CSharpSyntaxGeneratorInternal() { } - public static readonly SyntaxGeneratorInternal Instance = - new CSharpSyntaxGeneratorInternal(); + public static readonly SyntaxGeneratorInternal Instance = new CSharpSyntaxGeneratorInternal( + + ); public override ISyntaxFacts SyntaxFacts => CSharpSyntaxFacts.Instance; diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs index 2321d71714f..4596a9b794e 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs @@ -49,15 +49,14 @@ protected SyntaxEditorBasedCodeFixProvider(bool supportsFixAll = true) => // https://github.com/dotnet/roslyn/issues/31381, that seems to be causing duplicate diagnostics. var filteredDiagnostics = diagnostics .Distinct() - .WhereAsArray( - d => - this.IncludeDiagnosticDuringFixAll( - d, - document, - model, - fixAllContext.CodeActionEquivalenceKey, - fixAllContext.CancellationToken - ) + .WhereAsArray(d => + this.IncludeDiagnosticDuringFixAll( + d, + document, + model, + fixAllContext.CodeActionEquivalenceKey, + fixAllContext.CancellationToken + ) ) .Sort( (d1, d2) => d1.Location.SourceSpan.Start - d2.Location.SourceSpan.Start diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs index 8cdbcf09590..e9fa0885826 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs @@ -764,8 +764,7 @@ CancellationToken cancellationToken // Filter out the members that are implicitly declared. They're implicit, hence we do // not want an explicit declaration. The only exception are fields generated from implicit tuple fields. - var filteredMembers = membersList.Where( - m => !m.IsImplicitlyDeclared || m.IsTupleField() + var filteredMembers = membersList.Where(m => !m.IsImplicitlyDeclared || m.IsTupleField() ); return info.Context.AutoInsertionLocation diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs index da493b9a793..8790656763f 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs @@ -243,8 +243,8 @@ public static int GetInsertionIndex( && afterSourceTree.FilePath == declarationList.FirstOrDefault()?.SyntaxTree.FilePath ) { - var afterMember = declarationList.LastOrDefault( - m => m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start + var afterMember = declarationList.LastOrDefault(m => + m.SpanStart <= info.Context.AfterThisLocation.SourceSpan.Start ); if (afterMember != null) { @@ -264,8 +264,8 @@ public static int GetInsertionIndex( == declarationList.FirstOrDefault()?.SyntaxTree.FilePath ) { - var beforeMember = declarationList.FirstOrDefault( - m => m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End + var beforeMember = declarationList.FirstOrDefault(m => + m.Span.End >= info.Context.BeforeThisLocation.SourceSpan.End ); if (beforeMember != null) { diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceService.State.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceService.State.cs index 85259bc629f..3c208e27757 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceService.State.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/MoveDeclarationNearReference/AbstractMoveDeclarationNearReferenceService.State.cs @@ -145,8 +145,8 @@ select statement OutermostBlockStatements = blockFacts.GetExecutableBlockStatements(OutermostBlock); var allAffectedStatements = new HashSet( - referencingStatements.SelectMany( - expr => expr.GetAncestorsOrThis() + referencingStatements.SelectMany(expr => + expr.GetAncestorsOrThis() ) ); FirstStatementAffectedInInnermostBlock = InnermostBlockStatements diff --git a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/MefLanguageServices.cs b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/MefLanguageServices.cs index b15f2e2a9b0..4336f03fa08 100644 --- a/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/MefLanguageServices.cs +++ b/roslyn/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/MefLanguageServices.cs @@ -43,13 +43,10 @@ public MefLanguageServices(MefWorkspaceServices workspaceServices, string langua var services = hostServices.GetExports(); var factories = hostServices .GetExports() - .Select( - lz => - new Lazy( - () => lz.Value.CreateLanguageService(this), - lz.Metadata - ) - ); + .Select(lz => new Lazy( + () => lz.Value.CreateLanguageService(this), + lz.Metadata + )); _services = services .Concat(factories) diff --git a/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Dispensers/DispenserAlgorithm.cs b/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Dispensers/DispenserAlgorithm.cs index 8afb83bcc72..9a143825225 100644 --- a/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Dispensers/DispenserAlgorithm.cs +++ b/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Dispensers/DispenserAlgorithm.cs @@ -22,7 +22,8 @@ internal sealed class DispenserAlgorithm // The key cannot be a value type. // Keys are compared using Object.ReferenceEquals. // - public static readonly DispenserAlgorithm ReuseAsLongAsKeyIsAlive = - new DispenserAlgorithm(); + public static readonly DispenserAlgorithm ReuseAsLongAsKeyIsAlive = new DispenserAlgorithm( + + ); } } diff --git a/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Type.NativeAot.cs b/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Type.NativeAot.cs index 33b7112fc11..cdb84da66b1 100644 --- a/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Type.NativeAot.cs +++ b/runtime/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Type.NativeAot.cs @@ -58,8 +58,9 @@ private static unsafe RuntimeType GetTypeFromMethodTableSlow(MethodTable* pMT) if (runtimeTypeCache != null) return runtimeTypeCache; - RuntimeType? type = - FrozenObjectHeapManager.Instance.TryAllocateObject(); + RuntimeType? type = FrozenObjectHeapManager.Instance.TryAllocateObject( + + ); if (type == null) throw new OutOfMemoryException(); diff --git a/runtime/src/coreclr/tools/Common/Compiler/Dataflow/DynamicallyAccessedMembersBinder.cs b/runtime/src/coreclr/tools/Common/Compiler/Dataflow/DynamicallyAccessedMembersBinder.cs index 97327e24445..5095c1af21f 100644 --- a/runtime/src/coreclr/tools/Common/Compiler/Dataflow/DynamicallyAccessedMembersBinder.cs +++ b/runtime/src/coreclr/tools/Common/Compiler/Dataflow/DynamicallyAccessedMembersBinder.cs @@ -60,8 +60,8 @@ var c in typeDefinition.GetConstructorsOnType( if (memberTypes.HasFlag(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)) { foreach ( - var c in typeDefinition.GetConstructorsOnType( - filter: m => m.IsPublic() && !m.HasMetadataParameters() + var c in typeDefinition.GetConstructorsOnType(filter: m => + m.IsPublic() && !m.HasMetadataParameters() ) ) yield return c; diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs index 4ff1b948d7a..1f4d0196082 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilerTypeSystemContext.DynamicInvoke.cs @@ -31,16 +31,17 @@ protected override int GetValueHashCode(DynamicInvokeMethodThunk value) => protected override DynamicInvokeMethodThunk CreateValueFromKey(MethodSignature key) { return new DynamicInvokeMethodThunk( - ( - (CompilerTypeSystemContext)key.Context - ).GeneratedAssembly.GetGlobalModuleType(), + ((CompilerTypeSystemContext)key.Context).GeneratedAssembly.GetGlobalModuleType( + + ), key ); } } - private DynamicInvokeThunkHashtable _dynamicInvokeThunks = - new DynamicInvokeThunkHashtable(); + private DynamicInvokeThunkHashtable _dynamicInvokeThunks = new DynamicInvokeThunkHashtable( + + ); public MethodDesc GetDynamicInvokeThunk( MethodSignature signature, diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs index 883621c703d..a4cd768461a 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/InterfaceGenericVirtualMethodTableNode.cs @@ -195,7 +195,9 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) foreach (var interestingEntry in factory.MetadataManager.GetTypeGVMEntries()) { foreach ( - var typeGVMEntryInfo in interestingEntry.ScanForInterfaceGenericVirtualMethodEntries() + var typeGVMEntryInfo in interestingEntry.ScanForInterfaceGenericVirtualMethodEntries( + + ) ) { AddGenericVirtualMethodImplementation( diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs index 6870b8a7613..5b1e06fba82 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.NativeLayout.cs @@ -28,16 +28,15 @@ public NativeLayoutHelper(NodeFactory factory) private void CreateNodeCaches() { - _typeSignatures = new NodeCache< - TypeDesc, - NativeLayoutTypeSignatureVertexNode - >(type => - { - return NativeLayoutTypeSignatureVertexNode.NewTypeSignatureVertexNode( - _factory, - type - ); - }); + _typeSignatures = new NodeCache( + type => + { + return NativeLayoutTypeSignatureVertexNode.NewTypeSignatureVertexNode( + _factory, + type + ); + } + ); _methodSignatures = new NodeCache< MethodSignature, diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs index cd3149a97d2..b716f45c98e 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs @@ -202,21 +202,20 @@ private void CreateNodeCaches() _inlinedThreadStatiscNode = new ThreadStaticsNode(_inlinedThreadStatics, this); } - _typeThreadStaticIndices = new NodeCache< - MetadataType, - TypeThreadStaticIndexNode - >(type => - { - if ( - _inlinedThreadStatics.IsComputed() - && _inlinedThreadStatics.GetOffsets().ContainsKey(type) - ) + _typeThreadStaticIndices = new NodeCache( + type => { - return new TypeThreadStaticIndexNode(type, _inlinedThreadStatiscNode); - } + if ( + _inlinedThreadStatics.IsComputed() + && _inlinedThreadStatics.GetOffsets().ContainsKey(type) + ) + { + return new TypeThreadStaticIndexNode(type, _inlinedThreadStatiscNode); + } - return new TypeThreadStaticIndexNode(type, null); - }); + return new TypeThreadStaticIndexNode(type, null); + } + ); _GCStaticEETypes = new NodeCache( (GCPointerMap gcMap) => @@ -291,13 +290,12 @@ entrypoint is TentativeMethodNode tentative _unboxingStubs = new NodeCache(CreateUnboxingStubNode); - _methodAssociatedData = new NodeCache< - IMethodNode, - MethodAssociatedDataNode - >(methodNode => - { - return new MethodAssociatedDataNode(methodNode); - }); + _methodAssociatedData = new NodeCache( + methodNode => + { + return new MethodAssociatedDataNode(methodNode); + } + ); _fatFunctionPointers = new NodeCache(method => { @@ -314,26 +312,24 @@ entrypoint is TentativeMethodNode tentative return new GenericVirtualMethodImplNode(method); }); - _genericMethodEntries = new NodeCache< - MethodDesc, - GenericMethodsHashtableEntryNode - >(method => - { - return new GenericMethodsHashtableEntryNode(method); - }); + _genericMethodEntries = new NodeCache( + method => + { + return new GenericMethodsHashtableEntryNode(method); + } + ); _gvmTableEntries = new NodeCache(type => { return new TypeGVMEntriesNode(type); }); - _delegateTargetMethods = new NodeCache< - MethodDesc, - DelegateTargetVirtualMethodNode - >(method => - { - return new DelegateTargetVirtualMethodNode(method); - }); + _delegateTargetMethods = new NodeCache( + method => + { + return new DelegateTargetVirtualMethodNode(method); + } + ); _reflectedMethods = new NodeCache(method => { @@ -428,26 +424,27 @@ entrypoint is TentativeMethodNode tentative ); }); - _frozenConstructedRuntimeTypeNodes = new NodeCache< - TypeDesc, - FrozenRuntimeTypeNode - >(key => - { - return new FrozenRuntimeTypeNode(key, constructed: true); - }); + _frozenConstructedRuntimeTypeNodes = new NodeCache( + key => + { + return new FrozenRuntimeTypeNode(key, constructed: true); + } + ); _frozenNecessaryRuntimeTypeNodes = new NodeCache(key => { return new FrozenRuntimeTypeNode(key, constructed: false); }); - _interfaceDispatchCells = new NodeCache< - DispatchCellKey, - InterfaceDispatchCellNode - >(callSiteCell => - { - return new InterfaceDispatchCellNode(callSiteCell.Target, callSiteCell.CallsiteId); - }); + _interfaceDispatchCells = new NodeCache( + callSiteCell => + { + return new InterfaceDispatchCellNode( + callSiteCell.Target, + callSiteCell.CallsiteId + ); + } + ); _interfaceDispatchMaps = new NodeCache( (TypeDesc type) => @@ -541,13 +538,12 @@ entrypoint is TentativeMethodNode tentative } ); - _delegateMarshalingDataNodes = new NodeCache< - DefType, - DelegateMarshallingDataNode - >(type => - { - return new DelegateMarshallingDataNode(type); - }); + _delegateMarshalingDataNodes = new NodeCache( + type => + { + return new DelegateMarshallingDataNode(type); + } + ); _structMarshalingDataNodes = new NodeCache(type => { @@ -595,13 +591,12 @@ entrypoint is TentativeMethodNode tentative return new ModuleMetadataNode(module); }); - _inlineableStringResources = new NodeCache< - EcmaModule, - InlineableStringsResourceNode - >(module => - { - return new InlineableStringsResourceNode(module); - }); + _inlineableStringResources = new NodeCache( + module => + { + return new InlineableStringsResourceNode(module); + } + ); _customAttributesWithMetadata = new NodeCache< ReflectableCustomAttribute, diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs b/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs index 7815566f288..3b56daa23b5 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.DependencyAnalysisFramework/DependencyAnalyzer.cs @@ -272,7 +272,9 @@ out storedDependencySet ) { storedDependencySet = - new HashSet.CombinedDependencyListEntry>(); + new HashSet.CombinedDependencyListEntry>( + + ); _conditional_dependency_store.Add( dependency.OtherReasonNode, storedDependencySet diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs b/runtime/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs index 70e8aa1c7e8..8f36ff6c861 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs @@ -1549,11 +1549,10 @@ public sealed override int GetHashCode() internal override void Save(NativeWriter writer) { Debug.Assert( - Value.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.ConstantStringValue - || handle.HandleType == HandleType.ConstantReferenceValue + Value.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.ConstantStringValue + || handle.HandleType == HandleType.ConstantReferenceValue ) ); writer.Write(Value); @@ -2088,41 +2087,40 @@ internal override void Save(NativeWriter writer) ); writer.Write(Constructor); Debug.Assert( - FixedArguments.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ConstantBooleanArray - || handle.HandleType == HandleType.ConstantBooleanValue - || handle.HandleType == HandleType.ConstantByteArray - || handle.HandleType == HandleType.ConstantByteValue - || handle.HandleType == HandleType.ConstantCharArray - || handle.HandleType == HandleType.ConstantCharValue - || handle.HandleType == HandleType.ConstantDoubleArray - || handle.HandleType == HandleType.ConstantDoubleValue - || handle.HandleType == HandleType.ConstantEnumArray - || handle.HandleType == HandleType.ConstantHandleArray - || handle.HandleType == HandleType.ConstantInt16Array - || handle.HandleType == HandleType.ConstantInt16Value - || handle.HandleType == HandleType.ConstantInt32Array - || handle.HandleType == HandleType.ConstantInt32Value - || handle.HandleType == HandleType.ConstantInt64Array - || handle.HandleType == HandleType.ConstantInt64Value - || handle.HandleType == HandleType.ConstantReferenceValue - || handle.HandleType == HandleType.ConstantSByteArray - || handle.HandleType == HandleType.ConstantSByteValue - || handle.HandleType == HandleType.ConstantSingleArray - || handle.HandleType == HandleType.ConstantSingleValue - || handle.HandleType == HandleType.ConstantStringArray - || handle.HandleType == HandleType.ConstantStringValue - || handle.HandleType == HandleType.ConstantUInt16Array - || handle.HandleType == HandleType.ConstantUInt16Value - || handle.HandleType == HandleType.ConstantUInt32Array - || handle.HandleType == HandleType.ConstantUInt32Value - || handle.HandleType == HandleType.ConstantUInt64Array - || handle.HandleType == HandleType.ConstantUInt64Value + FixedArguments.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ConstantBooleanArray + || handle.HandleType == HandleType.ConstantBooleanValue + || handle.HandleType == HandleType.ConstantByteArray + || handle.HandleType == HandleType.ConstantByteValue + || handle.HandleType == HandleType.ConstantCharArray + || handle.HandleType == HandleType.ConstantCharValue + || handle.HandleType == HandleType.ConstantDoubleArray + || handle.HandleType == HandleType.ConstantDoubleValue + || handle.HandleType == HandleType.ConstantEnumArray + || handle.HandleType == HandleType.ConstantHandleArray + || handle.HandleType == HandleType.ConstantInt16Array + || handle.HandleType == HandleType.ConstantInt16Value + || handle.HandleType == HandleType.ConstantInt32Array + || handle.HandleType == HandleType.ConstantInt32Value + || handle.HandleType == HandleType.ConstantInt64Array + || handle.HandleType == HandleType.ConstantInt64Value + || handle.HandleType == HandleType.ConstantReferenceValue + || handle.HandleType == HandleType.ConstantSByteArray + || handle.HandleType == HandleType.ConstantSByteValue + || handle.HandleType == HandleType.ConstantSingleArray + || handle.HandleType == HandleType.ConstantSingleValue + || handle.HandleType == HandleType.ConstantStringArray + || handle.HandleType == HandleType.ConstantStringValue + || handle.HandleType == HandleType.ConstantUInt16Array + || handle.HandleType == HandleType.ConstantUInt16Value + || handle.HandleType == HandleType.ConstantUInt32Array + || handle.HandleType == HandleType.ConstantUInt32Value + || handle.HandleType == HandleType.ConstantUInt64Array + || handle.HandleType == HandleType.ConstantUInt64Value ) ); writer.Write(FixedArguments); @@ -2577,13 +2575,12 @@ internal override void Save(NativeWriter writer) writer.Write(Kind); writer.Write(Name); Debug.Assert( - Constraints.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + Constraints.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(Constraints); @@ -2853,13 +2850,12 @@ internal override void Save(NativeWriter writer) ); writer.Write(Method); Debug.Assert( - GenericTypeArguments.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + GenericTypeArguments.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(GenericTypeArguments); @@ -3026,24 +3022,22 @@ internal override void Save(NativeWriter writer) ); writer.Write(ReturnType); Debug.Assert( - Parameters.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + Parameters.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(Parameters); Debug.Assert( - VarArgParameters.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + VarArgParameters.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(VarArgParameters); @@ -3881,13 +3875,12 @@ internal override void Save(NativeWriter writer) ); writer.Write(Type); Debug.Assert( - Parameters.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + Parameters.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(Parameters); @@ -4437,12 +4430,11 @@ internal override void Save(NativeWriter writer) writer.Write(Events); writer.Write(GenericParameters); Debug.Assert( - Interfaces.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification + Interfaces.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification ) ); writer.Write(Interfaces); @@ -4606,13 +4598,12 @@ internal override void Save(NativeWriter writer) ); writer.Write(GenericType); Debug.Assert( - GenericTypeArguments.TrueForAll( - handle => - handle == null - || handle.HandleType == HandleType.TypeDefinition - || handle.HandleType == HandleType.TypeReference - || handle.HandleType == HandleType.TypeSpecification - || handle.HandleType == HandleType.ModifiedType + GenericTypeArguments.TrueForAll(handle => + handle == null + || handle.HandleType == HandleType.TypeDefinition + || handle.HandleType == HandleType.TypeReference + || handle.HandleType == HandleType.TypeSpecification + || handle.HandleType == HandleType.ModifiedType ) ); writer.Write(GenericTypeArguments); diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs index a60d55e9490..dcd16887faf 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/CodeGen/ReadyToRunObjectWriter.cs @@ -221,11 +221,8 @@ public void EmitPortableExecutable() _nodeFactory.Target, _nodeFactory.ImageBase ); - peIdProvider = new Func, BlobContentId>( - content => - BlobContentId.FromHash( - CryptographicHashProvider.ComputeSourceHash(content) - ) + peIdProvider = new Func, BlobContentId>(content => + BlobContentId.FromHash(CryptographicHashProvider.ComputeSourceHash(content)) ); timeDateStamp = null; r2rHeaderExportSymbol = _nodeFactory.Header; diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodFixupSignature.cs b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodFixupSignature.cs index f3f0626aa27..71a2b88c6e9 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodFixupSignature.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/MethodFixupSignature.cs @@ -70,7 +70,9 @@ protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFact { list = list - ?? new DependencyAnalysisFramework.DependencyNodeCore.DependencyList(); + ?? new DependencyAnalysisFramework.DependencyNodeCore.DependencyList( + + ); try { factory.DetectGenericCycles(_method.Method, canonMethod); diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/MapFileBuilder.cs b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/MapFileBuilder.cs index b1d7a26205c..48f68e2662e 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/MapFileBuilder.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/MapFileBuilder.cs @@ -164,8 +164,9 @@ private void WriteNodeTypeStatisticsCsv(StreamWriter writer) private void WriteRelocTypeStatistics(StreamWriter writer) { - KeyValuePair[] relocTypeCounts = - _outputInfoBuilder.RelocCounts.ToArray(); + KeyValuePair[] relocTypeCounts = _outputInfoBuilder.RelocCounts.ToArray( + + ); Array.Sort(relocTypeCounts, (a, b) => b.Value.CompareTo(a.Value)); WriteTitle(writer, "Reloc Type Statistics"); diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/ProfileFileBuilder.cs b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/ProfileFileBuilder.cs index bd95e7adc4c..fe01c1a454b 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/ProfileFileBuilder.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.ReadyToRun/ObjectWriter/ProfileFileBuilder.cs @@ -106,11 +106,11 @@ public void SaveProfile(string profileFileName) callCount, callCount * percentFactor ); - int resolvedPairCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.Unresolved ? 0 : 1 + int resolvedPairCount = _callInfo.Sum(info => + info.CallType == CrossPageCall.Unresolved ? 0 : 1 ); - int resolvedCallCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.Unresolved ? 0 : info.CallCount + int resolvedCallCount = _callInfo.Sum(info => + info.CallType == CrossPageCall.Unresolved ? 0 : info.CallCount ); writer.WriteLine( "RESOLVED ENTRIES | {0,10} | {1,10} | {2,10:F2}", @@ -126,11 +126,10 @@ public void SaveProfile(string profileFileName) unresolvedCallCount, unresolvedCallCount * percentFactor ); - int nearPairCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.No ? 1 : 0 + int nearPairCount = _callInfo.Sum(info => info.CallType == CrossPageCall.No ? 1 : 0 ); - int nearCallCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.No ? info.CallCount : 0 + int nearCallCount = _callInfo.Sum(info => + info.CallType == CrossPageCall.No ? info.CallCount : 0 ); writer.WriteLine( "NEAR (INTRA-PAGE) CALLS | {0,10} | {1,10} | {2,10:F2}", @@ -138,11 +137,10 @@ public void SaveProfile(string profileFileName) nearCallCount, nearCallCount * percentFactor ); - int farPairCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.Yes ? 1 : 0 + int farPairCount = _callInfo.Sum(info => info.CallType == CrossPageCall.Yes ? 1 : 0 ); - int farCallCount = _callInfo.Sum( - info => info.CallType == CrossPageCall.Yes ? info.CallCount : 0 + int farCallCount = _callInfo.Sum(info => + info.CallType == CrossPageCall.Yes ? info.CallCount : 0 ); writer.WriteLine( "FAR (CROSS-PAGE) CALLS | {0,10} | {1,10} | {2,10:F2}", diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/Extensions/NiceIO.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/Extensions/NiceIO.cs index 0bc20b781b1..c233c643c14 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/Extensions/NiceIO.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/Extensions/NiceIO.cs @@ -173,8 +173,8 @@ public NPath RelativeTo(NPath path) NPath? commonParent = null; foreach (var parent in RecursiveParents) { - commonParent = path.RecursiveParents.FirstOrDefault( - otherParent => otherParent == parent + commonParent = path.RecursiveParents.FirstOrDefault(otherParent => + otherParent == parent ); if (commonParent != null) diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/AssemblyChecker.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/AssemblyChecker.cs index e3351f64c2b..724a3496fc7 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/AssemblyChecker.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/AssemblyChecker.cs @@ -344,12 +344,8 @@ protected virtual void VerifyModule(ModuleDefinition original, ModuleDefinition? var expected = original .Assembly.MainModule.AllDefinedTypes() - .SelectMany( - t => - GetCustomAttributeCtorValues( - t, - nameof(KeptModuleReferenceAttribute) - ) + .SelectMany(t => + GetCustomAttributeCtorValues(t, nameof(KeptModuleReferenceAttribute)) ) .ToArray(); @@ -517,10 +513,9 @@ protected virtual void VerifyTypeDefinitionKept(TypeDefinition original, TypeDes private void VerifyBaseType(TypeDefinition src, TypeDefinition linked) { string expectedBaseName; - var expectedBaseGenericAttr = src.CustomAttributes.FirstOrDefault( - w => - w.AttributeType.Name == nameof(KeptBaseTypeAttribute) - && w.ConstructorArguments.Count > 1 + var expectedBaseGenericAttr = src.CustomAttributes.FirstOrDefault(w => + w.AttributeType.Name == nameof(KeptBaseTypeAttribute) + && w.ConstructorArguments.Count > 1 ); if (expectedBaseGenericAttr != null) { @@ -550,8 +545,8 @@ private void VerifyBaseType(TypeDefinition src, TypeDefinition linked) private void VerifyInterfaces(TypeDefinition src, TypeDefinition linked) { var expectedInterfaces = new HashSet( - src.CustomAttributes.Where( - w => w.AttributeType.Name == nameof(KeptInterfaceAttribute) + src.CustomAttributes.Where(w => + w.AttributeType.Name == nameof(KeptInterfaceAttribute) ) .Select(FormatBaseOrInterfaceAttributeValue) ); @@ -716,8 +711,8 @@ TypeDesc linkedType } if ( - src.CustomAttributes.Any( - attr => attr.AttributeType.Name == nameof(KeptEventAddMethodAttribute) + src.CustomAttributes.Any(attr => + attr.AttributeType.Name == nameof(KeptEventAddMethodAttribute) ) ) { @@ -734,8 +729,8 @@ TypeDesc linkedType } if ( - src.CustomAttributes.Any( - attr => attr.AttributeType.Name == nameof(KeptEventRemoveMethodAttribute) + src.CustomAttributes.Any(attr => + attr.AttributeType.Name == nameof(KeptEventRemoveMethodAttribute) ) ) { @@ -792,8 +787,8 @@ bool compilerGenerated private void VerifyMemberBackingField(IMemberDefinition src, TypeDesc? linkedType) { - var keptBackingFieldAttribute = src.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.Name == nameof(KeptBackingFieldAttribute) + var keptBackingFieldAttribute = src.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == nameof(KeptBackingFieldAttribute) ); if (keptBackingFieldAttribute == null) return; @@ -1028,15 +1023,15 @@ public static void VerifyBodyProperties( Func getExpectFromSequenceAttribute ) { - var expectedSequenceAttribute = src.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.Name == sequenceAttributeName + var expectedSequenceAttribute = src.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == sequenceAttributeName ); var linkedValues = valueCollector(linked); var srcValues = valueCollector(src); if ( - src.CustomAttributes.Any( - attr => attr.AttributeType.Name == expectModifiedAttributeName + src.CustomAttributes.Any(attr => + attr.AttributeType.Name == expectModifiedAttributeName ) ) { @@ -1072,8 +1067,8 @@ private void VerifyReferences(AssemblyDefinition original, AssemblyDefinition li { var expected = original .MainModule.AllDefinedTypes() - .SelectMany( - t => GetCustomAttributeCtorValues(t, nameof(KeptReferenceAttribute)) + .SelectMany(t => + GetCustomAttributeCtorValues(t, nameof(KeptReferenceAttribute)) ) .Select(ReduceAssemblyFileNameOrNameToNameOnly) .ToArray(); @@ -1115,8 +1110,8 @@ private void VerifyResources(AssemblyDefinition original, AssemblyDefinition lin { var expectedResourceNames = original .MainModule.AllDefinedTypes() - .SelectMany( - t => GetCustomAttributeCtorValues(t, nameof(KeptResourceAttribute)) + .SelectMany(t => + GetCustomAttributeCtorValues(t, nameof(KeptResourceAttribute)) ) .ToList(); @@ -1149,13 +1144,12 @@ private void VerifyExportedTypes(AssemblyDefinition original, AssemblyDefinition { var expectedTypes = original .MainModule.AllDefinedTypes() - .SelectMany( - t => - GetCustomAttributeCtorValues( - t, - nameof(KeptExportedTypeAttribute) - ) - .Select(l => l?.FullName ?? "") + .SelectMany(t => + GetCustomAttributeCtorValues( + t, + nameof(KeptExportedTypeAttribute) + ) + .Select(l => l?.FullName ?? "") ) .ToArray(); @@ -1359,8 +1353,8 @@ original is TypeDefinition srcDefinition ) { var name = srcDefinition.Name.Substring(1, srcDefinition.Name.IndexOf('>') - 1); - var fixedField = srcDefinition.DeclaringType.Fields.FirstOrDefault( - f => f.Name == name + var fixedField = srcDefinition.DeclaringType.Fields.FirstOrDefault(f => + f.Name == name ); if (fixedField == null) Assert.Fail($"Could not locate original fixed field for {srcDefinition}"); @@ -1496,8 +1490,8 @@ IGenericParameterProvider linked if (checkNames) { if ( - srcp.CustomAttributes.Any( - attr => attr.AttributeType.Name == nameof(RemovedNameValueAttribute) + srcp.CustomAttributes.Any(attr => + attr.AttributeType.Name == nameof(RemovedNameValueAttribute) ) ) { @@ -1535,8 +1529,8 @@ private void VerifyParameters(IMethodSignature src, LinkedMethodEntity linked) if (checkNames) { if ( - srcp.CustomAttributes.Any( - attr => attr.AttributeType.Name == nameof(RemovedNameValueAttribute) + srcp.CustomAttributes.Any(attr => + attr.AttributeType.Name == nameof(RemovedNameValueAttribute) ) ) linked @@ -1591,13 +1585,13 @@ uint sourceValue ) { var removals = provider - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(RemovedPseudoAttributeAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(RemovedPseudoAttributeAttribute) ) .ToArray(); var adds = provider - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(AddedPseudoAttributeAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(AddedPseudoAttributeAttribute) ) .ToArray(); @@ -1618,9 +1612,8 @@ string attributeName where T : class { return provider - .CustomAttributes.Where( - w => - w.AttributeType.Name == attributeName && w.Constructor.Parameters.Count == 1 + .CustomAttributes.Where(w => + w.AttributeType.Name == attributeName && w.Constructor.Parameters.Count == 1 ) .Select(l => l.ConstructorArguments[0].Value as T); } @@ -1924,13 +1917,12 @@ Action assertExpectedAttribute return; } - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => m.Name == memberName ); if (linkedProperty == null) Assert.Fail( @@ -1941,13 +1933,13 @@ Action assertExpectedAttribute return; } - var originalMethodMember = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var originalMethodMember = originalType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var linkedMethod = linkedType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (linkedMethod == null) Assert.Fail( @@ -1989,8 +1981,8 @@ private void VerifyCustomAttributeKept( string expectedAttributeTypeName ) { - var match = provider.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.FullName == expectedAttributeTypeName + var match = provider.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.FullName == expectedAttributeTypeName ); if (match == null) Assert.Fail( @@ -2003,8 +1995,8 @@ private void VerifyCustomAttributeRemoved( string expectedAttributeTypeName ) { - var match = provider.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.FullName == expectedAttributeTypeName + var match = provider.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.FullName == expectedAttributeTypeName ); if (match != null) Assert.Fail( @@ -2143,8 +2135,8 @@ var memberNameAttr in (CustomAttributeArgument[]) // We will find the matching type from the original assembly first that way we can confirm // that the name defined in the attribute corresponds to a member that actually existed - var originalFieldMember = originalType.Fields.FirstOrDefault( - m => m.Name == memberName + var originalFieldMember = originalType.Fields.FirstOrDefault(m => + m.Name == memberName ); if (originalFieldMember != null) { @@ -2157,13 +2149,13 @@ var memberNameAttr in (CustomAttributeArgument[]) continue; } - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (linkedProperty != null) Assert.Fail( @@ -2173,13 +2165,13 @@ var memberNameAttr in (CustomAttributeArgument[]) continue; } - var originalMethodMember = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var originalMethodMember = originalType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var linkedMethod = linkedType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (linkedMethod != null) Assert.Fail( @@ -2256,13 +2248,12 @@ protected virtual bool TryVerifyKeptMemberInAssemblyAsProperty( TypeDefinition linkedType ) { - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => m.Name == memberName ); if (linkedProperty == null) Assert.Fail( @@ -2298,13 +2289,11 @@ protected virtual bool TryVerifyKeptMemberInAssemblyAsMethod( out MethodDefinition? linkedMethod ) { - originalMethod = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + originalMethod = originalType.Methods.FirstOrDefault(m => m.GetSignature() == memberName ); if (originalMethod != null) { - linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + linkedMethod = linkedType.Methods.FirstOrDefault(m => m.GetSignature() == memberName ); if (linkedMethod == null) Assert.Fail( diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCollector.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCollector.cs index 17620a4e729..c331c271ac7 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCollector.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCollector.cs @@ -99,16 +99,16 @@ public IEnumerable AllSourceFiles() // This makes life a little easier when writing these supporting files as it removes some constraints you would previously have // had to follow such as ensuring a class exists that matches the file name and putting [NotATestCase] on that class if ( - relativeParents.RecursiveParents.Any( - p => p.Elements.Any() && p.FileName == "Dependencies" + relativeParents.RecursiveParents.Any(p => + p.Elements.Any() && p.FileName == "Dependencies" ) ) continue; // Magic: Anything in a directory named Individual is expected to be ran by it's own [Test] rather than as part of [TestCaseSource] if ( - relativeParents.RecursiveParents.Any( - p => p.Elements.Any() && p.FileName == "Individual" + relativeParents.RecursiveParents.Any(p => + p.Elements.Any() && p.FileName == "Individual" ) ) continue; @@ -165,14 +165,13 @@ private bool CreateCase( } // Verify the class as a static main method - var mainMethod = typeDefinition.Methods.FirstOrDefault( - m => - m.Name - == ( - typeDefinition.FullName == "Program" - ? "
$" // Compiler-generated Main for top-level statements - : "Main" - ) + var mainMethod = typeDefinition.Methods.FirstOrDefault(m => + m.Name + == ( + typeDefinition.FullName == "Program" + ? "
$" // Compiler-generated Main for top-level statements + : "Main" + ) ); if (mainMethod == null) diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCompiler.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCompiler.cs index ab21cf7446f..86584068494 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCompiler.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseCompiler.cs @@ -136,8 +136,8 @@ NPath[] resources .ToArray(); var allReferences = references .Concat( - setupCompileInfo.References?.Select( - p => MakeSupportingAssemblyReferencePathAbsolute(outputDirectory, p) + setupCompileInfo.References?.Select(p => + MakeSupportingAssemblyReferencePathAbsolute(outputDirectory, p) ) ?? Array.Empty() ) .ToArray(); @@ -383,8 +383,8 @@ protected virtual NPath CompileCSharpAssemblyWithRoslyn(CompilerOptions options) ? null : options.OutputPath.ChangeExtension(".pdb").ToString(); - var syntaxTrees = options.SourceFiles.Select( - p => CSharpSyntaxTree.ParseText(text: p.ReadAllText(), options: parseOptions) + var syntaxTrees = options.SourceFiles.Select(p => + CSharpSyntaxTree.ParseText(text: p.ReadAllText(), options: parseOptions) ); var compilation = CSharpCompilation.Create( diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseMetadataProvider.cs b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseMetadataProvider.cs index e6ba627cf8a..3e662ecd37e 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseMetadataProvider.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.Trimming.Tests/TestCasesRunner/TestCaseMetadataProvider.cs @@ -69,8 +69,8 @@ public virtual TestCaseLinkerOptions GetLinkerOptions(NPath inputPath) }; foreach ( - var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerActionAttribute) + var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerActionAttribute) ) ) { @@ -79,8 +79,8 @@ var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where( } foreach ( - var descFile in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerDescriptorFile) + var descFile in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerDescriptorFile) ) ) { @@ -90,8 +90,8 @@ var descFile in _testCaseTypeDefinition.CustomAttributes.Where( } foreach ( - var subsFile in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerSubstitutionFileAttribute) + var subsFile in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerSubstitutionFileAttribute) ) ) { @@ -101,8 +101,8 @@ var subsFile in _testCaseTypeDefinition.CustomAttributes.Where( } foreach ( - var linkAttrFile in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkAttributesFile) + var linkAttrFile in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkAttributesFile) ) ) { @@ -112,8 +112,8 @@ var linkAttrFile in _testCaseTypeDefinition.CustomAttributes.Where( } foreach ( - var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerArgumentAttribute) + var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerArgumentAttribute) ) ) { @@ -155,8 +155,8 @@ var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where( public virtual IEnumerable GetResponseFiles() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerResponseFileAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerResponseFileAttribute) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -164,8 +164,8 @@ public virtual IEnumerable GetResponseFiles() public virtual IEnumerable GetDescriptorFiles() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerDescriptorFile) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerDescriptorFile) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -173,8 +173,8 @@ public virtual IEnumerable GetDescriptorFiles() public virtual IEnumerable GetSubstitutionFiles() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkerSubstitutionFileAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkerSubstitutionFileAttribute) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -182,8 +182,8 @@ public virtual IEnumerable GetSubstitutionFiles() public virtual IEnumerable GetLinkAttributesFiles() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupLinkAttributesFile) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupLinkAttributesFile) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -191,8 +191,8 @@ public virtual IEnumerable GetLinkAttributesFiles() public IEnumerable GetDeleteBefore() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(DeleteBeforeAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(DeleteBeforeAttribute) ) .Select(attr => (string)attr.ConstructorArguments[0].Value); } @@ -219,9 +219,8 @@ public virtual IEnumerable GetExtraLinkerReferences() public virtual bool LinkPublicAndFamily() { - return _testCaseTypeDefinition.CustomAttributes.FirstOrDefault( - attr => - attr.AttributeType.Name == nameof(SetupLinkerLinkPublicAndFamilyAttribute) + return _testCaseTypeDefinition.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == nameof(SetupLinkerLinkPublicAndFamilyAttribute) ) != null; } } diff --git a/runtime/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs b/runtime/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs index 53f4eba4613..b528a0d8201 100644 --- a/runtime/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs +++ b/runtime/src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/SignatureTests.cs @@ -209,8 +209,8 @@ public void TestSignatureMatches() IEnumerable derivedClassMethods = derivedClassType .GetMethods() .Where(m => string.Equals(m.Name, "Method")); - IEnumerable matches = derivedClassMethods.Select( - m => matchingSignature.Equals(m.Signature) + IEnumerable matches = derivedClassMethods.Select(m => + matchingSignature.Equals(m.Signature) ); int matchCount = matches.Select(b => b ? 1 : 0).Sum(); Assert.Equal(1, matchCount); diff --git a/runtime/src/coreclr/tools/aot/crossgen2/Program.cs b/runtime/src/coreclr/tools/aot/crossgen2/Program.cs index 0d2037eaa08..a62ca5cb789 100644 --- a/runtime/src/coreclr/tools/aot/crossgen2/Program.cs +++ b/runtime/src/coreclr/tools/aot/crossgen2/Program.cs @@ -760,8 +760,9 @@ out ReadyToRunXmlRootProvider xmlProvider ); } - compositeImageSettings.PublicKey = - compositeStrongNameKey.ToImmutableArray(); + compositeImageSettings.PublicKey = compositeStrongNameKey.ToImmutableArray( + + ); } // diff --git a/runtime/src/coreclr/tools/dotnet-pgo/MethodMemoryMap.cs b/runtime/src/coreclr/tools/dotnet-pgo/MethodMemoryMap.cs index ba28e6ccdec..cbf3d1130bf 100644 --- a/runtime/src/coreclr/tools/dotnet-pgo/MethodMemoryMap.cs +++ b/runtime/src/coreclr/tools/dotnet-pgo/MethodMemoryMap.cs @@ -228,7 +228,9 @@ out MemoryRegionInfo inf { // Associate NativeToILMap with MethodLoad event found Memory Regions foreach ( - MethodILToNativeMapTraceData e in p.EventsInProcess.ByEventType() + MethodILToNativeMapTraceData e in p.EventsInProcess.ByEventType( + + ) ) { if ( diff --git a/runtime/src/coreclr/tools/dotnet-pgo/Program.cs b/runtime/src/coreclr/tools/dotnet-pgo/Program.cs index de61543c01d..41bb4a7ed17 100644 --- a/runtime/src/coreclr/tools/dotnet-pgo/Program.cs +++ b/runtime/src/coreclr/tools/dotnet-pgo/Program.cs @@ -751,11 +751,9 @@ GetLikelyClassResult result2 List typeHandleHistogramCallSites = prof1 .SchemaData.Concat(prof2.SchemaData) - .Where( - e => - e.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass - || e.InstrumentationKind - == PgoInstrumentationKind.HandleHistogramTypes + .Where(e => + e.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass + || e.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes ) .Select(e => e.ILOffset) .Distinct() @@ -1015,34 +1013,28 @@ private static void PrintMibcStats(ProfileData data) PrintOutput( $"# Methods with 64-bit edge counts: {profiledMethods.Count(spd => spd.SchemaData.Any(elem => elem.InstrumentationKind == PgoInstrumentationKind.EdgeLongCount))}" ); - int numTypeHandleHistograms = profiledMethods.Sum( - spd => - spd.SchemaData.Count( - elem => - elem.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes - ) + int numTypeHandleHistograms = profiledMethods.Sum(spd => + spd.SchemaData.Count(elem => + elem.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes + ) ); - int methodsWithTypeHandleHistograms = profiledMethods.Count( - spd => - spd.SchemaData.Any( - elem => - elem.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes - ) + int methodsWithTypeHandleHistograms = profiledMethods.Count(spd => + spd.SchemaData.Any(elem => + elem.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes + ) ); PrintOutput( $"# Type handle histograms: {numTypeHandleHistograms} in {methodsWithTypeHandleHistograms} methods" ); - int numGetLikelyClass = profiledMethods.Sum( - spd => - spd.SchemaData.Count( - elem => elem.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass - ) + int numGetLikelyClass = profiledMethods.Sum(spd => + spd.SchemaData.Count(elem => + elem.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass + ) ); - int methodsWithGetLikelyClass = profiledMethods.Count( - spd => - spd.SchemaData.Any( - elem => elem.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass - ) + int methodsWithGetLikelyClass = profiledMethods.Count(spd => + spd.SchemaData.Any(elem => + elem.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass + ) ); PrintOutput( $"# GetLikelyClass data: {numGetLikelyClass} in {methodsWithGetLikelyClass} methods" @@ -1051,10 +1043,9 @@ private static void PrintMibcStats(ProfileData data) var histogramCallSites = new List<(MethodProfileData mpd, int ilOffset)>(); foreach (var mpd in profiledMethods) { - var sites = mpd.SchemaData.Where( - e => - e.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes - || e.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass + var sites = mpd.SchemaData.Where(e => + e.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes + || e.InstrumentationKind == PgoInstrumentationKind.GetLikelyClass ) .Select(e => e.ILOffset) .Distinct(); @@ -1063,8 +1054,8 @@ private static void PrintMibcStats(ProfileData data) } int CountGetLikelyClass(Func predicate) => - histogramCallSites.Count( - t => predicate(GetLikelyClass(t.mpd.SchemaData, t.ilOffset)) + histogramCallSites.Count(t => + predicate(GetLikelyClass(t.mpd.SchemaData, t.ilOffset)) ); PrintOutput( @@ -1102,8 +1093,8 @@ static bool CountersSumToZero(MethodProfileData data) => PrintCallsitesByLikelyClassesChart( profiledMethods .SelectMany(m => m.SchemaData) - .Where( - sd => sd.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes + .Where(sd => + sd.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes ) .Select(GetUniqueClassesSeen) .ToArray() @@ -1121,8 +1112,8 @@ static int GetUniqueClassesSeen(PgoSchemaElem se) PrintLikelihoodHistogram( profiledMethods .SelectMany(m => m.SchemaData) - .Where( - sd => sd.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes + .Where(sd => + sd.InstrumentationKind == PgoInstrumentationKind.HandleHistogramTypes ) .Select(GetLikelihoodOfMostPopularType) .ToArray() @@ -1302,8 +1293,8 @@ private int InnerProcessTraceFileMain() "Either a pid or process name from the following list must be specified" ); foreach ( - TraceProcess proc in traceLog.Processes.OrderByDescending( - proc => proc.CPUMSec + TraceProcess proc in traceLog.Processes.OrderByDescending(proc => + proc.CPUMSec ) ) { @@ -1412,7 +1403,9 @@ TraceProcess proc in traceLog.Processes.OrderByDescending( HashSet clrInstanceIds = new HashSet(); HashSet examinedClrInstanceIds = new HashSet(); foreach ( - var assemblyLoadTrace in p.EventsInProcess.ByEventType() + var assemblyLoadTrace in p.EventsInProcess.ByEventType( + + ) ) { if (examinedClrInstanceIds.Add(assemblyLoadTrace.ClrInstanceID)) @@ -1613,7 +1606,9 @@ out HashSet candidatePaths bool mismatch = false; bool mismatchHandled = false; foreach ( - DebugDirectoryEntry debugEntry in ecmaModule.PEReader.SafeReadDebugDirectory() + DebugDirectoryEntry debugEntry in ecmaModule.PEReader.SafeReadDebugDirectory( + + ) ) { if (debugEntry.Type == DebugDirectoryEntryType.CodeView) @@ -2120,7 +2115,9 @@ out MethodChunks perMethodChunks if (!hasLbr) { foreach ( - SampledProfileTraceData e in p.EventsInProcess.ByEventType() + SampledProfileTraceData e in p.EventsInProcess.ByEventType( + + ) ) { correlator.AttributeSamplesToIP(e.InstructionPointer, 1); @@ -2280,37 +2277,33 @@ out MethodChunks chunks if (sp != null && sp.AttributedSamples >= Get(_command.SpgoMinSamples)) { IEnumerable schema = sp.SmoothedSamples.Select( - kvp => - new PgoSchemaElem - { - InstrumentationKind = - kvp.Value > uint.MaxValue - ? PgoInstrumentationKind.BasicBlockLongCount - : PgoInstrumentationKind.BasicBlockIntCount, - ILOffset = kvp.Key.Start, - Count = 1, - DataLong = kvp.Value, - } + kvp => new PgoSchemaElem + { + InstrumentationKind = + kvp.Value > uint.MaxValue + ? PgoInstrumentationKind.BasicBlockLongCount + : PgoInstrumentationKind.BasicBlockIntCount, + ILOffset = kvp.Key.Start, + Count = 1, + DataLong = kvp.Value, + } ); bool includeFullGraphs = Get(_command.IncludeFullGraphs); if (includeFullGraphs) { schema = schema.Concat( - sp.SmoothedEdgeSamples.Select( - kvp => - new PgoSchemaElem - { - InstrumentationKind = - kvp.Value > uint.MaxValue - ? PgoInstrumentationKind.EdgeLongCount - : PgoInstrumentationKind.EdgeIntCount, - ILOffset = kvp.Key.Item1.Start, - Other = kvp.Key.Item2.Start, - Count = 1, - DataLong = kvp.Value - } - ) + sp.SmoothedEdgeSamples.Select(kvp => new PgoSchemaElem + { + InstrumentationKind = + kvp.Value > uint.MaxValue + ? PgoInstrumentationKind.EdgeLongCount + : PgoInstrumentationKind.EdgeIntCount, + ILOffset = kvp.Key.Item1.Start, + Other = kvp.Key.Item2.Start, + Count = 1, + DataLong = kvp.Value + }) ); } @@ -2321,24 +2314,22 @@ out MethodChunks chunks { var writtenBlocks = new HashSet( methodData - .InstrumentationData.Where( - elem => - elem.InstrumentationKind - == PgoInstrumentationKind.BasicBlockIntCount - || elem.InstrumentationKind - == PgoInstrumentationKind.BasicBlockLongCount + .InstrumentationData.Where(elem => + elem.InstrumentationKind + == PgoInstrumentationKind.BasicBlockIntCount + || elem.InstrumentationKind + == PgoInstrumentationKind.BasicBlockLongCount ) .Select(elem => elem.ILOffset) ); var writtenEdges = new HashSet<(int, int)>( methodData - .InstrumentationData.Where( - elem => - elem.InstrumentationKind - == PgoInstrumentationKind.EdgeIntCount - || elem.InstrumentationKind - == PgoInstrumentationKind.EdgeLongCount + .InstrumentationData.Where(elem => + elem.InstrumentationKind + == PgoInstrumentationKind.EdgeIntCount + || elem.InstrumentationKind + == PgoInstrumentationKind.EdgeLongCount ) .Select(elem => (elem.ILOffset, elem.Other)) ); @@ -2350,11 +2341,8 @@ out MethodChunks chunks ); Debug.Assert( writtenEdges.SetEquals( - sp.FlowGraph.BasicBlocks.SelectMany( - bb => - bb.Targets.Select( - bbTar => (bb.Start, bbTar.Start) - ) + sp.FlowGraph.BasicBlocks.SelectMany(bb => + bb.Targets.Select(bbTar => (bb.Start, bbTar.Start)) ) ) ); @@ -2379,16 +2367,16 @@ out MethodChunks chunks var config = new MibcConfig(); // Look for OS and Arch, e.g. "Windows" and "x64" - TraceEvent processInfo = p.EventsInProcess.Filter( - t => t.EventName == "ProcessInfo" + TraceEvent processInfo = p.EventsInProcess.Filter(t => + t.EventName == "ProcessInfo" ) .FirstOrDefault(); config.Os = processInfo?.PayloadByName("OSInformation")?.ToString(); config.Arch = processInfo?.PayloadByName("ArchInformation")?.ToString(); // Look for Sku, e.g. "CoreClr" - TraceEvent runtimeStart = p.EventsInProcess.Filter( - t => t.EventName == "Runtime/Start" + TraceEvent runtimeStart = p.EventsInProcess.Filter(t => + t.EventName == "Runtime/Start" ) .FirstOrDefault(); config.Runtime = runtimeStart?.PayloadByName("Sku")?.ToString(); diff --git a/runtime/src/coreclr/tools/dotnet-pgo/TraceRuntimeDescToTypeSystemDesc.cs b/runtime/src/coreclr/tools/dotnet-pgo/TraceRuntimeDescToTypeSystemDesc.cs index 2c3530b83b5..7e1941834f9 100644 --- a/runtime/src/coreclr/tools/dotnet-pgo/TraceRuntimeDescToTypeSystemDesc.cs +++ b/runtime/src/coreclr/tools/dotnet-pgo/TraceRuntimeDescToTypeSystemDesc.cs @@ -138,7 +138,9 @@ int clrInstanceID _clrInstanceID = clrInstanceID; foreach ( - var methodIDDetailsData in traceProcess.EventsInProcess.ByEventType() + var methodIDDetailsData in traceProcess.EventsInProcess.ByEventType( + + ) ) { MethodDescInfo currentInfo; @@ -294,7 +296,9 @@ var bulkTypeTrace in traceProcess.EventsInProcess.ByEventType assemblyToIsDynamic = new Dictionary(); foreach ( - var assemblyLoadTrace in _traceProcess.EventsInProcess.ByEventType() + var assemblyLoadTrace in _traceProcess.EventsInProcess.ByEventType( + + ) ) { assemblyToCLRInstanceIDMap[assemblyLoadTrace.AssemblyID] = diff --git a/runtime/src/coreclr/tools/r2rtest/BuildFolderSet.cs b/runtime/src/coreclr/tools/r2rtest/BuildFolderSet.cs index cef11270c2a..942774775ec 100644 --- a/runtime/src/coreclr/tools/r2rtest/BuildFolderSet.cs +++ b/runtime/src/coreclr/tools/r2rtest/BuildFolderSet.cs @@ -1625,8 +1625,8 @@ ProcessInfo executionProcess in executions[(int)runner.Index] private void WriteFoldersBlockedWithIssues(StreamWriter logWriter) { - IEnumerable blockedFolders = _buildFolders.Where( - folder => folder.IsBlockedWithIssue + IEnumerable blockedFolders = _buildFolders.Where(folder => + folder.IsBlockedWithIssue ); int blockedCount = blockedFolders.Count(); @@ -1799,8 +1799,8 @@ Dictionary crossgen "Crossgen conflicting results: {0}", crossgen.Count(kvp => kvp.Value == 2) ); - int matchCount = cpaot.Count( - kvp => crossgen.ContainsKey(kvp.Key) && crossgen[kvp.Key] == kvp.Value + int matchCount = cpaot.Count(kvp => + crossgen.ContainsKey(kvp.Key) && crossgen[kvp.Key] == kvp.Value ); int bothCount = cpaot.Count(kvp => crossgen.ContainsKey(kvp.Key)); logWriter.WriteLine("Objects queried by both: {0}", bothCount); @@ -1811,8 +1811,8 @@ Dictionary crossgen ); logWriter.WriteLine( "Mismatched results: {0}", - cpaot.Count( - kvp => crossgen.ContainsKey(kvp.Key) && crossgen[kvp.Key] != kvp.Value + cpaot.Count(kvp => + crossgen.ContainsKey(kvp.Key) && crossgen[kvp.Key] != kvp.Value ) ); logWriter.WriteLine( @@ -1829,11 +1829,10 @@ Dictionary crossgen logWriter, "CPAOT = TRUE / CROSSGEN = FALSE", cpaot - .Where( - kvp => - kvp.Value == 1 - && crossgen.ContainsKey(kvp.Key) - && crossgen[kvp.Key] == 0 + .Where(kvp => + kvp.Value == 1 + && crossgen.ContainsKey(kvp.Key) + && crossgen[kvp.Key] == 0 ) .Select(kvp => kvp.Key) ); @@ -1842,11 +1841,10 @@ Dictionary crossgen logWriter, "CPAOT = FALSE / CROSSGEN = TRUE", cpaot - .Where( - kvp => - kvp.Value == 0 - && crossgen.ContainsKey(kvp.Key) - && crossgen[kvp.Key] == 1 + .Where(kvp => + kvp.Value == 0 + && crossgen.ContainsKey(kvp.Key) + && crossgen[kvp.Key] == 1 ) .Select(kvp => kvp.Key) ); diff --git a/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs b/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs index 68803c6a9b0..67cca0707a6 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/PerAssemblyVersionResolutionMultipleFrameworks.cs @@ -195,21 +195,20 @@ protected override void RunTest( string frameworkWins ) { - var app = SharedState.CreateTestFrameworkReferenceApp( - b => - b.WithPackage( - TestVersionsPackage, - "1.0.0", - lib => - lib.WithAssemblyGroup( - null, - g => - g.WithAsset( - testAssemblyName + ".dll", - rf => rf.WithVersion(appAsmVersion, appFileVersion) - ) - ) - ) + var app = SharedState.CreateTestFrameworkReferenceApp(b => + b.WithPackage( + TestVersionsPackage, + "1.0.0", + lib => + lib.WithAssemblyGroup( + null, + g => + g.WithAsset( + testAssemblyName + ".dll", + rf => rf.WithVersion(appAsmVersion, appFileVersion) + ) + ) + ) ); if (runtimeConfigCustomizer is not null) { @@ -259,21 +258,20 @@ protected override void RunTest( string frameworkWins ) { - var component = SharedState.CreateComponentWithNoDependencies( - b => - b.WithPackage( - TestVersionsPackage, - "1.0.0", - lib => - lib.WithAssemblyGroup( - null, - g => - g.WithAsset( - testAssemblyName + ".dll", - rf => rf.WithVersion(appAsmVersion, appFileVersion) - ) - ) - ) + var component = SharedState.CreateComponentWithNoDependencies(b => + b.WithPackage( + TestVersionsPackage, + "1.0.0", + lib => + lib.WithAssemblyGroup( + null, + g => + g.WithAsset( + testAssemblyName + ".dll", + rf => rf.WithVersion(appAsmVersion, appFileVersion) + ) + ) + ) ); if (runtimeConfigCustomizer is not null) { diff --git a/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs b/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs index 910e435b53e..0ffc4f27d35 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/DependencyResolution/RidAssetResolution.cs @@ -1020,10 +1020,9 @@ protected override void RunTest( Action appCustomizer ) { - var component = SharedState.CreateComponentWithNoDependencies( - b => - b.WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p)) - .WithCustomizer(appCustomizer) + var component = SharedState.CreateComponentWithNoDependencies(b => + b.WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p)) + .WithCustomizer(appCustomizer) ); DotNetCli dotnet; @@ -1101,10 +1100,9 @@ protected override void RunTest( Action appCustomizer ) { - var component = SharedState.CreateComponentWithNoDependencies( - b => - b.WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p)) - .WithCustomizer(appCustomizer) + var component = SharedState.CreateComponentWithNoDependencies(b => + b.WithPackage("NativeDependency", "1.0.0", p => assetsCustomizer?.Invoke(p)) + .WithCustomizer(appCustomizer) ); TestApp app; diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/ComplexHierarchies.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/ComplexHierarchies.cs index 4e7c9ae3422..84358d23713 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/ComplexHierarchies.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/ComplexHierarchies.cs @@ -59,13 +59,12 @@ public SharedTestState() [Fact] public void TwoAppFrameworksOnTopOfMiddleWare() { - RunTest( - runtimeConfig => - runtimeConfig - .WithFramework(MicrosoftNETCoreApp, "5.1.0") - .WithFramework("MiddleWare", "2.1.0") - .WithFramework("SerializerWare", "3.0.1") - .WithFramework("OMWare", "7.3.1") + RunTest(runtimeConfig => + runtimeConfig + .WithFramework(MicrosoftNETCoreApp, "5.1.0") + .WithFramework("MiddleWare", "2.1.0") + .WithFramework("SerializerWare", "3.0.1") + .WithFramework("OMWare", "7.3.1") ) // https://github.com/dotnet/runtime/issues/71027 // This should pass just fine and resolve all frameworks correctly diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs index b122cfe57c5..8e53d2d8046 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/IncludedFrameworksSettings.cs @@ -22,11 +22,10 @@ public IncludedFrameworksSettings(SharedTestState sharedState) public void FrameworkAndIncludedFrameworksIsInvalid() { RunFrameworkDependentTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig - .WithFramework(MicrosoftNETCoreApp, "5.1.2") - .WithIncludedFramework(MicrosoftNETCoreApp, "5.1.2") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig + .WithFramework(MicrosoftNETCoreApp, "5.1.2") + .WithIncludedFramework(MicrosoftNETCoreApp, "5.1.2") ) ) .Should() @@ -40,9 +39,8 @@ public void FrameworkAndIncludedFrameworksIsInvalid() public void SelfContainedCanHaveIncludedFrameworks() { RunSelfContainedTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithIncludedFramework(MicrosoftNETCoreApp, "5.1.2") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithIncludedFramework(MicrosoftNETCoreApp, "5.1.2") ) ) .Should() @@ -54,8 +52,8 @@ public void SelfContainedCanHaveIncludedFrameworks() public void IncludedFrameworkMustSpecifyName() { RunSelfContainedTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithIncludedFramework(null, "5.1.2") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithIncludedFramework(null, "5.1.2") ) ) .Should() @@ -67,14 +65,13 @@ public void IncludedFrameworkMustSpecifyName() public void OtherPropertiesAreIgnoredOnIncludedFramework() { RunSelfContainedTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithIncludedFramework( - new RuntimeConfig.Framework(MicrosoftNETCoreApp, "5.1.2") - .WithApplyPatches(false) // Properties which are otherwise parsed on frameworks are ignored - .WithRollForward("invalid") // in case of included frameworks. (so invalid values will be accepted) - .WithRollForwardOnNoCandidateFx(42) - ) + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithIncludedFramework( + new RuntimeConfig.Framework(MicrosoftNETCoreApp, "5.1.2") + .WithApplyPatches(false) // Properties which are otherwise parsed on frameworks are ignored + .WithRollForward("invalid") // in case of included frameworks. (so invalid values will be accepted) + .WithRollForwardOnNoCandidateFx(42) + ) ) ) .Should() diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs index 3c61f070f88..4d1cdf6e23e 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardAndRollForwardOnNoCandidateFxSettings.cs @@ -113,8 +113,8 @@ bool passes { CommandResult result = RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") ) .With( RollForwardSetting(rollForwardLocation, Constants.RollForwardSetting.Minor) @@ -146,9 +146,8 @@ public void CollisionsOnCommandLine_RollForwardOnNoCandidateFx() { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .WithCommandLine( Constants.RollForwardSetting.CommandLineArgument, @@ -194,9 +193,8 @@ bool passes string requestedVersion = "5.0.0"; CommandResult result = RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, requestedVersion) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, requestedVersion) ) .With( RollForwardSetting(rollForwardLocation, Constants.RollForwardSetting.Major) diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs index af095bf9a64..3abff1dcad9 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFx.cs @@ -72,8 +72,8 @@ public SharedTestState() [Fact] public void ExactMatchOnRelease_NoSettings() { - RunTestWithOneFramework( - runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3") + RunTestWithOneFramework(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3"); } @@ -94,12 +94,11 @@ public void RollForwardToLatestPatch_RollForwardOnNoCandidateFx( bool? applyPatches ) { - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.0") + RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.0") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3"); } @@ -123,12 +122,11 @@ bool passes ) { string requestedVersion = "5.0.0"; - CommandResult result = RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + CommandResult result = RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ); if (passes) { @@ -160,12 +158,11 @@ bool passes ) { string requestedVersion = "4.1.0"; - CommandResult result = RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + CommandResult result = RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ); if (passes) { @@ -191,12 +188,11 @@ bool passes public void NeverRollBackOnRelease(int? rollForwardOnNoCandidateFx, bool? applyPatches) { string requestedVersion = "5.1.4"; - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ) .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } @@ -205,12 +201,11 @@ public void NeverRollBackOnRelease(int? rollForwardOnNoCandidateFx, bool? applyP [Fact] public void RollForwardDisabledOnCandidateFxAndDisabledApplyPatches_FailsToRollPatches() { - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(0) - .WithApplyPatches(false) - .WithFramework(MicrosoftNETCoreApp, "5.1.0") + RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(0) + .WithApplyPatches(false) + .WithFramework(MicrosoftNETCoreApp, "5.1.0") ) .Should() .Fail() @@ -223,12 +218,11 @@ public void RollForwardDisabledOnCandidateFxAndDisabledApplyPatches_FailsToRollP [Fact] public void RollForwardDisabledOnCandidateFxAndDisabledApplyPatches_MatchesExact() { - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(0) - .WithApplyPatches(false) - .WithFramework(MicrosoftNETCoreApp, "5.1.3") + RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(0) + .WithApplyPatches(false) + .WithFramework(MicrosoftNETCoreApp, "5.1.3") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3"); } @@ -239,11 +233,10 @@ public void RollForwardDisabledOnCandidateFxAndDisabledApplyPatches_MatchesExact public void RollForwardOnMinorDisabledOnNoCandidateFx_FailsToRoll() { string requestedVersion = "5.0.0"; - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(0) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + RunTestWithOneFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(0) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ) // Will still attempt roll forward to latest patch .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion) @@ -254,9 +247,8 @@ public void RollForwardOnMinorDisabledOnNoCandidateFx_FailsToRoll() [Fact] public void PreReleaseReference_CanRollToRelease() { - RunTestWithOneFramework( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.0-preview.1") + RunTestWithOneFramework(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.0-preview.1") ) .Should() .Pass() @@ -284,9 +276,8 @@ Func runtimeConfig [Fact] public void ExactMatchOnPreRelease_NoSettings() { - RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.2") + RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.2") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } @@ -297,9 +288,8 @@ public void ExactMatchOnPreRelease_NoSettings() [Fact] public void RollForwardToPreRelease_CanRollOnPatch() { - RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.2-preview.2") + RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.2-preview.2") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } @@ -316,12 +306,11 @@ public void RollForwardToPreRelease_CanRollOnPatch() [InlineData(2, true)] public void RollForwardToPreRelease(int? rollForwardOnNoCandidateFx, bool? applyPatches) { - RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.1") + RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.1") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } @@ -342,12 +331,11 @@ public void RollForwardToPreReleaseLatestPatch_RollForwardOnNoCandidateFx( bool? applyPatches ) { - RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.0") + RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.0") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "5.1.3-preview.2"); } @@ -369,12 +357,11 @@ bool passes ) { string requestedVersion = "5.0.0"; - CommandResult result = RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + CommandResult result = RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ); if (passes) { @@ -405,12 +392,11 @@ bool passes ) { string requestedVersion = "4.1.0"; - CommandResult result = RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + CommandResult result = RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ); if (passes) { @@ -436,12 +422,11 @@ bool passes public void NeverRollBackOnPreRelease(int? rollForwardOnNoCandidateFx, bool? applyPatches) { string requestedVersion = "5.1.3-preview.9"; - RunTestWithPreReleaseFramework( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, requestedVersion) + RunTestWithPreReleaseFramework(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, requestedVersion) ) .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); } @@ -495,12 +480,11 @@ public void RollForwardToLatestPatch_PicksLatestReleasePatch( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "4.1.1") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "4.1.1") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -522,12 +506,11 @@ public void RollForwardOnMinor_PicksLatestReleasePatch( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "4.0.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -549,12 +532,11 @@ public void RollForwardOnMinor_RollOverPreRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "4.4.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "4.4.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -576,12 +558,11 @@ public void RollForwardOnMajor_PicksLatestReleasePatch( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "3.0.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "3.0.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -605,12 +586,11 @@ public void RollForwardToPreReleaseToLatestPatch_FromRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.2") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.2") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -633,12 +613,11 @@ public void RollForwardToPreReleaseOnMinor_FromRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.0.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.0.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -661,12 +640,11 @@ public void RollForwardToPreReleaseOnMajor_FromRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "6.2.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "6.2.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -692,12 +670,11 @@ public void RollForwardToPreReleaseToClosestPreRelease_FromRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.2.2") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.2.2") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -720,12 +697,11 @@ public void RollForwardToClosestReleaseWithPreReleaseAvailable_FromRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "2.3.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "2.3.0") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -746,12 +722,11 @@ public void RollForwardToPreRelease_FromDifferentPreRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.1-preview.1") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.1-preview.1") ) .ShouldHaveResolvedFrameworkOrFailToFind(MicrosoftNETCoreApp, resolvedFramework); } @@ -773,12 +748,11 @@ public void RollForwardToPreRelease_ExactPreReleaseMatch( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.1") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.1") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, resolvedFramework); } @@ -797,12 +771,11 @@ public void RollForwardToPreRelease_FromSamePreRelease( string resolvedFramework ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, "5.1.3-preview.0") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, resolvedFramework); } @@ -820,11 +793,10 @@ public void RollForwardToLatestPatch_WithHigherPreReleasePresent( int? rollForwardOnNoCandidateFx ) { - RunTestWithManyVersions( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) - .WithFramework(MicrosoftNETCoreApp, "6.1.0") + RunTestWithManyVersions(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(rollForwardOnNoCandidateFx) + .WithFramework(MicrosoftNETCoreApp, "6.1.0") ) .ShouldHaveResolvedFramework(MicrosoftNETCoreApp, "6.1.1"); } diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs index 76a8caba546..22a23d8642e 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardOnNoCandidateFxSettings.cs @@ -26,16 +26,15 @@ public void Default() { string requestedVersion = "4.0.0"; RunTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, requestedVersion) + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, requestedVersion) ) ) .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); RunTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") ) ) .Should() @@ -53,9 +52,8 @@ public void AllLocations(SettingLocation location) { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardOnNoCandidateFxSetting(location, 2)) ) @@ -71,9 +69,8 @@ public void CommandLinePriority(SettingLocation settingLocation, bool commandLin { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 0)) .WithCommandLine( @@ -99,14 +96,13 @@ bool frameworkReferenceWins { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework( - new RuntimeConfig.Framework( - MicrosoftNETCoreApp, - "4.0.0" - ).WithRollForwardOnNoCandidateFx(2) - ) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework( + new RuntimeConfig.Framework( + MicrosoftNETCoreApp, + "4.0.0" + ).WithRollForwardOnNoCandidateFx(2) + ) ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 0)) ) @@ -125,11 +121,10 @@ public void RuntimeOptionsPriority(SettingLocation settingLocation, bool runtime { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(2) - .WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(2) + .WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 0)) ) @@ -148,9 +143,8 @@ public void EnvironmentPriority(SettingLocation settingLocation, bool envVariabl { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 0)) .WithEnvironment( @@ -178,24 +172,21 @@ bool innerReferenceWins { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework( - new RuntimeConfig.Framework(MiddleWare, "2.1.0") - ) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework( + new RuntimeConfig.Framework(MiddleWare, "2.1.0") + ) ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 1, MiddleWare)) - .WithDotnetCustomizer( - dotnetCustomizer => - dotnetCustomizer - .Framework(MiddleWare) - .RuntimeConfig( - runtimeConfig => - runtimeConfig - .WithRollForwardOnNoCandidateFx(2) - .GetFramework(MicrosoftNETCoreApp) - .Version = "4.0.0" - ) + .WithDotnetCustomizer(dotnetCustomizer => + dotnetCustomizer + .Framework(MiddleWare) + .RuntimeConfig(runtimeConfig => + runtimeConfig + .WithRollForwardOnNoCandidateFx(2) + .GetFramework(MicrosoftNETCoreApp) + .Version = "4.0.0" + ) ) ) .ShouldHaveResolvedFrameworkOrFailToFind( @@ -218,20 +209,17 @@ public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appW { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MiddleWare, "1.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MiddleWare, "1.0.0") ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 2, MiddleWare)) - .WithDotnetCustomizer( - dotnetCustomizer => - dotnetCustomizer - .Framework(MiddleWare) - .RuntimeConfig( - runtimeConfig => - runtimeConfig - .GetFramework(MicrosoftNETCoreApp) - .Version = "4.0.0" - ) + .WithDotnetCustomizer(dotnetCustomizer => + dotnetCustomizer + .Framework(MiddleWare) + .RuntimeConfig(runtimeConfig => + runtimeConfig.GetFramework(MicrosoftNETCoreApp).Version = + "4.0.0" + ) ) ) .ShouldHaveResolvedFrameworkOrFailToFind( @@ -254,23 +242,19 @@ public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework( - new RuntimeConfig.Framework(MiddleWare, "2.1.2") - ) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework( + new RuntimeConfig.Framework(MiddleWare, "2.1.2") + ) ) .With(RollForwardOnNoCandidateFxSetting(settingLocation, 0, MiddleWare)) - .WithDotnetCustomizer( - dotnetCustomizer => - dotnetCustomizer - .Framework(MiddleWare) - .RuntimeConfig( - runtimeConfig => - runtimeConfig - .GetFramework(MicrosoftNETCoreApp) - .Version = "5.0.0" - ) + .WithDotnetCustomizer(dotnetCustomizer => + dotnetCustomizer + .Framework(MiddleWare) + .RuntimeConfig(runtimeConfig => + runtimeConfig.GetFramework(MicrosoftNETCoreApp).Version = + "5.0.0" + ) ) ) .ShouldHaveResolvedFrameworkOrFailToFind( diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseAndPreRelease.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseAndPreRelease.cs index b0018423165..d11fada63de 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseAndPreRelease.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardReleaseAndPreRelease.cs @@ -328,11 +328,10 @@ private CommandResult RunTest( SharedState.DotNetWithNETCoreAppReleaseAndPreRelease, SharedState.FrameworkReferenceApp, new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig - .WithApplyPatches(applyPatches) - .WithFramework(MicrosoftNETCoreApp, frameworkReferenceVersion) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig + .WithApplyPatches(applyPatches) + .WithFramework(MicrosoftNETCoreApp, frameworkReferenceVersion) ) // Using command line, so that it's possible to mix rollForward and applyPatches .With(RollForwardSetting(SettingLocation.CommandLine, rollForward)) diff --git a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs index b2f3f8071c1..3443027ea87 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/FrameworkResolution/RollForwardSettings.cs @@ -26,15 +26,15 @@ public void Default() { string requestedVersion = "4.0.0"; RunTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) ) .ShouldFailToFindCompatibleFrameworkVersion(MicrosoftNETCoreApp, requestedVersion); RunTest( - new TestSettings().WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") + new TestSettings().WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.0.0") ) ) .Should() @@ -52,9 +52,8 @@ public void InvalidValue(SettingLocation settingLocation) { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardSetting(settingLocation, "InvalidValue")) ) @@ -128,9 +127,8 @@ private void ValidateValueIgnoresCase(SettingLocation settingLocation, string ro { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "5.1.3") ) .With(RollForwardSetting(settingLocation, value)) ) @@ -154,8 +152,8 @@ public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appW { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => runtimeConfig.WithFramework(MiddleWare, "1.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MiddleWare, "1.0.0") ) .With( RollForwardSetting( @@ -164,16 +162,13 @@ public void NoInheritance_MoreRelaxed(SettingLocation settingLocation, bool appW MiddleWare ) ) - .WithDotnetCustomizer( - dotnetCustomizer => - dotnetCustomizer - .Framework(MiddleWare) - .RuntimeConfig( - runtimeConfig => - runtimeConfig - .GetFramework(MicrosoftNETCoreApp) - .Version = "4.0.0" - ) + .WithDotnetCustomizer(dotnetCustomizer => + dotnetCustomizer + .Framework(MiddleWare) + .RuntimeConfig(runtimeConfig => + runtimeConfig.GetFramework(MicrosoftNETCoreApp).Version = + "4.0.0" + ) ) ) .ShouldHaveResolvedFrameworkOrFailToFind( @@ -196,11 +191,10 @@ public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework( - new RuntimeConfig.Framework(MiddleWare, "2.1.2") - ) + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework( + new RuntimeConfig.Framework(MiddleWare, "2.1.2") + ) ) .With( RollForwardSetting( @@ -209,16 +203,13 @@ public void NoInheritance_MoreRestrictive(SettingLocation settingLocation, bool MiddleWare ) ) - .WithDotnetCustomizer( - dotnetCustomizer => - dotnetCustomizer - .Framework(MiddleWare) - .RuntimeConfig( - runtimeConfig => - runtimeConfig - .GetFramework(MicrosoftNETCoreApp) - .Version = "5.0.0" - ) + .WithDotnetCustomizer(dotnetCustomizer => + dotnetCustomizer + .Framework(MiddleWare) + .RuntimeConfig(runtimeConfig => + runtimeConfig.GetFramework(MicrosoftNETCoreApp).Version = + "5.0.0" + ) ) ) .ShouldHaveResolvedFrameworkOrFailToFind( @@ -237,9 +228,8 @@ public void AllLocations(SettingLocation location) { RunTest( new TestSettings() - .WithRuntimeConfigCustomizer( - runtimeConfig => - runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") + .WithRuntimeConfigCustomizer(runtimeConfig => + runtimeConfig.WithFramework(MicrosoftNETCoreApp, "4.0.0") ) .With(RollForwardSetting(location, Constants.RollForwardSetting.Major)) ) diff --git a/runtime/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs b/runtime/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs index a3996820e67..d5133884120 100644 --- a/runtime/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs +++ b/runtime/src/installer/tests/HostActivation.Tests/NativeHosting/Nethost.cs @@ -242,7 +242,9 @@ bool useDotNetRoot .Should() .Pass() .And.HaveStdOutContaining( - $"hostfxr_path: {(useDotNetRoot ? sharedState.HostFxrPath : hostFxrPath)}".ToLower() + $"hostfxr_path: {(useDotNetRoot ? sharedState.HostFxrPath : hostFxrPath)}".ToLower( + + ) ); } diff --git a/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs b/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs index 1d450198f3b..c81d04241d6 100644 --- a/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs +++ b/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.Bundle.Tests/BundlerConsistencyTests.cs @@ -110,15 +110,14 @@ public void ExactDuplicateEntries() // Exact duplicates are not duplicated in the bundle bundler - .BundleManifest.Files.Where( - entry => entry.RelativePath.Equals("rel/app.repeat.dll") + .BundleManifest.Files.Where(entry => entry.RelativePath.Equals("rel/app.repeat.dll") ) .Single() .Type.Should() .Be(FileType.Assembly); bundler - .BundleManifest.Files.Where( - entry => entry.RelativePath.Equals("rel/system.repeat.dll") + .BundleManifest.Files.Where(entry => + entry.RelativePath.Equals("rel/system.repeat.dll") ) .Single() .Type.Should() @@ -159,15 +158,13 @@ public void CaseSensitiveBundleRelativePath() bundler.GenerateBundle(fileSpecs); bundler - .BundleManifest.Files.Where( - entry => entry.RelativePath.Equals("rel/app.repeat.dll") + .BundleManifest.Files.Where(entry => entry.RelativePath.Equals("rel/app.repeat.dll") ) .Single() .Type.Should() .Be(FileType.Assembly); bundler - .BundleManifest.Files.Where( - entry => entry.RelativePath.Equals("rel/app.Repeat.dll") + .BundleManifest.Files.Where(entry => entry.RelativePath.Equals("rel/app.Repeat.dll") ) .Single() .Type.Should() @@ -285,8 +282,8 @@ public void BaseNameComputation() .Type.Should() .Be(FileType.DepsJson); bundler - .BundleManifest.Files.Where( - entry => entry.RelativePath.Equals(runtimeConfigName) + .BundleManifest.Files.Where(entry => + entry.RelativePath.Equals(runtimeConfigName) ) .Single() .Type.Should() @@ -396,9 +393,8 @@ public void AssemblyAlignment() OperatingSystem.IsLinux() && RuntimeInformation.OSArchitecture == Architecture.Arm64 ? 4096 : 16; - bundler.BundleManifest.Files.ForEach( - file => - Assert.True((file.Type != FileType.Assembly) || (file.Offset % alignment == 0)) + bundler.BundleManifest.Files.ForEach(file => + Assert.True((file.Type != FileType.Assembly) || (file.Offset % alignment == 0)) ); } diff --git a/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/RegFreeComManifestTests.cs b/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/RegFreeComManifestTests.cs index 51d3b7fa928..cdaa1537104 100644 --- a/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/RegFreeComManifestTests.cs +++ b/runtime/src/installer/tests/Microsoft.NET.HostModel.Tests/Microsoft.NET.HostModel.ComHost.Tests/RegFreeComManifestTests.cs @@ -142,10 +142,9 @@ public void EntryInClsidMapAddedToRegFreeComManifestIncludesProgId() Assert.Single( fileElement .Elements(regFreeComManifestNamespace + "comClass") - .Where( - cls => - cls.Attribute("clsid").Value == guid - && cls.Attribute("progid").Value == progId + .Where(cls => + cls.Attribute("clsid").Value == guid + && cls.Attribute("progid").Value == progId ) ); } diff --git a/runtime/src/installer/tests/TestUtils/DotNetBuilder.cs b/runtime/src/installer/tests/TestUtils/DotNetBuilder.cs index 63a5e401133..dd1501dcc49 100644 --- a/runtime/src/installer/tests/TestUtils/DotNetBuilder.cs +++ b/runtime/src/installer/tests/TestUtils/DotNetBuilder.cs @@ -106,9 +106,9 @@ public DotNetBuilder RemoveHostFxr(Version version = null) else { foreach ( - var dir in new DirectoryInfo( - Path.Combine(_path, "host", "fxr") - ).GetDirectories() + var dir in new DirectoryInfo(Path.Combine(_path, "host", "fxr")).GetDirectories( + + ) ) { dir.Delete(recursive: true); diff --git a/runtime/src/installer/tests/TestUtils/TestApp.cs b/runtime/src/installer/tests/TestUtils/TestApp.cs index 7feef687ba8..89a4a358896 100644 --- a/runtime/src/installer/tests/TestUtils/TestApp.cs +++ b/runtime/src/installer/tests/TestUtils/TestApp.cs @@ -123,13 +123,12 @@ public void PopulateSelfContained( var builder = NetCoreAppBuilder.ForNETCoreApp(Name, TestContext.TargetRID); // Update the .runtimeconfig.json - add included framework and remove any existing NETCoreApp framework - builder.WithRuntimeConfig( - c => - c.WithIncludedFramework( - Constants.MicrosoftNETCoreApp, - TestContext.MicrosoftNETCoreAppVersion - ) - .RemoveFramework(Constants.MicrosoftNETCoreApp) + builder.WithRuntimeConfig(c => + c.WithIncludedFramework( + Constants.MicrosoftNETCoreApp, + TestContext.MicrosoftNETCoreAppVersion + ) + .RemoveFramework(Constants.MicrosoftNETCoreApp) ); // Add main project assembly diff --git a/runtime/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs b/runtime/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs index b21c2d5a19f..b70dca4b9cc 100644 --- a/runtime/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs +++ b/runtime/src/libraries/Common/src/Roslyn/SyntaxValueProvider_ForAttributeWithSimpleName.cs @@ -181,8 +181,7 @@ Func predicate ) ) ) - .Where( - tuple => tuple.Item2.Length > 0 + .Where(tuple => tuple.Item2.Length > 0 ) /*.WithTrackingName("result_ForAttribute")*/; diff --git a/runtime/src/libraries/Common/src/System/Reflection/Emit/IgnoreAccessChecksToAttributeBuilder.cs b/runtime/src/libraries/Common/src/System/Reflection/Emit/IgnoreAccessChecksToAttributeBuilder.cs index d1033be61d8..74143d72319 100644 --- a/runtime/src/libraries/Common/src/System/Reflection/Emit/IgnoreAccessChecksToAttributeBuilder.cs +++ b/runtime/src/libraries/Common/src/System/Reflection/Emit/IgnoreAccessChecksToAttributeBuilder.cs @@ -83,10 +83,9 @@ public static ConstructorInfo AddToModule(ModuleBuilder mb) // Find the ctor that takes only AttributeTargets ConstructorInfo attributeUsageConstructorInfo = - attributeUsageTypeInfo.DeclaredConstructors.Single( - c => - c.GetParameters().Length == 1 - && c.GetParameters()[0].ParameterType == typeof(AttributeTargets) + attributeUsageTypeInfo.DeclaredConstructors.Single(c => + c.GetParameters().Length == 1 + && c.GetParameters()[0].ParameterType == typeof(AttributeTargets) ); // Find the property to set AllowMultiple diff --git a/runtime/src/libraries/Common/tests/StaticTestGenerator/Program.cs b/runtime/src/libraries/Common/tests/StaticTestGenerator/Program.cs index 22f9ff870e4..3d8ed878097 100644 --- a/runtime/src/libraries/Common/tests/StaticTestGenerator/Program.cs +++ b/runtime/src/libraries/Common/tests/StaticTestGenerator/Program.cs @@ -185,11 +185,8 @@ test.MemberDataMember as MethodInfo if (test.Values != null) { if ( - !test.Values.All( - v => - v == null - || (v is Type t && IsPublic(t)) - || IsPublic(v.GetType()) + !test.Values.All(v => + v == null || (v is Type t && IsPublic(t)) || IsPublic(v.GetType()) ) ) { @@ -549,8 +546,8 @@ CustomAttributeData cad in testMethod.GetCustomAttributesData() if ( !attrType.IsPublic || !cad.Constructor.IsPublic - || !cad.ConstructorArguments.All( - c => c.ArgumentType.IsPublic + || !cad.ConstructorArguments.All(c => + c.ArgumentType.IsPublic ) ) { diff --git a/runtime/src/libraries/Common/tests/System/IO/Compression/ZipTestHelper.cs b/runtime/src/libraries/Common/tests/System/IO/Compression/ZipTestHelper.cs index de4e1670cc7..80b5d4ee275 100644 --- a/runtime/src/libraries/Common/tests/System/IO/Compression/ZipTestHelper.cs +++ b/runtime/src/libraries/Common/tests/System/IO/Compression/ZipTestHelper.cs @@ -324,19 +324,18 @@ bool checkTimes if (entry == null) //entry not found { string entryNameOtherSlash = FlipSlashes(entryName); - bool isEmpty = !files.Any( - f => - f.IsFile - && ( - f.FullName.StartsWith( - entryName, - StringComparison.OrdinalIgnoreCase - ) - || f.FullName.StartsWith( - entryNameOtherSlash, - StringComparison.OrdinalIgnoreCase - ) + bool isEmpty = !files.Any(f => + f.IsFile + && ( + f.FullName.StartsWith( + entryName, + StringComparison.OrdinalIgnoreCase ) + || f.FullName.StartsWith( + entryNameOtherSlash, + StringComparison.OrdinalIgnoreCase + ) + ) ); if (requireExplicit || isEmpty) { diff --git a/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AutoRedirect.cs b/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AutoRedirect.cs index 4ee262fff1d..94f3e6ccd07 100644 --- a/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AutoRedirect.cs +++ b/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.AutoRedirect.cs @@ -108,8 +108,9 @@ await LoopbackServer.CreateServerAsync( await serverTask; // Redirected URL answers with success - serverTask = - redirServer.AcceptConnectionSendResponseAndCloseAsync(); + serverTask = redirServer.AcceptConnectionSendResponseAndCloseAsync( + + ); await TestHelper.WhenAllCompletedOrAnyFailed( getResponseTask, serverTask @@ -160,8 +161,8 @@ await LoopbackServer.CreateServerAsync( async (redirServer, redirUrl) => { // Original URL will redirect to a different URL - Task serverTask = - origServer.AcceptConnectionAsync(async connection => + Task serverTask = origServer.AcceptConnectionAsync( + async connection => { // Send Connection: close so the client will close connection after request is sent, // meaning we can just read to the end to get the content @@ -171,7 +172,8 @@ await connection.ReadRequestHeaderAndSendResponseAsync( ); connection.Socket.Shutdown(SocketShutdown.Send); await connection.ReadToEndAsync(); - }); + } + ); await Task.WhenAny(getResponseTask, serverTask); Assert.False( @@ -183,8 +185,8 @@ await connection.ReadRequestHeaderAndSendResponseAsync( // Redirected URL answers with success List receivedRequest = null; string receivedContent = null; - Task serverTask2 = - redirServer.AcceptConnectionAsync(async connection => + Task serverTask2 = redirServer.AcceptConnectionAsync( + async connection => { // Send Connection: close so the client will close connection after request is sent, // meaning we can just read to the end to get the content @@ -194,7 +196,8 @@ await connection.ReadRequestHeaderAndSendResponseAsync( ); connection.Socket.Shutdown(SocketShutdown.Send); receivedContent = await connection.ReadToEndAsync(); - }); + } + ); await TestHelper.WhenAllCompletedOrAnyFailed( getResponseTask, diff --git a/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index 42a00a59201..5cbad9dd6ba 100644 --- a/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/runtime/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -2246,26 +2246,28 @@ await LoopbackServerFactory.CreateServerAsync( ); // First server connects but doesn't send any response yet - Task serverTask1 = - server1.AcceptConnectionAsync(async connection1 => + Task serverTask1 = server1.AcceptConnectionAsync( + async connection1 => { await unblockServers.Task; - }); + } + ); // Second server connects and sends some but not all headers - Task serverTask2 = - server2.AcceptConnectionAsync(async connection2 => + Task serverTask2 = server2.AcceptConnectionAsync( + async connection2 => { await connection2.ReadRequestDataAsync(); await connection2.SendPartialResponseHeadersAsync( HttpStatusCode.OK ); await unblockServers.Task; - }); + } + ); // Third server connects and sends all headers and some but not all of the body - Task serverTask3 = - server3.AcceptConnectionAsync(async connection3 => + Task serverTask3 = server3.AcceptConnectionAsync( + async connection3 => { await connection3.ReadRequestDataAsync(); await connection3.SendResponseAsync( @@ -2285,7 +2287,8 @@ await connection3.SendResponseBodyAsync( "1234567890", isFinal: true ); - }); + } + ); // Make three requests Task get1, diff --git a/runtime/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Startup.cs b/runtime/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Startup.cs index 9df74ffaf9f..6c471171f61 100644 --- a/runtime/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Startup.cs +++ b/runtime/src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Startup.cs @@ -50,19 +50,18 @@ public void ConfigureServices(IServiceCollection services) }) ); #endif - services.AddCors( - o => - o.AddPolicy( - "AnyCors", - builder => - { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .WithExposedHeaders("*"); - } - ) + services.AddCors(o => + o.AddPolicy( + "AnyCors", + builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .WithExposedHeaders("*"); + } + ) ); } diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs index 8d17dfffe4a..9f8ec5b20b0 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesCipherTests.cs @@ -761,9 +761,13 @@ public static void VerifyInPlaceDecryption() "1ed2f625c187b993256a8b3ccf9dcbfa5b44b4795c731012f70e4e64732efd5d".HexToByteArray(); byte[] iv = "47d1e060ba3c8643f9f8b65feeda4b30".HexToByteArray(); byte[] plainText = - "f238882f6530ae9191c294868feed0b0df4058b322377dec14690c3b6bbf6ad1dd5b7c063a28e2cca2a6dce8cc2e668ea6ce80cee4c1a1a955ff46c530f3801b".HexToByteArray(); + "f238882f6530ae9191c294868feed0b0df4058b322377dec14690c3b6bbf6ad1dd5b7c063a28e2cca2a6dce8cc2e668ea6ce80cee4c1a1a955ff46c530f3801b".HexToByteArray( + + ); byte[] cipher = - "7c6e1bcd3c30d2fb2d92e3346048307dc6719a6b96a945b4d987af09469ec68f5ca535fab7f596fffa80f7cfaeb26eefaf8d4ca8be190393b2569249d673f042".HexToByteArray(); + "7c6e1bcd3c30d2fb2d92e3346048307dc6719a6b96a945b4d987af09469ec68f5ca535fab7f596fffa80f7cfaeb26eefaf8d4ca8be190393b2569249d673f042".HexToByteArray( + + ); using (Aes a = AesFactory.Create()) using (MemoryStream cipherStream = new MemoryStream(cipher)) @@ -2543,7 +2547,9 @@ PaddingMode paddingMode TestAesTransformDirectKey( CipherMode.CFB, paddingMode, - key: "34e8091cee09f1bd3ebf1e8f05f51bfbd4899ef2ae006a3a0f7875052cdd46c8".HexToByteArray(), + key: "34e8091cee09f1bd3ebf1e8f05f51bfbd4899ef2ae006a3a0f7875052cdd46c8".HexToByteArray( + + ), iv: "43eb4dcc4b04a80216a20e4a09a7abb5".HexToByteArray(), plainBytes: ("f9" + "000000000000000000000000000000").HexToByteArray(), cipherBytes: ("28" + "26199F76D20BE53AB4D146CFC6D281").HexToByteArray(), @@ -2564,7 +2570,9 @@ PaddingMode paddingMode TestAesTransformDirectKey( CipherMode.CFB, paddingMode, - key: "ebbb4566b5e182e0f072466b0b311df38f9175bc0213a5530bce2ec4d74f400d".HexToByteArray(), + key: "ebbb4566b5e182e0f072466b0b311df38f9175bc0213a5530bce2ec4d74f400d".HexToByteArray( + + ), iv: "0956a48e01002c9e16376d6e308dbad1".HexToByteArray(), plainBytes: ("b0fe25ac8d3d28a2f471" + "000000000000").HexToByteArray(), cipherBytes: ("638c6823e7256fb5626e" + "5EE5C1D7FA17").HexToByteArray(), @@ -2596,8 +2604,12 @@ public static void VerifyKnownTransform_CFB128_128_NoPadding_1_Extended() PaddingMode.None, key: "701ccc4c0e36e512ce077f5af6ccb957".HexToByteArray(), iv: "5337ddeaf89a00dd4d58d860de968469".HexToByteArray(), - plainBytes: "cc1172f2f80866d0768b25f70fcf6361aab7c627c8488f97525d7d88949beeea".HexToByteArray(), - cipherBytes: "cdcf093bb7840df225683b58a479b00d5de5553a7e85eae4b70bf46dc729dd31".HexToByteArray(), + plainBytes: "cc1172f2f80866d0768b25f70fcf6361aab7c627c8488f97525d7d88949beeea".HexToByteArray( + + ), + cipherBytes: "cdcf093bb7840df225683b58a479b00d5de5553a7e85eae4b70bf46dc729dd31".HexToByteArray( + + ), feedbackSize: 128 ); } @@ -2626,8 +2638,12 @@ public static void VerifyKnownTransform_CFB128_192_NoPadding_1_Extended() PaddingMode.None, key: "69f9d29885743826d7c5afc53637e6b1fa9512a10eea9ca9".HexToByteArray(), iv: "3743793c7144a755768437f4ef5a33c8".HexToByteArray(), - plainBytes: "f84ebf42a758971c369949e288f775c9cf6a82ab51b286576b45652cd68c3ce6".HexToByteArray(), - cipherBytes: "a3bd28bb817bdb3f6492827f2aa3e6e134c254129d8f20dbc92389b7d89702d6".HexToByteArray(), + plainBytes: "f84ebf42a758971c369949e288f775c9cf6a82ab51b286576b45652cd68c3ce6".HexToByteArray( + + ), + cipherBytes: "a3bd28bb817bdb3f6492827f2aa3e6e134c254129d8f20dbc92389b7d89702d6".HexToByteArray( + + ), feedbackSize: 128 ); } @@ -2711,7 +2727,9 @@ public static void VerifyKnownTransform_CFB128_256_NoPadding_0_Extended() TestAesTransformDirectKey( CipherMode.CFB, PaddingMode.None, - key: "e1c6e6884eee69552dbfee21f22ca92685d5d08ef0e3f37e5b338c533bb8d72c".HexToByteArray(), + key: "e1c6e6884eee69552dbfee21f22ca92685d5d08ef0e3f37e5b338c533bb8d72c".HexToByteArray( + + ), iv: "cea9f23ae87a637ab0cda6381ecc1202".HexToByteArray(), plainBytes: "b72606c98d8e4fabf08839abf7a0ac61".HexToByteArray(), cipherBytes: "2981761d979bb1765a28b2dd19125b54".HexToByteArray(), @@ -2726,10 +2744,16 @@ public static void VerifyKnownTransform_CFB128_256_NoPadding_1_Extended() TestAesTransformDirectKey( CipherMode.CFB, PaddingMode.None, - key: "ae59254c66d8f533e7f5002ced480c33984a421d7816e27be66c34c19bfbc2a8".HexToByteArray(), + key: "ae59254c66d8f533e7f5002ced480c33984a421d7816e27be66c34c19bfbc2a8".HexToByteArray( + + ), iv: "821dd21653ece3af675cd25d26017ae3".HexToByteArray(), - plainBytes: "3cb4f17e775c2d6d06dd60f15d6c3a103e5131727f9c6cb80d13e00f316eb904".HexToByteArray(), - cipherBytes: "ae375db9f28148c460f6c6b6665fcc2ff6b50b8eaf82c64bba8c649efd4731bc".HexToByteArray(), + plainBytes: "3cb4f17e775c2d6d06dd60f15d6c3a103e5131727f9c6cb80d13e00f316eb904".HexToByteArray( + + ), + cipherBytes: "ae375db9f28148c460f6c6b6665fcc2ff6b50b8eaf82c64bba8c649efd4731bc".HexToByteArray( + + ), feedbackSize: 128 ); } diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesContractTests.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesContractTests.cs index 152dcb592ed..78a5c755787 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesContractTests.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/AES/AesContractTests.cs @@ -428,7 +428,9 @@ public static void Cfb8ModeCanDepadCfb128Padding() // 1, 2, 3, 4, 5 encrypted with CFB8 but padded with block-size padding. byte[] ciphertext = "68C272ACF16BE005A361DB1C147CA3AD".HexToByteArray(); aes.Key = - "3279CE2E9669A54E038AA62818672150D0B5A13F6757C27F378115501F83B119".HexToByteArray(); + "3279CE2E9669A54E038AA62818672150D0B5A13F6757C27F378115501F83B119".HexToByteArray( + + ); aes.IV = new byte[16]; aes.Padding = PaddingMode.PKCS7; aes.Mode = CipherMode.CFB; diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs index 54ae02e2e32..d701d177754 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignVerify.cs @@ -150,11 +150,10 @@ public void InvalidArrayArguments_Throws() public sealed class DSASignVerify_Span : DSASignVerify { public override byte[] SignData(DSA dsa, byte[] data, HashAlgorithmName hashAlgorithm) => - TryWithOutputArray( - dest => - dsa.TrySignData(data, dest, hashAlgorithm, out int bytesWritten) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + dsa.TrySignData(data, dest, hashAlgorithm, out int bytesWritten) + ? (true, bytesWritten) + : (false, 0) ); public override bool VerifyData( diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSATestData.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSATestData.cs index 185abba6a84..8a3d95b833f 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSATestData.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSATestData.cs @@ -99,10 +99,12 @@ internal static DSAParameters GetDSA2048Params() + "B6CBF8C29C245173B1D8D219438E59373CE7554EF49C7840A8C55CE2E5E2C33C10AAD8D90F28C7CB2EF14AD5ED8C4E6992B4" + "1ECEC65288F5" ).HexToByteArray(); - p.Q = - "C93AB229237282997F23541A399BBF75CECD30BE0BE9592C07043ED30221EACB".HexToByteArray(); - p.X = - "B8BFF7B3328E6B6DBC8325A275A1193EF81C975ECF88B340C468B770FB5E2658".HexToByteArray(); + p.Q = "C93AB229237282997F23541A399BBF75CECD30BE0BE9592C07043ED30221EACB".HexToByteArray( + + ); + p.X = "B8BFF7B3328E6B6DBC8325A275A1193EF81C975ECF88B340C468B770FB5E2658".HexToByteArray( + + ); p.Y = ( "011BD85986A2C41315FF01C554A45E5A9C45B38EBDCC2660B6D17889604E800A6FDE8E017CED3793F4A6FBAFBB7613FEB7BA" + "87841ABD59935D18858939C00A6E4619B6562475955D6D72B2134BECF5AB34118F60D84B1FF268753F188E861255132D84CA" diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/EccTestData.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/EccTestData.cs index c4f45fa1501..74a454d60a3 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/EccTestData.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/EccTestData.cs @@ -27,22 +27,34 @@ internal static ECCurve GetNistP256ExplicitCurve() { CurveType = ECCurve.ECCurveType.PrimeShortWeierstrass, Prime = - "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF".HexToByteArray(), + "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF".HexToByteArray( + + ), A = - "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC".HexToByteArray(), + "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC".HexToByteArray( + + ), B = - "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B".HexToByteArray(), + "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B".HexToByteArray( + + ), Seed = "C49D360886E704936A6678E1139D26B7819F7E90".HexToByteArray(), Hash = HashAlgorithmName.SHA1, G = new ECPoint { X = - "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296".HexToByteArray(), + "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296".HexToByteArray( + + ), Y = - "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5".HexToByteArray(), + "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5".HexToByteArray( + + ), }, Order = - "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551".HexToByteArray(), + "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551".HexToByteArray( + + ), Cofactor = new byte[] { 0x01 }, }; } @@ -254,12 +266,18 @@ internal static ECParameters GetNistP256ReferenceKey() Q = { X = - "8101ECE47464A6EAD70CF69A6E2BD3D88691A3262D22CBA4F7635EAFF26680A8".HexToByteArray(), + "8101ECE47464A6EAD70CF69A6E2BD3D88691A3262D22CBA4F7635EAFF26680A8".HexToByteArray( + + ), Y = - "D8A12BA61D599235F67D9CB4D58F1783D3CA43E78F0A5ABAA624079936C0C3A9".HexToByteArray(), + "D8A12BA61D599235F67D9CB4D58F1783D3CA43E78F0A5ABAA624079936C0C3A9".HexToByteArray( + + ), }, D = - "70A12C2DB16845ED56FF68CFC21A472B3F04D7D6851BF6349F2D7D5B3452B38A".HexToByteArray(), + "70A12C2DB16845ED56FF68CFC21A472B3F04D7D6851BF6349F2D7D5B3452B38A".HexToByteArray( + + ), }; } @@ -273,12 +291,18 @@ internal static ECParameters GetNistP256ReferenceKeyExplicit() Q = { X = - "8101ECE47464A6EAD70CF69A6E2BD3D88691A3262D22CBA4F7635EAFF26680A8".HexToByteArray(), + "8101ECE47464A6EAD70CF69A6E2BD3D88691A3262D22CBA4F7635EAFF26680A8".HexToByteArray( + + ), Y = - "D8A12BA61D599235F67D9CB4D58F1783D3CA43E78F0A5ABAA624079936C0C3A9".HexToByteArray(), + "D8A12BA61D599235F67D9CB4D58F1783D3CA43E78F0A5ABAA624079936C0C3A9".HexToByteArray( + + ), }, D = - "70A12C2DB16845ED56FF68CFC21A472B3F04D7D6851BF6349F2D7D5B3452B38A".HexToByteArray(), + "70A12C2DB16845ED56FF68CFC21A472B3F04D7D6851BF6349F2D7D5B3452B38A".HexToByteArray( + + ), }; } @@ -334,12 +358,18 @@ internal static ECParameters GetNistP256ReferenceKeyExplicit() Q = { X = - "0752770BD33E6A6EE2096CB6B120E7497B47B6C077A147CB57DAF693909D840716EEA7AA".HexToByteArray(), + "0752770BD33E6A6EE2096CB6B120E7497B47B6C077A147CB57DAF693909D840716EEA7AA".HexToByteArray( + + ), Y = - "047DB9995C35603C5E6B2F8CDFF0EB71D37AE3431BA0849EBAB13A4C9003C7969F55CD90".HexToByteArray(), + "047DB9995C35603C5E6B2F8CDFF0EB71D37AE3431BA0849EBAB13A4C9003C7969F55CD90".HexToByteArray( + + ), }, D = - "00B4F1AE1E7FDCD4B0E82053C08A908852B26231E6C01670FCC6C3EA2C5D3FED40EDF037".HexToByteArray(), + "00B4F1AE1E7FDCD4B0E82053C08A908852B26231E6C01670FCC6C3EA2C5D3FED40EDF037".HexToByteArray( + + ), }; internal static readonly ECParameters C2pnb163v1Key1 = new ECParameters diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs index 7a049271f01..0917873b435 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDiffieHellman/ECDiffieHellmanTests.ImportExport.cs @@ -447,12 +447,18 @@ public static void ExportIncludingPrivateOnPublicOnlyKey() Q = { X = - "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(), + "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray( + + ), Y = - "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(), + "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray( + + ), }, D = - "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(), + "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray( + + ), }; using (ECDiffieHellman iut = ECDiffieHellmanFactory.Create()) @@ -483,16 +489,22 @@ public static void ExportIncludingPrivateOnPublicOnlyKey() public static void ImportFromPrivateOnlyKey() { byte[] expectedX = - "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(); + "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray( + + ); byte[] expectedY = - "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(); + "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray( + + ); ECParameters limitedPrivateParameters = new ECParameters { Curve = ECCurve.NamedCurves.nistP521, Q = default, D = - "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(), + "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray( + + ), }; using (ECDiffieHellman ecdh = ECDiffieHellmanFactory.Create()) diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs index 509c55b65c6..4347887a771 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaImportExport.cs @@ -371,12 +371,18 @@ public static void ExportIncludingPrivateOnPublicOnlyKey() Q = { X = - "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(), + "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray( + + ), Y = - "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(), + "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray( + + ), }, D = - "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(), + "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray( + + ), }; using (ECDsa iut = ECDsaFactory.Create()) @@ -400,16 +406,22 @@ public static void ExportIncludingPrivateOnPublicOnlyKey() public static void ImportFromPrivateOnlyKey() { byte[] expectedX = - "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray(); + "00d45615ed5d37fde699610a62cd43ba76bedd8f85ed31005fe00d6450fbbd101291abd96d4945a8b57bc73b3fe9f4671105309ec9b6879d0551d930dac8ba45d255".HexToByteArray( + + ); byte[] expectedY = - "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray(); + "01425332844e592b440c0027972ad1526431c06732df19cd46a242172d4dd67c2c8c99dfc22e49949a56cf90c6473635ce82f25b33682fb19bc33bd910ed8ce3a7fa".HexToByteArray( + + ); ECParameters limitedPrivateParameters = new ECParameters { Curve = ECCurve.NamedCurves.nistP521, Q = default, D = - "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray(), + "00816f19c1fb10ef94d4a1d81c156ec3d1de08b66761f03f06ee4bb9dcebbbfe1eaa1ed49a6a990838d8ed318c14d74cc872f95d05d07ad50f621ceb620cd905cfb8".HexToByteArray( + + ), }; using (ECDsa ecdsa = ECDsaFactory.Create()) diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs index 0c0e3ab2c44..9213ac5718f 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaTests.netcoreapp.cs @@ -27,14 +27,13 @@ protected override byte[] SignData( int count, HashAlgorithmName hashAlgorithm ) => - WithOutputArray( - dest => - ecdsa.SignData(new ReadOnlySpan(data, offset, count), dest, hashAlgorithm) + WithOutputArray(dest => + ecdsa.SignData(new ReadOnlySpan(data, offset, count), dest, hashAlgorithm) ); protected override byte[] SignHash(ECDsa ecdsa, byte[] hash, int offset, int count) => - WithOutputArray( - dest => ecdsa.SignHash(new ReadOnlySpan(hash, offset, count), dest) + WithOutputArray(dest => + ecdsa.SignHash(new ReadOnlySpan(hash, offset, count), dest) ); protected override bool VerifyHash( @@ -225,28 +224,26 @@ protected override byte[] SignData( int count, HashAlgorithmName hashAlgorithm ) => - TryWithOutputArray( - dest => - ecdsa.TrySignData( - new ReadOnlySpan(data, offset, count), - dest, - hashAlgorithm, - out int bytesWritten - ) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + ecdsa.TrySignData( + new ReadOnlySpan(data, offset, count), + dest, + hashAlgorithm, + out int bytesWritten + ) + ? (true, bytesWritten) + : (false, 0) ); protected override byte[] SignHash(ECDsa ecdsa, byte[] hash, int offset, int count) => - TryWithOutputArray( - dest => - ecdsa.TrySignHash( - new ReadOnlySpan(hash, offset, count), - dest, - out int bytesWritten - ) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + ecdsa.TrySignHash( + new ReadOnlySpan(hash, offset, count), + dest, + out int bytesWritten + ) + ? (true, bytesWritten) + : (false, 0) ); protected override bool VerifyHash( diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs index 93e27749b10..6ebe6a73092 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/EncryptDecrypt.netcoreapp.cs @@ -49,19 +49,17 @@ protected override byte[] Decrypt(RSA rsa, byte[] data, RSAEncryptionPadding pad public sealed class EncryptDecrypt_TrySpan : EncryptDecrypt { protected override byte[] Encrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => - TryWithOutputArray( - dest => - rsa.TryEncrypt(data, dest, padding, out int bytesWritten) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + rsa.TryEncrypt(data, dest, padding, out int bytesWritten) + ? (true, bytesWritten) + : (false, 0) ); protected override byte[] Decrypt(RSA rsa, byte[] data, RSAEncryptionPadding padding) => - TryWithOutputArray( - dest => - rsa.TryDecrypt(data, dest, padding, out int bytesWritten) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + rsa.TryDecrypt(data, dest, padding, out int bytesWritten) + ? (true, bytesWritten) + : (false, 0) ); private static byte[] TryWithOutputArray(Func func) diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs index fb2af798a98..4d895751478 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/SignVerify.netcoreapp.cs @@ -122,11 +122,10 @@ protected override byte[] SignData( HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) => - TryWithOutputArray( - dest => - rsa.TrySignData(data, dest, hashAlgorithm, padding, out int bytesWritten) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + rsa.TrySignData(data, dest, hashAlgorithm, padding, out int bytesWritten) + ? (true, bytesWritten) + : (false, 0) ); protected override byte[] SignHash( @@ -135,11 +134,10 @@ protected override byte[] SignHash( HashAlgorithmName hashAlgorithm, RSASignaturePadding padding ) => - TryWithOutputArray( - dest => - rsa.TrySignHash(hash, dest, hashAlgorithm, padding, out int bytesWritten) - ? (true, bytesWritten) - : (false, 0) + TryWithOutputArray(dest => + rsa.TrySignHash(hash, dest, hashAlgorithm, padding, out int bytesWritten) + ? (true, bytesWritten) + : (false, 0) ); protected override bool VerifyData( diff --git a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs index 4ef191b5c41..750cb4b4c48 100644 --- a/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs +++ b/runtime/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/TripleDES/TripleDESCipherTests.cs @@ -367,8 +367,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_3() PaddingMode.None, key: "c1497fdf67cecbab80d543f16d13c8d5c1497fdf67cecbab".HexToByteArray(), iv: "a1241ca0fe9378cd".HexToByteArray(), - plainBytes: "157dcfa7ad6758335e561fa7dd7f98dca592e9128e7be30ccd1af7dc5a4536d5".HexToByteArray(), - cipherBytes: "08fcace492f82282fb3255884a64a231dd438069ffbcb432bd7ec446f5b8adfd".HexToByteArray(), + plainBytes: "157dcfa7ad6758335e561fa7dd7f98dca592e9128e7be30ccd1af7dc5a4536d5".HexToByteArray( + + ), + cipherBytes: "08fcace492f82282fb3255884a64a231dd438069ffbcb432bd7ec446f5b8adfd".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -382,8 +386,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_4() PaddingMode.None, key: "fd0e3262ec38fe5710389d0779c2fb43fd0e3262ec38fe57".HexToByteArray(), iv: "33c9e4adfb4634ac".HexToByteArray(), - plainBytes: "37536dda516aab8a992131004134ce48c56fee05261164aae0a88db0f43410617f105e20940cf3e9".HexToByteArray(), - cipherBytes: "80e8a96c3fe83857fc738ac7b6639f0d8c28bfa617c56a60fd1b8fbdc36afe9ce3151e161fa5e3a7".HexToByteArray(), + plainBytes: "37536dda516aab8a992131004134ce48c56fee05261164aae0a88db0f43410617f105e20940cf3e9".HexToByteArray( + + ), + cipherBytes: "80e8a96c3fe83857fc738ac7b6639f0d8c28bfa617c56a60fd1b8fbdc36afe9ce3151e161fa5e3a7".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -397,8 +405,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_5() PaddingMode.None, key: "ae32253be61040157a7c10b6011fcde3ae32253be6104015".HexToByteArray(), iv: "47be2286dbccdfe6".HexToByteArray(), - plainBytes: "e579282129c123c914c700ad8c099b593fe83fdef7be7e5ffb36add9c6b91644cc79c1e457212017488963e16198c528".HexToByteArray(), - cipherBytes: "7185c5800ca4d5432b50f5b7920e26296c2913e7e3f847a1ef639e156ba4f9ec6e4b36ded885601d2b9d22f19dc3829f".HexToByteArray(), + plainBytes: "e579282129c123c914c700ad8c099b593fe83fdef7be7e5ffb36add9c6b91644cc79c1e457212017488963e16198c528".HexToByteArray( + + ), + cipherBytes: "7185c5800ca4d5432b50f5b7920e26296c2913e7e3f847a1ef639e156ba4f9ec6e4b36ded885601d2b9d22f19dc3829f".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -412,8 +424,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_6() PaddingMode.None, key: "df83498cec83084acb7aaef26e58f1e0df83498cec83084a".HexToByteArray(), iv: "158d2ca6e70b18f6".HexToByteArray(), - plainBytes: "4fb7cf2a244ff20beddf8719b2d9c78ab0710703036f804f08bc1f7927ea9906ba1ef57afd1553c5304c0b72694cd88bb6cb1289772dfff0".HexToByteArray(), - cipherBytes: "158b396cd1969a07042e808d0c875d74166ce77291df233fe300c29c5a30b1946575ec02042093537dae3f8d51ed96906e601d9da6e34e14".HexToByteArray(), + plainBytes: "4fb7cf2a244ff20beddf8719b2d9c78ab0710703036f804f08bc1f7927ea9906ba1ef57afd1553c5304c0b72694cd88bb6cb1289772dfff0".HexToByteArray( + + ), + cipherBytes: "158b396cd1969a07042e808d0c875d74166ce77291df233fe300c29c5a30b1946575ec02042093537dae3f8d51ed96906e601d9da6e34e14".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -427,8 +443,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_7() PaddingMode.None, key: "ce31cd2067c157199bfb3b8ad9ef9223ce31cd2067c15719".HexToByteArray(), iv: "d31741512b6a7471".HexToByteArray(), - plainBytes: "a0447f5abebf8623db81b600699ce8373353442908fefe8c63f5e29e22ba1057f759635505ed0ac059887def2d31f6996128d4fbe2df6534429744d7f6496768".HexToByteArray(), - cipherBytes: "b3a791b128f003bc28cd17bbb5c68990faec73f88c10b664f1349b045f3fba24c5f51bbb10259c41a72492c2377bb331b6dd34fea25c2eea8adc461bd0c78d6b".HexToByteArray(), + plainBytes: "a0447f5abebf8623db81b600699ce8373353442908fefe8c63f5e29e22ba1057f759635505ed0ac059887def2d31f6996128d4fbe2df6534429744d7f6496768".HexToByteArray( + + ), + cipherBytes: "b3a791b128f003bc28cd17bbb5c68990faec73f88c10b664f1349b045f3fba24c5f51bbb10259c41a72492c2377bb331b6dd34fea25c2eea8adc461bd0c78d6b".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -442,8 +462,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_8() PaddingMode.None, key: "5bbc3423bf67e05262d65740708019f15bbc3423bf67e052".HexToByteArray(), iv: "14544ea4813c49d9".HexToByteArray(), - plainBytes: "a21f26496f74fd8a93aa5423e2a4fc76facbff015db2f4ef14f08b8c13a29d0561e4e57d04b0b00211f8fba46d025a9c0727c8aebb7d25f27f1606321909ba50e660fa25358c63f9".HexToByteArray(), - cipherBytes: "c3acc89b9b6037effc65eacdc23b36c38d0e609566d360eba594e4481108983b4a67a5d9647c776ad5fcc4639116ca95734bd8a3df800fb9a6526a7b29a9fc3cc29079715f44f865".HexToByteArray(), + plainBytes: "a21f26496f74fd8a93aa5423e2a4fc76facbff015db2f4ef14f08b8c13a29d0561e4e57d04b0b00211f8fba46d025a9c0727c8aebb7d25f27f1606321909ba50e660fa25358c63f9".HexToByteArray( + + ), + cipherBytes: "c3acc89b9b6037effc65eacdc23b36c38d0e609566d360eba594e4481108983b4a67a5d9647c776ad5fcc4639116ca95734bd8a3df800fb9a6526a7b29a9fc3cc29079715f44f865".HexToByteArray( + + ), feedbackSize: 64 ); } @@ -457,8 +481,12 @@ public static void VerifyKnownTransform_CFB64_NoPadding_9() PaddingMode.None, key: "197c738cfb6e0bc2fee57ffb1ca72675197c738cfb6e0bc2".HexToByteArray(), iv: "f1a42447a333caa3".HexToByteArray(), - plainBytes: "6f914b6996ee8e7ea625b2fddd7677b4384320be0aba3af81d1210965ac37983f340d5698ddf35d45dfccbf783a50c6eed1a730b5c98675cb6b7645fc8374e10d8b340c44b0eae988c1ef635fab913da".HexToByteArray(), - cipherBytes: "8aabb83216e4bd5a3dd20586e598bb8e956dcbf7d09cde17a2cf8b7a788ecb853503ae5981004dfa644300b115f8d1ae0c7f30f25e70e86c4adc51620fd6c71301325c9bdc8dca16588eac08fe6aedfd".HexToByteArray(), + plainBytes: "6f914b6996ee8e7ea625b2fddd7677b4384320be0aba3af81d1210965ac37983f340d5698ddf35d45dfccbf783a50c6eed1a730b5c98675cb6b7645fc8374e10d8b340c44b0eae988c1ef635fab913da".HexToByteArray( + + ), + cipherBytes: "8aabb83216e4bd5a3dd20586e598bb8e956dcbf7d09cde17a2cf8b7a788ecb853503ae5981004dfa644300b115f8d1ae0c7f30f25e70e86c4adc51620fd6c71301325c9bdc8dca16588eac08fe6aedfd".HexToByteArray( + + ), feedbackSize: 64 ); } diff --git a/runtime/src/libraries/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs b/runtime/src/libraries/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs index 57d5fb6ea08..5afc45bb12d 100644 --- a/runtime/src/libraries/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs +++ b/runtime/src/libraries/Microsoft.CSharp/tests/RuntimeBinderInternalCompilerExceptionTests.cs @@ -11,8 +11,9 @@ public class RuntimeBinderInternalCompilerExceptionTests [Fact] public void NullaryCtor() { - RuntimeBinderInternalCompilerException rbe = - new RuntimeBinderInternalCompilerException(); + RuntimeBinderInternalCompilerException rbe = new RuntimeBinderInternalCompilerException( + + ); Assert.Null(rbe.InnerException); Assert.Empty(rbe.Data); Assert.True((rbe.HResult & 0xFFFF0000) == 0x80130000); // Error from .NET diff --git a/runtime/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CacheServiceExtensionsTests.cs b/runtime/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CacheServiceExtensionsTests.cs index 732f5289191..4e6837f74e2 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CacheServiceExtensionsTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Caching.Memory/tests/CacheServiceExtensionsTests.cs @@ -24,8 +24,8 @@ public void AddMemoryCache_RegistersMemoryCacheAsSingleton() services.AddMemoryCache(); // Assert - var memoryCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IMemoryCache) + var memoryCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IMemoryCache) ); Assert.NotNull(memoryCache); @@ -71,15 +71,15 @@ public void AddCaching_DoesNotReplaceUserRegisteredServices() // Assert var serviceProvider = services.BuildServiceProvider(); - var memoryCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IMemoryCache) + var memoryCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IMemoryCache) ); Assert.NotNull(memoryCache); Assert.Equal(ServiceLifetime.Scoped, memoryCache.Lifetime); Assert.IsType(serviceProvider.GetRequiredService()); - var distributedCache = services.FirstOrDefault( - desc => desc.ServiceType == typeof(IDistributedCache) + var distributedCache = services.FirstOrDefault(desc => + desc.ServiceType == typeof(IDistributedCache) ); Assert.NotNull(distributedCache); Assert.Equal(ServiceLifetime.Scoped, memoryCache.Lifetime); diff --git a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs index affb5cc9d07..0dd497b40e1 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Emitter/CoreBindingHelpers.cs @@ -417,8 +417,8 @@ is ObjectInstantiationStrategy.ParameterizedConstructor $"Expecting type for init method, {type.DisplayString}, to have both properties and ctor params." ); - IEnumerable initOnlyProps = type.Properties.Where( - prop => prop is { SetOnInit: true } + IEnumerable initOnlyProps = type.Properties.Where(prop => + prop is { SetOnInit: true } ); List ctorArgList = new(); diff --git a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/TypeIndex.cs b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/TypeIndex.cs index edfee08e605..3b0ba012c73 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/TypeIndex.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/gen/Specs/TypeIndex.cs @@ -11,8 +11,8 @@ namespace Microsoft.Extensions.Configuration.Binder.SourceGeneration { internal sealed class TypeIndex(IEnumerable typeSpecs) { - private readonly Dictionary _index = typeSpecs.ToDictionary( - spec => spec.TypeRef + private readonly Dictionary _index = typeSpecs.ToDictionary(spec => + spec.TypeRef ); public bool CanBindTo(TypeRef typeRef) => diff --git a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs index fcb1ee6e82a..1dc0f39a9f7 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/Common/ConfigurationBinderTests.cs @@ -1807,8 +1807,7 @@ public void PrivatePropertiesFromBaseClass_Get() #if BUILDING_SOURCE_GENERATOR_TESTS var ex = Assert.Throws( () => - config.Get( - b => b.BindNonPublicProperties = true + config.Get(b => b.BindNonPublicProperties = true ) ); Assert.Contains("BinderOptions.BindNonPublicProperties", ex.ToString()); @@ -1822,8 +1821,8 @@ public void PrivatePropertiesFromBaseClass_Get() ); Assert.Contains("BinderOptions.BindNonPublicProperties", ex.ToString()); #else - var test = config.Get( - b => b.BindNonPublicProperties = true + var test = config.Get(b => + b.BindNonPublicProperties = true ); Assert.Equal("a", test.ExposePrivatePropertyValue()); diff --git a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs index 3e1b1d243eb..7e77c43b412 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Configuration.Binder/tests/SourceGenerationTests/ConfigBindingGenTestDriver.cs @@ -187,8 +187,9 @@ public static void ValidateDiagnostics( ExpectedDiagnostics expectedDiags ) { - ImmutableArray outputDiagnostics = - result.OutputCompilation.GetDiagnostics(); + ImmutableArray outputDiagnostics = result.OutputCompilation.GetDiagnostics( + + ); if (expectedDiags is ExpectedDiagnostics.None) { diff --git a/runtime/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs b/runtime/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs index f0124401545..9977b0b2b86 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Configuration/src/InternalConfigurationRootExtensions.cs @@ -34,11 +34,10 @@ root as ConfigurationManager (seed, source) => source.GetChildKeys(seed, path) ) .Distinct(StringComparer.OrdinalIgnoreCase) - .Select( - key => - root.GetSection( - path == null ? key : path + ConfigurationPath.KeyDelimiter + key - ) + .Select(key => + root.GetSection( + path == null ? key : path + ConfigurationPath.KeyDelimiter + key + ) ); if (reference is null) diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/DependencyInjectionSpecificationTests.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/DependencyInjectionSpecificationTests.cs index 18fd50601c9..db4c09cd9d5 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/DependencyInjectionSpecificationTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Specification.Tests/src/DependencyInjectionSpecificationTests.cs @@ -465,10 +465,12 @@ public void NestedScopedServiceCanBeResolved() using (var outerScope = provider.CreateScope()) using (var innerScope = outerScope.ServiceProvider.CreateScope()) { - var outerScopedService = - outerScope.ServiceProvider.GetService(); - var innerScopedService = - innerScope.ServiceProvider.GetService(); + var outerScopedService = outerScope.ServiceProvider.GetService( + + ); + var innerScopedService = innerScope.ServiceProvider.GetService( + + ); // Assert Assert.NotNull(outerScopedService); @@ -658,10 +660,12 @@ public void NestedScopedServiceCanBeResolvedWithNoFallbackProvider() using (var outerScope = provider.CreateScope()) using (var innerScope = outerScope.ServiceProvider.CreateScope()) { - var outerScopedService = - outerScope.ServiceProvider.GetService(); - var innerScopedService = - innerScope.ServiceProvider.GetService(); + var outerScopedService = outerScope.ServiceProvider.GetService( + + ); + var innerScopedService = innerScope.ServiceProvider.GetService( + + ); // Assert Assert.NotSame(outerScopedService, innerScopedService); diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs index 566d62c5876..24bd5705bdf 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/src/ServiceLookup/Expressions/ExpressionResolverBuilder.cs @@ -80,10 +80,9 @@ public ExpressionResolverBuilder(ServiceProvider serviceProvider) { _rootScope = serviceProvider.Root; _scopeResolverCache = - new ConcurrentDictionary< - ServiceCacheKey, - Func - >(); + new ConcurrentDictionary>( + + ); _buildTypeDelegate = (key, cs) => BuildNoCache(cs); } @@ -225,8 +224,8 @@ static NewArrayExpression NewArrayInit(Type elementType, IEnumerable return NewArrayInit( callSite.ItemType, - callSite.ServiceCallSites.Select( - cs => Convert(VisitCallSite(cs, context), callSite.ItemType) + callSite.ServiceCallSites.Select(cs => + Convert(VisitCallSite(cs, context), callSite.ItemType) ) ); } diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/CallSiteTests.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/CallSiteTests.cs index 17edf245f7e..2c1e6d4d234 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/CallSiteTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/CallSiteTests.cs @@ -130,9 +130,9 @@ Func compare var service1 = Invoke(callSite, scope); var service2 = compiledCallSite(scope); - var serviceEnumerator = ( - (IEnumerable)compiledCollectionCallSite(scope) - ).GetEnumerator(); + var serviceEnumerator = ((IEnumerable)compiledCollectionCallSite(scope)).GetEnumerator( + + ); Assert.NotNull(service1); Assert.True(compare(service1, service2)); diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs index 7288e6a5a4e..a70ea820394 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/DependencyInjectionEventSourceTests.cs @@ -75,8 +75,7 @@ public void EmitsCallSiteBuiltEvent() serviceCollection.BuildServiceProvider().GetService>(); - var callsiteBuiltEvent = _listener.EventData.Single( - e => e.EventName == "CallSiteBuilt" + var callsiteBuiltEvent = _listener.EventData.Single(e => e.EventName == "CallSiteBuilt" ); Assert.Equal( @@ -218,8 +217,8 @@ public void EmitsExpressionTreeBuiltEvent() serviceProvider.GetService(); - var expressionTreeGeneratedEvent = _listener.EventData.Single( - e => e.EventName == "ExpressionTreeGenerated" + var expressionTreeGeneratedEvent = _listener.EventData.Single(e => + e.EventName == "ExpressionTreeGenerated" ); Assert.Equal( @@ -244,8 +243,8 @@ public void EmitsDynamicMethodBuiltEvent() serviceProvider.GetService(); - var expressionTreeGeneratedEvent = _listener.EventData.Single( - e => e.EventName == "DynamicMethodBuilt" + var expressionTreeGeneratedEvent = _listener.EventData.Single(e => + e.EventName == "DynamicMethodBuilt" ); Assert.Equal( @@ -269,8 +268,7 @@ public void EmitsScopeDisposedEvent() scope.ServiceProvider.GetService(); } - var scopeDisposedEvent = _listener.EventData.Single( - e => e.EventName == "ScopeDisposed" + var scopeDisposedEvent = _listener.EventData.Single(e => e.EventName == "ScopeDisposed" ); Assert.Equal(1, GetProperty(scopeDisposedEvent, "scopedServicesResolved")); @@ -285,8 +283,8 @@ public void EmitsServiceRealizationFailedEvent() DependencyInjectionEventSource.Log.ServiceRealizationFailed(exception, 1234); var eventName = nameof(DependencyInjectionEventSource.Log.ServiceRealizationFailed); - var serviceRealizationFailedEvent = _listener.EventData.Single( - e => e.EventName == eventName + var serviceRealizationFailedEvent = _listener.EventData.Single(e => + e.EventName == eventName ); Assert.Equal( @@ -331,8 +329,8 @@ public void EmitsServiceProviderBuilt() using ServiceProvider provider = serviceCollection.BuildServiceProvider(); - EventWrittenEventArgs serviceProviderBuiltEvent = _listener.EventData.Single( - e => e.EventName == "ServiceProviderBuilt" + EventWrittenEventArgs serviceProviderBuiltEvent = _listener.EventData.Single(e => + e.EventName == "ServiceProviderBuilt" ); GetProperty(serviceProviderBuiltEvent, "serviceProviderHashCode"); // assert hashcode exists as an int Assert.Equal(4, GetProperty(serviceProviderBuiltEvent, "singletonServices")); @@ -342,8 +340,8 @@ public void EmitsServiceProviderBuilt() Assert.Equal(1, GetProperty(serviceProviderBuiltEvent, "openGenericsServices")); Assert.Equal(7, serviceProviderBuiltEvent.EventId); - EventWrittenEventArgs serviceProviderDescriptorsEvent = _listener.EventData.Single( - e => e.EventName == "ServiceProviderDescriptors" + EventWrittenEventArgs serviceProviderDescriptorsEvent = _listener.EventData.Single(e => + e.EventName == "ServiceProviderDescriptors" ); Assert.Equal( string.Join( @@ -428,13 +426,13 @@ public void EmitsServiceProviderBuiltOnAttach() _listener.EnableEvents(DependencyInjectionEventSource.Log, EventLevel.Verbose); - EventWrittenEventArgs serviceProviderBuiltEvent = _listener.EventData.Single( - e => e.EventName == "ServiceProviderBuilt" + EventWrittenEventArgs serviceProviderBuiltEvent = _listener.EventData.Single(e => + e.EventName == "ServiceProviderBuilt" ); Assert.Equal(1, GetProperty(serviceProviderBuiltEvent, "singletonServices")); - EventWrittenEventArgs serviceProviderDescriptorsEvent = _listener.EventData.Single( - e => e.EventName == "ServiceProviderDescriptors" + EventWrittenEventArgs serviceProviderDescriptorsEvent = _listener.EventData.Single(e => + e.EventName == "ServiceProviderDescriptors" ); Assert.NotNull( JObject.Parse(GetProperty(serviceProviderDescriptorsEvent, "descriptors")) diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextExtensions.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextExtensions.cs index fe01a55e720..973bbc1bf5b 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextExtensions.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyModel/src/DependencyContextExtensions.cs @@ -194,8 +194,8 @@ private static IEnumerable ResolveAssets( IEnumerable assets ) { - RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault( - f => f.Runtime == runtimeIdentifier + RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault(f => + f.Runtime == runtimeIdentifier ); IEnumerable rids = Enumerable.Concat( new[] { runtimeIdentifier }, @@ -210,8 +210,8 @@ private static IEnumerable ResolveRuntimeFiles( IEnumerable assets ) { - RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault( - f => f.Runtime == runtimeIdentifier + RuntimeFallbacks? fallbacks = context.RuntimeGraph.FirstOrDefault(f => + f.Runtime == runtimeIdentifier ); IEnumerable rids = Enumerable.Concat( new[] { runtimeIdentifier }, diff --git a/runtime/src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs b/runtime/src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs index 455a1833ac7..688170cfa22 100644 --- a/runtime/src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs @@ -23,12 +23,11 @@ public void ResolveReferencePathsAcceptsCustomResolvers() var fail = new Mock(); var success = new Mock(); success - .Setup( - r => - r.TryResolveAssemblyPaths( - It.IsAny(), - It.IsAny>() - ) + .Setup(r => + r.TryResolveAssemblyPaths( + It.IsAny(), + It.IsAny>() + ) ) .Callback( (CompilationLibrary l, List a) => diff --git a/runtime/src/libraries/Microsoft.Extensions.Diagnostics/tests/MetricsSubscriptionManagerTests.cs b/runtime/src/libraries/Microsoft.Extensions.Diagnostics/tests/MetricsSubscriptionManagerTests.cs index 374561ce587..2f51d66850a 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Diagnostics/tests/MetricsSubscriptionManagerTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Diagnostics/tests/MetricsSubscriptionManagerTests.cs @@ -58,8 +58,8 @@ public void TestSubscriptionManagerDisposal() hostBuilder.ConfigureServices(services => { - services.AddMetrics( - metrics => metrics.EnableMetrics("TestMeter").AddListener() + services.AddMetrics(metrics => + metrics.EnableMetrics("TestMeter").AddListener() ); }); diff --git a/runtime/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs b/runtime/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs index 27431fa7412..3d510c2f303 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Hosting.WindowsServices/tests/UseWindowsServiceTests.cs @@ -96,9 +96,9 @@ public void ServiceCollectionExtensionMethodSetsEventLogSourceNameToApplicationN using IHost host = builder.Build(); - var eventLogSettings = host.Services.GetRequiredService< - IOptions - >().Value; + var eventLogSettings = host.Services.GetRequiredService>( + + ).Value; Assert.Same(appName, eventLogSettings.SourceName); } diff --git a/runtime/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs b/runtime/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs index 326722c26a7..b61be154626 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Hosting/src/HostingHostBuilderExtensions.cs @@ -159,8 +159,8 @@ public static IHostBuilder ConfigureHostOptions( Action configureOptions ) { - return hostBuilder.ConfigureServices( - collection => collection.Configure(configureOptions) + return hostBuilder.ConfigureServices(collection => + collection.Configure(configureOptions) ); } @@ -245,12 +245,9 @@ public static IHostBuilder ConfigureDefaults(this IHostBuilder builder, string[] ApplyDefaultAppConfiguration(hostingContext, config, args) ) .ConfigureServices(AddDefaultServices) - .UseServiceProviderFactory( - context => - new DefaultServiceProviderFactory( - CreateDefaultServiceProviderOptions(context) - ) - ); + .UseServiceProviderFactory(context => new DefaultServiceProviderFactory( + CreateDefaultServiceProviderOptions(context) + )); } private static void ApplyDefaultHostConfiguration( @@ -432,8 +429,8 @@ HostBuilderContext context [UnsupportedOSPlatform("tvos")] public static IHostBuilder UseConsoleLifetime(this IHostBuilder hostBuilder) { - return hostBuilder.ConfigureServices( - collection => collection.AddSingleton() + return hostBuilder.ConfigureServices(collection => + collection.AddSingleton() ); } diff --git a/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs b/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs index 449037b75bb..63ccaa60c6d 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/ConsoleLifetimeExitTests.cs @@ -141,8 +141,8 @@ public void EnsureEnvironmentExitDoesntHang() async () => { await Host.CreateDefaultBuilder() - .ConfigureHostOptions( - o => o.ShutdownTimeout = TimeSpan.FromMilliseconds(100) + .ConfigureHostOptions(o => + o.ShutdownTimeout = TimeSpan.FromMilliseconds(100) ) .ConfigureServices( (hostContext, services) => diff --git a/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/OptionsBuilderExtensionsTests.cs b/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/OptionsBuilderExtensionsTests.cs index f0e5c535b80..4a745f1a4bc 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/OptionsBuilderExtensionsTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Hosting/tests/UnitTests/OptionsBuilderExtensionsTests.cs @@ -281,11 +281,10 @@ private async Task ValidateOnStart_AddEagerValidation_DoesValidationWhenHostStar [Fact] private async void CanValidateOptionsEagerly_AddOptionsWithValidateOnStart_IValidateOptions() { - var hostBuilder = CreateHostBuilder( - services => - services - .AddOptionsWithValidateOnStart() - .Configure(o => o.Boolean = false) + var hostBuilder = CreateHostBuilder(services => + services + .AddOptionsWithValidateOnStart() + .Configure(o => o.Boolean = false) ); using (var host = hostBuilder.Build()) @@ -471,15 +470,15 @@ params string[] errorsToMatch { #if NETCOREAPP Assert.True( - e.Failures.FirstOrDefault( - predicate: f => f.Contains(error, StringComparison.CurrentCulture) + e.Failures.FirstOrDefault(predicate: f => + f.Contains(error, StringComparison.CurrentCulture) ) != null, "Did not find: " + error + " " + e.Failures.First() ); #else Assert.True( - e.Failures.FirstOrDefault( - predicate: f => f.IndexOf(error, StringComparison.CurrentCulture) >= 0 + e.Failures.FirstOrDefault(predicate: f => + f.IndexOf(error, StringComparison.CurrentCulture) >= 0 ) != null, "Did not find: " + error + " " + e.Failures.First() ); diff --git a/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientBuilderExtensions.cs b/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientBuilderExtensions.cs index 39a23563f15..0e6a37e4997 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientBuilderExtensions.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientBuilderExtensions.cs @@ -95,8 +95,8 @@ Func configureHandler builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.AdditionalHandlers.Add(configureHandler()) + options.HttpMessageHandlerBuilderActions.Add(b => + b.AdditionalHandlers.Add(configureHandler()) ); } ); @@ -131,8 +131,8 @@ Func configureHandler builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.AdditionalHandlers.Add(configureHandler(b.Services)) + options.HttpMessageHandlerBuilderActions.Add(b => + b.AdditionalHandlers.Add(configureHandler(b.Services)) ); } ); @@ -165,8 +165,8 @@ this IHttpClientBuilder builder builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.AdditionalHandlers.Add(b.Services.GetRequiredService()) + options.HttpMessageHandlerBuilderActions.Add(b => + b.AdditionalHandlers.Add(b.Services.GetRequiredService()) ); } ); @@ -197,8 +197,8 @@ Func configureHandler builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.PrimaryHandler = configureHandler() + options.HttpMessageHandlerBuilderActions.Add(b => + b.PrimaryHandler = configureHandler() ); } ); @@ -235,8 +235,8 @@ Func configureHandler builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.PrimaryHandler = configureHandler(b.Services) + options.HttpMessageHandlerBuilderActions.Add(b => + b.PrimaryHandler = configureHandler(b.Services) ); } ); @@ -270,8 +270,8 @@ this IHttpClientBuilder builder builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => b.PrimaryHandler = b.Services.GetRequiredService() + options.HttpMessageHandlerBuilderActions.Add(b => + b.PrimaryHandler = b.Services.GetRequiredService() ); } ); @@ -304,8 +304,8 @@ Action configureHandler builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => configureHandler(b.PrimaryHandler, b.Services) + options.HttpMessageHandlerBuilderActions.Add(b => + configureHandler(b.PrimaryHandler, b.Services) ); } ); @@ -542,8 +542,8 @@ internal static IHttpClientBuilder AddTypedClientCore< { ReserveClient(builder, typeof(TClient), builder.Name, validateSingleType); - builder.Services.AddTransient( - s => AddTransientHelper(s, builder) + builder.Services.AddTransient(s => + AddTransientHelper(s, builder) ); return builder; @@ -804,8 +804,8 @@ Action, IServiceProvider> configureAdditionalHandlers builder.Name, options => { - options.HttpMessageHandlerBuilderActions.Add( - b => configureAdditionalHandlers(b.AdditionalHandlers, b.Services) + options.HttpMessageHandlerBuilderActions.Add(b => + configureAdditionalHandlers(b.AdditionalHandlers, b.Services) ); } ); diff --git a/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs b/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs index 8c29b6ce4fd..a4fa0e9a98c 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs @@ -38,11 +38,11 @@ public static IServiceCollection AddHttpClient(this IServiceCollection services) // services.TryAddTransient(); services.TryAddSingleton(); - services.TryAddSingleton( - serviceProvider => serviceProvider.GetRequiredService() + services.TryAddSingleton(serviceProvider => + serviceProvider.GetRequiredService() ); - services.TryAddSingleton( - serviceProvider => serviceProvider.GetRequiredService() + services.TryAddSingleton(serviceProvider => + serviceProvider.GetRequiredService() ); // diff --git a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/DependencyInjection/HttpClientFactoryServiceCollectionExtensionsTest.cs b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/DependencyInjection/HttpClientFactoryServiceCollectionExtensionsTest.cs index cb30efb09c1..22398352bef 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/DependencyInjection/HttpClientFactoryServiceCollectionExtensionsTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/DependencyInjection/HttpClientFactoryServiceCollectionExtensionsTest.cs @@ -85,9 +85,10 @@ public void AddHttpClient_DoesNotRegisterDefaultClientIfAlreadyRegistered() { // Arrange var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient( - _ => new HttpClient() { Timeout = TimeSpan.FromSeconds(42) } - ); + serviceCollection.AddTransient(_ => new HttpClient() + { + Timeout = TimeSpan.FromSeconds(42) + }); // Act serviceCollection.AddHttpClient(); @@ -1241,8 +1242,9 @@ public async Task AddHttpClient_MessageHandler_Scope_ScopedDependency() using (var scope = services.GetRequiredService().CreateScope()) { // Act - var client = - scope.ServiceProvider.GetRequiredService(); + var client = scope.ServiceProvider.GetRequiredService( + + ); // Assert var request = new HttpRequestMessage(HttpMethod.Get, "http://example.com/"); diff --git a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/HttpClientLoggerTest.cs b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/HttpClientLoggerTest.cs index c72347a722f..6d620b84d2b 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/HttpClientLoggerTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/HttpClientLoggerTest.cs @@ -104,15 +104,11 @@ public async Task RemoveAllLoggers_OnlyForSpecifiedNames() public async Task CustomLogger_LogsCorrectEvents(bool requestSuccessful, bool async) { var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient( - _ => - new TestMessageHandler( - _ => - requestSuccessful - ? new HttpResponseMessage() - : throw new HttpRequestException("expected") - ) - ); + serviceCollection.AddTransient(_ => new TestMessageHandler(_ => + requestSuccessful + ? new HttpResponseMessage() + : throw new HttpRequestException("expected") + )); TestCountingLogger testLogger = async ? new TestCountingAsyncLogger() @@ -198,15 +194,11 @@ bool asyncSecondCall ) { var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient( - _ => - new TestMessageHandler( - _ => - requestSuccessful - ? new HttpResponseMessage() - : throw new HttpRequestException("expected") - ) - ); + serviceCollection.AddTransient(_ => new TestMessageHandler(_ => + requestSuccessful + ? new HttpResponseMessage() + : throw new HttpRequestException("expected") + )); var testLogger = new TestCountingAsyncLogger(); serviceCollection @@ -277,15 +269,11 @@ bool asyncSecondCall public async Task CustomLogger_WithContext_LogsCorrectEvents(bool requestSuccessful) { var serviceCollection = new ServiceCollection(); - serviceCollection.AddTransient( - _ => - new TestMessageHandler( - _ => - requestSuccessful - ? new HttpResponseMessage() - : throw new HttpRequestException("expected") - ) - ); + serviceCollection.AddTransient(_ => new TestMessageHandler(_ => + requestSuccessful + ? new HttpResponseMessage() + : throw new HttpRequestException("expected") + )); var testLogger = new TestContextCountingLogger(); serviceCollection @@ -395,15 +383,11 @@ public async Task WrapHandlerPipeline_LogCorrectNumberOfEvents() var serviceCollection = new ServiceCollection(); int counter = 1; - serviceCollection.AddTransient( - _ => - new TestMessageHandler( - _ => - ((counter++) % 3 == 0) // every 3rd request is successful - ? new HttpResponseMessage() - : throw new HttpRequestException("expected") - ) - ); + serviceCollection.AddTransient(_ => new TestMessageHandler(_ => + ((counter++) % 3 == 0) // every 3rd request is successful + ? new HttpResponseMessage() + : throw new HttpRequestException("expected") + )); serviceCollection.AddTransient(); var innerLogger = new TestCountingLogger(); @@ -451,8 +435,7 @@ public async Task LoggerFactoryWithHttpClientFactory_NoCircularDependency_Public services.AddSingleton(); services.AddLogging(b => b.SetMinimumLevel(LogLevel.Trace)); - services.AddSingleton( - sp => sp.GetRequiredService() + services.AddSingleton(sp => sp.GetRequiredService() ); services .AddHttpClient("TestLoggerProvider") @@ -476,14 +459,14 @@ public async Task LoggerFactoryWithHttpClientFactory_NoCircularDependency_Public Assert.Equal( DefaultLoggerEventsPerRequest, - sink.Writes.Count( - w => w.LoggerName.StartsWith("System.Net.Http.HttpClient.Production") + sink.Writes.Count(w => + w.LoggerName.StartsWith("System.Net.Http.HttpClient.Production") ) ); Assert.Equal( 0, - sink.Writes.Count( - w => w.LoggerName.StartsWith("System.Net.Http.HttpClient.TestLoggerProvider") + sink.Writes.Count(w => + w.LoggerName.StartsWith("System.Net.Http.HttpClient.TestLoggerProvider") ) ); } @@ -502,8 +485,7 @@ public async Task LoggerFactoryWithHttpClientFactory_NoCircularDependency_DebugL services.AddSingleton(); services.AddLogging(b => b.SetMinimumLevel(LogLevel.Trace)); - services.AddSingleton( - sp => sp.GetRequiredService() + services.AddSingleton(sp => sp.GetRequiredService() ); services .AddHttpClient("TestLoggerProvider") diff --git a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/SocketsHttpHandlerConfigurationTest.cs b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/SocketsHttpHandlerConfigurationTest.cs index 465001c78f4..35769dc4046 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/SocketsHttpHandlerConfigurationTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/SocketsHttpHandlerConfigurationTest.cs @@ -84,11 +84,10 @@ public void UseSocketsHttpHandler_ConfiguredByBuilder_Success() serviceCollection .AddHttpClient("ConfiguredByBuilder") - .UseSocketsHttpHandler( - builder => - builder.Configure( - (handler, _) => handler.ConnectTimeout = TimeSpan.FromSeconds(10) - ) + .UseSocketsHttpHandler(builder => + builder.Configure( + (handler, _) => handler.ConnectTimeout = TimeSpan.FromSeconds(10) + ) ); var services = serviceCollection.BuildServiceProvider(); @@ -117,9 +116,8 @@ public void UseSocketsHttpHandler_ConfiguredByIConfiguration_Success() serviceCollection .AddHttpClient(SectionName) - .UseSocketsHttpHandler( - builder => - builder.Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) + .UseSocketsHttpHandler(builder => + builder.Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) ); var services = serviceCollection.BuildServiceProvider(); @@ -251,17 +249,16 @@ public void UseSocketsHttpHandler_ChainingActionAfterIConfiguration_Updates() serviceCollection .AddHttpClient("ActionAfterIConfiguration") - .UseSocketsHttpHandler( - builder => - builder - .Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) - .Configure( - (handler, _) => - { - handler.ConnectTimeout = TimeSpan.FromSeconds(10); // will overwrite value from IConfiguration - handler.SslOptions = allowAllCertsSslOptions; - } - ) + .UseSocketsHttpHandler(builder => + builder + .Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) + .Configure( + (handler, _) => + { + handler.ConnectTimeout = TimeSpan.FromSeconds(10); // will overwrite value from IConfiguration + handler.SslOptions = allowAllCertsSslOptions; + } + ) ); var services = serviceCollection.BuildServiceProvider(); @@ -298,17 +295,16 @@ public void UseSocketsHttpHandler_ChainingIConfigurationAfterAction_Updates() serviceCollection .AddHttpClient("IConfigurationAfterAction") - .UseSocketsHttpHandler( - builder => - builder - .Configure( - (handler, _) => - { - handler.ConnectTimeout = TimeSpan.FromSeconds(10); // will be overwrittten by IConfiguration - handler.SslOptions = allowAllCertsSslOptions; - } - ) - .Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) + .UseSocketsHttpHandler(builder => + builder + .Configure( + (handler, _) => + { + handler.ConnectTimeout = TimeSpan.FromSeconds(10); // will be overwrittten by IConfiguration + handler.SslOptions = allowAllCertsSslOptions; + } + ) + .Configure(config.GetSection($"{ParentSectionName}:{SectionName}")) ); var services = serviceCollection.BuildServiceProvider(); diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/EventLogLoggerTest.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/EventLogLoggerTest.cs index d401c910a04..d204a972c6c 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/EventLogLoggerTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/EventLogLoggerTest.cs @@ -396,12 +396,9 @@ public TestEventLog(int maxMessageSize) MaxMessageSize = maxMessageSize; Messages = new List(); Entries = - new List<( - string Message, - EventLogEntryType Type, - int EventId, - short Category - )>(); + new List<(string Message, EventLogEntryType Type, int EventId, short Category)>( + + ); } public int MaxMessageSize { get; } diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerBuilderExtensionsTests.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerBuilderExtensionsTests.cs index 1d67cb71c9a..3490f2bf382 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerBuilderExtensionsTests.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerBuilderExtensionsTests.cs @@ -37,8 +37,8 @@ public void AddDebug_BuilderExtensionAddsSingleSetOfServicesWhenCalledTwice() public void CaptureScopesDefaultsToTrue() { var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging( - builder => builder.AddConfiguration(new ConfigurationBuilder().Build()) + serviceCollection.AddLogging(builder => + builder.AddConfiguration(new ConfigurationBuilder().Build()) ); var options = serviceCollection .BuildServiceProvider() diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFactoryExtensionsTest.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFactoryExtensionsTest.cs index 428ca8b84b7..ccf066d2302 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFactoryExtensionsTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFactoryExtensionsTest.cs @@ -44,16 +44,14 @@ public void LoggerFactoryCreateOfT_SingleGeneric_CallsCreateWithCorrectName() // Arrange var factory = new Mock(); factory - .Setup( - f => - f.CreateLogger( - It.Is( - x => - x.Equals( - "Microsoft.Extensions.Logging.Test.GenericClass" - ) + .Setup(f => + f.CreateLogger( + It.Is(x => + x.Equals( + "Microsoft.Extensions.Logging.Test.GenericClass" ) ) + ) ) .Returns(new Mock().Object); @@ -74,16 +72,14 @@ public void LoggerFactoryCreateOfT_TwoGenerics_CallsCreateWithCorrectName() // Arrange var factory = new Mock(); factory - .Setup( - f => - f.CreateLogger( - It.Is( - x => - x.Equals( - "Microsoft.Extensions.Logging.Test.GenericClass" - ) + .Setup(f => + f.CreateLogger( + It.Is(x => + x.Equals( + "Microsoft.Extensions.Logging.Test.GenericClass" ) ) + ) ) .Returns(new Mock().Object); @@ -183,13 +179,12 @@ public void LoggerFactoryCreate_SingleGeneric_CallsCreateWithCorrectName() // Arrange var factory = new Mock(); factory - .Setup( - f => - f.CreateLogger( - It.Is( - x => x.Equals("Microsoft.Extensions.Logging.Test.GenericClass") - ) + .Setup(f => + f.CreateLogger( + It.Is(x => + x.Equals("Microsoft.Extensions.Logging.Test.GenericClass") ) + ) ) .Returns(new Mock().Object); @@ -210,13 +205,12 @@ public void LoggerFactoryCreate_TwoGenerics_CallsCreateWithCorrectName() // Arrange var factory = new Mock(); factory - .Setup( - f => - f.CreateLogger( - It.Is( - x => x.Equals("Microsoft.Extensions.Logging.Test.GenericClass") - ) + .Setup(f => + f.CreateLogger( + It.Is(x => + x.Equals("Microsoft.Extensions.Logging.Test.GenericClass") ) + ) ) .Returns(new Mock().Object); diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFilterTest.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFilterTest.cs index 48395f2a2f3..515a3cb8fd1 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFilterTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerFilterTest.cs @@ -29,11 +29,8 @@ public void ChangingConfigReloadsDefaultFilter() var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) + var factory = TestLoggerBuilder.Create(builder => + builder.AddConfiguration(config.GetSection("Logging")).AddProvider(loggerProvider) ); var logger = factory.CreateLogger("Microsoft"); @@ -77,11 +74,8 @@ public void ChangingConfigFromUseConfigurationReloadsDefaultFilter() }"; var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) + var factory = TestLoggerBuilder.Create(builder => + builder.AddConfiguration(config.GetSection("Logging")).AddProvider(loggerProvider) ); var logger = factory.CreateLogger("Microsoft"); @@ -128,11 +122,8 @@ public void CanFilterOnNamedProviders() var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) + var factory = TestLoggerBuilder.Create(builder => + builder.AddConfiguration(config.GetSection("Logging")).AddProvider(loggerProvider) ); var logger = factory.CreateLogger("Microsoft"); @@ -165,11 +156,8 @@ public void PreferFullNameOverDefaultForFiltering() var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) + var factory = TestLoggerBuilder.Create(builder => + builder.AddConfiguration(config.GetSection("Logging")).AddProvider(loggerProvider) ); var logger = factory.CreateLogger("Microsoft"); @@ -200,11 +188,8 @@ public void DefaultCategoryNameIsUsedIfNoneMatch() var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) + var factory = TestLoggerBuilder.Create(builder => + builder.AddConfiguration(config.GetSection("Logging")).AddProvider(loggerProvider) ); var logger = factory.CreateLogger("Microsoft"); @@ -236,29 +221,28 @@ public void DefaultCategoryNameIsUsedIfNoneMatch() public void AddFilterForMatchingProviderFilters() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter( - (name, cat, level) => - { - if ( - string.Equals( - "Microsoft.Extensions.Logging.Test.TestLoggerProvider", - name - ) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter( + (name, cat, level) => + { + if ( + string.Equals( + "Microsoft.Extensions.Logging.Test.TestLoggerProvider", + name ) + ) + { + if (string.Equals("Test", cat)) { - if (string.Equals("Test", cat)) - { - return level >= LogLevel.Information; - } + return level >= LogLevel.Information; } - - return true; } - ) + + return true; + } + ) ); var logger = factory.CreateLogger("Test"); @@ -277,21 +261,20 @@ public void AddFilterForMatchingProviderFilters() public void AddFilterForNonMatchingProviderDoesNotFilter() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter( - (name, cat, level) => + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter( + (name, cat, level) => + { + if (string.Equals("None", name)) { - if (string.Equals("None", name)) - { - return level >= LogLevel.Error; - } - - return true; + return level >= LogLevel.Error; } - ) + + return true; + } + ) ); var logger = factory.CreateLogger("Test"); @@ -306,12 +289,11 @@ public void AddFilterForNonMatchingProviderDoesNotFilter() public void AddFilterLastWins() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter((name, cat, level) => level >= LogLevel.Warning) - .AddFilter((name, cat, level) => string.Equals(cat, "NotTest")) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter((name, cat, level) => level >= LogLevel.Warning) + .AddFilter((name, cat, level) => string.Equals(cat, "NotTest")) ); var logger = factory.CreateLogger("Test"); @@ -349,12 +331,11 @@ public void ProviderLevelIsPreferredOverGlobalFilter() var config = TestConfiguration.Create(() => json); var loggerProvider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddConfiguration(config.GetSection("Logging")) - .AddProvider(loggerProvider) - .AddFilter((name, cat, level) => level < LogLevel.Critical) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddConfiguration(config.GetSection("Logging")) + .AddProvider(loggerProvider) + .AddFilter((name, cat, level) => level < LogLevel.Critical) ); var logger = factory.CreateLogger("Test"); @@ -378,11 +359,10 @@ public void ProviderLevelIsPreferredOverGlobalFilter() public void AddFilterWithProviderNameCategoryNameAndFilterFuncFiltersCorrectly() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter((cat, level) => level >= LogLevel.Warning) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter((cat, level) => level >= LogLevel.Warning) ); var logger = factory.CreateLogger("Sample.Test"); @@ -401,11 +381,10 @@ public void AddFilterWithProviderNameCategoryNameAndFilterFuncFiltersCorrectly() public void AddFilterWithProviderNameCategoryNameAndMinLevelFiltersCorrectly() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter("Sample", LogLevel.Warning) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter("Sample", LogLevel.Warning) ); var logger = factory.CreateLogger("Sample.Test"); @@ -424,11 +403,10 @@ public void AddFilterWithProviderNameCategoryNameAndMinLevelFiltersCorrectly() public void AddFilterWithProviderNameAndCategoryFilterFuncFiltersCorrectly() { var provider = new TestLoggerProvider(new TestSink(), isEnabled: true); - var factory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider(provider) - .AddFilter((c, l) => l >= LogLevel.Warning) + var factory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(provider) + .AddFilter((c, l) => l >= LogLevel.Warning) ); var logger = factory.CreateLogger("Sample.Test"); @@ -447,21 +425,17 @@ public void AddFilterWithProviderNameAndCategoryFilterFuncFiltersCorrectly() public void LogLevelKeyIsCaseInsensitive() { var serviceProvider = new ServiceCollection() - .AddLogging( - builder => - builder.AddConfiguration( - new ConfigurationBuilder() - .AddInMemoryCollection( - new[] - { - new KeyValuePair( - "logLevel:Default", - "Error" - ) - } - ) - .Build() - ) + .AddLogging(builder => + builder.AddConfiguration( + new ConfigurationBuilder() + .AddInMemoryCollection( + new[] + { + new KeyValuePair("logLevel:Default", "Error") + } + ) + .Build() + ) ) .BuildServiceProvider(); @@ -474,21 +448,17 @@ public void LogLevelKeyIsCaseInsensitive() public void DefaultCategoryIsCaseInsensitive() { var serviceProvider = new ServiceCollection() - .AddLogging( - builder => - builder.AddConfiguration( - new ConfigurationBuilder() - .AddInMemoryCollection( - new[] - { - new KeyValuePair( - "LogLevel:default", - "Error" - ) - } - ) - .Build() - ) + .AddLogging(builder => + builder.AddConfiguration( + new ConfigurationBuilder() + .AddInMemoryCollection( + new[] + { + new KeyValuePair("LogLevel:default", "Error") + } + ) + .Build() + ) ) .BuildServiceProvider(); diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerTest.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerTest.cs index 4195a7f459c..79a0bad90dd 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggerTest.cs @@ -16,18 +16,15 @@ public void Log_IgnoresExceptionInIntermediateLoggersAndThrowsAggregateException { // Arrange var store = new List(); - var loggerFactory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider( - new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) - ) - .AddProvider( - new CustomLoggerProvider("provider2", ThrowExceptionAt.Log, store) - ) - .AddProvider( - new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) - ) + var loggerFactory = TestLoggerBuilder.Create(builder => + builder + .AddProvider( + new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) + ) + .AddProvider(new CustomLoggerProvider("provider2", ThrowExceptionAt.Log, store)) + .AddProvider( + new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) + ) ); var logger = loggerFactory.CreateLogger("Test"); @@ -54,22 +51,17 @@ public void BeginScope_IgnoresExceptionInIntermediateLoggersAndThrowsAggregateEx { // Arrange var store = new List(); - var loggerFactory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider( - new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) - ) - .AddProvider( - new CustomLoggerProvider( - "provider2", - ThrowExceptionAt.BeginScope, - store - ) - ) - .AddProvider( - new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) - ) + var loggerFactory = TestLoggerBuilder.Create(builder => + builder + .AddProvider( + new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) + ) + .AddProvider( + new CustomLoggerProvider("provider2", ThrowExceptionAt.BeginScope, store) + ) + .AddProvider( + new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) + ) ); var logger = loggerFactory.CreateLogger("Test"); @@ -96,18 +88,17 @@ public void IsEnabled_IgnoresExceptionInIntermediateLoggers() { // Arrange var store = new List(); - var loggerFactory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider( - new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) - ) - .AddProvider( - new CustomLoggerProvider("provider2", ThrowExceptionAt.IsEnabled, store) - ) - .AddProvider( - new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) - ) + var loggerFactory = TestLoggerBuilder.Create(builder => + builder + .AddProvider( + new CustomLoggerProvider("provider1", ThrowExceptionAt.None, store) + ) + .AddProvider( + new CustomLoggerProvider("provider2", ThrowExceptionAt.IsEnabled, store) + ) + .AddProvider( + new CustomLoggerProvider("provider3", ThrowExceptionAt.None, store) + ) ); var logger = loggerFactory.CreateLogger("Test"); @@ -137,15 +128,10 @@ public void Log_AggregatesExceptionsFromMultipleLoggers() { // Arrange var store = new List(); - var loggerFactory = TestLoggerBuilder.Create( - builder => - builder - .AddProvider( - new CustomLoggerProvider("provider1", ThrowExceptionAt.Log, store) - ) - .AddProvider( - new CustomLoggerProvider("provider2", ThrowExceptionAt.Log, store) - ) + var loggerFactory = TestLoggerBuilder.Create(builder => + builder + .AddProvider(new CustomLoggerProvider("provider1", ThrowExceptionAt.Log, store)) + .AddProvider(new CustomLoggerProvider("provider2", ThrowExceptionAt.Log, store)) ); var logger = loggerFactory.CreateLogger("Test"); @@ -240,8 +226,8 @@ public void ScopesAreNotCreatedWhenScopesAreDisabled() var factory = TestLoggerBuilder.Create(builder => { builder.AddProvider(provider.Object); - builder.Services.Configure( - options => options.CaptureScopes = false + builder.Services.Configure(options => + options.CaptureScopes = false ); }); @@ -278,8 +264,8 @@ public void ScopesAreNotCreatedInIScopeProviderWhenScopesAreDisabled() var factory = TestLoggerBuilder.Create(builder => { builder.AddProvider(provider.Object); - builder.Services.Configure( - options => options.CaptureScopes = false + builder.Services.Configure(options => + options.CaptureScopes = false ); }); diff --git a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/TraceSourceScopeTest.cs b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/TraceSourceScopeTest.cs index 9a9cb90041d..108fa3870d9 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/TraceSourceScopeTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Logging/tests/Common/TraceSourceScopeTest.cs @@ -17,12 +17,8 @@ public static void DiagnosticsScope_PushesAndPops_LogicalOperationStack() Trace.CorrelationManager.StartLogicalOperation(baseState); var state = "1337state7331"; - var factory = TestLoggerBuilder.Create( - builder => - builder.AddTraceSource( - new SourceSwitch("TestSwitch"), - new ConsoleTraceListener() - ) + var factory = TestLoggerBuilder.Create(builder => + builder.AddTraceSource(new SourceSwitch("TestSwitch"), new ConsoleTraceListener()) ); var logger = factory.CreateLogger("Test"); diff --git a/runtime/src/libraries/Microsoft.Extensions.Options/gen/ParserUtilities.cs b/runtime/src/libraries/Microsoft.Extensions.Options/gen/ParserUtilities.cs index 4ddcc8f767d..37aeb533b5d 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Options/gen/ParserUtilities.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Options/gen/ParserUtilities.cs @@ -41,10 +41,9 @@ internal static bool PropertyHasModifier( SyntaxKind modifierToSearch, CancellationToken token ) => - property.DeclaringSyntaxReferences.Any( - x => - x.GetSyntax(token) is PropertyDeclarationSyntax syntax - && syntax.Modifiers.Any(m => m.IsKind(modifierToSearch)) + property.DeclaringSyntaxReferences.Any(x => + x.GetSyntax(token) is PropertyDeclarationSyntax syntax + && syntax.Modifiers.Any(m => m.IsKind(modifierToSearch)) ); internal static Location? GetLocation(this ISymbol symbol) @@ -97,14 +96,13 @@ SpecialType returnType if ( type.GetMembers(propertyName) .OfType() - .Any( - property => - property.Type.SpecialType == returnType - && property.DeclaredAccessibility == Accessibility.Public - && property.Kind == SymbolKind.Property - && !property.IsStatic - && property.GetMethod != null - && property.Parameters.IsEmpty + .Any(property => + property.Type.SpecialType == returnType + && property.DeclaredAccessibility == Accessibility.Public + && property.Kind == SymbolKind.Property + && !property.IsStatic + && property.GetMethod != null + && property.Parameters.IsEmpty ) ) { @@ -122,13 +120,12 @@ SpecialType returnType interfaceType .GetMembers(propertyName) .OfType() - .Any( - property => - property.Type.SpecialType == returnType - && property.Kind == SymbolKind.Property - && !property.IsStatic - && property.GetMethod != null - && property.Parameters.IsEmpty + .Any(property => + property.Type.SpecialType == returnType + && property.Kind == SymbolKind.Property + && !property.IsStatic + && property.GetMethod != null + && property.Parameters.IsEmpty ) ) { diff --git a/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsMonitorTest.cs b/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsMonitorTest.cs index b497ea45e93..241cb41e7b4 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsMonitorTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsMonitorTest.cs @@ -532,18 +532,17 @@ public void InstantiatesOnlyOneOptionsInstance() using Barrier barrier = new(participantCount: 2); Task[] instanceTasks = Enumerable .Range(0, 2) - .Select( - _ => - Task.Factory.StartNew( - () => - { - barrier.SignalAndWait(); - return monitor.Get("someName"); - }, - CancellationToken.None, - TaskCreationOptions.LongRunning, - TaskScheduler.Default - ) + .Select(_ => + Task.Factory.StartNew( + () => + { + barrier.SignalAndWait(); + return monitor.Get("someName"); + }, + CancellationToken.None, + TaskCreationOptions.LongRunning, + TaskScheduler.Default + ) ) .ToArray(); diff --git a/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs b/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs index 3f943cf1e41..fb195ee1bce 100644 --- a/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs +++ b/runtime/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs @@ -253,11 +253,9 @@ IDictionary expectedValues // Assert var optionsProps = options.GetType().GetProperties().ToDictionary(p => p.Name); - var assertions = expectedValues.Select( - _ => - new Action>( - kvp => Assert.Equal(kvp.Value, optionsProps[kvp.Key].GetValue(options)) - ) + var assertions = expectedValues.Select(_ => new Action>( + kvp => Assert.Equal(kvp.Value, optionsProps[kvp.Key].GetValue(options)) + ) ); Assert.Collection(expectedValues, assertions.ToArray()); } @@ -317,11 +315,9 @@ IDictionary expectedValues // Assert var optionsProps = options.GetType().GetProperties().ToDictionary(p => p.Name); - var assertions = expectedValues.Select( - _ => - new Action>( - kvp => Assert.Equal(kvp.Value, optionsProps[kvp.Key].GetValue(options)) - ) + var assertions = expectedValues.Select(_ => new Action>( + kvp => Assert.Equal(kvp.Value, optionsProps[kvp.Key].GetValue(options)) + ) ); Assert.Collection(expectedValues, assertions.ToArray()); } @@ -371,10 +367,9 @@ public void Options_CanCreateInstancesWithoutDefaultCtor() } ); - services.AddSingleton< - IOptionsFactory, - CustomOptionsFactory - >(); + services.AddSingleton, CustomOptionsFactory>( + + ); var sp = services.BuildServiceProvider(); var optionsWithoutDefaultCtor = sp.GetRequiredService< diff --git a/runtime/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs b/runtime/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs index bfe3ac19651..c578ea2b4c4 100644 --- a/runtime/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs +++ b/runtime/src/libraries/Microsoft.XmlSerializer.Generator/tests/Expected.SerializableAssembly.XmlSerializers.cs @@ -10286,7 +10286,9 @@ public object Read192_Item() o = (global::SerializationTypes.ClassImplementingIXmlSerialiable)ReadSerializable( (System.Xml.Serialization.IXmlSerializable) - new global::SerializationTypes.ClassImplementingIXmlSerialiable() + new global::SerializationTypes.ClassImplementingIXmlSerialiable( + + ) ); break; } @@ -11368,7 +11370,9 @@ bool checkType return null; global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName o; o = - new global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName(); + new global::SerializationTypes.TypeWithKnownTypesOfCollectionsWithConflictingXmlName( + + ); System.Span paramsRead = stackalloc bool[2]; while (Reader.MoveToNextAttribute()) { @@ -12370,7 +12374,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -12435,7 +12441,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -12501,7 +12509,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -12697,7 +12707,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -12761,8 +12773,9 @@ bool checkType if (!ReadNull()) { if ((object)(a) == null) - a = - new global::System.Collections.Generic.List(); + a = new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -13393,7 +13406,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -13455,7 +13470,9 @@ bool checkType { if ((object)(a) == null) a = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List z_0_0 = (global::System.Collections.Generic.List)a; if ((Reader.IsEmptyElement)) @@ -14338,7 +14355,9 @@ bool checkType { if ((object)(o.@Children) == null) o.@Children = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_1_0 = (global::System.Collections.Generic.List) o.@Children; @@ -17037,7 +17056,9 @@ bool checkType { if ((object)(o.@Aliased) == null) o.@Aliased = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List) o.@Aliased; @@ -17103,7 +17124,9 @@ bool checkType { if ((object)(o.@Aliased) == null) o.@Aliased = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List) o.@Aliased; @@ -17170,7 +17193,9 @@ bool checkType { if ((object)(o.@Aliased) == null) o.@Aliased = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List) o.@Aliased; @@ -18322,7 +18347,9 @@ bool checkType { if ((object)(o.@Parameters) == null) o.@Parameters = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List) o.@Parameters; @@ -19342,8 +19369,9 @@ bool checkType global::SerializationTypes.TypeWithMyCollectionField o; o = new global::SerializationTypes.TypeWithMyCollectionField(); if ((object)(o.@Collection) == null) - o.@Collection = - new global::SerializationTypes.MyCollection(); + o.@Collection = new global::SerializationTypes.MyCollection( + + ); global::SerializationTypes.MyCollection a_0 = (global::SerializationTypes.MyCollection)o.@Collection; System.Span paramsRead = stackalloc bool[1]; @@ -19382,7 +19410,9 @@ bool checkType { if ((object)(o.@Collection) == null) o.@Collection = - new global::SerializationTypes.MyCollection(); + new global::SerializationTypes.MyCollection( + + ); global::SerializationTypes.MyCollection a_0_0 = (global::SerializationTypes.MyCollection) o.@Collection; @@ -20347,7 +20377,9 @@ bool checkType { if ((object)(o.@ListProperty) == null) o.@ListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List) o.@ListProperty; @@ -20543,7 +20575,9 @@ bool checkType { if ((object)(o.@ListProperty) == null) o.@ListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List) o.@ListProperty; @@ -20748,7 +20782,9 @@ bool checkType { if ((object)(o.@ListProperty) == null) o.@ListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_3_0 = (global::System.Collections.Generic.List) o.@ListProperty; @@ -22011,8 +22047,9 @@ bool checkType ca_7_0, typeof(global::System.Object) ); - a_7_0[ca_7_0++] = - Reader.ReadElementString(); + a_7_0[ca_7_0++] = Reader.ReadElementString( + + ); } break; } @@ -22539,7 +22576,9 @@ bool checkType { if ((object)(o.@UnqualifiedSchemaFormListProperty) == null) o.@UnqualifiedSchemaFormListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_0_0 = (global::System.Collections.Generic.List) o.@UnqualifiedSchemaFormListProperty; @@ -22603,7 +22642,9 @@ bool checkType { if ((object)(o.@NoneSchemaFormListProperty) == null) o.@NoneSchemaFormListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_1_0 = (global::System.Collections.Generic.List) o.@NoneSchemaFormListProperty; @@ -22663,7 +22704,9 @@ bool checkType { if ((object)(o.@QualifiedSchemaFormListProperty) == null) o.@QualifiedSchemaFormListProperty = - new global::System.Collections.Generic.List(); + new global::System.Collections.Generic.List( + + ); global::System.Collections.Generic.List a_2_0 = (global::System.Collections.Generic.List) o.@QualifiedSchemaFormListProperty; diff --git a/runtime/src/libraries/System.CodeDom/src/System/CodeDom/CodeNamespace.cs b/runtime/src/libraries/System.CodeDom/src/System/CodeDom/CodeNamespace.cs index eceadcecef2..47f582c8cf8 100644 --- a/runtime/src/libraries/System.CodeDom/src/System/CodeDom/CodeNamespace.cs +++ b/runtime/src/libraries/System.CodeDom/src/System/CodeDom/CodeNamespace.cs @@ -7,12 +7,14 @@ namespace System.CodeDom public class CodeNamespace : CodeObject { private string _name; - private readonly CodeNamespaceImportCollection _imports = - new CodeNamespaceImportCollection(); + private readonly CodeNamespaceImportCollection _imports = new CodeNamespaceImportCollection( + + ); private readonly CodeCommentStatementCollection _comments = new CodeCommentStatementCollection(); - private readonly CodeTypeDeclarationCollection _classes = - new CodeTypeDeclarationCollection(); + private readonly CodeTypeDeclarationCollection _classes = new CodeTypeDeclarationCollection( + + ); private int _populated; private const int ImportsCollection = 0x1; diff --git a/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceTests.cs b/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceTests.cs index 3cc697bb391..a83d37480e7 100644 --- a/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceTests.cs +++ b/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeReferenceTests.cs @@ -55,8 +55,8 @@ public void Ctor_Type(Type type, string expectedBaseType) var typeReference = new CodeTypeReference(type); string expectedArrayElementType = type.IsArray ? type.GetElementType().FullName : null; int expectedArrayRank = type.IsArray ? type.GetArrayRank() : 0; - string[] expectedTypeArguments = type.GenericTypeArguments.Select( - arg => arg.IsGenericType ? arg.GetGenericTypeDefinition().FullName : arg.FullName + string[] expectedTypeArguments = type.GenericTypeArguments.Select(arg => + arg.IsGenericType ? arg.GetGenericTypeDefinition().FullName : arg.FullName ) .ToArray(); VerifyCodeTypeReference( diff --git a/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/VBCodeGenerationTests.cs b/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/VBCodeGenerationTests.cs index d76ffaee2e9..1d951e683dc 100644 --- a/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/VBCodeGenerationTests.cs +++ b/runtime/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/VBCodeGenerationTests.cs @@ -2867,14 +2867,16 @@ static CodeStatement CreateStatement(string objName, int iNum) fooMethod1.Attributes = MemberAttributes.Public; fooMethod1.ReturnType = new CodeTypeReference(typeof(string)); - CodeParameterDeclarationExpression parameter1 = - new CodeParameterDeclarationExpression(); + CodeParameterDeclarationExpression parameter1 = new CodeParameterDeclarationExpression( + + ); parameter1.Name = "format"; parameter1.Type = new CodeTypeReference(typeof(string)); fooMethod1.Parameters.Add(parameter1); - CodeParameterDeclarationExpression parameter2 = - new CodeParameterDeclarationExpression(); + CodeParameterDeclarationExpression parameter2 = new CodeParameterDeclarationExpression( + + ); parameter2.Name = "array"; parameter2.Type = new CodeTypeReference(typeof(object[])); parameter2.CustomAttributes.Add( diff --git a/runtime/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionTests.cs b/runtime/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionTests.cs index da7e6d9aa98..ead1af70a9b 100644 --- a/runtime/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionTests.cs +++ b/runtime/src/libraries/System.Collections.Concurrent/tests/BlockingCollectionTests.cs @@ -183,10 +183,9 @@ public static void TestDebuggerAttributes() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); int[] items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs b/runtime/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs index 8b11188e866..bcd8e1a51b7 100644 --- a/runtime/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs +++ b/runtime/src/libraries/System.Collections.Concurrent/tests/ProducerConsumerCollectionTests.cs @@ -242,21 +242,20 @@ bool take WaitAllOrAnyFailed( Enumerable .Range(0, threadsCount) - .Select( - threadNum => - ThreadFactory.StartNew(() => + .Select(threadNum => + ThreadFactory.StartNew(() => + { + b.SignalAndWait(); + for (int j = 0; j < itemsPerThread; j++) { - b.SignalAndWait(); - for (int j = 0; j < itemsPerThread; j++) + int data; + if (take ? c.TryTake(out data) : TryPeek(c, out data)) { - int data; - if (take ? c.TryTake(out data) : TryPeek(c, out data)) - { - Interlocked.Increment(ref successes); - Assert.NotEqual(0, data); // shouldn't be default(T) - } + Interlocked.Increment(ref successes); + Assert.NotEqual(0, data); // shouldn't be default(T) } - }) + } + }) ) .ToArray() ); @@ -583,37 +582,35 @@ int producerSpin Task[] producers = Enumerable .Range(0, numThreadsPerConsumerProducer) - .Select( - _ => - ThreadFactory.StartNew(() => + .Select(_ => + ThreadFactory.StartNew(() => + { + for (int i = 1; i <= numItemsPerThread; i++) { - for (int i = 1; i <= numItemsPerThread; i++) - { - for (int j = 0; j < producerSpin; j++) - dummy *= j; // spin a little - bc.Add(i); - } - }) + for (int j = 0; j < producerSpin; j++) + dummy *= j; // spin a little + bc.Add(i); + } + }) ) .ToArray(); Task[] consumers = Enumerable .Range(0, numThreadsPerConsumerProducer) - .Select( - _ => - ThreadFactory.StartNew(() => + .Select(_ => + ThreadFactory.StartNew(() => + { + for (int i = 0; i < numItemsPerThread; i++) { - for (int i = 0; i < numItemsPerThread; i++) - { - const int TimeoutMs = 100000; - int item; - Assert.True( - bc.TryTake(out item, TimeoutMs), - $"Couldn't get {i}th item after {TimeoutMs}ms" - ); - Assert.NotEqual(0, item); - } - }) + const int TimeoutMs = 100000; + int item; + Assert.True( + bc.TryTake(out item, TimeoutMs), + $"Couldn't get {i}th item after {TimeoutMs}ms" + ); + Assert.NotEqual(0, item); + } + }) ) .ToArray(); @@ -844,32 +841,31 @@ double seconds { Task[] tasks = Enumerable .Range(0, b.ParticipantCount) - .Select( - _ => - ThreadFactory.StartNew(() => - { - b.SignalAndWait(); + .Select(_ => + ThreadFactory.StartNew(() => + { + b.SignalAndWait(); - int count = 0; - var rand = new Random(); + int count = 0; + var rand = new Random(); - while (DateTime.UtcNow < end) + while (DateTime.UtcNow < end) + { + if (rand.NextDouble() < .5) { - if (rand.NextDouble() < .5) - { - Assert.True(c.TryAdd(rand.Next())); - count++; - } - else - { - int item; - if (c.TryTake(out item)) - count--; - } + Assert.True(c.TryAdd(rand.Next())); + count++; + } + else + { + int item; + if (c.TryTake(out item)) + count--; } + } - return count; - }) + return count; + }) ) .ToArray(); Task.WaitAll(tasks); @@ -1128,10 +1124,9 @@ public void DebuggerAttributes_Success(int count) IProducerConsumerCollection c = CreateProducerConsumerCollection(count); DebuggerAttributes.ValidateDebuggerDisplayReferences(c); DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(c); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); Array items = itemProperty.GetValue(info.Instance) as Array; Assert.Equal(c, items.Cast()); diff --git a/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary.cs b/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary.cs index 7e875927c03..4427ebb6856 100644 --- a/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary.cs +++ b/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableDictionary.cs @@ -194,13 +194,10 @@ public static ImmutableDictionary ToImmutableDictionary< return ImmutableDictionary .Empty.WithComparers(keyComparer, valueComparer) .AddRange( - source.Select( - element => - new KeyValuePair( - keySelector(element), - elementSelector(element) - ) - ) + source.Select(element => new KeyValuePair( + keySelector(element), + elementSelector(element) + )) ); } diff --git a/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs b/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs index 9a466946f73..51792525147 100644 --- a/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs +++ b/runtime/src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs @@ -190,13 +190,10 @@ public static ImmutableSortedDictionary ToImmutableSortedDictionar return ImmutableSortedDictionary .Empty.WithComparers(keyComparer, valueComparer) .AddRange( - source.Select( - element => - new KeyValuePair( - keySelector(element), - elementSelector(element) - ) - ) + source.Select(element => new KeyValuePair( + keySelector(element), + elementSelector(element) + )) ); } diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs index c0dfa5cbe44..c223573e3dc 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayBuilderTest.cs @@ -1275,10 +1275,9 @@ public void DebuggerAttributesValid() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( builder ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); string[] items = itemProperty.GetValue(info.Instance) as string[]; Assert.Equal(builder, items); diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs index d208f9df509..0af4d1dec74 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableArrayTest.cs @@ -1951,18 +1951,17 @@ public void Remove(IEnumerable source, T item, IEqualityComparer compar public static IEnumerable RemoveData() { return SharedEqualityComparers() - .SelectMany( - comparer => - new[] - { - new object[] { s_manyElements, 1, comparer }, - new object[] { s_manyElements, 2, comparer }, - new object[] { s_manyElements, 3, comparer }, - new object[] { s_manyElements, 4, comparer }, - new object[] { new int[0], 4, comparer }, - new object[] { new int[] { 1, 4 }, 4, comparer }, - new object[] { s_oneElement, 1, comparer } - } + .SelectMany(comparer => + new[] + { + new object[] { s_manyElements, 1, comparer }, + new object[] { s_manyElements, 2, comparer }, + new object[] { s_manyElements, 3, comparer }, + new object[] { s_manyElements, 4, comparer }, + new object[] { new int[0], 4, comparer }, + new object[] { new int[] { 1, 4 }, 4, comparer }, + new object[] { s_oneElement, 1, comparer } + } ); } @@ -2071,92 +2070,71 @@ public void RemoveRangeEnumerable( public static IEnumerable RemoveRangeEnumerableData() { return SharedEqualityComparers() - .SelectMany( - comparer => - new[] + .SelectMany(comparer => + new[] + { + new object[] { Array.Empty(), Array.Empty(), comparer }, + new object[] { Array.Empty(), new int?[] { 1 }, comparer }, + new object[] { new int?[] { 1 }, Array.Empty(), comparer }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 2, 3, 4 }, comparer }, + new object[] { - new object[] { Array.Empty(), Array.Empty(), comparer }, - new object[] { Array.Empty(), new int?[] { 1 }, comparer }, - new object[] { new int?[] { 1 }, Array.Empty(), comparer }, - new object[] - { - new int?[] { 1, 2, 3 }, - new int?[] { 2, 3, 4 }, - comparer - }, - new object[] - { - Enumerable.Range(1, 5).Cast(), - Enumerable.Range(6, 5).Cast(), - comparer - }, - new object[] { new int?[] { 1, 2, 3 }, new int?[] { 2 }, comparer }, - new object[] - { - new int?[] { 1, 2, 3 }, - new int?[] { 1, 3, 5 }, - comparer - }, - new object[] - { - Enumerable.Range(1, 10).Cast(), - new int?[] { 2, 4, 5, 7, 10 }, - comparer - }, - new object[] - { - Enumerable.Range(1, 10).Cast(), - new int?[] { 1, 2, 4, 5, 7, 10 }, - comparer - }, - new object[] { new int?[] { 1, 2, 3 }, new int?[] { 5 }, comparer }, - new object[] { new int?[] { 1, 2, 2, 3 }, new int?[] { 2 }, comparer }, - new object[] - { - new int?[] { 1, 2, 2, 3 }, - new int?[] { 2, 2 }, - comparer - }, - new object[] - { - new int?[] { 1, 2, 2, 3 }, - new int?[] { 2, 2, 2 }, - comparer - }, - new object[] { new int?[] { 1, 2, 3 }, new int?[] { 42 }, comparer }, - new object[] - { - new int?[] { 1, 2, 3 }, - new int?[] { 42, 42 }, - comparer - }, - new object[] - { - new int?[] { 1, 2, 3 }, - new int?[] { 42, 42, 42 }, - comparer - }, - new object[] { new int?[] { null }, new int?[] { 1 }, comparer }, - new object[] { new int?[] { 1 }, new int?[] { null }, comparer }, - new object[] - { - new int?[] { 1, null, 2, null }, - new int?[] { 1, null }, - comparer - }, - new object[] - { - new int?[] { 1, null, 2 }, - new int?[] { 1, null, null }, - comparer - }, - new object[] - { - new int?[] { 1, null, 2, null }, - new int?[] { 1, null, null }, - comparer - }, - } + Enumerable.Range(1, 5).Cast(), + Enumerable.Range(6, 5).Cast(), + comparer + }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 2 }, comparer }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 1, 3, 5 }, comparer }, + new object[] + { + Enumerable.Range(1, 10).Cast(), + new int?[] { 2, 4, 5, 7, 10 }, + comparer + }, + new object[] + { + Enumerable.Range(1, 10).Cast(), + new int?[] { 1, 2, 4, 5, 7, 10 }, + comparer + }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 5 }, comparer }, + new object[] { new int?[] { 1, 2, 2, 3 }, new int?[] { 2 }, comparer }, + new object[] { new int?[] { 1, 2, 2, 3 }, new int?[] { 2, 2 }, comparer }, + new object[] + { + new int?[] { 1, 2, 2, 3 }, + new int?[] { 2, 2, 2 }, + comparer + }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 42 }, comparer }, + new object[] { new int?[] { 1, 2, 3 }, new int?[] { 42, 42 }, comparer }, + new object[] + { + new int?[] { 1, 2, 3 }, + new int?[] { 42, 42, 42 }, + comparer + }, + new object[] { new int?[] { null }, new int?[] { 1 }, comparer }, + new object[] { new int?[] { 1 }, new int?[] { null }, comparer }, + new object[] + { + new int?[] { 1, null, 2, null }, + new int?[] { 1, null }, + comparer + }, + new object[] + { + new int?[] { 1, null, 2 }, + new int?[] { 1, null, null }, + comparer + }, + new object[] + { + new int?[] { 1, null, 2, null }, + new int?[] { 1, null, null }, + comparer + }, + } ); } @@ -2435,17 +2413,16 @@ IEqualityComparer comparer public static IEnumerable ReplaceData() { return SharedEqualityComparers() - .SelectMany( - comparer => - new[] - { - new object[] { s_oneElement, 1, 5, comparer }, - new object[] { s_manyElements, 1, 6, comparer }, - new object[] { s_manyElements, 2, 6, comparer }, - new object[] { s_manyElements, 3, 6, comparer }, - new object[] { new[] { 1, 3, 3, 4 }, 3, 2, comparer }, - new object[] { s_manyElements, 2, 10, comparer } - } + .SelectMany(comparer => + new[] + { + new object[] { s_oneElement, 1, 5, comparer }, + new object[] { s_manyElements, 1, 6, comparer }, + new object[] { s_manyElements, 2, 6, comparer }, + new object[] { s_manyElements, 3, 6, comparer }, + new object[] { new[] { 1, 3, 3, 4 }, 3, 2, comparer }, + new object[] { s_manyElements, 2, 10, comparer } + } ); } @@ -2890,25 +2867,24 @@ public void Sort(IEnumerable source, int index, int count, IComparer co public static IEnumerable SortData() { return SharedComparers() - .SelectMany( - comparer => - new[] + .SelectMany(comparer => + new[] + { + new object[] { new[] { 2, 4, 1, 3 }, 0, 4, comparer }, + new object[] { new[] { 1 }, 0, 1, comparer }, + new object[] { new int[0], 0, 0, comparer }, + new object[] { new[] { 2, 4, 1, 3 }, 1, 2, comparer }, + new object[] { new[] { 2, 4, 1, 3 }, 4, 0, comparer }, + new object[] { - new object[] { new[] { 2, 4, 1, 3 }, 0, 4, comparer }, - new object[] { new[] { 1 }, 0, 1, comparer }, - new object[] { new int[0], 0, 0, comparer }, - new object[] { new[] { 2, 4, 1, 3 }, 1, 2, comparer }, - new object[] { new[] { 2, 4, 1, 3 }, 4, 0, comparer }, - new object[] - { - new[] { "c", "B", "a" }, - 0, - 3, - StringComparer.OrdinalIgnoreCase - }, - new object[] { new[] { "c", "B", "a" }, 0, 3, StringComparer.Ordinal }, - new object[] { new[] { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }, 4, 2, comparer } - } + new[] { "c", "B", "a" }, + 0, + 3, + StringComparer.OrdinalIgnoreCase + }, + new object[] { new[] { "c", "B", "a" }, 0, 3, StringComparer.Ordinal }, + new object[] { new[] { 1, 2, 3, 4, 6, 5, 7, 8, 9, 10 }, 4, 2, comparer } + } ); } @@ -3257,9 +3233,8 @@ public static IEnumerable IStructuralEquatableGetHashCodeData() return SharedComparers() .OfType() .Except(new IEqualityComparer[] { null }) - .SelectMany( - comparer => - enumerables.Select(enumerable => new object[] { enumerable, comparer }) + .SelectMany(comparer => + enumerables.Select(enumerable => new object[] { enumerable, comparer }) ); } @@ -3533,24 +3508,23 @@ public static IEnumerable IStructuralComparableCompareToInvalidData() return SharedComparers() .OfType() .Except(new IComparer[] { null }) - .SelectMany( - comparer => - new[] + .SelectMany(comparer => + new[] + { + new object[] { new[] { 1, 2, 3 }, new[] { 1, 2, 3, 4 }, comparer }, + new object[] { - new object[] { new[] { 1, 2, 3 }, new[] { 1, 2, 3, 4 }, comparer }, - new object[] - { - new[] { 1, 2, 3 }, - ImmutableArray.Create(1, 2, 3, 4), - comparer - }, - new object[] - { - new[] { 1, 2, 3 }, - new List { 1, 2, 3 }, - comparer - } + new[] { 1, 2, 3 }, + ImmutableArray.Create(1, 2, 3, 4), + comparer + }, + new object[] + { + new[] { 1, 2, 3 }, + new List { 1, 2, 3 }, + comparer } + } ); } @@ -3675,10 +3649,9 @@ public void DebuggerAttributesValid() ImmutableArray array = ImmutableArray.Create(1, 2, 3, 4); FieldInfo itemField = typeof(ImmutableArray) .GetFields(BindingFlags.Instance | BindingFlags.NonPublic) - .Single( - fi => - fi.GetCustomAttribute()?.State - == DebuggerBrowsableState.RootHidden + .Single(fi => + fi.GetCustomAttribute()?.State + == DebuggerBrowsableState.RootHidden ); int[] items = itemField.GetValue(array) as int[]; Assert.Equal(array, items); diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs index a0048c2888d..d2e0b33a260 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryBuilderTest.cs @@ -333,10 +333,9 @@ public void DebuggerAttributesValid() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( builder ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTestBase.nonnetstandard.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTestBase.nonnetstandard.cs index e787f54d537..766b5337e8d 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTestBase.nonnetstandard.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableDictionaryTestBase.nonnetstandard.cs @@ -96,13 +96,10 @@ public void AddRangeTest() map = map.AddRange( Enumerable .Range(1, 100) - .Select( - n => - new KeyValuePair( - n, - new GenericParameterHelper() - ) - ) + .Select(n => new KeyValuePair( + n, + new GenericParameterHelper() + )) ); CollectionAssertAreEquivalent( map.Select(kv => kv.Key).ToList(), diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableHashSetTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableHashSetTest.cs index 5ee6c367d5c..a4cd8ea6685 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableHashSetTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableHashSetTest.cs @@ -194,10 +194,9 @@ public void DebuggerAttributesValid() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( set ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); int[] items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(set, items); diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs index 505cdbf6074..3c52845b558 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableListTest.cs @@ -923,10 +923,9 @@ public void DebuggerAttributesValid() "_root" ); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); double[] items = itemProperty.GetValue(info.Instance) as double[]; Assert.Equal(list, items); diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableQueueTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableQueueTest.cs index 6338749bcf5..898e89475b6 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableQueueTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableQueueTest.cs @@ -290,10 +290,9 @@ public void DebuggerAttributesValid() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( queue ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); string[] items = itemProperty.GetValue(info.Instance) as string[]; Assert.Equal(queue, items); diff --git a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs index 60e54b9f093..142caa73877 100644 --- a/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs +++ b/runtime/src/libraries/System.Collections.Immutable/tests/ImmutableSortedDictionaryTest.cs @@ -132,13 +132,10 @@ public void ToUnorderedTest() .AddRange( Enumerable .Range(1, 100) - .Select( - n => - new KeyValuePair( - n, - new GenericParameterHelper(n) - ) - ) + .Select(n => new KeyValuePair( + n, + new GenericParameterHelper(n) + )) ); ImmutableDictionary unsortedMap = sortedMap.ToImmutableDictionary(); @@ -528,10 +525,9 @@ public void DebuggerAttributesValid() "_root" ); DebuggerAttributes.ValidateDebuggerDisplayReferences(rootNode); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); KeyValuePair[] items = itemProperty.GetValue(info.Instance) as KeyValuePair[]; diff --git a/runtime/src/libraries/System.Collections.NonGeneric/tests/StackTests.cs b/runtime/src/libraries/System.Collections.NonGeneric/tests/StackTests.cs index ac52206a82f..b9c42d17f36 100644 --- a/runtime/src/libraries/System.Collections.NonGeneric/tests/StackTests.cs +++ b/runtime/src/libraries/System.Collections.NonGeneric/tests/StackTests.cs @@ -88,8 +88,8 @@ public static void DebuggerAttribute() DebuggerAttributeInfo debuggerAttribute = DebuggerAttributes.ValidateDebuggerTypeProxyProperties(stack); - PropertyInfo infoProperty = debuggerAttribute.Properties.Single( - property => property.Name == "Items" + PropertyInfo infoProperty = debuggerAttribute.Properties.Single(property => + property.Name == "Items" ); object[] items = (object[])infoProperty.GetValue(debuggerAttribute.Instance); diff --git a/runtime/src/libraries/System.Collections/tests/BitArray/BitArray_GetSetTests.cs b/runtime/src/libraries/System.Collections/tests/BitArray/BitArray_GetSetTests.cs index 7e8dabd1eb7..04724ad7657 100644 --- a/runtime/src/libraries/System.Collections/tests/BitArray/BitArray_GetSetTests.cs +++ b/runtime/src/libraries/System.Collections/tests/BitArray/BitArray_GetSetTests.cs @@ -778,13 +778,12 @@ public static void HasAnySet(bool[] bits, bool expectedResult) public static IEnumerable HasAllSet_TestData() => HasAnySet_TestData() - .Select( - parameters => - new object[] - { - ((bool[])parameters[0]).Select(bit => !bit).ToArray(), - !(bool)parameters[1] - } + .Select(parameters => + new object[] + { + ((bool[])parameters[0]).Select(bit => !bit).ToArray(), + !(bool)parameters[1] + } ); public static IEnumerable HasAnySet_TestData() diff --git a/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs b/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs index 70f90608250..c84d2793df0 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/PartBuilder.cs @@ -47,13 +47,13 @@ internal PartBuilder(Predicate selectType) _creationPolicy = CreationPolicy.Any; _typeExportBuilders = new List(); _propertyExports = - new List< - Tuple, Action, Type> - >(); + new List, Action, Type>>( + + ); _propertyImports = - new List< - Tuple, Action, Type> - >(); + new List, Action, Type>>( + + ); _interfaceExports = new List, Action>>(); } diff --git a/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/RegistrationBuilder.cs b/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/RegistrationBuilder.cs index 19d4dca87bd..8d4181fa405 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/RegistrationBuilder.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition.Registration/src/System/ComponentModel/Composition/Registration/RegistrationBuilder.cs @@ -117,8 +117,8 @@ private List>> EvaluateThisTypeAgainstTheConventio bool matchedConvention = false; foreach ( - PartBuilder builder in _conventions.Where( - c => c.SelectType(type.UnderlyingSystemType) + PartBuilder builder in _conventions.Where(c => + c.SelectType(type.UnderlyingSystemType) ) ) { diff --git a/runtime/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/PartBuilderOfTTests.cs b/runtime/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/PartBuilderOfTTests.cs index 63110dbeb39..ceeddc66398 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/PartBuilderOfTTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/PartBuilderOfTTests.cs @@ -284,9 +284,9 @@ public void ManuallySelectingConstructor_SelectsTheExplicitOne() { var builder = InternalCalls.PartBuilder(t => true); builder - .SelectConstructor( - param => new FooImplWithConstructors(param.Import>()) - ) + .SelectConstructor(param => new FooImplWithConstructors( + param.Import>() + )) .Export(); IEnumerable typeAtts; @@ -322,9 +322,9 @@ public void ManuallySelectingConstructor_SelectsTheExplicitOne_IEnumerableParame { var builder = InternalCalls.PartBuilder(t => true); builder - .SelectConstructor( - param => new FooImplWithConstructors(param.Import>()) - ) + .SelectConstructor(param => new FooImplWithConstructors( + param.Import>() + )) .Export(); IEnumerable typeAtts; diff --git a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CompositionServices.cs b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CompositionServices.cs index 71306a795e5..0e5b14e5535 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CompositionServices.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/CompositionServices.cs @@ -618,9 +618,10 @@ internal static IEnumerable> GetRequiredMetadata( // NOTE : this is a carefully found balance between eager and delay-evaluation - the properties are filtered once and upfront // whereas the key/Type pairs are created every time. The latter is fine as KVPs are structs and as such copied on access regardless. // This also allows us to avoid creation of List which - at least according to FxCop - leads to isues with NGEN - return properties.Select( - property => new KeyValuePair(property.Name, property.PropertyType) - ); + return properties.Select(property => new KeyValuePair( + property.Name, + property.PropertyType + )); } internal static IDictionary GetImportMetadata( diff --git a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs index 303ded9285d..2f2a4d1e702 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/ImportEngine.RecompositionManager.cs @@ -57,8 +57,8 @@ public static IEnumerable GetAffectedImports( IEnumerable changedExports ) { - return part.ImportDefinitions.Where( - import => IsAffectedImport(import, changedExports) + return part.ImportDefinitions.Where(import => + IsAffectedImport(import, changedExports) ); } diff --git a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs index 6e8e17d5ac4..56700591f0c 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/src/System/ComponentModel/Composition/Hosting/TypeCatalog.cs @@ -367,8 +367,8 @@ private Dictionary> CreateIndex() foreach (var part in PartsInternal) { foreach ( - string contractName in part.ExportDefinitions.Select( - export => export.ContractName + string contractName in part.ExportDefinitions.Select(export => + export.ContractName ) .Distinct() ) diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs index 2e2e0efd27b..32eb3293ee2 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/INotifyImportTests.cs @@ -29,8 +29,9 @@ public void ImportsSatisfiedOnComponentWithoutImports() typeof(PartWithoutImports) ); - PartWithoutImports partWithoutImports = - container.GetExportedValue(); + PartWithoutImports partWithoutImports = container.GetExportedValue( + + ); Assert.NotNull(partWithoutImports); Assert.True(partWithoutImports.ImportsSatisfiedInvoked); diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionServicesTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionServicesTests.cs index 18afc8bf88d..2f5cd6a26c7 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionServicesTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/CompositionServicesTests.cs @@ -107,10 +107,9 @@ public void GetDefaultContractNameTest() "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)[][,,,,]" ); expectations.Add( - typeof(GenericContract4.GenericContract5< - double, - int - >).MakePointerType(), + typeof(GenericContract4.GenericContract5).MakePointerType( + + ), "System.ComponentModel.Composition.GenericContract4(System.Int32,System.Double)+GenericContract5(System.Double,System.Int32)*" ); expectations.Add( diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs index 6a341750c8b..87b9b10f6bb 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/DirectoryCatalogTests.cs @@ -595,10 +595,9 @@ ExportDefinition exportDefinition (part, export) => new Tuple(part, export) ) - .Where( - partAndExport => - partAndExport.Item2.ContractName - == AttributedModelServices.GetContractName(typeof(MyExport)) + .Where(partAndExport => + partAndExport.Item2.ContractName + == AttributedModelServices.GetContractName(typeof(MyExport)) ); Assert.True(matchingExports.SequenceEqual(expectedMatchingExports)); diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/FilteredCatalogTransitiveClosureTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/FilteredCatalogTransitiveClosureTests.cs index 6d80aec5fd9..6b5e5d7e29b 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/FilteredCatalogTransitiveClosureTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/FilteredCatalogTransitiveClosureTests.cs @@ -120,8 +120,8 @@ public void IncludeDependentsSimpleChainOptionalOnly() var filteredCatalog = catalog.Filter(p => p.Exports()); Assert.Equal(1, filteredCatalog.Parts.Count()); - var dependentsCatalog = filteredCatalog.IncludeDependents( - i => i.Cardinality == ImportCardinality.ZeroOrOne + var dependentsCatalog = filteredCatalog.IncludeDependents(i => + i.Cardinality == ImportCardinality.ZeroOrOne ); Assert.Equal(2, dependentsCatalog.Parts.Count()); } @@ -142,8 +142,8 @@ public void IncludeDependentsChainWithCyclesOptionalOnly() var filteredCatalog = catalog.Filter(p => p.Exports()); Assert.Equal(2, filteredCatalog.Parts.Count()); - var dependentsCatalog = filteredCatalog.IncludeDependents( - i => i.Cardinality == ImportCardinality.ZeroOrOne + var dependentsCatalog = filteredCatalog.IncludeDependents(i => + i.Cardinality == ImportCardinality.ZeroOrOne ); Assert.Equal(3, dependentsCatalog.Parts.Count()); } @@ -312,8 +312,8 @@ public void IncludeDependenciesSimpleChainOptionalOnly() var filteredCatalog = catalog.Filter(p => p.Exports()); Assert.Equal(3, filteredCatalog.Parts.Count()); - var dependentsCatalog = filteredCatalog.IncludeDependencies( - i => i.Cardinality == ImportCardinality.ZeroOrOne + var dependentsCatalog = filteredCatalog.IncludeDependencies(i => + i.Cardinality == ImportCardinality.ZeroOrOne ); Assert.Equal(4, dependentsCatalog.Parts.Count()); } @@ -333,8 +333,8 @@ public void IncludeDependenciesChainWithCyclesOptionalOnly() var filteredCatalog = catalog.Filter(p => p.Exports()); Assert.Equal(2, filteredCatalog.Parts.Count()); - var dependentsCatalog = filteredCatalog.IncludeDependencies( - i => i.Cardinality == ImportCardinality.ZeroOrOne + var dependentsCatalog = filteredCatalog.IncludeDependencies(i => + i.Cardinality == ImportCardinality.ZeroOrOne ); Assert.Equal(4, dependentsCatalog.Parts.Count()); } diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/ScopeExtensionsTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/ScopeExtensionsTests.cs index 4f2f558342c..454cf9ce1b7 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/ScopeExtensionsTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Hosting/ScopeExtensionsTests.cs @@ -95,8 +95,9 @@ public void Imports() public void Imports_CardinalityIgnored_WhenNotSpecified() { ComposablePartDefinition part1 = typeof(PartImportingContract1).AsPart(); - ComposablePartDefinition part1Multiple = - typeof(PartImportingContract1Multiple).AsPart(); + ComposablePartDefinition part1Multiple = typeof(PartImportingContract1Multiple).AsPart( + + ); ComposablePartDefinition part1Optional = typeof(PartImportingContract1Optionally).AsPart(); @@ -109,8 +110,9 @@ public void Imports_CardinalityIgnored_WhenNotSpecified() public void Imports_CardinalityNotIgnored_WhenSpecified() { ComposablePartDefinition part1 = typeof(PartImportingContract1).AsPart(); - ComposablePartDefinition part1Multiple = - typeof(PartImportingContract1Multiple).AsPart(); + ComposablePartDefinition part1Multiple = typeof(PartImportingContract1Multiple).AsPart( + + ); ComposablePartDefinition part1Optional = typeof(PartImportingContract1Optionally).AsPart(); diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs index 092eccf4206..994b9f0b3b6 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/MetadataTests.cs @@ -977,10 +977,9 @@ public void ExportWithMultipleMetadata_ExportTypes_WithAllNulls() var container = ContainerFactory.Create(); container.ComposeParts(new ItemWithTypeExports_WithAllNulls()); - var export = container.GetExport< - ItemWithTypeExports_WithAllNulls, - ITypesMetadataView - >(); + var export = container.GetExport( + + ); Assert.NotNull(export.Metadata); Assert.NotNull(export.Metadata.Type); diff --git a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/UnitTesting/EqualityExtensions.cs b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/UnitTesting/EqualityExtensions.cs index b0b5b089b59..4bc3d243f1d 100644 --- a/runtime/src/libraries/System.ComponentModel.Composition/tests/System/UnitTesting/EqualityExtensions.cs +++ b/runtime/src/libraries/System.ComponentModel.Composition/tests/System/UnitTesting/EqualityExtensions.cs @@ -36,21 +36,19 @@ private static MethodInfo GetExtensionMethod(Type extendedType) { var x = typeof(EqualityExtensions) .GetMethods() - ?.Where( - m => - m.Name == "IsEqual" - && m.GetParameters().Length == 2 - && m.IsGenericMethodDefinition + ?.Where(m => + m.Name == "IsEqual" + && m.GetParameters().Length == 2 + && m.IsGenericMethodDefinition ); MethodInfo method = typeof(EqualityExtensions) .GetMethods() - ?.SingleOrDefault( - m => - m.Name == "IsEqual" - && m.GetParameters().Length == 2 - && m.GetParameters()[0].ParameterType.Name == extendedType.Name - && m.IsGenericMethodDefinition + ?.SingleOrDefault(m => + m.Name == "IsEqual" + && m.GetParameters().Length == 2 + && m.GetParameters()[0].ParameterType.Name == extendedType.Name + && m.IsGenericMethodDefinition ); // If extension method found, make it generic and return diff --git a/runtime/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs b/runtime/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs index 30975db544e..cc7d68de71c 100644 --- a/runtime/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs +++ b/runtime/src/libraries/System.ComponentModel.TypeConverter/src/System/ComponentModel/TypeDescriptor.cs @@ -3121,8 +3121,9 @@ internal bool IsValid(ITypeDescriptorFilterService filterService) /// private sealed class MemberDescriptorComparer : IComparer { - public static readonly MemberDescriptorComparer Instance = - new MemberDescriptorComparer(); + public static readonly MemberDescriptorComparer Instance = new MemberDescriptorComparer( + + ); public int Compare(object? left, object? right) { diff --git a/runtime/src/libraries/System.Composition.Convention/src/System/Composition/Convention/PartConventionBuilderOfT.cs b/runtime/src/libraries/System.Composition.Convention/src/System/Composition/Convention/PartConventionBuilderOfT.cs index f45ad89e64b..ea593d695e5 100644 --- a/runtime/src/libraries/System.Composition.Convention/src/System/Composition/Convention/PartConventionBuilderOfT.cs +++ b/runtime/src/libraries/System.Composition.Convention/src/System/Composition/Convention/PartConventionBuilderOfT.cs @@ -215,10 +215,9 @@ Expression> constructorSelector var lambdaExpression = (LambdaExpression)parameter; Delegate importDelegate = lambdaExpression.Compile(); _importBuilders ??= - new Dictionary< - ParameterInfo, - Action - >(); + new Dictionary>( + + ); _importBuilders.Add( parameterInfos[index], (Action)importDelegate diff --git a/runtime/src/libraries/System.Composition.Convention/tests/ConventionBuilderTests.cs b/runtime/src/libraries/System.Composition.Convention/tests/ConventionBuilderTests.cs index 753f8b0166e..fefd669af99 100644 --- a/runtime/src/libraries/System.Composition.Convention/tests/ConventionBuilderTests.cs +++ b/runtime/src/libraries/System.Composition.Convention/tests/ConventionBuilderTests.cs @@ -64,8 +64,9 @@ public void MapType_ConventionSelectedConstructor() builder.ForTypesDerivedFrom().Export(); - TypeInfo fooImplWithConstructorsTypeInfo = - typeof(FooImplWithConstructors).GetTypeInfo(); + TypeInfo fooImplWithConstructorsTypeInfo = typeof(FooImplWithConstructors).GetTypeInfo( + + ); // necessary as BuildConventionConstructorAttributes is only called for type level query for attributes ConstructorInfo constructor1 = fooImplWithConstructorsTypeInfo @@ -147,9 +148,9 @@ public void MapType_OverridingSelectionOfConventionSelectedConstructor_WithPartB builder .ForType() - .SelectConstructor( - param => new FooImplWithConstructors(param.Import>()) - ); + .SelectConstructor(param => new FooImplWithConstructors( + param.Import>() + )); TypeInfo fooImplWithConstructors = typeof(FooImplWithConstructors).GetTypeInfo(); diff --git a/runtime/src/libraries/System.Composition.Convention/tests/PartBuilderOfTTests.cs b/runtime/src/libraries/System.Composition.Convention/tests/PartBuilderOfTTests.cs index ed7cd448954..daaa41a08af 100644 --- a/runtime/src/libraries/System.Composition.Convention/tests/PartBuilderOfTTests.cs +++ b/runtime/src/libraries/System.Composition.Convention/tests/PartBuilderOfTTests.cs @@ -428,9 +428,9 @@ public void ManuallySelectingConstructor_SelectsTheExplicitOne_IEnumerableParame var builder = new ConventionBuilder(); builder .ForType() - .SelectConstructor( - param => new FooImplWithConstructors(param.Import>()) - ); + .SelectConstructor(param => new FooImplWithConstructors( + param.Import>() + )); ConstructorInfo selectedConstructor = GetSelectedConstructor( builder, diff --git a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/CompositionDependency.cs b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/CompositionDependency.cs index 22dcaa464dc..2c3ee2a0d55 100644 --- a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/CompositionDependency.cs +++ b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/CompositionDependency.cs @@ -201,8 +201,8 @@ internal void DescribeError(StringBuilder message) if (_oversuppliedTargets != null) { var list = Formatters.ReadableList( - _oversuppliedTargets.Select( - t => SR.Format(SR.Dependency_QuoteParameter, t.Origin) + _oversuppliedTargets.Select(t => + SR.Format(SR.Dependency_QuoteParameter, t.Origin) ) ); message.AppendFormat(SR.Dependency_TooManyExports, Contract, list); diff --git a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistryUpdate.cs b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistryUpdate.cs index 5adaed35931..f7e286eee89 100644 --- a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistryUpdate.cs +++ b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Core/ExportDescriptorRegistryUpdate.cs @@ -167,16 +167,13 @@ CompositionContract contract ExportDescriptor[] definitions; if (_partDefinitions.TryGetValue(contract, out definitions)) return definitions - .Select( - d => - new ExportDescriptorPromise( - contract, - "Preexisting", - false, - s_noDependencies, - _ => d - ) - ) + .Select(d => new ExportDescriptorPromise( + contract, + "Preexisting", + false, + s_noDependencies, + _ => d + )) .ToArray(); UpdateResult updateResult; diff --git a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/ExportFactory/ExportFactoryWithMetadataExportDescriptorProvider.cs b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/ExportFactory/ExportFactoryWithMetadataExportDescriptorProvider.cs index e9ac5296e50..a774fd5b5f1 100644 --- a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/ExportFactory/ExportFactoryWithMetadataExportDescriptorProvider.cs +++ b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/ExportFactory/ExportFactoryWithMetadataExportDescriptorProvider.cs @@ -63,43 +63,37 @@ out unwrapped return definitionAccessor .ResolveDependencies("product", productContract, false) - .Select( - d => - new ExportDescriptorPromise( - exportFactoryContract, - typeof(ExportFactory).Name, - false, - () => new[] { d }, - _ => + .Select(d => new ExportDescriptorPromise( + exportFactoryContract, + typeof(ExportFactory).Name, + false, + () => new[] { d }, + _ => + { + var dsc = d.Target.GetDescriptor(); + return ExportDescriptor.Create( + (c, o) => { - var dsc = d.Target.GetDescriptor(); - return ExportDescriptor.Create( - (c, o) => + return new ExportFactory( + () => { - return new ExportFactory( - () => - { - var lifetimeContext = new LifetimeContext( - c, - boundaries - ); - return Tuple.Create( - (TProduct) - CompositionOperation.Run( - lifetimeContext, - dsc.Activator - ), - lifetimeContext.Dispose - ); - }, - metadataProvider(dsc.Metadata) + var lifetimeContext = new LifetimeContext(c, boundaries); + return Tuple.Create( + (TProduct) + CompositionOperation.Run( + lifetimeContext, + dsc.Activator + ), + lifetimeContext.Dispose ); }, - dsc.Metadata + metadataProvider(dsc.Metadata) ); - } - ) - ) + }, + dsc.Metadata + ); + } + )) .ToArray(); } } diff --git a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Lazy/LazyExportDescriptorProvider.cs b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Lazy/LazyExportDescriptorProvider.cs index 67d187ad172..460c158613d 100644 --- a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Lazy/LazyExportDescriptorProvider.cs +++ b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Lazy/LazyExportDescriptorProvider.cs @@ -43,27 +43,22 @@ DependencyAccessor definitionAccessor { return definitionAccessor .ResolveDependencies("value", lazyContract.ChangeType(typeof(TValue)), false) - .Select( - d => - new ExportDescriptorPromise( - lazyContract, - Formatters.Format(typeof(Lazy)), - false, - () => new[] { d }, - _ => - { - var dsc = d.Target.GetDescriptor(); - var da = dsc.Activator; - return ExportDescriptor.Create( - (c, o) => - new Lazy( - () => (TValue)CompositionOperation.Run(c, da) - ), - dsc.Metadata - ); - } - ) - ) + .Select(d => new ExportDescriptorPromise( + lazyContract, + Formatters.Format(typeof(Lazy)), + false, + () => new[] { d }, + _ => + { + var dsc = d.Target.GetDescriptor(); + var da = dsc.Activator; + return ExportDescriptor.Create( + (c, o) => + new Lazy(() => (TValue)CompositionOperation.Run(c, da)), + dsc.Metadata + ); + } + )) .ToArray(); } } diff --git a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Metadata/MetadataViewProvider.cs b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Metadata/MetadataViewProvider.cs index 600cad88691..36ab74055a5 100644 --- a/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Metadata/MetadataViewProvider.cs +++ b/runtime/src/libraries/System.Composition.Hosting/src/System/Composition/Hosting/Providers/Metadata/MetadataViewProvider.cs @@ -57,8 +57,8 @@ public static Func< .Compile(); } - var parameterlessConstructor = ti.DeclaredConstructors.SingleOrDefault( - ci => ci.IsPublic && ci.GetParameters().Length == 0 + var parameterlessConstructor = ti.DeclaredConstructors.SingleOrDefault(ci => + ci.IsPublic && ci.GetParameters().Length == 0 ); if (parameterlessConstructor != null) { @@ -76,14 +76,13 @@ public static Func< foreach ( var prop in typeof(TMetadata) .GetTypeInfo() - .DeclaredProperties.Where( - prop => - prop.GetMethod != null - && prop.GetMethod.IsPublic - && !prop.GetMethod.IsStatic - && prop.SetMethod != null - && prop.SetMethod.IsPublic - && !prop.SetMethod.IsStatic + .DeclaredProperties.Where(prop => + prop.GetMethod != null + && prop.GetMethod.IsPublic + && !prop.GetMethod.IsStatic + && prop.SetMethod != null + && prop.SetMethod.IsPublic + && !prop.SetMethod.IsStatic ) ) { diff --git a/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ActivationFeatures/OnImportsSatisfiedFeature.cs b/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ActivationFeatures/OnImportsSatisfiedFeature.cs index b2d1c7ca4bf..ba8e3041a58 100644 --- a/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ActivationFeatures/OnImportsSatisfiedFeature.cs +++ b/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ActivationFeatures/OnImportsSatisfiedFeature.cs @@ -41,12 +41,11 @@ IEnumerable dependencies var partTypeAsType = partType.AsType(); var importsSatisfiedMethods = partTypeAsType .GetRuntimeMethods() - .Where( - mi => - _attributeContext.GetDeclaredAttribute( - mi.DeclaringType, - mi - ) != null + .Where(mi => + _attributeContext.GetDeclaredAttribute( + mi.DeclaringType, + mi + ) != null ); foreach (var m in importsSatisfiedMethods) diff --git a/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ContractHelpers.cs b/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ContractHelpers.cs index e5798c25a38..ea6f513dd5f 100644 --- a/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ContractHelpers.cs +++ b/runtime/src/libraries/System.Composition.TypedParts/src/System/Composition/TypedParts/ContractHelpers.cs @@ -79,9 +79,8 @@ public static ImportInfo GetImportInfo(Type memberType, object[] attributes, obj foreach ( var prop in attrType .GetRuntimeProperties() - .Where( - p => - p.GetMethod.IsPublic && p.DeclaringType == attrType && p.CanRead + .Where(p => + p.GetMethod.IsPublic && p.DeclaringType == attrType && p.CanRead ) ) { diff --git a/runtime/src/libraries/System.Composition/tests/Microsoft.Composition.Demos.ExtendedCollectionImports/Dictionaries/DictionaryExportDescriptorProvider.cs b/runtime/src/libraries/System.Composition/tests/Microsoft.Composition.Demos.ExtendedCollectionImports/Dictionaries/DictionaryExportDescriptorProvider.cs index fdd09dce8d7..7365468d911 100644 --- a/runtime/src/libraries/System.Composition/tests/Microsoft.Composition.Demos.ExtendedCollectionImports/Dictionaries/DictionaryExportDescriptorProvider.cs +++ b/runtime/src/libraries/System.Composition/tests/Microsoft.Composition.Demos.ExtendedCollectionImports/Dictionaries/DictionaryExportDescriptorProvider.cs @@ -85,8 +85,8 @@ string keyByMetadataName () => definitionAccessor.ResolveDependencies("value", valueContract, true), deps => { - var items = deps.Select( - d => Tuple.Create(d.Target.Origin, d.Target.GetDescriptor()) + var items = deps.Select(d => + Tuple.Create(d.Target.Origin, d.Target.GetDescriptor()) ) .ToArray(); var isValidated = false; diff --git a/runtime/src/libraries/System.Console/tests/KeyParserTests.cs b/runtime/src/libraries/System.Console/tests/KeyParserTests.cs index cc359d0437c..f8c59625c97 100644 --- a/runtime/src/libraries/System.Console/tests/KeyParserTests.cs +++ b/runtime/src/libraries/System.Console/tests/KeyParserTests.cs @@ -60,8 +60,8 @@ public class KeyParserTests } public static IEnumerable AsciiCharactersArguments => - Terminals.SelectMany( - terminal => AsciiKeys.Select(tuple => new object[] { terminal, tuple.ch, tuple.key }) + Terminals.SelectMany(terminal => + AsciiKeys.Select(tuple => new object[] { terminal, tuple.ch, tuple.key }) ); [Theory] @@ -249,9 +249,8 @@ ConsoleKeyInfo expected } public static IEnumerable VTSequencesArguments => - Terminals.SelectMany( - terminal => - VTSequences.Select(tuple => new object[] { terminal, tuple.chars, tuple.key }) + Terminals.SelectMany(terminal => + VTSequences.Select(tuple => new object[] { terminal, tuple.chars, tuple.key }) ); [Theory] @@ -462,11 +461,8 @@ public void ExtendedStringCodePath() } public static IEnumerable EdgeCaseScenariosArguments => - Terminals.SelectMany( - terminal => - EdgeCaseScenarios.Select( - tuple => new object[] { terminal, tuple.chars, tuple.keys } - ) + Terminals.SelectMany(terminal => + EdgeCaseScenarios.Select(tuple => new object[] { terminal, tuple.chars, tuple.keys }) ); [Theory] diff --git a/runtime/src/libraries/System.Data.Common/src/System/Data/DataTable.cs b/runtime/src/libraries/System.Data.Common/src/System/Data/DataTable.cs index 32a7fec7a4c..56b40315420 100644 --- a/runtime/src/libraries/System.Data.Common/src/System/Data/DataTable.cs +++ b/runtime/src/libraries/System.Data.Common/src/System/Data/DataTable.cs @@ -4935,12 +4935,9 @@ public DataRow[] Select(string? filterExpression) ObjectID, filterExpression ); - return new Select( - this, - filterExpression, - "", - DataViewRowState.CurrentRows - ).SelectRows(); + return new Select(this, filterExpression, "", DataViewRowState.CurrentRows).SelectRows( + + ); } /// diff --git a/runtime/src/libraries/System.Data.Common/src/System/Data/SortExpressionBuilder.cs b/runtime/src/libraries/System.Data.Common/src/System/Data/SortExpressionBuilder.cs index b84fbc197b4..a017a35691c 100644 --- a/runtime/src/libraries/System.Data.Common/src/System/Data/SortExpressionBuilder.cs +++ b/runtime/src/libraries/System.Data.Common/src/System/Data/SortExpressionBuilder.cs @@ -166,8 +166,8 @@ internal SortExpressionBuilder CloneCast() { if (selector == _currentSelector!.Value) { - builder._currentSelector = builder._selectors.AddLast( - r => selector((T)(object)r!) + builder._currentSelector = builder._selectors.AddLast(r => + selector((T)(object)r!) ); } else diff --git a/runtime/src/libraries/System.Data.Common/tests/System.Data.DataSetExtensions.Tests/System/Data/EnumerableRowCollectionExtensionsTests.cs b/runtime/src/libraries/System.Data.Common/tests/System.Data.DataSetExtensions.Tests/System/Data/EnumerableRowCollectionExtensionsTests.cs index bd976f85e12..8399d67d722 100644 --- a/runtime/src/libraries/System.Data.Common/tests/System.Data.DataSetExtensions.Tests/System/Data/EnumerableRowCollectionExtensionsTests.cs +++ b/runtime/src/libraries/System.Data.Common/tests/System.Data.DataSetExtensions.Tests/System/Data/EnumerableRowCollectionExtensionsTests.cs @@ -80,8 +80,8 @@ public void OrderByDescending_AddSortExpressionValidation() var (table, one, two, three) = InstantiateTable(); EnumerableRowCollection source = table.Cast(); - var orderedBackwards = source.OrderByDescending( - row => int.Parse((string)row.ItemArray[0]) + var orderedBackwards = source.OrderByDescending(row => + int.Parse((string)row.ItemArray[0]) ); Assert.Equal(new DataRow[] { three, two, one }, orderedBackwards); @@ -126,8 +126,8 @@ public void ThenByDescending_AddSortExpressionValidation() .OrderByDescending(row => int.Parse((string)row.ItemArray[0])); DataRow zero = table.Rows.Add(0); - var orderedBackwardsAgain = orderedSource.ThenByDescending( - row => int.Parse((string)row.ItemArray[0]) + var orderedBackwardsAgain = orderedSource.ThenByDescending(row => + int.Parse((string)row.ItemArray[0]) ); Assert.Equal(new DataRow[] { three, two, one, zero }, orderedBackwardsAgain); diff --git a/runtime/src/libraries/System.Data.OleDb/src/OleDbCommand.cs b/runtime/src/libraries/System.Data.OleDb/src/OleDbCommand.cs index d675bae081d..f1dcf4a999c 100644 --- a/runtime/src/libraries/System.Data.OleDb/src/OleDbCommand.cs +++ b/runtime/src/libraries/System.Data.OleDb/src/OleDbCommand.cs @@ -1410,8 +1410,9 @@ private bool PropertiesOnCommand(bool throwNotSupported) { if (null != propSet) { - UnsafeNativeMethods.ICommandProperties icommandProperties = - ICommandProperties(); + UnsafeNativeMethods.ICommandProperties icommandProperties = ICommandProperties( + + ); OleDbHResult hr = icommandProperties.SetProperties( propSet.PropertySetCount, propSet diff --git a/runtime/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs b/runtime/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs index eccc833dd22..abce1f947ff 100644 --- a/runtime/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs +++ b/runtime/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs @@ -1575,6 +1575,7 @@ private bool ReadRowset() // @devnote: releasing row handles occurs next time user calls read, skip, or close GetRowHandles( /*skipCount*/ + ); } return ((_currentRow <= (int)_rowFetchedCount) && _isRead); diff --git a/runtime/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionClosed.cs b/runtime/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionClosed.cs index 7e1b0b71410..c5cda045190 100644 --- a/runtime/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionClosed.cs +++ b/runtime/src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbConnectionClosed.cs @@ -112,8 +112,9 @@ private DbConnectionClosedBusy() internal sealed class DbConnectionOpenBusy : DbConnectionBusy { // Open Connection, Currently Busy - closing connection - internal static readonly DbConnectionInternal SingletonInstance = - new DbConnectionOpenBusy(); // singleton object + internal static readonly DbConnectionInternal SingletonInstance = new DbConnectionOpenBusy( + + ); // singleton object private DbConnectionOpenBusy() : base(ConnectionState.Open) { } diff --git a/runtime/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs b/runtime/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs index 2909f4cfae2..834d6f80f24 100644 --- a/runtime/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs +++ b/runtime/src/libraries/System.Diagnostics.DiagnosticSource/tests/MetricEventSourceTests.cs @@ -3583,21 +3583,18 @@ params Instrument[] expectedInstruments { var beginReportEvents = events .Where(e => e.EventName == "BeginInstrumentReporting") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - InstrumentType = e.Payload[4].ToString(), - Unit = e.Payload[5].ToString(), - Description = e.Payload[6].ToString(), - InstrumentTags = e.Payload[7].ToString(), - MeterTags = e.Payload[8].ToString(), - ScopeHash = e.Payload[9].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + InstrumentType = e.Payload[4].ToString(), + Unit = e.Payload[5].ToString(), + Description = e.Payload[6].ToString(), + InstrumentTags = e.Payload[7].ToString(), + MeterTags = e.Payload[8].ToString(), + ScopeHash = e.Payload[9].ToString() + }) .ToArray(); foreach (Instrument i in expectedInstruments) @@ -3631,21 +3628,18 @@ params Instrument[] expectedInstruments { var beginReportEvents = events .Where(e => e.EventName == "EndInstrumentReporting") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - InstrumentType = e.Payload[4].ToString(), - Unit = e.Payload[5].ToString(), - Description = e.Payload[6].ToString(), - InstrumentTags = e.Payload[7].ToString(), - MeterTags = e.Payload[8].ToString(), - ScopeHash = e.Payload[9].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + InstrumentType = e.Payload[4].ToString(), + Unit = e.Payload[5].ToString(), + Description = e.Payload[6].ToString(), + InstrumentTags = e.Payload[7].ToString(), + MeterTags = e.Payload[8].ToString(), + ScopeHash = e.Payload[9].ToString() + }) .ToArray(); foreach (Instrument i in expectedInstruments) @@ -3705,21 +3699,18 @@ params Instrument[] expectedInstruments { var publishEvents = events .Where(e => e.EventName == "InstrumentPublished") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - InstrumentType = e.Payload[4].ToString(), - Unit = e.Payload[5].ToString(), - Description = e.Payload[6].ToString(), - InstrumentTags = e.Payload[7].ToString(), - MeterTags = e.Payload[8].ToString(), - ScopeHash = e.Payload[9].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + InstrumentType = e.Payload[4].ToString(), + Unit = e.Payload[5].ToString(), + Description = e.Payload[6].ToString(), + InstrumentTags = e.Payload[7].ToString(), + MeterTags = e.Payload[8].ToString(), + ScopeHash = e.Payload[9].ToString() + }) .ToArray(); foreach (Instrument i in expectedInstruments) @@ -3798,26 +3789,20 @@ private void AssertGenericCounterEventsPresent( { var counterEvents = events .Where(e => e.EventName == eventName) - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - Unit = e.Payload[4].ToString(), - Tags = e.Payload[5].ToString(), - Rate = e.Payload[6].ToString(), - Value = e.Payload[7].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + Unit = e.Payload[4].ToString(), + Tags = e.Payload[5].ToString(), + Rate = e.Payload[6].ToString(), + Value = e.Payload[7].ToString() + }) .ToArray(); var filteredEvents = counterEvents - .Where( - e => - e.MeterName == meterName - && e.InstrumentName == instrumentName - && e.Tags == tags + .Where(e => + e.MeterName == meterName && e.InstrumentName == instrumentName && e.Tags == tags ) .ToArray(); Assert.True(filteredEvents.Length >= expected.Length); @@ -3838,23 +3823,17 @@ string tags { var counterEvents = events .Where(e => e.EventName == "CounterRateValuePublished") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - Tags = e.Payload[5].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + Tags = e.Payload[5].ToString() + }) .ToArray(); var filteredEvents = counterEvents - .Where( - e => - e.MeterName == meterName - && e.InstrumentName == instrumentName - && e.Tags == tags + .Where(e => + e.MeterName == meterName && e.InstrumentName == instrumentName && e.Tags == tags ) .ToArray(); Assert.Equal(0, filteredEvents.Length); @@ -3871,25 +3850,19 @@ params string[] expectedValues { var counterEvents = events .Where(e => e.EventName == "GaugeValuePublished") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - Unit = e.Payload[4].ToString(), - Tags = e.Payload[5].ToString(), - Value = e.Payload[6].ToString(), - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + Unit = e.Payload[4].ToString(), + Tags = e.Payload[5].ToString(), + Value = e.Payload[6].ToString(), + }) .ToArray(); var filteredEvents = counterEvents - .Where( - e => - e.MeterName == meterName - && e.InstrumentName == instrumentName - && e.Tags == tags + .Where(e => + e.MeterName == meterName && e.InstrumentName == instrumentName && e.Tags == tags ) .ToArray(); Assert.True(filteredEvents.Length >= expectedValues.Length); @@ -3911,27 +3884,21 @@ private void AssertHistogramEventsPresent( { var counterEvents = events .Where(e => e.EventName == "HistogramValuePublished") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - Unit = e.Payload[4].ToString(), - Tags = e.Payload[5].ToString(), - Quantiles = (string)e.Payload[6], - Count = e.Payload[7].ToString(), - Sum = e.Payload[8].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + Unit = e.Payload[4].ToString(), + Tags = e.Payload[5].ToString(), + Quantiles = (string)e.Payload[6], + Count = e.Payload[7].ToString(), + Sum = e.Payload[8].ToString() + }) .ToArray(); var filteredEvents = counterEvents - .Where( - e => - e.MeterName == meterName - && e.InstrumentName == instrumentName - && e.Tags == tags + .Where(e => + e.MeterName == meterName && e.InstrumentName == instrumentName && e.Tags == tags ) .ToArray(); Assert.True(filteredEvents.Length >= expected.Length); @@ -3953,23 +3920,17 @@ string tags { var counterEvents = events .Where(e => e.EventName == "HistogramValuePublished") - .Select( - e => - new - { - MeterName = e.Payload[1].ToString(), - MeterVersion = e.Payload[2].ToString(), - InstrumentName = e.Payload[3].ToString(), - Tags = e.Payload[5].ToString() - } - ) + .Select(e => new + { + MeterName = e.Payload[1].ToString(), + MeterVersion = e.Payload[2].ToString(), + InstrumentName = e.Payload[3].ToString(), + Tags = e.Payload[5].ToString() + }) .ToArray(); var filteredEvents = counterEvents - .Where( - e => - e.MeterName == meterName - && e.InstrumentName == instrumentName - && e.Tags == tags + .Where(e => + e.MeterName == meterName && e.InstrumentName == instrumentName && e.Tags == tags ) .ToArray(); Assert.Equal(0, filteredEvents.Length); @@ -4041,18 +4002,15 @@ string actualRefreshInterval { var counterEvents = events .Where(e => e.EventName == "MultipleSessionsConfiguredIncorrectlyError") - .Select( - e => - new - { - ExpectedMaxHistograms = e.Payload[1].ToString(), - ActualMaxHistograms = e.Payload[2].ToString(), - ExpectedMaxTimeSeries = e.Payload[3].ToString(), - ActualMaxTimeSeries = e.Payload[4].ToString(), - ExpectedRefreshInterval = e.Payload[5].ToString(), - ActualRefreshInterval = e.Payload[6].ToString(), - } - ) + .Select(e => new + { + ExpectedMaxHistograms = e.Payload[1].ToString(), + ActualMaxHistograms = e.Payload[2].ToString(), + ExpectedMaxTimeSeries = e.Payload[3].ToString(), + ActualMaxTimeSeries = e.Payload[4].ToString(), + ExpectedRefreshInterval = e.Payload[5].ToString(), + ActualRefreshInterval = e.Payload[6].ToString(), + }) .ToArray(); var filteredEvents = counterEvents; Assert.Single(filteredEvents); diff --git a/runtime/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs b/runtime/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs index ca6e179d138..cba1954e349 100644 --- a/runtime/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs +++ b/runtime/src/libraries/System.Diagnostics.EventLog/src/System/Diagnostics/Reader/UnsafeNativeMethods.cs @@ -422,8 +422,9 @@ public void FromManaged(EvtRpcLogin managed) _value.Domain = Marshal.StringToCoTaskMemUni(managed.Domain); _passwordHandle = managed.Password; _passwordHandle.DangerousAddRef(ref _passwordHandleAddRefd); - _value.Password = _originalHandleValue = - _passwordHandle.DangerousGetHandle(); + _value.Password = _originalHandleValue = _passwordHandle.DangerousGetHandle( + + ); _value.Flags = managed.Flags; } diff --git a/runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs b/runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs index 489c27d552a..69fbfa98008 100644 --- a/runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs +++ b/runtime/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Unix.cs @@ -18,8 +18,9 @@ public partial class Process : IDisposable { private static volatile bool s_initialized; private static readonly object s_initializedGate = new object(); - private static readonly ReaderWriterLockSlim s_processStartLock = - new ReaderWriterLockSlim(); + private static readonly ReaderWriterLockSlim s_processStartLock = new ReaderWriterLockSlim( + + ); /// /// Puts a Process component in state to interact with operating system processes that run in a diff --git a/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index a226864b928..92e8b2c2a66 100644 --- a/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -301,11 +301,10 @@ public void TestEnvironmentOfChildProcess() Environment .GetEnvironmentVariables() .Cast() - .Select( - e => - Convert.ToBase64String( - Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) - ) + .Select(e => + Convert.ToBase64String( + Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) + ) ) ) ); @@ -383,11 +382,10 @@ public void EnvironmentGetEnvironmentVariablesIsCaseSensitive() Environment .GetEnvironmentVariables() .Cast() - .Select( - e => - Convert.ToBase64String( - Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) - ) + .Select(e => + Convert.ToBase64String( + Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) + ) ) ) ); @@ -425,11 +423,10 @@ public void ProcessStartInfoEnvironmentDoesNotThrowForCaseSensitiveDuplicates() Console.Write( string.Join( ItemSeparator, - new ProcessStartInfo().Environment.Select( - e => - Convert.ToBase64String( - Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) - ) + new ProcessStartInfo().Environment.Select(e => + Convert.ToBase64String( + Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) + ) ) ) ); @@ -472,11 +469,10 @@ public void ProcessStartInfoEnvironmentVariablesDoesNotThrowForCaseSensitiveDupl ItemSeparator, new ProcessStartInfo() .EnvironmentVariables.Cast() - .Select( - e => - Convert.ToBase64String( - Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) - ) + .Select(e => + Convert.ToBase64String( + Encoding.UTF8.GetBytes(e.Key + "=" + e.Value) + ) ) ) ); @@ -785,8 +781,8 @@ public void TestEnvironmentVariables_Environment_DataRoundTrips() psi.EnvironmentVariables.Add("NewKey2", "NewValue2"); // Environment and EnvironmentVariables should be equal, but have different enumeration types. - IEnumerable> allEnvironment = psi.Environment.OrderBy( - k => k.Key + IEnumerable> allEnvironment = psi.Environment.OrderBy(k => + k.Key ); IEnumerable allDictionary = psi.EnvironmentVariables.Cast().OrderBy(k => k.Key); diff --git a/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 4130f19490f..514f3ab1b72 100644 --- a/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/runtime/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -173,8 +173,8 @@ public void ProcessStart_UseShellExecute_OnUnix_OpenMissingFile_DoesNotThrow() )] public void ProcessStart_UseShellExecute_OnUnix_SuccessWhenProgramInstalled(bool isFolder) { - string programToOpen = s_allowedProgramsToRun.FirstOrDefault( - program => IsProgramInstalled(program) + string programToOpen = s_allowedProgramsToRun.FirstOrDefault(program => + IsProgramInstalled(program) ); string fileToOpen; if (isFolder) diff --git a/runtime/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMMembersSet.cs b/runtime/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMMembersSet.cs index f94fec2f94b..eadbf0d7e4d 100644 --- a/runtime/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMMembersSet.cs +++ b/runtime/src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/SAM/SAMMembersSet.cs @@ -175,8 +175,9 @@ private bool MoveNextLocal() // Transform the "WinNT://BUILTIN/foo" path to "WinNT://machineName/foo" string builtinADsPath = nativeMember.ADsPath; - UnsafeNativeMethods.Pathname pathCracker = - new UnsafeNativeMethods.Pathname(); + UnsafeNativeMethods.Pathname pathCracker = new UnsafeNativeMethods.Pathname( + + ); UnsafeNativeMethods.IADsPathname pathName = (UnsafeNativeMethods.IADsPathname)pathCracker; diff --git a/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySite.cs b/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySite.cs index c7f8e20bf0f..0d239ba3365 100644 --- a/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySite.cs +++ b/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySite.cs @@ -765,8 +765,9 @@ public ActiveDirectorySchedule? IntraSiteReplicationSchedule } else // replace with the new value - NTDSSiteEntry.Properties["schedule"].Value = - value.GetUnmanagedSchedule(); + NTDSSiteEntry.Properties["schedule"].Value = value.GetUnmanagedSchedule( + + ); } catch (COMException e) { diff --git a/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySiteLink.cs b/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySiteLink.cs index a241250606e..1f30b60002e 100644 --- a/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySiteLink.cs +++ b/runtime/src/libraries/System.DirectoryServices/src/System/DirectoryServices/ActiveDirectory/ActiveDirectorySiteLink.cs @@ -92,8 +92,9 @@ public ActiveDirectorySiteLink( cachedEntry.Properties["cost"].Value = appDefaultCost; cachedEntry.Properties["replInterval"].Value = appDefaultInterval; if (schedule != null) - cachedEntry.Properties[nameof(schedule)].Value = - schedule.GetUnmanagedSchedule(); + cachedEntry.Properties[nameof(schedule)].Value = schedule.GetUnmanagedSchedule( + + ); } catch (COMException e) { diff --git a/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs b/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs index 3f01b2f4845..6a4326262b8 100644 --- a/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs +++ b/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs @@ -1539,8 +1539,8 @@ public static int MainMethod() dynamic dy = mc; byte p1 = 10; int p2 = p1; - var result = list.Where( - p => !p._field1.HasValue && !((MyStruct?)dy[p1]).HasValue && p._field2 == dy[p2] + var result = list.Where(p => + !p._field1.HasValue && !((MyStruct?)dy[p1]).HasValue && p._field2 == dy[p2] ) .Select(p => p._field3) .Average(); diff --git a/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs b/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs index 88eee4a9b4f..144dd9b4280 100644 --- a/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs +++ b/runtime/src/libraries/System.Dynamic.Runtime/tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs @@ -2014,10 +2014,8 @@ public static int MainMethod() dynamic dy = mc; char? c = 'a'; double[] d = new double[0]; - var result = list.Where( - p => - p._field1 == ((decimal?)(mc != dy)).Value - && p._field2 == ((int?)(c ^ dy)).Value + var result = list.Where(p => + p._field1 == ((decimal?)(mc != dy)).Value && p._field2 == ((int?)(c ^ dy)).Value ) .Where(p => p._field3 == (d & dy)) .Select(p => p._field3) diff --git a/runtime/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs b/runtime/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs index 2623ed0fc95..a87c395a726 100644 --- a/runtime/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs +++ b/runtime/src/libraries/System.Formats.Asn1/src/System/Formats/Asn1/AsnWriter.cs @@ -501,8 +501,9 @@ private void PopTag(Asn1Tag tag, UniversalTagNumber tagType, bool sortContents = throw new InvalidOperationException(SR.AsnWriter_PopWrongTag); } - (Asn1Tag stackTag, int lenOffset, UniversalTagNumber stackTagType) = - _nestingStack.Peek(); + (Asn1Tag stackTag, int lenOffset, UniversalTagNumber stackTagType) = _nestingStack.Peek( + + ); Debug.Assert(tag.IsConstructed); if (stackTag != tag || stackTagType != tagType) diff --git a/runtime/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.Tag.cs b/runtime/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.Tag.cs index 3b028aff5b6..7a814e0a58b 100644 --- a/runtime/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.Tag.cs +++ b/runtime/src/libraries/System.Formats.Cbor/tests/Reader/CborReaderTests.Tag.cs @@ -251,7 +251,9 @@ public static void ReadDateTimeOffset_IsCultureInvariant() CultureInfo.InvariantCulture ); byte[] data = - "c07821323032302d30342d30395431343a33313a32312e333533353934312b30313a3030".HexToByteArray(); + "c07821323032302d30342d30395431343a33313a32312e333533353934312b30313a3030".HexToByteArray( + + ); // Install a non-Gregorian calendar var culture = new CultureInfo("he-IL"); diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Tests.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Tests.cs index 29e99f47e46..303a9734133 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Tests.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Tests.cs @@ -173,28 +173,28 @@ public async Task VerifyIncludeBaseDirectory_Async(bool includeBaseDirectory) if (includeBaseDirectory) { - TarEntry baseEntry = entries.FirstOrDefault( - x => x.EntryType == TarEntryType.Directory && x.Name == prefix + TarEntry baseEntry = entries.FirstOrDefault(x => + x.EntryType == TarEntryType.Directory && x.Name == prefix ); Assert.NotNull(baseEntry); AssertEntryModeFromFileSystemEquals(baseEntry, baseDirectoryMode); } - TarEntry entry1 = entries.FirstOrDefault( - x => x.EntryType == TarEntryType.RegularFile && x.Name == prefix + fileName1 + TarEntry entry1 = entries.FirstOrDefault(x => + x.EntryType == TarEntryType.RegularFile && x.Name == prefix + fileName1 ); Assert.NotNull(entry1); AssertEntryModeFromFileSystemEquals(entry1, filename1Mode); - TarEntry directory = entries.FirstOrDefault( - x => x.EntryType == TarEntryType.Directory && x.Name == prefix + subDirectoryName + TarEntry directory = entries.FirstOrDefault(x => + x.EntryType == TarEntryType.Directory && x.Name == prefix + subDirectoryName ); Assert.NotNull(directory); AssertEntryModeFromFileSystemEquals(directory, subDirectoryMode); string actualFileName2 = subDirectoryName + fileName2; // Notice the trailing separator in subDirectoryName - TarEntry entry2 = entries.FirstOrDefault( - x => x.EntryType == TarEntryType.RegularFile && x.Name == prefix + actualFileName2 + TarEntry entry2 = entries.FirstOrDefault(x => + x.EntryType == TarEntryType.RegularFile && x.Name == prefix + actualFileName2 ); Assert.NotNull(entry2); AssertEntryModeFromFileSystemEquals(entry2, filename2Mode); diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs index 7de2f8a1843..9c7cb0032a7 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectory.Stream.Tests.cs @@ -352,8 +352,8 @@ public void UnseekableStreams_RoundTrip(TestTarFormat testFormat) string entryPath = Path.TrimEndingDirectorySeparator( Path.GetFullPath(Path.Join(root.Path, entry.Name)) ); - FileSystemInfo fsi = fileSystemEntries.SingleOrDefault( - file => file.FullName == entryPath + FileSystemInfo fsi = fileSystemEntries.SingleOrDefault(file => + file.FullName == entryPath ); Assert.NotNull(fsi); if (entry.EntryType is TarEntryType.RegularFile or TarEntryType.V7RegularFile) diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs index f05d937a28e..8f0e365ea86 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.ExtractToDirectoryAsync.Stream.Tests.cs @@ -488,8 +488,8 @@ await TarFile.CreateFromDirectoryAsync( string entryPath = Path.TrimEndingDirectorySeparator( Path.GetFullPath(Path.Join(root.Path, entry.Name)) ); - FileSystemInfo fsi = fileSystemEntries.SingleOrDefault( - file => file.FullName == entryPath + FileSystemInfo fsi = fileSystemEntries.SingleOrDefault(file => + file.FullName == entryPath ); Assert.NotNull(fsi); if (entry.EntryType is TarEntryType.RegularFile or TarEntryType.V7RegularFile) diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Async.Tests.Base.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Async.Tests.Base.cs index de4192352c1..ab0c4124f5a 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Async.Tests.Base.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Async.Tests.Base.cs @@ -318,8 +318,7 @@ TestTarFormat testFormat entries.Add(entry); } - int directoriesCount = entries.Count( - e => e.EntryType == TarEntryType.Directory + int directoriesCount = entries.Count(e => e.EntryType == TarEntryType.Directory ); Assert.Equal(10, directoriesCount); @@ -330,8 +329,8 @@ format is TarEntryFormat.V7 for (int i = 0; i < 10; i++) { - int filesCount = entries.Count( - e => e.EntryType == actualEntryType && e.Name.StartsWith($"{i}/") + int filesCount = entries.Count(e => + e.EntryType == actualEntryType && e.Name.StartsWith($"{i}/") ); Assert.Equal(10, filesCount); } diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.Base.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.Base.cs index f2092319f6c..1030a2b25f5 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.Base.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarReader/TarReader.File.Tests.Base.cs @@ -264,8 +264,8 @@ TestTarFormat testFormat for (int i = 0; i < 10; i++) { - int filesCount = entries.Count( - e => e.EntryType == actualEntryType && e.Name.StartsWith($"{i}/") + int filesCount = entries.Count(e => + e.EntryType == actualEntryType && e.Name.StartsWith($"{i}/") ); Assert.Equal(10, filesCount); } diff --git a/runtime/src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.Tests.cs b/runtime/src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.Tests.cs index d725e9c4e47..c2ec867a408 100644 --- a/runtime/src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.Tests.cs +++ b/runtime/src/libraries/System.Formats.Tar/tests/TarWriter/TarWriter.WriteEntryAsync.Tests.cs @@ -503,7 +503,9 @@ await Assert.ThrowsAsync( } public static IEnumerable WriteEntry_UsingTarEntry_FromTarReader_IntoTarWriter_Async_TheoryData() => - TarWriter_WriteEntry_Tests.WriteEntry_UsingTarEntry_FromTarReader_IntoTarWriter_TheoryData(); + TarWriter_WriteEntry_Tests.WriteEntry_UsingTarEntry_FromTarReader_IntoTarWriter_TheoryData( + + ); [Theory] [MemberData(nameof(WriteEntry_UsingTarEntry_FromTarReader_IntoTarWriter_Async_TheoryData))] diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarAddYears.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarAddYears.cs index d96b60586c6..74b3927f721 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarAddYears.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarAddYears.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class GregorianCalendarAddYears { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable AddYears_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarToDateTime.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarToDateTime.cs index 1585f5abc11..71ce20430aa 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarToDateTime.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/GregorianCalendar/GregorianCalendarToDateTime.cs @@ -9,8 +9,9 @@ namespace System.Globalization.Tests { public class GregorianCalendarToDateTime { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable ToDateTime_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarAddYears.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarAddYears.cs index 34de7cf95f5..08c8fad3d00 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarAddYears.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarAddYears.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarAddYears { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable AddYears_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetDaysInMonth.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetDaysInMonth.cs index 6e3ac6b8fca..7df57c08d36 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetDaysInMonth.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetDaysInMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetDaysInMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDaysInMonth_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetMonthsInYear.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetMonthsInYear.cs index bb06c9294e7..6b7dc29e8be 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetMonthsInYear.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/KoreanCalendar/KoreanCalendarGetMonthsInYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetMonthsInYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetMonthsInYear_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddYears.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddYears.cs index 1397c0a1191..b3acdc1481a 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddYears.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddYears.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarAddYears { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable AddYears_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInMonth.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInMonth.cs index cfc2b02ce53..5457c5f0eea 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInMonth.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetDaysInMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDaysInMonth_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonthsInYear.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonthsInYear.cs index 82e18aa0499..52c72298093 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonthsInYear.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonthsInYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetMonthsInYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetMonthsInYear_TestData() { diff --git a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapMonth.cs b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapMonth.cs index 967693725e9..8d77b73434c 100644 --- a/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapMonth.cs +++ b/runtime/src/libraries/System.Globalization.Calendars/tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarIsLeapMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable IsLeapMonth_TestData() { diff --git a/runtime/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Create.Stream.cs b/runtime/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Create.Stream.cs index 4d3130357cb..49f92555519 100644 --- a/runtime/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Create.Stream.cs +++ b/runtime/src/libraries/System.IO.Compression.ZipFile/tests/ZipFile.Create.Stream.cs @@ -130,8 +130,7 @@ public void CreateFromDirectory_IncludeBaseDirectory() using ZipArchive archive = new(destination); foreach (ZipArchiveEntry actualEntry in archive.Entries) { - string expectedFile = expected.Single( - i => Path.GetFileName(i).Equals(actualEntry.Name) + string expectedFile = expected.Single(i => Path.GetFileName(i).Equals(actualEntry.Name) ); Assert.StartsWith("normal", actualEntry.FullName); Assert.Equal(new FileInfo(expectedFile).Length, actualEntry.Length); diff --git a/runtime/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs b/runtime/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs index 3359661dcc2..298045b60ba 100644 --- a/runtime/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs +++ b/runtime/src/libraries/System.IO.Compression/tests/ZipArchive/zip_UpdateTests.cs @@ -189,8 +189,9 @@ public static async Task AppendToEntry(bool writeWithSpans) { s.Seek(0, SeekOrigin.End); - byte[] data = - "\r\n\r\nThe answer my friend, is blowin' in the wind."u8.ToArray(); + byte[] data = "\r\n\r\nThe answer my friend, is blowin' in the wind."u8.ToArray( + + ); if (writeWithSpans) { s.Write(new ReadOnlySpan(data)); diff --git a/runtime/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs b/runtime/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs index 899df29920f..a1a716f78de 100644 --- a/runtime/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs +++ b/runtime/src/libraries/System.IO.FileSystem.AccessControl/tests/FileSystemAclExtensionsTests.cs @@ -1033,9 +1033,8 @@ CommonObjectSecurity actualSecurity expectedAccessRules, actualAccessRule => { - int count = expectedAccessRules.Count( - expectedAccessRule => - AreAccessRulesEqual(expectedAccessRule, actualAccessRule) + int count = expectedAccessRules.Count(expectedAccessRule => + AreAccessRulesEqual(expectedAccessRule, actualAccessRule) ); Assert.True(count > 0); } diff --git a/runtime/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs b/runtime/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs index 0ed4c8d3968..b43b16b2b93 100644 --- a/runtime/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs +++ b/runtime/src/libraries/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.File.Move.cs @@ -235,14 +235,11 @@ private void FileMove_Multiple_FromWatchedToUnwatched(int filesCount, bool skipO var files = Enumerable .Range(0, filesCount) - .Select( - i => - new - { - FileInWatchedDir = Path.Combine(watchedTestDirectory, $"file{i}"), - FileInUnwatchedDir = Path.Combine(unwatchedTestDirectory, $"file{i}") - } - ) + .Select(i => new + { + FileInWatchedDir = Path.Combine(watchedTestDirectory, $"file{i}"), + FileInUnwatchedDir = Path.Combine(unwatchedTestDirectory, $"file{i}") + }) .ToArray(); Array.ForEach(files, (file) => File.Create(file.FileInWatchedDir).Dispose()); @@ -267,16 +264,15 @@ private void FileMove_Multiple_FromWatchedToUnwatched(int filesCount, bool skipO // Remove Created and Changed events as there is racecondition when create file and then observe parent folder. It receives Create and Changed event altought Watcher is not registered yet. if (skipOldEvents) { - events = events.Where( - x => - (x.EventType & (WatcherChangeTypes.Created | WatcherChangeTypes.Changed)) - == 0 + events = events.Where(x => + (x.EventType & (WatcherChangeTypes.Created | WatcherChangeTypes.Changed)) == 0 ); } - var expectedEvents = files.Select( - file => new FiredEvent(WatcherChangeTypes.Deleted, file.FileInWatchedDir) - ); + var expectedEvents = files.Select(file => new FiredEvent( + WatcherChangeTypes.Deleted, + file.FileInWatchedDir + )); Assert.Equal(expectedEvents, events); } @@ -290,14 +286,11 @@ private void FileMove_Multiple_FromUnwatchedToWatched(int filesCount) var files = Enumerable .Range(0, filesCount) - .Select( - i => - new - { - FileInWatchedDir = Path.Combine(watchedTestDirectory, $"file{i}"), - FileInUnwatchedDir = Path.Combine(unwatchedTestDirectory, $"file{i}") - } - ) + .Select(i => new + { + FileInWatchedDir = Path.Combine(watchedTestDirectory, $"file{i}"), + FileInUnwatchedDir = Path.Combine(unwatchedTestDirectory, $"file{i}") + }) .ToArray(); Array.ForEach(files, (file) => File.Create(file.FileInUnwatchedDir).Dispose()); @@ -311,9 +304,10 @@ private void FileMove_Multiple_FromUnwatchedToWatched(int filesCount) ); List events = ExpectEvents(watcher, filesCount, action); - var expectedEvents = files.Select( - file => new FiredEvent(WatcherChangeTypes.Created, file.FileInWatchedDir) - ); + var expectedEvents = files.Select(file => new FiredEvent( + WatcherChangeTypes.Created, + file.FileInWatchedDir + )); Assert.Equal(expectedEvents, events); } diff --git a/runtime/src/libraries/System.IO.Hashing/tests/Crc64Tests.cs b/runtime/src/libraries/System.IO.Hashing/tests/Crc64Tests.cs index ee05992d15d..8c85999d66d 100644 --- a/runtime/src/libraries/System.IO.Hashing/tests/Crc64Tests.cs +++ b/runtime/src/libraries/System.IO.Hashing/tests/Crc64Tests.cs @@ -54,25 +54,33 @@ public static IEnumerable TestCases // Test 256 bytes for vector optimizations new TestCase( "Lorem ipsum 256", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non ipsum quis mauris euismod hendrerit id sed lacus. Duis quam neque, porta et volutpat nec, tempor eget nisl. Nunc quis leo quis nisi mattis molestie. Donec a diam velit. Sed a tempus nec."u8.ToArray(), + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non ipsum quis mauris euismod hendrerit id sed lacus. Duis quam neque, porta et volutpat nec, tempor eget nisl. Nunc quis leo quis nisi mattis molestie. Donec a diam velit. Sed a tempus nec."u8.ToArray( + + ), "DA70046E6B79DD83" ), // Test a multiple of 128 bytes greater than 256 bytes + 16 bytes for vector optimizations new TestCase( "Lorem ipsum 272", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non ipsum quis mauris euismod hendrerit id sed lacus. Duis quam neque, porta et volutpat nec, tempor eget nisl. Nunc quis leo quis nisi mattis molestie. Donec a diam velit. Sed a tempus nec1234567890abcdef."u8.ToArray(), + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent non ipsum quis mauris euismod hendrerit id sed lacus. Duis quam neque, porta et volutpat nec, tempor eget nisl. Nunc quis leo quis nisi mattis molestie. Donec a diam velit. Sed a tempus nec1234567890abcdef."u8.ToArray( + + ), "A94F5E9C5557F65A" ), // Test a multiple of 128 bytes greater than 256 bytes for vector optimizations new TestCase( "Lorem ipsum 384", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam lobortis non felis et pretium. Suspendisse commodo dignissim sagittis. Etiam vestibulum luctus mollis. Ut finibus, nisl in sodales sagittis, leo mauris sollicitudin odio, id sodales nisl ante vitae quam. Nunc ut mi at lacus ultricies efficitur vitae eu ligula. Donec tincidunt, nisi suscipit facilisis auctor, metus non."u8.ToArray(), + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam lobortis non felis et pretium. Suspendisse commodo dignissim sagittis. Etiam vestibulum luctus mollis. Ut finibus, nisl in sodales sagittis, leo mauris sollicitudin odio, id sodales nisl ante vitae quam. Nunc ut mi at lacus ultricies efficitur vitae eu ligula. Donec tincidunt, nisi suscipit facilisis auctor, metus non."u8.ToArray( + + ), "5768E3F2E9A63829" ), // Test data that is > 256 bytes but not a multiple of 16 for vector optimizations new TestCase( "Lorem ipsum 1001", - "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac urna vitae nibh sagittis porttitor et vel ante. Ut molestie sit amet velit ac mattis. Sed ullamcorper nunc non neque imperdiet, vehicula bibendum sapien efficitur. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Suspendisse potenti. Duis sem dui, malesuada non pharetra at, feugiat id mi. Nulla facilisi. Fusce a scelerisque magna. Ut leo justo, auctor quis nisi et, sollicitudin pretium odio. Sed eu nibh mollis, pretium lectus nec, posuere nulla. Morbi ac euismod purus. Morbi rhoncus leo est, at volutpat nunc pretium in. Aliquam erat volutpat. Curabitur eu lacus mollis, varius lectus ut, tincidunt eros. Nullam a velit hendrerit, euismod magna id, fringilla sem. Phasellus scelerisque hendrerit est, vel imperdiet enim auctor a. Aenean vel ultricies nunc. Suspendisse ac tincidunt urna. Nulla tempor dolor ut ligula accumsan, tempus auctor massa gravida. Aenean non odio et augue pellena."u8.ToArray(), + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ac urna vitae nibh sagittis porttitor et vel ante. Ut molestie sit amet velit ac mattis. Sed ullamcorper nunc non neque imperdiet, vehicula bibendum sapien efficitur. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Suspendisse potenti. Duis sem dui, malesuada non pharetra at, feugiat id mi. Nulla facilisi. Fusce a scelerisque magna. Ut leo justo, auctor quis nisi et, sollicitudin pretium odio. Sed eu nibh mollis, pretium lectus nec, posuere nulla. Morbi ac euismod purus. Morbi rhoncus leo est, at volutpat nunc pretium in. Aliquam erat volutpat. Curabitur eu lacus mollis, varius lectus ut, tincidunt eros. Nullam a velit hendrerit, euismod magna id, fringilla sem. Phasellus scelerisque hendrerit est, vel imperdiet enim auctor a. Aenean vel ultricies nunc. Suspendisse ac tincidunt urna. Nulla tempor dolor ut ligula accumsan, tempus auctor massa gravida. Aenean non odio et augue pellena."u8.ToArray( + + ), "3ECF3A363FC5BD59" ), }; diff --git a/runtime/src/libraries/System.IO.Packaging/tests/Tests.cs b/runtime/src/libraries/System.IO.Packaging/tests/Tests.cs index 81f54ddcba3..bab7c89ac6b 100644 --- a/runtime/src/libraries/System.IO.Packaging/tests/Tests.cs +++ b/runtime/src/libraries/System.IO.Packaging/tests/Tests.cs @@ -1881,10 +1881,9 @@ public void T032_DeletePartRelationship() var nonRelationshipParts = package .GetParts() .Cast() - .Where( - p => - p.ContentType - != "application/vnd.openxmlformats-package.relationships+xml" + .Where(p => + p.ContentType + != "application/vnd.openxmlformats-package.relationships+xml" ); int relationshipsBefore = nonRelationshipParts .Select(p => p.GetRelationships().Count()) diff --git a/runtime/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs b/runtime/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs index bc84aa67130..160252ca0e4 100644 --- a/runtime/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs +++ b/runtime/src/libraries/System.IO.Pipes/tests/NamedPipeTests/NamedPipeTest.Specific.cs @@ -296,10 +296,9 @@ public async Task MultipleServers_ServeMultipleClientsConcurrently(int numServer from server in servers select server.WaitForConnectionAsync() ).ToArray(); - Task[] clientWaits = ( - from client in clients - select client.ConnectAsync() - ).ToArray(); + Task[] clientWaits = (from client in clients select client.ConnectAsync()).ToArray( + + ); await serverWaits.Concat(clientWaits).ToArray().WhenAllOrAnyFailed(); Task[] serverSends = ( diff --git a/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalAccess.cs b/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalAccess.cs index ca2703999f5..88641a0ce7c 100644 --- a/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalAccess.cs +++ b/runtime/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/LocalAccess.cs @@ -204,8 +204,9 @@ public override int Run(InterpretedFrame frame) internal sealed class ValueTypeCopyInstruction : Instruction { - public static readonly ValueTypeCopyInstruction Instruction = - new ValueTypeCopyInstruction(); + public static readonly ValueTypeCopyInstruction Instruction = new ValueTypeCopyInstruction( + + ); public override int ConsumedStack => 1; public override int ProducedStack => 1; diff --git a/runtime/src/libraries/System.Linq.Expressions/tests/CompilerTests.cs b/runtime/src/libraries/System.Linq.Expressions/tests/CompilerTests.cs index d7e07e75f69..ca8c7304eba 100644 --- a/runtime/src/libraries/System.Linq.Expressions/tests/CompilerTests.cs +++ b/runtime/src/libraries/System.Linq.Expressions/tests/CompilerTests.cs @@ -438,9 +438,8 @@ private static string Normalize(string s) StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries ) .Where(line => !line.StartsWith("//")) - .Select( - beforeLambdaUniquifierRemoval => - normalizeRegex.Replace(beforeLambdaUniquifierRemoval, "lambda_method") + .Select(beforeLambdaUniquifierRemoval => + normalizeRegex.Replace(beforeLambdaUniquifierRemoval, "lambda_method") ); return string.Join("\n", lines); @@ -527,8 +526,9 @@ public static void CompileWorksWhenDynamicCodeNotSupportedInner() d, e ) => a + b + c + d + e; - Func fiveParameterFunc = - fiveParameterExpression.Compile(); + Func fiveParameterFunc = fiveParameterExpression.Compile( + + ); Assert.Equal(6, fiveParameterFunc(2, 2, 1, 1, 0)); Expression> callExpression = (a, b) => Add(a, b); diff --git a/runtime/src/libraries/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs b/runtime/src/libraries/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs index f32dac4763b..066e13a2c6c 100644 --- a/runtime/src/libraries/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs +++ b/runtime/src/libraries/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs @@ -520,18 +520,17 @@ public static IEnumerable SameNameObjectPairs() { object[] testObjects = Enumerable .Range(0, 4) - .Select( - _ => - Activator.CreateInstance( - AssemblyBuilder - .DefineDynamicAssembly( - new AssemblyName("TestAssembly"), - AssemblyBuilderAccess.RunAndCollect - ) - .DefineDynamicModule("TestModule") - .DefineType("TestType", TypeAttributes.Public) - .CreateType() - ) + .Select(_ => + Activator.CreateInstance( + AssemblyBuilder + .DefineDynamicAssembly( + new AssemblyName("TestAssembly"), + AssemblyBuilderAccess.RunAndCollect + ) + .DefineDynamicModule("TestModule") + .DefineType("TestType", TypeAttributes.Public) + .CreateType() + ) ) .ToArray(); return testObjects.SelectMany(i => testObjects.Select(j => new[] { i, j })); diff --git a/runtime/src/libraries/System.Linq.Expressions/tests/Goto/MakeGoto.cs b/runtime/src/libraries/System.Linq.Expressions/tests/Goto/MakeGoto.cs index 09479b5001e..0d24eeb5413 100644 --- a/runtime/src/libraries/System.Linq.Expressions/tests/Goto/MakeGoto.cs +++ b/runtime/src/libraries/System.Linq.Expressions/tests/Goto/MakeGoto.cs @@ -9,8 +9,8 @@ namespace System.Linq.Expressions.Tests public class MakeGoto { public static IEnumerable GotoTypes => - ((GotoExpressionKind[])Enum.GetValues(typeof(GotoExpressionKind))).Select( - kind => new object[] { kind } + ((GotoExpressionKind[])Enum.GetValues(typeof(GotoExpressionKind))).Select(kind => + new object[] { kind } ); [Theory] diff --git a/runtime/src/libraries/System.Linq.Expressions/tests/MemberInit/ListBindTests.cs b/runtime/src/libraries/System.Linq.Expressions/tests/MemberInit/ListBindTests.cs index df9fe863dc8..8560d7783fd 100644 --- a/runtime/src/libraries/System.Linq.Expressions/tests/MemberInit/ListBindTests.cs +++ b/runtime/src/libraries/System.Linq.Expressions/tests/MemberInit/ListBindTests.cs @@ -370,12 +370,11 @@ public void UpdateDifferentReturnsDifferent() typeof(ListWrapper).GetProperty(nameof(ListWrapper.ListProperty)), Enumerable .Range(0, 3) - .Select( - i => - Expression.ElementInit( - typeof(List).GetMethod("Add"), - Expression.Constant(i) - ) + .Select(i => + Expression.ElementInit( + typeof(List).GetMethod("Add"), + Expression.Constant(i) + ) ) ); Assert.NotSame( @@ -399,12 +398,11 @@ public void UpdateDoesntRepeatEnumeration() typeof(ListWrapper).GetProperty(nameof(ListWrapper.ListProperty)), Enumerable .Range(0, 3) - .Select( - i => - Expression.ElementInit( - typeof(List).GetMethod("Add"), - Expression.Constant(i) - ) + .Select(i => + Expression.ElementInit( + typeof(List).GetMethod("Add"), + Expression.Constant(i) + ) ) ); Assert.NotSame( @@ -430,12 +428,11 @@ public void UpdateNullThrows() typeof(ListWrapper).GetProperty(nameof(ListWrapper.ListProperty)), Enumerable .Range(0, 3) - .Select( - i => - Expression.ElementInit( - typeof(List).GetMethod("Add"), - Expression.Constant(i) - ) + .Select(i => + Expression.ElementInit( + typeof(List).GetMethod("Add"), + Expression.Constant(i) + ) ) ); AssertExtensions.Throws( @@ -449,12 +446,11 @@ public void UpdateSameReturnsSame() { ElementInit[] initializers = Enumerable .Range(0, 3) - .Select( - i => - Expression.ElementInit( - typeof(List).GetMethod("Add"), - Expression.Constant(i) - ) + .Select(i => + Expression.ElementInit( + typeof(List).GetMethod("Add"), + Expression.Constant(i) + ) ) .ToArray(); MemberListBinding binding = Expression.ListBind( diff --git a/runtime/src/libraries/System.Linq.Expressions/tests/Unary/IncDecAssign/IncDecAssignTests.cs b/runtime/src/libraries/System.Linq.Expressions/tests/Unary/IncDecAssign/IncDecAssignTests.cs index b41ee92f56a..c31c35bcdbf 100644 --- a/runtime/src/libraries/System.Linq.Expressions/tests/Unary/IncDecAssign/IncDecAssignTests.cs +++ b/runtime/src/libraries/System.Linq.Expressions/tests/Unary/IncDecAssign/IncDecAssignTests.cs @@ -43,15 +43,15 @@ public static IEnumerable NullableInt16s public static IEnumerable NullableInt16sAndDecrements() { - return NullableInt16s.Select( - i => new object[] { typeof(short?), i, unchecked((short?)(i - 1)) } + return NullableInt16s.Select(i => + new object[] { typeof(short?), i, unchecked((short?)(i - 1)) } ); } public static IEnumerable NullableInt16sAndIncrements() { - return NullableInt16s.Select( - i => new object[] { typeof(short?), i, unchecked((short?)(i + 1)) } + return NullableInt16s.Select(i => + new object[] { typeof(short?), i, unchecked((short?)(i + 1)) } ); } @@ -62,15 +62,15 @@ public static IEnumerable UInt16s public static IEnumerable UInt16sAndDecrements() { - return UInt16s.Select( - i => new object[] { typeof(ushort), i, unchecked((ushort)(i - 1)) } + return UInt16s.Select(i => + new object[] { typeof(ushort), i, unchecked((ushort)(i - 1)) } ); } public static IEnumerable UInt16sAndIncrements() { - return UInt16s.Select( - i => new object[] { typeof(ushort), i, unchecked((ushort)(i + 1)) } + return UInt16s.Select(i => + new object[] { typeof(ushort), i, unchecked((ushort)(i + 1)) } ); } @@ -81,15 +81,15 @@ public static IEnumerable NullableUInt16s public static IEnumerable NullableUInt16sAndDecrements() { - return NullableUInt16s.Select( - i => new object[] { typeof(ushort?), i, unchecked((ushort?)(i - 1)) } + return NullableUInt16s.Select(i => + new object[] { typeof(ushort?), i, unchecked((ushort?)(i - 1)) } ); } public static IEnumerable NullableUInt16sAndIncrements() { - return NullableUInt16s.Select( - i => new object[] { typeof(ushort?), i, unchecked((ushort?)(i + 1)) } + return NullableUInt16s.Select(i => + new object[] { typeof(ushort?), i, unchecked((ushort?)(i + 1)) } ); } @@ -219,15 +219,13 @@ public static IEnumerable NullableUInt64s public static IEnumerable NullableUInt64sAndDecrements() { - return NullableUInt64s.Select( - i => new object[] { typeof(ulong?), i, unchecked(i - 1) } + return NullableUInt64s.Select(i => new object[] { typeof(ulong?), i, unchecked(i - 1) } ); } public static IEnumerable NullableUInt64sAndIncrements() { - return NullableUInt64s.Select( - i => new object[] { typeof(ulong?), i, unchecked(i + 1) } + return NullableUInt64s.Select(i => new object[] { typeof(ulong?), i, unchecked(i + 1) } ); } diff --git a/runtime/src/libraries/System.Linq.Parallel/tests/Combinatorial/SourcesAndOperators.cs b/runtime/src/libraries/System.Linq.Parallel/tests/Combinatorial/SourcesAndOperators.cs index 950f849add1..25822c7618f 100644 --- a/runtime/src/libraries/System.Linq.Parallel/tests/Combinatorial/SourcesAndOperators.cs +++ b/runtime/src/libraries/System.Linq.Parallel/tests/Combinatorial/SourcesAndOperators.cs @@ -337,12 +337,11 @@ public static IEnumerable UnaryOperations() "SelectMany", (start, count, source) => source(0, (count - 1) / CountFactor + 1) - .SelectMany( - x => - Enumerable.Range( - start + x * CountFactor, - Math.Min(CountFactor, count - x * CountFactor) - ) + .SelectMany(x => + Enumerable.Range( + start + x * CountFactor, + Math.Min(CountFactor, count - x * CountFactor) + ) ) ) }; @@ -1063,13 +1062,12 @@ public static IEnumerable BinaryOperators() // For most, only the ordering of the first query is important foreach ( Labeled operation in BinaryOperatorSources(LabeledDefaultSource) - .Where( - op => - !( - op.ToString().StartsWith("Union") - || op.ToString().StartsWith("Zip") - || op.ToString().StartsWith("Concat") - ) && op.ToString().Contains("Right") + .Where(op => + !( + op.ToString().StartsWith("Union") + || op.ToString().StartsWith("Zip") + || op.ToString().StartsWith("Concat") + ) && op.ToString().Contains("Right") ) ) { @@ -1079,10 +1077,8 @@ Labeled operation in BinaryOperatorSources(LabeledDefaultSource) // For Concat and Union, both sources must be ordered foreach ( var operation in BinaryOperatorSources(RangeSources().First()) - .Where( - op => - op.ToString().StartsWith("Concat") - || op.ToString().StartsWith("Union") + .Where(op => + op.ToString().StartsWith("Concat") || op.ToString().StartsWith("Union") ) ) { diff --git a/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/MinTests.cs b/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/MinTests.cs index 9ed52376486..1194fdc13ff 100644 --- a/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/MinTests.cs +++ b/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/MinTests.cs @@ -466,22 +466,20 @@ int min Assert.Equal( count / 2, query - .Min( - x => - x >= count / 2 - ? DelegatedComparable.Delegate(x, Comparer.Default) - : null + .Min(x => + x >= count / 2 + ? DelegatedComparable.Delegate(x, Comparer.Default) + : null ) .Value ); Assert.Equal( count - 1, query - .Min( - x => - x >= count / 2 - ? DelegatedComparable.Delegate(x, ReverseComparer.Instance) - : null + .Min(x => + x >= count / 2 + ? DelegatedComparable.Delegate(x, ReverseComparer.Instance) + : null ) .Value ); diff --git a/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/OrderByThenByTests.cs b/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/OrderByThenByTests.cs index 2b94d47378f..4445a0cc001 100644 --- a/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/OrderByThenByTests.cs +++ b/runtime/src/libraries/System.Linq.Parallel/tests/QueryOperators/OrderByThenByTests.cs @@ -1781,12 +1781,11 @@ public static void ThenBy_ThenBy(Labeled> labeled, int count) int seen = 0; foreach ( var pOuter in labeled - .Item.Select( - x => - KeyValuePair.Create( - x % GroupFactor, - KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) - ) + .Item.Select(x => + KeyValuePair.Create( + x % GroupFactor, + KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) + ) ) .OrderBy(o => o.Key) .ThenBy(o => o.Value.Key) @@ -1838,12 +1837,11 @@ int count int seen = 0; foreach ( var pOuter in labeled - .Item.Select( - x => - KeyValuePair.Create( - x % GroupFactor, - KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) - ) + .Item.Select(x => + KeyValuePair.Create( + x % GroupFactor, + KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) + ) ) .OrderByDescending(o => o.Key) .ThenByDescending(o => o.Value.Key) @@ -1895,12 +1893,11 @@ int count int seen = 0; Assert.All( labeled - .Item.Select( - x => - KeyValuePair.Create( - x % GroupFactor, - KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) - ) + .Item.Select(x => + KeyValuePair.Create( + x % GroupFactor, + KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) + ) ) .OrderBy(o => o.Key) .ThenBy(o => o.Value.Key) @@ -1957,12 +1954,11 @@ int count int seen = 0; Assert.All( labeled - .Item.Select( - x => - KeyValuePair.Create( - x % GroupFactor, - KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) - ) + .Item.Select(x => + KeyValuePair.Create( + x % GroupFactor, + KeyValuePair.Create((KeyFactor - 1) - x % KeyFactor, x) + ) ) .OrderByDescending(o => o.Key) .ThenByDescending(o => o.Value.Key) diff --git a/runtime/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs b/runtime/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs index e63e29da81c..3dda6b2608f 100644 --- a/runtime/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs +++ b/runtime/src/libraries/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs @@ -201,10 +201,9 @@ private Type GetEquivalentType(Type type) .Select(i => new { Info = i, GenType = i.GetGenericTypeDefinition() }) .ToArray(); Type? typeArg = singleTypeGenInterfacesWithGetType - .Where( - i => - i.GenType == typeof(IOrderedQueryable<>) - || i.GenType == typeof(IOrderedEnumerable<>) + .Where(i => + i.GenType == typeof(IOrderedQueryable<>) + || i.GenType == typeof(IOrderedEnumerable<>) ) .Select(i => i.Info.GenericTypeArguments[0]) .Distinct() @@ -214,10 +213,9 @@ private Type GetEquivalentType(Type type) else { typeArg = singleTypeGenInterfacesWithGetType - .Where( - i => - i.GenType == typeof(IQueryable<>) - || i.GenType == typeof(IEnumerable<>) + .Where(i => + i.GenType == typeof(IQueryable<>) + || i.GenType == typeof(IEnumerable<>) ) .Select(i => i.Info.GenericTypeArguments[0]) .Distinct() diff --git a/runtime/src/libraries/System.Linq.Queryable/tests/Queryable.cs b/runtime/src/libraries/System.Linq.Queryable/tests/Queryable.cs index 8bfc401887e..1dcc0da2846 100644 --- a/runtime/src/libraries/System.Linq.Queryable/tests/Queryable.cs +++ b/runtime/src/libraries/System.Linq.Queryable/tests/Queryable.cs @@ -58,7 +58,9 @@ public void NonGenericToQueryable() AssertExtensions.Throws( null, () => - new NonGenericEnumerableSoWeDontNeedADependencyOnTheAssemblyWithNonGeneric().AsQueryable() + new NonGenericEnumerableSoWeDontNeedADependencyOnTheAssemblyWithNonGeneric( + + ).AsQueryable() ); } @@ -150,15 +152,15 @@ IEnumerable excludedMethods var dex = new HashSet(excludedMethods); var aMethods = a.GetMethods(BindingFlags.Static | BindingFlags.Public) - .Where( - m => m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) + .Where(m => + m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) ) .ToLookup(m => m.Name); MethodComparer mc = new MethodComparer(); var bMethods = b.GetMethods(BindingFlags.Static | BindingFlags.Public) - .Where( - m => m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) + .Where(m => + m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) ) .ToLookup(m => m, mc); diff --git a/runtime/src/libraries/System.Linq/tests/ConsistencyTests.cs b/runtime/src/libraries/System.Linq/tests/ConsistencyTests.cs index c2136c9398f..8c603dbfe64 100644 --- a/runtime/src/libraries/System.Linq/tests/ConsistencyTests.cs +++ b/runtime/src/libraries/System.Linq/tests/ConsistencyTests.cs @@ -74,15 +74,15 @@ IEnumerable excludedMethods var dex = new HashSet(excludedMethods); var aMethods = a.GetMethods(BindingFlags.Static | BindingFlags.Public) - .Where( - m => m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) + .Where(m => + m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) ) .ToLookup(m => m.Name); MethodComparer mc = new MethodComparer(); var bMethods = b.GetMethods(BindingFlags.Static | BindingFlags.Public) - .Where( - m => m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) + .Where(m => + m.CustomAttributes.Any(c => c.AttributeType == typeof(ExtensionAttribute)) ) .ToLookup(m => m, mc); diff --git a/runtime/src/libraries/System.Linq/tests/GroupByTests.cs b/runtime/src/libraries/System.Linq/tests/GroupByTests.cs index dda34ad00a3..7748db42511 100644 --- a/runtime/src/libraries/System.Linq/tests/GroupByTests.cs +++ b/runtime/src/libraries/System.Linq/tests/GroupByTests.cs @@ -124,8 +124,8 @@ public void SameResultsRepeatCallsStringQuery() [Fact] public void Grouping_IList_IsReadOnly() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); foreach (IList grouping in oddsEvens) { @@ -136,8 +136,8 @@ public void Grouping_IList_IsReadOnly() [Fact] public void Grouping_IList_NotSupported() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); foreach (IList grouping in oddsEvens) { @@ -153,8 +153,8 @@ public void Grouping_IList_NotSupported() [Fact] public void Grouping_IList_IndexerGetter() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); var e = oddsEvens.GetEnumerator(); @@ -172,8 +172,8 @@ public void Grouping_IList_IndexerGetter() [Fact] public void Grouping_IList_IndexGetterOutOfRange() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); var e = oddsEvens.GetEnumerator(); @@ -186,8 +186,8 @@ public void Grouping_IList_IndexGetterOutOfRange() [Fact] public void Grouping_ICollection_Contains() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); var e = oddsEvens.GetEnumerator(); @@ -209,8 +209,8 @@ public void Grouping_ICollection_Contains() [Fact] public void Grouping_IList_IndexOf() { - IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy( - i => i % 2 == 0 + IEnumerable> oddsEvens = new int[] { 1, 2, 3, 4 }.GroupBy(i => + i % 2 == 0 ); var e = oddsEvens.GetEnumerator(); diff --git a/runtime/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs b/runtime/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs index 67b81d50b82..d21caf02d29 100644 --- a/runtime/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs +++ b/runtime/src/libraries/System.Linq/tests/ToLookupTests.DebuggerAttributes.cs @@ -35,8 +35,8 @@ public void DebuggerAttributesValid(ILookup look Assert.Equal(1, properties.Count()); // Groupings - PropertyInfo groupingsProperty = properties.Single( - property => property.Name == "Groupings" + PropertyInfo groupingsProperty = properties.Single(property => + property.Name == "Groupings" ); Assert.Equal( DebuggerBrowsableState.RootHidden, diff --git a/runtime/src/libraries/System.Management/src/System/Management/WMIGenerator.cs b/runtime/src/libraries/System.Management/src/System/Management/WMIGenerator.cs index 2ad175586d7..1ca4588a7db 100644 --- a/runtime/src/libraries/System.Management/src/System/Management/WMIGenerator.cs +++ b/runtime/src/libraries/System.Management/src/System/Management/WMIGenerator.cs @@ -7420,9 +7420,9 @@ CodeExpression beginningExpression beginningExpression ) ); - cmie2.Method.MethodName = PrivateNamesUsed[ - "ToDMTFTimeIntervalMethod" - ].ToString(); + cmie2.Method.MethodName = PrivateNamesUsed["ToDMTFTimeIntervalMethod"].ToString( + + ); return cmie2; case "System.Management.ManagementPath": @@ -8285,8 +8285,9 @@ private void AddToDateTimeFunction() string exceptVar = "e"; CodeCatchClause catchblock = new CodeCatchClause(exceptVar); - CodeObjectCreateExpression codeThrowExceptionWithArgs = - new CodeObjectCreateExpression(); + CodeObjectCreateExpression codeThrowExceptionWithArgs = new CodeObjectCreateExpression( + + ); codeThrowExceptionWithArgs.CreateType = new CodeTypeReference( PublicNamesUsed["ArgumentOutOfRangeException"].ToString() ); @@ -9740,8 +9741,9 @@ private void AddToTimeSpanFunction() string exceptVar = "e"; CodeCatchClause catchblock = new CodeCatchClause(exceptVar); - CodeObjectCreateExpression codeThrowExceptionWithArgs = - new CodeObjectCreateExpression(); + CodeObjectCreateExpression codeThrowExceptionWithArgs = new CodeObjectCreateExpression( + + ); codeThrowExceptionWithArgs.CreateType = new CodeTypeReference( PublicNamesUsed["ArgumentOutOfRangeException"].ToString() ); diff --git a/runtime/src/libraries/System.Memory/tests/Binary/ReverseEndiannessUnitTests.cs b/runtime/src/libraries/System.Memory/tests/Binary/ReverseEndiannessUnitTests.cs index 46a460ccbe6..7089203ba42 100644 --- a/runtime/src/libraries/System.Memory/tests/Binary/ReverseEndiannessUnitTests.cs +++ b/runtime/src/libraries/System.Memory/tests/Binary/ReverseEndiannessUnitTests.cs @@ -151,26 +151,20 @@ public static IEnumerable ReverseEndianness_Span_MemberData() { Enumerable .Range(0, length) - .Select( - _ => - new UInt128( - (ulong)r.NextInt64(long.MinValue, long.MaxValue), - (ulong)r.NextInt64(long.MinValue, long.MaxValue) - ) - ) + .Select(_ => new UInt128( + (ulong)r.NextInt64(long.MinValue, long.MaxValue), + (ulong)r.NextInt64(long.MinValue, long.MaxValue) + )) .ToArray() }; yield return new object[] { Enumerable .Range(0, length) - .Select( - _ => - new Int128( - (ulong)r.NextInt64(long.MinValue, long.MaxValue), - (ulong)r.NextInt64(long.MinValue, long.MaxValue) - ) - ) + .Select(_ => new Int128( + (ulong)r.NextInt64(long.MinValue, long.MaxValue), + (ulong)r.NextInt64(long.MinValue, long.MaxValue) + )) .ToArray() }; } diff --git a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Boolean.cs b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Boolean.cs index 82b1b247185..77ebdc24166 100644 --- a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Boolean.cs +++ b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Boolean.cs @@ -12,7 +12,9 @@ public static IEnumerable> BooleanParserTestData get { foreach ( - ParserTestData testData in BooleanFormatterTestData.ToParserTheoryDataCollection() + ParserTestData testData in BooleanFormatterTestData.ToParserTheoryDataCollection( + + ) ) { yield return testData; diff --git a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Date.cs b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Date.cs index 888a5e7c004..9f386bdc34c 100644 --- a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Date.cs +++ b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Date.cs @@ -12,7 +12,9 @@ public static IEnumerable> DateTimeParserTestData get { foreach ( - ParserTestData testData in DateTimeFormatterTestData.ToParserTheoryDataCollection() + ParserTestData testData in DateTimeFormatterTestData.ToParserTheoryDataCollection( + + ) ) { bool roundTrippable = testData.FormatSymbol == 'O'; @@ -135,7 +137,9 @@ ParserTestData bad in GenerateCorruptedDateTimeText( } foreach ( - ParserTestData testData in DateTimeOffsetFormatterTestData.ToParserTheoryDataCollection() + ParserTestData testData in DateTimeOffsetFormatterTestData.ToParserTheoryDataCollection( + + ) ) { bool roundTrippable = testData.FormatSymbol == 'O'; diff --git a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Guid.cs b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Guid.cs index e339890b757..7e1c42b0a5a 100644 --- a/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Guid.cs +++ b/runtime/src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/TestData.Parser.Guid.cs @@ -13,7 +13,9 @@ public static IEnumerable> GuidParserTestData get { foreach ( - ParserTestData testData in GuidFormatterTestData.ToParserTheoryDataCollection() + ParserTestData testData in GuidFormatterTestData.ToParserTheoryDataCollection( + + ) ) { yield return testData; diff --git a/runtime/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs b/runtime/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs index 4f957463893..d3e372b2722 100644 --- a/runtime/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs +++ b/runtime/src/libraries/System.Net.Http.WinHttpHandler/tests/FunctionalTests/WinHttpHandlerTest.cs @@ -128,13 +128,14 @@ await connection.SendResponseAsync( await triggerResponseWrite.Task; }); - HttpRequestException ex = - await Assert.ThrowsAsync(async () => + HttpRequestException ex = await Assert.ThrowsAsync( + async () => { Task t = client.GetAsync(url); await triggerRequestWait.Task; var _ = await t; - }); + } + ); Assert.IsType(ex.InnerException); Assert.NotNull(ex.InnerException.InnerException); Assert.Contains( diff --git a/runtime/src/libraries/System.Net.Http/src/System/Net/Http/CancellationHelper.cs b/runtime/src/libraries/System.Net.Http/src/System/Net/Http/CancellationHelper.cs index 072bcf1acc6..e29bd562b8c 100644 --- a/runtime/src/libraries/System.Net.Http/src/System/Net/Http/CancellationHelper.cs +++ b/runtime/src/libraries/System.Net.Http/src/System/Net/Http/CancellationHelper.cs @@ -10,8 +10,9 @@ namespace System.Net.Http internal static class CancellationHelper { /// The default message used by . - private static readonly string s_cancellationMessage = - new OperationCanceledException().Message; // use same message as the default ctor + private static readonly string s_cancellationMessage = new OperationCanceledException( + + ).Message; // use same message as the default ctor /// Determines whether to wrap an in a cancellation exception. /// The exception. diff --git a/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs b/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs index dc02f284069..9f352fd637b 100644 --- a/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs +++ b/runtime/src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpRequestHeaders.cs @@ -37,41 +37,37 @@ private T GetSpecializedCollection(int slot, Func crea public HttpHeaderValueCollection Accept => GetSpecializedCollection( AcceptSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.Accept.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.Accept.Descriptor, + thisRef + ) ); public HttpHeaderValueCollection AcceptCharset => GetSpecializedCollection( AcceptCharsetSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.AcceptCharset.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.AcceptCharset.Descriptor, + thisRef + ) ); public HttpHeaderValueCollection AcceptEncoding => GetSpecializedCollection( AcceptEncodingSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.AcceptEncoding.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.AcceptEncoding.Descriptor, + thisRef + ) ); public HttpHeaderValueCollection AcceptLanguage => GetSpecializedCollection( AcceptLanguageSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.AcceptLanguage.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.AcceptLanguage.Descriptor, + thisRef + ) ); public AuthenticationHeaderValue? Authorization @@ -177,11 +173,10 @@ public string? Host public HttpHeaderValueCollection IfMatch => GetSpecializedCollection( IfMatchSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.IfMatch.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.IfMatch.Descriptor, + thisRef + ) ); public DateTimeOffset? IfModifiedSince @@ -199,11 +194,10 @@ public DateTimeOffset? IfModifiedSince public HttpHeaderValueCollection IfNoneMatch => GetSpecializedCollection( IfNoneMatchSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.IfNoneMatch.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.IfNoneMatch.Descriptor, + thisRef + ) ); public RangeConditionHeaderValue? IfRange @@ -285,31 +279,28 @@ public Uri? Referrer public HttpHeaderValueCollection TE => GetSpecializedCollection( TransferEncodingSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.TE.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.TE.Descriptor, + thisRef + ) ); public HttpHeaderValueCollection UserAgent => GetSpecializedCollection( UserAgentSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.UserAgent.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.UserAgent.Descriptor, + thisRef + ) ); public HttpHeaderValueCollection Expect => GetSpecializedCollection( ExpectSlot, - static thisRef => - new HttpHeaderValueCollection( - KnownHeaders.Expect.Descriptor, - thisRef - ) + static thisRef => new HttpHeaderValueCollection( + KnownHeaders.Expect.Descriptor, + thisRef + ) ); #endregion diff --git a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs index 85b89e4cde5..a1bc049b85b 100644 --- a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs +++ b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http3.cs @@ -326,8 +326,9 @@ public async Task ReservedFrameType_Throws() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); QuicException ex = await AssertThrowsQuicExceptionAsync( QuicError.ConnectionAborted, @@ -375,8 +376,9 @@ public async Task ServerClosesConnection_ThrowsHttpProtocolException() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); await connection.CloseAsync(GeneralProtocolError); }); @@ -415,8 +417,9 @@ public async Task ServerClosesStream_ThrowsHttpProtocolException() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); stream.Abort(GeneralProtocolError); await semaphore.WaitAsync(); @@ -506,8 +509,9 @@ public async Task ServerClosesConnection_ResponseContentStream_ThrowsHttpProtoco { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); await stream.ReadRequestBodyAsync(); await stream.SendResponseHeadersAsync(); @@ -555,8 +559,9 @@ public async Task RequestSentResponseDisposed_ThrowsOnServer() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync(); await stream.SendResponseHeadersAsync(); @@ -622,8 +627,9 @@ public async Task RequestStreamingResponseFinishes_ClientFinishes() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync(false); var body = await stream.ReadRequestBodyAsync(data.Length); await stream.SendResponseHeadersAsync(); @@ -674,8 +680,9 @@ public async Task RequestSendingResponseDisposed_ThrowsOnServer() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync(false); await stream.SendResponseHeadersAsync(); @@ -753,11 +760,13 @@ public async Task ServerCertificateCustomValidationCallback_Succeeds() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); await stream.HandleRequestAsync(); - await using Http3LoopbackStream stream2 = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream2 = await connection.AcceptRequestStreamAsync( + + ); await stream2.HandleRequestAsync(); }); @@ -799,8 +808,9 @@ public async Task EmptyCustomContent_FlushHeaders() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); // Receive headers and unblock the client. await stream.ReadRequestDataAsync(false); @@ -1037,8 +1047,9 @@ public async Task ResponseCancellation_ServerReceivesCancellation(CancellationTy { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync().ConfigureAwait(false); @@ -1136,8 +1147,9 @@ public async Task ResponseCancellation_BothCancellationTokenAndDispose_Success() { await using Http3LoopbackConnection connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync().ConfigureAwait(false); @@ -1241,8 +1253,9 @@ public async Task Alpn_H3_Success() { connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); await stream.HandleRequestAsync(); }); @@ -1473,8 +1486,9 @@ public async Task StatusCodes_ReceiveSuccess(HttpStatusCode statusCode, bool qpa { connection = (Http3LoopbackConnection) await server.EstablishGenericConnectionAsync(); - await using Http3LoopbackStream stream = - await connection.AcceptRequestStreamAsync(); + await using Http3LoopbackStream stream = await connection.AcceptRequestStreamAsync( + + ); HttpRequestData request = await stream.ReadRequestDataAsync().ConfigureAwait(false); diff --git a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs index 0703af808f2..cc61506e807 100644 --- a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs +++ b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/SocketsHttpHandlerTest.Http2FlowControl.cs @@ -46,8 +46,8 @@ public async Task InitialHttp2StreamWindowSize_SentInSettingsFrame() SettingsFrame clientSettingsFrame = await connection .ReadSettingsAsync() .ConfigureAwait(false); - SettingsEntry entry = clientSettingsFrame.Entries.First( - e => e.SettingId == SettingId.InitialWindowSize + SettingsEntry entry = clientSettingsFrame.Entries.First(e => + e.SettingId == SettingId.InitialWindowSize ); Assert.Equal(WindowSize, (int)entry.Value); diff --git a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs index 662b93d89ea..d7a6df91275 100644 --- a/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs +++ b/runtime/src/libraries/System.Net.Http/tests/FunctionalTests/TelemetryTest.cs @@ -844,8 +844,8 @@ EventWrittenEventArgs requestContentStop in requestContentStops.Select(e => e.Ev .ToArray(); Assert.Equal(count, responseHeadersStops.Length); foreach ( - EventWrittenEventArgs responseHeadersStop in responseHeadersStops.Select( - e => e.Event + EventWrittenEventArgs responseHeadersStop in responseHeadersStops.Select(e => + e.Event ) ) { @@ -1171,8 +1171,8 @@ await connection.ReadRequestDataAsync( ValidateConnectionEstablishedClosed(events, version, expectedUri); - var requestLeftQueueEvents = events.Where( - e => e.Event.EventName == "RequestLeftQueue" + var requestLeftQueueEvents = events.Where(e => + e.Event.EventName == "RequestLeftQueue" ); var (minCount, maxCount) = version.Major switch { @@ -1340,8 +1340,9 @@ await listener.RunWithCallbackAsync( e => events.Enqueue((e, e.ActivityId)), async () => { - using LoopbackProxyServer proxyServer = - LoopbackProxyServer.Create(); + using LoopbackProxyServer proxyServer = LoopbackProxyServer.Create( + + ); await LoopbackServer.CreateClientAndServerAsync( async uri => @@ -1472,8 +1473,8 @@ await Http11LoopbackServerFactory.Singleton.CreateClientAndServerAsync( Task[] parallelConnectionTasks = Enumerable .Repeat(server, NumParallelRequests) - .Select( - _ => server.AcceptConnectionAsync(HandleConnectionAsync) + .Select(_ => + server.AcceptConnectionAsync(HandleConnectionAsync) ) .ToArray(); diff --git a/runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs b/runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs index ca331ae26ac..7043b4f66d4 100644 --- a/runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs +++ b/runtime/src/libraries/System.Net.Http/tests/StressTests/HttpStress/StressServer.cs @@ -267,16 +267,15 @@ private static void MapRoutes(IEndpointRouteBuilder endpoints) (string name, StringValues values)[] headersToEcho = context .Request.Headers.Where(h => h.Key.StartsWith("header-")) // kestrel does not seem to be splitting comma separated header values, handle here - .Select( - h => - ( - h.Key, - new StringValues( - h.Value.SelectMany(v => v.Split(',')) - .Select(x => x.Trim()) - .ToArray() - ) + .Select(h => + ( + h.Key, + new StringValues( + h.Value.SelectMany(v => v.Split(',')) + .Select(x => x.Trim()) + .ToArray() ) + ) ) .ToArray(); diff --git a/runtime/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs b/runtime/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs index db9e81a3ab5..fd38f85eae5 100644 --- a/runtime/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs +++ b/runtime/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs @@ -2576,8 +2576,8 @@ bool enumerateNonValidated KeyValuePair[] entries = enumerateNonValidated ? headers - .NonValidated.Select( - pair => KeyValuePair.Create(pair.Key, Assert.Single(pair.Value)) + .NonValidated.Select(pair => + KeyValuePair.Create(pair.Key, Assert.Single(pair.Value)) ) .ToArray() : headers diff --git a/runtime/src/libraries/System.Net.Mail/src/System/Net/Mail/MailHeaderInfo.cs b/runtime/src/libraries/System.Net.Mail/src/System/Net/Mail/MailHeaderInfo.cs index e94ad63c99a..0280a2388ca 100644 --- a/runtime/src/libraries/System.Net.Mail/src/System/Net/Mail/MailHeaderInfo.cs +++ b/runtime/src/libraries/System.Net.Mail/src/System/Net/Mail/MailHeaderInfo.cs @@ -91,8 +91,9 @@ bool allowsUnicode new HeaderInfo(MailHeaderID.XSender, "X-Sender", true, true, true) }; - private static readonly Dictionary s_headerDictionary = - CreateHeaderDictionary(); + private static readonly Dictionary s_headerDictionary = CreateHeaderDictionary( + + ); private static Dictionary CreateHeaderDictionary() { diff --git a/runtime/src/libraries/System.Net.Mail/src/System/Net/Mime/ContentDisposition.cs b/runtime/src/libraries/System.Net.Mail/src/System/Net/Mime/ContentDisposition.cs index 7eb6bb1a8e3..b0c87ece176 100644 --- a/runtime/src/libraries/System.Net.Mail/src/System/Net/Mime/ContentDisposition.cs +++ b/runtime/src/libraries/System.Net.Mail/src/System/Net/Mime/ContentDisposition.cs @@ -25,9 +25,9 @@ public class ContentDisposition private bool _isPersisted; private static readonly TrackingValidationObjectDictionary.ValidateAndParseValue s_dateParser = - new TrackingValidationObjectDictionary.ValidateAndParseValue( - v => new SmtpDateTime(v.ToString()!) - ); + new TrackingValidationObjectDictionary.ValidateAndParseValue(v => new SmtpDateTime( + v.ToString()! + )); // this will throw a FormatException if the value supplied is not a valid SmtpDateTime diff --git a/runtime/src/libraries/System.Net.NameResolution/tests/FunctionalTests/MetricsTest.cs b/runtime/src/libraries/System.Net.NameResolution/tests/FunctionalTests/MetricsTest.cs index 6fd5eb986d3..1e5322b7667 100644 --- a/runtime/src/libraries/System.Net.NameResolution/tests/FunctionalTests/MetricsTest.cs +++ b/runtime/src/libraries/System.Net.NameResolution/tests/FunctionalTests/MetricsTest.cs @@ -91,11 +91,10 @@ private static double[] GetMeasurementsForHostname( { KeyValuePair[] tags = m.Tags.ToArray(); if ( - !tags.Any( - t => - t.Key == "dns.question.name" - && t.Value is string hostnameTag - && hostnameTag == hostname + !tags.Any(t => + t.Key == "dns.question.name" + && t.Value is string hostnameTag + && hostnameTag == hostname ) ) { diff --git a/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs b/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs index ac5c370325b..83a39e13fdc 100644 --- a/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs +++ b/runtime/src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/LinuxNetworkInterface.cs @@ -114,10 +114,9 @@ public static unsafe NetworkInterface[] GetLinuxNetworkInterfaces() if (nii->NumAddressBytes > 0) { lni._physicalAddress = new PhysicalAddress( - new ReadOnlySpan( - nii->AddressBytes, - nii->NumAddressBytes - ).ToArray() + new ReadOnlySpan(nii->AddressBytes, nii->NumAddressBytes).ToArray( + + ) ); } diff --git a/runtime/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs b/runtime/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs index fbe0e46c35b..623a467b4d9 100644 --- a/runtime/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs +++ b/runtime/src/libraries/System.Net.Primitives/src/System/Net/CookieContainer.cs @@ -873,8 +873,9 @@ public CookieCollection GetAllCookies() int port = uri.Port; CookieCollection? cookies = null; - var domainAttributeMatchAnyCookieVariant = - new System.Collections.Generic.List(); + var domainAttributeMatchAnyCookieVariant = new System.Collections.Generic.List( + + ); System.Collections.Generic.List? domainAttributeMatchOnlyCookieVariantPlain = null; diff --git a/runtime/src/libraries/System.Net.Primitives/tests/FunctionalTests/IPNetworkTest.cs b/runtime/src/libraries/System.Net.Primitives/tests/FunctionalTests/IPNetworkTest.cs index f16115f57ef..e50981eec81 100644 --- a/runtime/src/libraries/System.Net.Primitives/tests/FunctionalTests/IPNetworkTest.cs +++ b/runtime/src/libraries/System.Net.Primitives/tests/FunctionalTests/IPNetworkTest.cs @@ -313,8 +313,8 @@ public void Equals_WhenNull_ReturnsFalse() } public static IEnumerable CidrInputs() => - new[] { "127.0.0.0/24", "172.16.0.0/12", "10.0.0.0/16", "192.168.2.0/24", }.Select( - s => new object[] { s } + new[] { "127.0.0.0/24", "172.16.0.0/12", "10.0.0.0/16", "192.168.2.0/24", }.Select(s => + new object[] { s } ); [Theory] diff --git a/runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs b/runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs index 843d456faeb..98792ec6d4e 100644 --- a/runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs +++ b/runtime/src/libraries/System.Net.Quic/tests/FunctionalTests/MsQuicTests.cs @@ -1105,8 +1105,9 @@ await RunClientServer( }, async serverConnection => { - await using QuicStream stream = - await serverConnection.AcceptInboundStreamAsync(); + await using QuicStream stream = await serverConnection.AcceptInboundStreamAsync( + + ); var buffer = new byte[4096]; int receivedBytes = 0, @@ -1133,12 +1134,11 @@ public static IEnumerable WriteData() return from bufferCount in new[] { 1, 2, 3, 10 } let writes = Enumerable .Range(0, 5) - .Select( - _ => - Enumerable - .Range(0, bufferCount) - .Select(_ => bufferSizes[r.Next(bufferSizes.Length)]) - .ToArray() + .Select(_ => + Enumerable + .Range(0, bufferCount) + .Select(_ => bufferSizes[r.Next(bufferSizes.Length)]) + .ToArray() ) .ToArray() select new object[] { writes }; diff --git a/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.OSX.cs b/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.OSX.cs index 6bfdfad3608..237a597d635 100644 --- a/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.OSX.cs +++ b/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslConnectionInfo.OSX.cs @@ -57,8 +57,9 @@ public void UpdateSslConnectionInfo(SafeDeleteSslContext context) } else { - ApplicationProtocol = - context.SelectedApplicationProtocol.Protocol.ToArray(); + ApplicationProtocol = context.SelectedApplicationProtocol.Protocol.ToArray( + + ); } } } diff --git a/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs b/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs index 47726dca0ce..939b32e9293 100644 --- a/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs +++ b/runtime/src/libraries/System.Net.Security/src/System/Net/Security/SslStream.Protocol.cs @@ -297,8 +297,9 @@ private string[] GetRequestCertificateAuthorities() { issuers = GetRequestCertificateAuthorities(); remoteCert = CertificateValidationPal.GetRemoteCertificate(_securityContext); - _sslAuthenticationOptions.ClientCertificates ??= - new X509CertificateCollection(); + _sslAuthenticationOptions.ClientCertificates ??= new X509CertificateCollection( + + ); clientCertificate = _sslAuthenticationOptions.CertSelectionDelegate( this, _sslAuthenticationOptions.TargetHost, diff --git a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs index cfda3621fe4..e249648dbee 100644 --- a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs +++ b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/CertificateValidationRemoteServer.cs @@ -295,8 +295,9 @@ private async Task ConnectWithRevocation_WithCallback_Core( { issuingAuthority.Revoke(serverCert, serverCert.NotBefore); - SslServerAuthenticationOptions serverOpts = - new SslServerAuthenticationOptions(); + SslServerAuthenticationOptions serverOpts = new SslServerAuthenticationOptions( + + ); if (offlineContext.HasValue) { diff --git a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs index 555e755f5a2..a5fbe2ae38d 100644 --- a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs +++ b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamRemoteExecutorTests.cs @@ -39,8 +39,9 @@ public void SslKeyLogFile_IsCreatedAndFilled() .Invoke( async () => { - (Stream clientStream, Stream serverStream) = - TestHelper.GetConnectedStreams(); + (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams( + + ); using (clientStream) using (serverStream) using (var client = new SslStream(clientStream)) diff --git a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs index 0e73049e236..955d7c0a374 100644 --- a/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs +++ b/runtime/src/libraries/System.Net.Security/tests/FunctionalTests/TelemetryTest.cs @@ -159,7 +159,9 @@ await listener.RunWithCallbackAsync( { // Invoke tests that'll cause some events to be generated var test = new SslStreamStreamToStreamTest_Async(); - await test.SslStream_ServerLocalCertificateSelectionCallbackReturnsNull_Throw(); + await test.SslStream_ServerLocalCertificateSelectionCallbackReturnsNull_Throw( + + ); await WaitForEventCountersAsync(events); } ); @@ -304,8 +306,8 @@ bool shouldHaveFailures double[] allHandshakeDurations = eventCounters["all-tls-handshake-duration"]; double[][] tlsHandshakeDurations = eventCounters - .Where( - pair => pair.Key.StartsWith("tls") && pair.Key.EndsWith("-handshake-duration") + .Where(pair => + pair.Key.StartsWith("tls") && pair.Key.EndsWith("-handshake-duration") ) .Select(pair => pair.Value) .ToArray(); diff --git a/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs b/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs index 477430e5efb..ae1a3f838f3 100644 --- a/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs +++ b/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketDuplicationTests.cs @@ -274,8 +274,9 @@ static void ChildProcessBody(string clientPipeHandle) public async Task DoAsyncOperation_OnBothOriginalAndClone_ThrowsInvalidOperationException() { // Not applicable for synchronous operations: - (Socket client, Socket originalServer) = - SocketTestExtensions.CreateConnectedSocketPair(); + (Socket client, Socket originalServer) = SocketTestExtensions.CreateConnectedSocketPair( + + ); using (client) using (originalServer) diff --git a/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs b/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs index feb8637bc40..f37adb8f18f 100644 --- a/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs +++ b/runtime/src/libraries/System.Net.Sockets/tests/FunctionalTests/SocketTestHelper.cs @@ -634,12 +634,11 @@ EndPoint endPoint ) => InvokeAsync( s, - e => - new SocketReceiveFromResult - { - ReceivedBytes = e.BytesTransferred, - RemoteEndPoint = e.RemoteEndPoint - }, + e => new SocketReceiveFromResult + { + ReceivedBytes = e.BytesTransferred, + RemoteEndPoint = e.RemoteEndPoint + }, e => { e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); @@ -655,14 +654,13 @@ EndPoint endPoint ) => InvokeAsync( s, - e => - new SocketReceiveMessageFromResult - { - ReceivedBytes = e.BytesTransferred, - RemoteEndPoint = e.RemoteEndPoint, - SocketFlags = e.SocketFlags, - PacketInformation = e.ReceiveMessageFromPacketInfo - }, + e => new SocketReceiveMessageFromResult + { + ReceivedBytes = e.BytesTransferred, + RemoteEndPoint = e.RemoteEndPoint, + SocketFlags = e.SocketFlags, + PacketInformation = e.ReceiveMessageFromPacketInfo + }, e => { e.SetBuffer(buffer.Array, buffer.Offset, buffer.Count); diff --git a/runtime/src/libraries/System.Net.WebSockets.Client/tests/ClientWebSocketTestBase.cs b/runtime/src/libraries/System.Net.WebSockets.Client/tests/ClientWebSocketTestBase.cs index 933f6521a2a..f5039e688c9 100644 --- a/runtime/src/libraries/System.Net.WebSockets.Client/tests/ClientWebSocketTestBase.cs +++ b/runtime/src/libraries/System.Net.WebSockets.Client/tests/ClientWebSocketTestBase.cs @@ -29,8 +29,8 @@ public class ClientWebSocketTestBase .WebSockets .EchoHeadersServers; public static readonly object[][] EchoServersAndBoolean = EchoServers - .SelectMany( - o => new object[][] { new object[] { o[0], false }, new object[] { o[0], true } } + .SelectMany(o => + new object[][] { new object[] { o[0], false }, new object[] { o[0], true } } ) .ToArray(); public static readonly object[][] SecureEchoServersAndBoolean = new object[][] diff --git a/runtime/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs b/runtime/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs index 9ecc90d6e8b..98c95d9f9b9 100644 --- a/runtime/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs +++ b/runtime/src/libraries/System.Net.WebSockets.Client/tests/ConnectTest.Http2.cs @@ -37,8 +37,8 @@ public static IEnumerable ConnectAsync_Http2WithNoInvoker_ThrowsArgume yield return Options(options => options.HttpVersion = HttpVersion.Version20); yield return Options(options => options.HttpVersion = HttpVersion.Version30); yield return Options(options => options.HttpVersion = new Version(2, 1)); - yield return Options( - options => options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher + yield return Options(options => + options.HttpVersionPolicy = HttpVersionPolicy.RequestVersionOrHigher ); static object[] Options(Action configureOptions) => diff --git a/runtime/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs b/runtime/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs index 50d3911f62f..62ca1b21af0 100644 --- a/runtime/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs +++ b/runtime/src/libraries/System.Net.WebSockets/tests/WebSocketCreateTest.cs @@ -592,8 +592,8 @@ await writer.WriteAsync( .WebSockets .EchoServers; public static readonly object[][] EchoServersAndBoolean = EchoServers - .SelectMany( - o => new object[][] { new object[] { o[0], false }, new object[] { o[0], true } } + .SelectMany(o => + new object[][] { new object[] { o[0], false }, new object[] { o[0], true } } ) .ToArray(); diff --git a/runtime/src/libraries/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs b/runtime/src/libraries/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs index c2fc50939da..6d986917fa6 100644 --- a/runtime/src/libraries/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs +++ b/runtime/src/libraries/System.ObjectModel/tests/ObservableCollection/ObservableCollection_ConstructorAndPropertyTests.cs @@ -144,10 +144,9 @@ public static void DebuggerAttributeTests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); int[] items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs b/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs index 2a03721dc44..7264be2bbb4 100644 --- a/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs +++ b/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyDictionary/ReadOnlyDictionaryTests.cs @@ -327,10 +327,9 @@ public static void DebuggerAttributeTests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( dict ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); Array itemArray = (Array)itemProperty.GetValue(info.Instance); Assert.Equal(dict.Count, itemArray.Length); @@ -341,10 +340,9 @@ public static void DebuggerAttributeTests() new Type[] { typeof(int) }, dict.Keys ); - itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); int[] items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(dict.Keys, items); @@ -355,10 +353,9 @@ public static void DebuggerAttributeTests() new Type[] { typeof(int) }, dict.Values ); - itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(dict.Values, items); diff --git a/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs b/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs index 1569f1bb69f..034e0d8c10f 100644 --- a/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs +++ b/runtime/src/libraries/System.ObjectModel/tests/ReadOnlyObservableCollection/ReadOnlyObservableCollectionTests.cs @@ -290,10 +290,9 @@ public static void DebuggerAttribute_Tests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); int[] items = itemProperty.GetValue(info.Instance) as int[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Array.Enumerators.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Array.Enumerators.cs index e3f6ba77498..538201fe08d 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Array.Enumerators.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Array.Enumerators.cs @@ -49,7 +49,9 @@ public object? Current { if (index < 0) { - ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted(); + ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumNotStarted( + + ); } else { diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/XplatEventLogger.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/XplatEventLogger.cs index 56031d6aac5..cc7b60bf6b6 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/XplatEventLogger.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/XplatEventLogger.cs @@ -66,10 +66,9 @@ string payload '\"', '\\' }; - private static readonly Dictionary seq_mapping = new Dictionary< - char, - string - >() + private static readonly Dictionary seq_mapping = new Dictionary( + + ) { { '\b', "b" }, { '\f', "f" }, diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Progress.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Progress.cs index dc25f8a96b7..2110eb8c365 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Progress.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Progress.cs @@ -106,7 +106,8 @@ private void InvokeHandlers(object? state) internal static class ProgressStatics { /// A default synchronization context that targets the ThreadPool. - internal static readonly SynchronizationContext DefaultContext = - new SynchronizationContext(); + internal static readonly SynchronizationContext DefaultContext = new SynchronizationContext( + + ); } } diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs index 8463e6b907d..9758147c53a 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs @@ -45,8 +45,8 @@ public AssemblyDependencyResolver(string componentAssemblyPath) { // Setup error writer for this thread. This makes the hostpolicy redirect all error output // to the writer specified. Have to store the previous writer to set it back once this is done. - var errorWriter = new Interop.HostPolicy.corehost_error_writer_fn( - message => errorMessage.AppendLine(Marshal.PtrToStringAuto(message)) + var errorWriter = new Interop.HostPolicy.corehost_error_writer_fn(message => + errorMessage.AppendLine(Marshal.PtrToStringAuto(message)) ); IntPtr errorWriterPtr = Marshal.GetFunctionPointerForDelegate(errorWriter); diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs index 2d8ca42b516..a82ecf5c157 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyLoadContext.cs @@ -940,8 +940,9 @@ Func handler in dllResolveHandler.GetInvocationList() internal sealed class DefaultAssemblyLoadContext : AssemblyLoadContext { - internal static readonly AssemblyLoadContext s_loadContext = - new DefaultAssemblyLoadContext(); + internal static readonly AssemblyLoadContext s_loadContext = new DefaultAssemblyLoadContext( + + ); internal DefaultAssemblyLoadContext() : base(true, false, "Default") { } diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Text/DecoderExceptionFallback.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Text/DecoderExceptionFallback.cs index 6b5027dd30a..3c8d0ea7269 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Text/DecoderExceptionFallback.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Text/DecoderExceptionFallback.cs @@ -10,8 +10,9 @@ namespace System.Text { public sealed class DecoderExceptionFallback : DecoderFallback { - internal static readonly DecoderExceptionFallback s_default = - new DecoderExceptionFallback(); + internal static readonly DecoderExceptionFallback s_default = new DecoderExceptionFallback( + + ); public override DecoderFallbackBuffer CreateFallbackBuffer() => new DecoderExceptionFallbackBuffer(); diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs index ea43b72076a..bb7ac2b9cfc 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/PortableThreadPool.GateThread.cs @@ -132,7 +132,9 @@ private static void GateThreadStart() { NativeRuntimeEventSource.Log.ThreadPoolWorkingThreadCount( (uint) - threadPoolInstance.GetAndResetHighWatermarkCountOfThreadsProcessingUserCallbacks() + threadPoolInstance.GetAndResetHighWatermarkCountOfThreadsProcessingUserCallbacks( + + ) ); } diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs index 316ce1eafba..720f56a2943 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/Tasks/TaskScheduler.cs @@ -249,8 +249,9 @@ internal void InternalQueueTask(Task task) private static ConditionalWeakTable? s_activeTaskSchedulers; // An AppDomain-wide default manager. - private static readonly TaskScheduler s_defaultTaskScheduler = - new ThreadPoolTaskScheduler(); + private static readonly TaskScheduler s_defaultTaskScheduler = new ThreadPoolTaskScheduler( + + ); // static counter used to generate unique TaskScheduler IDs internal static int s_taskSchedulerIdCounter; diff --git a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs index 0ac972d5641..02ff3060448 100644 --- a/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs +++ b/runtime/src/libraries/System.Private.CoreLib/src/System/Threading/ThreadPool.Windows.cs @@ -82,7 +82,9 @@ internal static void IncrementCompletedWorkItemCount() => internal static object GetOrCreateThreadLocalCompletionCountObject() => ThreadPool.UseWindowsThreadPool ? WindowsThreadPool.GetOrCreateThreadLocalCompletionCountObject() - : PortableThreadPool.ThreadPoolInstance.GetOrCreateThreadLocalCompletionCountObject(); + : PortableThreadPool.ThreadPoolInstance.GetOrCreateThreadLocalCompletionCountObject( + + ); public static bool SetMaxThreads(int workerThreads, int completionPortThreads) => ThreadPool.UseWindowsThreadPool diff --git a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs index 04c3cf17779..f152f526ca2 100644 --- a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs +++ b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/DataContractSet.cs @@ -864,7 +864,9 @@ bool importXmlDataType { SchemaImporter importer = new SchemaImporter( schemaSet, - Array.Empty() /* Needs to be empty, not null for 'elements' to be used. */ + Array.Empty( + + ) /* Needs to be empty, not null for 'elements' to be used. */ , elements, this, diff --git a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs index fc3b8652804..7bc9a88cb44 100644 --- a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs +++ b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/Json/JsonCollectionDataContract.cs @@ -38,15 +38,15 @@ internal JsonFormatCollectionReaderDelegate JsonFormatReaderDelegate JsonFormatCollectionReaderDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = - new ReflectionJsonCollectionReader().ReflectionReadCollection; + tempDelegate = new ReflectionJsonCollectionReader( + + ).ReflectionReadCollection; } else { - tempDelegate = - new JsonFormatReaderGenerator().GenerateCollectionReader( - TraditionalCollectionDataContract - ); + tempDelegate = new JsonFormatReaderGenerator( + + ).GenerateCollectionReader(TraditionalCollectionDataContract); } Interlocked.MemoryBarrier(); @@ -93,15 +93,17 @@ internal JsonFormatGetOnlyCollectionReaderDelegate JsonFormatGetOnlyReaderDelega JsonFormatGetOnlyCollectionReaderDelegate tempDelegate; if (DataContractSerializer.Option == SerializationOption.ReflectionOnly) { - tempDelegate = - new ReflectionJsonCollectionReader().ReflectionReadGetOnlyCollection; + tempDelegate = new ReflectionJsonCollectionReader( + + ).ReflectionReadGetOnlyCollection; } else { - tempDelegate = - new JsonFormatReaderGenerator().GenerateGetOnlyCollectionReader( - TraditionalCollectionDataContract - ); + tempDelegate = new JsonFormatReaderGenerator( + + ).GenerateGetOnlyCollectionReader( + TraditionalCollectionDataContract + ); } Interlocked.MemoryBarrier(); @@ -132,10 +134,9 @@ internal JsonFormatCollectionWriterDelegate JsonFormatWriterDelegate } else { - tempDelegate = - new JsonFormatWriterGenerator().GenerateCollectionWriter( - TraditionalCollectionDataContract - ); + tempDelegate = new JsonFormatWriterGenerator( + + ).GenerateCollectionWriter(TraditionalCollectionDataContract); } Interlocked.MemoryBarrier(); diff --git a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/PrimitiveDataContract.cs b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/PrimitiveDataContract.cs index 4fb510a9763..c2187937b57 100644 --- a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/PrimitiveDataContract.cs +++ b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Runtime/Serialization/PrimitiveDataContract.cs @@ -16,8 +16,9 @@ internal abstract class PrimitiveDataContract : DataContract internal const string ContractTypeString = nameof(PrimitiveDataContract); public override string? ContractType => ContractTypeString; - internal static readonly PrimitiveDataContract NullContract = - new NullPrimitiveDataContract(); + internal static readonly PrimitiveDataContract NullContract = new NullPrimitiveDataContract( + + ); private readonly PrimitiveDataContractCriticalHelper _helper; diff --git a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Xml/ArrayHelper.cs b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Xml/ArrayHelper.cs index 62ccfc81806..3f8b6df2d57 100644 --- a/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Xml/ArrayHelper.cs +++ b/runtime/src/libraries/System.Private.DataContractSerialization/src/System/Xml/ArrayHelper.cs @@ -201,8 +201,9 @@ int count internal sealed class Int16ArrayHelperWithString : ArrayHelper { - public static readonly Int16ArrayHelperWithString Instance = - new Int16ArrayHelperWithString(); + public static readonly Int16ArrayHelperWithString Instance = new Int16ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, @@ -264,8 +265,9 @@ int count internal sealed class Int32ArrayHelperWithString : ArrayHelper { - public static readonly Int32ArrayHelperWithString Instance = - new Int32ArrayHelperWithString(); + public static readonly Int32ArrayHelperWithString Instance = new Int32ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, @@ -327,8 +329,9 @@ int count internal sealed class Int64ArrayHelperWithString : ArrayHelper { - public static readonly Int64ArrayHelperWithString Instance = - new Int64ArrayHelperWithString(); + public static readonly Int64ArrayHelperWithString Instance = new Int64ArrayHelperWithString( + + ); protected override int ReadArray( XmlDictionaryReader reader, diff --git a/runtime/src/libraries/System.Private.Xml.Linq/tests/TreeManipulation/XNodeSequenceRemove.cs b/runtime/src/libraries/System.Private.Xml.Linq/tests/TreeManipulation/XNodeSequenceRemove.cs index e5ff3b16657..9c4925ae645 100644 --- a/runtime/src/libraries/System.Private.Xml.Linq/tests/TreeManipulation/XNodeSequenceRemove.cs +++ b/runtime/src/libraries/System.Private.Xml.Linq/tests/TreeManipulation/XNodeSequenceRemove.cs @@ -1093,11 +1093,10 @@ private void VerifyDeleteNodes(IEnumerable toRemove) // Create array of parents IEnumerable parents = toRemove - .Select( - x => - (x == null) - ? (XContainer)null - : (x.Parent != null ? (XContainer)x.Parent : (XContainer)x.Document) + .Select(x => + (x == null) + ? (XContainer)null + : (x.Parent != null ? (XContainer)x.Parent : (XContainer)x.Document) ) .ToList(); diff --git a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs index 99606e3af43..b8295aa33cc 100644 --- a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs +++ b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Core/XsdValidatingReader.cs @@ -3094,8 +3094,9 @@ private void GetIsDefault() case XmlNodeType.EndElement: _atomicValue = _validator.ValidateEndElement(_xmlSchemaInfo); //?? pop namespaceManager scope - _originalAtomicValueString = - GetOriginalAtomicValueStringOfElement(); + _originalAtomicValueString = GetOriginalAtomicValueStringOfElement( + + ); if (_xmlSchemaInfo.IsDefault) { // The atomicValue returned is a default value diff --git a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdBuilder.cs b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdBuilder.cs index e0c9226d7b1..62422324fbc 100644 --- a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdBuilder.cs +++ b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Schema/XsdBuilder.cs @@ -2418,8 +2418,9 @@ private static void InitComplexContentExtension(XsdBuilder builder, string? valu { builder.SendValidationEvent(SR.Sch_ComplexContentContentModel, "extension"); } - builder._xso = builder._complexContentExtension = - new XmlSchemaComplexContentExtension(); + builder._xso = builder._complexContentExtension = new XmlSchemaComplexContentExtension( + + ); builder._complexContent.Content = builder._complexContentExtension; } diff --git a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs index 40e0e4b87b0..5f4f314f600 100644 --- a/runtime/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs +++ b/runtime/src/libraries/System.Private.Xml/src/System/Xml/Serialization/XmlSerializationReaderILGen.cs @@ -3058,11 +3058,15 @@ private void WriteMemberEnd(Member[] members, bool soapRefs) ilg.Call(XmlSerializationReader_ShrinkArray); ilg.ConvertValue( XmlSerializationReader_ShrinkArray.ReturnType, - member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType() + member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType( + + ) ); WriteSourceEnd( member.ChoiceSource!, - member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType() + member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType( + + ) ); } } diff --git a/runtime/src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/XPathParser.cs b/runtime/src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/XPathParser.cs index 0e7cdba140e..4208a8dafae 100644 --- a/runtime/src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/XPathParser.cs +++ b/runtime/src/libraries/System.Private.Xml/src/System/Xml/XPath/Internal/XPathParser.cs @@ -890,8 +890,9 @@ XPathResultType[] argTypes } } //ParamInfo - private static readonly Dictionary s_functionTable = - CreateFunctionTable(); + private static readonly Dictionary s_functionTable = CreateFunctionTable( + + ); private static Dictionary CreateFunctionTable() { diff --git a/runtime/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs b/runtime/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs index 1ae7da58781..1257f3dd77d 100644 --- a/runtime/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs +++ b/runtime/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs @@ -256,13 +256,12 @@ string SourcePath string systemUrlPrefix, string pathPrefix ) => - ids.Select( - x => - ( - x.PublicId, - systemUrlPrefix + x.RelativeId, - Path.Combine(pathPrefix, x.RelativeId) - ) + ids.Select(x => + ( + x.PublicId, + systemUrlPrefix + x.RelativeId, + Path.Combine(pathPrefix, x.RelativeId) + ) ); } diff --git a/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Assembly.cs b/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Assembly.cs index a70a962ef33..e20d9e41d1e 100644 --- a/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Assembly.cs +++ b/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_Assembly.cs @@ -27,35 +27,32 @@ public void GetCustomAttributes_thisAsm() Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_Single single", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_Single single", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple2", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple2", + StringComparison.Ordinal + ) ) ); } @@ -114,24 +111,22 @@ public void GetCustomAttributesExtension() Assert.Equal(2, attributes.Count()); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", + StringComparison.Ordinal + ) ) ); @@ -182,24 +177,22 @@ public void GetCustomAttributesOfT() Assert.Equal(2, attributes.Count()); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple1", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple multiple2", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple multiple2", + StringComparison.Ordinal + ) ) ); diff --git a/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_MemberInfo.cs b/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_MemberInfo.cs index cede3236438..be4d8dac68d 100644 --- a/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_MemberInfo.cs +++ b/runtime/src/libraries/System.Reflection.Extensions/tests/GetCustomAttributes_MemberInfo.cs @@ -207,46 +207,42 @@ public void GetCustomAttribute5() Assert.Equal(4, attributes.Count()); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_Single_M single", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_Single_M single", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple1", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple2", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple2", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multiple", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multiple", + StringComparison.Ordinal + ) ) ); } @@ -269,68 +265,62 @@ public void GetCustomAttributeAll() Assert.Equal(6, attributes.Count()); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_Single_M single", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_Single_M single", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple1", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple1", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple2", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_M multiple2", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_Single_Inherited singleBase", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_Single_Inherited singleBase", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multiple", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multiple", + StringComparison.Ordinal + ) ) ); Assert.Equal( 1, - attributes.Count( - attr => - attr.ToString() - .Equals( - "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multipleBase", - StringComparison.Ordinal - ) + attributes.Count(attr => + attr.ToString() + .Equals( + "System.Reflection.Tests.MyAttribute_AllowMultiple_Inherited multipleBase", + StringComparison.Ordinal + ) ) ); diff --git a/runtime/src/libraries/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs b/runtime/src/libraries/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs index d03c3468f98..0c6db88978b 100644 --- a/runtime/src/libraries/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs +++ b/runtime/src/libraries/System.Reflection.Metadata/tests/Metadata/MetadataReaderTests.cs @@ -1818,10 +1818,9 @@ private void ValidateNamespaceChildren( else { expChildren = allNamespaces - .Where( - ns => - ns.StartsWith(rootNamespaceName) - && ns.LastIndexOf('.') == rootNamespaceName.Length + .Where(ns => + ns.StartsWith(rootNamespaceName) + && ns.LastIndexOf('.') == rootNamespaceName.Length ) .ToList(); } @@ -4064,8 +4063,8 @@ public void MemberCollections_TypeMembers_MiddleTypeDef() var reader = GetMetadataReader(Misc.Members); var typeC = reader.GetTypeDefinition( reader - .TypeDefinitions.Where( - t => reader.GetString(reader.GetTypeDefinition(t).Name) == "C" + .TypeDefinitions.Where(t => + reader.GetString(reader.GetTypeDefinition(t).Name) == "C" ) .Single() ); diff --git a/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs b/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs index 3027f6866c2..7458ac1c345 100644 --- a/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs +++ b/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEBuilderTests.cs @@ -117,8 +117,8 @@ private static void WritePEImage( public static IEnumerable AllMachineTypes() { - return ((Machine[])Enum.GetValues(typeof(Machine))).Select( - m => new object[] { (object)m } + return ((Machine[])Enum.GetValues(typeof(Machine))).Select(m => + new object[] { (object)m } ); } @@ -712,8 +712,8 @@ out Blob mvidFixup FieldAttributes.Assembly, metadata.GetOrAddString("_bc"), metadata.GetOrAddBlob( - BuildSignature( - e => e.FieldSignature().Type(type: baseClassTypeDef, isValueType: false) + BuildSignature(e => + e.FieldSignature().Type(type: baseClassTypeDef, isValueType: false) ) ) ); @@ -741,10 +741,9 @@ out Blob mvidFixup MethodImplAttributes.IL, metadata.GetOrAddString("Foo"), metadata.GetOrAddBlob( - BuildSignature( - e => - e.MethodSignature(isInstanceMethod: true) - .Parameters(0, returnType => returnType.Void(), parameters => { }) + BuildSignature(e => + e.MethodSignature(isInstanceMethod: true) + .Parameters(0, returnType => returnType.Void(), parameters => { }) ) ), fooBodyOffset, diff --git a/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEHeadersTests.cs b/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEHeadersTests.cs index c576dfdc007..1fa5669c701 100644 --- a/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEHeadersTests.cs +++ b/runtime/src/libraries/System.Reflection.Metadata/tests/PortableExecutable/PEHeadersTests.cs @@ -109,9 +109,8 @@ public void Sections() ".s2 offset=0x400 rva=0x400 size=512", ".s3 offset=0x600 rva=0x600 size=512" }, - peHeaders.SectionHeaders.Select( - h => - $"{h.Name} offset=0x{h.PointerToRawData:x3} rva=0x{h.VirtualAddress:x3} size={h.SizeOfRawData}" + peHeaders.SectionHeaders.Select(h => + $"{h.Name} offset=0x{h.PointerToRawData:x3} rva=0x{h.VirtualAddress:x3} size={h.SizeOfRawData}" ) ); } diff --git a/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/MetadataLoadContext.CoreAssembly.cs b/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/MetadataLoadContext.CoreAssembly.cs index 35e0846bc97..fde39963e54 100644 --- a/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/MetadataLoadContext.CoreAssembly.cs +++ b/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/MetadataLoadContext.CoreAssembly.cs @@ -26,9 +26,9 @@ public sealed partial class MetadataLoadContext } else { - RoAssemblyName roAssemblyName = new AssemblyName( - coreAssemblyName - ).ToRoAssemblyName(); + RoAssemblyName roAssemblyName = new AssemblyName(coreAssemblyName).ToRoAssemblyName( + + ); _coreAssembly = TryResolveAssembly(roAssemblyName, out e); } diff --git a/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.cs b/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.cs index 098690db355..81459e059e1 100644 --- a/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.cs +++ b/runtime/src/libraries/System.Reflection.MetadataLoadContext/src/System/Reflection/TypeLoading/Assemblies/Ecma/EcmaAssembly.cs @@ -30,8 +30,9 @@ string location Debug.Assert(location != null); _location = location; - _neverAccessThisExceptThroughAssemblyDefinitionProperty = - reader.GetAssemblyDefinition(); + _neverAccessThisExceptThroughAssemblyDefinitionProperty = reader.GetAssemblyDefinition( + + ); _manifestModule = new EcmaModule(this, location, peReader, reader); } diff --git a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/TestUtils/TestUtils.cs b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/TestUtils/TestUtils.cs index 12022c30a80..749c5e387b4 100644 --- a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/TestUtils/TestUtils.cs +++ b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/TestUtils/TestUtils.cs @@ -17,8 +17,8 @@ internal static partial class TestUtils public static int GetMark(this MemberInfo m) { Type markAttributeType = typeof(MarkAttribute).Project(); - CustomAttributeData cad = m.CustomAttributes.Single( - ca => ca.AttributeType == markAttributeType + CustomAttributeData cad = m.CustomAttributes.Single(ca => + ca.AttributeType == markAttributeType ); return (int)(cad.ConstructorArguments[0].Value); } @@ -75,12 +75,12 @@ private static CustomAttributeData ProjectBackToRuntime(this CustomAttributeData ); Assert.NotNull(runtimeConstructor); - IList runtimeCats = cad.ConstructorArguments.Select( - ct => ct.ProjectBackToRuntime() + IList runtimeCats = cad.ConstructorArguments.Select(ct => + ct.ProjectBackToRuntime() ) .ToArray(); - IList runtimeCans = cad.NamedArguments.Select( - cn => cn.ProjectBackToRuntime() + IList runtimeCans = cad.NamedArguments.Select(cn => + cn.ProjectBackToRuntime() ) .ToArray(); @@ -254,8 +254,7 @@ public static void Dump(this CustomAttributeData cad, int indent = 0) } Console.WriteLine(si + "Named Arguments.........:"); foreach ( - CustomAttributeNamedArgument cna in cad.NamedArguments.OrderBy( - can => can.MemberName + CustomAttributeNamedArgument cna in cad.NamedArguments.OrderBy(can => can.MemberName ) ) { diff --git a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/DllImportTests.cs b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/DllImportTests.cs index 49b7edd7c33..c5f4d849a3c 100644 --- a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/DllImportTests.cs +++ b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/CustomAttributes/DllImportTests.cs @@ -31,8 +31,8 @@ public static void TestDllImportPseudoCustomAttribute() DllImportAttribute expected = runtimeMethods[ i ].GetCustomAttribute(); - CustomAttributeData cad = ecmaMethods[i].CustomAttributes.Single( - c => c.AttributeType.Name == nameof(DllImportAttribute) + CustomAttributeData cad = ecmaMethods[i].CustomAttributes.Single(c => + c.AttributeType.Name == nameof(DllImportAttribute) ); DllImportAttribute actual = cad.UnprojectAndInstantiate(); AssertEqual(expected, actual); @@ -63,8 +63,8 @@ MarshalAsAttribute expected TypeInfo ecmaType = typeof(MarshalAsHolders).Project().GetTypeInfo(); FieldInfo ecmaField = ecmaType.GetDeclaredField(fieldName); Assert.NotNull(ecmaField); - CustomAttributeData cad = ecmaField.CustomAttributes.Single( - c => c.AttributeType.Name == nameof(MarshalAsAttribute) + CustomAttributeData cad = ecmaField.CustomAttributes.Single(c => + c.AttributeType.Name == nameof(MarshalAsAttribute) ); MarshalAsAttribute actual = cad.UnprojectAndInstantiate(); AssertEqual(expected, actual); diff --git a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Field/FieldTests.cs b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Field/FieldTests.cs index 2e4c2cd4ce6..6130ef365db 100644 --- a/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Field/FieldTests.cs +++ b/runtime/src/libraries/System.Reflection.MetadataLoadContext/tests/src/Tests/Field/FieldTests.cs @@ -135,22 +135,21 @@ public static unsafe void TestLiteralFields1() ); { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.NotLiteral) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.NotLiteral) ); Assert.Throws(() => f.GetRawConstantValue()); } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.NotLiteralJustReadOnly) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.NotLiteralJustReadOnly) ); Assert.Throws(() => f.GetRawConstantValue()); } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitBool1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitBool1) ); object o = f.GetRawConstantValue(); Assert.True(o is bool); @@ -158,8 +157,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitBool2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitBool2) ); object o = f.GetRawConstantValue(); Assert.True(o is bool); @@ -167,8 +165,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar1) ); object o = f.GetRawConstantValue(); Assert.True(o is char); @@ -176,8 +173,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar2) ); object o = f.GetRawConstantValue(); Assert.True(o is char); @@ -185,8 +181,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar3) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitChar3) ); object o = f.GetRawConstantValue(); Assert.True(o is char); @@ -194,8 +189,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte1) ); object o = f.GetRawConstantValue(); Assert.True(o is byte); @@ -203,8 +197,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte2) ); object o = f.GetRawConstantValue(); Assert.True(o is byte); @@ -212,8 +205,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte3) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitByte3) ); object o = f.GetRawConstantValue(); Assert.True(o is byte); @@ -221,8 +213,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitSByte1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitSByte1) ); object o = f.GetRawConstantValue(); Assert.True(o is sbyte); @@ -230,8 +222,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitSByte2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitSByte2) ); object o = f.GetRawConstantValue(); Assert.True(o is sbyte); @@ -239,8 +231,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitSByte3) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitSByte3) ); object o = f.GetRawConstantValue(); Assert.True(o is sbyte); @@ -248,8 +240,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitShort1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitShort1) ); object o = f.GetRawConstantValue(); Assert.True(o is short); @@ -257,8 +249,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitShort2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitShort2) ); object o = f.GetRawConstantValue(); Assert.True(o is short); @@ -266,8 +258,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitShort3) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitShort3) ); object o = f.GetRawConstantValue(); Assert.True(o is short); @@ -275,8 +267,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUShort1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitUShort1) ); object o = f.GetRawConstantValue(); Assert.True(o is ushort); @@ -284,8 +276,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUShort2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitUShort2) ); object o = f.GetRawConstantValue(); Assert.True(o is ushort); @@ -293,8 +285,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUShort3) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitUShort3) ); object o = f.GetRawConstantValue(); Assert.True(o is ushort); @@ -302,8 +294,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt1) ); object o = f.GetRawConstantValue(); Assert.True(o is int); @@ -311,8 +302,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt2) ); object o = f.GetRawConstantValue(); Assert.True(o is int); @@ -320,8 +310,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt3) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitInt3) ); object o = f.GetRawConstantValue(); Assert.True(o is int); @@ -329,8 +318,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt1) ); object o = f.GetRawConstantValue(); Assert.True(o is uint); @@ -338,8 +326,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt2) ); object o = f.GetRawConstantValue(); Assert.True(o is uint); @@ -347,8 +334,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt3) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitUInt3) ); object o = f.GetRawConstantValue(); Assert.True(o is uint); @@ -356,8 +342,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong1) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong1) ); object o = f.GetRawConstantValue(); Assert.True(o is long); @@ -365,8 +350,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong2) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong2) ); object o = f.GetRawConstantValue(); Assert.True(o is long); @@ -374,8 +358,7 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong3) + FieldInfo f = fields.Single(f1 => f1.Name == nameof(ClassWithLiteralFields.LitLong3) ); object o = f.GetRawConstantValue(); Assert.True(o is long); @@ -383,8 +366,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitULong1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitULong1) ); object o = f.GetRawConstantValue(); Assert.True(o is ulong); @@ -392,8 +375,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitULong2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitULong2) ); object o = f.GetRawConstantValue(); Assert.True(o is ulong); @@ -401,8 +384,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitULong3) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitULong3) ); object o = f.GetRawConstantValue(); Assert.True(o is ulong); @@ -410,8 +393,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitSingle1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitSingle1) ); object o = f.GetRawConstantValue(); Assert.True(o is float); @@ -419,8 +402,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitSingle2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitSingle2) ); object o = f.GetRawConstantValue(); Assert.True(o is float); @@ -428,8 +411,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitDouble1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitDouble1) ); object o = f.GetRawConstantValue(); Assert.True(o is double); @@ -437,8 +420,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitDouble2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitDouble2) ); object o = f.GetRawConstantValue(); Assert.True(o is double); @@ -446,8 +429,8 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitString1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitString1) ); object o = f.GetRawConstantValue(); Assert.True(o is string); @@ -455,24 +438,24 @@ public static unsafe void TestLiteralFields1() } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitString2) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitString2) ); object o = f.GetRawConstantValue(); Assert.True(o == null); } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitObject) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitObject) ); object o = f.GetRawConstantValue(); Assert.True(o == null); } { - FieldInfo f = fields.Single( - f1 => f1.Name == nameof(ClassWithLiteralFields.LitMyColor1) + FieldInfo f = fields.Single(f1 => + f1.Name == nameof(ClassWithLiteralFields.LitMyColor1) ); object o = f.GetRawConstantValue(); Assert.True(o is int); diff --git a/runtime/src/libraries/System.Reflection/tests/MethodInfoTests.cs b/runtime/src/libraries/System.Reflection/tests/MethodInfoTests.cs index 7a3fbcd08a4..9f6731db529 100644 --- a/runtime/src/libraries/System.Reflection/tests/MethodInfoTests.cs +++ b/runtime/src/libraries/System.Reflection/tests/MethodInfoTests.cs @@ -209,8 +209,9 @@ public void CreateDelegate_ValueTypeParameters() ); Assert.Equal(testClass.PublicStructMethod(new DateTime()), returnValue); - Delegate genMethodDelegate = - miPublicStructMethod.CreateDelegate(); + Delegate genMethodDelegate = miPublicStructMethod.CreateDelegate( + + ); object genReturnValue = genMethodDelegate.DynamicInvoke( new object[] { testClass, null } ); @@ -319,8 +320,8 @@ Type exceptionType public void CustomAttributes(Type type, string expectedToString) { MethodInfo methodInfo = GetMethod(typeof(MI_SubClass), "MethodWithAttributes"); - CustomAttributeData attributeData = methodInfo.CustomAttributes.First( - attribute => attribute.AttributeType.Equals(type) + CustomAttributeData attributeData = methodInfo.CustomAttributes.First(attribute => + attribute.AttributeType.Equals(type) ); Assert.Equal(expectedToString, attributeData.ToString()); } diff --git a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs index c84930cd698..e949f0fc024 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSExportCodeGenerator.cs @@ -72,8 +72,8 @@ is JSMarshallingInfo (_, JSTaskTypeInfo) ) { - BoundGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault( - m => m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo) + BoundGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault(m => + m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo) ); if (spanArg != default) { @@ -285,12 +285,8 @@ private ArgumentSyntax CreateSignaturesSyntax() var types = ((IJSMarshallingGenerator)_marshallers.ManagedReturnMarshaller.Generator) .GenerateBind(_marshallers.ManagedReturnMarshaller.TypeInfo, _context) .Concat( - _marshallers.NativeParameterMarshallers.SelectMany( - p => - ((IJSMarshallingGenerator)p.Generator).GenerateBind( - p.TypeInfo, - _context - ) + _marshallers.NativeParameterMarshallers.SelectMany(p => + ((IJSMarshallingGenerator)p.Generator).GenerateBind(p.TypeInfo, _context) ) ); diff --git a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs index ae8bbc93288..8dc38b846e4 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSImportCodeGenerator.cs @@ -79,8 +79,8 @@ is JSMarshallingInfo (_, JSTaskTypeInfo) ) { - BoundGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault( - m => m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo) + BoundGenerator spanArg = _marshallers.SignatureMarshallers.FirstOrDefault(m => + m.TypeInfo.MarshallingAttributeInfo is JSMarshallingInfo(_, JSSpanTypeInfo) ); if (spanArg != default) { @@ -269,12 +269,8 @@ private ArgumentSyntax CreateSignaturesSyntax() var types = ((IJSMarshallingGenerator)_marshallers.ManagedReturnMarshaller.Generator) .GenerateBind(_marshallers.ManagedReturnMarshaller.TypeInfo, _context) .Concat( - _marshallers.NativeParameterMarshallers.SelectMany( - p => - ((IJSMarshallingGenerator)p.Generator).GenerateBind( - p.TypeInfo, - _context - ) + _marshallers.NativeParameterMarshallers.SelectMany(p => + ((IJSMarshallingGenerator)p.Generator).GenerateBind(p.TypeInfo, _context) ) ); diff --git a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSManagedTypeInfo.cs b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSManagedTypeInfo.cs index 54a9c31d8f6..ba614e7b198 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSManagedTypeInfo.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices.JavaScript/gen/JSImportGenerator/JSManagedTypeInfo.cs @@ -198,8 +198,8 @@ is JSSimpleTypeInfo gti case INamedTypeSymbol actionType when fullTypeName.StartsWith(Constants.ActionGlobal, StringComparison.Ordinal): var argumentTypes = actionType - .TypeArguments.Select( - arg => CreateJSTypeInfoForTypeSymbol(arg) as JSSimpleTypeInfo + .TypeArguments.Select(arg => + CreateJSTypeInfoForTypeSymbol(arg) as JSSimpleTypeInfo ) .ToArray(); if (argumentTypes.Any(x => x is null)) @@ -212,8 +212,8 @@ when fullTypeName.StartsWith(Constants.ActionGlobal, StringComparison.Ordinal): case INamedTypeSymbol funcType when fullTypeName.StartsWith(Constants.FuncGlobal, StringComparison.Ordinal): var signatureTypes = funcType - .TypeArguments.Select( - argName => CreateJSTypeInfoForTypeSymbol(argName) as JSSimpleTypeInfo + .TypeArguments.Select(argName => + CreateJSTypeInfoForTypeSymbol(argName) as JSSimpleTypeInfo ) .ToArray(); if (signatureTypes.Any(x => x is null)) diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/ConvertComImportToGeneratedComInterfaceAnalyzer.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/ConvertComImportToGeneratedComInterfaceAnalyzer.cs index 2e41cd3897a..893f2df9c9a 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/ConvertComImportToGeneratedComInterfaceAnalyzer.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/Analyzers/ConvertComImportToGeneratedComInterfaceAnalyzer.cs @@ -59,12 +59,11 @@ public override void Initialize(AnalysisContext context) { INamedTypeSymbol type = (INamedTypeSymbol)context.Symbol; AttributeData? interfaceTypeAttributeData = type.GetAttributes() - .FirstOrDefault( - a => - a.AttributeClass.Equals( - interfaceTypeAttribute, - SymbolEqualityComparer.Default - ) + .FirstOrDefault(a => + a.AttributeClass.Equals( + interfaceTypeAttribute, + SymbolEqualityComparer.Default + ) ); if ( type is not { TypeKind: TypeKind.Interface, IsComImport: true } @@ -108,10 +107,9 @@ var method in type.GetMembers() typeof(FxResources.Microsoft.Interop.ComInterfaceGenerator.SR) ); AttributeData comImportAttribute = type.GetAttributes() - .First( - attr => - attr.AttributeClass.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_ComImportAttribute + .First(attr => + attr.AttributeClass.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_ComImportAttribute ); SignatureContext targetSignatureContext = SignatureContext.Create( method, @@ -220,8 +218,8 @@ info.MarshallingAttributeInfo is TrackedMarshallingInfo out var generatorDiagnostics ); - mayRequireAdditionalWork |= generatorDiagnostics.Any( - diag => diag.IsFatal + mayRequireAdditionalWork |= generatorDiagnostics.Any(diag => + diag.IsFatal ); if (anyExplicitlyUnsupportedInfo) diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs index b3972c9604b..d8a69014a10 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/ComInterfaceGenerator.cs @@ -172,8 +172,8 @@ IMethodSymbol Symbol (data, ct) => data.DeclaredMethods.SelectMany(m => m.ManagedToUnmanagedStub.Diagnostics) .Union( - data.DeclaredMethods.SelectMany( - m => m.UnmanagedToManagedStub.Diagnostics + data.DeclaredMethods.SelectMany(m => + m.UnmanagedToManagedStub.Diagnostics ) ) ) @@ -494,8 +494,8 @@ or EnumTypeInfo // that is defined as a structure. These types used to work with built-in COM interop, but they do not work with // source-generated interop as we now use the MemberFunction calling convention, which is more correct. TypePositionInfo? managedReturnInfo = - signatureContext.ElementTypeInformation.FirstOrDefault( - e => e.IsManagedReturnPosition + signatureContext.ElementTypeInformation.FirstOrDefault(e => + e.IsManagedReturnPosition ); if ( managedReturnInfo @@ -662,20 +662,19 @@ CancellationToken _ { var definingType = interfaceGroup.Interface.Info.Type; var shadowImplementations = interfaceGroup - .ShadowingMethods.Select( - m => (Method: m, ManagedToUnmanagedStub: m.ManagedToUnmanagedStub) + .ShadowingMethods.Select(m => + (Method: m, ManagedToUnmanagedStub: m.ManagedToUnmanagedStub) ) .Where(p => p.ManagedToUnmanagedStub is GeneratedStubCodeContext) - .Select( - ctx => - ( - (GeneratedStubCodeContext)ctx.ManagedToUnmanagedStub - ).Stub.Node.WithExplicitInterfaceSpecifier( - ExplicitInterfaceSpecifier(ParseName(definingType.FullTypeName)) - ) + .Select(ctx => + ( + (GeneratedStubCodeContext)ctx.ManagedToUnmanagedStub + ).Stub.Node.WithExplicitInterfaceSpecifier( + ExplicitInterfaceSpecifier(ParseName(definingType.FullTypeName)) + ) ); - var inheritedStubs = interfaceGroup.ShadowingMethods.Select( - m => m.UnreachableExceptionStub + var inheritedStubs = interfaceGroup.ShadowingMethods.Select(m => + m.UnreachableExceptionStub ); return ImplementationInterfaceTemplate .AddBaseListTypes(SimpleBaseType(definingType.Syntax)) @@ -710,12 +709,10 @@ CancellationToken _ comInterfaceAndMethods .DeclaredMethods.Select(m => m.UnmanagedToManagedStub) .OfType() - .Where( - context => - context.Diagnostics.All( - diag => - diag.Descriptor.DefaultSeverity != DiagnosticSeverity.Error - ) + .Where(context => + context.Diagnostics.All(diag => + diag.Descriptor.DefaultSeverity != DiagnosticSeverity.Error + ) ) .Select(context => context.Stub.Node) ) @@ -876,12 +873,10 @@ CancellationToken _ var vtableSlotAssignments = VirtualMethodPointerStubGenerator.GenerateVirtualMethodTableSlotAssignments( interfaceMethods - .DeclaredMethods.Where( - context => - context.UnmanagedToManagedStub.Diagnostics.All( - diag => - diag.Descriptor.DefaultSeverity != DiagnosticSeverity.Error - ) + .DeclaredMethods.Where(context => + context.UnmanagedToManagedStub.Diagnostics.All(diag => + diag.Descriptor.DefaultSeverity != DiagnosticSeverity.Error + ) ) .Select(context => context.GenerationContext), vtableLocalName, diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/VirtualMethodPointerStubGenerator.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/VirtualMethodPointerStubGenerator.cs index 1ffdee7d3b9..4aad89db64d 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/VirtualMethodPointerStubGenerator.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/ComInterfaceGenerator/VirtualMethodPointerStubGenerator.cs @@ -140,13 +140,10 @@ public static ( InitializerExpression( SyntaxKind.CollectionInitializerExpression, SeparatedList( - methodStub.CallingConvention.Array.Select( - callConv => - TypeOfExpression( - TypeSyntaxes.CallConv( - callConv.Name.ValueText - ) - ) + methodStub.CallingConvention.Array.Select(callConv => + TypeOfExpression( + TypeSyntaxes.CallConv(callConv.Name.ValueText) + ) ) ) ) diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/Common/ConvertToSourceGeneratedInteropFixer.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/Common/ConvertToSourceGeneratedInteropFixer.cs index 6d0d1ac7162..fdd5ec4975f 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/Common/ConvertToSourceGeneratedInteropFixer.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/Common/ConvertToSourceGeneratedInteropFixer.cs @@ -336,10 +336,9 @@ string unmanagedTypeMemberIdentifier parameter.Type.SpecialType == SpecialType.System_Boolean && !parameter .GetAttributes() - .Any( - attr => - attr.AttributeClass?.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute + .Any(attr => + attr.AttributeClass?.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute ) ) { @@ -364,10 +363,9 @@ string unmanagedTypeMemberIdentifier methodSymbol.ReturnType.SpecialType == SpecialType.System_Boolean && !methodSymbol .GetReturnTypeAttributes() - .Any( - attr => - attr.AttributeClass?.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute + .Any(attr => + attr.AttributeClass?.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute ) ) { @@ -410,10 +408,9 @@ SyntaxNode generatedDeclaration && IsHResultLikeType(methodSymbol.ReturnType) && !methodSymbol .GetReturnTypeAttributes() - .Any( - attr => - attr.AttributeClass?.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute + .Any(attr => + attr.AttributeClass?.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_MarshalAsAttribute ) ) { diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportAnalyzer.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportAnalyzer.cs index a12292e2940..a8f06eb231e 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportAnalyzer.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ConvertToLibraryImportAnalyzer.cs @@ -59,7 +59,9 @@ public override void Initialize(AnalysisContext context) return; TargetFrameworkSettings targetFramework = - context.Options.AnalyzerConfigOptionsProvider.GlobalOptions.GetTargetFrameworkSettings(); + context.Options.AnalyzerConfigOptionsProvider.GlobalOptions.GetTargetFrameworkSettings( + + ); StubEnvironment env = new StubEnvironment( context.Compilation, @@ -139,8 +141,7 @@ TargetFrameworkSettings tf ); AttributeData dllImportAttribute = method .GetAttributes() - .First( - attr => attr.AttributeClass.ToDisplayString() == TypeNames.DllImportAttribute + .First(attr => attr.AttributeClass.ToDisplayString() == TypeNames.DllImportAttribute ); SignatureContext targetSignatureContext = SignatureContext.Create( method, @@ -231,10 +232,9 @@ private static bool IsBestFitMapping(IMethodSymbol method, DllImportData? dllImp AttributeData? bestFitMappingContainingType = method .ContainingType.GetAttributes() - .FirstOrDefault( - attr => - attr.AttributeClass.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute + .FirstOrDefault(attr => + attr.AttributeClass.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute ); if (bestFitMappingContainingType is not null) { @@ -243,10 +243,9 @@ private static bool IsBestFitMapping(IMethodSymbol method, DllImportData? dllImp AttributeData? bestFitMappingContainingAssembly = method .ContainingAssembly.GetAttributes() - .FirstOrDefault( - attr => - attr.AttributeClass.ToDisplayString() - == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute + .FirstOrDefault(attr => + attr.AttributeClass.ToDisplayString() + == TypeNames.System_Runtime_InteropServices_BestFitMappingAttribute ); if (bestFitMappingContainingAssembly is not null) { diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs index b7f0562f768..2fddf3c0cca 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/CustomMarshallerAttributeAnalyzer.cs @@ -1534,14 +1534,13 @@ IMethodSymbol callerAllocatedBufferMethod marshallerType .GetMembers(ShapeMemberNames.BufferSize) .OfType() - .FirstOrDefault( - prop => - prop - is { - ReturnsByRef: false, - ReturnsByRefReadonly: false, - GetMethod: not null - } + .FirstOrDefault(prop => + prop + is { + ReturnsByRef: false, + ReturnsByRefReadonly: false, + GetMethod: not null + } ) is null ) diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ShapeBreakingDiagnosticSuppressor.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ShapeBreakingDiagnosticSuppressor.cs index 5754f3b9248..4606abcd35a 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ShapeBreakingDiagnosticSuppressor.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/LibraryImportGenerator/Analyzers/ShapeBreakingDiagnosticSuppressor.cs @@ -94,24 +94,23 @@ INamedTypeSymbol ManagedType { AttributeData? attrData = containingType .GetAttributes() - .FirstOrDefault( - attr => - attr.AttributeClass?.ToDisplayString() - == TypeNames.CustomMarshallerAttribute - && attr.AttributeConstructor is not null - && !attr.ConstructorArguments[0].IsNull - && attr.ConstructorArguments[2].Value - is INamedTypeSymbol marshallerTypeInAttribute - && ManualTypeMarshallingHelper.TryResolveMarshallerType( - containingType, - marshallerTypeInAttribute, - (_, _) => { }, - out ITypeSymbol constructedMarshallerType - ) - && SymbolEqualityComparer.Default.Equals( - constructedMarshallerType, - marshallerType - ) + .FirstOrDefault(attr => + attr.AttributeClass?.ToDisplayString() + == TypeNames.CustomMarshallerAttribute + && attr.AttributeConstructor is not null + && !attr.ConstructorArguments[0].IsNull + && attr.ConstructorArguments[2].Value + is INamedTypeSymbol marshallerTypeInAttribute + && ManualTypeMarshallingHelper.TryResolveMarshallerType( + containingType, + marshallerTypeInAttribute, + (_, _) => { }, + out ITypeSymbol constructedMarshallerType + ) + && SymbolEqualityComparer.Default.Equals( + constructedMarshallerType, + marshallerType + ) ); if (attrData is not null) { diff --git a/runtime/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallerShape.cs b/runtime/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallerShape.cs index ee817595504..aebbec7dce7 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallerShape.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/gen/Microsoft.Interop.SourceGeneration/MarshallerShape.cs @@ -274,8 +274,8 @@ Compilation compilation // static void Free(TNative unmanaged) return type.GetMembers(ShapeMemberNames.Free) .OfType() - .FirstOrDefault( - m => m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: true } + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: true } ); } @@ -289,12 +289,11 @@ ITypeSymbol managedType // static ref readonly TOther GetPinnableReference(TManaged managed) return type.GetMembers(ShapeMemberNames.GetPinnableReference) .OfType() - .FirstOrDefault( - m => - m - is { IsStatic: true, Parameters.Length: 1 } - and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) - && SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, managedType) + .FirstOrDefault(m => + m + is { IsStatic: true, Parameters.Length: 1 } + and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) + && SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, managedType) ); } @@ -351,13 +350,9 @@ ITypeSymbol managedType // static TNative ConvertToUnmanaged(TManaged managed) return type.GetMembers(ShapeMemberNames.Value.Stateless.ConvertToUnmanaged) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } - && SymbolEqualityComparer.Default.Equals( - managedType, - m.Parameters[0].Type - ) + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } + && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) ); } @@ -372,13 +367,9 @@ ITypeSymbol spanOfT ShapeMemberNames.Value.Stateless.ConvertToUnmanaged ) .OfType() - .Where( - m => - m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } - && SymbolEqualityComparer.Default.Equals( - managedType, - m.Parameters[0].Type - ) + .Where(m => + m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } + && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) ); foreach (IMethodSymbol method in methods) @@ -400,10 +391,9 @@ ITypeSymbol managedType // static TManaged ConvertToManaged(TNative unmanaged) return type.GetMembers(ShapeMemberNames.Value.Stateless.ConvertToManaged) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } - && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } + && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) ); } @@ -415,10 +405,9 @@ ITypeSymbol managedType // static TManaged ConvertToManagedFinally(TNative unmanaged) return type.GetMembers(ShapeMemberNames.Value.Stateless.ConvertToManagedFinally) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } - && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 1, ReturnsVoid: false } + && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) ); } } @@ -438,12 +427,11 @@ ITypeSymbol managedType .AllocateContainerForUnmanagedElements ) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } - && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) - && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 - && m.Parameters[1].RefKind == RefKind.Out + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } + && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) + && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 + && m.Parameters[1].RefKind == RefKind.Out ); } @@ -461,12 +449,11 @@ ITypeSymbol spanOfT .AllocateContainerForUnmanagedElements ) .OfType() - .Where( - m => - m is { IsStatic: true, Parameters.Length: 3, ReturnsVoid: false } - && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) - && m.Parameters[2].Type.SpecialType == SpecialType.System_Int32 - && m.Parameters[2].RefKind == RefKind.Out + .Where(m => + m is { IsStatic: true, Parameters.Length: 3, ReturnsVoid: false } + && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) + && m.Parameters[2].Type.SpecialType == SpecialType.System_Int32 + && m.Parameters[2].RefKind == RefKind.Out ); foreach (IMethodSymbol method in methods) @@ -491,20 +478,19 @@ ITypeSymbol readOnlySpanOfT ShapeMemberNames.LinearCollection.Stateless.GetManagedValuesSource ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: true, - Parameters.Length: 1, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) - && SymbolEqualityComparer.Default.Equals( - readOnlySpanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: true, + Parameters.Length: 1, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) + && SymbolEqualityComparer.Default.Equals( + readOnlySpanOfT, + returnType.ConstructedFrom + ) ); } @@ -518,20 +504,19 @@ ITypeSymbol spanOfT ShapeMemberNames.LinearCollection.Stateless.GetUnmanagedValuesDestination ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: true, - Parameters.Length: 2, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 - && SymbolEqualityComparer.Default.Equals( - spanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: true, + Parameters.Length: 2, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 + && SymbolEqualityComparer.Default.Equals( + spanOfT, + returnType.ConstructedFrom + ) ); } @@ -548,11 +533,10 @@ ITypeSymbol managedType .AllocateContainerForManagedElements ) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } - && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 - && managedType.IsConstructedFromEqualTypes(m.ReturnType) + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } + && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 + && managedType.IsConstructedFromEqualTypes(m.ReturnType) ); } @@ -569,11 +553,10 @@ ITypeSymbol managedType .AllocateContainerForManagedElementsFinally ) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } - && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 - && managedType.IsConstructedFromEqualTypes(m.ReturnType) + .FirstOrDefault(m => + m is { IsStatic: true, Parameters.Length: 2, ReturnsVoid: false } + && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 + && managedType.IsConstructedFromEqualTypes(m.ReturnType) ); } @@ -588,20 +571,19 @@ ITypeSymbol spanOfT ShapeMemberNames.LinearCollection.Stateless.GetManagedValuesDestination ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: true, - Parameters.Length: 1, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) - && SymbolEqualityComparer.Default.Equals( - spanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: true, + Parameters.Length: 1, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && managedType.IsConstructedFromEqualTypes(m.Parameters[0].Type) + && SymbolEqualityComparer.Default.Equals( + spanOfT, + returnType.ConstructedFrom + ) ); } @@ -615,20 +597,19 @@ ITypeSymbol readOnlySpanOfT ShapeMemberNames.LinearCollection.Stateless.GetUnmanagedValuesSource ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: true, - Parameters.Length: 2, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 - && SymbolEqualityComparer.Default.Equals( - readOnlySpanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: true, + Parameters.Length: 2, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && m.Parameters[1].Type.SpecialType == SpecialType.System_Int32 + && SymbolEqualityComparer.Default.Equals( + readOnlySpanOfT, + returnType.ConstructedFrom + ) ); } } @@ -844,10 +825,9 @@ ITypeSymbol managedType { return type.GetMembers(ShapeMemberNames.Value.Stateful.FromManaged) .OfType() - .FirstOrDefault( - m => - m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: true } - && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) + .FirstOrDefault(m => + m is { IsStatic: false, Parameters.Length: 1, ReturnsVoid: true } + && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) ); } @@ -861,10 +841,9 @@ ITypeSymbol spanOfT ShapeMemberNames.Value.Stateful.FromManaged ) .OfType() - .Where( - m => - m is { IsStatic: false, Parameters.Length: 2, ReturnsVoid: true } - && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) + .Where(m => + m is { IsStatic: false, Parameters.Length: 2, ReturnsVoid: true } + && SymbolEqualityComparer.Default.Equals(managedType, m.Parameters[0].Type) ); foreach (IMethodSymbol method in methods) @@ -888,17 +867,16 @@ ITypeSymbol spanOfT { return type.GetMembers(ShapeMemberNames.Value.Stateful.ToManaged) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 0, - ReturnsVoid: false, - ReturnsByRef: false, - ReturnsByRefReadonly: false - } - && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 0, + ReturnsVoid: false, + ReturnsByRef: false, + ReturnsByRefReadonly: false + } + && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) ); } @@ -909,17 +887,16 @@ ITypeSymbol managedType { return type.GetMembers(ShapeMemberNames.Value.Stateful.ToManagedFinally) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 0, - ReturnsVoid: false, - ReturnsByRef: false, - ReturnsByRefReadonly: false - } - && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 0, + ReturnsVoid: false, + ReturnsByRef: false, + ReturnsByRefReadonly: false + } + && SymbolEqualityComparer.Default.Equals(managedType, m.ReturnType) ); } @@ -927,16 +904,15 @@ ITypeSymbol managedType { return type.GetMembers(ShapeMemberNames.Value.Stateful.ToUnmanaged) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 0, - ReturnsVoid: false, - ReturnsByRef: false, - ReturnsByRefReadonly: false - } + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 0, + ReturnsVoid: false, + ReturnsByRef: false, + ReturnsByRefReadonly: false + } ); } @@ -993,8 +969,8 @@ ITypeSymbol type { return type.GetMembers(ShapeMemberNames.Value.Stateful.Free) .OfType() - .FirstOrDefault( - m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true } + .FirstOrDefault(m => + m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true } ); } @@ -1002,8 +978,8 @@ ITypeSymbol type { return type.GetMembers(ShapeMemberNames.Value.Stateful.OnInvoked) .OfType() - .FirstOrDefault( - m => m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true } + .FirstOrDefault(m => + m is { IsStatic: false, Parameters.Length: 0, ReturnsVoid: true } ); } @@ -1014,12 +990,11 @@ ITypeSymbol managedType { return type.GetMembers(ShapeMemberNames.GetPinnableReference) .OfType() - .FirstOrDefault( - m => - m - is { IsStatic: true, Parameters.Length: 1 } - and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) - && SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, managedType) + .FirstOrDefault(m => + m + is { IsStatic: true, Parameters.Length: 1 } + and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) + && SymbolEqualityComparer.Default.Equals(m.Parameters[0].Type, managedType) ); } @@ -1027,11 +1002,10 @@ ITypeSymbol managedType { return type.GetMembers(ShapeMemberNames.GetPinnableReference) .OfType() - .FirstOrDefault( - m => - m - is { IsStatic: false, Parameters.Length: 0 } - and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) + .FirstOrDefault(m => + m + is { IsStatic: false, Parameters.Length: 0 } + and ({ ReturnsByRef: true } or { ReturnsByRefReadonly: true }) ); } @@ -1047,19 +1021,18 @@ ITypeSymbol readOnlySpanOfT ShapeMemberNames.LinearCollection.Stateful.GetManagedValuesSource ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 0, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && SymbolEqualityComparer.Default.Equals( - readOnlySpanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 0, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && SymbolEqualityComparer.Default.Equals( + readOnlySpanOfT, + returnType.ConstructedFrom + ) ); } @@ -1073,19 +1046,18 @@ ITypeSymbol spanOfT ShapeMemberNames.LinearCollection.Stateful.GetUnmanagedValuesDestination ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 0, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && SymbolEqualityComparer.Default.Equals( - spanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 0, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && SymbolEqualityComparer.Default.Equals( + spanOfT, + returnType.ConstructedFrom + ) ); } @@ -1099,20 +1071,19 @@ ITypeSymbol spanOfT ShapeMemberNames.LinearCollection.Stateful.GetManagedValuesDestination ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 1, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && m.Parameters[0].Type.SpecialType == SpecialType.System_Int32 - && SymbolEqualityComparer.Default.Equals( - spanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 1, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && m.Parameters[0].Type.SpecialType == SpecialType.System_Int32 + && SymbolEqualityComparer.Default.Equals( + spanOfT, + returnType.ConstructedFrom + ) ); } @@ -1126,20 +1097,19 @@ ITypeSymbol readOnlySpanOfT ShapeMemberNames.LinearCollection.Stateful.GetUnmanagedValuesSource ) .OfType() - .FirstOrDefault( - m => - m - is { - IsStatic: false, - Parameters.Length: 1, - ReturnsVoid: false, - ReturnType: INamedTypeSymbol returnType - } - && m.Parameters[0].Type.SpecialType == SpecialType.System_Int32 - && SymbolEqualityComparer.Default.Equals( - readOnlySpanOfT, - returnType.ConstructedFrom - ) + .FirstOrDefault(m => + m + is { + IsStatic: false, + Parameters.Length: 1, + ReturnsVoid: false, + ReturnType: INamedTypeSymbol returnType + } + && m.Parameters[0].Type.SpecialType == SpecialType.System_Int32 + && SymbolEqualityComparer.Default.Equals( + readOnlySpanOfT, + returnType.ConstructedFrom + ) ); } } diff --git a/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGeneratorOutputShape.cs b/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGeneratorOutputShape.cs index 8d1cd4ccd52..cab58436640 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGeneratorOutputShape.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/ComInterfaceGeneratorOutputShape.cs @@ -276,10 +276,8 @@ static void VerifyCompilation(Compilation comp) .Where(m => m.Kind == SymbolKind.Method && m.Name == "Bar") .SingleOrDefault() ?.GetAttributes() - .Any( - att => - att.AttributeClass?.Name - == nameof(RequiresUnreferencedCodeAttribute) + .Any(att => + att.AttributeClass?.Name == nameof(RequiresUnreferencedCodeAttribute) ) ); } diff --git a/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs b/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs index 1625592d689..ad515202487 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/tests/ComInterfaceGenerator.Unit.Tests/Compiles.cs @@ -634,132 +634,184 @@ public static IEnumerable CustomCollections(GeneratorKind generator) yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerReturnValueLength() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.CustomMarshallerReturnValueLength( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateless.NestedMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateless.NestedMarshallerParametersAndModifiers( + + ) }; yield return new[] { @@ -778,127 +830,177 @@ public static IEnumerable CustomCollections(GeneratorKind generator) yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.DefaultMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerParametersAndModifiers( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerReturnValueLength() + customCollectionMarshallingCodeSnippetsBidirectional.Stateful.CustomMarshallerReturnValueLength( + + ) }; yield return new[] { @@ -940,7 +1042,9 @@ GeneratorKind generator yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue( + + ) }; yield return new[] { @@ -970,77 +1074,107 @@ GeneratorKind generator yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValue( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.ByValueWithPinning( + + ) }; yield return new[] { @@ -1100,197 +1234,275 @@ GeneratorKind generator yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValue( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueCallerAllocatedBuffer( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.ByValueWithStaticPinning( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.NativeToManagedOnlyOutParameter() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.NativeToManagedOnlyOutParameter( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.NativeToManagedOnlyReturnValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateless.NativeToManagedOnlyReturnValue( + + ) }; yield return new[] { @@ -1316,12 +1528,16 @@ GeneratorKind generator yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.NativeToManagedOnlyOutParameter() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.NativeToManagedOnlyOutParameter( + + ) }; yield return new[] { ID(), - customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.NativeToManagedOnlyReturnValue() + customCollectionMarshallingCodeSnippetsManagedToUnmanaged.Stateful.NativeToManagedOnlyReturnValue( + + ) }; yield return new[] { diff --git a/runtime/src/libraries/System.Runtime.InteropServices/tests/Common/TestUtils.cs b/runtime/src/libraries/System.Runtime.InteropServices/tests/Common/TestUtils.cs index cbf387f712a..210078fc7f4 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/tests/Common/TestUtils.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/tests/Common/TestUtils.cs @@ -197,15 +197,14 @@ public static Task CreateCompilation( { return CreateCompilation( sources - .Select( - source => - CSharpSyntaxTree.ParseText( - source, - new CSharpParseOptions( - LanguageVersion.Preview, - preprocessorSymbols: preprocessorSymbols - ) + .Select(source => + CSharpSyntaxTree.ParseText( + source, + new CSharpParseOptions( + LanguageVersion.Preview, + preprocessorSymbols: preprocessorSymbols ) + ) ) .ToArray(), targetFramework, diff --git a/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionMarshallingFails.cs b/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionMarshallingFails.cs index 1ba14057774..4f12f9099e1 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionMarshallingFails.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.Tests/CollectionMarshallingFails.cs @@ -235,37 +235,28 @@ public void MultidimensionalArray_CheckInnerArraysAreCleared() public void SingleDimensionalOutArray_EnsureAllCleaned() { BoolStruct[] arr = new BoolStruct[10] - .Select( - _ => - new BoolStruct() - { - b1 = true, - b2 = true, - b3 = false - } - ) + .Select(_ => new BoolStruct() + { + b1 = true, + b2 = true, + b3 = false + }) .ToArray(); BoolStructNative[] nativeArr = new BoolStruct[10] - .Select( - _ => - new BoolStructNative() - { - b1 = 1, - b2 = 1, - b3 = 0 - } - ) + .Select(_ => new BoolStructNative() + { + b1 = 1, + b2 = 1, + b3 = 0 + }) .ToArray(); BoolStructNative[] nativeNegated = new BoolStruct[10] - .Select( - _ => - new BoolStructNative() - { - b1 = 0, - b2 = 0, - b3 = 1 - } - ) + .Select(_ => new BoolStructNative() + { + b1 = 0, + b2 = 0, + b3 = 1 + }) .ToArray(); foreach (var throwOn in new int[] { 0, 1, 5, 9 }) { @@ -303,15 +294,12 @@ public void MultiDimensionalOutArray_EnsureAllCleaned() BoolStructOutMarshaller.Marshaller.UnmarshallingFailsIndex = throwOn; BoolStructOutMarshaller.Marshaller.ExpectedFreedValues = Enumerable .Range(0, 100) - .Select( - _ => - new BoolStructNative() - { - b1 = 1, - b2 = 1, - b3 = 1 - } - ) + .Select(_ => new BoolStructNative() + { + b1 = 1, + b2 = 1, + b3 = 1 + }) .ToArray(); // https://github.com/dotnet/runtime/issues/93423 //NegateBoolStructInMarshaller.Marshaller.ExpectedFreedValues = Enumerable.Range(0, 100).Select(_ => new BoolStructNative() { b1 = 0, b2 = 0, b3 = 0 }).ToArray(); @@ -333,15 +321,12 @@ out BoolStruct[][] boolsOut BoolStructOutMarshaller.Marshaller.UnmarshallingFailsIndex = -1; BoolStructOutMarshaller.Marshaller.ExpectedFreedValues = Enumerable .Range(0, 100) - .Select( - _ => - new BoolStructNative() - { - b1 = 1, - b2 = 1, - b3 = 1 - } - ) + .Select(_ => new BoolStructNative() + { + b1 = 1, + b2 = 1, + b3 = 1 + }) .ToArray(); // https://github.com/dotnet/runtime/issues/93423 //NegateBoolStructInMarshaller.Marshaller.UnmarshallingFailsIndex = -1; diff --git a/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ShapeBreakingDiagnosticSuppressorTests.cs b/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ShapeBreakingDiagnosticSuppressorTests.cs index 150bbef46ad..31957c6f85a 100644 --- a/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ShapeBreakingDiagnosticSuppressorTests.cs +++ b/runtime/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/ShapeBreakingDiagnosticSuppressorTests.cs @@ -304,7 +304,9 @@ protected override IEnumerable GetDiagnosticAnalyzers() // Our diagnostic suppressor new ShapeBreakingDiagnosticSuppressor(), // Each of the analyzers the suppressor supports suppressing diagnostics from - new Microsoft.CodeQuality.Analyzers.QualityGuidelines.MarkMembersAsStaticAnalyzer() + new Microsoft.CodeQuality.Analyzers.QualityGuidelines.MarkMembersAsStaticAnalyzer( + + ) }; } diff --git a/runtime/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs b/runtime/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs index 82a88ce43af..a013979ff40 100644 --- a/runtime/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs +++ b/runtime/src/libraries/System.Runtime.Loader/tests/ApplyUpdateTest.cs @@ -951,7 +951,9 @@ public static void TestReflectionAddNewType() Assert.Equal("123", i.ItfMethod(123)); - System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType.ZExistingClass.ExistingMethod(); + System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType.ZExistingClass.ExistingMethod( + + ); }); } diff --git a/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs b/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs index bfde6cc7d2b..8464dfa5437 100644 --- a/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs +++ b/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/EqualityExtensions.cs @@ -36,21 +36,19 @@ private static MethodInfo GetExtensionMethod(Type extendedType) { IEnumerable x = typeof(EqualityExtensions) .GetMethods() - ?.Where( - m => - m.Name == "IsEqual" - && m.GetParameters().Length == 3 - && m.IsGenericMethodDefinition + ?.Where(m => + m.Name == "IsEqual" + && m.GetParameters().Length == 3 + && m.IsGenericMethodDefinition ); MethodInfo method = typeof(EqualityExtensions) .GetMethods() - ?.SingleOrDefault( - m => - m.Name == "IsEqual" - && m.GetParameters().Length == 3 - && m.GetParameters()[0].ParameterType.Name == extendedType.Name - && m.IsGenericMethodDefinition + ?.SingleOrDefault(m => + m.Name == "IsEqual" + && m.GetParameters().Length == 3 + && m.GetParameters()[0].ParameterType.Name == extendedType.Name + && m.IsGenericMethodDefinition ); // If extension method found, make it generic and return diff --git a/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs b/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs index e89106194f0..a2d58ee7433 100644 --- a/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs +++ b/runtime/src/libraries/System.Runtime.Serialization.Formatters/tests/PlatformExtensions.cs @@ -34,8 +34,8 @@ public static int GetPlatformIndex(this TypeSerializableValue[] blobs) // Check if a specialized blob for >=netfx472 build 3260 is present and return if found. if (IsNetFxPatchedVersion(3260)) { - index = blobList.FindIndex( - b => b.Platform == TargetFrameworkMoniker.netfx472_3260 + index = blobList.FindIndex(b => + b.Platform == TargetFrameworkMoniker.netfx472_3260 ); if (index >= 0) diff --git a/runtime/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs b/runtime/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs index 7575e4cb656..cc21e2e253f 100644 --- a/runtime/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs +++ b/runtime/src/libraries/System.Runtime.Serialization.Schema/src/System/Runtime/Serialization/Schema/CodeExporter.cs @@ -2660,8 +2660,9 @@ private CodeMemberMethod GetObjectDataMethod ); //Generates: SerializationEntry entry = enumerator.Current; - CodeVariableDeclarationStatement getCurrent = - new CodeVariableDeclarationStatement(); + CodeVariableDeclarationStatement getCurrent = new CodeVariableDeclarationStatement( + + ); getCurrent.Type = GetCodeTypeReference(typeof(SerializationEntry)); getCurrent.Name = ImportGlobals.SerializationEntryFieldName; getCurrent.InitExpression = new CodePropertyReferenceExpression( diff --git a/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs b/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs index 7a6103db8eb..9695043d8a5 100644 --- a/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs +++ b/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/DataContractSerializer.cs @@ -3101,11 +3101,12 @@ public static void DCS_DerivedTypeWithBaseTypeWithDataMember() [Fact] public static void DCS_PocoDerivedTypeWithBaseTypeWithDataMember() { - PocoDerivedTypeWithDataMemberInBaseType value = - new PocoDerivedTypeWithDataMemberInBaseType() - { - EmbeddedDataMember = new PocoTypeAsEmbeddedDataMember { Name = "Foo" } - }; + PocoDerivedTypeWithDataMemberInBaseType value = new PocoDerivedTypeWithDataMemberInBaseType( + + ) + { + EmbeddedDataMember = new PocoTypeAsEmbeddedDataMember { Name = "Foo" } + }; var deserializedValue = DataContractSerializerHelper.SerializeAndDeserialize( value, @@ -3134,7 +3135,9 @@ public static void DCS_ClassImplementingIXmlSerialiable() public static void DCS_TypeWithNestedGenericClassImplementingIXmlSerialiable() { TypeWithNestedGenericClassImplementingIXmlSerialiable.NestedGenericClassImplementingIXmlSerialiable value = - new TypeWithNestedGenericClassImplementingIXmlSerialiable.NestedGenericClassImplementingIXmlSerialiable() + new TypeWithNestedGenericClassImplementingIXmlSerialiable.NestedGenericClassImplementingIXmlSerialiable( + + ) { StringValue = "Foo" }; @@ -3356,8 +3359,9 @@ public static void DCS_DataContractWithOtherSymbolsInName() [Fact] public static void DCS_CollectionDataContractWithCustomKeyName() { - CollectionDataContractWithCustomKeyName value = - new CollectionDataContractWithCustomKeyName(); + CollectionDataContractWithCustomKeyName value = new CollectionDataContractWithCustomKeyName( + + ); value.Add(100, 123); value.Add(200, 456); var deserializedValue = @@ -5356,7 +5360,9 @@ public static void DCS_BasicPerSerializerRoundTripAndCompare_SampleTypes() ); TestObjectInObjectContainerWithSimpleResolver( - new SerializationTestTypes.PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM(), + new SerializationTestTypes.PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM( + + ), @"<_data z:Id=""i1"" i:type=""a:SerializationTestTypes.PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM***"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM***""><_derivedData1/><_data2 z:Ref=""i1"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""/>" ); @@ -5410,7 +5416,9 @@ public static void DCS_BasicPerSerializerRoundTripAndCompare_SampleTypes() ); TestObjectInObjectContainerWithSimpleResolver( - new SerializationTestTypes.Prop_PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM(), + new SerializationTestTypes.Prop_PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM( + + ), @"<_data z:Id=""i1"" i:type=""a:SerializationTestTypes.Prop_PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM***"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/"" xmlns:a=""http://schemas.datacontract.org/2004/07/SerializationTestTypes.Prop_PublicDCClassPublicDM_DerivedDCClassPublicContainsPrivateDM***""><_derivedData1/><_data2 z:Ref=""i1"" xmlns:z=""http://schemas.microsoft.com/2003/10/Serialization/""/>" ); diff --git a/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/SerializationTypes/IXmlSerializableTypes.cs b/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/SerializationTypes/IXmlSerializableTypes.cs index c0f49f662cb..e560e6df24c 100644 --- a/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/SerializationTypes/IXmlSerializableTypes.cs +++ b/runtime/src/libraries/System.Runtime.Serialization.Xml/tests/XsdDataContractExporterTests/SerializationTypes/IXmlSerializableTypes.cs @@ -298,8 +298,9 @@ System.Xml.Schema.XmlSchemaSet xs TypedDataSet ds = new TypedDataSet(); System.Xml.Schema.XmlSchemaComplexType type = new System.Xml.Schema.XmlSchemaComplexType(); - System.Xml.Schema.XmlSchemaSequence sequence = - new System.Xml.Schema.XmlSchemaSequence(); + System.Xml.Schema.XmlSchemaSequence sequence = new System.Xml.Schema.XmlSchemaSequence( + + ); xs.Add(ds.GetSchemaSerializable()); if (PublishLegacyWSDL()) { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.ExplicitImple.Inheritance.cs b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.ExplicitImple.Inheritance.cs index eaa45e1e090..b8c0147e7a3 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.ExplicitImple.Inheritance.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.ExplicitImple.Inheritance.cs @@ -70,8 +70,9 @@ public void InterfaceWithTwoMembers_InSubClass() [Fact] public void InterfaceWithTwoMembers_InBaseClass() { - dynamic d = - new SubClassOfExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass(); + dynamic d = new SubClassOfExplicitlyImplementedInterfaceWithTwoMembersAndEmptySubClass( + + ); Assert.Throws(() => d.Foo()); var x = Helpers.Cast(d); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs index 3f01b2f4845..6a4326262b8 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.indexer.regclass.cs @@ -1539,8 +1539,8 @@ public static int MainMethod() dynamic dy = mc; byte p1 = 10; int p2 = p1; - var result = list.Where( - p => !p._field1.HasValue && !((MyStruct?)dy[p1]).HasValue && p._field2 == dy[p2] + var result = list.Where(p => + !p._field1.HasValue && !((MyStruct?)dy[p1]).HasValue && p._field2 == dy[p2] ) .Select(p => p._field3) .Average(); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs index 0c15a40a5df..1b24aec1096 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.method.genmethod.regclass.cs @@ -806,8 +806,8 @@ public static int MainMethod() dynamic mc = new MemberClass(); string a = "a"; dynamic da = a; - var result = list.Where( - p => p == (string)mc.Method_ReturnsDynamic(null, 10, a, da) + var result = list.Where(p => + p == (string)mc.Method_ReturnsDynamic(null, 10, a, da) ) .ToList(); if (result.Count == 1 && result[0] == "a") diff --git a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs index 88eee4a9b4f..144dd9b4280 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Dynamic.Runtime.Tests/Dynamic.Context/Conformance.dynamic.context.operator.regclass.cs @@ -2014,10 +2014,8 @@ public static int MainMethod() dynamic dy = mc; char? c = 'a'; double[] d = new double[0]; - var result = list.Where( - p => - p._field1 == ((decimal?)(mc != dy)).Value - && p._field2 == ((int?)(c ^ dy)).Value + var result = list.Where(p => + p._field1 == ((decimal?)(mc != dy)).Value && p._field2 == ((int?)(c ^ dy)).Value ) .Where(p => p._field3 == (d & dy)) .Select(p => p._field3) diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarAddMonths.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarAddMonths.cs index 4eaa200beed..5479d753ca5 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarAddMonths.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarAddMonths.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class GregorianCalendarAddMonths { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); private const int MaxMonths = 120000; diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarToFourDigitYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarToFourDigitYear.cs index 1e6b22a25d9..3eb0b78014d 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarToFourDigitYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/GregorianCalendar/GregorianCalendarToFourDigitYear.cs @@ -11,8 +11,9 @@ public class GregorianCalendarToFourDigitYear private const int MaxTwoDigitYear = 99; private const int MinTwoDigitYear = 0; - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable ToFourDigitYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfMonth.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfMonth.cs index 40e01bf6471..0c3bd520385 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfMonth.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetDayOfMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDayOfMonth_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfYear.cs index 6783a7f398b..0c47a2d4854 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDayOfYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetDayOfYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDayOfYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDaysInYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDaysInYear.cs index b8282ac5bb4..00502f24f6b 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDaysInYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetDaysInYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetDaysInYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDaysInYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetWeekOfYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetWeekOfYear.cs index 1276cda4240..071db90579c 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetWeekOfYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarGetWeekOfYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarGetWeekOfYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetWeekOfYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarToFourDigitYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarToFourDigitYear.cs index 34f55b08b74..5d526904016 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarToFourDigitYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/KoreanCalendar/KoreanCalendarToFourDigitYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class KoreanCalendarToFourDigitYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable ToFourDigitYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddMonths.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddMonths.cs index aed5149b566..baa0fc65e7d 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddMonths.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarAddMonths.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarAddMonths { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable AddMonths_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfMonth.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfMonth.cs index e48b1f3144a..f66474edb7e 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfMonth.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetDayOfMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDayOfMonth_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfYear.cs index 5fddb1edb32..e76f0f83635 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDayOfYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetDayOfYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDayOfYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInYear.cs index a045a88fd6b..ec2786b91df 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetDaysInYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetDaysInYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetDaysInYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonth.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonth.cs index 4d1e84ad095..3eee543c25a 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonth.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetMonth.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetMonth { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetMonth_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetWeekOfYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetWeekOfYear.cs index d9ee2f145e7..b132e38b949 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetWeekOfYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarGetWeekOfYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarGetWeekOfYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable GetWeekOfYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapDay.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapDay.cs index c7f20e7fd4e..f08ca6d4b1e 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapDay.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapDay.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarIsLeapDay { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable IsLeapDay_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapYear.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapYear.cs index 2cccfa093c0..70a445738bd 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapYear.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Calendars.Tests/ThaiBuddhistCalendar/ThaiBuddhistCalendarIsLeapYear.cs @@ -8,8 +8,9 @@ namespace System.Globalization.Tests { public class ThaiBuddhistCalendarIsLeapYear { - private static readonly RandomDataGenerator s_randomDataGenerator = - new RandomDataGenerator(); + private static readonly RandomDataGenerator s_randomDataGenerator = new RandomDataGenerator( + + ); public static IEnumerable IsLeapYear_TestData() { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoAll.cs b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoAll.cs index ce127ae3d11..96b7882902c 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoAll.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoAll.cs @@ -2212,10 +2212,9 @@ string consoleUICultureName ); found = CultureInfo .GetCultures(CultureTypes.NeutralCultures) - .Any( - c => - cultureNames.Contains(c.Name, StringComparer.OrdinalIgnoreCase) - || c.Name.Equals(alternativeCultureName, StringComparison.OrdinalIgnoreCase) + .Any(c => + cultureNames.Contains(c.Name, StringComparer.OrdinalIgnoreCase) + || c.Name.Equals(alternativeCultureName, StringComparison.OrdinalIgnoreCase) ); Assert.All( CultureInfo.GetCultures(CultureTypes.SpecificCultures), @@ -2229,13 +2228,9 @@ string consoleUICultureName { found = CultureInfo .GetCultures(CultureTypes.SpecificCultures) - .Any( - c => - cultureNames.Contains(c.Name, StringComparer.OrdinalIgnoreCase) - || c.Name.Equals( - alternativeCultureName, - StringComparison.OrdinalIgnoreCase - ) + .Any(c => + cultureNames.Contains(c.Name, StringComparer.OrdinalIgnoreCase) + || c.Name.Equals(alternativeCultureName, StringComparison.OrdinalIgnoreCase) ); } diff --git a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs index 6c66a1c2731..a9ed0ea6661 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs @@ -71,8 +71,8 @@ public void SetValue_ReadonlyField() public static void CustomAttributes(Type type, string expectedToString) { FieldInfo fieldInfo = GetField(typeof(FieldInfoTests), "fieldWithAttributes"); - CustomAttributeData attributeData = fieldInfo.CustomAttributes.First( - attribute => attribute.AttributeType.Equals(type) + CustomAttributeData attributeData = fieldInfo.CustomAttributes.First(attribute => + attribute.AttributeType.Equals(type) ); Assert.Equal(expectedToString, attributeData.ToString()); } diff --git a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs index dc7a3783a91..0547cc2eaf7 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs @@ -527,8 +527,8 @@ public void CustomAttributesTest(Type attrType) "MethodWithOptionalDefaultOutInMarshalParam", 0 ); - CustomAttributeData attribute = parameterInfo.CustomAttributes.SingleOrDefault( - a => a.AttributeType.Equals(attrType) + CustomAttributeData attribute = parameterInfo.CustomAttributes.SingleOrDefault(a => + a.AttributeType.Equals(attrType) ); Assert.NotNull(attribute); @@ -562,8 +562,8 @@ int expectedMyAttributeValue "VirtualMethodWithCustomAttributes", paramIndex ); - CustomAttributeData attribute = parameterInfo.CustomAttributes.SingleOrDefault( - a => a.AttributeType.Equals(typeof(MyAttribute)) + CustomAttributeData attribute = parameterInfo.CustomAttributes.SingleOrDefault(a => + a.AttributeType.Equals(typeof(MyAttribute)) ); Assert.Equal(exists, attribute != null); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs index 7ab3cea7328..5c5842c9676 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs @@ -321,8 +321,8 @@ public void DeclaredNestedTypes(Type type, string name, bool exists) public void DeclaredProperties(Type type, string name) { TypeInfo typeInfo = type.GetTypeInfo(); - IEnumerable properties = typeInfo.DeclaredProperties.Select( - property => property.Name + IEnumerable properties = typeInfo.DeclaredProperties.Select(property => + property.Name ); Assert.Contains(name, properties); Assert.Equal(name, typeInfo.GetDeclaredProperty(name).Name); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Resources.ResourceManager.Tests/ResourceManagerTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Resources.ResourceManager.Tests/ResourceManagerTests.cs index c7a960e6c71..bd127b28520 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Resources.ResourceManager.Tests/ResourceManagerTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Resources.ResourceManager.Tests/ResourceManagerTests.cs @@ -38,13 +38,14 @@ out bool isEnabled [Fact] public static void ExpectMissingManifestResourceException() { - MissingManifestResourceException e = - Assert.Throws(() => + MissingManifestResourceException e = Assert.Throws( + () => { Type resourceType = typeof(Resources.TestClassWithoutNeutralResources); ResourceManager resourceManager = new ResourceManager(resourceType); string actual = resourceManager.GetString("Any"); - }); + } + ); Assert.NotNull(e.Message); } @@ -297,14 +298,13 @@ bool useEnumeratorEntry using Barrier barrier = new(Threads); Task[] tasks = Enumerable .Range(0, Threads) - .Select( - _ => - Task.Factory.StartNew( - WaitForBarrierThenEnumerateResources, - CancellationToken.None, - TaskCreationOptions.LongRunning, - TaskScheduler.Default - ) + .Select(_ => + Task.Factory.StartNew( + WaitForBarrierThenEnumerateResources, + CancellationToken.None, + TaskCreationOptions.LongRunning, + TaskScheduler.Default + ) ) .ToArray(); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArraySegmentTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArraySegmentTests.cs index b3b1fa0ff9b..4bcc14526eb 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArraySegmentTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArraySegmentTests.cs @@ -918,8 +918,8 @@ public static IEnumerable ArraySegment_TestData() (array: new[] { 3, 4, 5, 6 }, index: 1, count: 0) // Non-empty array, count == 0 }; - return arraySegments.Select( - aseg => new object[] { new ArraySegment(aseg.array, aseg.index, aseg.count) } + return arraySegments.Select(aseg => + new object[] { new ArraySegment(aseg.array, aseg.index, aseg.count) } ); } } diff --git a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/SignatureTypes.cs b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/SignatureTypes.cs index 6ff5b7417f0..835b14272de 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/SignatureTypes.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/SignatureTypes.cs @@ -480,8 +480,8 @@ private static Type ToSignatureType(this Type type) return type.GetElementType().ToSignatureType().MakePointerType(); if (type.IsConstructedGenericType) { - Type[] genericTypeArguments = type.GenericTypeArguments.Select( - t => t.ToSignatureType() + Type[] genericTypeArguments = type.GenericTypeArguments.Select(t => + t.ToSignatureType() ) .ToArray(); return type.GetGenericTypeDefinition().MakeGenericType(genericTypeArguments); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs index 7ed3a0d1a78..7e96acf6f3a 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs @@ -732,8 +732,8 @@ public void IsSZArray_FalseForNonArrayTypes() public void IsSZArray_TrueForSZArrayTypes() { foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType() + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType() ) ) { @@ -745,8 +745,8 @@ Type type in NonArrayBaseTypes.Select( public void IsSZArray_FalseForVariableBoundArrayTypes() { foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType(1) + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType(1) ) ) { @@ -754,8 +754,8 @@ Type type in NonArrayBaseTypes.Select( } foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType(2) + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType(2) ) ) { @@ -794,8 +794,8 @@ public void IsVariableBoundArray_FalseForNonArrayTypes() public void IsVariableBoundArray_FalseForSZArrayTypes() { foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType() + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType() ) ) { @@ -807,8 +807,8 @@ Type type in NonArrayBaseTypes.Select( public void IsVariableBoundArray_TrueForVariableBoundArrayTypes() { foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType(1) + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType(1) ) ) { @@ -816,8 +816,8 @@ Type type in NonArrayBaseTypes.Select( } foreach ( - Type type in NonArrayBaseTypes.Select( - nonArrayBaseType => nonArrayBaseType.MakeArrayType(2) + Type type in NonArrayBaseTypes.Select(nonArrayBaseType => + nonArrayBaseType.MakeArrayType(2) ) ) { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ValueTypeTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ValueTypeTests.cs index 817cdd339c0..4880e39c482 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ValueTypeTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ValueTypeTests.cs @@ -18,13 +18,15 @@ public static void ToStringTest() [Fact] public static void StructWithDoubleFieldNotTightlyPackedZeroCompareTest() { - StructWithDoubleFieldNotTightlyPacked obj1 = - new StructWithDoubleFieldNotTightlyPacked(); + StructWithDoubleFieldNotTightlyPacked obj1 = new StructWithDoubleFieldNotTightlyPacked( + + ); obj1.value1 = 1; obj1.value2 = 0.0; - StructWithDoubleFieldNotTightlyPacked obj2 = - new StructWithDoubleFieldNotTightlyPacked(); + StructWithDoubleFieldNotTightlyPacked obj2 = new StructWithDoubleFieldNotTightlyPacked( + + ); obj2.value1 = 1; obj2.value2 = -0.0; @@ -50,13 +52,15 @@ public static void StructWithDoubleFieldTightlyPackedZeroCompareTest() [Fact] public static void StructWithDoubleFieldNotTightlyPackedNaNCompareTest() { - StructWithDoubleFieldNotTightlyPacked obj1 = - new StructWithDoubleFieldNotTightlyPacked(); + StructWithDoubleFieldNotTightlyPacked obj1 = new StructWithDoubleFieldNotTightlyPacked( + + ); obj1.value1 = 1; obj1.value2 = double.NaN; - StructWithDoubleFieldNotTightlyPacked obj2 = - new StructWithDoubleFieldNotTightlyPacked(); + StructWithDoubleFieldNotTightlyPacked obj2 = new StructWithDoubleFieldNotTightlyPacked( + + ); obj2.value1 = 1; obj2.value2 = -double.NaN; diff --git a/runtime/src/libraries/System.Runtime/tests/System.Text.Encoding.Tests/Encoding/TranscodingStreamTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Text.Encoding.Tests/Encoding/TranscodingStreamTests.cs index 3c0301c45b6..e002a5304e4 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Text.Encoding.Tests/Encoding/TranscodingStreamTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Text.Encoding.Tests/Encoding/TranscodingStreamTests.cs @@ -792,8 +792,7 @@ private async Task RunReadTestAsync( if (suppressExpectedCancellationTokenAsserts) { delegatingInnerStreamMock - .Setup( - o => o.ReadAsync(It.IsAny>(), It.IsAny()) + .Setup(o => o.ReadAsync(It.IsAny>(), It.IsAny()) ) .Returns, CancellationToken>(innerStream.ReadAsync); } @@ -1076,20 +1075,21 @@ public void Write_WithInvalidArgs_Throws() public async Task WriteAsync_WithFullData() { MemoryStream sink = new MemoryStream(); - CancellationToken expectedFlushAsyncCancellationToken = - new CancellationTokenSource().Token; - CancellationToken expectedWriteAsyncCancellationToken = - new CancellationTokenSource().Token; + CancellationToken expectedFlushAsyncCancellationToken = new CancellationTokenSource( + + ).Token; + CancellationToken expectedWriteAsyncCancellationToken = new CancellationTokenSource( + + ).Token; var innerStreamMock = new Mock(MockBehavior.Strict); innerStreamMock.Setup(o => o.CanWrite).Returns(true); innerStreamMock - .Setup( - o => - o.WriteAsync( - It.IsAny>(), - expectedWriteAsyncCancellationToken - ) + .Setup(o => + o.WriteAsync( + It.IsAny>(), + expectedWriteAsyncCancellationToken + ) ) .Returns, CancellationToken>(sink.WriteAsync); innerStreamMock @@ -1178,8 +1178,8 @@ public async Task WriteAsync_WithPartialData() var innerStreamMock = new Mock(MockBehavior.Strict); innerStreamMock.Setup(o => o.CanWrite).Returns(true); innerStreamMock - .Setup( - o => o.WriteAsync(It.IsAny>(), expectedCancellationToken) + .Setup(o => + o.WriteAsync(It.IsAny>(), expectedCancellationToken) ) .Returns, CancellationToken>(sink.WriteAsync); diff --git a/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs index eddfef21b98..4925e5b49a6 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs @@ -823,8 +823,8 @@ public static void DroppedIncompleteStateMachine_RaisesIncompleteAsyncMethodEven throw new XunitException(sb.ToString()); } - EventWrittenEventArgs iam = events.SingleOrDefault( - e => e.EventName == "IncompleteAsyncMethod" + EventWrittenEventArgs iam = events.SingleOrDefault(e => + e.EventName == "IncompleteAsyncMethod" ); if (iam == null) { diff --git a/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs b/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs index 8a2a934a844..ee26d54512d 100644 --- a/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/Task/TaskContinueWithTests.cs @@ -1503,40 +1503,39 @@ public static void RunUnwrapTests_ExceptionTests() // Exception handling // var c = Task.Factory.StartNew(() => { }) - .ContinueWith( - _ => - Task.Factory.StartNew(() => - { - Task.Factory.StartNew( - delegate - { - throw new Exception("uh oh #1"); - }, - TaskCreationOptions.AttachedToParent - ); - Task.Factory.StartNew( - delegate - { - throw new Exception("uh oh #2"); - }, - TaskCreationOptions.AttachedToParent - ); - Task.Factory.StartNew( - delegate - { - throw new Exception("uh oh #3"); - }, - TaskCreationOptions.AttachedToParent - ); - Task.Factory.StartNew( - delegate - { - throw new Exception("uh oh #4"); - }, - TaskCreationOptions.AttachedToParent - ); - return 1; - }) + .ContinueWith(_ => + Task.Factory.StartNew(() => + { + Task.Factory.StartNew( + delegate + { + throw new Exception("uh oh #1"); + }, + TaskCreationOptions.AttachedToParent + ); + Task.Factory.StartNew( + delegate + { + throw new Exception("uh oh #2"); + }, + TaskCreationOptions.AttachedToParent + ); + Task.Factory.StartNew( + delegate + { + throw new Exception("uh oh #3"); + }, + TaskCreationOptions.AttachedToParent + ); + Task.Factory.StartNew( + delegate + { + throw new Exception("uh oh #4"); + }, + TaskCreationOptions.AttachedToParent + ); + return 1; + }) ) .Unwrap(); diff --git a/runtime/src/libraries/System.Runtime/tests/System/Reflection/SignatureTypes.cs b/runtime/src/libraries/System.Runtime/tests/System/Reflection/SignatureTypes.cs index 60d8fb60258..8b6ddef6f19 100644 --- a/runtime/src/libraries/System.Runtime/tests/System/Reflection/SignatureTypes.cs +++ b/runtime/src/libraries/System.Runtime/tests/System/Reflection/SignatureTypes.cs @@ -480,8 +480,8 @@ private static Type ToSignatureType(this Type type) return type.GetElementType().ToSignatureType().MakePointerType(); if (type.IsConstructedGenericType) { - Type[] genericTypeArguments = type.GenericTypeArguments.Select( - t => t.ToSignatureType() + Type[] genericTypeArguments = type.GenericTypeArguments.Select(t => + t.ToSignatureType() ) .ToArray(); return type.GetGenericTypeDefinition().MakeGenericType(genericTypeArguments); diff --git a/runtime/src/libraries/System.Runtime/tests/System/Text/StringBuilderTests.cs b/runtime/src/libraries/System.Runtime/tests/System/Text/StringBuilderTests.cs index a80bb522a03..9a42c863358 100644 --- a/runtime/src/libraries/System.Runtime/tests/System/Text/StringBuilderTests.cs +++ b/runtime/src/libraries/System.Runtime/tests/System/Text/StringBuilderTests.cs @@ -3482,18 +3482,18 @@ public static unsafe void FailureOnLargeString() RemoteExecutor .Invoke(() => // Uses lots of memory { - AssertExtensions.ThrowsAny< - ArgumentOutOfRangeException, - OutOfMemoryException - >(() => - { - StringBuilder sb = new StringBuilder(); - sb.Append(new char[2_000_000_000]); - sb.Length--; - string s = new string('x', 500_000_000); - sb.Append(s); // This should throw, not AV - }); - }) + AssertExtensions.ThrowsAny( + () => + { + StringBuilder sb = new StringBuilder(); + sb.Append(new char[2_000_000_000]); + sb.Length--; + string s = new string('x', 500_000_000); + sb.Append(s); // This should throw, not AV + } + ); + } + ) .Dispose(); } } diff --git a/runtime/src/libraries/System.Security.Cryptography.Cng/tests/TripleDESCngTests.cs b/runtime/src/libraries/System.Security.Cryptography.Cng/tests/TripleDESCngTests.cs index 5d6bafc13ac..eb1231fbf01 100644 --- a/runtime/src/libraries/System.Security.Cryptography.Cng/tests/TripleDESCngTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography.Cng/tests/TripleDESCngTests.cs @@ -114,12 +114,11 @@ public static void VerifyMachineKey() SymmetricCngTestHelpers.VerifyMachineKey( s_cngAlgorithm, 8 * BlockSizeBytes, - keyName => - new TripleDESCng( - keyName, - CngProvider.MicrosoftSoftwareKeyStorageProvider, - CngKeyOpenOptions.MachineKey - ), + keyName => new TripleDESCng( + keyName, + CngProvider.MicrosoftSoftwareKeyStorageProvider, + CngKeyOpenOptions.MachineKey + ), () => new TripleDESCng() ); } diff --git a/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs b/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs index cba463a0c42..bb8628da505 100644 --- a/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs +++ b/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/AnyOS/ManagedPal.Encrypt.cs @@ -108,16 +108,17 @@ byte[] parameterBytes CmsRecipient recipient = recipients[i]; bool v0Recipient; - envelopedData.RecipientInfos[i].Ktri = - recipient.Certificate.GetKeyAlgorithm() switch - { - Oids.Rsa => MakeKtri(cek, recipient, out v0Recipient), - _ - => throw new CryptographicException( - SR.Cryptography_Cms_UnknownAlgorithm, - recipient.Certificate.GetKeyAlgorithm() - ), - }; + envelopedData.RecipientInfos[i].Ktri = recipient.Certificate.GetKeyAlgorithm( + + ) switch + { + Oids.Rsa => MakeKtri(cek, recipient, out v0Recipient), + _ + => throw new CryptographicException( + SR.Cryptography_Cms_UnknownAlgorithm, + recipient.Certificate.GetKeyAlgorithm() + ), + }; allRecipientsVersion0 = allRecipientsVersion0 && v0Recipient; } diff --git a/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/KeyAgreeRecipientInfoPalWindows.cs b/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/KeyAgreeRecipientInfoPalWindows.cs index d8b8d998f9a..8671f7b02ea 100644 --- a/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/KeyAgreeRecipientInfoPalWindows.cs +++ b/runtime/src/libraries/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Pal/Windows/KeyAgreeRecipientInfoPalWindows.cs @@ -110,7 +110,9 @@ public sealed override SubjectIdentifierOrKey OriginatorIdentifierOrKey => recipient->OriginatorCertId.ToSubjectIdentifierOrKey(), CMsgKeyAgreeOriginatorChoice.CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY - => recipient->OriginatorPublicKeyInfo.ToSubjectIdentifierOrKey(), + => recipient->OriginatorPublicKeyInfo.ToSubjectIdentifierOrKey( + + ), _ => throw new CryptographicException( diff --git a/runtime/src/libraries/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs b/runtime/src/libraries/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs index 80b5e19855f..266e76cfb9a 100644 --- a/runtime/src/libraries/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs +++ b/runtime/src/libraries/System.Security.Cryptography.Xml/tests/DSAKeyValueTest.cs @@ -82,9 +82,8 @@ public void GetXml() "Seed", "PgenCounter" } - .Select( - elementName => - xmlkey.SelectSingleNode($"/schema:DSAKeyValue/schema:{elementName}", ns) + .Select(elementName => + xmlkey.SelectSingleNode($"/schema:DSAKeyValue/schema:{elementName}", ns) ) .Where(element => element != null); diff --git a/runtime/src/libraries/System.Security.Cryptography.Xml/tests/RSAKeyValueTest.cs b/runtime/src/libraries/System.Security.Cryptography.Xml/tests/RSAKeyValueTest.cs index 13a5832f3f6..cc96acaff92 100644 --- a/runtime/src/libraries/System.Security.Cryptography.Xml/tests/RSAKeyValueTest.cs +++ b/runtime/src/libraries/System.Security.Cryptography.Xml/tests/RSAKeyValueTest.cs @@ -65,15 +65,14 @@ public void GetXml() // Schema check. Should not throw. const string schema = "http://www.w3.org/2000/09/xmldsig#"; new[] { "Exponent", "Modulus" } - .Select( - elementName => - Convert.FromBase64String( - xmlkey - .SelectSingleNode( - $"*[local-name()='RSAKeyValue' and namespace-uri()='{schema}']/*[local-name()='{elementName}' and namespace-uri()='{schema}']" - ) - .InnerText - ) + .Select(elementName => + Convert.FromBase64String( + xmlkey + .SelectSingleNode( + $"*[local-name()='RSAKeyValue' and namespace-uri()='{schema}']/*[local-name()='{elementName}' and namespace-uri()='{schema}']" + ) + .InnerText + ) ) .ToArray(); } diff --git a/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.Android.cs b/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.Android.cs index fc9709e87ca..5ade943739f 100644 --- a/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.Android.cs +++ b/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/ChainPal.Android.cs @@ -281,10 +281,9 @@ out checkedRevocation { statuses[index] = errorsByIndex[index]; if ( - errorsByIndex[index].Exists( - s => - s.Status == X509ChainStatusFlags.Revoked - || s.Status == X509ChainStatusFlags.RevocationStatusUnknown + errorsByIndex[index].Exists(s => + s.Status == X509ChainStatusFlags.Revoked + || s.Status == X509ChainStatusFlags.RevocationStatusUnknown ) ) { diff --git a/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509ChainProcessor.cs b/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509ChainProcessor.cs index a2774c556dc..7e4b97a274b 100644 --- a/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509ChainProcessor.cs +++ b/runtime/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/OpenSslX509ChainProcessor.cs @@ -44,8 +44,9 @@ Interop.Crypto.X509VerifyStatusCode code private static readonly ConcurrentDictionary s_errorStrings = new ConcurrentDictionary(); - private static readonly MapVersionSpecificCode s_mapVersionSpecificCode = - GetVersionLookup(); + private static readonly MapVersionSpecificCode s_mapVersionSpecificCode = GetVersionLookup( + + ); private SafeX509Handle _leafHandle; private SafeX509StoreHandle _store; diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs index 34fb75e78c0..2cfacf1ecb5 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/AesGcmTests.cs @@ -1106,7 +1106,9 @@ private static IEnumerable GetNistTests() Source = NistGcmTestVectors, CaseId = 0, Key = - "b52c505a37d78eda5dd34f20c22540ea1b58963cf8e5bf8ffa85f9f2492505b4".HexToByteArray(), + "b52c505a37d78eda5dd34f20c22540ea1b58963cf8e5bf8ffa85f9f2492505b4".HexToByteArray( + + ), Nonce = "516c33929df5a3284ff463d7".HexToByteArray(), Plaintext = Array.Empty(), AssociatedData = null, @@ -1118,7 +1120,9 @@ private static IEnumerable GetNistTests() Source = NistGcmTestVectors, CaseId = 0, Key = - "7cb746fbd70e929a8efa65d16b1aa8a37f5b4478edc686b3a9d31631d5bf114b".HexToByteArray(), + "7cb746fbd70e929a8efa65d16b1aa8a37f5b4478edc686b3a9d31631d5bf114b".HexToByteArray( + + ), Nonce = "2f007847f97273c353af2b18".HexToByteArray(), Plaintext = Array.Empty(), AssociatedData = ( @@ -1135,7 +1139,9 @@ private static IEnumerable GetNistTests() Source = NistGcmTestVectors, CaseId = 0, Key = - "810bf78086dc8f630134934f9d978e0f308858e20b21dd4d319f0e6c811d6cec".HexToByteArray(), + "810bf78086dc8f630134934f9d978e0f308858e20b21dd4d319f0e6c811d6cec".HexToByteArray( + + ), Nonce = "afc220a95ad53a376dadba12".HexToByteArray(), Plaintext = "edd60681c4919db5e32b6e44e1".HexToByteArray(), AssociatedData = null, @@ -1147,16 +1153,22 @@ private static IEnumerable GetNistTests() Source = NistGcmTestVectors, CaseId = 0, Key = - "e29e006956c7532d40bd56df5f565d57ee1ea49037404cca7b6ea9dc9e36ab0f".HexToByteArray(), + "e29e006956c7532d40bd56df5f565d57ee1ea49037404cca7b6ea9dc9e36ab0f".HexToByteArray( + + ), Nonce = "ed2caad30eb367d2d89a5ffb".HexToByteArray(), Plaintext = - "b982ea6ff68af4c5202d71466f9f9f63614ad5378859a62d7a38ee32aa370bd9".HexToByteArray(), + "b982ea6ff68af4c5202d71466f9f9f63614ad5378859a62d7a38ee32aa370bd9".HexToByteArray( + + ), AssociatedData = ( "416a7b1db963ed683fd91bc2c5e9df3998944c3d0cbea2d2" + "302c8a67249973525d0dbe8d13f806174dd983ab18854ae6" ).HexToByteArray(), Ciphertext = - "656539e12450db9dd88e4113f7890e80c6186768e6c8b1fc869c42dfad7b58bf".HexToByteArray(), + "656539e12450db9dd88e4113f7890e80c6186768e6c8b1fc869c42dfad7b58bf".HexToByteArray( + + ), Tag = "4366e2ce0396f0410ebcb893".HexToByteArray(), }, new AEADTest @@ -1164,7 +1176,9 @@ private static IEnumerable GetNistTests() Source = NistGcmTestVectors, CaseId = 0, Key = - "6db07c6e834108aa97f4fb9b59378b75b6d58002f0063d8ec48af5adca3327a4".HexToByteArray(), + "6db07c6e834108aa97f4fb9b59378b75b6d58002f0063d8ec48af5adca3327a4".HexToByteArray( + + ), Nonce = "cb2892bb9b841ff16ba0bee6".HexToByteArray(), Plaintext = ( "241f625f0560e9bf6bdb2c3734d79700d18ab0b6d0a2ae8d322" diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs index ff2a90d7ec8..50a6f506fa2 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/ChaCha20Poly1305Tests.cs @@ -435,7 +435,9 @@ public static IEnumerable GetRfc8439TestCases() Source = Rfc8439TestVectors, CaseId = 1, // RFC 8439, Sec. 2.8.2 Key = - "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f".HexToByteArray(), + "808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f".HexToByteArray( + + ), Nonce = "070000004041424344454647".HexToByteArray(), Plaintext = ( "4c616469657320616e642047656e746c" @@ -465,7 +467,9 @@ public static IEnumerable GetRfc8439TestCases() Source = Rfc8439TestVectors, CaseId = 2, // RFC 8439, Appendix A.5 Key = - "1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0".HexToByteArray(), + "1c9240a5eb55d38af333888604f6b5f0473917c1402b80099dca5cbc207075c0".HexToByteArray( + + ), Nonce = "000000000102030405060708".HexToByteArray(), Plaintext = ( "496e7465726e65742d44726166747320" diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs index c3d001b2ce8..20009ccf793 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/HKDFTests.cs @@ -486,7 +486,9 @@ public static IEnumerable Sha3TestCases Name = "SHA3-256 with salt and info", Hash = HashAlgorithmName.SHA3_256, Ikm = - "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray(), + "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray( + + ), Salt = "mysalt"u8.ToArray(), Info = "myinfo"u8.ToArray(), Okm = "35bd9d1c75cf7e30".HexToByteArray(), @@ -500,7 +502,9 @@ public static IEnumerable Sha3TestCases Name = "SHA3-384 with salt and info", Hash = HashAlgorithmName.SHA3_384, Ikm = - "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray(), + "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray( + + ), Salt = "mysalt"u8.ToArray(), Info = "myinfo"u8.ToArray(), Okm = "323a8ab50c7190c8".HexToByteArray(), @@ -514,7 +518,9 @@ public static IEnumerable Sha3TestCases Name = "SHA3-512 with salt and info", Hash = HashAlgorithmName.SHA3_512, Ikm = - "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray(), + "000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F".HexToByteArray( + + ), Salt = "mysalt"u8.ToArray(), Info = "myinfo"u8.ToArray(), Okm = "27693b36a489e9f1".HexToByteArray(), @@ -869,7 +875,9 @@ public void ExtractOverlapsPrkOverKeyMaterial(int ikmOffset, int outputOffset) "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b".HexToByteArray(); ReadOnlySpan salt = "000102030405060708090a0b0c".HexToByteArray(); byte[] expectedPrk = - "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5".HexToByteArray(); + "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5".HexToByteArray( + + ); int length = Math.Max(ikm.Length, expectedPrk.Length) + Math.Max(ikmOffset, outputOffset); @@ -893,7 +901,9 @@ public void ExtractOverlapsPrkOverSalt(int saltOffset, int outputOffset) "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b".HexToByteArray(); ReadOnlySpan salt = "000102030405060708090a0b0c".HexToByteArray(); byte[] expectedPrk = - "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5".HexToByteArray(); + "077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5".HexToByteArray( + + ); int length = Math.Max(ikm.Length, expectedPrk.Length) + Math.Max(saltOffset, outputOffset); @@ -919,7 +929,9 @@ public void ExpandOverlapsOutputOverInfo(int infoOffset, int outputOffset) + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" ).HexToByteArray(); ReadOnlySpan prk = - "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray(); + "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray( + + ); byte[] expectedOkm = ( "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c" + "59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71" @@ -950,9 +962,13 @@ public void ExpandOverlapsOutputOverInfoShortOkm(int infoOffset, int outputOffse + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" ).HexToByteArray(); ReadOnlySpan prk = - "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray(); + "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray( + + ); byte[] expectedOkm = - "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c".HexToByteArray(); + "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c".HexToByteArray( + + ); int length = Math.Max(info.Length, expectedOkm.Length) + Math.Max(infoOffset, outputOffset); @@ -978,7 +994,9 @@ public void ExpandOverlapsOutputOverPrk(int prkOffset, int outputOffset) + "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff" ).HexToByteArray(); ReadOnlySpan prk = - "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray(); + "06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244".HexToByteArray( + + ); byte[] expectedOkm = ( "b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c" + "59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71" diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs index 63c2058911e..7ae45f77905 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/TripleDesTests.cs @@ -64,7 +64,9 @@ public static void TripleDesCannotSetWeakKey() public static void TripleDesCreate() { byte[] inputBytes = - "This is a secret message and is a sentence that is longer than a block, it ensures that multi-block functions work."u8.ToArray(); + "This is a secret message and is a sentence that is longer than a block, it ensures that multi-block functions work."u8.ToArray( + + ); TripleDES tripleDes = TripleDES.Create(); byte[] encryptedBytes; diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/Cert.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/Cert.cs index df1717a0b33..9089f6bc7fd 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/Cert.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/Cert.cs @@ -15,11 +15,11 @@ internal static class Cert // netcoreapp-other: EphemeralKeySet internal static readonly X509KeyStorageFlags EphemeralIfPossible = #if !NO_EPHEMERALKEYSET_AVAILABLE - !OperatingSystem.IsMacOS() - ? X509KeyStorageFlags.EphemeralKeySet - : + !OperatingSystem.IsMacOS() + ? X509KeyStorageFlags.EphemeralKeySet + : #endif - X509KeyStorageFlags.DefaultKeySet; + X509KeyStorageFlags.DefaultKeySet; // // The Import() methods have an overload for each X509Certificate2Collection.Import() overload. diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/CertificateCreation/CertificateRequestUsageTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/CertificateCreation/CertificateRequestUsageTests.cs index 967b39e9a9b..a120882dbff 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/CertificateCreation/CertificateRequestUsageTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/CertificateCreation/CertificateRequestUsageTests.cs @@ -15,7 +15,9 @@ public static void ReproduceBigExponentCsr() { X509Extension sanExtension = new X509Extension( "2.5.29.17", - "302387047F00000187100000000000000000000000000000000182096C6F63616C686F7374".HexToByteArray(), + "302387047F00000187100000000000000000000000000000000182096C6F63616C686F7374".HexToByteArray( + + ), false ); diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs index 385921205f7..0cdbb6e8f68 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/ChainTests.cs @@ -1349,8 +1349,8 @@ public static void BuildChainForFraudulentCertificate() } else { - X509ChainElement certElement = chain.ChainElements.Single( - e => e.Certificate.Subject == cert.Subject + X509ChainElement certElement = chain.ChainElements.Single(e => + e.Certificate.Subject == cert.Subject ); const X509ChainStatusFlags ExpectedFlag = X509ChainStatusFlags.ExplicitDistrust; @@ -1443,8 +1443,8 @@ public static void BuildChainForCertificateSignedWithDisallowedKey() } else { - X509ChainElement certElement = chain.ChainElements.Single( - e => e.Certificate.Subject == intermediateCert.Subject + X509ChainElement certElement = chain.ChainElements.Single(e => + e.Certificate.Subject == intermediateCert.Subject ); const X509ChainStatusFlags ExpectedFlag = X509ChainStatusFlags.ExplicitDistrust; diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/PublicKeyTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/PublicKeyTests.cs index cc12f187c9b..58a902a31e1 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/PublicKeyTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/PublicKeyTests.cs @@ -55,13 +55,17 @@ public static IEnumerable BrainpoolCurves yield return new object[] { TestData.ECDsabrainpoolP160r1_CertificatePemBytes, - "9145C79DD4DF758EB377D13B0DB81F83CE1A63A4099DDC32FE228B06EB1F306423ED61B6B4AF4691".HexToByteArray() + "9145C79DD4DF758EB377D13B0DB81F83CE1A63A4099DDC32FE228B06EB1F306423ED61B6B4AF4691".HexToByteArray( + + ) }; yield return new object[] { TestData.ECDsabrainpoolP160r1_ExplicitCertificatePemBytes, - "6D74F1C9BCBBA5A25F67E670B3DABDB36C24E8FAC3266847EB2EE7E3239208ADC696BB421AB380B4".HexToByteArray() + "6D74F1C9BCBBA5A25F67E670B3DABDB36C24E8FAC3266847EB2EE7E3239208ADC696BB421AB380B4".HexToByteArray( + + ) }; } } @@ -802,7 +806,9 @@ public static void TestDSAPublicKey_VerifiesSignature() byte[] data = { 1, 2, 3, 4, 5 }; byte[] wrongData = { 0xFE, 2, 3, 4, 5 }; byte[] signature = - "B06E26CFC939F25B864F52ABD3288222363A164259B0027FFC95DBC88F9204F7A51A901F3005C9F7".HexToByteArray(); + "B06E26CFC939F25B864F52ABD3288222363A164259B0027FFC95DBC88F9204F7A51A901F3005C9F7".HexToByteArray( + + ); using (var cert = new X509Certificate2(TestData.Dsa1024Cert)) using (DSA pubKey = cert.GetDSAPublicKey()) diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs index 84c40f8fb0f..b019bf542c4 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/TestData.cs @@ -1962,10 +1962,12 @@ public static SecureString CreatePfxDataPasswordSecureString() internal static readonly ECDsaCngKeyValues ECDsaCng256PublicKey = new ECDsaCngKeyValues() { - QX = - "448d98ee08aeba0d8b40f3c6dbd500e8b69f07c70c661771655228ea5a178a91".HexToByteArray(), - QY = - "0ef5cb1759f6f2e062021d4f973f5bb62031be87ae915cff121586809e3219af".HexToByteArray(), + QX = "448d98ee08aeba0d8b40f3c6dbd500e8b69f07c70c661771655228ea5a178a91".HexToByteArray( + + ), + QY = "0ef5cb1759f6f2e062021d4f973f5bb62031be87ae915cff121586809e3219af".HexToByteArray( + + ), D = "692837e9cf613c0e290462a6f08faadcc7002398f75598d5554698a0cb51cf47".HexToByteArray(), }; @@ -1994,11 +1996,17 @@ public static SecureString CreatePfxDataPasswordSecureString() internal static readonly ECDsaCngKeyValues ECDsaCng384PublicKey = new ECDsaCngKeyValues() { QX = - "c59eca607aa5559e6b2f8ac2eeb12d9ab47f420feabeb444c3f71520d7f2280439979323ab5a67344811d296fef6d1bd".HexToByteArray(), + "c59eca607aa5559e6b2f8ac2eeb12d9ab47f420feabeb444c3f71520d7f2280439979323ab5a67344811d296fef6d1bd".HexToByteArray( + + ), QY = - "d15f307cc6cc6c8baeeeb168bfb02c34d6eb0621efb3d06ad31c06b29eaf6ec2ec67bf288455e729d82e5a6439f70901".HexToByteArray(), + "d15f307cc6cc6c8baeeeb168bfb02c34d6eb0621efb3d06ad31c06b29eaf6ec2ec67bf288455e729d82e5a6439f70901".HexToByteArray( + + ), D = - "f55ba33e28cea32a014e2fe1213bb4d41cef361f1fee022116b15be50feb96bc946b10a46a9a7a94176787e0928a3e1d".HexToByteArray(), + "f55ba33e28cea32a014e2fe1213bb4d41cef361f1fee022116b15be50feb96bc946b10a46a9a7a94176787e0928a3e1d".HexToByteArray( + + ), }; internal static readonly byte[] ECDsa384Certificate = ( @@ -2015,11 +2023,17 @@ public static SecureString CreatePfxDataPasswordSecureString() internal static readonly ECDsaCngKeyValues ECDsaCng521PublicKey = new ECDsaCngKeyValues() { QX = - "0134af29d1fe5e581fd2ff6194263abcb6f8cb4d9c08bdb384ede9b8663ae2f4e1af6c85eacc69dc768fbfcd856630792e05484cefb1fefb693081dc6490dac579c0".HexToByteArray(), + "0134af29d1fe5e581fd2ff6194263abcb6f8cb4d9c08bdb384ede9b8663ae2f4e1af6c85eacc69dc768fbfcd856630792e05484cefb1fefb693081dc6490dac579c0".HexToByteArray( + + ), QY = - "00bfe103f53cbcb039873b1a3e81a9da9abd71995e722318367281d30b35a338bf356662342b653eff38e85881863b7128ddbb856d8ae158365550bb6330b93d4ef0".HexToByteArray(), + "00bfe103f53cbcb039873b1a3e81a9da9abd71995e722318367281d30b35a338bf356662342b653eff38e85881863b7128ddbb856d8ae158365550bb6330b93d4ef0".HexToByteArray( + + ), D = - "0153603164bcef5c9f62388d06dcbf5681479be4397c07ff6f44bb848465e3397537d5f61abc7bc9266d4df6bae1df4847fcfd3dabdda37a2fe549b821ea858d088d".HexToByteArray(), + "0153603164bcef5c9f62388d06dcbf5681479be4397c07ff6f44bb848465e3397537d5f61abc7bc9266d4df6bae1df4847fcfd3dabdda37a2fe549b821ea858d088d".HexToByteArray( + + ), }; internal static readonly ECDsaCngKeyValues ECDsabrainpoolP160r1_PublicKey = diff --git a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs index 5d71cb7436e..7ecba89ba9b 100644 --- a/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs +++ b/runtime/src/libraries/System.Security.Cryptography/tests/X509Certificates/X500DistinguishedNameTests.cs @@ -256,7 +256,9 @@ public static void TpmIdentifiers() public static void NameWithNumericString() { X500DistinguishedName dn = new X500DistinguishedName( - "30283117301506052901020203120C313233203635342037383930310D300B0603550403130454657374".HexToByteArray() + "30283117301506052901020203120C313233203635342037383930310D300B0603550403130454657374".HexToByteArray( + + ) ); Assert.Equal( diff --git a/runtime/src/libraries/System.Security.Principal.Windows/tests/WindowsPrincipalTests.cs b/runtime/src/libraries/System.Security.Principal.Windows/tests/WindowsPrincipalTests.cs index 0328ac3a875..39effc94806 100644 --- a/runtime/src/libraries/System.Security.Principal.Windows/tests/WindowsPrincipalTests.cs +++ b/runtime/src/libraries/System.Security.Principal.Windows/tests/WindowsPrincipalTests.cs @@ -40,8 +40,8 @@ public static void CheckDeviceClaims() { WindowsPrincipal principal = new WindowsPrincipal(id); - int manualCount = principal.Claims.Count( - c => c.Properties.ContainsKey(ClaimTypes.WindowsDeviceClaim) + int manualCount = principal.Claims.Count(c => + c.Properties.ContainsKey(ClaimTypes.WindowsDeviceClaim) ); int autoCount = principal.DeviceClaims.Count(); @@ -56,8 +56,8 @@ public static void CheckUserClaims() { WindowsPrincipal principal = new WindowsPrincipal(id); Claim[] allClaims = principal.Claims.ToArray(); - int deviceCount = allClaims.Count( - c => c.Properties.ContainsKey(ClaimTypes.WindowsDeviceClaim) + int deviceCount = allClaims.Count(c => + c.Properties.ContainsKey(ClaimTypes.WindowsDeviceClaim) ); int manualCount = allClaims.Length - deviceCount; int autoCount = principal.UserClaims.Count(); diff --git a/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/CategoriesDocumentFormatterTests.cs b/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/CategoriesDocumentFormatterTests.cs index 471932b25ef..fa6f19db55f 100644 --- a/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/CategoriesDocumentFormatterTests.cs +++ b/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/CategoriesDocumentFormatterTests.cs @@ -36,8 +36,9 @@ public void Ctor_NullDocumentToWrite_ThrowsArgumentNullException() public void CreateInlineCategoriesDocument_Invoke_ReturnsExpected() { var formatter = new Formatter(); - InlineCategoriesDocument document = - formatter.CreateInlineCategoriesDocumentEntryPoint(); + InlineCategoriesDocument document = formatter.CreateInlineCategoriesDocumentEntryPoint( + + ); Assert.Empty(document.AttributeExtensions); Assert.Null(document.BaseUri); Assert.Empty(document.Categories); diff --git a/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs b/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs index 3e7c5d35321..cb36723b6c2 100644 --- a/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs +++ b/runtime/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs @@ -386,8 +386,9 @@ public void Categories_SetNullItem_ThrowsArgumentNullException() public void CreateInlineCategoriesDocument_Invoke_ReturnsExpected() { var workspace = new ResourceCollectionInfoSubclass(); - InlineCategoriesDocument document = - workspace.CreateInlineCategoriesDocumentEntryPoint(); + InlineCategoriesDocument document = workspace.CreateInlineCategoriesDocumentEntryPoint( + + ); Assert.Empty(document.AttributeExtensions); Assert.Null(document.BaseUri); Assert.Empty(document.Categories); diff --git a/runtime/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs b/runtime/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs index 86133661800..e75797f5282 100644 --- a/runtime/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs +++ b/runtime/src/libraries/System.ServiceProcess.ServiceController/src/System/ServiceProcess/ServiceBase.cs @@ -703,8 +703,8 @@ IntPtr eventContext // So we capture the session id at this point WTSSESSION_NOTIFICATION sessionNotification = new WTSSESSION_NOTIFICATION(); Marshal.PtrToStructure(eventData, sessionNotification); - ThreadPool.QueueUserWorkItem( - _ => DeferredSessionChange(eventType, sessionNotification.sessionId) + ThreadPool.QueueUserWorkItem(_ => + DeferredSessionChange(eventType, sessionNotification.sessionId) ); break; } diff --git a/runtime/src/libraries/System.Text.Encodings.Web/tests/TextEncoderTests.cs b/runtime/src/libraries/System.Text.Encodings.Web/tests/TextEncoderTests.cs index 0fd98a5becc..1a451191fdc 100644 --- a/runtime/src/libraries/System.Text.Encodings.Web/tests/TextEncoderTests.cs +++ b/runtime/src/libraries/System.Text.Encodings.Web/tests/TextEncoderTests.cs @@ -81,8 +81,7 @@ int expectedBytesCopied 0x50 }; // UTF-8 subsequences of varying length - var encoder = new ConfigurableScalarTextEncoder( - _ => true /* allow everything */ + var encoder = new ConfigurableScalarTextEncoder(_ => true /* allow everything */ ); // Act & assert @@ -145,8 +144,7 @@ public void EncodeUtf8_MixedInputWhichRequiresEncodingOrReplacement() new { utf8Bytes = new byte[] { 0xF0, 0x90, 0x82, 0x83 }, output = "[10083]" }, // U+10083 LINEAR B IDEOGRAM B105 EQUID (encoded since not on allow list) }; - var encoder = new ConfigurableScalarTextEncoder( - scalarValue => (scalarValue % 2) == 0 /* allow only even-valued scalars to be represented unescaped */ + var encoder = new ConfigurableScalarTextEncoder(scalarValue => (scalarValue % 2) == 0 /* allow only even-valued scalars to be represented unescaped */ ); // Act & assert @@ -309,8 +307,7 @@ public void EncodeUtf8_EmptyInput_AlwaysSucceeds() { // Arrange - var encoder = new ConfigurableScalarTextEncoder( - _ => false /* disallow everything */ + var encoder = new ConfigurableScalarTextEncoder(_ => false /* disallow everything */ ); // Act & assert @@ -347,8 +344,7 @@ public void FindFirstCharToEncodeUtf8_EmptyInput_ReturnsNegOne() { // Arrange - var encoder = new ConfigurableScalarTextEncoder( - _ => false /* disallow everything */ + var encoder = new ConfigurableScalarTextEncoder(_ => false /* disallow everything */ ); // Act @@ -368,8 +364,7 @@ public void FindFirstCharToEncodeUtf8_WellFormedData_AllCharsAllowed() // Arrange byte[] inputBytes = "\U00000040\U00000400\U00004000\U00040000"u8.ToArray(); // code units of different lengths - var encoder = new ConfigurableScalarTextEncoder( - _ => true /* allow everything */ + var encoder = new ConfigurableScalarTextEncoder(_ => true /* allow everything */ ); // Act @@ -387,8 +382,7 @@ public void FindFirstCharToEncodeUtf8_WellFormedData_SomeCharsDisallowed() // Arrange byte[] inputBytes = "\U00000040\U00000400\U00004000\U00040000"u8.ToArray(); // code units of different lengths - var encoder = new ConfigurableScalarTextEncoder( - codePoint => codePoint != 0x4000 /* disallow U+4000, allow all else */ + var encoder = new ConfigurableScalarTextEncoder(codePoint => codePoint != 0x4000 /* disallow U+4000, allow all else */ ); // Act @@ -413,8 +407,7 @@ int expectedIndex { // Arrange - var encoder = new ConfigurableScalarTextEncoder( - _ => true /* allow everything */ + var encoder = new ConfigurableScalarTextEncoder(_ => true /* allow everything */ ); // Act @@ -447,8 +440,8 @@ OperationStatus expectedResult { // Arrange - var encoder = new ConfigurableScalarTextEncoder( - scalar => UnicodeUtility.IsInRangeInclusive((uint)scalar | 0x20, 'a', 'z') + var encoder = new ConfigurableScalarTextEncoder(scalar => + UnicodeUtility.IsInRangeInclusive((uint)scalar | 0x20, 'a', 'z') ); // allow only [A-Za-z] unescaped using BoundedMemory boundedInput = BoundedMemory.AllocateFromExistingData( input.AsSpan() diff --git a/runtime/src/libraries/System.Text.Encodings.Web/tools/GenUnicodeRanges/Program.cs b/runtime/src/libraries/System.Text.Encodings.Web/tools/GenUnicodeRanges/Program.cs index 0eb4c878f9b..2b87b08efd6 100644 --- a/runtime/src/libraries/System.Text.Encodings.Web/tools/GenUnicodeRanges/Program.cs +++ b/runtime/src/libraries/System.Text.Encodings.Web/tools/GenUnicodeRanges/Program.cs @@ -156,11 +156,8 @@ private static string RemoveAllNonAlphanumeric(string blockName) return new String( blockName .ToCharArray() - .Where( - c => - ('A' <= c && c <= 'Z') - || ('a' <= c && c <= 'z') - || ('0' <= c && c <= '9') + .Where(c => + ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || ('0' <= c && c <= '9') ) .ToArray() ); diff --git a/runtime/src/libraries/System.Text.Json/gen/Helpers/RoslynExtensions.cs b/runtime/src/libraries/System.Text.Json/gen/Helpers/RoslynExtensions.cs index e29a33842a8..134654ef6c2 100644 --- a/runtime/src/libraries/System.Text.Json/gen/Helpers/RoslynExtensions.cs +++ b/runtime/src/libraries/System.Text.Json/gen/Helpers/RoslynExtensions.cs @@ -121,10 +121,9 @@ out IMethodSymbol? constructorInfo constructorInfo = namedType .GetExplicitlyDeclaredInstanceConstructors() - .FirstOrDefault( - ctor => - ctor.DeclaredAccessibility is Accessibility.Public - && ctor.Parameters.Length == 0 + .FirstOrDefault(ctor => + ctor.DeclaredAccessibility is Accessibility.Public + && ctor.Parameters.Length == 0 ); return constructorInfo != null || type.IsValueType; } @@ -132,12 +131,9 @@ ctor.DeclaredAccessibility is Accessibility.Public public static IEnumerable GetExplicitlyDeclaredInstanceConstructors( this INamedTypeSymbol type ) => - type.Constructors.Where( - ctor => - !ctor.IsStatic - && !( - ctor.IsImplicitlyDeclared && type.IsValueType && ctor.Parameters.Length == 0 - ) + type.Constructors.Where(ctor => + !ctor.IsStatic + && !(ctor.IsImplicitlyDeclared && type.IsValueType && ctor.Parameters.Length == 0) ); public static bool ContainsAttribute( @@ -147,9 +143,8 @@ public static bool ContainsAttribute( attributeType != null && memberInfo .GetAttributes() - .Any( - attr => - SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType) + .Any(attr => + SymbolEqualityComparer.Default.Equals(attr.AttributeClass, attributeType) ); public static bool IsVirtual(this ISymbol symbol) => diff --git a/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs b/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs index 55dd0dd9104..d2cd93bf8c1 100644 --- a/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs +++ b/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs @@ -40,8 +40,9 @@ private sealed partial class Emitter private const string ValueVarName = "value"; private const string WriterVarName = "writer"; - private static readonly AssemblyName s_assemblyName = - typeof(Emitter).Assembly.GetName(); + private static readonly AssemblyName s_assemblyName = typeof(Emitter).Assembly.GetName( + + ); // global::fully.qualified.name for referenced types private const string InvalidOperationExceptionTypeRef = diff --git a/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs b/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs index d45938a68f3..ce5f11a69dd 100644 --- a/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs +++ b/runtime/src/libraries/System.Text.Json/gen/JsonSourceGenerator.Parser.cs @@ -2020,10 +2020,8 @@ AttributeData attributeData if ( converterType is not INamedTypeSymbol namedConverterType || !_knownSymbols.JsonConverterType.IsAssignableFrom(namedConverterType) - || !namedConverterType.Constructors.Any( - c => - c.Parameters.Length == 0 - && IsSymbolAccessibleWithin(c, within: contextType) + || !namedConverterType.Constructors.Any(c => + c.Parameters.Length == 0 && IsSymbolAccessibleWithin(c, within: contextType) ) ) { diff --git a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandlePropertyName.cs b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandlePropertyName.cs index 19bc6a204cf..1df66fa34cc 100644 --- a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandlePropertyName.cs +++ b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandlePropertyName.cs @@ -174,7 +174,9 @@ JsonSerializerOptions options // Avoid a reference to the JsonNode type for trimming if (jsonPropertyInfo.PropertyType.FullName == JsonTypeInfo.JsonObjectTypeName) { - ThrowHelper.ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty(); + ThrowHelper.ThrowInvalidOperationException_NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty( + + ); } else { diff --git a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs index 26aec8d0af9..06fc9ce9381 100644 --- a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs +++ b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPropertyInfo.cs @@ -632,12 +632,16 @@ private void DetermineEffectiveObjectCreationHandlingForProperty() { if (ParentTypeInfo.DetermineUsesParameterizedConstructor()) { - ThrowHelper.ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors(); + ThrowHelper.ThrowNotSupportedException_ObjectCreationHandlingPropertyDoesNotSupportParameterizedConstructors( + + ); } if (Options.ReferenceHandlingStrategy != ReferenceHandlingStrategy.None) { - ThrowHelper.ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling(); + ThrowHelper.ThrowInvalidOperationException_ObjectCreationHandlingPropertyCannotAllowReferenceHandling( + + ); } } diff --git a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PolymorphicTypeResolver.cs b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PolymorphicTypeResolver.cs index b6b6df17125..a0d92b61a02 100644 --- a/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PolymorphicTypeResolver.cs +++ b/runtime/src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/PolymorphicTypeResolver.cs @@ -124,7 +124,9 @@ bool converterCanHaveMetadata ) != 0 ) { - ThrowHelper.ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName(); + ThrowHelper.ThrowInvalidOperationException_InvalidCustomTypeDiscriminatorPropertyName( + + ); } TypeDiscriminatorPropertyName = propertyName; diff --git a/runtime/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs b/runtime/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs index f1f8e651cf0..6d5ed454a2c 100644 --- a/runtime/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs +++ b/runtime/src/libraries/System.Text.Json/tests/Common/CollectionTests/CollectionTests.AsyncEnumerable.cs @@ -431,18 +431,22 @@ public static IEnumerable GetAsyncEnumerableSources() yield return WrapArgs( Enumerable .Range(0, 10) - .Select( - i => new AsyncEnumerableElement(i, $"lorem ipsum dolor: {i}", (i % 2 == 0)) - ), + .Select(i => new AsyncEnumerableElement( + i, + $"lorem ipsum dolor: {i}", + (i % 2 == 0) + )), 3, 100 ); yield return WrapArgs( Enumerable .Range(0, 100) - .Select( - i => new AsyncEnumerableElement(i, $"lorem ipsum dolor: {i}", (i % 2 == 0)) - ), + .Select(i => new AsyncEnumerableElement( + i, + $"lorem ipsum dolor: {i}", + (i % 2 == 0) + )), 20, 100 ); diff --git a/runtime/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.AttributePresence.cs b/runtime/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.AttributePresence.cs index aebb6cce3e8..41b1b204c9e 100644 --- a/runtime/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.AttributePresence.cs +++ b/runtime/src/libraries/System.Text.Json/tests/Common/ConstructorTests/ConstructorTests.AttributePresence.cs @@ -123,7 +123,9 @@ async Task RunTestAsync() await RunTestAsync(); await RunTestAsync(); - await RunTestAsync(); + await RunTestAsync( + + ); } [Fact] @@ -204,12 +206,24 @@ await Assert.ThrowsAsync( } await RunTestAsync(); - await RunTestAsync(); - await RunTestAsync(); - await RunTestAsync(); - await RunTestAsync(); - await RunTestAsync(); - await RunTestAsync(); + await RunTestAsync( + + ); + await RunTestAsync( + + ); + await RunTestAsync( + + ); + await RunTestAsync( + + ); + await RunTestAsync( + + ); + await RunTestAsync( + + ); await RunTestAsync(); await RunTestAsync(); } diff --git a/runtime/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs b/runtime/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs index 78e7a993cf0..f1da9c95fcf 100644 --- a/runtime/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/Common/PropertyVisibilityTests.cs @@ -791,7 +791,9 @@ public async Task HiddenPropertiesIgnored_WhenOverridesIgnored() Assert.Equal(@"{""MyProp"":false}", serialized); serialized = await Serializer.SerializeWrapper( - new DerivedClass_With_Ignored_NewProperty_Of_DifferentType_And_ConflictingPropertyName() + new DerivedClass_With_Ignored_NewProperty_Of_DifferentType_And_ConflictingPropertyName( + + ) ); Assert.Equal(@"{""MyProp"":null}", serialized); diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs index 57fe50e6aa4..933a7c8643e 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Tests/JsonSerializerContextTests.cs @@ -122,7 +122,9 @@ public static void VariousGenericsAreSupported() Assert.NotNull(NestedGenericTypesContext.Default); var original = - new MyContainingGenericClass.MyNestedGenericClass.MyNestedGenericNestedGenericClass() + new MyContainingGenericClass.MyNestedGenericClass.MyNestedGenericNestedGenericClass( + + ) { DataT = 1, DataT1 = 10, diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs index 33a0b24ae01..aa7dca0dfac 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/JsonSourceGeneratorDiagnosticsTests.cs @@ -99,8 +99,9 @@ public void SuccessfulSourceGeneration() // Compile the referenced assembly first. Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); - Compilation eventCompilation = - CompilationHelper.CreateActiveOrUpcomingEventCompilation(); + Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation( + + ); // Emit the image of the referenced assembly. byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); @@ -150,8 +151,9 @@ public void MultiDimensionArrayDoesNotProduceWarnings(bool explicitRef) // Compile the referenced assembly first. Compilation campaignCompilation = CompilationHelper.CreateCampaignSummaryViewModelCompilation(); - Compilation eventCompilation = - CompilationHelper.CreateActiveOrUpcomingEventCompilation(); + Compilation eventCompilation = CompilationHelper.CreateActiveOrUpcomingEventCompilation( + + ); // Emit the image of the referenced assembly. byte[] campaignImage = CompilationHelper.CreateAssemblyImage(campaignCompilation); diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonPolymorphismOptionsTests.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonPolymorphismOptionsTests.cs index a2f0406cc0f..d3769080b83 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonPolymorphismOptionsTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/JsonPolymorphismOptionsTests.cs @@ -160,11 +160,11 @@ public static void DefaultResolver_ReportsCorrectPolymorphismMetadata(Type polym polyOptions.TypeDiscriminatorPropertyName ); Assert.Equal( - expected: derivedTypeAttributes.Select( - attr => (attr.DerivedType, attr.TypeDiscriminator) + expected: derivedTypeAttributes.Select(attr => + (attr.DerivedType, attr.TypeDiscriminator) ), - actual: polyOptions.DerivedTypes.Select( - attr => (attr.DerivedType, attr.TypeDiscriminator) + actual: polyOptions.DerivedTypes.Select(attr => + (attr.DerivedType, attr.TypeDiscriminator) ) ); } diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/DefaultJsonTypeInfoResolverTests.JsonPropertyInfo.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/DefaultJsonTypeInfoResolverTests.JsonPropertyInfo.cs index b64f8e8fa42..6f068a84859 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/DefaultJsonTypeInfoResolverTests.JsonPropertyInfo.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/DefaultJsonTypeInfoResolverTests.JsonPropertyInfo.cs @@ -1492,8 +1492,8 @@ public static void ClassWithoutExtensionDataAttribute_CanHaveExtensionDataEnable { if (jti.Type == typeof(ClassWithTwoExtensionDataLikeProperties)) { - JsonPropertyInfo propertyInfo = jti.Properties.First( - prop => prop.Name == "ExtensionData2" + JsonPropertyInfo propertyInfo = jti.Properties.First(prop => + prop.Name == "ExtensionData2" ); propertyInfo.IsExtensionData = true; } @@ -1573,8 +1573,7 @@ public static void DefaultJsonTypeInfoResolver_JsonPropertyInfo_ReturnsMemberInf Assert.NotNull(fieldInfo); Assert.Same(fieldInfo, fieldPropInfo.AttributeProvider); - JsonPropertyInfo propertyPropInfo = jti.Properties.First( - prop => prop.Name == "Property" + JsonPropertyInfo propertyPropInfo = jti.Properties.First(prop => prop.Name == "Property" ); PropertyInfo propInfo = typeof(ClassWithFieldsAndProperties).GetProperty("Property"); Assert.NotNull(propInfo); diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/JsonTypeInfoResolverTests.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/JsonTypeInfoResolverTests.cs index c46b150cbab..666efa2fac2 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/JsonTypeInfoResolverTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/MetadataTests/JsonTypeInfoResolverTests.cs @@ -223,8 +223,8 @@ public static void WithAddedModifier_CallsModifierOnResolvedMetadata() JsonSerializerOptions options = new(); TestResolver resolver = new(JsonTypeInfo.CreateJsonTypeInfo); - IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier( - _ => modifierInvocationCount++ + IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier(_ => + modifierInvocationCount++ ); Assert.NotNull(resolverWithModifier.GetTypeInfo(typeof(int), options)); @@ -244,8 +244,8 @@ public static void WithAddedModifier_DoesNotCallModifierOnUnResolvedMetadata() JsonSerializerOptions options = new(); TestResolver resolver = new((_, _) => null); - IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier( - _ => modifierInvocationCount++ + IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier(_ => + modifierInvocationCount++ ); Assert.Null(resolverWithModifier.GetTypeInfo(typeof(int), options)); @@ -265,8 +265,8 @@ public static void WithAddedModifier_CanChainMultipleModifiers() IJsonTypeInfoResolver resolverWithModifier = resolver .WithAddedModifier(_ => modifier1InvocationCount++) - .WithAddedModifier( - _ => Assert.Equal(modifier1InvocationCount, ++modifier2InvocationCount) + .WithAddedModifier(_ => + Assert.Equal(modifier1InvocationCount, ++modifier2InvocationCount) ); // Validates order of modifier evaluation. Assert.NotNull(resolverWithModifier.GetTypeInfo(typeof(int), options)); @@ -282,13 +282,13 @@ public static void WithAddedModifier_ChainingDoesNotMutateIntermediateResolvers( JsonSerializerOptions options = new(); TestResolver resolver = new(JsonTypeInfo.CreateJsonTypeInfo); - IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier( - _ => modifier1InvocationCount++ + IJsonTypeInfoResolver resolverWithModifier = resolver.WithAddedModifier(_ => + modifier1InvocationCount++ ); IJsonTypeInfoResolver resolverWithChainedModifier = - resolverWithModifier.WithAddedModifier( - _ => Assert.Equal(modifier1InvocationCount, ++modifier2InvocationCount) + resolverWithModifier.WithAddedModifier(_ => + Assert.Equal(modifier1InvocationCount, ++modifier2InvocationCount) ); // Validates order of modifier evaluation. Assert.NotSame(resolverWithModifier, resolverWithChainedModifier); diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Null.WriteTests.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Null.WriteTests.cs index 03b89fb75d4..258507e07eb 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Null.WriteTests.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Null.WriteTests.cs @@ -368,11 +368,10 @@ public static void SerializeNullValue_BuiltInConverter(JsonConverter conve { return typeof(JsonMetadataServices) .GetProperties(BindingFlags.Public | BindingFlags.Static) - .Where( - prop => - prop.PropertyType.IsGenericType - && prop.PropertyType.GetGenericTypeDefinition() == typeof(JsonConverter<>) - && !prop.PropertyType.GetGenericArguments()[0].IsValueType + .Where(prop => + prop.PropertyType.IsGenericType + && prop.PropertyType.GetGenericTypeDefinition() == typeof(JsonConverter<>) + && !prop.PropertyType.GetGenericArguments()[0].IsValueType ) .Select(prop => new object?[] { prop.GetValue(null) }); } diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PolymorphicTests.CustomTypeHierarchies.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PolymorphicTests.CustomTypeHierarchies.cs index 90a39c4bb2e..b3333cb082e 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PolymorphicTests.CustomTypeHierarchies.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/PolymorphicTests.CustomTypeHierarchies.cs @@ -3237,8 +3237,8 @@ public async Task ReferencePreservation_CustomTypeDiscriminator_MultipleRepeatin PolymorphicClassWithCustomTypeDiscriminator Value, Func JsonTemplate )[] data = PolymorphicClassWithCustomTypeDiscriminator.GetTestData().ToArray(); - PolymorphicClassWithCustomTypeDiscriminator[] expectedValues = data.Select( - entry => entry.Value + PolymorphicClassWithCustomTypeDiscriminator[] expectedValues = data.Select(entry => + entry.Value ) .Concat(data.Select(entry => entry.Value)) .ToArray(); @@ -3421,7 +3421,9 @@ await Assert.ThrowsAsync( public async Task PolymorphicInterfaceWithInterfaceDerivedType_FallbackToNearestAncestor_Serialization() { PolymorphicInterfaceWithInterfaceDerivedType value = - new PolymorphicInterfaceWithInterfaceDerivedType.DerivedInterface.ImplementingClass(); + new PolymorphicInterfaceWithInterfaceDerivedType.DerivedInterface.ImplementingClass( + + ); string expectedJson = @"{""$type"":""derivedInterface""}"; string actualJson = await Serializer.SerializeWrapper( value, diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.DeserializeAsyncEnumerable.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.DeserializeAsyncEnumerable.cs index 9f114762372..d9a0409777e 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.DeserializeAsyncEnumerable.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.DeserializeAsyncEnumerable.cs @@ -109,8 +109,9 @@ DeserializeAsyncEnumerableOverload overload options, overload: overload ); - await using IAsyncEnumerator asyncEnumerator = - asyncEnumerable.GetAsyncEnumerator(); + await using IAsyncEnumerator asyncEnumerator = asyncEnumerable.GetAsyncEnumerator( + + ); for (int i = 0; i < 20; i++) { @@ -347,45 +348,36 @@ public static IEnumerable GetAsyncEnumerableSources() yield return WrapArgs( Enumerable .Range(0, 10) - .Select( - i => - new - { - Field1 = i, - Field2 = $"lorem ipsum dolor: {i}", - Field3 = i % 2 == 0 - } - ), + .Select(i => new + { + Field1 = i, + Field2 = $"lorem ipsum dolor: {i}", + Field3 = i % 2 == 0 + }), 100, DeserializeAsyncEnumerableOverload.JsonSerializerOptions ); yield return WrapArgs( Enumerable .Range(0, 10) - .Select( - i => - new - { - Field1 = i, - Field2 = $"lorem ipsum dolor: {i}", - Field3 = i % 2 == 0 - } - ), + .Select(i => new + { + Field1 = i, + Field2 = $"lorem ipsum dolor: {i}", + Field3 = i % 2 == 0 + }), 100, DeserializeAsyncEnumerableOverload.JsonTypeInfo ); yield return WrapArgs( Enumerable .Range(0, 100) - .Select( - i => - new - { - Field1 = i, - Field2 = $"lorem ipsum dolor: {i}", - Field3 = i % 2 == 0 - } - ), + .Select(i => new + { + Field1 = i, + Field2 = $"lorem ipsum dolor: {i}", + Field3 = i % 2 == 0 + }), 500, DeserializeAsyncEnumerableOverload.JsonSerializerOptions ); diff --git a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs index 6a6c0a4bd98..20038216809 100644 --- a/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs +++ b/runtime/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/TrimmingTests/IsReflectionEnabledByDefaultFalse.cs @@ -119,7 +119,9 @@ public MyJsonResolver() global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? jsonTypeInfo = null; global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues objectInfo = - new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues() + new global::System.Text.Json.Serialization.Metadata.JsonObjectInfoValues( + + ) { ObjectCreator = static () => new global::MyPoco(), ObjectWithParameterizedConstructorCreator = null, @@ -145,7 +147,9 @@ public MyJsonResolver() new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfo[1]; global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues info0 = - new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues() + new global::System.Text.Json.Serialization.Metadata.JsonPropertyInfoValues( + + ) { IsProperty = true, IsPublic = true, diff --git a/runtime/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs b/runtime/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs index 4c0de8bf22e..3cfe7b62e72 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/gen/RegexGenerator.Parser.cs @@ -62,8 +62,7 @@ CancellationToken cancellationToken AttributeData generatedRegexAttr = boundAttributes[0]; if ( - generatedRegexAttr.ConstructorArguments.Any( - ca => ca.Kind == TypedConstantKind.Error + generatedRegexAttr.ConstructorArguments.Any(ca => ca.Kind == TypedConstantKind.Error ) ) { diff --git a/runtime/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs b/runtime/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs index 68cd7e5cb21..cd1f00654b3 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexPrefixAnalyzer.cs @@ -207,12 +207,11 @@ bool thorough int distance = 0; TryFindRawFixedSets(root, results, ref distance, thorough); #if DEBUG - results.ForEach( - r => - Debug.Assert( - !r.Negated && r.Chars is null && r.Range is null, - $"{nameof(TryFindRawFixedSets)} should have only populated {nameof(r.Set)} and {nameof(r.Distance)}" - ) + results.ForEach(r => + Debug.Assert( + !r.Negated && r.Chars is null && r.Range is null, + $"{nameof(TryFindRawFixedSets)} should have only populated {nameof(r.Set)} and {nameof(r.Distance)}" + ) ); #endif diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs index 43fd2fa7616..b0909526236 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs @@ -50,14 +50,13 @@ public static IEnumerable Test_MemberData() .GetRegexesAsync( engine, cases - .Select( - c => - ( - c.Pattern, - (CultureInfo?)null, - (RegexOptions?)c.Options, - (TimeSpan?)null - ) + .Select(c => + ( + c.Pattern, + (CultureInfo?)null, + (RegexOptions?)c.Options, + (TimeSpan?)null + ) ) .ToArray() ) diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/CaptureCollectionTests2.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/CaptureCollectionTests2.cs index 40c6fb11b20..23487738875 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/CaptureCollectionTests2.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/CaptureCollectionTests2.cs @@ -185,10 +185,9 @@ public static void DebuggerAttributeTests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); Capture[] items = itemProperty.GetValue(info.Instance) as Capture[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GroupCollectionTests2.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GroupCollectionTests2.cs index 2827cd2d0ca..be1be540e9c 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GroupCollectionTests2.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GroupCollectionTests2.cs @@ -182,10 +182,9 @@ public static void DebuggerAttributeTests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); Group[] items = itemProperty.GetValue(info.Instance) as Group[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/MatchCollectionTests2.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/MatchCollectionTests2.cs index 287f426dc67..af869417430 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/MatchCollectionTests2.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/MatchCollectionTests2.cs @@ -173,10 +173,9 @@ public static void DebuggerAttributeTests() DebuggerAttributeInfo info = DebuggerAttributes.ValidateDebuggerTypeProxyProperties( col ); - PropertyInfo itemProperty = info.Properties.Single( - pr => - pr.GetCustomAttribute().State - == DebuggerBrowsableState.RootHidden + PropertyInfo itemProperty = info.Properties.Single(pr => + pr.GetCustomAttribute().State + == DebuggerBrowsableState.RootHidden ); Match[] items = itemProperty.GetValue(info.Instance) as Match[]; Assert.Equal(col, items); diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Groups.Tests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Groups.Tests.cs index 7eefe9d5fb1..f6a969923b4 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Groups.Tests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Groups.Tests.cs @@ -26,14 +26,8 @@ string[] Expected .GetRegexesAsync( engine, cases - .Select( - c => - ( - c.Pattern, - c.Culture, - (RegexOptions?)c.Options, - (TimeSpan?)null - ) + .Select(c => + (c.Pattern, c.Culture, (RegexOptions?)c.Options, (TimeSpan?)null) ) .ToArray() ) diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs index 685a03bdff8..1bce198f2ac 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/Regex.Match.Tests.cs @@ -34,14 +34,13 @@ string ExpectedValue .GetRegexesAsync( engine, cases - .Select( - c => - ( - c.Pattern, - (CultureInfo?)null, - (RegexOptions?)c.Options, - (TimeSpan?)null - ) + .Select(c => + ( + c.Pattern, + (CultureInfo?)null, + (RegexOptions?)c.Options, + (TimeSpan?)null + ) ) .ToArray() ) @@ -6796,33 +6795,32 @@ TimeSpan timeout Task.WaitAll( Enumerable .Range(0, b.ParticipantCount) - .Select( - _ => - Task.Factory.StartNew( - () => + .Select(_ => + Task.Factory.StartNew( + () => + { + b.SignalAndWait(); + for (int i = 0; i < IterationsPerTask; i++) { - b.SignalAndWait(); - for (int i = 0; i < IterationsPerTask; i++) - { - Match m = r.Match(Input); - Assert.NotNull(m); - Assert.True(m.Success); - Assert.Equal("abcdefghijklmnx", m.Value); - - m = m.NextMatch(); - Assert.NotNull(m); - Assert.True(m.Success); - Assert.Equal("nmlkjihgfedcbax", m.Value); - - m = m.NextMatch(); - Assert.NotNull(m); - Assert.False(m.Success); - } - }, - CancellationToken.None, - TaskCreationOptions.LongRunning, - TaskScheduler.Default - ) + Match m = r.Match(Input); + Assert.NotNull(m); + Assert.True(m.Success); + Assert.Equal("abcdefghijklmnx", m.Value); + + m = m.NextMatch(); + Assert.NotNull(m); + Assert.True(m.Success); + Assert.Equal("nmlkjihgfedcbax", m.Value); + + m = m.NextMatch(); + Assert.NotNull(m); + Assert.False(m.Success); + } + }, + CancellationToken.None, + TaskCreationOptions.LongRunning, + TaskScheduler.Default + ) ) .ToArray() ); diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCharacterSetTests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCharacterSetTests.cs index f0a871815cd..9da43deb9b6 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCharacterSetTests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexCharacterSetTests.cs @@ -711,8 +711,8 @@ public async Task UnicodeCategoryInclusionsExpected( UnicodeCategory[] categories ) { - HashSet categoryInclusions = ComputeIncludedSet( - c => Array.IndexOf(categories, char.GetUnicodeCategory(c)) >= 0 + HashSet categoryInclusions = ComputeIncludedSet(c => + Array.IndexOf(categories, char.GetUnicodeCategory(c)) >= 0 ); await ValidateSetAsync(engine, $"[{set}]", RegexOptions.None, categoryInclusions, null); await ValidateSetAsync( @@ -1432,8 +1432,8 @@ UnicodeCategory[] unicodeCategory Regex r; char[] allChars = Enumerable.Range(0, char.MaxValue + 1).Select(i => (char)i).ToArray(); - int expectedInCategory = allChars.Count( - c => Array.IndexOf(unicodeCategory, char.GetUnicodeCategory(c)) >= 0 + int expectedInCategory = allChars.Count(c => + Array.IndexOf(unicodeCategory, char.GetUnicodeCategory(c)) >= 0 ); int expectedNotInCategory = allChars.Length - expectedInCategory; diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs index 783e44b63a7..9c20a837904 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorHelper.netcoreapp.cs @@ -152,11 +152,10 @@ internal static async Task> RunGenerator( comp = comp.AddSyntaxTrees(generatorResults.GeneratedTrees.ToArray()); EmitResult results = comp.Emit(Stream.Null, cancellationToken: cancellationToken); ImmutableArray generatorDiagnostics = - generatorResults.Diagnostics.RemoveAll( - d => d.Severity <= DiagnosticSeverity.Hidden + generatorResults.Diagnostics.RemoveAll(d => d.Severity <= DiagnosticSeverity.Hidden ); - ImmutableArray resultsDiagnostics = results.Diagnostics.RemoveAll( - d => d.Severity <= DiagnosticSeverity.Hidden + ImmutableArray resultsDiagnostics = results.Diagnostics.RemoveAll(d => + d.Severity <= DiagnosticSeverity.Hidden ); if (!results.Success || resultsDiagnostics.Length != 0) { @@ -344,8 +343,7 @@ internal static async Task SourceGenRegexAsync( .RunGenerators(comp!, cancellationToken) .GetRunResult(); ImmutableArray generatorDiagnostics = - generatorResults.Diagnostics.RemoveAll( - d => d.Severity <= DiagnosticSeverity.Hidden + generatorResults.Diagnostics.RemoveAll(d => d.Severity <= DiagnosticSeverity.Hidden ); if (generatorDiagnostics.Length != 0) { @@ -367,8 +365,8 @@ internal static async Task SourceGenRegexAsync( options: s_emitOptions, cancellationToken: cancellationToken ); - ImmutableArray resultsDiagnostics = results.Diagnostics.RemoveAll( - d => d.Severity <= DiagnosticSeverity.Hidden + ImmutableArray resultsDiagnostics = results.Diagnostics.RemoveAll(d => + d.Severity <= DiagnosticSeverity.Hidden ); if (!results.Success || resultsDiagnostics.Length != 0) { diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexPcreTests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexPcreTests.cs index 81a3a69f20b..8cc5097e23a 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexPcreTests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexPcreTests.cs @@ -31,14 +31,13 @@ public static IEnumerable PcreTestData() .GetRegexesAsync( engine, cases - .Select( - c => - ( - c.pattern, - (CultureInfo?)null, - (RegexOptions?)c.options, - (TimeSpan?)null - ) + .Select(c => + ( + c.pattern, + (CultureInfo?)null, + (RegexOptions?)c.options, + (TimeSpan?)null + ) ) .ToArray() ) diff --git a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexRustTests.cs b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexRustTests.cs index 222f23e2d24..1388340abb0 100644 --- a/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexRustTests.cs +++ b/runtime/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexRustTests.cs @@ -23,14 +23,13 @@ public static IEnumerable MatchStartAndEndPositions_MemberData() .GetRegexesAsync( engine, cases - .Select( - c => - ( - c.Pattern, - (CultureInfo?)null, - (RegexOptions?)RegexOptions.None, - (TimeSpan?)null - ) + .Select(c => + ( + c.Pattern, + (CultureInfo?)null, + (RegexOptions?)RegexOptions.None, + (TimeSpan?)null + ) ) .ToArray() ) diff --git a/runtime/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs b/runtime/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs index 6045cc9fe6b..61a04635c44 100644 --- a/runtime/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs +++ b/runtime/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs @@ -352,9 +352,8 @@ MutexSecurity actualSecurity expectedAccessRules, actualAccessRule => { - int count = expectedAccessRules.Count( - expectedAccessRule => - AreAccessRulesEqual(expectedAccessRule, actualAccessRule) + int count = expectedAccessRules.Count(expectedAccessRule => + AreAccessRulesEqual(expectedAccessRule, actualAccessRule) ); Assert.True(count > 0); } diff --git a/runtime/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs b/runtime/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs index f88aafa197b..151d688ff95 100644 --- a/runtime/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs +++ b/runtime/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs @@ -397,9 +397,8 @@ SemaphoreSecurity actualSecurity expectedAccessRules, actualAccessRule => { - int count = expectedAccessRules.Count( - expectedAccessRule => - AreAccessRulesEqual(expectedAccessRule, actualAccessRule) + int count = expectedAccessRules.Count(expectedAccessRule => + AreAccessRulesEqual(expectedAccessRule, actualAccessRule) ); Assert.True(count > 0); } diff --git a/runtime/src/libraries/System.Threading.Channels/tests/Stress.cs b/runtime/src/libraries/System.Threading.Channels/tests/Stress.cs index 4f8f984ca15..4a31d50df87 100644 --- a/runtime/src/libraries/System.Threading.Channels/tests/Stress.cs +++ b/runtime/src/libraries/System.Threading.Channels/tests/Stress.cs @@ -298,8 +298,7 @@ public async Task CanceledReads(Func> channelFactory) // Create a bunch of reads, half of which are cancelable Task[] reads = Enumerable .Range(0, Writes) - .Select( - i => channel.Reader.ReadAsync(i % 2 == 0 ? cts.Token : default).AsTask() + .Select(i => channel.Reader.ReadAsync(i % 2 == 0 ? cts.Token : default).AsTask() ) .ToArray(); diff --git a/runtime/src/libraries/System.Threading.RateLimiting/tests/PartitionedRateLimiterTests.cs b/runtime/src/libraries/System.Threading.RateLimiting/tests/PartitionedRateLimiterTests.cs index a513275f09d..bdeb4bb8c34 100644 --- a/runtime/src/libraries/System.Threading.RateLimiting/tests/PartitionedRateLimiterTests.cs +++ b/runtime/src/libraries/System.Threading.RateLimiting/tests/PartitionedRateLimiterTests.cs @@ -139,13 +139,12 @@ public async Task Create_BlockingWaitDoesNotBlockOtherPartitions() } return RateLimitPartition.GetConcurrencyLimiter( 2, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.OldestFirst, - QueueLimit = 2 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.OldestFirst, + QueueLimit = 2 + } ); }); @@ -395,16 +394,15 @@ public async Task Create_WithTokenBucketReplenishesAutomatically() { return RateLimitPartition.GetTokenBucketLimiter( 1, - _ => - new TokenBucketRateLimiterOptions - { - TokenLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1, - ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), - TokensPerPeriod = 1, - AutoReplenishment = false - } + _ => new TokenBucketRateLimiterOptions + { + TokenLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1, + ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), + TokensPerPeriod = 1, + AutoReplenishment = false + } ); }); @@ -423,18 +421,17 @@ public async Task Create_WithReplenishingLimiterReplenishesAutomatically() // Use the non-specific Create method to make sure ReplenishingRateLimiters are still handled properly return RateLimitPartition.Get( 1, - _ => - new TokenBucketRateLimiter( - new TokenBucketRateLimiterOptions - { - TokenLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1, - ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), - TokensPerPeriod = 1, - AutoReplenishment = false - } - ) + _ => new TokenBucketRateLimiter( + new TokenBucketRateLimiterOptions + { + TokenLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1, + ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), + TokensPerPeriod = 1, + AutoReplenishment = false + } + ) ); }); @@ -454,22 +451,7 @@ public async Task Create_MultipleReplenishingLimitersReplenishAutomatically() { return RateLimitPartition.GetTokenBucketLimiter( 1, - _ => - new TokenBucketRateLimiterOptions - { - TokenLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1, - ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), - TokensPerPeriod = 1, - AutoReplenishment = false - } - ); - } - return RateLimitPartition.GetTokenBucketLimiter( - 2, - _ => - new TokenBucketRateLimiterOptions + _ => new TokenBucketRateLimiterOptions { TokenLimit = 1, QueueProcessingOrder = QueueProcessingOrder.NewestFirst, @@ -478,6 +460,19 @@ public async Task Create_MultipleReplenishingLimitersReplenishAutomatically() TokensPerPeriod = 1, AutoReplenishment = false } + ); + } + return RateLimitPartition.GetTokenBucketLimiter( + 2, + _ => new TokenBucketRateLimiterOptions + { + TokenLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1, + ReplenishmentPeriod = TimeSpan.FromMilliseconds(100), + TokensPerPeriod = 1, + AutoReplenishment = false + } ); }); @@ -505,13 +500,12 @@ public async Task Create_CancellationTokenPassedToUnderlyingLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); }); @@ -636,8 +630,9 @@ public async Task AllIdleLimitersCleanedUp_DisposeThrows() [Fact] public async Task ThrowingTryReplenishDoesNotPreventIdleLimiterBeingCleanedUp() { - CustomizableReplenishingLimiter replenishLimiter = - new CustomizableReplenishingLimiter(); + CustomizableReplenishingLimiter replenishLimiter = new CustomizableReplenishingLimiter( + + ); CustomizableLimiter idleLimiter = null; var factoryCallCount = 0; using var limiter = Utils.CreatePartitionedLimiterWithoutTimer(resource => @@ -703,26 +698,24 @@ public void Translate_AcquirePassesThroughToInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -761,26 +754,24 @@ public async Task Translate_WaitAsyncPassesThroughToInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -819,26 +810,24 @@ public void Translate_GetAvailablePermitsPassesThroughToInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -886,26 +875,24 @@ public void Translate_DisposeDoesNotDisposeInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -937,26 +924,24 @@ public void Translate_DisposeDoesDisposeInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -986,26 +971,24 @@ public async Task Translate_DisposeAsyncDoesNotDisposeInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); @@ -1037,26 +1020,24 @@ public async Task Translate_DisposeAsyncDoesDisposeInnerLimiter() { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } else { return RateLimitPartition.GetConcurrencyLimiter( 1, - _ => - new ConcurrencyLimiterOptions - { - PermitLimit = 1, - QueueProcessingOrder = QueueProcessingOrder.NewestFirst, - QueueLimit = 1 - } + _ => new ConcurrencyLimiterOptions + { + PermitLimit = 1, + QueueProcessingOrder = QueueProcessingOrder.NewestFirst, + QueueLimit = 1 + } ); } }); diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Blocks/JoinBlock.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Blocks/JoinBlock.cs index 6168c4861e1..ce13965e22e 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Blocks/JoinBlock.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/src/Blocks/JoinBlock.cs @@ -1834,9 +1834,9 @@ private void ProcessAsyncIfNecessary_Slow(bool isReplacementReplica) // so that _taskForInputProcessing will be visibly set in the task loop. _taskForInputProcessing = new Task( static thisSharedResources => - ( - (JoinBlockTargetSharedResources)thisSharedResources! - ).ProcessMessagesLoopCore(), + ((JoinBlockTargetSharedResources)thisSharedResources!).ProcessMessagesLoopCore( + + ), this, Common.GetCreationOptionsForTask(isReplacementReplica) ); diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/ActionBlockTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/ActionBlockTests.cs index a757af48510..146352d4287 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/ActionBlockTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/ActionBlockTests.cs @@ -12,32 +12,30 @@ public class ActionBlockTests public void TestToString() { // Test ToString() with the only custom configuration being NameFormat - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new ActionBlock( - i => { }, - new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new ActionBlock(i => { }) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new ActionBlock( + i => { }, + new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new ActionBlock(i => { }) ); // Test ToString() with other configuration - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new ActionBlock( - i => { }, - new ExecutionDataflowBlockOptions() - { - NameFormat = nameFormat, - SingleProducerConstrained = true - } - ) - : new ActionBlock( - i => { }, - new ExecutionDataflowBlockOptions() { SingleProducerConstrained = true } - ) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new ActionBlock( + i => { }, + new ExecutionDataflowBlockOptions() + { + NameFormat = nameFormat, + SingleProducerConstrained = true + } + ) + : new ActionBlock( + i => { }, + new ExecutionDataflowBlockOptions() { SingleProducerConstrained = true } + ) ); } diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BatchedJoinBlockTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BatchedJoinBlockTests.cs index 9a405663cdf..25d48ae93f1 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BatchedJoinBlockTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BatchedJoinBlockTests.cs @@ -131,24 +131,22 @@ public void TestArgumentExceptions() [Fact] public void TestToString() { - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new BatchedJoinBlock( - 2, - new GroupingDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new BatchedJoinBlock(2) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new BatchedJoinBlock( + 2, + new GroupingDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new BatchedJoinBlock(2) ); - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new BatchedJoinBlock( - 3, - new GroupingDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new BatchedJoinBlock(3) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new BatchedJoinBlock( + 3, + new GroupingDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new BatchedJoinBlock(3) ); } diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BufferBlockTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BufferBlockTests.cs index 94bc5228023..c3d370e61fb 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BufferBlockTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/BufferBlockTests.cs @@ -40,13 +40,10 @@ public void TestArgumentExceptions() [Fact] public void TestToString() { - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new BufferBlock( - new DataflowBlockOptions() { NameFormat = nameFormat } - ) - : new BufferBlock() + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new BufferBlock(new DataflowBlockOptions() { NameFormat = nameFormat }) + : new BufferBlock() ); } diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DataflowBlockExtensionTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DataflowBlockExtensionTests.cs index ed09eac60bc..a768c59cf15 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DataflowBlockExtensionTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/DataflowBlockExtensionTests.cs @@ -2021,21 +2021,18 @@ public async Task TestChoose_LinkTracking() unlinkCounts = new int[n]; ISourceBlock[] sources = Enumerable .Range(0, n) - .Select( - i => - new DelegatePropagator + .Select(i => new DelegatePropagator + { + LinkToDelegate = (target, linkOptions) => + { + Interlocked.Increment(ref linkCounts[i]); + return new DelegateDisposable { - LinkToDelegate = (target, linkOptions) => - { - Interlocked.Increment(ref linkCounts[i]); - return new DelegateDisposable - { - DisposeDelegate = () => - Interlocked.Increment(ref unlinkCounts[i]) - }; - } - } - ) + DisposeDelegate = () => + Interlocked.Increment(ref unlinkCounts[i]) + }; + } + }) .ToArray(); var cts = new CancellationTokenSource(); @@ -2090,14 +2087,13 @@ public async Task TestChoose_ManyConcurrent() branch2 = 0; Task[] tasks = Enumerable .Range(0, iterations) - .Select( - _ => - DataflowBlock.Choose( - source1, - x => Interlocked.Increment(ref branch1), - source2, - x => Interlocked.Increment(ref branch2) - ) + .Select(_ => + DataflowBlock.Choose( + source1, + x => Interlocked.Increment(ref branch1), + source2, + x => Interlocked.Increment(ref branch2) + ) ) .ToArray(); diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/JoinBlockTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/JoinBlockTests.cs index dd7bd6cd727..36c20a387fc 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/JoinBlockTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/JoinBlockTests.cs @@ -68,21 +68,19 @@ public void TestCtor3() [Fact] public void TestToString() { - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new JoinBlock( - new GroupingDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new JoinBlock() + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new JoinBlock( + new GroupingDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new JoinBlock() ); - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new JoinBlock( - new GroupingDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new JoinBlock() + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new JoinBlock( + new GroupingDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new JoinBlock() ); } @@ -430,26 +428,23 @@ public async Task TestNonGreedyFailToConsumeReservedMessage() { var sources = Enumerable .Range(0, 2) - .Select( - i => - new DelegatePropagator - { - ReserveMessageDelegate = delegate - { - return true; - }, - ConsumeMessageDelegate = delegate( - DataflowMessageHeader messageHeader, - ITargetBlock target, - out bool messageConsumed - ) - { - messageConsumed = false; // fail consumption of a message already reserved - Assert.Equal(expected: 0, actual: i); // shouldn't get to second source - return 0; - } - } - ) + .Select(i => new DelegatePropagator + { + ReserveMessageDelegate = delegate + { + return true; + }, + ConsumeMessageDelegate = delegate( + DataflowMessageHeader messageHeader, + ITargetBlock target, + out bool messageConsumed + ) + { + messageConsumed = false; // fail consumption of a message already reserved + Assert.Equal(expected: 0, actual: i); // shouldn't get to second source + return 0; + } + }) .ToArray(); var options = new GroupingDataflowBlockOptions { Greedy = false }; diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformBlockTests.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformBlockTests.cs index 464e20c1c77..6955007a193 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformBlockTests.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformBlockTests.cs @@ -73,14 +73,13 @@ public void TestArgumentExceptions() [Fact] public void TestToString() { - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new TransformBlock( - i => i, - new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new TransformBlock(i => i) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new TransformBlock( + i => i, + new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new TransformBlock(i => i) ); } diff --git a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs index ebc8a794580..b474d0de798 100644 --- a/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs +++ b/runtime/src/libraries/System.Threading.Tasks.Dataflow/tests/Dataflow/TransformManyBlockTests.IAsyncEnumerable.cs @@ -60,14 +60,13 @@ public void TestArgumentExceptionsAsyncEnumerable() [Fact] public void TestToStringAsyncEnumerable() { - DataflowTestHelpers.TestToString( - nameFormat => - nameFormat != null - ? new TransformManyBlock( - DataflowTestHelpers.ToAsyncEnumerable, - new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } - ) - : new TransformManyBlock(DataflowTestHelpers.ToAsyncEnumerable) + DataflowTestHelpers.TestToString(nameFormat => + nameFormat != null + ? new TransformManyBlock( + DataflowTestHelpers.ToAsyncEnumerable, + new ExecutionDataflowBlockOptions() { NameFormat = nameFormat } + ) + : new TransformManyBlock(DataflowTestHelpers.ToAsyncEnumerable) ); } diff --git a/runtime/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs b/runtime/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs index 038330c9738..4bb50b3414b 100644 --- a/runtime/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs +++ b/runtime/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs @@ -627,11 +627,10 @@ public void JavaScriptStringEncode_ExplicitDontAddQuotes(string decoded, string public static IEnumerable ParseQueryStringDataQ => ParseQueryStringData - .Select( - a => - new object[] { "?" + (string)a[0] } - .Concat(a.Skip(1)) - .ToArray() + .Select(a => + new object[] { "?" + (string)a[0] } + .Concat(a.Skip(1)) + .ToArray() ) .Concat( new[] diff --git a/runtime/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs b/runtime/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs index 20ec631ed30..469bfbf8b5c 100644 --- a/runtime/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs +++ b/runtime/src/mono/System.Private.CoreLib/src/System/Array.Mono.cs @@ -65,7 +65,9 @@ public static unsafe void Clear(Array array) array.NativeLength * (nuint) (uint) - array.GetElementSize() /* force zero-extension */ + array.GetElementSize( + + ) /* force zero-extension */ ; if (RuntimeHelpers.ObjectHasReferences(array)) diff --git a/runtime/src/mono/sample/wasm/blazor-frame/Program.cs b/runtime/src/mono/sample/wasm/blazor-frame/Program.cs index 99946dc5e79..b372e1ac6d5 100644 --- a/runtime/src/mono/sample/wasm/blazor-frame/Program.cs +++ b/runtime/src/mono/sample/wasm/blazor-frame/Program.cs @@ -10,8 +10,9 @@ builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); -builder.Services.AddScoped( - sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) } -); +builder.Services.AddScoped(sp => new HttpClient +{ + BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) +}); await builder.Build().RunAsync().ConfigureAwait(true); diff --git a/runtime/src/mono/tools/jitdiff/jitdiff.cs b/runtime/src/mono/tools/jitdiff/jitdiff.cs index 9d4830bcf7e..3e636c6ac4f 100644 --- a/runtime/src/mono/tools/jitdiff/jitdiff.cs +++ b/runtime/src/mono/tools/jitdiff/jitdiff.cs @@ -23,10 +23,9 @@ private static void Main(string[] args) foreach (string fileBefore in filesBefore) { string fileName = Path.GetFileName(fileBefore); - string fileAfter = filesAfter.FirstOrDefault( - f => - Path.GetFileName(f) - .Equals(fileName, StringComparison.InvariantCultureIgnoreCase) + string fileAfter = filesAfter.FirstOrDefault(f => + Path.GetFileName(f) + .Equals(fileName, StringComparison.InvariantCultureIgnoreCase) ); if (fileAfter != null) @@ -108,8 +107,8 @@ private static List GetDiffs(string file1, string file2) foreach (FunctionInfo file1Function in file1Functions) { // SingleOrDefault to make sure functions are unique - FunctionInfo file2Function = file2Functions.FirstOrDefault( - f => f.Name == file1Function.Name + FunctionInfo file2Function = file2Functions.FirstOrDefault(f => + f.Name == file1Function.Name ); diffItems.Add(new DiffItem(file1Function, file2Function)); // file2Function can be null here - means function was removed in file2 } @@ -117,8 +116,8 @@ private static List GetDiffs(string file1, string file2) foreach (FunctionInfo file2Function in file2Functions) { // SingleOrDefault to make sure functions are unique - FunctionInfo file1Function = file1Functions.FirstOrDefault( - f => f.Name == file2Function.Name + FunctionInfo file1Function = file1Functions.FirstOrDefault(f => + f.Name == file2Function.Name ); if (file1Function == null) diffItems.Add(new DiffItem(null, file2Function)); // function was added in file2 diff --git a/runtime/src/mono/wasm/Wasm.Build.Tests/Common/HelperExtensions.cs b/runtime/src/mono/wasm/Wasm.Build.Tests/Common/HelperExtensions.cs index 21ce1b660eb..cb2c0743579 100644 --- a/runtime/src/mono/wasm/Wasm.Build.Tests/Common/HelperExtensions.cs +++ b/runtime/src/mono/wasm/Wasm.Build.Tests/Common/HelperExtensions.cs @@ -141,8 +141,8 @@ params string[] names var env = psi.Environment; foreach (string name in names) { - string? key = env.Keys.FirstOrDefault( - k => string.Compare(k, name, StringComparison.OrdinalIgnoreCase) == 0 + string? key = env.Keys.FirstOrDefault(k => + string.Compare(k, name, StringComparison.OrdinalIgnoreCase) == 0 ); if (key is not null) env.Remove("MSBuildSDKsPath"); diff --git a/runtime/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs b/runtime/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs index 1cba482da55..9e8e89c67f2 100644 --- a/runtime/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs +++ b/runtime/src/mono/wasm/Wasm.Build.Tests/ProjectProviderBase.cs @@ -116,8 +116,8 @@ public IReadOnlyDictionary FindAndAssertDotnetFiles( .Order() .ToList(); foreach ( - (string expectedFilename, bool expectFingerprint) in superSet.OrderByDescending( - kvp => kvp.Key + (string expectedFilename, bool expectFingerprint) in superSet.OrderByDescending(kvp => + kvp.Key ) ) { @@ -531,8 +531,8 @@ public void AssertBootJson(AssertBundleOptionsBase options) BootJsonData bootJson = ParseBootData(bootJsonPath); string spcExpectedFilename = $"System.Private.CoreLib{WasmAssemblyExtension}"; string? spcActualFilename = bootJson - .resources.assembly.Keys.Where( - a => Path.GetFileNameWithoutExtension(a) == "System.Private.CoreLib" + .resources.assembly.Keys.Where(a => + Path.GetFileNameWithoutExtension(a) == "System.Private.CoreLib" ) .SingleOrDefault(); if (spcActualFilename is null) diff --git a/runtime/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/LazyLoadingTests.cs b/runtime/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/LazyLoadingTests.cs index c7ae6392667..2f39ace24bd 100644 --- a/runtime/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/LazyLoadingTests.cs +++ b/runtime/src/mono/wasm/Wasm.Build.Tests/TestAppScenarios/LazyLoadingTests.cs @@ -51,8 +51,8 @@ public async Task FailOnMissingLazyAssembly() ) ); Assert.True( - result.ConsoleOutput.Any( - m => m.Contains("Could not load file or assembly") && m.Contains("System.Text.Json") + result.ConsoleOutput.Any(m => + m.Contains("Could not load file or assembly") && m.Contains("System.Text.Json") ), "The lazy loading test didn't emit expected error message" ); diff --git a/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs b/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs index ac079d887b2..cefd9df7e2c 100644 --- a/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs +++ b/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MemberObjectsExplorer.cs @@ -548,11 +548,10 @@ await UpdateBackingFieldWithPropertyAttributes( { // this has `new` keyword if it is newSlot but direct child was not a newSlot: var child = allMembers - .FirstOrDefault( - kvp => - (kvp.Key == propName || kvp.Key.StartsWith($"{propName} (")) - && kvp.Value[InternalUseFieldName.ParentTypeId.Name]?.Value() - == typeId + .FirstOrDefault(kvp => + (kvp.Key == propName || kvp.Key.StartsWith($"{propName} (")) + && kvp.Value[InternalUseFieldName.ParentTypeId.Name]?.Value() + == typeId ) .Value; bool wasOverriddenByDerivedType = @@ -817,8 +816,9 @@ await sdbHelper.GetValuesFromDebuggerProxyAttributeForObject( DotnetObjectId id = new DotnetObjectId("object", objectId); using var commandParamsObjWriter = new MonoBinaryWriter(); commandParamsObjWriter.WriteObj(id, sdbHelper); - ArraySegment getPropertiesParamBuffer = - commandParamsObjWriter.GetParameterBuffer(); + ArraySegment getPropertiesParamBuffer = commandParamsObjWriter.GetParameterBuffer( + + ); var allMembers = new Dictionary(); int typeIdsCnt = typeIdsIncludingParents.Count; diff --git a/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs b/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs index 4460ff00030..f12c16bef19 100644 --- a/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs +++ b/runtime/src/mono/wasm/debugger/BrowserDebugProxy/MonoSDBHelper.cs @@ -3250,16 +3250,14 @@ public async Task GetObjectProxy(int objectId, CancellationToken token) var attrValue = retDebuggerCmdReader.ReadInt32(); //attrs //Console.WriteLine($"{propertyNameStr} - {attrValue}"); if ( - ret.Where( - attribute => - attribute["name"].Value().Equals(propertyNameStr) + ret.Where(attribute => + attribute["name"].Value().Equals(propertyNameStr) ) .Any() ) { - var attr = ret.Where( - attribute => - attribute["name"].Value().Equals(propertyNameStr) + var attr = ret.Where(attribute => + attribute["name"].Value().Equals(propertyNameStr) ) .First(); diff --git a/runtime/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs b/runtime/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs index a665d2027d6..0086adda569 100644 --- a/runtime/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs +++ b/runtime/src/mono/wasm/debugger/DebuggerTestSuite/SteppingTests.cs @@ -2077,20 +2077,18 @@ public async Task SkipWasmFunctionsAccordinglyJustMyCode(bool justMyCode) Assert.False( pause_location["callFrames"] .Value() - .Any( - f => - f?["scopeChain"]?[0]?["type"]?.Value() - ?.Equals("wasm-expression-stack") == true + .Any(f => + f?["scopeChain"]?[0]?["type"]?.Value() + ?.Equals("wasm-expression-stack") == true ) ); else Assert.True( pause_location["callFrames"] .Value() - .Any( - f => - f?["scopeChain"]?[0]?["type"]?.Value() - ?.Equals("wasm-expression-stack") == true + .Any(f => + f?["scopeChain"]?[0]?["type"]?.Value() + ?.Equals("wasm-expression-stack") == true ) ); if (justMyCode && ReleaseRuntime) diff --git a/runtime/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs b/runtime/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs index 83c27c068a0..f2334480d76 100644 --- a/runtime/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs +++ b/runtime/src/mono/wasm/debugger/DebuggerTestSuite/TestHarnessProxy.cs @@ -111,19 +111,18 @@ public static Task Start( { if (options.WebServerUseCors) { - services.AddCors( - o => - o.AddPolicy( - "AnyCors", - builder => - { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .WithExposedHeaders("*"); - } - ) + services.AddCors(o => + o.AddPolicy( + "AnyCors", + builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .WithExposedHeaders("*"); + } + ) ); } services.AddSingleton(Options.Create(options)); diff --git a/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-async-test.cs b/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-async-test.cs index a4cb0f5bfd0..a25f3ec8d9e 100644 --- a/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-async-test.cs +++ b/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-async-test.cs @@ -96,8 +96,7 @@ await Task.Delay(300) }); Console.WriteLine("done with this continueWith"); await Task.Delay(300) - .ContinueWith( - t2 => Console.WriteLine($"t2: {t2.Status}, str: {str}, {dt0}") + .ContinueWith(t2 => Console.WriteLine($"t2: {t2.Status}, str: {str}, {dt0}") ); }); Console.WriteLine($"done with this method"); diff --git a/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs b/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs index 8f413d61fab..19b1aaf7f13 100644 --- a/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs +++ b/runtime/src/mono/wasm/debugger/tests/debugger-test/debugger-test.cs @@ -1794,7 +1794,9 @@ public class GenericCustomAttributeDecoratedClassInheritsFromNonUserCodeClassTha public static void Run() { var myVar = - new GenericCustomAttributeDecoratedClassInheritsFromNonUserCodeClassThatInheritsFromNormalClass(); + new GenericCustomAttributeDecoratedClassInheritsFromNonUserCodeClassThatInheritsFromNormalClass( + + ); myVar.CallMethod(); } diff --git a/runtime/src/mono/wasm/host/DevServer/DevServer.cs b/runtime/src/mono/wasm/host/DevServer/DevServer.cs index 549ea9edf23..6610ef22e78 100644 --- a/runtime/src/mono/wasm/host/DevServer/DevServer.cs +++ b/runtime/src/mono/wasm/host/DevServer/DevServer.cs @@ -39,19 +39,18 @@ CancellationToken token { if (options.WebServerUseCors) { - services.AddCors( - o => - o.AddPolicy( - "AnyCors", - builder => - { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .WithExposedHeaders("*"); - } - ) + services.AddCors(o => + o.AddPolicy( + "AnyCors", + builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .WithExposedHeaders("*"); + } + ) ); } services.AddSingleton(logger); diff --git a/runtime/src/mono/wasm/host/WebServer.cs b/runtime/src/mono/wasm/host/WebServer.cs index e21202699f9..d50c71d1428 100644 --- a/runtime/src/mono/wasm/host/WebServer.cs +++ b/runtime/src/mono/wasm/host/WebServer.cs @@ -41,19 +41,18 @@ CancellationToken token { if (options.WebServerUseCors) { - services.AddCors( - o => - o.AddPolicy( - "AnyCors", - builder => - { - builder - .AllowAnyOrigin() - .AllowAnyMethod() - .AllowAnyHeader() - .WithExposedHeaders("*"); - } - ) + services.AddCors(o => + o.AddPolicy( + "AnyCors", + builder => + { + builder + .AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .WithExposedHeaders("*"); + } + ) ); } services.AddSingleton(logger); @@ -96,8 +95,9 @@ public static void ResolveServerUrlsOnApplicationStarted( TaskCompletionSource tcs = realUrlsAvailableTcs; try { - ICollection? addresses = - app.ServerFeatures.Get()?.Addresses; + ICollection? addresses = app.ServerFeatures.Get( + + )?.Addresses; string? ipAddress = null; string? ipAddressSecure = null; @@ -125,12 +125,11 @@ public static void ResolveServerUrlsOnApplicationStarted( static string? GetHttpServerAddress(ICollection addresses, bool secure) => addresses - ?.Where( - a => - a.StartsWith( - secure ? "https:" : "http:", - StringComparison.InvariantCultureIgnoreCase - ) + ?.Where(a => + a.StartsWith( + secure ? "https:" : "http:", + StringComparison.InvariantCultureIgnoreCase + ) ) .Select(a => new Uri(a)) .Select(uri => uri.ToString()) diff --git a/runtime/src/mono/wasm/testassets/Blazor_net50/Program.cs b/runtime/src/mono/wasm/testassets/Blazor_net50/Program.cs index d82373df5db..da1aa04dc72 100644 --- a/runtime/src/mono/wasm/testassets/Blazor_net50/Program.cs +++ b/runtime/src/mono/wasm/testassets/Blazor_net50/Program.cs @@ -17,9 +17,10 @@ public static async Task Main(string[] args) var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); - builder.Services.AddScoped( - sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) } - ); + builder.Services.AddScoped(sp => new HttpClient + { + BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) + }); await builder.Build().RunAsync(); } diff --git a/runtime/src/tasks/AotCompilerTask/MonoAOTCompiler.cs b/runtime/src/tasks/AotCompilerTask/MonoAOTCompiler.cs index 0f08346fff0..b10c694490c 100644 --- a/runtime/src/tasks/AotCompilerTask/MonoAOTCompiler.cs +++ b/runtime/src/tasks/AotCompilerTask/MonoAOTCompiler.cs @@ -704,8 +704,8 @@ IEnumerable assemblies { string firstAsmDir = Path.GetDirectoryName(assemblies.First().GetMetadata("FullPath")) ?? string.Empty; - bool allInSameDir = assemblies.All( - asm => Path.GetDirectoryName(asm.GetMetadata("FullPath")) == firstAsmDir + bool allInSameDir = assemblies.All(asm => + Path.GetDirectoryName(asm.GetMetadata("FullPath")) == firstAsmDir ); if (allInSameDir) return assemblies; diff --git a/runtime/src/tasks/Common/AndroidSdkHelper.cs b/runtime/src/tasks/Common/AndroidSdkHelper.cs index 9be40677590..0fd2c4597ca 100644 --- a/runtime/src/tasks/Common/AndroidSdkHelper.cs +++ b/runtime/src/tasks/Common/AndroidSdkHelper.cs @@ -59,11 +59,10 @@ private static string GetLatestApiLevel(string androidSdkDir) { return Directory .GetDirectories(Path.Combine(androidSdkDir, "platforms")) - .Select( - file => - int.TryParse(Path.GetFileName(file).Replace("android-", ""), out int apiLevel) - ? apiLevel - : -1 + .Select(file => + int.TryParse(Path.GetFileName(file).Replace("android-", ""), out int apiLevel) + ? apiLevel + : -1 ) .OrderByDescending(v => v) .FirstOrDefault() diff --git a/runtime/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs b/runtime/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs index ebe70f2c755..e61c8dabc7a 100644 --- a/runtime/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs +++ b/runtime/src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/ComputeWasmPublishAssets.cs @@ -249,10 +249,8 @@ out var removed else if (baseName.StartsWith("dotnet")) baseName = "dotnet"; - var aotDotNetJs = WasmAotAssets.SingleOrDefault( - a => - $"{a.GetMetadata("FileName")}{a.GetMetadata("Extension")}" - == $"{baseName}.js" + var aotDotNetJs = WasmAotAssets.SingleOrDefault(a => + $"{a.GetMetadata("FileName")}{a.GetMetadata("Extension")}" == $"{baseName}.js" ); ITaskItem newDotNetJs = null; if (aotDotNetJs != null) diff --git a/runtime/src/tasks/Microsoft.NET.WebAssembly.Webcil/WebcilReader.Reflection.cs b/runtime/src/tasks/Microsoft.NET.WebAssembly.Webcil/WebcilReader.Reflection.cs index 9f439968c07..6fa6e166d7e 100644 --- a/runtime/src/tasks/Microsoft.NET.WebAssembly.Webcil/WebcilReader.Reflection.cs +++ b/runtime/src/tasks/Microsoft.NET.WebAssembly.Webcil/WebcilReader.Reflection.cs @@ -16,8 +16,8 @@ public sealed partial class WebcilReader // Helpers to call into System.Reflection.Metadata internals internal static class Reflection { - private static readonly Lazy s_readUtf8NullTerminated = - new Lazy(() => + private static readonly Lazy s_readUtf8NullTerminated = new Lazy( + () => { var mi = typeof(BlobReader).GetMethod( "ReadUtf8NullTerminated", @@ -30,7 +30,8 @@ internal static class Reflection ); } return mi; - }); + } + ); internal static string? ReadUtf8NullTerminated(ref BlobReader reader) { diff --git a/runtime/src/tasks/WasmAppBuilder/PInvokeCollector.cs b/runtime/src/tasks/WasmAppBuilder/PInvokeCollector.cs index 1f39fcfd406..2c04ee320be 100644 --- a/runtime/src/tasks/WasmAppBuilder/PInvokeCollector.cs +++ b/runtime/src/tasks/WasmAppBuilder/PInvokeCollector.cs @@ -130,11 +130,11 @@ void CollectPInvokesForMethod(MethodInfo method) { if ((method.Attributes & MethodAttributes.PinvokeImpl) != 0) { - var dllimport = method.CustomAttributes.First( - attr => attr.AttributeType.Name == "DllImportAttribute" + var dllimport = method.CustomAttributes.First(attr => + attr.AttributeType.Name == "DllImportAttribute" ); - var wasmLinkage = method.CustomAttributes.Any( - attr => attr.AttributeType.Name == "WasmImportLinkageAttribute" + var wasmLinkage = method.CustomAttributes.Any(attr => + attr.AttributeType.Name == "WasmImportLinkageAttribute" ); var module = (string)dllimport.ConstructorArguments[0].Value!; var entrypoint = (string) diff --git a/runtime/src/tasks/installer.tasks/RegenerateDownloadTable.cs b/runtime/src/tasks/installer.tasks/RegenerateDownloadTable.cs index 4b7d7fa560e..51677de3fbd 100644 --- a/runtime/src/tasks/installer.tasks/RegenerateDownloadTable.cs +++ b/runtime/src/tasks/installer.tasks/RegenerateDownloadTable.cs @@ -64,8 +64,8 @@ public override bool Execute() .Skip(1) .TakeWhile(line => line != End(LinksComment)) .Where(line => line.StartsWith("[") && line.Contains("]:")) - .Select( - line => line.Substring(1, line.IndexOf("]:", StringComparison.Ordinal) - 1) + .Select(line => + line.Substring(1, line.IndexOf("]:", StringComparison.Ordinal) - 1) ) .ToArray(); diff --git a/runtime/src/tasks/installer.tasks/StaticFileRegeneration/RegenerateThirdPartyNotices.cs b/runtime/src/tasks/installer.tasks/StaticFileRegeneration/RegenerateThirdPartyNotices.cs index 4e6021da208..66354cc7e87 100644 --- a/runtime/src/tasks/installer.tasks/StaticFileRegeneration/RegenerateThirdPartyNotices.cs +++ b/runtime/src/tasks/installer.tasks/StaticFileRegeneration/RegenerateThirdPartyNotices.cs @@ -57,16 +57,13 @@ public async Task ExecuteAsync(HttpClient client) item.GetMetadata("Branch") ?? throw new ArgumentException($"{item.ItemSpec} specifies no Branch."); - return PotentialTpnPaths.Select( - path => - new - { - Repo = repo, - Branch = branch, - PotentialPath = path, - Url = $"{GitHubRawContentBaseUrl}{repo}/{branch}/{path}" - } - ); + return PotentialTpnPaths.Select(path => new + { + Repo = repo, + Branch = branch, + PotentialPath = path, + Url = $"{GitHubRawContentBaseUrl}{repo}/{branch}/{path}" + }); }) .Select(async c => { diff --git a/runtime/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs b/runtime/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs index 8f453094c69..a2bb30b552e 100644 --- a/runtime/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs +++ b/runtime/src/tests/Common/XUnitWrapperGenerator/XUnitWrapperGenerator.cs @@ -151,8 +151,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context) compilation.GetAssemblyOrModuleSymbol(reference) )!; ImmutableArray tests = ImmutableArray.CreateRange( - testMethods.SelectMany( - method => GetTestMethodInfosForMethod(method, configOptions, aliasMap) + testMethods.SelectMany(method => + GetTestMethodInfosForMethod(method, configOptions, aliasMap) ) ); if ( @@ -1250,10 +1250,9 @@ string alias continue; } var argsAsCode = ImmutableArray.CreateRange( - args.Select( - a => - a.ToCSharpString() - + (a.Type!.SpecialType == SpecialType.System_Single ? "F" : "") + args.Select(a => + a.ToCSharpString() + + (a.Type!.SpecialType == SpecialType.System_Single ? "F" : "") ) ); testCasesBuilder.Add(new BasicTestMethod(method, alias, arguments: argsAsCode)); @@ -1395,9 +1394,8 @@ bool negate { string condition = string.Join( "&&", - values.Select( - v => - $"{externAlias}::{conditionType.ToDisplayString(FullyQualifiedWithoutGlobalNamespace)}.{v.Value}" + values.Select(v => + $"{externAlias}::{conditionType.ToDisplayString(FullyQualifiedWithoutGlobalNamespace)}.{v.Value}" ) ); if (negate) diff --git a/runtime/src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/InteropTestsWebsite/TestServiceImpl.cs b/runtime/src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/InteropTestsWebsite/TestServiceImpl.cs index d9ae452a5b9..b532928cfed 100644 --- a/runtime/src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/InteropTestsWebsite/TestServiceImpl.cs +++ b/runtime/src/tests/FunctionalTests/Android/Device_Emulator/gRPC/grpc-dotnet/testassets/InteropTestsWebsite/TestServiceImpl.cs @@ -174,13 +174,8 @@ private static void EnsureCompression(BoolValue expectCompressed, ServerCallCont // Get grpc-encoding from HttpContext instead var encoding = context .GetHttpContext() - .Request.Headers.SingleOrDefault( - h => - string.Equals( - h.Key, - "grpc-encoding", - StringComparison.OrdinalIgnoreCase - ) + .Request.Headers.SingleOrDefault(h => + string.Equals(h.Key, "grpc-encoding", StringComparison.OrdinalIgnoreCase) ) .Value.SingleOrDefault(); if (expectCompressed.Value) diff --git a/runtime/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs b/runtime/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs index c3f6302898d..67ed03d57ae 100644 --- a/runtime/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs +++ b/runtime/src/tests/Interop/DllImportAttribute/DllImportPath/DllImportPathTest.cs @@ -151,11 +151,10 @@ private static void SetupUnicodeTest() var info = new DirectoryInfo(currentDirectory); var file = info.EnumerateFiles("*DllImportPath_Local*", SearchOption.TopDirectoryOnly) - .FirstOrDefault( - localFile => - localFile.Extension == ".dll" - || localFile.Extension == ".so" - || localFile.Extension == ".dylib" + .FirstOrDefault(localFile => + localFile.Extension == ".dll" + || localFile.Extension == ".so" + || localFile.Extension == ".dylib" ); var unicodeFileLocation = file.FullName.Replace("DllImportPath_Local", UnicodeFileName); diff --git a/runtime/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs b/runtime/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs index 15ec183d6e5..ea669c7434e 100644 --- a/runtime/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs +++ b/runtime/src/tests/Interop/StructMarshalling/ReversePInvoke/MarshalExpStruct/DelegatePInvoke/DelegatePInvokeTest.cs @@ -226,8 +226,9 @@ private static void TestMethod_DelegatePInvoke_MarshalByRef_Cdecl(StructID struc 64.0F, 6.4 ); - DelegateCdeclByRef_U caller_U = - Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr(); + DelegateCdeclByRef_U caller_U = Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr( + + ); Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByRefU_Cdecl_FuncPtr..."); Assert.True(caller_U(ref sourceU)); Assert.True( @@ -811,8 +812,9 @@ private static void TestMethod_DelegatePInvoke_MarshalByVal_Cdecl(StructID struc 32.0F, 3.2 ); - DelegateCdeclByVal_U caller_U = - Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr(); + DelegateCdeclByVal_U caller_U = Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr( + + ); Console.WriteLine("Calling Get_MarshalStructAsParam_AsExpByValU_Cdecl_FuncPtr..."); Assert.True(caller_U(sourceU)); Assert.True( diff --git a/runtime/src/tests/JIT/Generics/Coverage/chaos55915408cs.cs b/runtime/src/tests/JIT/Generics/Coverage/chaos55915408cs.cs index 27e175351e8..f8963c8e5b4 100644 --- a/runtime/src/tests/JIT/Generics/Coverage/chaos55915408cs.cs +++ b/runtime/src/tests/JIT/Generics/Coverage/chaos55915408cs.cs @@ -275,9 +275,9 @@ public void CreateAllTypesA0A1() v0.VerifyInterfaceIA1(); A0 v1 = new A0(); v1.VerifyInterfaceGenericIA1>(); - A0.VerifyA0NotInlinedGenericStatic< - A0A0A0>>>>> - >(); + A0.VerifyA0NotInlinedGenericStatic>>>>>>( + + ); A0.VerifyA0NotInlinedStatic(); A0.VerifyA0GenericStatic>(); A0.VerifyA0Static(); @@ -313,9 +313,9 @@ public void CreateAllTypesA0A1() i14.VerifyInterfaceGenericIA1>(); A0A1.VerifyA0A1NotInlinedGenericStatic(); A0A1>>>>>>.VerifyA0A1NotInlinedStatic(); - A0A1< - A0A0A0>>>>> - >.VerifyA0A1GenericStatic(); + A0A1>>>>>>.VerifyA0A1GenericStatic( + + ); A0A1>>>>>>.VerifyA0A1Static(); A0A1>>>>>> v15 = new A0A1>>>>>>(); @@ -493,9 +493,9 @@ public void CreateAllTypesA0A0A0() A0A1>>>>>> >(); A0A0.VerifyA0A0NotInlinedStatic(); - A0A0.VerifyA0A0GenericStatic< - A0A1>>>>>> - >(); + A0A0.VerifyA0A0GenericStatic>>>>>>>( + + ); A0A0.VerifyA0A0Static(); A0A0 v9 = new A0A0(); v9.VerifyA0A0NotInlinedGeneric(); diff --git a/runtime/src/tests/JIT/Generics/Coverage/chaos65204782cs.cs b/runtime/src/tests/JIT/Generics/Coverage/chaos65204782cs.cs index 49584de7672..3b06fe53955 100644 --- a/runtime/src/tests/JIT/Generics/Coverage/chaos65204782cs.cs +++ b/runtime/src/tests/JIT/Generics/Coverage/chaos65204782cs.cs @@ -1489,9 +1489,9 @@ public void CreateAllTypesA0A3A6() > >, A0A0A0>> - >.VerifyA0A1A2A3NotInlinedGenericStatic< - A0A1A4, A0A3A6> - >(); + >.VerifyA0A1A2A3NotInlinedGenericStatic, A0A3A6>>( + + ); A0A1A2A3>>>>.VerifyA0A1A2A3NotInlinedStatic(); A0A1A2A3< A0, @@ -1926,9 +1926,9 @@ public void CreateAllTypesA0() > > >.VerifyA0A1NotInlinedStatic(); - A0A1.VerifyA0A1GenericStatic< - A0A0A0>>>> - >(); + A0A1.VerifyA0A1GenericStatic>>>>>( + + ); A0A1.VerifyA0A1Static(); A0A1 v21 = new A0A1(); v21.VerifyA0A1NotInlinedGeneric>>>>>(); @@ -2760,9 +2760,9 @@ public void CreateAllTypesA0A0A0A1() i19.VerifyInterfaceIA2(); IA2 i20 = ((IA2)(new A0A0())); i20.VerifyInterfaceGenericIA2(); - A0A1>>.VerifyA0A1NotInlinedGenericStatic< - A0A4> - >(); + A0A1>>.VerifyA0A1NotInlinedGenericStatic>>( + + ); A0A1< A0A1A2A3< A0A0A1A2, @@ -3241,9 +3241,9 @@ public void CreateAllTypesA0A0A0A1() v45.VerifyA0A4NotInlinedGeneric>>>>(); A0A4> v46 = new A0A4>(); v46.VerifyA0A4NotInlined(); - A0A0A3>>.VerifyA0A0A3NotInlinedGenericStatic< - A0A0A3>> - >(); + A0A0A3>>.VerifyA0A0A3NotInlinedGenericStatic>>>( + + ); A0A0A3< A0A0A0A1< A0A1>>>, @@ -3932,9 +3932,9 @@ public void CreateAllTypesA0A0A1() A0A1> v21 = new A0A1>(); v21.VerifyA0A1NotInlinedGeneric>>(); A0A1, IA1A2A5, A0A0A3>>>>> v22 = - new A0A1< - A0A0A0A1, IA1A2A5, A0A0A3>>>> - >(); + new A0A1, IA1A2A5, A0A0A3>>>>>( + + ); v22.VerifyA0A1NotInlined(); IA2 i23 = ((IA2)(new A0A1())); i23.VerifyInterfaceIA2(); @@ -4192,14 +4192,14 @@ public void CreateAllTypesA0A0A1() A0A4>>>.VerifyA0A4GenericStatic(); A0A4>.VerifyA0A4Static(); A0A4, IA1A2A5, A0A0A3>>>>> v45 = - new A0A4< - A0A0A0A1, IA1A2A5, A0A0A3>>>> - >(); + new A0A4, IA1A2A5, A0A0A3>>>>>( + + ); v45.VerifyA0A4NotInlinedGeneric(); A0A4, IA1A2A5, A0A0A3>>>>> v46 = - new A0A4< - A0A0A0A1, IA1A2A5, A0A0A3>>>> - >(); + new A0A4, IA1A2A5, A0A0A3>>>>>( + + ); v46.VerifyA0A4NotInlined(); A0A0A3.VerifyA0A0A3NotInlinedGenericStatic>>>(); A0A0A3>.VerifyA0A0A3NotInlinedStatic(); @@ -4282,10 +4282,9 @@ public void CreateAllTypesA0A0A1() >.VerifyA0A1A4GenericStatic>>>(); A0A1A4>>, A0A0A1A2>.VerifyA0A1A4Static(); A0A1A4>>, A0A0A1A2>, IA1A2>> v49 = - new A0A1A4< - A0A1A4>>, A0A0A1A2>, - IA1A2> - >(); + new A0A1A4>>, A0A0A1A2>, IA1A2>>( + + ); v49.VerifyA0A1A4NotInlinedGeneric(); A0A1A4< A0A0A0A1, IA1A2A5, A0A0A3>>>>, @@ -4296,9 +4295,9 @@ public void CreateAllTypesA0A0A1() A0A0A1A2 >(); v50.VerifyA0A1A4NotInlined(); - A0A0A0A1.VerifyA0A0A0A1NotInlinedGenericStatic< - A0A3A6>> - >(); + A0A0A0A1.VerifyA0A0A0A1NotInlinedGenericStatic>>>( + + ); A0A0A0A1< A0A0A0>>, A0A0A0>> @@ -7776,10 +7775,9 @@ public void CreateAllTypesA0A0A0A0A0() A0A1A2A3>>>> >(); A0A1A4>, A0A0A0A1>>, A0A0> v50 = - new A0A1A4< - A0A1A4>, A0A0A0A1>>, - A0A0 - >(); + new A0A1A4>, A0A0A0A1>>, A0A0>( + + ); v50.VerifyA0A1A4NotInlined(); A0A0A0A1>>>, IA1>.VerifyA0A0A0A1NotInlinedGenericStatic< A0A0A0A1>>>, IA1> @@ -8199,9 +8197,9 @@ public void CreateAllTypesA0A0A1A2() IA2 i31 = ((IA2)(new A0A3())); i31.VerifyInterfaceIA2(); IA2 i32 = ((IA2)(new A0A3())); - i32.VerifyInterfaceGenericIA2< - A0A1A2A3, A0A0A0A0>> - >(); + i32.VerifyInterfaceGenericIA2, A0A0A0A0>>>( + + ); A0A0A1.VerifyA0A0A1NotInlinedGenericStatic< A0A1A4, A0A3A6> >(); @@ -8234,9 +8232,9 @@ public void CreateAllTypesA0A0A1A2() IA2 i39 = ((IA2)(new A0A1A2>>())); i39.VerifyInterfaceIA2(); IA2 i40 = ((IA2)(new A0A1A2>())); - i40.VerifyInterfaceGenericIA2< - A0A1A2A3, A0A0A0A0>> - >(); + i40.VerifyInterfaceGenericIA2, A0A0A0A0>>>( + + ); A0A0A0A0>.VerifyA0A0A0A0NotInlinedGenericStatic>(); A0A0A0A0< A0A4< @@ -8899,9 +8897,9 @@ public void CreateAllTypesA0A1A4() >(); A0A0A0A0>>>>>>.VerifyA0A0A0A0Static(); A0A0A0A0 v41 = new A0A0A0A0(); - v41.VerifyA0A0A0A0NotInlinedGeneric< - A0A0A3>>>>> - >(); + v41.VerifyA0A0A0A0NotInlinedGeneric>>>>>>( + + ); A0A0A0A0 v42 = new A0A0A0A0(); v42.VerifyA0A0A0A0NotInlined(); IA2 i43 = ( @@ -9946,10 +9944,9 @@ public void CreateAllTypesA0A4() A0A1A2>>>, A0A1A4, A0A0A1>>, A0A0A0A1> >.VerifyA0A1A2A3NotInlinedGenericStatic>>>>(); - A0A1A2A3< - A0A0A1A2, - A0A0A0A0>> - >.VerifyA0A1A2A3NotInlinedStatic(); + A0A1A2A3, A0A0A0A0>>>.VerifyA0A1A2A3NotInlinedStatic( + + ); A0A1A2A3< A0A1A4, A0A0A1>>, A0A0A0A1>, A0A0A0A0>> @@ -9965,10 +9962,9 @@ public void CreateAllTypesA0A4() new A0A1A2A3>>>, A0A4>(); v57.VerifyA0A1A2A3NotInlinedGeneric>>>>(); A0A1A2A3, A0A1A2A3>>>, A0A4>> v58 = - new A0A1A2A3< - A0A4, - A0A1A2A3>>>, A0A4> - >(); + new A0A1A2A3, A0A1A2A3>>>, A0A4>>( + + ); v58.VerifyA0A1A2A3NotInlined(); A0A0A0A0A0< A0A0A0A0>>, @@ -9992,10 +9988,9 @@ public void CreateAllTypesA0A4() A0A0A0A0A0, A0A0A0>>> >(); A0A0A0A0A0>>, A0A1>>>> v60 = - new A0A0A0A0A0< - A0A0A0A0>>, - A0A1>>> - >(); + new A0A0A0A0A0>>, A0A1>>>>( + + ); v60.VerifyA0A0A0A0A0NotInlined(); } } @@ -11266,10 +11261,9 @@ public void CreateAllTypesA0A1A2A3() A0A0A0A1>>>.VerifyA0A0A0A1NotInlinedGenericStatic< A0A1A2A3, A0A0A0A0A0>>>>> >(); - A0A0A0A1< - A0A4>, - A0A0A3>> - >.VerifyA0A0A0A1NotInlinedStatic(); + A0A0A0A1>, A0A0A3>>>.VerifyA0A0A0A1NotInlinedStatic( + + ); A0A0A0A1< A0A1A2A3, A0A0A0A0A0>>>>>, A0A0A0A0>>> @@ -11598,9 +11592,9 @@ public void CreateAllTypesA0A1() v22.VerifyA0A1NotInlined(); IA2 i23 = ( (IA2)( - new A0A1< - A0A1A4>>>>, IA1A2>> - >() + new A0A1>>>>, IA1A2>>>( + + ) ) ); i23.VerifyInterfaceIA2(); @@ -14834,9 +14828,9 @@ public void CreateAllTypesA0A0A3() A0A1A2>>.VerifyA0A1A2Static(); A0A1A2>>>> v37 = new A0A1A2>>>>(); - v37.VerifyA0A1A2NotInlinedGeneric< - A0A1A2>>>> - >(); + v37.VerifyA0A1A2NotInlinedGeneric>>>>>( + + ); A0A1A2>> v38 = new A0A1A2>>(); v38.VerifyA0A1A2NotInlined(); IA2 i39 = ((IA2)(new A0A1A2())); @@ -14851,9 +14845,9 @@ public void CreateAllTypesA0A0A3() >() ) ); - i40.VerifyInterfaceGenericIA2< - A0A0A0>>>>>> - >(); + i40.VerifyInterfaceGenericIA2>>>>>>>( + + ); A0A0A0A0.VerifyA0A0A0A0NotInlinedGenericStatic< A0A0A0A1>>> >(); @@ -14959,9 +14953,9 @@ public void CreateAllTypesA0A0A3() A0A1A2< A0A0A0A0A0>>, A0A1>>>> > - >.VerifyA0A0A0A1GenericStatic< - A0A0A0>>>>>> - >(); + >.VerifyA0A0A0A1GenericStatic>>>>>>>( + + ); A0A0A0A1.VerifyA0A0A0A1Static(); A0A0A0A1< A0A0A0A0A0>>, A0A1>>>>, diff --git a/runtime/src/tests/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Int32.cs b/runtime/src/tests/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Int32.cs index b00c39dc5f5..19c7d3cc036 100644 --- a/runtime/src/tests/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Int32.cs +++ b/runtime/src/tests/JIT/HardwareIntrinsics/X86/Sse2/ConvertToInt32WithTruncation.Int32.cs @@ -21,7 +21,9 @@ public static partial class Program private static void ConvertToInt32WithTruncationInt32Vector128Double() { var test = - new SimdScalarUnaryOpConvertTest__ConvertToInt32WithTruncationInt32Vector128Double(); + new SimdScalarUnaryOpConvertTest__ConvertToInt32WithTruncationInt32Vector128Double( + + ); if (test.IsSupported && (true)) { @@ -300,7 +302,9 @@ public void RunClassLclFldScenario() TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = - new SimdScalarUnaryOpConvertTest__ConvertToInt32WithTruncationInt32Vector128Double(); + new SimdScalarUnaryOpConvertTest__ConvertToInt32WithTruncationInt32Vector128Double( + + ); var result = Sse2.ConvertToInt32WithTruncation(test._fld); ValidateResult(test._fld, result); diff --git a/runtime/src/tests/JIT/HardwareIntrinsics/X86_Avx/Avx1/DotProduct.cs b/runtime/src/tests/JIT/HardwareIntrinsics/X86_Avx/Avx1/DotProduct.cs index c60116106be..e0204f7e957 100644 --- a/runtime/src/tests/JIT/HardwareIntrinsics/X86_Avx/Avx1/DotProduct.cs +++ b/runtime/src/tests/JIT/HardwareIntrinsics/X86_Avx/Avx1/DotProduct.cs @@ -38,13 +38,9 @@ public static unsafe void DotProduct() if ( !floatTable.CheckResult( (x, y, z) => - z.All( - result => - result - == (x[0] * y[0]) - + (x[1] * y[1]) - + (x[2] * y[2]) - + (x[3] * y[3]) + z.All(result => + result + == (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]) + (x[3] * y[3]) ) ) ) @@ -64,9 +60,8 @@ public static unsafe void DotProduct() if ( !floatTable.CheckResult( (x, y, z) => - z.All( - result => - result == (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]) + z.All(result => + result == (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]) ) ) ) @@ -137,13 +132,9 @@ public static unsafe void DotProduct() if ( !floatTable.CheckResult( (x, y, z) => - z.All( - result => - result - == (x[0] * y[0]) - + (x[1] * y[1]) - + (x[2] * y[2]) - + (x[3] * y[3]) + z.All(result => + result + == (x[0] * y[0]) + (x[1] * y[1]) + (x[2] * y[2]) + (x[3] * y[3]) ) ) ) diff --git a/runtime/src/tests/JIT/Intrinsics/TypeIntrinsics.IsAssignableTo.cs b/runtime/src/tests/JIT/Intrinsics/TypeIntrinsics.IsAssignableTo.cs index 204cce4a825..ff0145d35fa 100644 --- a/runtime/src/tests/JIT/Intrinsics/TypeIntrinsics.IsAssignableTo.cs +++ b/runtime/src/tests/JIT/Intrinsics/TypeIntrinsics.IsAssignableTo.cs @@ -265,10 +265,9 @@ public static void TestIsAssignableTo() IsAssignableTo, KeyValuePair>() ); IsFalse( - IsAssignableTo< - IDictionary, - IDictionary - >() + IsAssignableTo, IDictionary>( + + ) ); IsFalse(IsAssignableTo, IDictionary>()); IsFalse( diff --git a/runtime/src/tests/JIT/Stress/ABI/Program.cs b/runtime/src/tests/JIT/Stress/ABI/Program.cs index 0524eb5514e..56987e6fd8a 100644 --- a/runtime/src/tests/JIT/Stress/ABI/Program.cs +++ b/runtime/src/tests/JIT/Stress/ABI/Program.cs @@ -133,8 +133,8 @@ static void Usage() int numRejected = tcel.FailureReasons.Values.Sum(); Console.WriteLine("{0} rejected tailcalls. Breakdown:", numRejected); foreach ( - var (reason, count) in tcel.FailureReasons.OrderByDescending( - kvp => kvp.Value + var (reason, count) in tcel.FailureReasons.OrderByDescending(kvp => + kvp.Value ) ) Console.WriteLine( diff --git a/runtime/src/tests/Loader/binding/tracing/BinderEventListener.cs b/runtime/src/tests/Loader/binding/tracing/BinderEventListener.cs index 3c978bd4f72..658ba8b1e4b 100644 --- a/runtime/src/tests/Loader/binding/tracing/BinderEventListener.cs +++ b/runtime/src/tests/Loader/binding/tracing/BinderEventListener.cs @@ -191,11 +191,10 @@ public BindOperation[] WaitAndGetEventsForAssembly(AssemblyName assemblyName) { lock (eventsLock) { - var events = bindOperations.Values.Where( - e => - e.Completed - && Helpers.AssemblyNamesMatch(e.AssemblyName, assemblyName) - && !e.Nested + var events = bindOperations.Values.Where(e => + e.Completed + && Helpers.AssemblyNamesMatch(e.AssemblyName, assemblyName) + && !e.Nested ); if (events.Any()) { @@ -399,8 +398,8 @@ object GetData(string name) private bool IsLoadToTrack(string name) { - return this.loadsToTrack.Any( - n => n.Equals(name, StringComparison.InvariantCultureIgnoreCase) + return this.loadsToTrack.Any(n => + n.Equals(name, StringComparison.InvariantCultureIgnoreCase) ); } diff --git a/runtime/src/tests/Loader/binding/tracing/BinderTracingTest.cs b/runtime/src/tests/Loader/binding/tracing/BinderTracingTest.cs index 30cc75abdec..f77345afbc9 100644 --- a/runtime/src/tests/Loader/binding/tracing/BinderTracingTest.cs +++ b/runtime/src/tests/Loader/binding/tracing/BinderTracingTest.cs @@ -86,11 +86,10 @@ public static bool RunAllTests() { MethodInfo[] methods = typeof(BinderTracingTest) .GetMethods(BindingFlags.Public | BindingFlags.Static) - .Where( - m => - m.GetCustomAttribute() != null - && m.ReturnType == typeof(BindOperation) - && m.GetCustomAttribute().ActiveIssue == null + .Where(m => + m.GetCustomAttribute() != null + && m.ReturnType == typeof(BindOperation) + && m.GetCustomAttribute().ActiveIssue == null ) .ToArray(); diff --git a/runtime/src/tests/Loader/classloader/nesting/coreclr/vsw491577.cs b/runtime/src/tests/Loader/classloader/nesting/coreclr/vsw491577.cs index 048e29d68f9..a833087ba4d 100644 --- a/runtime/src/tests/Loader/classloader/nesting/coreclr/vsw491577.cs +++ b/runtime/src/tests/Loader/classloader/nesting/coreclr/vsw491577.cs @@ -16,7 +16,9 @@ public class Test_vsw491577 public static void TestEntryPoint() { MyClass0.MyClass1.MyClass2.MyClass3.MyClass4.MyClass5.MyClass6.MyClass7.MyClass8.MyClass9.MyClass10.MyClass11.MyClass12.MyClass13.MyClass14.MyClass15.MyClass16.MyClass17.MyClass18.MyClass19.MyClass20.MyClass21.MyClass22.MyClass23.MyClass24.MyClass25.MyClass26.MyClass27.MyClass28.MyClass29.MyClass30.MyClass31.MyClass32.MyClass33.MyClass34.MyClass35.MyClass36.MyClass37.MyClass38.MyClass39.MyClass40.MyClass41.MyClass42.MyClass43.MyClass44.MyClass45.MyClass46.MyClass47.MyClass48.MyClass49.MyClass50.MyClass51.MyClass52.MyClass53.MyClass54.MyClass55.MyClass56.MyClass57.MyClass58.MyClass59.MyClass60.MyClass61.MyClass62.MyClass63.MyClass64.MyClass65.MyClass66.MyClass67.MyClass68.MyClass69.MyClass70.MyClass71.MyClass72 obj = - new MyClass0.MyClass1.MyClass2.MyClass3.MyClass4.MyClass5.MyClass6.MyClass7.MyClass8.MyClass9.MyClass10.MyClass11.MyClass12.MyClass13.MyClass14.MyClass15.MyClass16.MyClass17.MyClass18.MyClass19.MyClass20.MyClass21.MyClass22.MyClass23.MyClass24.MyClass25.MyClass26.MyClass27.MyClass28.MyClass29.MyClass30.MyClass31.MyClass32.MyClass33.MyClass34.MyClass35.MyClass36.MyClass37.MyClass38.MyClass39.MyClass40.MyClass41.MyClass42.MyClass43.MyClass44.MyClass45.MyClass46.MyClass47.MyClass48.MyClass49.MyClass50.MyClass51.MyClass52.MyClass53.MyClass54.MyClass55.MyClass56.MyClass57.MyClass58.MyClass59.MyClass60.MyClass61.MyClass62.MyClass63.MyClass64.MyClass65.MyClass66.MyClass67.MyClass68.MyClass69.MyClass70.MyClass71.MyClass72(); + new MyClass0.MyClass1.MyClass2.MyClass3.MyClass4.MyClass5.MyClass6.MyClass7.MyClass8.MyClass9.MyClass10.MyClass11.MyClass12.MyClass13.MyClass14.MyClass15.MyClass16.MyClass17.MyClass18.MyClass19.MyClass20.MyClass21.MyClass22.MyClass23.MyClass24.MyClass25.MyClass26.MyClass27.MyClass28.MyClass29.MyClass30.MyClass31.MyClass32.MyClass33.MyClass34.MyClass35.MyClass36.MyClass37.MyClass38.MyClass39.MyClass40.MyClass41.MyClass42.MyClass43.MyClass44.MyClass45.MyClass46.MyClass47.MyClass48.MyClass49.MyClass50.MyClass51.MyClass52.MyClass53.MyClass54.MyClass55.MyClass56.MyClass57.MyClass58.MyClass59.MyClass60.MyClass61.MyClass62.MyClass63.MyClass64.MyClass65.MyClass66.MyClass67.MyClass68.MyClass69.MyClass70.MyClass71.MyClass72( + + ); } } diff --git a/runtime/src/tests/ilasm/PortablePdb/IlasmPortablePdbTester.cs b/runtime/src/tests/ilasm/PortablePdb/IlasmPortablePdbTester.cs index bf68668237f..6a75c8025a1 100644 --- a/runtime/src/tests/ilasm/PortablePdb/IlasmPortablePdbTester.cs +++ b/runtime/src/tests/ilasm/PortablePdb/IlasmPortablePdbTester.cs @@ -50,8 +50,8 @@ out string pdb var dbgDirEntries = peReader.ReadDebugDirectory(); Assert.False(dbgDirEntries.IsEmpty); - var dbgEntry = dbgDirEntries.FirstOrDefault( - dbgEntry => dbgEntry.IsPortableCodeView + var dbgEntry = dbgDirEntries.FirstOrDefault(dbgEntry => + dbgEntry.IsPortableCodeView ); Assert.True(dbgEntry.DataSize > 0); diff --git a/runtime/src/tests/nativeaot/SmokeTests/DynamicGenerics/dictionaries.cs b/runtime/src/tests/nativeaot/SmokeTests/DynamicGenerics/dictionaries.cs index 411b9c74973..0ab592d72e6 100644 --- a/runtime/src/tests/nativeaot/SmokeTests/DynamicGenerics/dictionaries.cs +++ b/runtime/src/tests/nativeaot/SmokeTests/DynamicGenerics/dictionaries.cs @@ -2372,10 +2372,9 @@ public string CallerMethod(int testId) case 10: return TestClass.Nested>.Nested>.Nested>.MyMethod(); case 11: - return TestClass.Nested>.Nested>.Nested>.MyGenMethod(); + return TestClass.Nested>.Nested>.Nested>.MyGenMethod( + + ); case 12: return TestClass.MyGenMethod.Nested>.Nested>.Nested>(); diff --git a/runtime/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs b/runtime/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs index 7a3e2f08771..dda52169328 100644 --- a/runtime/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs +++ b/runtime/src/tests/nativeaot/SmokeTests/UnitTests/Interfaces.cs @@ -1412,8 +1412,9 @@ public static void Run() } { - DerivedWithOverriddenUnusedVirtual b = - new SuperDerivedWithOverriddenUnusedVirtual(); + DerivedWithOverriddenUnusedVirtual b = new SuperDerivedWithOverriddenUnusedVirtual( + + ); if (b.GetFoo().State != "SuperDerivedWithOverriddenUnusedVirtual") throw new Exception(); } diff --git a/runtime/src/tests/readytorun/tests/main.cs b/runtime/src/tests/readytorun/tests/main.cs index 4df5d504c82..843aa8429f2 100644 --- a/runtime/src/tests/readytorun/tests/main.cs +++ b/runtime/src/tests/readytorun/tests/main.cs @@ -523,7 +523,9 @@ private class CallDefaultVsExactStaticVirtual static void TestDefaultVsExactStaticVirtualMethodImplementation() { Assert.AreEqual( - CallDefaultVsExactStaticVirtual.CallMethodOnGenericType(), + CallDefaultVsExactStaticVirtual.CallMethodOnGenericType( + + ), "DefaultVsExactStaticVirtualMethod" ); // Naively one would expect that the following should do, however Roslyn fails to compile it claiming that the type DVESVC doesn't contain 'Method': diff --git a/runtime/src/tests/reflection/RefEmit/EmittingIgnoresAccessChecksToAttributeIsRespected.cs b/runtime/src/tests/reflection/RefEmit/EmittingIgnoresAccessChecksToAttributeIsRespected.cs index 46bbfda1a01..d993a9eb04b 100644 --- a/runtime/src/tests/reflection/RefEmit/EmittingIgnoresAccessChecksToAttributeIsRespected.cs +++ b/runtime/src/tests/reflection/RefEmit/EmittingIgnoresAccessChecksToAttributeIsRespected.cs @@ -138,15 +138,14 @@ static ConstructorInfo DefineIgnoresAccessChecksToAttribute(ModuleBuilder mb) // Find the ctor that takes only AttributeTargets ConstructorInfo attributeUsageConstructorInfo = - attributeUsageTypeInfo.DeclaredConstructors.Single( - c => - c.GetParameters().Length == 1 - && c.GetParameters()[0].ParameterType == typeof(AttributeTargets) + attributeUsageTypeInfo.DeclaredConstructors.Single(c => + c.GetParameters().Length == 1 + && c.GetParameters()[0].ParameterType == typeof(AttributeTargets) ); // Find the property to set AllowMultiple - PropertyInfo allowMultipleProperty = attributeUsageTypeInfo.DeclaredProperties.Single( - f => string.Equals(f.Name, "AllowMultiple") + PropertyInfo allowMultipleProperty = attributeUsageTypeInfo.DeclaredProperties.Single(f => + string.Equals(f.Name, "AllowMultiple") ); // Create a builder to construct the instance via the ctor and property diff --git a/runtime/src/tools/illink/src/ILLink.CodeFix/DynamicallyAccessedMembersCodeFixProvider.cs b/runtime/src/tools/illink/src/ILLink.CodeFix/DynamicallyAccessedMembersCodeFixProvider.cs index b7e5ec752b1..1c90237572e 100644 --- a/runtime/src/tools/illink/src/ILLink.CodeFix/DynamicallyAccessedMembersCodeFixProvider.cs +++ b/runtime/src/tools/illink/src/ILLink.CodeFix/DynamicallyAccessedMembersCodeFixProvider.cs @@ -176,21 +176,37 @@ private static ImmutableArray GetSupportedDiagnostics() private static readonly string[] AttributeOnReturn = { - DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsParameter.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsMethodReturnType.AsString(), + DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsParameter.AsString( + + ), + DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsMethodReturnType.AsString( + + ), DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsField.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsThisParameter.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchOnMethodReturnValueBetweenOverrides.AsString() + DiagnosticId.DynamicallyAccessedMembersMismatchMethodReturnTypeTargetsThisParameter.AsString( + + ), + DiagnosticId.DynamicallyAccessedMembersMismatchOnMethodReturnValueBetweenOverrides.AsString( + + ) }; private static readonly string[] AttributeOnGeneric = { DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsParameter.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsMethodReturnType.AsString(), + DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsMethodReturnType.AsString( + + ), DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsField.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsThisParameter.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsGenericParameter.AsString(), - DiagnosticId.DynamicallyAccessedMembersMismatchOnGenericParameterBetweenOverrides.AsString() + DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsThisParameter.AsString( + + ), + DiagnosticId.DynamicallyAccessedMembersMismatchTypeArgumentTargetsGenericParameter.AsString( + + ), + DiagnosticId.DynamicallyAccessedMembersMismatchOnGenericParameterBetweenOverrides.AsString( + + ) }; public sealed override FixAllProvider GetFixAllProvider() diff --git a/runtime/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/ReflectionAccessAnalyzer.cs b/runtime/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/ReflectionAccessAnalyzer.cs index 378a46f2740..72d28f2ce00 100644 --- a/runtime/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/ReflectionAccessAnalyzer.cs +++ b/runtime/src/tools/illink/src/ILLink.RoslynAnalyzer/TrimAnalysis/ReflectionAccessAnalyzer.cs @@ -120,10 +120,8 @@ ITypeSymbol typeSymbol ) { foreach ( - var c in typeSymbol.GetConstructorsOnType( - filter: m => - (m.DeclaredAccessibility == Accessibility.Public) - && m.Parameters.Length == 0 + var c in typeSymbol.GetConstructorsOnType(filter: m => + (m.DeclaredAccessibility == Accessibility.Public) && m.Parameters.Length == 0 ) ) GetReflectionAccessDiagnosticsForMethod(diagnosticContext, c); diff --git a/runtime/src/tools/illink/src/linker/Linker.Dataflow/DynamicallyAccessedMembersBinder.cs b/runtime/src/tools/illink/src/linker/Linker.Dataflow/DynamicallyAccessedMembersBinder.cs index 08e1d6a199c..3fb8900a6ea 100644 --- a/runtime/src/tools/illink/src/linker/Linker.Dataflow/DynamicallyAccessedMembersBinder.cs +++ b/runtime/src/tools/illink/src/linker/Linker.Dataflow/DynamicallyAccessedMembersBinder.cs @@ -61,8 +61,8 @@ var c in typeDefinition.GetConstructorsOnType( if (memberTypes.HasFlag(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)) { foreach ( - var c in typeDefinition.GetConstructorsOnType( - filter: m => m.IsPublic && !m.HasMetadataParameters() + var c in typeDefinition.GetConstructorsOnType(filter: m => + m.IsPublic && !m.HasMetadataParameters() ) ) yield return c; diff --git a/runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index 3780c7f242c..6789f6ef000 100644 --- a/runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/runtime/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -965,8 +965,8 @@ void MarkMethodIfNeededByBaseMethod(MethodDefinition method) if (bases is null) return; - var markedBaseMethods = bases.Where( - ov => Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope) + var markedBaseMethods = bases.Where(ov => + Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope) ); foreach (var ov in markedBaseMethods) { @@ -1743,8 +1743,8 @@ in DependencyInfo reason TypeDefinition? type = inputType; while (type != null) { - PropertyDefinition? property = type.Properties.FirstOrDefault( - p => p.Name == propertyname + PropertyDefinition? property = type.Properties.FirstOrDefault(p => + p.Name == propertyname ); if (property != null) return property; @@ -1807,8 +1807,8 @@ ICustomAttribute ca TypeDefinition? type = inputType; while (type != null) { - MethodDefinition? method = type.Methods.FirstOrDefault( - m => m.Name == methodname && !m.HasMetadataParameters() + MethodDefinition? method = type.Methods.FirstOrDefault(m => + m.Name == methodname && !m.HasMetadataParameters() ); if (method != null) return method; @@ -2037,8 +2037,8 @@ TypeReference CreateTypeReferenceForExportedTypeTarget(ExportedType exportedType void ProcessModuleType(AssemblyDefinition assembly) { // The type may have an initializer, in which case we want to keep it. - TypeDefinition? moduleType = assembly.MainModule.Types.FirstOrDefault( - t => t.MetadataToken.RID == 1 + TypeDefinition? moduleType = assembly.MainModule.Types.FirstOrDefault(t => + t.MetadataToken.RID == 1 ); if (moduleType != null && moduleType.HasMethods) MarkType(moduleType, new DependencyInfo(DependencyKind.TypeInAssembly, assembly)); @@ -4584,10 +4584,8 @@ or AssemblyAction.CopyUsed if (Annotations.GetOverrides(method) is IEnumerable overrides) { foreach ( - var @override in overrides.Where( - ov => - Annotations.IsMarked(ov.Base) - || IgnoreScope(ov.Base.DeclaringType.Scope) + var @override in overrides.Where(ov => + Annotations.IsMarked(ov.Base) || IgnoreScope(ov.Base.DeclaringType.Scope) ) ) { diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs index e0ae0f15e5a..9391ff88e64 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly.cs @@ -44,8 +44,9 @@ public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembl { public static void Main() { - var foo = - new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib(); + var foo = new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib( + + ); foo.Property = 1; } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs index e8e1b66e28d..3778080e174 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes.Debugger/KeepDebugMembers/DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeInOtherAssembly.cs @@ -48,7 +48,9 @@ public class DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameOfGenericTypeI public static void Main() { var foo = - new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.GenericType(); + new DebuggerDisplayAttributeOnAssemblyUsingTargetTypeNameInOtherAssembly_Lib.GenericType( + + ); foo.PropertyOnGenericType = 1; } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs index 807b9c8debe..50f248c55bb 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Attributes/OnlyKeepUsed/UnusedAttributeOnReturnTypeIsRemoved.cs @@ -24,13 +24,17 @@ static void Main() { #if IL_ASSEMBLY_AVAILABLE var tmp = - new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition().Method( - 1 - ); + new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition( + + ).Method(1); var tmp2 = - new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition().MethodWithoutParameters(); + new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition( + + ).MethodWithoutParameters(); var tmp3 = - new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition().MethodWithoutParametersNonNestedAttribute(); + new Mono.Linker.Tests.Cases.Attributes.OnlyKeepUsed.Dependencies.AssemblyWithUnusedAttributeOnReturnParameterDefinition( + + ).MethodWithoutParametersNonNestedAttribute(); #endif } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs index fcac663e2f6..24a0dbef6d1 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/DataFlow/PropertyDataFlow.cs @@ -147,9 +147,9 @@ private void WriteToStaticProperty() )] private void WriteToStaticPropertyExpressionValue() { - ( - StaticPropertyWithPublicConstructor = GetTypeWithNonPublicConstructors() - ).RequiresAll(); + (StaticPropertyWithPublicConstructor = GetTypeWithNonPublicConstructors()).RequiresAll( + + ); } [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs index 436b13d71fa..7b210980b6a 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit.cs @@ -35,7 +35,9 @@ public class InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit { public static void Main() { - InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.ToKeepReferenceAtCompileTime(); + InterfaceTypeInOtherUsedOnlyByCopiedAssemblyExplicit_Copy.ToKeepReferenceAtCompileTime( + + ); } } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs index a4a870f6ec4..2636d155401 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveFieldsWithInterfacesMarked.cs @@ -41,7 +41,9 @@ public static void Main() { #if IL_ASSEMBLY_COMPILED var tmp = - typeof(Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib.IFoo).ToString(); + typeof(Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib.IFoo).ToString( + + ); #endif } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs index 2f757c8d082..4ef1466e765 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Inheritance.Interfaces/OnReferenceType/NoInstanceCtor/NoInstanceCtorAndTypePreserveMethodsWithInterfacesMarked.cs @@ -41,7 +41,9 @@ public static void Main() // We'll mark one interface in code and one via xml, the end result should be the same #if IL_ASSEMBLY_COMPILED var tmp = - typeof(Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib.IFoo).ToString(); + typeof(Mono.Linker.Tests.Cases.Inheritance.Interfaces.OnReferenceType.NoInstanceCtor.Dependencies.NoInstanceCtorAndAssemblyPreserveAll_Lib.IFoo).ToString( + + ); #endif } } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs index e178387be7e..90dd5b86132 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/ConstructorUsedViaReflection.cs @@ -17,7 +17,9 @@ public static void Main() GetConstructor_BindingAttr_Binder_Types_Modifiers.TestWithUnknownBindingFlags( BindingFlags.Public ); - GetConstructor_BindingAttr_Binder_CallConvention_Types_Modifiers.TestWithCallingConvention(); + GetConstructor_BindingAttr_Binder_CallConvention_Types_Modifiers.TestWithCallingConvention( + + ); #if NETCOREAPP GetConstructor_BindingAttr_Types.Test(); #endif diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs index 3d43e84e4eb..6dc2b5e99f6 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/Reflection/MethodUsedViaReflection.cs @@ -26,15 +26,27 @@ public static void Main() GetMethod_Name_BindingAttr.TestNullName(); GetMethod_Name_BindingAttr.TestUnknownName("Unknown"); GetMethod_Name_BindingAttr.TestUnknownNameAndWrongBindingFlags("Unknown"); - GetMethod_Name_BindingAttr_Binder_Types_Modifiers.TestNameBindingFlagsAndParameterModifier(); - GetMethod_Name_BindingAttr_Binder_CallConvention_Types_Modifiers.TestNameBindingFlagsCallingConventionParameterModifier(); + GetMethod_Name_BindingAttr_Binder_Types_Modifiers.TestNameBindingFlagsAndParameterModifier( + + ); + GetMethod_Name_BindingAttr_Binder_CallConvention_Types_Modifiers.TestNameBindingFlagsCallingConventionParameterModifier( + + ); #if NETCOREAPP GetMethod_Name_BindingAttr_Types.TestNameBindingFlagsAndTypes(); GetMethod_Name_GenericParameterCount_Types.TestNameWithIntAndType(); - GetMethod_Name_GenericParameterCount_Types_Modifiers.TestNameWithIntAndTypeAndModifiers(); - GetMethod_Name_GenericParameterCount_BindingAttr_Binder_Types_Modifiers.TestNameWithIntAndBindingFlags(); - GetMethod_Name_GenericParameterCount_BindingAttr_Binder_Types_Modifiers_PrivateBinding.TestNameWithIntAndPrivateBindingFlags(); - GetMethod_Name_GenericParameterCount_BindingAttr_Binder_CallConvention_Types_Modifiers.TestNameWithIntBindingFlagsCallingConventionParameter(); + GetMethod_Name_GenericParameterCount_Types_Modifiers.TestNameWithIntAndTypeAndModifiers( + + ); + GetMethod_Name_GenericParameterCount_BindingAttr_Binder_Types_Modifiers.TestNameWithIntAndBindingFlags( + + ); + GetMethod_Name_GenericParameterCount_BindingAttr_Binder_Types_Modifiers_PrivateBinding.TestNameWithIntAndPrivateBindingFlags( + + ); + GetMethod_Name_GenericParameterCount_BindingAttr_Binder_CallConvention_Types_Modifiers.TestNameWithIntBindingFlagsCallingConventionParameter( + + ); #endif TestNullName(); TestEmptyName(); diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs index 6c17af415e0..91443367bd6 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs @@ -18,7 +18,9 @@ static void Main() { #if IL_ASSEMBLY_AVAILABLE Console.WriteLine( - new Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample().GiveMeAValue() + new Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample( + + ).GiveMeAValue() ); #endif } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationWorks.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationWorks.cs index 249e0062452..21258235f86 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationWorks.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests.Cases/TestFramework/ILVerificationWorks.cs @@ -26,7 +26,9 @@ public static void Main() { #if IL_ASSEMBLY_AVAILABLE System.Console.WriteLine( - new Mono.Linker.Tests.Cases.TestFramework.Dependencies.AssemblyWithInvalidIL().GiveMeAValue() + new Mono.Linker.Tests.Cases.TestFramework.Dependencies.AssemblyWithInvalidIL( + + ).GiveMeAValue() ); #endif } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs index 5c3b732e28e..2a03cac4d9b 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests/Extensions/NiceIO.cs @@ -173,8 +173,8 @@ public NPath RelativeTo(NPath path) NPath commonParent = null; foreach (var parent in RecursiveParents) { - commonParent = path.RecursiveParents.FirstOrDefault( - otherParent => otherParent == parent + commonParent = path.RecursiveParents.FirstOrDefault(otherParent => + otherParent == parent ); if (commonParent != null) diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCases/TestCase.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCases/TestCase.cs index 4b6bbe8ba90..a51adf9091f 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCases/TestCase.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCases/TestCase.cs @@ -95,8 +95,8 @@ public TypeDefinition FindTypeDefinition(AssemblyDefinition caseAssemblyDefiniti { if ( type.Name == "Program" - && type.CustomAttributes.Any( - attr => attr.AttributeType.Name == nameof(CompilerGeneratedAttribute) + && type.CustomAttributes.Any(attr => + attr.AttributeType.Name == nameof(CompilerGeneratedAttribute) ) ) return type; diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs index f7bec17f700..79ff90aeea5 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ILVerification/ILVerifier.cs @@ -73,18 +73,17 @@ protected virtual IEnumerable FilterResults( IEnumerable results ) { - return results.Where( - r => - r.Code switch - { - VerifierError.None - // ex. localloc cannot be statically verified by ILVerify - or VerifierError.Unverifiable - // initlocals must be set for verifiable methods with one or more local variables - Lots of these in class libraries - or VerifierError.InitLocals - => false, - _ => true - } + return results.Where(r => + r.Code switch + { + VerifierError.None + // ex. localloc cannot be statically verified by ILVerify + or VerifierError.Unverifiable + // initlocals must be set for verifiable methods with one or more local variables - Lots of these in class libraries + or VerifierError.InitLocals + => false, + _ => true + } ); } diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs index fc6a0294c72..5a908dc5e73 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/ResultChecker.cs @@ -62,8 +62,8 @@ protected static void ValidateTypeRefsHaveValidAssemblyRefs(AssemblyDefinition l { case null: // There should be an ExportedType row for this typeref - var exportedType = linked.MainModule.ExportedTypes.SingleOrDefault( - et => et.FullName == typeRef.FullName + var exportedType = linked.MainModule.ExportedTypes.SingleOrDefault(et => + et.FullName == typeRef.FullName ); Assert.IsNotNull( exportedType, @@ -74,8 +74,8 @@ protected static void ValidateTypeRefsHaveValidAssemblyRefs(AssemblyDefinition l { case AssemblyNameReference: // There should be an AssemblyRef row for this assembly - var assemblyRef = linked.MainModule.AssemblyReferences.Single( - ar => ar.Name == exportedType.Scope.Name + var assemblyRef = linked.MainModule.AssemblyReferences.Single(ar => + ar.Name == exportedType.Scope.Name ); Assert.IsNotNull( assemblyRef, @@ -91,8 +91,8 @@ protected static void ValidateTypeRefsHaveValidAssemblyRefs(AssemblyDefinition l case AssemblyNameReference: { // There should be an AssemblyRef row for this assembly - var assemblyRef = linked.MainModule.AssemblyReferences.Single( - ar => ar.Name == typeRef.Scope.Name + var assemblyRef = linked.MainModule.AssemblyReferences.Single(ar => + ar.Name == typeRef.Scope.Name ); Assert.IsNotNull( assemblyRef, @@ -467,8 +467,8 @@ void VerifyLinkingOfOtherAssemblies(AssemblyDefinition original) if (linkedType == null && linkedAssembly.MainModule.HasExportedTypes) { ExportedType exportedType = - linkedAssembly.MainModule.ExportedTypes.FirstOrDefault( - exported => exported.FullName == expectedTypeName + linkedAssembly.MainModule.ExportedTypes.FirstOrDefault(exported => + exported.FullName == expectedTypeName ); // Note that copied assemblies could have dangling references. @@ -544,8 +544,8 @@ void VerifyLinkingOfOtherAssemblies(AssemblyDefinition original) break; case nameof(RemovedForwarderAttribute): if ( - linkedAssembly.MainModule.ExportedTypes.Any( - l => l.Name == expectedTypeName + linkedAssembly.MainModule.ExportedTypes.Any(l => + l.Name == expectedTypeName ) ) Assert.Fail( @@ -556,8 +556,8 @@ void VerifyLinkingOfOtherAssemblies(AssemblyDefinition original) case nameof(RemovedAssemblyReferenceAttribute): Assert.False( - linkedAssembly.MainModule.AssemblyReferences.Any( - l => l.Name == expectedTypeName + linkedAssembly.MainModule.AssemblyReferences.Any(l => + l.Name == expectedTypeName ), $"AssemblyRef '{expectedTypeName}' should have been removed from assembly {assemblyName}" ); @@ -689,13 +689,12 @@ Action assertExpectedAttribute return; } - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => m.Name == memberName ); if (linkedProperty == null) Assert.Fail( @@ -706,13 +705,13 @@ Action assertExpectedAttribute return; } - var originalMethodMember = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var originalMethodMember = originalType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var linkedMethod = linkedType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (linkedMethod == null) Assert.Fail( @@ -751,8 +750,8 @@ void VerifyCustomAttributeKept( string expectedAttributeTypeName ) { - var match = provider.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.FullName == expectedAttributeTypeName + var match = provider.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.FullName == expectedAttributeTypeName ); if (match == null) Assert.Fail( @@ -765,8 +764,8 @@ void VerifyCustomAttributeRemoved( string expectedAttributeTypeName ) { - var match = provider.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.FullName == expectedAttributeTypeName + var match = provider.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.FullName == expectedAttributeTypeName ); if (match != null) Assert.Fail( @@ -906,8 +905,8 @@ var memberNameAttr in (CustomAttributeArgument[]) // We will find the matching type from the original assembly first that way we can confirm // that the name defined in the attribute corresponds to a member that actually existed - var originalFieldMember = originalType.Fields.FirstOrDefault( - m => m.Name == memberName + var originalFieldMember = originalType.Fields.FirstOrDefault(m => + m.Name == memberName ); if (originalFieldMember != null) { @@ -920,13 +919,13 @@ var memberNameAttr in (CustomAttributeArgument[]) continue; } - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (linkedProperty != null) Assert.Fail( @@ -936,13 +935,13 @@ var memberNameAttr in (CustomAttributeArgument[]) continue; } - var originalMethodMember = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var originalMethodMember = originalType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + var linkedMethod = linkedType.Methods.FirstOrDefault(m => + m.GetSignature() == memberName ); if (linkedMethod != null) Assert.Fail( @@ -1019,13 +1018,12 @@ protected virtual bool TryVerifyKeptMemberInAssemblyAsProperty( TypeDefinition linkedType ) { - var originalPropertyMember = originalType.Properties.FirstOrDefault( - m => m.Name == memberName + var originalPropertyMember = originalType.Properties.FirstOrDefault(m => + m.Name == memberName ); if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault( - m => m.Name == memberName + var linkedProperty = linkedType.Properties.FirstOrDefault(m => m.Name == memberName ); if (linkedProperty == null) Assert.Fail( @@ -1061,13 +1059,11 @@ protected virtual bool TryVerifyKeptMemberInAssemblyAsMethod( out MethodDefinition linkedMethod ) { - originalMethod = originalType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + originalMethod = originalType.Methods.FirstOrDefault(m => m.GetSignature() == memberName ); if (originalMethod != null) { - linkedMethod = linkedType.Methods.FirstOrDefault( - m => m.GetSignature() == memberName + linkedMethod = linkedType.Methods.FirstOrDefault(m => m.GetSignature() == memberName ); if (linkedMethod == null) Assert.Fail( @@ -1562,8 +1558,8 @@ attrProvider is IMemberDefinition attrMember if (checkRemainingErrors) { - var remainingErrors = loggedMessages.Where( - m => Regex.IsMatch(m.ToString(), @".*(error | warning): \d{4}.*") + var remainingErrors = loggedMessages.Where(m => + Regex.IsMatch(m.ToString(), @".*(error | warning): \d{4}.*") ); Assert.IsEmpty( remainingErrors, @@ -1624,20 +1620,18 @@ TestDependencyRecorder dependencyRecorder string targetCandidates = string.Join( Environment.NewLine, dependencyRecorder - .Dependencies.Where( - d => - d.Target.ToLowerInvariant() - .Contains(expectedTarget.ToLowerInvariant()) + .Dependencies.Where(d => + d.Target.ToLowerInvariant() + .Contains(expectedTarget.ToLowerInvariant()) ) .Select(d => "\t" + DependencyToString(d)) ); string sourceCandidates = string.Join( Environment.NewLine, dependencyRecorder - .Dependencies.Where( - d => - d.Source.ToLowerInvariant() - .Contains(expectedSource.ToLowerInvariant()) + .Dependencies.Where(d => + d.Source.ToLowerInvariant() + .Contains(expectedSource.ToLowerInvariant()) ) .Select(d => "\t" + DependencyToString(d)) ); @@ -1891,13 +1885,12 @@ string attributeName ) { if (caProvider is AssemblyDefinition assembly && assembly.EntryPoint != null) - return assembly.EntryPoint.DeclaringType.CustomAttributes.Where( - attr => attr!.AttributeType.Name == attributeName + return assembly.EntryPoint.DeclaringType.CustomAttributes.Where(attr => + attr!.AttributeType.Name == attributeName ); if (caProvider is TypeDefinition type) - return type.CustomAttributes.Where( - attr => attr!.AttributeType.Name == attributeName + return type.CustomAttributes.Where(attr => attr!.AttributeType.Name == attributeName ); return Enumerable.Empty(); diff --git a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs index 501872eaa32..020c814ff74 100644 --- a/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs +++ b/runtime/src/tools/illink/test/Mono.Linker.Tests/TestCasesRunner/TestCaseCompilationMetadataProvider.cs @@ -34,8 +34,8 @@ private static bool IsIgnoredByTrimmer(CustomAttribute attr) public virtual bool IsIgnored(out string reason) { - var ignoreAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.Name == nameof(IgnoreTestCaseAttribute) + var ignoreAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == nameof(IgnoreTestCaseAttribute) ); if (ignoreAttribute != null && IsIgnoredByTrimmer(ignoreAttribute)) { @@ -111,8 +111,8 @@ public virtual IEnumerable GetDefines() yield return "SUPPORTS_DEFAULT_INTERFACE_METHODS"; foreach ( - var attr in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(DefineAttribute) + var attr in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(DefineAttribute) ) ) yield return (string)attr.ConstructorArguments.First().Value; @@ -120,8 +120,8 @@ var attr in _testCaseTypeDefinition.CustomAttributes.Where( public virtual string GetAssemblyName() { - var asLibraryAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.Name == nameof(SetupCompileAsLibraryAttribute) + var asLibraryAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == nameof(SetupCompileAsLibraryAttribute) ); var defaultName = asLibraryAttribute == null ? "test.exe" : "test.dll"; return GetOptionAttributeValue(nameof(SetupCompileAssemblyNameAttribute), defaultName); @@ -136,8 +136,8 @@ public virtual string GetCSharpCompilerToUse() public virtual IEnumerable GetSetupCompilerArguments() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupCompileArgumentAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupCompileArgumentAttribute) ) .Select(attr => (string)attr.ConstructorArguments.First().Value); } @@ -145,8 +145,8 @@ public virtual IEnumerable GetSetupCompilerArguments() public virtual IEnumerable AdditionalFilesToSandbox() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SandboxDependencyAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SandboxDependencyAttribute) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -266,8 +266,8 @@ public virtual IEnumerable GetReferencedAssemblies(NPath workingDirector public virtual IEnumerable GetReferenceDependencies() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(ReferenceDependencyAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(ReferenceDependencyAttribute) ) .Select(attr => (string)attr.ConstructorArguments[0].Value); } @@ -275,8 +275,8 @@ public virtual IEnumerable GetReferenceDependencies() public virtual IEnumerable GetReferenceValues() { foreach ( - var referenceAttr in _testCaseTypeDefinition.CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(ReferenceAttribute) + var referenceAttr in _testCaseTypeDefinition.CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(ReferenceAttribute) ) ) yield return (string)referenceAttr.ConstructorArguments.First().Value; @@ -285,8 +285,8 @@ var referenceAttr in _testCaseTypeDefinition.CustomAttributes.Where( public virtual IEnumerable GetResources() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupCompileResourceAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupCompileResourceAttribute) ) .Select(GetSourceAndRelativeDestinationValue); } @@ -294,8 +294,8 @@ public virtual IEnumerable GetResources() public virtual IEnumerable GetSetupCompileAssembliesBefore() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupCompileBeforeAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupCompileBeforeAttribute) ) .Select(CreateSetupCompileAssemblyInfo); } @@ -303,8 +303,8 @@ public virtual IEnumerable GetSetupCompileAssembliesBefore() public virtual IEnumerable GetSetupCompileAssembliesAfter() { return _testCaseTypeDefinition - .CustomAttributes.Where( - attr => attr.AttributeType.Name == nameof(SetupCompileAfterAttribute) + .CustomAttributes.Where(attr => + attr.AttributeType.Name == nameof(SetupCompileAfterAttribute) ) .Select(CreateSetupCompileAssemblyInfo); } diff --git a/runtime/src/tools/illink/test/Trimming.Tests.Shared/BaseMetadataProvider.cs b/runtime/src/tools/illink/test/Trimming.Tests.Shared/BaseMetadataProvider.cs index 6ca7b5e6794..b2cd1c3c115 100644 --- a/runtime/src/tools/illink/test/Trimming.Tests.Shared/BaseMetadataProvider.cs +++ b/runtime/src/tools/illink/test/Trimming.Tests.Shared/BaseMetadataProvider.cs @@ -32,8 +32,8 @@ AssemblyDefinition fullTestCaseAssemblyDefinition protected T? GetOptionAttributeValue(string attributeName, T? defaultValue) { - var attribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault( - attr => attr.AttributeType.Name == attributeName + var attribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault(attr => + attr.AttributeType.Name == attributeName ); if (attribute != null) return (T?)attribute.ConstructorArguments.First().Value; @@ -70,7 +70,9 @@ protected virtual NPath SourceFileForAttributeArgumentValue(object value) // Use the parent type for locating the source file var parentType = ParentMostType(valueAsTypeRef); var pathRelativeToAssembly = - $"{parentType.FullName.Substring(parentType.Module.Name.Length - 3).Replace('.', '/')}.cs".ToNPath(); + $"{parentType.FullName.Substring(parentType.Module.Name.Length - 3).Replace('.', '/')}.cs".ToNPath( + + ); var pathElements = pathRelativeToAssembly.Elements.ToArray(); var topMostDirectoryName = pathElements[0]; var topMostDirectory = _testCase