From 212d133337888738ec0a1cd36771c580a52dc5c0 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 7 Apr 2020 00:06:39 -0700 Subject: [PATCH 1/5] Remove migrated packages --- .github/CODEOWNERS | 2 - Directory.Build.props | 2 +- eng/Build.props | 3 - eng/repo.targets | 11 - .../test}/ConfigurationProviderExtensions.cs | 0 .../test/ConfigurationProviderTestBase.cs | 0 ....Configuration.NewtonsoftJson.Tests.csproj | 12 - .../test}/TestStreamHelpers.cs | 0 .../DI.External.Tests/test/Autofac.cs | 20 - .../DI.External.Tests/test/DryIoc.cs | 20 - .../DI.External.Tests/test/Grace.cs | 24 - .../DI.External.Tests/test/Lamar.cs | 22 - .../DI.External.Tests/test/LightInject.cs | 21 - ...yInjection.ExternalContainers.Tests.csproj | 30 - ...leDependencyInjectionSpecificationTests.cs | 32 - .../DI.External.Tests/test/StashBox.cs | 16 - .../DI.External.Tests/test/StructureMap.cs | 29 - .../DI.External.Tests/test/Unity.cs | 21 - .../src/ActivatorUtilitiesTests.cs | 399 --------- .../DependencyInjectionSpecificationTests.cs | 779 ------------------ .../src/Fakes/AnotherClass.cs | 16 - .../src/Fakes/AnotherClassAcceptingData.cs | 22 - .../src/Fakes/ClassWithAmbiguousCtors.cs | 40 - .../ClassWithAmbiguousCtorsAndAttribute.cs | 27 - .../src/Fakes/ClassWithInternalConstructor.cs | 13 - .../src/Fakes/ClassWithMultipleMarkedCtors.cs | 19 - .../ClassWithNestedReferencesToProvider.cs | 35 - .../src/Fakes/ClassWithOptionalArgsCtor.cs | 16 - .../ClassWithOptionalArgsCtorWithStructs.cs | 42 - .../src/Fakes/ClassWithPrivateCtor.cs | 13 - .../Fakes/ClassWithProtectedConstructor.cs | 13 - .../src/Fakes/ClassWithServiceProvider.cs | 20 - .../src/Fakes/ClassWithStaticCtor.cs | 14 - .../src/Fakes/ClassWithThrowingCtor.cs | 16 - .../src/Fakes/ClassWithThrowingEmptyCtor.cs | 16 - .../src/Fakes/CreationCountFakeService.cs | 21 - .../FakeDisposableCallbackInnerService.cs | 13 - .../FakeDisposableCallbackOuterService.cs | 24 - .../Fakes/FakeDisposableCallbackService.cs | 31 - .../src/Fakes/FakeDisposeCallback.cs | 13 - .../src/Fakes/FakeOneMultipleService.cs | 10 - .../src/Fakes/FakeOpenGenericService.cs | 16 - .../src/Fakes/FakeOuterService.cs | 23 - .../src/Fakes/FakeService.cs | 25 - .../src/Fakes/FakeTwoMultipleService.cs | 10 - .../src/Fakes/IFactoryService.cs | 13 - .../src/Fakes/IFakeEveryService.cs | 16 - .../src/Fakes/IFakeMultipleService.cs | 10 - .../src/Fakes/IFakeOpenGenericService.cs | 11 - .../src/Fakes/IFakeOuterService.cs | 15 - .../src/Fakes/IFakeScopedService.cs | 10 - .../src/Fakes/IFakeService.cs | 10 - .../src/Fakes/IFakeServiceInstance.cs | 10 - .../src/Fakes/IFakeSingletonService.cs | 10 - .../src/Fakes/INonexistentService.cs | 10 - .../src/Fakes/PocoClass.cs | 10 - .../src/Fakes/ScopedFactoryService.cs | 11 - .../Fakes/ServiceAcceptingFactoryService.cs | 21 - .../src/Fakes/TransientFactoryService.cs | 13 - .../src/Fakes/TypeWithSupersetConstructors.cs | 65 -- ...ndencyInjection.Specification.Tests.csproj | 34 - .../src/ServiceCollection.cs | 12 - .../DependencyInjection.sln | 59 -- src/DependencyInjection/README.md | 14 - src/DependencyInjection/startvs.cmd | 3 - .../src/LogValuesFormatter.cs | 0 ...rosoft.Extensions.Logging.Analyzers.csproj | 4 - .../Directory.Build.props | 8 - ...Extensions.Logging.AzureAppServices.csproj | 15 - ...Logging.AzureAppServices.netstandard2.0.cs | 54 -- ...AzureAppServicesLoggerFactoryExtensions.cs | 98 --- .../src/AzureBlobLoggerOptions.cs | 39 - .../src/AzureFileLoggerOptions.cs | 73 -- .../src/BatchLoggerConfigureOptions.cs | 37 - .../src/BatchingLogger.cs | 75 -- .../src/BatchingLoggerOptions.cs | 80 -- .../src/BatchingLoggerProvider.cs | 208 ----- .../src/BlobAppendReferenceWrapper.cs | 97 --- .../src/BlobLoggerConfigureOptions.cs | 30 - .../src/BlobLoggerProvider.cs | 92 --- .../src/ConfigurationBasedLevelSwitcher.cs | 51 -- .../src/FileLoggerConfigureOptions.cs | 27 - .../src/FileLoggerProvider.cs | 89 -- .../src/ICloudAppendBlob.cs | 23 - .../src/IWebAppContext.cs | 32 - .../src/LogMessage.cs | 20 - ...Extensions.Logging.AzureAppServices.csproj | 24 - .../src/Properties/AssemblyInfo.cs | 8 - .../src/SiteConfigurationProvider.cs | 23 - .../src/WebAppContext.cs | 34 - .../test/AzureAppendBlobTests.cs | 186 ----- .../test/AzureBlobSinkTests.cs | 98 --- ...reDiagnosticsConfigurationProviderTests.cs | 70 -- .../test/BatchingLoggerProviderTests.cs | 136 --- .../test/ConfigureOptionsTests.cs | 71 -- .../test/FileLoggerTests.cs | 122 --- .../test/LoggerBuilderExtensionsTests.cs | 79 -- .../test/ManualIntervalControl.cs | 31 - ...ions.Logging.AzureAppServices.Tests.csproj | 28 - .../test/OptionsWrapperMonitor.cs | 26 - .../test/TestBlobSink.cs | 32 - .../test/TestFileLoggerProvider.cs | 36 - .../test/WebConfigurationLevelSwitchTests.cs | 40 - .../Logging.Testing/src/BeginScopeContext.cs | 13 - src/Logging/Logging.Testing/src/ITestSink.cs | 28 - .../Logging.Testing/src/LogLevelAttribute.cs | 19 - .../Logging.Testing/src/LogValuesAssert.cs | 81 -- ...icrosoft.Extensions.Logging.Testing.csproj | 38 - src/Logging/Logging.Testing/src/TestLogger.cs | 77 -- .../Logging.Testing/src/TestLoggerFactory.cs | 31 - .../Logging.Testing/src/TestLoggerProvider.cs | 25 - .../Logging.Testing/src/TestLoggerT.cs | 38 - src/Logging/Logging.Testing/src/TestSink.cs | 66 -- .../Logging.Testing/src/WriteContext.cs | 33 - .../src/XunitLoggerFactoryExtensions.cs | 50 -- .../src/XunitLoggerProvider.cs | 127 --- .../samples/SampleApp/SampleApp.csproj | 1 - .../ActivatorUtilities/ActivatorUtilities.cs | 433 ---------- .../ActivatorUtilitiesConstructorAttribute.cs | 27 - ...tensions.ActivatorUtilities.Sources.csproj | 14 - .../src/ActivatorUtilities/ObjectFactory.cs | 26 - .../AspNetCoreBenchmarkAttribute.cs | 74 -- .../src/BenchmarkRunner/DefaultCoreConfig.cs | 47 -- .../BenchmarkRunner/DefaultCoreDebugConfig.cs | 24 - .../DefaultCorePerfLabConfig.cs | 49 -- .../DefaultCoreProfileConfig.cs | 33 - .../DefaultCoreValidationConfig.cs | 21 - ....AspNetCore.BenchmarkRunner.Sources.csproj | 7 - .../ParameterizedJobConfigAttribute.cs | 16 - .../ParamsDisplayInfoColumn.cs | 27 - src/Shared/src/BenchmarkRunner/Program.cs | 107 --- src/Shared/src/EmptyDisposable.cs | 21 - .../src/HashCodeCombiner/HashCodeCombiner.cs | 85 -- ...Extensions.HashCodeCombiner.Sources.csproj | 7 - .../HostFactoryResolver.cs | 113 --- ...ensions.HostFactoryResolver.Sources.csproj | 7 - ...xtensions.NonCapturingTimer.Sources.csproj | 7 - .../NonCapturingTimer/NonCapturingTimer.cs | 44 - ...sions.ParameterDefaultValue.Sources.csproj | 7 - .../ParameterDefaultValue.cs | 63 -- .../ProviderAliasUtilities.cs | 35 - ...t.Extensions.TypeNameHelper.Sources.csproj | 7 - .../src/TypeNameHelper/TypeNameHelper.cs | 180 ---- src/Shared/test/HashCodeCombinerTest.cs | 40 - src/Shared/test/HostFactoryResolverTests.cs | 117 --- .../Microsoft.Extensions.Sources.Tests.csproj | 16 +- src/Shared/test/NonCapturingTimerTest.cs | 41 - src/Shared/test/TypeNameHelperTest.cs | 305 ------- .../BuildWebHostInvalidSignature.csproj | 12 - .../BuildWebHostInvalidSignature/Program.cs | 18 - .../BuildWebHostPatternTestSite.csproj | 12 - .../BuildWebHostPatternTestSite/Program.cs | 17 - .../CreateHostBuilderInvalidSignature.csproj | 12 - .../Program.cs | 19 - .../CreateHostBuilderPatternTestSite.csproj | 12 - .../Program.cs | 20 - ...reateWebHostBuilderInvalidSignature.csproj | 12 - .../Program.cs | 18 - ...CreateWebHostBuilderPatternTestSite.csproj | 12 - .../Program.cs | 20 - src/Shared/testassets/MockHostTypes/Host.cs | 13 - .../testassets/MockHostTypes/HostBuilder.cs | 11 - src/Shared/testassets/MockHostTypes/IHost.cs | 13 - .../testassets/MockHostTypes/IHostBuilder.cs | 11 - .../testassets/MockHostTypes/IWebHost.cs | 13 - .../MockHostTypes/IWebHostBuilder.cs | 11 - .../MockHostTypes/MockHostTypes.csproj | 7 - .../MockHostTypes/ServiceProvider.cs | 13 - .../testassets/MockHostTypes/WebHost.cs | 13 - .../MockHostTypes/WebHostBuilder.cs | 11 - .../Microsoft.Internal.Extensions.Refs.csproj | 83 -- .../Microsoft.Internal.Extensions.Refs.props | 5 - .../src/Internal.AspNetCore.Analyzers.csproj | 24 - .../src/PubternalityAnalyzer.cs | 279 ------- .../src/PubturnalityDescriptors.cs | 25 - ...Internal.AspNetCore.Analyzers.Tests.csproj | 15 - .../test/PubternabilityAnalyzerTests.cs | 260 ------ ...crosoft.AspNetCore.Analyzer.Testing.csproj | 2 +- 178 files changed, 3 insertions(+), 8121 deletions(-) rename src/Configuration/{Config/testassets/Test.Common => Config.NewtonsoftJson/test}/ConfigurationProviderExtensions.cs (100%) rename src/Configuration/{Config => Config.NewtonsoftJson}/test/ConfigurationProviderTestBase.cs (100%) rename src/Configuration/{Config/testassets/Test.Common => Config.NewtonsoftJson/test}/TestStreamHelpers.cs (100%) delete mode 100644 src/DependencyInjection/DI.External.Tests/test/Autofac.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/DryIoc.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/Grace.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/Lamar.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/LightInject.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj delete mode 100644 src/DependencyInjection/DI.External.Tests/test/SkippableDependencyInjectionSpecificationTests.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/StashBox.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/StructureMap.cs delete mode 100644 src/DependencyInjection/DI.External.Tests/test/Unity.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/ActivatorUtilitiesTests.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/DependencyInjectionSpecificationTests.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClass.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClassAcceptingData.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtors.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithInternalConstructor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithMultipleMarkedCtors.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithNestedReferencesToProvider.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtorWithStructs.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithPrivateCtor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithProtectedConstructor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithServiceProvider.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithStaticCtor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingCtor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingEmptyCtor.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/CreationCountFakeService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackInnerService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackOuterService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposeCallback.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOneMultipleService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOpenGenericService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOuterService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeTwoMultipleService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFactoryService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeEveryService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeMultipleService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOpenGenericService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOuterService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeScopedService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeServiceInstance.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeSingletonService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/INonexistentService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/PocoClass.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ScopedFactoryService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/ServiceAcceptingFactoryService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/TransientFactoryService.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Fakes/TypeWithSupersetConstructors.cs delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj delete mode 100644 src/DependencyInjection/DI.Specification.Tests/src/ServiceCollection.cs delete mode 100644 src/DependencyInjection/DependencyInjection.sln delete mode 100644 src/DependencyInjection/README.md delete mode 100644 src/DependencyInjection/startvs.cmd rename src/Logging/{Logging.Abstractions => Logging.Analyzers}/src/LogValuesFormatter.cs (100%) delete mode 100644 src/Logging/Logging.AzureAppServices/Directory.Build.props delete mode 100644 src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.csproj delete mode 100644 src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.netstandard2.0.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/LogMessage.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj delete mode 100644 src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs delete mode 100644 src/Logging/Logging.AzureAppServices/src/WebAppContext.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj delete mode 100644 src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs delete mode 100644 src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs delete mode 100644 src/Logging/Logging.Testing/src/BeginScopeContext.cs delete mode 100644 src/Logging/Logging.Testing/src/ITestSink.cs delete mode 100644 src/Logging/Logging.Testing/src/LogLevelAttribute.cs delete mode 100644 src/Logging/Logging.Testing/src/LogValuesAssert.cs delete mode 100644 src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj delete mode 100644 src/Logging/Logging.Testing/src/TestLogger.cs delete mode 100644 src/Logging/Logging.Testing/src/TestLoggerFactory.cs delete mode 100644 src/Logging/Logging.Testing/src/TestLoggerProvider.cs delete mode 100644 src/Logging/Logging.Testing/src/TestLoggerT.cs delete mode 100644 src/Logging/Logging.Testing/src/TestSink.cs delete mode 100644 src/Logging/Logging.Testing/src/WriteContext.cs delete mode 100644 src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs delete mode 100644 src/Logging/Logging.Testing/src/XunitLoggerProvider.cs delete mode 100644 src/Shared/src/ActivatorUtilities/ActivatorUtilities.cs delete mode 100644 src/Shared/src/ActivatorUtilities/ActivatorUtilitiesConstructorAttribute.cs delete mode 100644 src/Shared/src/ActivatorUtilities/Microsoft.Extensions.ActivatorUtilities.Sources.csproj delete mode 100644 src/Shared/src/ActivatorUtilities/ObjectFactory.cs delete mode 100644 src/Shared/src/BenchmarkRunner/AspNetCoreBenchmarkAttribute.cs delete mode 100644 src/Shared/src/BenchmarkRunner/DefaultCoreConfig.cs delete mode 100644 src/Shared/src/BenchmarkRunner/DefaultCoreDebugConfig.cs delete mode 100644 src/Shared/src/BenchmarkRunner/DefaultCorePerfLabConfig.cs delete mode 100644 src/Shared/src/BenchmarkRunner/DefaultCoreProfileConfig.cs delete mode 100644 src/Shared/src/BenchmarkRunner/DefaultCoreValidationConfig.cs delete mode 100644 src/Shared/src/BenchmarkRunner/Microsoft.AspNetCore.BenchmarkRunner.Sources.csproj delete mode 100644 src/Shared/src/BenchmarkRunner/ParameterizedJobConfigAttribute.cs delete mode 100644 src/Shared/src/BenchmarkRunner/ParamsDisplayInfoColumn.cs delete mode 100644 src/Shared/src/BenchmarkRunner/Program.cs delete mode 100644 src/Shared/src/EmptyDisposable.cs delete mode 100644 src/Shared/src/HashCodeCombiner/HashCodeCombiner.cs delete mode 100644 src/Shared/src/HashCodeCombiner/Microsoft.Extensions.HashCodeCombiner.Sources.csproj delete mode 100644 src/Shared/src/HostFactoryResolver/HostFactoryResolver.cs delete mode 100644 src/Shared/src/HostFactoryResolver/Microsoft.Extensions.HostFactoryResolver.Sources.csproj delete mode 100644 src/Shared/src/NonCapturingTimer/Microsoft.Extensions.NonCapturingTimer.Sources.csproj delete mode 100644 src/Shared/src/NonCapturingTimer/NonCapturingTimer.cs delete mode 100644 src/Shared/src/ParameterDefaultValue/Microsoft.Extensions.ParameterDefaultValue.Sources.csproj delete mode 100644 src/Shared/src/ParameterDefaultValue/ParameterDefaultValue.cs delete mode 100644 src/Shared/src/ProviderAliasUtilities/ProviderAliasUtilities.cs delete mode 100644 src/Shared/src/TypeNameHelper/Microsoft.Extensions.TypeNameHelper.Sources.csproj delete mode 100644 src/Shared/src/TypeNameHelper/TypeNameHelper.cs delete mode 100644 src/Shared/test/HashCodeCombinerTest.cs delete mode 100644 src/Shared/test/HostFactoryResolverTests.cs delete mode 100644 src/Shared/test/NonCapturingTimerTest.cs delete mode 100644 src/Shared/test/TypeNameHelperTest.cs delete mode 100644 src/Shared/testassets/BuildWebHostInvalidSignature/BuildWebHostInvalidSignature.csproj delete mode 100644 src/Shared/testassets/BuildWebHostInvalidSignature/Program.cs delete mode 100644 src/Shared/testassets/BuildWebHostPatternTestSite/BuildWebHostPatternTestSite.csproj delete mode 100644 src/Shared/testassets/BuildWebHostPatternTestSite/Program.cs delete mode 100644 src/Shared/testassets/CreateHostBuilderInvalidSignature/CreateHostBuilderInvalidSignature.csproj delete mode 100644 src/Shared/testassets/CreateHostBuilderInvalidSignature/Program.cs delete mode 100644 src/Shared/testassets/CreateHostBuilderPatternTestSite/CreateHostBuilderPatternTestSite.csproj delete mode 100644 src/Shared/testassets/CreateHostBuilderPatternTestSite/Program.cs delete mode 100644 src/Shared/testassets/CreateWebHostBuilderInvalidSignature/CreateWebHostBuilderInvalidSignature.csproj delete mode 100644 src/Shared/testassets/CreateWebHostBuilderInvalidSignature/Program.cs delete mode 100644 src/Shared/testassets/CreateWebHostBuilderPatternTestSite/CreateWebHostBuilderPatternTestSite.csproj delete mode 100644 src/Shared/testassets/CreateWebHostBuilderPatternTestSite/Program.cs delete mode 100644 src/Shared/testassets/MockHostTypes/Host.cs delete mode 100644 src/Shared/testassets/MockHostTypes/HostBuilder.cs delete mode 100644 src/Shared/testassets/MockHostTypes/IHost.cs delete mode 100644 src/Shared/testassets/MockHostTypes/IHostBuilder.cs delete mode 100644 src/Shared/testassets/MockHostTypes/IWebHost.cs delete mode 100644 src/Shared/testassets/MockHostTypes/IWebHostBuilder.cs delete mode 100644 src/Shared/testassets/MockHostTypes/MockHostTypes.csproj delete mode 100644 src/Shared/testassets/MockHostTypes/ServiceProvider.cs delete mode 100644 src/Shared/testassets/MockHostTypes/WebHost.cs delete mode 100644 src/Shared/testassets/MockHostTypes/WebHostBuilder.cs delete mode 100644 src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/Microsoft.Internal.Extensions.Refs.csproj delete mode 100644 src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/build/Microsoft.Internal.Extensions.Refs.props delete mode 100644 src/TestingUtils/Internal.AspNetCore.Analyzers/src/Internal.AspNetCore.Analyzers.csproj delete mode 100644 src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubternalityAnalyzer.cs delete mode 100644 src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubturnalityDescriptors.cs delete mode 100644 src/TestingUtils/Internal.AspNetCore.Analyzers/test/Internal.AspNetCore.Analyzers.Tests.csproj delete mode 100644 src/TestingUtils/Internal.AspNetCore.Analyzers/test/PubternabilityAnalyzerTests.cs diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index f35f2a9822e..e17086a2e3a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,5 +10,3 @@ /src/Caching/ @tratcher @anurse /src/Configuration/ @tratcher @anurse /src/Hosting/ @tratcher @anurse -/src/Primitives/ @tratcher @anurse -/src/Shared/src/HostFactoryResolver/ @tratcher @anurse diff --git a/Directory.Build.props b/Directory.Build.props index f0c898a3993..c9d0418f567 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -54,7 +54,7 @@ - diff --git a/eng/Build.props b/eng/Build.props index 3fa0bd004cb..27bd8d621eb 100644 --- a/eng/Build.props +++ b/eng/Build.props @@ -1,8 +1,5 @@ - - false - diff --git a/eng/repo.targets b/eng/repo.targets index 04d1cc71206..a4815877780 100644 --- a/eng/repo.targets +++ b/eng/repo.targets @@ -53,15 +53,4 @@ SkipNonexistentProjects="true" /> - - - $(ArtifactsDir)log\Microsoft.Extensions.Logging.Testing.Tests\$(DefaultNetCoreTargetFramework)\AssemblyTestLogTests\ - $(FunctionalLogDir)FunctionalLogs_LogsPreservedFromFlakyRun.log - $(FunctionalLogDir)FunctionalLogs_LogsPreservedFromNonFlakyRun.log - - - - - - diff --git a/src/Configuration/Config/testassets/Test.Common/ConfigurationProviderExtensions.cs b/src/Configuration/Config.NewtonsoftJson/test/ConfigurationProviderExtensions.cs similarity index 100% rename from src/Configuration/Config/testassets/Test.Common/ConfigurationProviderExtensions.cs rename to src/Configuration/Config.NewtonsoftJson/test/ConfigurationProviderExtensions.cs diff --git a/src/Configuration/Config/test/ConfigurationProviderTestBase.cs b/src/Configuration/Config.NewtonsoftJson/test/ConfigurationProviderTestBase.cs similarity index 100% rename from src/Configuration/Config/test/ConfigurationProviderTestBase.cs rename to src/Configuration/Config.NewtonsoftJson/test/ConfigurationProviderTestBase.cs diff --git a/src/Configuration/Config.NewtonsoftJson/test/Microsoft.Extensions.Configuration.NewtonsoftJson.Tests.csproj b/src/Configuration/Config.NewtonsoftJson/test/Microsoft.Extensions.Configuration.NewtonsoftJson.Tests.csproj index 3f4554b9159..007cfbebb76 100644 --- a/src/Configuration/Config.NewtonsoftJson/test/Microsoft.Extensions.Configuration.NewtonsoftJson.Tests.csproj +++ b/src/Configuration/Config.NewtonsoftJson/test/Microsoft.Extensions.Configuration.NewtonsoftJson.Tests.csproj @@ -4,18 +4,6 @@ $(DefaultNetCoreTargetFramework);net472 - - - test\ConfigurationProviderTestBase.cs - - - testassets\Common\ConfigurationProviderExtensions.cs - - - testassets\Common\TestStreamHelpers.cs - - - diff --git a/src/Configuration/Config/testassets/Test.Common/TestStreamHelpers.cs b/src/Configuration/Config.NewtonsoftJson/test/TestStreamHelpers.cs similarity index 100% rename from src/Configuration/Config/testassets/Test.Common/TestStreamHelpers.cs rename to src/Configuration/Config.NewtonsoftJson/test/TestStreamHelpers.cs diff --git a/src/DependencyInjection/DI.External.Tests/test/Autofac.cs b/src/DependencyInjection/DI.External.Tests/test/Autofac.cs deleted file mode 100644 index 68fc0f2eaef..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/Autofac.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Autofac; -using Autofac.Extensions.DependencyInjection; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class AutofacDependencyInjectionSpecificationTests: DependencyInjectionSpecificationTests - { - protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) - { - var builder = new ContainerBuilder(); - builder.Populate(serviceCollection); - return new AutofacServiceProvider(builder.Build()); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/DryIoc.cs b/src/DependencyInjection/DI.External.Tests/test/DryIoc.cs deleted file mode 100644 index ca6238278cc..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/DryIoc.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using DryIoc; -using DryIoc.Microsoft.DependencyInjection; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class DryIocDependencyInjectionSpecificationTests: DependencyInjectionSpecificationTests - { - protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) - { - return new Container() - .WithDependencyInjectionAdapter(serviceCollection) - .BuildServiceProvider(); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/Grace.cs b/src/DependencyInjection/DI.External.Tests/test/Grace.cs deleted file mode 100644 index 5cfe355fabe..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/Grace.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Grace.DependencyInjection; -using Grace.DependencyInjection.Extensions; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class GraceDependencyInjectionSpecificationTests: SkippableDependencyInjectionSpecificationTests - { - public override string[] SkippedTests => new[] - { - "ResolvesMixedOpenClosedGenericsAsEnumerable", - "TypeActivatorWorksWithCtorWithOptionalArgs_WithStructDefaults" - }; - - protected override IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection) - { - return new DependencyInjectionContainer().Populate(serviceCollection); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/Lamar.cs b/src/DependencyInjection/DI.External.Tests/test/Lamar.cs deleted file mode 100644 index 7e591e1e097..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/Lamar.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class LamarDependencyInjectionSpecificationTests : SkippableDependencyInjectionSpecificationTests - { - public override string[] SkippedTests => new[] - { - "DisposesInReverseOrderOfCreation", - "ResolvesMixedOpenClosedGenericsAsEnumerable" - }; - - protected override IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection) - { - return Lamar.Container.BuildAsync(serviceCollection).Result; - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/LightInject.cs b/src/DependencyInjection/DI.External.Tests/test/LightInject.cs deleted file mode 100644 index 65ab5a605d9..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/LightInject.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Autofac; -using Autofac.Extensions.DependencyInjection; -using LightInject.Microsoft.DependencyInjection; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class LightInjectDependencyInjectionSpecificationTests: DependencyInjectionSpecificationTests - { - protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) - { - var builder = new ContainerBuilder(); - builder.Populate(serviceCollection); - return serviceCollection.CreateLightInjectServiceProvider(); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj b/src/DependencyInjection/DI.External.Tests/test/Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj deleted file mode 100644 index d6b2f1e61e8..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Microsoft.Extensions.DependencyInjection - false - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DependencyInjection/DI.External.Tests/test/SkippableDependencyInjectionSpecificationTests.cs b/src/DependencyInjection/DI.External.Tests/test/SkippableDependencyInjectionSpecificationTests.cs deleted file mode 100644 index 321493bfb16..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/SkippableDependencyInjectionSpecificationTests.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; -using System.Linq; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public abstract class SkippableDependencyInjectionSpecificationTests: DependencyInjectionSpecificationTests - { - public abstract string[] SkippedTests { get; } - - - protected sealed override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) - { - foreach (var stackFrame in new StackTrace(1).GetFrames().Take(2)) - { - if (SkippedTests.Contains(stackFrame.GetMethod().Name)) - { - // We skip tests by returning MEDI service provider that we know passes the test - return serviceCollection.BuildServiceProvider(); - } - } - - return CreateServiceProviderImpl(serviceCollection); - } - - protected abstract IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection); - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/StashBox.cs b/src/DependencyInjection/DI.External.Tests/test/StashBox.cs deleted file mode 100644 index b9f469a528e..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/StashBox.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class StashBoxDependencyInjectionSpecificationTests: DependencyInjectionSpecificationTests - { - protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection) - { - return serviceCollection.UseStashbox(); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/StructureMap.cs b/src/DependencyInjection/DI.External.Tests/test/StructureMap.cs deleted file mode 100644 index 66803d35c86..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/StructureMap.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using StructureMap; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class StructureMapDependencyInjectionSpecificationTests: SkippableDependencyInjectionSpecificationTests - { - public override string[] SkippedTests => new[] - { - "DisposesInReverseOrderOfCreation", - "ResolvesMixedOpenClosedGenericsAsEnumerable" - }; - - protected override IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection) - { - var container = new Container(); - container.Configure(config => - { - config.Populate(serviceCollection); - }); - - return container.GetInstance(); - } - } -} diff --git a/src/DependencyInjection/DI.External.Tests/test/Unity.cs b/src/DependencyInjection/DI.External.Tests/test/Unity.cs deleted file mode 100644 index eb101bc2096..00000000000 --- a/src/DependencyInjection/DI.External.Tests/test/Unity.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class UnityDependencyInjectionSpecificationTests: SkippableDependencyInjectionSpecificationTests - { - public override string[] SkippedTests => new[] - { - "SingletonServiceCanBeResolvedFromScope" - }; - - protected override IServiceProvider CreateServiceProviderImpl(IServiceCollection serviceCollection) - { - return Unity.Microsoft.DependencyInjection.ServiceProviderExtensions.BuildServiceProvider(serviceCollection); - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/ActivatorUtilitiesTests.cs b/src/DependencyInjection/DI.Specification.Tests/src/ActivatorUtilitiesTests.cs deleted file mode 100644 index d653a671f1c..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/ActivatorUtilitiesTests.cs +++ /dev/null @@ -1,399 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Extensions.DependencyInjection.Specification.Fakes; -using Xunit; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public abstract partial class DependencyInjectionSpecificationTests - { - public delegate object CreateInstanceFunc(IServiceProvider provider, Type type, object[] args); - - private static object CreateInstanceDirectly(IServiceProvider provider, Type type, object[] args) - { - return ActivatorUtilities.CreateInstance(provider, type, args); - } - - private static object CreateInstanceFromFactory(IServiceProvider provider, Type type, object[] args) - { - var factory = ActivatorUtilities.CreateFactory(type, args.Select(a => a.GetType()).ToArray()); - return factory(provider, args); - } - - private static T CreateInstance(CreateInstanceFunc func, IServiceProvider provider, params object[] args) - { - return (T)func(provider, typeof(T), args); - } - - public static IEnumerable CreateInstanceFuncs - { - get - { - yield return new[] { (CreateInstanceFunc)CreateInstanceDirectly }; - yield return new[] { (CreateInstanceFunc)CreateInstanceFromFactory }; - } - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorEnablesYouToCreateAnyTypeWithServicesEvenWhenNotInIocContainer(CreateInstanceFunc createFunc) - { - // Arrange - var serviceCollection = new TestServiceCollection() - .AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - var anotherClass = CreateInstance(createFunc, serviceProvider); - - Assert.NotNull(anotherClass.FakeService); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorAcceptsAnyNumberOfAdditionalConstructorParametersToProvide(CreateInstanceFunc createFunc) - { - // Arrange - var serviceCollection = new TestServiceCollection() - .AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act - var anotherClass = CreateInstance(createFunc, serviceProvider, "1", "2"); - - // Assert - Assert.NotNull(anotherClass.FakeService); - Assert.Equal("1", anotherClass.One); - Assert.Equal("2", anotherClass.Two); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorWorksWithStaticCtor(CreateInstanceFunc createFunc) - { - // Act - var anotherClass = CreateInstance(createFunc, provider: null); - - // Assert - Assert.NotNull(anotherClass); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorWorksWithCtorWithOptionalArgs(CreateInstanceFunc createFunc) - { - // Arrange - var provider = new TestServiceCollection(); - var serviceProvider = CreateServiceProvider(provider); - - // Act - var anotherClass = CreateInstance(createFunc, serviceProvider); - - // Assert - Assert.NotNull(anotherClass); - Assert.Equal("BLARGH", anotherClass.Whatever); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorWorksWithCtorWithOptionalArgs_WithStructDefaults(CreateInstanceFunc createFunc) - { - // Arrange - var provider = new TestServiceCollection(); - var serviceProvider = CreateServiceProvider(provider); - - // Act - var anotherClass = CreateInstance(createFunc, serviceProvider); - - // Assert - Assert.NotNull(anotherClass); - Assert.Equal(ConsoleColor.DarkGreen, anotherClass.Color); - Assert.Null(anotherClass.ColorNull); - Assert.Equal(12, anotherClass.Integer); - Assert.Null(anotherClass.IntegerNull); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorCanDisambiguateConstructorsWithUniqueArguments(CreateInstanceFunc createFunc) - { - // Arrange - var serviceCollection = new TestServiceCollection() - .AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act - var instance = CreateInstance(createFunc, serviceProvider, "1", 2); - - // Assert - Assert.NotNull(instance); - Assert.NotNull(instance.FakeService); - Assert.Equal("1", instance.Data1); - Assert.Equal(2, instance.Data2); - } - - public static IEnumerable TypesWithNonPublicConstructorData => - CreateInstanceFuncs.Zip( - new[] { typeof(ClassWithPrivateCtor), typeof(ClassWithInternalConstructor), typeof(ClassWithProtectedConstructor) }, - (a, b) => new object[] { a[0], b }); - - [Theory] - [MemberData(nameof(TypesWithNonPublicConstructorData))] - public void TypeActivatorRequiresPublicConstructor(CreateInstanceFunc createFunc, Type type) - { - // Arrange - var expectedMessage = $"A suitable constructor for type '{type}' could not be located. " + - "Ensure the type is concrete and services are registered for all parameters of a public constructor."; - - // Act and Assert - var ex = Assert.Throws(() => - createFunc(provider: null, type: type, args: new object[0])); - - Assert.Equal(expectedMessage, ex.Message); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorRequiresAllArgumentsCanBeAccepted(CreateInstanceFunc createFunc) - { - // Arrange - var expectedMessage = $"A suitable constructor for type '{typeof(AnotherClassAcceptingData).FullName}' could not be located. " + - "Ensure the type is concrete and services are registered for all parameters of a public constructor."; - var serviceCollection = new TestServiceCollection() - .AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - var ex1 = Assert.Throws(() => - CreateInstance(createFunc, serviceProvider, "1", "2", "3")); - var ex2 = Assert.Throws(() => - CreateInstance(createFunc, serviceProvider, 1, 2)); - - Assert.Equal(expectedMessage, ex1.Message); - Assert.Equal(expectedMessage, ex2.Message); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorRethrowsOriginalExceptionFromConstructor(CreateInstanceFunc createFunc) - { - // Act - var ex1 = Assert.Throws(() => - CreateInstance(createFunc, provider: null)); - - var ex2 = Assert.Throws(() => - CreateInstance(createFunc, provider: null, args: new[] { new FakeService() })); - - // Assert - Assert.Equal(nameof(ClassWithThrowingEmptyCtor), ex1.Message); - Assert.Equal(nameof(ClassWithThrowingCtor), ex2.Message); - } - - [Theory] - [InlineData(typeof(string))] - [InlineData(typeof(int))] - public void TypeActivatorCreateFactoryDoesNotAllowForAmbiguousConstructorMatches(Type paramType) - { - // Arrange - var type = typeof(ClassWithAmbiguousCtors); - var expectedMessage = $"Multiple constructors accepting all given argument types have been found in type '{type}'. " + - "There should only be one applicable constructor."; - - // Act - var ex = Assert.Throws(() => - ActivatorUtilities.CreateFactory(type, new[] { paramType })); - - // Assert - Assert.Equal(expectedMessage, ex.Message); - } - - [Theory] - [InlineData("", "string")] - [InlineData(5, "IFakeService, int")] - public void TypeActivatorCreateInstanceUsesFirstMathchedConstructor(object value, string ctor) - { - // Arrange - var serviceCollection = new TestServiceCollection(); - serviceCollection.AddSingleton(); - var serviceProvider = CreateServiceProvider(serviceCollection); - var type = typeof(ClassWithAmbiguousCtors); - - // Act - var instance = ActivatorUtilities.CreateInstance(serviceProvider, type, value); - - // Assert - Assert.Equal(ctor, ((ClassWithAmbiguousCtors)instance).CtorUsed); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorUsesMarkedConstructor(CreateInstanceFunc createFunc) - { - // Arrange - var serviceCollection = new TestServiceCollection(); - serviceCollection.AddSingleton(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act - var instance = CreateInstance(createFunc, serviceProvider, "hello"); - - // Assert - Assert.Equal("IFakeService, string", instance.CtorUsed); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorThrowsOnMultipleMarkedCtors(CreateInstanceFunc createFunc) - { - // Act - var exception = Assert.Throws(() => CreateInstance(createFunc, null, "hello")); - - // Assert - Assert.Equal("Multiple constructors were marked with ActivatorUtilitiesConstructorAttribute.", exception.Message); - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void TypeActivatorThrowsWhenMarkedCtorDoesntAcceptArguments(CreateInstanceFunc createFunc) - { - // Act - var exception = Assert.Throws(() => CreateInstance(createFunc, null, 0, "hello")); - - // Assert - Assert.Equal("Constructor marked with ActivatorUtilitiesConstructorAttribute does not accept all given argument types.", exception.Message); - } - - [Fact] - public void GetServiceOrCreateInstanceRegisteredServiceTransient() - { - // Reset the count because test order is not guaranteed - lock (CreationCountFakeService.InstanceLock) - { - CreationCountFakeService.InstanceCount = 0; - - var serviceCollection = new TestServiceCollection() - .AddTransient() - .AddTransient(); - - var serviceProvider = CreateServiceProvider(serviceCollection); - - var service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); - Assert.NotNull(service); - Assert.Equal(1, service.InstanceId); - Assert.Equal(1, CreationCountFakeService.InstanceCount); - - service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); - Assert.NotNull(service); - Assert.Equal(2, service.InstanceId); - Assert.Equal(2, CreationCountFakeService.InstanceCount); - } - } - - [Fact] - public void GetServiceOrCreateInstanceRegisteredServiceSingleton() - { - lock (CreationCountFakeService.InstanceLock) - { - // Arrange - // Reset the count because test order is not guaranteed - CreationCountFakeService.InstanceCount = 0; - - var serviceCollection = new TestServiceCollection() - .AddTransient() - .AddSingleton(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act and Assert - var service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); - Assert.NotNull(service); - Assert.Equal(1, service.InstanceId); - Assert.Equal(1, CreationCountFakeService.InstanceCount); - - service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); - Assert.NotNull(service); - Assert.Equal(1, service.InstanceId); - Assert.Equal(1, CreationCountFakeService.InstanceCount); - } - } - - [Fact] - public void GetServiceOrCreateInstanceUnregisteredService() - { - lock (CreationCountFakeService.InstanceLock) - { - // Arrange - // Reset the count because test order is not guaranteed - CreationCountFakeService.InstanceCount = 0; - - var serviceCollection = new TestServiceCollection() - .AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act and Assert - var service = (CreationCountFakeService)ActivatorUtilities.GetServiceOrCreateInstance( - serviceProvider, - typeof(CreationCountFakeService)); - Assert.NotNull(service); - Assert.Equal(1, service.InstanceId); - Assert.Equal(1, CreationCountFakeService.InstanceCount); - - service = ActivatorUtilities.GetServiceOrCreateInstance(serviceProvider); - Assert.NotNull(service); - Assert.Equal(2, service.InstanceId); - Assert.Equal(2, CreationCountFakeService.InstanceCount); - } - } - - [Theory] - [MemberData(nameof(CreateInstanceFuncs))] - public void UnRegisteredServiceAsConstructorParameterThrowsException(CreateInstanceFunc createFunc) - { - var serviceCollection = new TestServiceCollection() - .AddSingleton(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - var ex = Assert.Throws(() => - CreateInstance(createFunc, serviceProvider)); - Assert.Equal($"Unable to resolve service for type '{typeof(IFakeService)}' while attempting" + - $" to activate '{typeof(CreationCountFakeService)}'.", - ex.Message); - } - - [Fact] - public void CreateInstance_WithAbstractTypeAndPublicConstructor_ThrowsCorrectException() - { - // Act & Assert - var ex = Assert.Throws(() => ActivatorUtilities.CreateInstance(default(IServiceProvider), typeof(AbstractFoo))); - var msg = "A suitable constructor for type 'Microsoft.Extensions.DependencyInjection.Specification.DependencyInjectionSpecificationTests+AbstractFoo' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor."; - Assert.Equal(msg, ex.Message); - } - - [Fact] - public void CreateInstance_CapturesInnerException_OfTargetInvocationException() - { - // Act & Assert - var ex = Assert.Throws(() => ActivatorUtilities.CreateInstance(default(IServiceProvider), typeof(Bar))); - var msg = "some error"; - Assert.Equal(msg, ex.Message); - } - - abstract class AbstractFoo - { - // The constructor should be public, since that is checked as well. - public AbstractFoo() - { - } - } - - class Bar - { - public Bar() - { - throw new InvalidOperationException("some error"); - } - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/DependencyInjectionSpecificationTests.cs b/src/DependencyInjection/DI.Specification.Tests/src/DependencyInjectionSpecificationTests.cs deleted file mode 100644 index beed0c8661e..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/DependencyInjectionSpecificationTests.cs +++ /dev/null @@ -1,779 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Microsoft.Extensions.DependencyInjection.Specification.Fakes; -using Xunit; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public abstract partial class DependencyInjectionSpecificationTests - { - protected abstract IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection); - - [Fact] - public void ServicesRegisteredWithImplementationTypeCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService(); - - // Assert - Assert.NotNull(service); - Assert.IsType(service); - } - - [Fact] - public void ServicesRegisteredWithImplementationType_ReturnDifferentInstancesPerResolution_ForTransientServices() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - var service2 = provider.GetService(); - - // Assert - Assert.IsType(service1); - Assert.IsType(service2); - Assert.NotSame(service1, service2); - } - - [Fact] - public void ServicesRegisteredWithImplementationType_ReturnSameInstancesPerResolution_ForSingletons() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddSingleton(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - var service2 = provider.GetService(); - - // Assert - Assert.IsType(service1); - Assert.IsType(service2); - Assert.Same(service1, service2); - } - - [Fact] - public void ServiceInstanceCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - var instance = new FakeService(); - collection.AddSingleton(typeof(IFakeServiceInstance), instance); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService(); - - // Assert - Assert.Same(instance, service); - } - - [Fact] - public void TransientServiceCanBeResolvedFromProvider() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - var service2 = provider.GetService(); - - // Assert - Assert.NotNull(service1); - Assert.NotSame(service1, service2); - } - - [Fact] - public void TransientServiceCanBeResolvedFromScope() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - - using (var scope = provider.CreateScope()) - { - var scopedService1 = scope.ServiceProvider.GetService(); - var scopedService2 = scope.ServiceProvider.GetService(); - - // Assert - Assert.NotSame(service1, scopedService1); - Assert.NotSame(service1, scopedService2); - Assert.NotSame(scopedService1, scopedService2); - } - } - - [Fact] - public void SingletonServiceCanBeResolvedFromScope() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddSingleton(); - var provider = CreateServiceProvider(collection); - - // Act - IServiceProvider scopedSp1 = null; - IServiceProvider scopedSp2 = null; - ClassWithServiceProvider instance1 = null; - ClassWithServiceProvider instance2 = null; - - using (var scope1 = provider.CreateScope()) - { - scopedSp1 = scope1.ServiceProvider; - instance1 = scope1.ServiceProvider.GetRequiredService(); - } - - using (var scope2 = provider.CreateScope()) - { - scopedSp2 = scope2.ServiceProvider; - instance2 = scope2.ServiceProvider.GetRequiredService(); - } - - // Assert - Assert.Same(instance1.ServiceProvider, instance2.ServiceProvider); - Assert.NotSame(instance1.ServiceProvider, scopedSp1); - Assert.NotSame(instance2.ServiceProvider, scopedSp2); - } - - [Fact] - public void SingleServiceCanBeIEnumerableResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeService), typeof(FakeService)); - var provider = CreateServiceProvider(collection); - - // Act - var services = provider.GetService>(); - - // Assert - Assert.NotNull(services); - var service = Assert.Single(services); - Assert.IsType(service); - } - - [Fact] - public void MultipleServiceCanBeIEnumerableResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeOneMultipleService)); - collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeTwoMultipleService)); - var provider = CreateServiceProvider(collection); - - // Act - var services = provider.GetService>(); - - // Assert - Assert.Collection(services.OrderBy(s => s.GetType().FullName), - service => Assert.IsType(service), - service => Assert.IsType(service)); - } - - [Fact] - public void RegistrationOrderIsPreservedWhenServicesAreIEnumerableResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeOneMultipleService)); - collection.AddTransient(typeof(IFakeMultipleService), typeof(FakeTwoMultipleService)); - - var provider = CreateServiceProvider(collection); - - collection.Reverse(); - var providerReversed = CreateServiceProvider(collection); - - // Act - var services = provider.GetService>(); - var servicesReversed = providerReversed.GetService>(); - - // Assert - Assert.Collection(services, - service => Assert.IsType(service), - service => Assert.IsType(service)); - - Assert.Collection(servicesReversed, - service => Assert.IsType(service), - service => Assert.IsType(service)); - } - - [Fact] - public void OuterServiceCanHaveOtherServicesInjected() - { - // Arrange - var collection = new TestServiceCollection(); - var fakeService = new FakeService(); - collection.AddTransient(); - collection.AddSingleton(fakeService); - collection.AddTransient(); - collection.AddTransient(); - var provider = CreateServiceProvider(collection); - - // Act - var services = provider.GetService(); - - // Assert - Assert.Same(fakeService, services.SingleService); - Assert.Collection(services.MultipleServices.OrderBy(s => s.GetType().FullName), - service => Assert.IsType(service), - service => Assert.IsType(service)); - } - - [Fact] - public void FactoryServicesCanBeCreatedByGetService() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(); - collection.AddTransient(p => - { - var fakeService = p.GetRequiredService(); - return new TransientFactoryService - { - FakeService = fakeService, - Value = 42 - }; - }); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService(); - - // Assert - Assert.NotNull(service); - Assert.Equal(42, service.Value); - Assert.NotNull(service.FakeService); - Assert.IsType(service.FakeService); - } - - [Fact] - public void FactoryServicesAreCreatedAsPartOfCreatingObjectGraph() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(); - collection.AddTransient(p => - { - var fakeService = p.GetService(); - return new TransientFactoryService - { - FakeService = fakeService, - Value = 42 - }; - }); - collection.AddScoped(p => - { - var fakeService = p.GetService(); - return new ScopedFactoryService - { - FakeService = fakeService, - }; - }); - collection.AddTransient(); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - var service2 = provider.GetService(); - - // Assert - Assert.Equal(42, service1.TransientService.Value); - Assert.NotNull(service1.TransientService.FakeService); - - Assert.Equal(42, service2.TransientService.Value); - Assert.NotNull(service2.TransientService.FakeService); - - Assert.NotNull(service1.ScopedService.FakeService); - - // Verify scoping works - Assert.NotSame(service1.TransientService, service2.TransientService); - Assert.Same(service1.ScopedService, service2.ScopedService); - } - - [Fact] - public void LastServiceReplacesPreviousServices() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(); - collection.AddTransient(); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService(); - - // Assert - Assert.IsType(service); - } - - [Fact] - public void SingletonServiceCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddSingleton(); - var provider = CreateServiceProvider(collection); - - // Act - var service1 = provider.GetService(); - var service2 = provider.GetService(); - - // Assert - Assert.NotNull(service1); - Assert.Same(service1, service2); - } - - [Fact] - public void ServiceProviderRegistersServiceScopeFactory() - { - // Arrange - var collection = new TestServiceCollection(); - var provider = CreateServiceProvider(collection); - - // Act - var scopeFactory = provider.GetService(); - - // Assert - Assert.NotNull(scopeFactory); - } - - [Fact] - public void ScopedServiceCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddScoped(); - var provider = CreateServiceProvider(collection); - - // Act - using (var scope = provider.CreateScope()) - { - var providerScopedService = provider.GetService(); - var scopedService1 = scope.ServiceProvider.GetService(); - var scopedService2 = scope.ServiceProvider.GetService(); - - // Assert - Assert.NotSame(providerScopedService, scopedService1); - Assert.Same(scopedService1, scopedService2); - } - } - - [Fact] - public void NestedScopedServiceCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddScoped(); - var provider = CreateServiceProvider(collection); - - // Act - using (var outerScope = provider.CreateScope()) - using (var innerScope = outerScope.ServiceProvider.CreateScope()) - { - var outerScopedService = outerScope.ServiceProvider.GetService(); - var innerScopedService = innerScope.ServiceProvider.GetService(); - - // Assert - Assert.NotNull(outerScopedService); - Assert.NotNull(innerScopedService); - Assert.NotSame(outerScopedService, innerScopedService); - } - } - - [Fact] - public void ScopedServices_FromCachedScopeFactory_CanBeResolvedAndDisposed() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddScoped(); - var provider = CreateServiceProvider(collection); - var cachedScopeFactory = provider.GetService(); - - // Act - for (var i = 0; i < 3; i++) - { - FakeService outerScopedService; - using (var outerScope = cachedScopeFactory.CreateScope()) - { - FakeService innerScopedService; - using (var innerScope = outerScope.ServiceProvider.CreateScope()) - { - outerScopedService = outerScope.ServiceProvider.GetService() as FakeService; - innerScopedService = innerScope.ServiceProvider.GetService() as FakeService; - - // Assert - Assert.NotNull(outerScopedService); - Assert.NotNull(innerScopedService); - Assert.NotSame(outerScopedService, innerScopedService); - } - - Assert.False(outerScopedService.Disposed); - Assert.True(innerScopedService.Disposed); - } - - Assert.True(outerScopedService.Disposed); - } - } - - [Fact] - public void DisposingScopeDisposesService() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddSingleton(); - collection.AddScoped(); - collection.AddTransient(); - - var provider = CreateServiceProvider(collection); - FakeService disposableService; - FakeService transient1; - FakeService transient2; - FakeService singleton; - - // Act and Assert - var transient3 = Assert.IsType(provider.GetService()); - using (var scope = provider.CreateScope()) - { - disposableService = (FakeService)scope.ServiceProvider.GetService(); - transient1 = (FakeService)scope.ServiceProvider.GetService(); - transient2 = (FakeService)scope.ServiceProvider.GetService(); - singleton = (FakeService)scope.ServiceProvider.GetService(); - - Assert.False(disposableService.Disposed); - Assert.False(transient1.Disposed); - Assert.False(transient2.Disposed); - Assert.False(singleton.Disposed); - } - - Assert.True(disposableService.Disposed); - Assert.True(transient1.Disposed); - Assert.True(transient2.Disposed); - Assert.False(singleton.Disposed); - - var disposableProvider = provider as IDisposable; - if (disposableProvider != null) - { - disposableProvider.Dispose(); - Assert.True(singleton.Disposed); - Assert.True(transient3.Disposed); - } - } - - [Fact] - public void SelfResolveThenDispose() - { - // Arrange - var collection = new TestServiceCollection(); - var provider = CreateServiceProvider(collection); - - // Act - var serviceProvider = provider.GetService(); - - // Assert - Assert.NotNull(serviceProvider); - (provider as IDisposable)?.Dispose(); - } - - [Fact] - public void SafelyDisposeNestedProviderReferences() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(); - var provider = CreateServiceProvider(collection); - - // Act - var nester = provider.GetService(); - - // Assert - Assert.NotNull(nester); - nester.Dispose(); - } - - [Fact] - public void SingletonServicesComeFromRootProvider() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddSingleton(); - var provider = CreateServiceProvider(collection); - FakeService disposableService1; - FakeService disposableService2; - - // Act and Assert - using (var scope = provider.CreateScope()) - { - var service = scope.ServiceProvider.GetService(); - disposableService1 = Assert.IsType(service); - Assert.False(disposableService1.Disposed); - } - - Assert.False(disposableService1.Disposed); - - using (var scope = provider.CreateScope()) - { - var service = scope.ServiceProvider.GetService(); - disposableService2 = Assert.IsType(service); - Assert.False(disposableService2.Disposed); - } - - Assert.False(disposableService2.Disposed); - Assert.Same(disposableService1, disposableService2); - } - - [Fact] - public void NestedScopedServiceCanBeResolvedWithNoFallbackProvider() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddScoped(); - var provider = CreateServiceProvider(collection); - - // Act - using (var outerScope = provider.CreateScope()) - using (var innerScope = outerScope.ServiceProvider.CreateScope()) - { - var outerScopedService = outerScope.ServiceProvider.GetService(); - var innerScopedService = innerScope.ServiceProvider.GetService(); - - // Assert - Assert.NotSame(outerScopedService, innerScopedService); - } - } - - [Fact] - public void OpenGenericServicesCanBeResolved() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); - collection.AddSingleton(); - var provider = CreateServiceProvider(collection); - - // Act - var genericService = provider.GetService>(); - var singletonService = provider.GetService(); - - // Assert - Assert.Same(singletonService, genericService.Value); - } - - [Fact] - public void ClosedServicesPreferredOverOpenGenericServices() - { - // Arrange - var collection = new TestServiceCollection(); - collection.AddTransient(typeof(IFakeOpenGenericService), typeof(FakeService)); - collection.AddTransient(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); - collection.AddSingleton(); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService>(); - - // Assert - Assert.IsType(service); - } - - [Fact] - public void AttemptingToResolveNonexistentServiceReturnsNull() - { - // Arrange - var collection = new TestServiceCollection(); - var provider = CreateServiceProvider(collection); - - // Act - var service = provider.GetService(); - - // Assert - Assert.Null(service); - } - - [Fact] - public void NonexistentServiceCanBeIEnumerableResolved() - { - // Arrange - var collection = new TestServiceCollection(); - var provider = CreateServiceProvider(collection); - - // Act - var services = provider.GetService>(); - - // Assert - Assert.Empty(services); - } - - public static TheoryData ServiceContainerPicksConstructorWithLongestMatchesData - { - get - { - var fakeService = new FakeService(); - var multipleService = new FakeService(); - var factoryService = new TransientFactoryService(); - var scopedService = new FakeService(); - - return new TheoryData - { - { - new TestServiceCollection() - .AddSingleton(fakeService), - new TypeWithSupersetConstructors(fakeService) - }, - { - new TestServiceCollection() - .AddSingleton(factoryService), - new TypeWithSupersetConstructors(factoryService) - }, - { - new TestServiceCollection() - .AddSingleton(fakeService) - .AddSingleton(factoryService), - new TypeWithSupersetConstructors(fakeService, factoryService) - }, - { - new TestServiceCollection() - .AddSingleton(fakeService) - .AddSingleton(multipleService) - .AddSingleton(factoryService), - new TypeWithSupersetConstructors(fakeService, multipleService, factoryService) - }, - { - new TestServiceCollection() - .AddSingleton(fakeService) - .AddSingleton(multipleService) - .AddSingleton(scopedService) - .AddSingleton(factoryService), - new TypeWithSupersetConstructors(multipleService, factoryService, fakeService, scopedService) - } - }; - } - } - - [Theory] - [MemberData(nameof(ServiceContainerPicksConstructorWithLongestMatchesData))] - public void ServiceContainerPicksConstructorWithLongestMatches( - IServiceCollection serviceCollection, - TypeWithSupersetConstructors expected) - { - // Arrange - serviceCollection.AddTransient(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - // Act - var actual = serviceProvider.GetService(); - - // Assert - Assert.NotNull(actual); - Assert.Same(expected.Service, actual.Service); - Assert.Same(expected.FactoryService, actual.FactoryService); - Assert.Same(expected.MultipleService, actual.MultipleService); - Assert.Same(expected.ScopedService, actual.ScopedService); - } - - [Fact] - public void DisposesInReverseOrderOfCreation() - { - // Arrange - var serviceCollection = new TestServiceCollection(); - serviceCollection.AddSingleton(); - serviceCollection.AddTransient(); - serviceCollection.AddSingleton(); - serviceCollection.AddScoped(); - serviceCollection.AddTransient(); - serviceCollection.AddSingleton(); - var serviceProvider = CreateServiceProvider(serviceCollection); - - var callback = serviceProvider.GetService(); - var outer = serviceProvider.GetService(); - var multipleServices = outer.MultipleServices.ToArray(); - - // Act - ((IDisposable)serviceProvider).Dispose(); - - // Assert - Assert.Equal(outer, callback.Disposed[0]); - Assert.Equal(multipleServices.Reverse(), callback.Disposed.Skip(1).Take(3).OfType()); - Assert.Equal(outer.SingleService, callback.Disposed[4]); - } - - [Fact] - public void ResolvesMixedOpenClosedGenericsAsEnumerable() - { - // Arrange - var serviceCollection = new TestServiceCollection(); - var instance = new FakeOpenGenericService(null); - - serviceCollection.AddTransient(); - serviceCollection.AddSingleton(typeof(IFakeOpenGenericService), typeof(FakeService)); - serviceCollection.AddSingleton(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>)); - serviceCollection.AddSingleton>(instance); - - var serviceProvider = CreateServiceProvider(serviceCollection); - - var enumerable = serviceProvider.GetService>>().ToArray(); - - // Assert - Assert.Equal(3, enumerable.Length); - Assert.NotNull(enumerable[0]); - Assert.NotNull(enumerable[1]); - Assert.NotNull(enumerable[2]); - - Assert.Equal(instance, enumerable[2]); - Assert.IsType(enumerable[0]); - } - - [Theory] - [InlineData(typeof(IFakeService), typeof(FakeService), typeof(IFakeService), ServiceLifetime.Scoped)] - [InlineData(typeof(IFakeService), typeof(FakeService), typeof(IFakeService), ServiceLifetime.Singleton)] - [InlineData(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>), typeof(IFakeOpenGenericService), ServiceLifetime.Scoped)] - [InlineData(typeof(IFakeOpenGenericService<>), typeof(FakeOpenGenericService<>), typeof(IFakeOpenGenericService), ServiceLifetime.Singleton)] - public void ResolvesDifferentInstancesForServiceWhenResolvingEnumerable(Type serviceType, Type implementation, Type resolve, ServiceLifetime lifetime) - { - // Arrange - var serviceCollection = new TestServiceCollection - { - ServiceDescriptor.Describe(serviceType, implementation, lifetime), - ServiceDescriptor.Describe(serviceType, implementation, lifetime), - ServiceDescriptor.Describe(serviceType, implementation, lifetime) - }; - - var serviceProvider = CreateServiceProvider(serviceCollection); - using (var scope = serviceProvider.CreateScope()) - { - var enumerable = (scope.ServiceProvider.GetService(typeof(IEnumerable<>).MakeGenericType(resolve)) as IEnumerable) - .OfType().ToArray(); - var service = scope.ServiceProvider.GetService(resolve); - - // Assert - Assert.Equal(3, enumerable.Length); - Assert.NotNull(enumerable[0]); - Assert.NotNull(enumerable[1]); - Assert.NotNull(enumerable[2]); - - Assert.NotEqual(enumerable[0], enumerable[1]); - Assert.NotEqual(enumerable[1], enumerable[2]); - Assert.Equal(service, enumerable[2]); - } - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClass.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClass.cs deleted file mode 100644 index 40a92237bfb..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClass.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class AnotherClass - { - public AnotherClass(IFakeService fakeService) - { - FakeService = fakeService; - } - - public IFakeService FakeService { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClassAcceptingData.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClassAcceptingData.cs deleted file mode 100644 index 4f9dcda0ae3..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/AnotherClassAcceptingData.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class AnotherClassAcceptingData - { - public AnotherClassAcceptingData(IFakeService fakeService, string one, string two) - { - FakeService = fakeService; - One = one; - Two = two; - } - - public IFakeService FakeService { get; } - - public string One { get; } - - public string Two { get; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtors.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtors.cs deleted file mode 100644 index 55ec934be20..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtors.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithAmbiguousCtors - { - public ClassWithAmbiguousCtors(string data) - { - CtorUsed = "string"; - } - - public ClassWithAmbiguousCtors(IFakeService service, string data) - { - CtorUsed = "IFakeService, string"; - } - - public ClassWithAmbiguousCtors(IFakeService service, int data) - { - CtorUsed = "IFakeService, int"; - } - - public ClassWithAmbiguousCtors(IFakeService service, string data1, int data2) - { - FakeService = service; - Data1 = data1; - Data2 = data2; - - CtorUsed = "IFakeService, string, string"; - } - - public IFakeService FakeService { get; } - - public string Data1 { get; } - - public int Data2 { get; } - public string CtorUsed { get; set; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs deleted file mode 100644 index b0e7d2284cd..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithAmbiguousCtorsAndAttribute.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithAmbiguousCtorsAndAttribute - { - public ClassWithAmbiguousCtorsAndAttribute(string data) - { - CtorUsed = "string"; - } - - [ActivatorUtilitiesConstructor] - public ClassWithAmbiguousCtorsAndAttribute(IFakeService service, string data) - { - CtorUsed = "IFakeService, string"; - } - - public ClassWithAmbiguousCtorsAndAttribute(IFakeService service, IFakeOuterService service2, string data) - { - CtorUsed = "IFakeService, IFakeService, string"; - } - - public string CtorUsed { get; set; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithInternalConstructor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithInternalConstructor.cs deleted file mode 100644 index 220d3e86d39..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithInternalConstructor.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection -{ - public class ClassWithInternalConstructor - { - internal ClassWithInternalConstructor() - { - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithMultipleMarkedCtors.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithMultipleMarkedCtors.cs deleted file mode 100644 index 9cb04aafd63..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithMultipleMarkedCtors.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithMultipleMarkedCtors - { - [ActivatorUtilitiesConstructor] - public ClassWithMultipleMarkedCtors(string data) - { - } - - [ActivatorUtilitiesConstructor] - public ClassWithMultipleMarkedCtors(IFakeService service, string data) - { - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithNestedReferencesToProvider.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithNestedReferencesToProvider.cs deleted file mode 100644 index 1813db134fa..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithNestedReferencesToProvider.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithNestedReferencesToProvider : IDisposable - { - private IServiceProvider _serviceProvider; - private ClassWithNestedReferencesToProvider _nested; - - public ClassWithNestedReferencesToProvider(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - _nested = new ClassWithNestedReferencesToProvider(_serviceProvider, 0); - } - - private ClassWithNestedReferencesToProvider(IServiceProvider serviceProvider, int level) - { - _serviceProvider = serviceProvider; - if (level > 1) - { - _nested = new ClassWithNestedReferencesToProvider(_serviceProvider, level + 1); - } - } - - public void Dispose() - { - _nested?.Dispose(); - (_serviceProvider as IDisposable)?.Dispose(); - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtor.cs deleted file mode 100644 index 810804bafcc..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtor.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class ClassWithOptionalArgsCtor - { - public ClassWithOptionalArgsCtor(string whatever = "BLARGH") - { - Whatever = whatever; - } - - public string Whatever { get; set; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtorWithStructs.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtorWithStructs.cs deleted file mode 100644 index d0b2588211e..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithOptionalArgsCtorWithStructs.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - public class ClassWithOptionalArgsCtorWithStructs - { - public ConsoleColor? Color { get; } - public ConsoleColor? ColorNull { get; } - - public int? Integer { get; } - public int? IntegerNull { get; } - - public ClassWithOptionalArgsCtorWithStructs( - DateTime dateTime = new DateTime(), - DateTime dateTimeDefault = default(DateTime), - TimeSpan timeSpan = new TimeSpan(), - TimeSpan timeSpanDefault = default(TimeSpan), - DateTimeOffset dateTimeOffset = new DateTimeOffset(), - DateTimeOffset dateTimeOffsetDefault = default(DateTimeOffset), - Guid guid = new Guid(), - Guid guidDefault = default(Guid), - CustomStruct customStruct = new CustomStruct(), - CustomStruct customStructDefault = default(CustomStruct), - ConsoleColor? color = ConsoleColor.DarkGreen, - ConsoleColor? colorNull = null, - int? integer = 12, - int? integerNull = null - ) - { - Color = color; - ColorNull = colorNull; - Integer = integer; - IntegerNull = integerNull; - } - - public struct CustomStruct { } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithPrivateCtor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithPrivateCtor.cs deleted file mode 100644 index f0ef2a678c7..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithPrivateCtor.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithPrivateCtor - { - private ClassWithPrivateCtor() - { - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithProtectedConstructor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithProtectedConstructor.cs deleted file mode 100644 index d3098dcd09b..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithProtectedConstructor.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithProtectedConstructor - { - internal ClassWithProtectedConstructor() - { - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithServiceProvider.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithServiceProvider.cs deleted file mode 100644 index 1003e997658..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithServiceProvider.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithServiceProvider - { - public ClassWithServiceProvider(IServiceProvider serviceProvider) - { - ServiceProvider = serviceProvider; - } - - public IServiceProvider ServiceProvider { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithStaticCtor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithStaticCtor.cs deleted file mode 100644 index ebd631b17e9..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithStaticCtor.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithStaticCtor - { - static ClassWithStaticCtor() - { - - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingCtor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingCtor.cs deleted file mode 100644 index 575d1811711..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingCtor.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithThrowingCtor - { - public ClassWithThrowingCtor(IFakeService service) - { - throw new Exception(nameof(ClassWithThrowingCtor)); - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingEmptyCtor.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingEmptyCtor.cs deleted file mode 100644 index 9ecc4b23324..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ClassWithThrowingEmptyCtor.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ClassWithThrowingEmptyCtor - { - public ClassWithThrowingEmptyCtor() - { - throw new Exception(nameof(ClassWithThrowingEmptyCtor)); - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/CreationCountFakeService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/CreationCountFakeService.cs deleted file mode 100644 index 8c9a21912b0..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/CreationCountFakeService.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class CreationCountFakeService - { - public static readonly object InstanceLock = new object(); - - public CreationCountFakeService(IFakeService dependency) - { - InstanceCount++; - InstanceId = InstanceCount; - } - - public static int InstanceCount { get; set; } - - public int InstanceId { get; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackInnerService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackInnerService.cs deleted file mode 100644 index 2acc2204591..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackInnerService.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeDisposableCallbackInnerService : FakeDisposableCallbackService, IFakeMultipleService - { - public FakeDisposableCallbackInnerService(FakeDisposeCallback callback) : base(callback) - { - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackOuterService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackOuterService.cs deleted file mode 100644 index 7ef95a854b0..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackOuterService.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeDisposableCallbackOuterService : FakeDisposableCallbackService, IFakeOuterService - { - public FakeDisposableCallbackOuterService( - IFakeService singleService, - IEnumerable multipleServices, - FakeDisposeCallback callback) : base(callback) - { - SingleService = singleService; - MultipleServices = multipleServices.ToArray(); - } - - public IFakeService SingleService { get; } - public IEnumerable MultipleServices { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackService.cs deleted file mode 100644 index 5f29aa01ed1..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposableCallbackService.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeDisposableCallbackService: IDisposable - { - private static int _globalId; - private readonly int _id; - private readonly FakeDisposeCallback _callback; - - public FakeDisposableCallbackService(FakeDisposeCallback callback) - { - _id = _globalId++; - _callback = callback; - } - - public void Dispose() - { - _callback.Disposed.Add(this); - } - - public override string ToString() - { - return _id.ToString(); - } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposeCallback.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposeCallback.cs deleted file mode 100644 index 8d0ca9f446f..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeDisposeCallback.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeDisposeCallback - { - public List Disposed { get; } = new List(); - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOneMultipleService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOneMultipleService.cs deleted file mode 100644 index a5d3cd1451c..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOneMultipleService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeOneMultipleService : IFakeMultipleService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOpenGenericService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOpenGenericService.cs deleted file mode 100644 index c2be6bc4c1b..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOpenGenericService.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeOpenGenericService : IFakeOpenGenericService - { - public FakeOpenGenericService(TVal value) - { - Value = value; - } - - public TVal Value { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOuterService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOuterService.cs deleted file mode 100644 index 667f911557e..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeOuterService.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeOuterService : IFakeOuterService - { - public FakeOuterService( - IFakeService singleService, - IEnumerable multipleServices) - { - SingleService = singleService; - MultipleServices = multipleServices; - } - - public IFakeService SingleService { get; } - - public IEnumerable MultipleServices { get; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeService.cs deleted file mode 100644 index 3fccf3de00b..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeService.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeService : IFakeEveryService, IDisposable - { - public PocoClass Value { get; set; } - - public bool Disposed { get; private set; } - - public void Dispose() - { - if (Disposed) - { - throw new ObjectDisposedException(nameof(FakeService)); - } - - Disposed = true; - } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeTwoMultipleService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeTwoMultipleService.cs deleted file mode 100644 index 89fcab70108..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/FakeTwoMultipleService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class FakeTwoMultipleService : IFakeMultipleService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFactoryService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFactoryService.cs deleted file mode 100644 index ddbc44f20fb..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFactoryService.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFactoryService - { - IFakeService FakeService { get; } - - int Value { get; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeEveryService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeEveryService.cs deleted file mode 100644 index 9e24521a65a..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeEveryService.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeEveryService : - IFakeService, - IFakeMultipleService, - IFakeScopedService, - IFakeServiceInstance, - IFakeSingletonService, - IFakeOpenGenericService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeMultipleService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeMultipleService.cs deleted file mode 100644 index a38394c665f..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeMultipleService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeMultipleService : IFakeService - { - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOpenGenericService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOpenGenericService.cs deleted file mode 100644 index 12dc7142557..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOpenGenericService.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeOpenGenericService - { - TValue Value { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOuterService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOuterService.cs deleted file mode 100644 index f4bd3e3a2da..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeOuterService.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeOuterService - { - IFakeService SingleService { get; } - - IEnumerable MultipleServices { get; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeScopedService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeScopedService.cs deleted file mode 100644 index 9f3f4f000df..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeScopedService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeScopedService : IFakeService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeService.cs deleted file mode 100644 index 391bf2edf3d..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeService - { - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeServiceInstance.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeServiceInstance.cs deleted file mode 100644 index e6ed4019e37..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeServiceInstance.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeServiceInstance : IFakeService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeSingletonService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeSingletonService.cs deleted file mode 100644 index 3f341ce204d..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/IFakeSingletonService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface IFakeSingletonService : IFakeService - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/INonexistentService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/INonexistentService.cs deleted file mode 100644 index 54661e3cd97..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/INonexistentService.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public interface INonexistentService - { - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/PocoClass.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/PocoClass.cs deleted file mode 100644 index 75bd28ae9f7..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/PocoClass.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class PocoClass - { - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ScopedFactoryService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ScopedFactoryService.cs deleted file mode 100644 index 298ad076c1a..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ScopedFactoryService.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ScopedFactoryService - { - public IFakeService FakeService { get; set; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ServiceAcceptingFactoryService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ServiceAcceptingFactoryService.cs deleted file mode 100644 index c016eaeeca7..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/ServiceAcceptingFactoryService.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class ServiceAcceptingFactoryService - { - public ServiceAcceptingFactoryService( - ScopedFactoryService scopedService, - IFactoryService transientService) - { - ScopedService = scopedService; - TransientService = transientService; - } - - public ScopedFactoryService ScopedService { get; private set; } - - public IFactoryService TransientService { get; private set; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TransientFactoryService.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TransientFactoryService.cs deleted file mode 100644 index 1915f3fda0a..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TransientFactoryService.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class TransientFactoryService : IFactoryService - { - public IFakeService FakeService { get; set; } - - public int Value { get; set; } - } -} \ No newline at end of file diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TypeWithSupersetConstructors.cs b/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TypeWithSupersetConstructors.cs deleted file mode 100644 index c3788837015..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Fakes/TypeWithSupersetConstructors.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection.Specification.Fakes -{ - public class TypeWithSupersetConstructors - { - public TypeWithSupersetConstructors(IFactoryService factoryService) - : this( - fakeService: null, - factoryService: factoryService) - { - } - - public TypeWithSupersetConstructors(IFakeService fakeService) - : this( - fakeService, - factoryService: null) - { - } - - public TypeWithSupersetConstructors( - IFakeService fakeService, - IFactoryService factoryService) - : this( - fakeService, - multipleService: null, - factoryService: factoryService) - { - } - - public TypeWithSupersetConstructors( - IFakeService fakeService, - IFakeMultipleService multipleService, - IFactoryService factoryService) - : this( - multipleService, - factoryService, - fakeService, - scopedService: null) - { - } - - public TypeWithSupersetConstructors( - IFakeMultipleService multipleService, - IFactoryService factoryService, - IFakeService fakeService, - IFakeScopedService scopedService) - { - MultipleService = multipleService; - FactoryService = factoryService; - Service = fakeService; - ScopedService = scopedService; - } - - public IFakeService Service { get; } - - public IFactoryService FactoryService { get; } - - public IFakeMultipleService MultipleService { get; } - - public IFakeScopedService ScopedService { get; } - } -} diff --git a/src/DependencyInjection/DI.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj b/src/DependencyInjection/DI.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj deleted file mode 100644 index ce391836d87..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj +++ /dev/null @@ -1,34 +0,0 @@ - - - - Suite of xUnit.net tests to check for container compatibility with Microsoft.Extensions.DependencyInjection. - netstandard2.0 - Microsoft.Extensions.DependencyInjection.Specification - true - dependencyinjection;di - $(NoWarn);CS1591 - - false - true - true - false - true - - - - - - - - - - - - diff --git a/src/DependencyInjection/DI.Specification.Tests/src/ServiceCollection.cs b/src/DependencyInjection/DI.Specification.Tests/src/ServiceCollection.cs deleted file mode 100644 index b4501e76319..00000000000 --- a/src/DependencyInjection/DI.Specification.Tests/src/ServiceCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; - -namespace Microsoft.Extensions.DependencyInjection.Specification -{ - internal class TestServiceCollection : List, IServiceCollection - { - } -} diff --git a/src/DependencyInjection/DependencyInjection.sln b/src/DependencyInjection/DependencyInjection.sln deleted file mode 100644 index 25adb65a6c4..00000000000 --- a/src/DependencyInjection/DependencyInjection.sln +++ /dev/null @@ -1,59 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.28508.60 -MinimumVisualStudioVersion = 16.0.0.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DI.External.Tests", "DI.External.Tests", "{2AB3CFC2-9E7D-4928-ADC3-07DC42778DC8}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests", "DI.External.Tests\test\Microsoft.Extensions.DependencyInjection.ExternalContainers.Tests.csproj", "{61A474DD-2FA9-47CE-BA61-D5D441C6924B}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DI.Specification.Tests", "DI.Specification.Tests", "{DCE2FA14-0ADC-4774-AAFB-604FE4AB423A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection.Specification.Tests", "DI.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj", "{F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|x64.ActiveCfg = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|x64.Build.0 = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|x86.ActiveCfg = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Debug|x86.Build.0 = Debug|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|Any CPU.Build.0 = Release|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|x64.ActiveCfg = Release|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|x64.Build.0 = Release|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|x86.ActiveCfg = Release|Any CPU - {61A474DD-2FA9-47CE-BA61-D5D441C6924B}.Release|x86.Build.0 = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|x64.ActiveCfg = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|x64.Build.0 = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|x86.ActiveCfg = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Debug|x86.Build.0 = Debug|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|Any CPU.Build.0 = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|x64.ActiveCfg = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|x64.Build.0 = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|x86.ActiveCfg = Release|Any CPU - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {61A474DD-2FA9-47CE-BA61-D5D441C6924B} = {2AB3CFC2-9E7D-4928-ADC3-07DC42778DC8} - {F1F351F3-B92F-49DE-93E1-DD7FFC137C0F} = {DCE2FA14-0ADC-4774-AAFB-604FE4AB423A} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {E8C39812-56AD-485D-8101-15D1A77D27C7} - EndGlobalSection -EndGlobal diff --git a/src/DependencyInjection/README.md b/src/DependencyInjection/README.md deleted file mode 100644 index 02e2bd5a5ed..00000000000 --- a/src/DependencyInjection/README.md +++ /dev/null @@ -1,14 +0,0 @@ -DependencyInjection -=================== - -Contains common DI abstractions that ASP.NET Core and Entity Framework Core use. - -### Using other containers with Microsoft.Extensions.DependencyInjection - -* [**Autofac**](https://autofac.readthedocs.org/en/latest/integration/aspnetcore.html) -* [**DryIoc**](https://www.nuget.org/packages/DryIoc.Microsoft.DependencyInjection) -* [**Grace**](https://www.nuget.org/packages/Grace.DependencyInjection.Extensions) -* [**LightInject**](https://github.com/seesharper/LightInject.Microsoft.DependencyInjection) -* [**StructureMap**](https://github.com/structuremap/StructureMap.Microsoft.DependencyInjection) -* [**Stashbox**](https://github.com/z4kn4fein/stashbox-extensions-dependencyinjection) -* [**Unity**](https://www.nuget.org/packages/Unity.Microsoft.DependencyInjection/) diff --git a/src/DependencyInjection/startvs.cmd b/src/DependencyInjection/startvs.cmd deleted file mode 100644 index e4b282fec47..00000000000 --- a/src/DependencyInjection/startvs.cmd +++ /dev/null @@ -1,3 +0,0 @@ -@ECHO OFF - -%~dp0..\..\startvs.cmd %~dp0DependencyInjection.sln \ No newline at end of file diff --git a/src/Logging/Logging.Abstractions/src/LogValuesFormatter.cs b/src/Logging/Logging.Analyzers/src/LogValuesFormatter.cs similarity index 100% rename from src/Logging/Logging.Abstractions/src/LogValuesFormatter.cs rename to src/Logging/Logging.Analyzers/src/LogValuesFormatter.cs diff --git a/src/Logging/Logging.Analyzers/src/Microsoft.Extensions.Logging.Analyzers.csproj b/src/Logging/Logging.Analyzers/src/Microsoft.Extensions.Logging.Analyzers.csproj index f45954525ec..07ea301602a 100644 --- a/src/Logging/Logging.Analyzers/src/Microsoft.Extensions.Logging.Analyzers.csproj +++ b/src/Logging/Logging.Analyzers/src/Microsoft.Extensions.Logging.Analyzers.csproj @@ -14,8 +14,4 @@ true - - - - diff --git a/src/Logging/Logging.AzureAppServices/Directory.Build.props b/src/Logging/Logging.AzureAppServices/Directory.Build.props deleted file mode 100644 index 68f87d4f248..00000000000 --- a/src/Logging/Logging.AzureAppServices/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - true - - diff --git a/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.csproj b/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.csproj deleted file mode 100644 index 0132b218708..00000000000 --- a/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - netstandard2.0 - - - - - - - - - - - diff --git a/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.netstandard2.0.cs b/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.netstandard2.0.cs deleted file mode 100644 index 9b8f637cff6..00000000000 --- a/src/Logging/Logging.AzureAppServices/ref/Microsoft.Extensions.Logging.AzureAppServices.netstandard2.0.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Logging -{ - public static partial class AzureAppServicesLoggerFactoryExtensions - { - public static Microsoft.Extensions.Logging.ILoggingBuilder AddAzureWebAppDiagnostics(this Microsoft.Extensions.Logging.ILoggingBuilder builder) { throw null; } - } -} -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - public partial class AzureBlobLoggerOptions : Microsoft.Extensions.Logging.AzureAppServices.BatchingLoggerOptions - { - public AzureBlobLoggerOptions() { } - public string BlobName { get { throw null; } set { } } - } - public partial class AzureFileLoggerOptions : Microsoft.Extensions.Logging.AzureAppServices.BatchingLoggerOptions - { - public AzureFileLoggerOptions() { } - public string FileName { get { throw null; } set { } } - public int? FileSizeLimit { get { throw null; } set { } } - public int? RetainedFileCountLimit { get { throw null; } set { } } - } - public partial class BatchingLoggerOptions - { - public BatchingLoggerOptions() { } - public int? BackgroundQueueSize { get { throw null; } set { } } - public int? BatchSize { get { throw null; } set { } } - public System.TimeSpan FlushPeriod { get { throw null; } set { } } - public bool IncludeScopes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public bool IsEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - } - public abstract partial class BatchingLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider, Microsoft.Extensions.Logging.ISupportExternalScope, System.IDisposable - { - internal BatchingLoggerProvider() { } - public bool IsEnabled { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public Microsoft.Extensions.Logging.ILogger CreateLogger(string categoryName) { throw null; } - public void Dispose() { } - protected virtual System.Threading.Tasks.Task IntervalAsync(System.TimeSpan interval, System.Threading.CancellationToken cancellationToken) { throw null; } - void Microsoft.Extensions.Logging.ISupportExternalScope.SetScopeProvider(Microsoft.Extensions.Logging.IExternalScopeProvider scopeProvider) { } - } - [Microsoft.Extensions.Logging.ProviderAliasAttribute("AzureAppServicesBlob")] - public partial class BlobLoggerProvider : Microsoft.Extensions.Logging.AzureAppServices.BatchingLoggerProvider - { - public BlobLoggerProvider(Microsoft.Extensions.Options.IOptionsMonitor options) { } - } - [Microsoft.Extensions.Logging.ProviderAliasAttribute("AzureAppServicesFile")] - public partial class FileLoggerProvider : Microsoft.Extensions.Logging.AzureAppServices.BatchingLoggerProvider - { - public FileLoggerProvider(Microsoft.Extensions.Options.IOptionsMonitor options) { } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs b/src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs deleted file mode 100644 index 9b680e91381..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/AzureAppServicesLoggerFactoryExtensions.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using Microsoft.Extensions.Logging.AzureAppServices; -using Microsoft.Extensions.Logging.Configuration; -using Microsoft.Extensions.Options; -using static Microsoft.Extensions.DependencyInjection.ServiceDescriptor; - -namespace Microsoft.Extensions.Logging -{ - /// - /// Extension methods for adding Azure diagnostics logger. - /// - public static class AzureAppServicesLoggerFactoryExtensions - { - /// - /// Adds an Azure Web Apps diagnostics logger. - /// - /// The extension method argument - public static ILoggingBuilder AddAzureWebAppDiagnostics(this ILoggingBuilder builder) - { - var context = WebAppContext.Default; - - // Only add the provider if we're in Azure WebApp. That cannot change once the apps started - return AddAzureWebAppDiagnostics(builder, context); - } - - internal static ILoggingBuilder AddAzureWebAppDiagnostics(this ILoggingBuilder builder, IWebAppContext context) - { - if (!context.IsRunningInAzureWebApp) - { - return builder; - } - - builder.AddConfiguration(); - - var config = SiteConfigurationProvider.GetAzureLoggingConfiguration(context); - var services = builder.Services; - - var addedFileLogger = TryAddEnumerable(services, Singleton()); - var addedBlobLogger = TryAddEnumerable(services, Singleton()); - - if (addedFileLogger || addedBlobLogger) - { - services.AddSingleton(context); - services.AddSingleton>( - new ConfigurationChangeTokenSource(config)); - } - - if (addedFileLogger) - { - services.AddSingleton>(CreateFileFilterConfigureOptions(config)); - services.AddSingleton>(new FileLoggerConfigureOptions(config, context)); - services.AddSingleton>( - new ConfigurationChangeTokenSource(config)); - LoggerProviderOptions.RegisterProviderOptions(builder.Services); - } - - if (addedBlobLogger) - { - services.AddSingleton>(CreateBlobFilterConfigureOptions(config)); - services.AddSingleton>(new BlobLoggerConfigureOptions(config, context)); - services.AddSingleton>( - new ConfigurationChangeTokenSource(config)); - LoggerProviderOptions.RegisterProviderOptions(builder.Services); - } - - return builder; - } - - private static bool TryAddEnumerable(IServiceCollection collection, ServiceDescriptor descriptor) - { - var beforeCount = collection.Count; - collection.TryAddEnumerable(descriptor); - return beforeCount != collection.Count; - } - - private static ConfigurationBasedLevelSwitcher CreateBlobFilterConfigureOptions(IConfiguration config) - { - return new ConfigurationBasedLevelSwitcher( - configuration: config, - provider: typeof(BlobLoggerProvider), - levelKey: "AzureBlobTraceLevel"); - } - - private static ConfigurationBasedLevelSwitcher CreateFileFilterConfigureOptions(IConfiguration config) - { - return new ConfigurationBasedLevelSwitcher( - configuration: config, - provider: typeof(FileLoggerProvider), - levelKey: "AzureDriveTraceLevel"); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs b/src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs deleted file mode 100644 index 1e1285b3581..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/AzureBlobLoggerOptions.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Options for Azure diagnostics blob logging. - /// - public class AzureBlobLoggerOptions: BatchingLoggerOptions - { - private string _blobName = "applicationLog.txt"; - - /// - /// Gets or sets the last section of log blob name. - /// Defaults to "applicationLog.txt". - /// - public string BlobName - { - get { return _blobName; } - set - { - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentException(nameof(value), $"{nameof(BlobName)} must be non-empty string."); - } - _blobName = value; - } - } - - internal string ContainerUrl { get; set; } - - internal string ApplicationName { get; set; } - - internal string ApplicationInstanceId { get; set; } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs b/src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs deleted file mode 100644 index af8b5a112e1..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/AzureFileLoggerOptions.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Options for Azure diagnostics file logging. - /// - public class AzureFileLoggerOptions: BatchingLoggerOptions - { - private int? _fileSizeLimit = 10 * 1024 * 1024; - private int? _retainedFileCountLimit = 2; - private string _fileName = "diagnostics-"; - - /// - /// Gets or sets a strictly positive value representing the maximum log size in bytes or null for no limit. - /// Once the log is full, no more messages will be appended. - /// Defaults to 10MB. - /// - public int? FileSizeLimit - { - get { return _fileSizeLimit; } - set - { - if (value <= 0) - { - throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(FileSizeLimit)} must be positive."); - } - _fileSizeLimit = value; - } - } - - /// - /// Gets or sets a strictly positive value representing the maximum retained file count or null for no limit. - /// Defaults to 2. - /// - public int? RetainedFileCountLimit - { - get { return _retainedFileCountLimit; } - set - { - if (value <= 0) - { - throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(RetainedFileCountLimit)} must be positive."); - } - _retainedFileCountLimit = value; - } - } - - /// - /// Gets or sets a string representing the prefix of the file name used to store the logging information. - /// The current date, in the format YYYYMMDD will be added after the given value. - /// Defaults to diagnostics-. - /// - public string FileName - { - get { return _fileName; } - set - { - if (string.IsNullOrEmpty(value)) - { - throw new ArgumentException(nameof(value)); - } - _fileName = value; - } - } - - internal string LogDirectory { get; set; } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs b/src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs deleted file mode 100644 index 8dc8727b3a4..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BatchLoggerConfigureOptions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class BatchLoggerConfigureOptions : IConfigureOptions - { - private readonly IConfiguration _configuration; - private readonly string _isEnabledKey; - - public BatchLoggerConfigureOptions(IConfiguration configuration, string isEnabledKey) - { - _configuration = configuration; - _isEnabledKey = isEnabledKey; - } - - public void Configure(BatchingLoggerOptions options) - { - options.IsEnabled = TextToBoolean(_configuration.GetSection(_isEnabledKey)?.Value); - } - - private static bool TextToBoolean(string text) - { - if (string.IsNullOrEmpty(text) || - !bool.TryParse(text, out var result)) - { - result = false; - } - - return result; - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs b/src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs deleted file mode 100644 index bd192169f38..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BatchingLogger.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class BatchingLogger : ILogger - { - private readonly BatchingLoggerProvider _provider; - private readonly string _category; - - public BatchingLogger(BatchingLoggerProvider loggerProvider, string categoryName) - { - _provider = loggerProvider; - _category = categoryName; - } - - public IDisposable BeginScope(TState state) - { - return null; - } - - public bool IsEnabled(LogLevel logLevel) - { - return _provider.IsEnabled; - } - - public void Log(DateTimeOffset timestamp, LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - if (!IsEnabled(logLevel)) - { - return; - } - - var builder = new StringBuilder(); - builder.Append(timestamp.ToString("yyyy-MM-dd HH:mm:ss.fff zzz")); - builder.Append(" ["); - builder.Append(logLevel.ToString()); - builder.Append("] "); - builder.Append(_category); - - var scopeProvider = _provider.ScopeProvider; - if (scopeProvider != null) - { - scopeProvider.ForEachScope((scope, stringBuilder) => - { - stringBuilder.Append(" => ").Append(scope); - }, builder); - - builder.AppendLine(":"); - } - else - { - builder.Append(": "); - } - - builder.AppendLine(formatter(state, exception)); - - if (exception != null) - { - builder.AppendLine(exception.ToString()); - } - - _provider.AddMessage(timestamp, builder.ToString()); - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - Log(DateTimeOffset.Now, logLevel, eventId, state, exception, formatter); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs b/src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs deleted file mode 100644 index 9fbd964800e..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerOptions.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Options for a logger which batches up log messages. - /// - public class BatchingLoggerOptions - { - private int? _batchSize; - private int? _backgroundQueueSize = 1000; - private TimeSpan _flushPeriod = TimeSpan.FromSeconds(1); - - /// - /// Gets or sets the period after which logs will be flushed to the store. - /// - public TimeSpan FlushPeriod - { - get { return _flushPeriod; } - set - { - if (value <= TimeSpan.Zero) - { - throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(FlushPeriod)} must be positive."); - } - _flushPeriod = value; - } - } - - /// - /// Gets or sets the maximum size of the background log message queue or null for no limit. - /// After maximum queue size is reached log event sink would start blocking. - /// Defaults to 1000. - /// - public int? BackgroundQueueSize - { - get { return _backgroundQueueSize; } - set - { - if (value < 0) - { - throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(BackgroundQueueSize)} must be non-negative."); - } - _backgroundQueueSize = value; - } - } - - /// - /// Gets or sets a maximum number of events to include in a single batch or null for no limit. - /// - /// Defaults to null. - public int? BatchSize - { - get { return _batchSize; } - set - { - if (value <= 0) - { - throw new ArgumentOutOfRangeException(nameof(value), $"{nameof(BatchSize)} must be positive."); - } - _batchSize = value; - } - } - - /// - /// Gets or sets value indicating if logger accepts and queues writes. - /// - public bool IsEnabled { get; set; } - - /// - /// Gets or sets a value indicating whether scopes should be included in the message. - /// Defaults to false. - /// - public bool IncludeScopes { get; set; } = false; - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs b/src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs deleted file mode 100644 index 227a616f3b5..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BatchingLoggerProvider.cs +++ /dev/null @@ -1,208 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// A provider of instances. - /// - public abstract class BatchingLoggerProvider : ILoggerProvider, ISupportExternalScope - { - private readonly List _currentBatch = new List(); - private readonly TimeSpan _interval; - private readonly int? _queueSize; - private readonly int? _batchSize; - private readonly IDisposable _optionsChangeToken; - - private int _messagesDropped; - - private BlockingCollection _messageQueue; - private Task _outputTask; - private CancellationTokenSource _cancellationTokenSource; - - private bool _includeScopes; - private IExternalScopeProvider _scopeProvider; - - internal IExternalScopeProvider ScopeProvider => _includeScopes ? _scopeProvider : null; - - internal BatchingLoggerProvider(IOptionsMonitor options) - { - // NOTE: Only IsEnabled is monitored - - var loggerOptions = options.CurrentValue; - if (loggerOptions.BatchSize <= 0) - { - throw new ArgumentOutOfRangeException(nameof(loggerOptions.BatchSize), $"{nameof(loggerOptions.BatchSize)} must be a positive number."); - } - if (loggerOptions.FlushPeriod <= TimeSpan.Zero) - { - throw new ArgumentOutOfRangeException(nameof(loggerOptions.FlushPeriod), $"{nameof(loggerOptions.FlushPeriod)} must be longer than zero."); - } - - _interval = loggerOptions.FlushPeriod; - _batchSize = loggerOptions.BatchSize; - _queueSize = loggerOptions.BackgroundQueueSize; - - _optionsChangeToken = options.OnChange(UpdateOptions); - UpdateOptions(options.CurrentValue); - } - - /// - /// Checks if the queue is enabled. - /// - public bool IsEnabled { get; private set; } - - private void UpdateOptions(BatchingLoggerOptions options) - { - var oldIsEnabled = IsEnabled; - IsEnabled = options.IsEnabled; - _includeScopes = options.IncludeScopes; - - if (oldIsEnabled != IsEnabled) - { - if (IsEnabled) - { - Start(); - } - else - { - Stop(); - } - } - - } - - internal abstract Task WriteMessagesAsync(IEnumerable messages, CancellationToken token); - - private async Task ProcessLogQueue() - { - while (!_cancellationTokenSource.IsCancellationRequested) - { - var limit = _batchSize ?? int.MaxValue; - - while (limit > 0 && _messageQueue.TryTake(out var message)) - { - _currentBatch.Add(message); - limit--; - } - - var messagesDropped = Interlocked.Exchange(ref _messagesDropped, 0); - if (messagesDropped != 0) - { - _currentBatch.Add(new LogMessage(DateTimeOffset.Now, $"{messagesDropped} message(s) dropped because of queue size limit. Increase the queue size or decrease logging verbosity to avoid this.{Environment.NewLine}")); - } - - if (_currentBatch.Count > 0) - { - try - { - await WriteMessagesAsync(_currentBatch, _cancellationTokenSource.Token); - } - catch - { - // ignored - } - - _currentBatch.Clear(); - } - else - { - await IntervalAsync(_interval, _cancellationTokenSource.Token); - } - } - } - - /// - /// Wait for the given . - /// - /// The amount of time to wait. - /// A that can be used to cancel the delay. - /// A which completes when the has passed or the has been canceled. - protected virtual Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken) - { - return Task.Delay(interval, cancellationToken); - } - - internal void AddMessage(DateTimeOffset timestamp, string message) - { - if (!_messageQueue.IsAddingCompleted) - { - try - { - if (!_messageQueue.TryAdd(new LogMessage(timestamp, message), millisecondsTimeout: 0, cancellationToken: _cancellationTokenSource.Token)) - { - Interlocked.Increment(ref _messagesDropped); - } - } - catch - { - //cancellation token canceled or CompleteAdding called - } - } - } - - private void Start() - { - _messageQueue = _queueSize == null ? - new BlockingCollection(new ConcurrentQueue()) : - new BlockingCollection(new ConcurrentQueue(), _queueSize.Value); - - _cancellationTokenSource = new CancellationTokenSource(); - _outputTask = Task.Run(ProcessLogQueue); - } - - private void Stop() - { - _cancellationTokenSource.Cancel(); - _messageQueue.CompleteAdding(); - - try - { - _outputTask.Wait(_interval); - } - catch (TaskCanceledException) - { - } - catch (AggregateException ex) when (ex.InnerExceptions.Count == 1 && ex.InnerExceptions[0] is TaskCanceledException) - { - } - } - - /// - public void Dispose() - { - _optionsChangeToken?.Dispose(); - if (IsEnabled) - { - Stop(); - } - } - - /// - /// Creates a with the given . - /// - /// The name of the category to create this logger with. - /// The that was created. - public ILogger CreateLogger(string categoryName) - { - return new BatchingLogger(this, categoryName); - } - - /// - /// Sets the scope on this provider. - /// - /// Provides the scope. - void ISupportExternalScope.SetScopeProvider(IExternalScopeProvider scopeProvider) - { - _scopeProvider = scopeProvider; - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs b/src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs deleted file mode 100644 index e9805128b72..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BlobAppendReferenceWrapper.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - internal class BlobAppendReferenceWrapper : ICloudAppendBlob - { - private readonly Uri _fullUri; - private readonly HttpClient _client; - private readonly Uri _appendUri; - - public BlobAppendReferenceWrapper(string containerUrl, string name, HttpClient client) - { - var uriBuilder = new UriBuilder(containerUrl); - uriBuilder.Path += "/" + name; - _fullUri = uriBuilder.Uri; - - AppendBlockQuery(uriBuilder); - _appendUri = uriBuilder.Uri; - _client = client; - } - - /// - public async Task AppendAsync(ArraySegment data, CancellationToken cancellationToken) - { - Task AppendDataAsync() - { - var message = new HttpRequestMessage(HttpMethod.Put, _appendUri) - { - Content = new ByteArrayContent(data.Array, data.Offset, data.Count) - }; - AddCommonHeaders(message); - - return _client.SendAsync(message, cancellationToken); - } - - var response = await AppendDataAsync(); - - if (response.StatusCode == HttpStatusCode.NotFound) - { - // If no blob exists try creating it - var message = new HttpRequestMessage(HttpMethod.Put, _fullUri) - { - // Set Content-Length to 0 to create "Append Blob" - Content = new ByteArrayContent(Array.Empty()), - Headers = - { - { "If-None-Match", "*" } - } - }; - - AddCommonHeaders(message); - - response = await _client.SendAsync(message, cancellationToken); - - // If result is 2** or 412 try to append again - if (response.IsSuccessStatusCode || - response.StatusCode == HttpStatusCode.PreconditionFailed) - { - // Retry sending data after blob creation - response = await AppendDataAsync(); - } - } - - response.EnsureSuccessStatusCode(); - } - - private static void AddCommonHeaders(HttpRequestMessage message) - { - message.Headers.Add("x-ms-blob-type", "AppendBlob"); - message.Headers.Add("x-ms-version", "2016-05-31"); - message.Headers.Date = DateTimeOffset.UtcNow; - } - - private static void AppendBlockQuery(UriBuilder uriBuilder) - { - // See https://msdn.microsoft.com/en-us/library/system.uribuilder.query.aspx for: - // Note: Do not append a string directly to Query property. - // If the length of Query is greater than 1, retrieve the property value - // as a string, remove the leading question mark, append the new query string, - // and set the property with the combined string. - var queryToAppend = "comp=appendblock"; - if (uriBuilder.Query != null && uriBuilder.Query.Length > 1) - uriBuilder.Query = uriBuilder.Query.Substring(1) + "&" + queryToAppend; - else - uriBuilder.Query = queryToAppend; - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs b/src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs deleted file mode 100644 index f9a186872b7..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BlobLoggerConfigureOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class BlobLoggerConfigureOptions : BatchLoggerConfigureOptions, IConfigureOptions - { - private readonly IConfiguration _configuration; - private readonly IWebAppContext _context; - - public BlobLoggerConfigureOptions(IConfiguration configuration, IWebAppContext context) - : base(configuration, "AzureBlobEnabled") - { - _configuration = configuration; - _context = context; - } - - public void Configure(AzureBlobLoggerOptions options) - { - base.Configure(options); - options.ContainerUrl = _configuration.GetSection("APPSETTING_DIAGNOSTICS_AZUREBLOBCONTAINERSASURL")?.Value; - options.ApplicationName = _context.SiteName; - options.ApplicationInstanceId = _context.SiteInstanceId; - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs b/src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs deleted file mode 100644 index 3d62ea2ac6e..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/BlobLoggerProvider.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// The implementation that stores messages by appending them to Azure Blob in batches. - /// - [ProviderAlias("AzureAppServicesBlob")] - public class BlobLoggerProvider : BatchingLoggerProvider - { - private readonly string _appName; - private readonly string _fileName; - private readonly Func _blobReferenceFactory; - private readonly HttpClient _httpClient; - - /// - /// Creates a new instance of - /// - /// The options to use when creating a provider. - public BlobLoggerProvider(IOptionsMonitor options) - : this(options, null) - { - _blobReferenceFactory = name => new BlobAppendReferenceWrapper( - options.CurrentValue.ContainerUrl, - name, - _httpClient); - } - - /// - /// Creates a new instance of - /// - /// The container to store logs to. - /// Options to be used in creating a logger. - internal BlobLoggerProvider( - IOptionsMonitor options, - Func blobReferenceFactory) : - base(options) - { - var value = options.CurrentValue; - _appName = value.ApplicationName; - _fileName = value.ApplicationInstanceId + "_" + value.BlobName; - _blobReferenceFactory = blobReferenceFactory; - _httpClient = new HttpClient(); - } - - internal override async Task WriteMessagesAsync(IEnumerable messages, CancellationToken cancellationToken) - { - var eventGroups = messages.GroupBy(GetBlobKey); - foreach (var eventGroup in eventGroups) - { - var key = eventGroup.Key; - var blobName = $"{_appName}/{key.Year}/{key.Month:00}/{key.Day:00}/{key.Hour:00}/{_fileName}"; - - var blob = _blobReferenceFactory(blobName); - - using (var stream = new MemoryStream()) - using (var writer = new StreamWriter(stream)) - { - foreach (var logEvent in eventGroup) - { - writer.Write(logEvent.Message); - } - - await writer.FlushAsync(); - var tryGetBuffer = stream.TryGetBuffer(out var buffer); - Debug.Assert(tryGetBuffer); - await blob.AppendAsync(buffer, cancellationToken); - } - } - } - - private (int Year, int Month, int Day, int Hour) GetBlobKey(LogMessage e) - { - return (e.Timestamp.Year, - e.Timestamp.Month, - e.Timestamp.Day, - e.Timestamp.Hour); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs b/src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs deleted file mode 100644 index c62ccb23315..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/ConfigurationBasedLevelSwitcher.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class ConfigurationBasedLevelSwitcher: IConfigureOptions - { - private readonly IConfiguration _configuration; - private readonly Type _provider; - private readonly string _levelKey; - - public ConfigurationBasedLevelSwitcher(IConfiguration configuration, Type provider, string levelKey) - { - _configuration = configuration; - _provider = provider; - _levelKey = levelKey; - } - - public void Configure(LoggerFilterOptions options) - { - options.Rules.Add(new LoggerFilterRule(_provider.FullName, null, GetLogLevel(), null)); - } - - private LogLevel GetLogLevel() - { - return TextToLogLevel(_configuration.GetSection(_levelKey)?.Value); - } - - private static LogLevel TextToLogLevel(string text) - { - switch (text?.ToUpperInvariant()) - { - case "ERROR": - return LogLevel.Error; - case "WARNING": - return LogLevel.Warning; - case "INFORMATION": - return LogLevel.Information; - case "VERBOSE": - return LogLevel.Trace; - default: - return LogLevel.None; - } - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs b/src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs deleted file mode 100644 index 8cd1f5eb912..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/FileLoggerConfigureOptions.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class FileLoggerConfigureOptions : BatchLoggerConfigureOptions, IConfigureOptions - { - private readonly IWebAppContext _context; - - public FileLoggerConfigureOptions(IConfiguration configuration, IWebAppContext context) - : base(configuration, "AzureDriveEnabled") - { - _context = context; - } - - public void Configure(AzureFileLoggerOptions options) - { - base.Configure(options); - options.LogDirectory = Path.Combine(_context.HomeFolder, "LogFiles", "Application"); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs b/src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs deleted file mode 100644 index 1143d38c075..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/FileLoggerProvider.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// A which writes out to a file. - /// - [ProviderAlias("AzureAppServicesFile")] - public class FileLoggerProvider : BatchingLoggerProvider - { - private readonly string _path; - private readonly string _fileName; - private readonly int? _maxFileSize; - private readonly int? _maxRetainedFiles; - - /// - /// Creates a new instance of . - /// - /// The options to use when creating a provider. - public FileLoggerProvider(IOptionsMonitor options) : base(options) - { - var loggerOptions = options.CurrentValue; - _path = loggerOptions.LogDirectory; - _fileName = loggerOptions.FileName; - _maxFileSize = loggerOptions.FileSizeLimit; - _maxRetainedFiles = loggerOptions.RetainedFileCountLimit; - } - - internal override async Task WriteMessagesAsync(IEnumerable messages, CancellationToken cancellationToken) - { - Directory.CreateDirectory(_path); - - foreach (var group in messages.GroupBy(GetGrouping)) - { - var fullName = GetFullName(group.Key); - var fileInfo = new FileInfo(fullName); - if (_maxFileSize > 0 && fileInfo.Exists && fileInfo.Length > _maxFileSize) - { - return; - } - - using (var streamWriter = File.AppendText(fullName)) - { - foreach (var item in group) - { - await streamWriter.WriteAsync(item.Message); - } - } - } - - RollFiles(); - } - - private string GetFullName((int Year, int Month, int Day) group) - { - return Path.Combine(_path, $"{_fileName}{group.Year:0000}{group.Month:00}{group.Day:00}.txt"); - } - - private (int Year, int Month, int Day) GetGrouping(LogMessage message) - { - return (message.Timestamp.Year, message.Timestamp.Month, message.Timestamp.Day); - } - - private void RollFiles() - { - if (_maxRetainedFiles > 0) - { - var files = new DirectoryInfo(_path) - .GetFiles(_fileName + "*") - .OrderByDescending(f => f.Name) - .Skip(_maxRetainedFiles.Value); - - foreach (var item in files) - { - item.Delete(); - } - } - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs b/src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs deleted file mode 100644 index 2f55bbb0d10..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/ICloudAppendBlob.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Represents an append blob, a type of blob where blocks of data are always committed to the end of the blob. - /// - internal interface ICloudAppendBlob - { - /// - /// Initiates an asynchronous operation to open a stream for writing to the blob. - /// - /// A object of type that represents the asynchronous operation. - Task AppendAsync(ArraySegment data, CancellationToken cancellationToken); - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs b/src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs deleted file mode 100644 index f8c826ceb84..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/IWebAppContext.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Represents an Azure WebApp context - /// - internal interface IWebAppContext - { - /// - /// Gets the path to the home folder if running in Azure WebApp - /// - string HomeFolder { get; } - - /// - /// Gets the name of site if running in Azure WebApp - /// - string SiteName { get; } - - /// - /// Gets the id of site if running in Azure WebApp - /// - string SiteInstanceId { get; } - - /// - /// Gets a value indicating whether or new we're in an Azure WebApp - /// - bool IsRunningInAzureWebApp { get; } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/LogMessage.cs b/src/Logging/Logging.AzureAppServices/src/LogMessage.cs deleted file mode 100644 index 4a1179ceb3a..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/LogMessage.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal readonly struct LogMessage - { - public LogMessage(DateTimeOffset timestamp, string message) - { - Timestamp = timestamp; - Message = message; - } - - public DateTimeOffset Timestamp { get; } - public string Message { get; } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj b/src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj deleted file mode 100644 index 5bedde8c6d8..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - Logger implementation to support Azure App Services 'Diagnostics logs' and 'Log stream' features. - netstandard2.0 - $(NoWarn);CS1591 - true - true - - - - - - - - - - - - - - - - diff --git a/src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs b/src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 7c7d3325459..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Runtime.CompilerServices; - - -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs b/src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs deleted file mode 100644 index 452c936f939..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/SiteConfigurationProvider.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.IO; -using Microsoft.Extensions.Configuration; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - internal class SiteConfigurationProvider - { - public static IConfiguration GetAzureLoggingConfiguration(IWebAppContext context) - { - var settingsFolder = Path.Combine(context.HomeFolder, "site", "diagnostics"); - var settingsFile = Path.Combine(settingsFolder, "settings.json"); - - return new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddJsonFile(settingsFile, optional: true, reloadOnChange: true) - .Build(); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/src/WebAppContext.cs b/src/Logging/Logging.AzureAppServices/src/WebAppContext.cs deleted file mode 100644 index 8bdd3f1c760..00000000000 --- a/src/Logging/Logging.AzureAppServices/src/WebAppContext.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.AzureAppServices -{ - /// - /// Represents the default implementation of . - /// - internal class WebAppContext : IWebAppContext - { - /// - /// Gets the default instance of the WebApp context. - /// - public static WebAppContext Default { get; } = new WebAppContext(); - - private WebAppContext() { } - - /// - public string HomeFolder { get; } = Environment.GetEnvironmentVariable("HOME"); - - /// - public string SiteName { get; } = Environment.GetEnvironmentVariable("WEBSITE_SITE_NAME"); - - /// - public string SiteInstanceId { get; } = Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"); - - /// - public bool IsRunningInAzureWebApp => !string.IsNullOrEmpty(HomeFolder) && - !string.IsNullOrEmpty(SiteName); - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs b/src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs deleted file mode 100644 index 2fd5955e86c..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/AzureAppendBlobTests.cs +++ /dev/null @@ -1,186 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Net; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class AzureAppendBlobTests - { - public string _containerUrl = "https://host/container?query=1"; - public string _blobName = "blob/path"; - - [Fact] - public async Task SendsDataAsStream() - { - var testMessageHandler = new TestMessageHandler(async message => - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1&comp=appendblock", message.RequestUri.ToString()); - Assert.Equal(new byte[] { 0, 2, 3 }, await message.Content.ReadAsByteArrayAsync()); - AssertDefaultHeaders(message); - - return new HttpResponseMessage(HttpStatusCode.OK); - }); - - var blob = new BlobAppendReferenceWrapper(_containerUrl, _blobName, new HttpClient(testMessageHandler)); - await blob.AppendAsync(new ArraySegment(new byte[] { 0, 2, 3 }), CancellationToken.None); - } - - private static void AssertDefaultHeaders(HttpRequestMessage message) - { - Assert.Equal(new[] {"AppendBlob"}, message.Headers.GetValues("x-ms-blob-type")); - Assert.Equal(new[] {"2016-05-31"}, message.Headers.GetValues("x-ms-version")); - Assert.NotNull(message.Headers.Date); - } - - [Theory] - [InlineData(HttpStatusCode.Created)] - [InlineData(HttpStatusCode.PreconditionFailed)] - public async Task CreatesBlobIfNotExist(HttpStatusCode createStatusCode) - { - var stage = 0; - var testMessageHandler = new TestMessageHandler(async message => - { - // First PUT request - if (stage == 0) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1&comp=appendblock", message.RequestUri.ToString()); - Assert.Equal(new byte[] { 0, 2, 3 }, await message.Content.ReadAsByteArrayAsync()); - Assert.Equal(3, message.Content.Headers.ContentLength); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(HttpStatusCode.NotFound); - } - // Create request - if (stage == 1) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1", message.RequestUri.ToString()); - Assert.Equal(0, message.Content.Headers.ContentLength); - Assert.Equal(new[] { "*" }, message.Headers.GetValues("If-None-Match")); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(createStatusCode); - } - // First PUT request - if (stage == 2) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1&comp=appendblock", message.RequestUri.ToString()); - Assert.Equal(new byte[] { 0, 2, 3 }, await message.Content.ReadAsByteArrayAsync()); - Assert.Equal(3, message.Content.Headers.ContentLength); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(HttpStatusCode.Created); - } - throw new NotImplementedException(); - }); - - var blob = new BlobAppendReferenceWrapper(_containerUrl, _blobName, new HttpClient(testMessageHandler)); - await blob.AppendAsync(new ArraySegment(new byte[] { 0, 2, 3 }), CancellationToken.None); - - Assert.Equal(3, stage); - } - - [Fact] - public async Task ThrowsForUnknownStatus() - { - var stage = 0; - var testMessageHandler = new TestMessageHandler(async message => - { - // First PUT request - if (stage == 0) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1&comp=appendblock", message.RequestUri.ToString()); - Assert.Equal(new byte[] { 0, 2, 3 }, await message.Content.ReadAsByteArrayAsync()); - Assert.Equal(3, message.Content.Headers.ContentLength); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(HttpStatusCode.InternalServerError); - } - - throw new NotImplementedException(); - }); - - var blob = new BlobAppendReferenceWrapper(_containerUrl, _blobName, new HttpClient(testMessageHandler)); - await Assert.ThrowsAsync(() => blob.AppendAsync(new ArraySegment(new byte[] { 0, 2, 3 }), CancellationToken.None)); - - Assert.Equal(1, stage); - } - - [Fact] - public async Task ThrowsForUnknownStatusDuringCreation() - { - var stage = 0; - var testMessageHandler = new TestMessageHandler(async message => - { - // First PUT request - if (stage == 0) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1&comp=appendblock", message.RequestUri.ToString()); - Assert.Equal(new byte[] { 0, 2, 3 }, await message.Content.ReadAsByteArrayAsync()); - Assert.Equal(3, message.Content.Headers.ContentLength); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(HttpStatusCode.NotFound); - } - // Create request - if (stage == 1) - { - Assert.Equal(HttpMethod.Put, message.Method); - Assert.Equal("https://host/container/blob/path?query=1", message.RequestUri.ToString()); - Assert.Equal(0, message.Content.Headers.ContentLength); - Assert.Equal(new[] { "*" }, message.Headers.GetValues("If-None-Match")); - - AssertDefaultHeaders(message); - - stage++; - return new HttpResponseMessage(HttpStatusCode.InternalServerError); - } - - throw new NotImplementedException(); - }); - - var blob = new BlobAppendReferenceWrapper(_containerUrl, _blobName, new HttpClient(testMessageHandler)); - await Assert.ThrowsAsync(() => blob.AppendAsync(new ArraySegment(new byte[] { 0, 2, 3 }), CancellationToken.None)); - - Assert.Equal(2, stage); - } - - - private class TestMessageHandler : HttpMessageHandler - { - private readonly Func> _callback; - - public TestMessageHandler(Func> callback) - { - _callback = callback; - } - - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - return await _callback(request); - } - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs b/src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs deleted file mode 100644 index 4d9125335ad..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/AzureBlobSinkTests.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Moq; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class AzureBlobSinkTests - { - DateTimeOffset _timestampOne = new DateTimeOffset(2016, 05, 04, 03, 02, 01, TimeSpan.Zero); - - [Fact] - public async Task WritesMessagesInBatches() - { - var blob = new Mock(); - var buffers = new List(); - blob.Setup(b => b.AppendAsync(It.IsAny>(), It.IsAny())) - .Callback((ArraySegment s, CancellationToken ct) => buffers.Add(ToArray(s))) - .Returns(Task.CompletedTask); - - var sink = new TestBlobSink(name => blob.Object); - var logger = (BatchingLogger)sink.CreateLogger("Cat"); - - await sink.IntervalControl.Pause; - - for (int i = 0; i < 5; i++) - { - logger.Log(_timestampOne, LogLevel.Information, 0, "Text " + i, null, (state, ex) => state); - } - - sink.IntervalControl.Resume(); - await sink.IntervalControl.Pause; - - Assert.Single(buffers); - Assert.Equal( - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Text 0" + Environment.NewLine + - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Text 1" + Environment.NewLine + - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Text 2" + Environment.NewLine + - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Text 3" + Environment.NewLine + - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Text 4" + Environment.NewLine, - Encoding.UTF8.GetString(buffers[0])); - } - - [Fact] - public async Task GroupsByHour() - { - var blob = new Mock(); - var buffers = new List(); - var names = new List(); - - blob.Setup(b => b.AppendAsync(It.IsAny>(), It.IsAny())) - .Callback((ArraySegment s, CancellationToken ct) => buffers.Add(ToArray(s))) - .Returns(Task.CompletedTask); - - var sink = new TestBlobSink(name => - { - names.Add(name); - return blob.Object; - }); - var logger = (BatchingLogger)sink.CreateLogger("Cat"); - - await sink.IntervalControl.Pause; - - var startDate = _timestampOne; - for (int i = 0; i < 3; i++) - { - logger.Log(startDate, LogLevel.Information, 0, "Text " + i, null, (state, ex) => state); - - startDate = startDate.AddHours(1); - } - - sink.IntervalControl.Resume(); - await sink.IntervalControl.Pause; - - Assert.Equal(3, buffers.Count); - - Assert.Equal("appname/2016/05/04/03/42_filename", names[0]); - Assert.Equal("appname/2016/05/04/04/42_filename", names[1]); - Assert.Equal("appname/2016/05/04/05/42_filename", names[2]); - } - - private byte[] ToArray(ArraySegment inputStream) - { - return inputStream.Array - .Skip(inputStream.Offset) - .Take(inputStream.Count) - .ToArray(); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs b/src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs deleted file mode 100644 index 00d7dcd58d2..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/AzureDiagnosticsConfigurationProviderTests.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using Moq; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class AzureDiagnosticsConfigurationProviderTests - { - [Fact] - public void NoConfigFile() - { - var tempFolder = Path.Combine(Path.GetTempPath(), "AzureWebAppLoggerThisFolderShouldNotExist"); - - var contextMock = new Mock(); - contextMock.SetupGet(c => c.HomeFolder) - .Returns(tempFolder); - - var config = SiteConfigurationProvider.GetAzureLoggingConfiguration(contextMock.Object); - - Assert.NotNull(config); - } - - [Fact] - public void ReadsSettingsFileAndEnvironment() - { - var tempFolder = Path.Combine(Path.GetTempPath(), "WebAppLoggerConfigurationDisabledInSettingsFile"); - - try - { - var settingsFolder = Path.Combine(tempFolder, "site", "diagnostics"); - var settingsFile = Path.Combine(settingsFolder, "settings.json"); - - if (!Directory.Exists(settingsFolder)) - { - Directory.CreateDirectory(settingsFolder); - } - Environment.SetEnvironmentVariable("RANDOM_ENVIRONMENT_VARIABLE", "USEFUL_VALUE"); - File.WriteAllText(settingsFile, @"{ ""key"":""test value"" }"); - - var contextMock = new Mock(); - contextMock.SetupGet(c => c.HomeFolder) - .Returns(tempFolder); - - var config = SiteConfigurationProvider.GetAzureLoggingConfiguration(contextMock.Object); - - Assert.Equal("test value", config["key"]); - Assert.Equal("USEFUL_VALUE", config["RANDOM_ENVIRONMENT_VARIABLE"]); - } - finally - { - if (Directory.Exists(tempFolder)) - { - try - { - Directory.Delete(tempFolder, recursive: true); - } - catch - { - // Don't break the test if temp folder deletion fails. - } - } - } - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs b/src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs deleted file mode 100644 index 9ab0c0cb45f..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/BatchingLoggerProviderTests.cs +++ /dev/null @@ -1,136 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class BatchingLoggerProviderTests - { - private DateTimeOffset _timestampOne = new DateTimeOffset(2016, 05, 04, 03, 02, 01, TimeSpan.Zero); - private string _nl = Environment.NewLine; - private Regex _timeStampRegex = new Regex(@"^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}.\d{3} .\d{2}:\d{2} "); - - [Fact] - public async Task LogsInIntervals() - { - var provider = new TestBatchingLoggingProvider(); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - logger.Log(_timestampOne, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(_timestampOne.AddHours(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Equal("2016-05-04 03:02:01.000 +00:00 [Information] Cat: Info message" + _nl, provider.Batches[0][0].Message); - Assert.Equal("2016-05-04 04:02:01.000 +00:00 [Error] Cat: Error message" + _nl, provider.Batches[0][1].Message); - } - - [Fact] - public async Task IncludesScopes() - { - var provider = new TestBatchingLoggingProvider(includeScopes: true); - var factory = new LoggerFactory(new [] { provider }); - var logger = factory.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - using (logger.BeginScope("Scope")) - { - using (logger.BeginScope("Scope2")) - { - logger.Log(LogLevel.Information, 0, "Info message", null, (state, ex) => state); - } - } - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Matches(_timeStampRegex, provider.Batches[0][0].Message); - Assert.EndsWith( - " [Information] Cat => Scope => Scope2:" + _nl + - "Info message" + _nl, - provider.Batches[0][0].Message); - } - - [Fact] - public async Task RespectsBatchSize() - { - var provider = new TestBatchingLoggingProvider(maxBatchSize: 1); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - logger.Log(_timestampOne, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(_timestampOne.AddHours(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Equal(2, provider.Batches.Count); - Assert.Single(provider.Batches[0]); - Assert.Equal("2016-05-04 03:02:01.000 +00:00 [Information] Cat: Info message" + _nl, provider.Batches[0][0].Message); - - Assert.Single(provider.Batches[1]); - Assert.Equal("2016-05-04 04:02:01.000 +00:00 [Error] Cat: Error message" + _nl, provider.Batches[1][0].Message); - } - - [Fact] - public async Task DropsMessagesWhenReachingMaxQueue() - { - var provider = new TestBatchingLoggingProvider(maxQueueSize: 1); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - logger.Log(_timestampOne, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(_timestampOne.AddHours(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Equal(2, provider.Batches[0].Length); - Assert.Equal("2016-05-04 03:02:01.000 +00:00 [Information] Cat: Info message" + _nl, provider.Batches[0][0].Message); - Assert.Equal("1 message(s) dropped because of queue size limit. Increase the queue size or decrease logging verbosity to avoid this." + _nl, provider.Batches[0][1].Message); - } - - private class TestBatchingLoggingProvider: BatchingLoggerProvider - { - public List Batches { get; } = new List(); - public ManualIntervalControl IntervalControl { get; } = new ManualIntervalControl(); - - public TestBatchingLoggingProvider(TimeSpan? interval = null, int? maxBatchSize = null, int? maxQueueSize = null, bool includeScopes = false) - : base(new OptionsWrapperMonitor(new BatchingLoggerOptions - { - FlushPeriod = interval ?? TimeSpan.FromSeconds(1), - BatchSize = maxBatchSize, - BackgroundQueueSize = maxQueueSize, - IsEnabled = true, - IncludeScopes = includeScopes - })) - { - } - - internal override Task WriteMessagesAsync(IEnumerable messages, CancellationToken token) - { - Batches.Add(messages.ToArray()); - return Task.CompletedTask; - } - - protected override Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken) - { - return IntervalControl.IntervalAsync(); - } - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs b/src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs deleted file mode 100644 index 46b72c7a0de..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/ConfigureOptionsTests.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.IO; -using Microsoft.Extensions.Configuration; -using Moq; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class ConfigureOptionsTests - { - [Theory] - [InlineData(true)] - [InlineData(false)] - [InlineData(null)] - public void InitializesIsEnabled(bool? enabled) - { - var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] - { - new KeyValuePair("IsEnabledKey", Convert.ToString(enabled)) - }).Build(); - - var options = new BatchingLoggerOptions(); - new BatchLoggerConfigureOptions(configuration, "IsEnabledKey").Configure(options); - - Assert.Equal(enabled ?? false, options.IsEnabled); - } - - [Fact] - public void InitializesLogDirectory() - { - var configuration = new ConfigurationBuilder().AddInMemoryCollection(new[] - { - new KeyValuePair("APPSETTING_DIAGNOSTICS_AZUREBLOBCONTAINERSASURL", "http://container/url") - }).Build(); - - var contextMock = new Mock(); - contextMock.SetupGet(c => c.HomeFolder).Returns("Home"); - - var options = new AzureFileLoggerOptions(); - new FileLoggerConfigureOptions(configuration, contextMock.Object).Configure(options); - - Assert.Equal(Path.Combine("Home", "LogFiles", "Application"), options.LogDirectory); - } - - [Fact] - public void InitializesBlobUriSiteInstanceAndName() - { - var configuration = new ConfigurationBuilder().AddInMemoryCollection(new [] - { - new KeyValuePair("APPSETTING_DIAGNOSTICS_AZUREBLOBCONTAINERSASURL", "http://container/url") - }).Build(); - - var contextMock = new Mock(); - contextMock.SetupGet(c => c.HomeFolder).Returns("Home"); - contextMock.SetupGet(c => c.SiteInstanceId).Returns("InstanceId"); - contextMock.SetupGet(c => c.SiteName).Returns("Name"); - - var options = new AzureBlobLoggerOptions(); - new BlobLoggerConfigureOptions(configuration, contextMock.Object).Configure(options); - - Assert.Equal("http://container/url", options.ContainerUrl); - Assert.Equal("InstanceId", options.ApplicationInstanceId); - Assert.Equal("Name", options.ApplicationName); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs b/src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs deleted file mode 100644 index a3fcd2587d2..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/FileLoggerTests.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class FileLoggerTests: IDisposable - { - DateTimeOffset _timestampOne = new DateTimeOffset(2016, 05, 04, 03, 02, 01, TimeSpan.Zero); - - public FileLoggerTests() - { - TempPath = Path.GetTempFileName() + "_"; - } - - public string TempPath { get; } - - public void Dispose() - { - try - { - if (Directory.Exists(TempPath)) - { - Directory.Delete(TempPath, true); - } - } - catch - { - // ignored - } - } - - [Fact] - public async Task WritesToTextFile() - { - var provider = new TestFileLoggerProvider(TempPath); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - logger.Log(_timestampOne, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(_timestampOne.AddHours(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Equal( - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Info message" + Environment.NewLine + - "2016-05-04 04:02:01.000 +00:00 [Error] Cat: Error message" + Environment.NewLine, - File.ReadAllText(Path.Combine(TempPath, "LogFile.20160504.txt"))); - } - - [Fact] - public async Task RollsTextFile() - { - var provider = new TestFileLoggerProvider(TempPath); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - - logger.Log(_timestampOne, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(_timestampOne.AddDays(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - Assert.Equal( - "2016-05-04 03:02:01.000 +00:00 [Information] Cat: Info message" + Environment.NewLine, - File.ReadAllText(Path.Combine(TempPath, "LogFile.20160504.txt"))); - - Assert.Equal( - "2016-05-05 03:02:01.000 +00:00 [Error] Cat: Error message" + Environment.NewLine, - File.ReadAllText(Path.Combine(TempPath, "LogFile.20160505.txt"))); - } - - [Fact] - public async Task RespectsMaxFileCount() - { - Directory.CreateDirectory(TempPath); - File.WriteAllText(Path.Combine(TempPath, "randomFile.txt"), "Text"); - - var provider = new TestFileLoggerProvider(TempPath, maxRetainedFiles: 5); - var logger = (BatchingLogger)provider.CreateLogger("Cat"); - - await provider.IntervalControl.Pause; - var timestamp = _timestampOne; - - for (int i = 0; i < 10; i++) - { - logger.Log(timestamp, LogLevel.Information, 0, "Info message", null, (state, ex) => state); - logger.Log(timestamp.AddHours(1), LogLevel.Error, 0, "Error message", null, (state, ex) => state); - - timestamp = timestamp.AddDays(1); - } - - provider.IntervalControl.Resume(); - await provider.IntervalControl.Pause; - - var actualFiles = new DirectoryInfo(TempPath) - .GetFiles() - .Select(f => f.Name) - .OrderBy(f => f) - .ToArray(); - - Assert.Equal(6, actualFiles.Length); - Assert.Equal(new[] { - "LogFile.20160509.txt", - "LogFile.20160510.txt", - "LogFile.20160511.txt", - "LogFile.20160512.txt", - "LogFile.20160513.txt", - "randomFile.txt" - }, actualFiles); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs b/src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs deleted file mode 100644 index cf8bede1a58..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/LoggerBuilderExtensionsTests.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Linq; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Options; -using Moq; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class LoggerBuilderExtensionsTests - { - private IWebAppContext _appContext; - - public LoggerBuilderExtensionsTests() - { - var contextMock = new Mock(); - contextMock.SetupGet(c => c.IsRunningInAzureWebApp).Returns(true); - contextMock.SetupGet(c => c.HomeFolder).Returns("."); - _appContext = contextMock.Object; - } - - [Fact] - public void BuilderExtensionAddsSingleSetOfServicesWhenCalledTwice() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging(builder => builder.AddAzureWebAppDiagnostics(_appContext)); - var count = serviceCollection.Count; - - Assert.NotEqual(0, count); - - serviceCollection.AddLogging(builder => builder.AddAzureWebAppDiagnostics(_appContext)); - - Assert.Equal(count, serviceCollection.Count); - } - - [Fact] - public void BuilderExtensionAddsConfigurationChangeTokenSource() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging(builder => builder.AddConfiguration(new ConfigurationBuilder().Build())); - - // Tracking for main configuration - Assert.Equal(1, serviceCollection.Count(d => d.ServiceType == typeof(IOptionsChangeTokenSource))); - - serviceCollection.AddLogging(builder => builder.AddAzureWebAppDiagnostics(_appContext)); - - // Make sure we add another config change token for azure diagnostic configuration - Assert.Equal(2, serviceCollection.Count(d => d.ServiceType == typeof(IOptionsChangeTokenSource))); - } - - [Fact] - public void BuilderExtensionAddsIConfigureOptions() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging(builder => builder.AddConfiguration(new ConfigurationBuilder().Build())); - - // Tracking for main configuration - Assert.Equal(2, serviceCollection.Count(d => d.ServiceType == typeof(IConfigureOptions))); - - serviceCollection.AddLogging(builder => builder.AddAzureWebAppDiagnostics(_appContext)); - - Assert.Equal(4, serviceCollection.Count(d => d.ServiceType == typeof(IConfigureOptions))); - } - - [Fact] - public void LoggerProviderIsResolvable() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging(builder => builder.AddAzureWebAppDiagnostics(_appContext)); - - var serviceProvider = serviceCollection.BuildServiceProvider(); - var loggerFactory = serviceProvider.GetService(); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs b/src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs deleted file mode 100644 index 29cc883a286..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/ManualIntervalControl.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - internal class ManualIntervalControl - { - - private TaskCompletionSource _pauseCompletionSource = new TaskCompletionSource(); - private TaskCompletionSource _resumeCompletionSource; - - public Task Pause => _pauseCompletionSource.Task; - - public void Resume() - { - _pauseCompletionSource = new TaskCompletionSource(); - _resumeCompletionSource.SetResult(null); - } - - public async Task IntervalAsync() - { - _resumeCompletionSource = new TaskCompletionSource(); - _pauseCompletionSource.SetResult(null); - - await _resumeCompletionSource.Task; - } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj b/src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj deleted file mode 100644 index 7365c790766..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs b/src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs deleted file mode 100644 index fbc531c26d4..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/OptionsWrapperMonitor.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.Options; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - internal class OptionsWrapperMonitor : IOptionsMonitor - { - public OptionsWrapperMonitor(T currentValue) - { - CurrentValue = currentValue; - } - - public IDisposable OnChange(Action listener) - { - return null; - } - - public T Get(string name) => CurrentValue; - - public T CurrentValue { get; } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs b/src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs deleted file mode 100644 index 4b9ec445bef..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/TestBlobSink.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - internal class TestBlobSink : BlobLoggerProvider - { - internal ManualIntervalControl IntervalControl { get; } = new ManualIntervalControl(); - - public TestBlobSink(Func blobReferenceFactory) : base( - new OptionsWrapperMonitor(new AzureBlobLoggerOptions() - { - ApplicationInstanceId = "42", - ApplicationName = "appname", - BlobName = "filename", - IsEnabled = true - }), - blobReferenceFactory) - { - } - - protected override Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken) - { - return IntervalControl.IntervalAsync(); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs b/src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs deleted file mode 100644 index 60fbb88bd86..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/TestFileLoggerProvider.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - internal class TestFileLoggerProvider : FileLoggerProvider - { - internal ManualIntervalControl IntervalControl { get; } = new ManualIntervalControl(); - - public TestFileLoggerProvider( - string path, - string fileName = "LogFile.", - int maxFileSize = 32_000, - int maxRetainedFiles = 100) - : base(new OptionsWrapperMonitor(new AzureFileLoggerOptions() - { - LogDirectory = path, - FileName = fileName, - FileSizeLimit = maxFileSize, - RetainedFileCountLimit = maxRetainedFiles, - IsEnabled = true - })) - { - } - - protected override Task IntervalAsync(TimeSpan interval, CancellationToken cancellationToken) - { - return IntervalControl.IntervalAsync(); - } - } -} diff --git a/src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs b/src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs deleted file mode 100644 index f933b9f2fab..00000000000 --- a/src/Logging/Logging.AzureAppServices/test/WebConfigurationLevelSwitchTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using Microsoft.Extensions.Configuration; -using Xunit; - -namespace Microsoft.Extensions.Logging.AzureAppServices.Test -{ - public class WebConfigurationLevelSwitchTests - { - [Theory] - [InlineData("Error", LogLevel.Error)] - [InlineData("Warning", LogLevel.Warning)] - [InlineData("Information", LogLevel.Information)] - [InlineData("Verbose", LogLevel.Trace)] - [InlineData("ABCD", LogLevel.None)] - public void AddsRuleWithCorrectLevel(string levelValue, LogLevel expectedLevel) - { - var configuration = new ConfigurationBuilder().AddInMemoryCollection( - new[] - { - new KeyValuePair("levelKey", levelValue), - }) - .Build(); - - var levelSwitcher = new ConfigurationBasedLevelSwitcher(configuration, typeof(TestFileLoggerProvider), "levelKey"); - - var filterConfiguration = new LoggerFilterOptions(); - levelSwitcher.Configure(filterConfiguration); - - Assert.Equal(1, filterConfiguration.Rules.Count); - - var rule = filterConfiguration.Rules[0]; - Assert.Equal(typeof(TestFileLoggerProvider).FullName, rule.ProviderName); - Assert.Equal(expectedLevel, rule.LogLevel); - } - } -} diff --git a/src/Logging/Logging.Testing/src/BeginScopeContext.cs b/src/Logging/Logging.Testing/src/BeginScopeContext.cs deleted file mode 100644 index 14ef991e0d4..00000000000 --- a/src/Logging/Logging.Testing/src/BeginScopeContext.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Logging.Testing -{ - public class BeginScopeContext - { - public object Scope { get; set; } - - public string LoggerName { get; set; } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.Testing/src/ITestSink.cs b/src/Logging/Logging.Testing/src/ITestSink.cs deleted file mode 100644 index b328e5c595f..00000000000 --- a/src/Logging/Logging.Testing/src/ITestSink.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; - -namespace Microsoft.Extensions.Logging.Testing -{ - public interface ITestSink - { - event Action MessageLogged; - - event Action ScopeStarted; - - Func WriteEnabled { get; set; } - - Func BeginEnabled { get; set; } - - IProducerConsumerCollection Scopes { get; set; } - - IProducerConsumerCollection Writes { get; set; } - - void Write(WriteContext context); - - void Begin(BeginScopeContext context); - } -} diff --git a/src/Logging/Logging.Testing/src/LogLevelAttribute.cs b/src/Logging/Logging.Testing/src/LogLevelAttribute.cs deleted file mode 100644 index 74aa395d4b7..00000000000 --- a/src/Logging/Logging.Testing/src/LogLevelAttribute.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.Testing -{ - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = false)] - public class LogLevelAttribute : Attribute - { - public LogLevelAttribute(LogLevel logLevel) - { - LogLevel = logLevel; - } - - public LogLevel LogLevel { get; } - } -} diff --git a/src/Logging/Logging.Testing/src/LogValuesAssert.cs b/src/Logging/Logging.Testing/src/LogValuesAssert.cs deleted file mode 100644 index ef2ff1f406b..00000000000 --- a/src/Logging/Logging.Testing/src/LogValuesAssert.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Xunit.Sdk; - -namespace Microsoft.Extensions.Logging.Testing -{ - public static class LogValuesAssert - { - /// - /// Asserts that the given key and value are present in the actual values. - /// - /// The key of the item to be found. - /// The value of the item to be found. - /// The actual values. - public static void Contains( - string key, - object value, - IEnumerable> actualValues) - { - Contains(new[] { new KeyValuePair(key, value) }, actualValues); - } - - /// - /// Asserts that all the expected values are present in the actual values by ignoring - /// the order of values. - /// - /// Expected subset of values - /// Actual set of values - public static void Contains( - IEnumerable> expectedValues, - IEnumerable> actualValues) - { - if (expectedValues == null) - { - throw new ArgumentNullException(nameof(expectedValues)); - } - - if (actualValues == null) - { - throw new ArgumentNullException(nameof(actualValues)); - } - - var comparer = new LogValueComparer(); - - foreach (var expectedPair in expectedValues) - { - if (!actualValues.Contains(expectedPair, comparer)) - { - throw new EqualException( - expected: GetString(expectedValues), - actual: GetString(actualValues)); - } - } - } - - private static string GetString(IEnumerable> logValues) - { - return string.Join(",", logValues.Select(kvp => $"[{kvp.Key} {kvp.Value}]")); - } - - private class LogValueComparer : IEqualityComparer> - { - public bool Equals(KeyValuePair x, KeyValuePair y) - { - return string.Equals(x.Key, y.Key) && object.Equals(x.Value, y.Value); - } - - public int GetHashCode(KeyValuePair obj) - { - // We are never going to put this KeyValuePair in a hash table, - // so this is ok. - throw new NotImplementedException(); - } - } - } -} diff --git a/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj b/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj deleted file mode 100644 index 457843ba64a..00000000000 --- a/src/Logging/Logging.Testing/src/Microsoft.Extensions.Logging.Testing.csproj +++ /dev/null @@ -1,38 +0,0 @@ - - - - Helpers for writing tests that use Microsoft.Extensions.Logging. Contains null implementations of the abstractions that do nothing, as well as test implementations that are observable. - netstandard2.0;net461 - $(NoWarn);CS1591 - $(PackageTags);testing - - false - - true - false - true - - - - - - - - - - - - - - - - - - diff --git a/src/Logging/Logging.Testing/src/TestLogger.cs b/src/Logging/Logging.Testing/src/TestLogger.cs deleted file mode 100644 index 1f1b1d6abaa..00000000000 --- a/src/Logging/Logging.Testing/src/TestLogger.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.Testing -{ - public class TestLogger : ILogger - { - private object _scope; - private readonly ITestSink _sink; - private readonly string _name; - private readonly Func _filter; - - public TestLogger(string name, ITestSink sink, bool enabled) - : this(name, sink, _ => enabled) - { - } - - public TestLogger(string name, ITestSink sink, Func filter) - { - _sink = sink; - _name = name; - _filter = filter; - } - - public string Name { get; set; } - - public IDisposable BeginScope(TState state) - { - _scope = state; - - _sink.Begin(new BeginScopeContext() - { - LoggerName = _name, - Scope = state, - }); - - return TestDisposable.Instance; - } - - public void Log(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - if (!IsEnabled(logLevel)) - { - return; - } - - _sink.Write(new WriteContext() - { - LogLevel = logLevel, - EventId = eventId, - State = state, - Exception = exception, - Formatter = (s, e) => formatter((TState)s, e), - LoggerName = _name, - Scope = _scope - }); - } - - public bool IsEnabled(LogLevel logLevel) - { - return logLevel != LogLevel.None && _filter(logLevel); - } - - private class TestDisposable : IDisposable - { - public static readonly TestDisposable Instance = new TestDisposable(); - - public void Dispose() - { - // intentionally does nothing - } - } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.Testing/src/TestLoggerFactory.cs b/src/Logging/Logging.Testing/src/TestLoggerFactory.cs deleted file mode 100644 index a7f2f1398c5..00000000000 --- a/src/Logging/Logging.Testing/src/TestLoggerFactory.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Logging.Testing -{ - public class TestLoggerFactory : ILoggerFactory - { - private readonly ITestSink _sink; - private readonly bool _enabled; - - public TestLoggerFactory(ITestSink sink, bool enabled) - { - _sink = sink; - _enabled = enabled; - } - - public ILogger CreateLogger(string name) - { - return new TestLogger(name, _sink, _enabled); - } - - public void AddProvider(ILoggerProvider provider) - { - } - - public void Dispose() - { - } - } -} diff --git a/src/Logging/Logging.Testing/src/TestLoggerProvider.cs b/src/Logging/Logging.Testing/src/TestLoggerProvider.cs deleted file mode 100644 index e604bda36e9..00000000000 --- a/src/Logging/Logging.Testing/src/TestLoggerProvider.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Logging.Testing -{ - public class TestLoggerProvider : ILoggerProvider - { - private readonly ITestSink _sink; - - public TestLoggerProvider(ITestSink sink) - { - _sink = sink; - } - - public ILogger CreateLogger(string categoryName) - { - return new TestLogger(categoryName, _sink, enabled: true); - } - - public void Dispose() - { - } - } -} diff --git a/src/Logging/Logging.Testing/src/TestLoggerT.cs b/src/Logging/Logging.Testing/src/TestLoggerT.cs deleted file mode 100644 index 096bb965352..00000000000 --- a/src/Logging/Logging.Testing/src/TestLoggerT.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.Testing -{ - public class TestLogger : ILogger - { - private readonly ILogger _logger; - - public TestLogger(TestLoggerFactory factory) - { - _logger = factory.CreateLogger(); - } - - public IDisposable BeginScope(TState state) - { - return _logger.BeginScope(state); - } - - public bool IsEnabled(LogLevel logLevel) - { - return _logger.IsEnabled(logLevel); - } - - public void Log( - LogLevel logLevel, - EventId eventId, - TState state, - Exception exception, - Func formatter) - { - _logger.Log(logLevel, eventId, state, exception, formatter); - } - } -} diff --git a/src/Logging/Logging.Testing/src/TestSink.cs b/src/Logging/Logging.Testing/src/TestSink.cs deleted file mode 100644 index 5285b3068fe..00000000000 --- a/src/Logging/Logging.Testing/src/TestSink.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; - -namespace Microsoft.Extensions.Logging.Testing -{ - public class TestSink : ITestSink - { - private ConcurrentQueue _scopes; - private ConcurrentQueue _writes; - - public TestSink( - Func writeEnabled = null, - Func beginEnabled = null) - { - WriteEnabled = writeEnabled; - BeginEnabled = beginEnabled; - - _scopes = new ConcurrentQueue(); - _writes = new ConcurrentQueue(); - } - - public Func WriteEnabled { get; set; } - - public Func BeginEnabled { get; set; } - - public IProducerConsumerCollection Scopes { get => _scopes; set => _scopes = new ConcurrentQueue(value); } - - public IProducerConsumerCollection Writes { get => _writes; set => _writes = new ConcurrentQueue(value); } - - public event Action MessageLogged; - - public event Action ScopeStarted; - - public void Write(WriteContext context) - { - if (WriteEnabled == null || WriteEnabled(context)) - { - _writes.Enqueue(context); - } - MessageLogged?.Invoke(context); - } - - public void Begin(BeginScopeContext context) - { - if (BeginEnabled == null || BeginEnabled(context)) - { - _scopes.Enqueue(context); - } - ScopeStarted?.Invoke(context); - } - - public static bool EnableWithTypeName(WriteContext context) - { - return context.LoggerName.Equals(typeof(T).FullName); - } - - public static bool EnableWithTypeName(BeginScopeContext context) - { - return context.LoggerName.Equals(typeof(T).FullName); - } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.Testing/src/WriteContext.cs b/src/Logging/Logging.Testing/src/WriteContext.cs deleted file mode 100644 index 0ecfc8f1a9a..00000000000 --- a/src/Logging/Logging.Testing/src/WriteContext.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Logging.Testing -{ - public class WriteContext - { - public LogLevel LogLevel { get; set; } - - public EventId EventId { get; set; } - - public object State { get; set; } - - public Exception Exception { get; set; } - - public Func Formatter { get; set; } - - public object Scope { get; set; } - - public string LoggerName { get; set; } - - public string Message - { - get - { - return Formatter(State, Exception); - } - } - } -} \ No newline at end of file diff --git a/src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs b/src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs deleted file mode 100644 index 7d053d45dd9..00000000000 --- a/src/Logging/Logging.Testing/src/XunitLoggerFactoryExtensions.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging.Testing; -using Xunit.Abstractions; - -namespace Microsoft.Extensions.Logging -{ - public static class XunitLoggerFactoryExtensions - { - public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output) - { - builder.Services.AddSingleton(new XunitLoggerProvider(output)); - return builder; - } - - public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output, LogLevel minLevel) - { - builder.Services.AddSingleton(new XunitLoggerProvider(output, minLevel)); - return builder; - } - - public static ILoggingBuilder AddXunit(this ILoggingBuilder builder, ITestOutputHelper output, LogLevel minLevel, DateTimeOffset? logStart) - { - builder.Services.AddSingleton(new XunitLoggerProvider(output, minLevel, logStart)); - return builder; - } - - public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output) - { - loggerFactory.AddProvider(new XunitLoggerProvider(output)); - return loggerFactory; - } - - public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output, LogLevel minLevel) - { - loggerFactory.AddProvider(new XunitLoggerProvider(output, minLevel)); - return loggerFactory; - } - - public static ILoggerFactory AddXunit(this ILoggerFactory loggerFactory, ITestOutputHelper output, LogLevel minLevel, DateTimeOffset? logStart) - { - loggerFactory.AddProvider(new XunitLoggerProvider(output, minLevel, logStart)); - return loggerFactory; - } - } -} diff --git a/src/Logging/Logging.Testing/src/XunitLoggerProvider.cs b/src/Logging/Logging.Testing/src/XunitLoggerProvider.cs deleted file mode 100644 index 3a1d7514131..00000000000 --- a/src/Logging/Logging.Testing/src/XunitLoggerProvider.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Linq; -using System.Text; -using Xunit.Abstractions; - -namespace Microsoft.Extensions.Logging.Testing -{ - public class XunitLoggerProvider : ILoggerProvider - { - private readonly ITestOutputHelper _output; - private readonly LogLevel _minLevel; - private readonly DateTimeOffset? _logStart; - - public XunitLoggerProvider(ITestOutputHelper output) - : this(output, LogLevel.Trace) - { - } - - public XunitLoggerProvider(ITestOutputHelper output, LogLevel minLevel) - : this(output, minLevel, null) - { - } - - public XunitLoggerProvider(ITestOutputHelper output, LogLevel minLevel, DateTimeOffset? logStart) - { - _output = output; - _minLevel = minLevel; - _logStart = logStart; - } - - public ILogger CreateLogger(string categoryName) - { - return new XunitLogger(_output, categoryName, _minLevel, _logStart); - } - - public void Dispose() - { - } - } - - public class XunitLogger : ILogger - { - private static readonly string[] NewLineChars = new[] { Environment.NewLine }; - private readonly string _category; - private readonly LogLevel _minLogLevel; - private readonly ITestOutputHelper _output; - private DateTimeOffset? _logStart; - - public XunitLogger(ITestOutputHelper output, string category, LogLevel minLogLevel, DateTimeOffset? logStart) - { - _minLogLevel = minLogLevel; - _category = category; - _output = output; - _logStart = logStart; - } - - public void Log( - LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - if (!IsEnabled(logLevel)) - { - return; - } - - // Buffer the message into a single string in order to avoid shearing the message when running across multiple threads. - var messageBuilder = new StringBuilder(); - - var timestamp = _logStart.HasValue ? $"{(DateTimeOffset.UtcNow - _logStart.Value).TotalSeconds.ToString("N3")}s" : DateTimeOffset.UtcNow.ToString("s"); - - var firstLinePrefix = $"| [{timestamp}] {_category} {logLevel}: "; - var lines = formatter(state, exception).Split(NewLineChars, StringSplitOptions.RemoveEmptyEntries); - messageBuilder.AppendLine(firstLinePrefix + lines.FirstOrDefault() ?? string.Empty); - - var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); - foreach (var line in lines.Skip(1)) - { - messageBuilder.AppendLine(additionalLinePrefix + line); - } - - if (exception != null) - { - lines = exception.ToString().Split(NewLineChars, StringSplitOptions.RemoveEmptyEntries); - additionalLinePrefix = "| "; - foreach (var line in lines) - { - messageBuilder.AppendLine(additionalLinePrefix + line); - } - } - - // Remove the last line-break, because ITestOutputHelper only has WriteLine. - var message = messageBuilder.ToString(); - if (message.EndsWith(Environment.NewLine)) - { - message = message.Substring(0, message.Length - Environment.NewLine.Length); - } - - try - { - _output.WriteLine(message); - } - catch (Exception) - { - // We could fail because we're on a background thread and our captured ITestOutputHelper is - // busted (if the test "completed" before the background thread fired). - // So, ignore this. There isn't really anything we can do but hope the - // caller has additional loggers registered - } - } - - public bool IsEnabled(LogLevel logLevel) - => logLevel >= _minLogLevel; - - public IDisposable BeginScope(TState state) - => new NullScope(); - - private class NullScope : IDisposable - { - public void Dispose() - { - } - } - } -} diff --git a/src/Logging/samples/SampleApp/SampleApp.csproj b/src/Logging/samples/SampleApp/SampleApp.csproj index 9d04421accd..e1f5904b7e7 100644 --- a/src/Logging/samples/SampleApp/SampleApp.csproj +++ b/src/Logging/samples/SampleApp/SampleApp.csproj @@ -16,7 +16,6 @@ - diff --git a/src/Shared/src/ActivatorUtilities/ActivatorUtilities.cs b/src/Shared/src/ActivatorUtilities/ActivatorUtilities.cs deleted file mode 100644 index c4c20f1fba3..00000000000 --- a/src/Shared/src/ActivatorUtilities/ActivatorUtilities.cs +++ /dev/null @@ -1,433 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Runtime.ExceptionServices; - -#if ActivatorUtilities_In_DependencyInjection -using Microsoft.Extensions.Internal; - -namespace Microsoft.Extensions.DependencyInjection -#else -namespace Microsoft.Extensions.Internal -#endif -{ - /// - /// Helper code for the various activator services. - /// - -#if ActivatorUtilities_In_DependencyInjection - public -#else - // Do not take a dependency on this class unless you are explicitly trying to avoid taking a - // dependency on Microsoft.AspNetCore.DependencyInjection.Abstractions. - internal -#endif - static class ActivatorUtilities - { - private static readonly MethodInfo GetServiceInfo = - GetMethodInfo>((sp, t, r, c) => GetService(sp, t, r, c)); - - /// - /// Instantiate a type with constructor arguments provided directly and/or from an . - /// - /// The service provider used to resolve dependencies - /// The type to activate - /// Constructor arguments not provided by the . - /// An activated object of type instanceType - public static object CreateInstance(IServiceProvider provider, Type instanceType, params object[] parameters) - { - int bestLength = -1; - var seenPreferred = false; - - ConstructorMatcher bestMatcher = default; - - if (!instanceType.GetTypeInfo().IsAbstract) - { - foreach (var constructor in instanceType - .GetTypeInfo() - .DeclaredConstructors) - { - if (!constructor.IsStatic && constructor.IsPublic) - { - var matcher = new ConstructorMatcher(constructor); - var isPreferred = constructor.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), false); - var length = matcher.Match(parameters); - - if (isPreferred) - { - if (seenPreferred) - { - ThrowMultipleCtorsMarkedWithAttributeException(); - } - - if (length == -1) - { - ThrowMarkedCtorDoesNotTakeAllProvidedArguments(); - } - } - - if (isPreferred || bestLength < length) - { - bestLength = length; - bestMatcher = matcher; - } - - seenPreferred |= isPreferred; - } - } - } - - if (bestLength == -1) - { - var message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor."; - throw new InvalidOperationException(message); - } - - return bestMatcher.CreateInstance(provider); - } - - /// - /// Create a delegate that will instantiate a type with constructor arguments provided directly - /// and/or from an . - /// - /// The type to activate - /// - /// The types of objects, in order, that will be passed to the returned function as its second parameter - /// - /// - /// A factory that will instantiate instanceType using an - /// and an argument array containing objects matching the types defined in argumentTypes - /// - public static ObjectFactory CreateFactory(Type instanceType, Type[] argumentTypes) - { - FindApplicableConstructor(instanceType, argumentTypes, out ConstructorInfo constructor, out int?[] parameterMap); - - var provider = Expression.Parameter(typeof(IServiceProvider), "provider"); - var argumentArray = Expression.Parameter(typeof(object[]), "argumentArray"); - var factoryExpressionBody = BuildFactoryExpression(constructor, parameterMap, provider, argumentArray); - - var factoryLambda = Expression.Lambda>( - factoryExpressionBody, provider, argumentArray); - - var result = factoryLambda.Compile(); - return result.Invoke; - } - - /// - /// Instantiate a type with constructor arguments provided directly and/or from an . - /// - /// The type to activate - /// The service provider used to resolve dependencies - /// Constructor arguments not provided by the . - /// An activated object of type T - public static T CreateInstance(IServiceProvider provider, params object[] parameters) - { - return (T)CreateInstance(provider, typeof(T), parameters); - } - - - /// - /// Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly. - /// - /// The type of the service - /// The service provider used to resolve dependencies - /// The resolved service or created instance - public static T GetServiceOrCreateInstance(IServiceProvider provider) - { - return (T)GetServiceOrCreateInstance(provider, typeof(T)); - } - - /// - /// Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly. - /// - /// The service provider - /// The type of the service - /// The resolved service or created instance - public static object GetServiceOrCreateInstance(IServiceProvider provider, Type type) - { - return provider.GetService(type) ?? CreateInstance(provider, type); - } - - private static MethodInfo GetMethodInfo(Expression expr) - { - var mc = (MethodCallExpression)expr.Body; - return mc.Method; - } - - private static object GetService(IServiceProvider sp, Type type, Type requiredBy, bool isDefaultParameterRequired) - { - var service = sp.GetService(type); - if (service == null && !isDefaultParameterRequired) - { - var message = $"Unable to resolve service for type '{type}' while attempting to activate '{requiredBy}'."; - throw new InvalidOperationException(message); - } - return service; - } - - private static Expression BuildFactoryExpression( - ConstructorInfo constructor, - int?[] parameterMap, - Expression serviceProvider, - Expression factoryArgumentArray) - { - var constructorParameters = constructor.GetParameters(); - var constructorArguments = new Expression[constructorParameters.Length]; - - for (var i = 0; i < constructorParameters.Length; i++) - { - var constructorParameter = constructorParameters[i]; - var parameterType = constructorParameter.ParameterType; - var hasDefaultValue = ParameterDefaultValue.TryGetDefaultValue(constructorParameter, out var defaultValue); - - if (parameterMap[i] != null) - { - constructorArguments[i] = Expression.ArrayAccess(factoryArgumentArray, Expression.Constant(parameterMap[i])); - } - else - { - var parameterTypeExpression = new Expression[] { serviceProvider, - Expression.Constant(parameterType, typeof(Type)), - Expression.Constant(constructor.DeclaringType, typeof(Type)), - Expression.Constant(hasDefaultValue) }; - constructorArguments[i] = Expression.Call(GetServiceInfo, parameterTypeExpression); - } - - // Support optional constructor arguments by passing in the default value - // when the argument would otherwise be null. - if (hasDefaultValue) - { - var defaultValueExpression = Expression.Constant(defaultValue); - constructorArguments[i] = Expression.Coalesce(constructorArguments[i], defaultValueExpression); - } - - constructorArguments[i] = Expression.Convert(constructorArguments[i], parameterType); - } - - return Expression.New(constructor, constructorArguments); - } - - private static void FindApplicableConstructor( - Type instanceType, - Type[] argumentTypes, - out ConstructorInfo matchingConstructor, - out int?[] parameterMap) - { - matchingConstructor = null; - parameterMap = null; - - if (!TryFindPreferredConstructor(instanceType, argumentTypes, ref matchingConstructor, ref parameterMap) && - !TryFindMatchingConstructor(instanceType, argumentTypes, ref matchingConstructor, ref parameterMap)) - { - var message = $"A suitable constructor for type '{instanceType}' could not be located. Ensure the type is concrete and services are registered for all parameters of a public constructor."; - throw new InvalidOperationException(message); - } - } - - // Tries to find constructor based on provided argument types - private static bool TryFindMatchingConstructor( - Type instanceType, - Type[] argumentTypes, - ref ConstructorInfo matchingConstructor, - ref int?[] parameterMap) - { - foreach (var constructor in instanceType.GetTypeInfo().DeclaredConstructors) - { - if (constructor.IsStatic || !constructor.IsPublic) - { - continue; - } - - if (TryCreateParameterMap(constructor.GetParameters(), argumentTypes, out int?[] tempParameterMap)) - { - if (matchingConstructor != null) - { - throw new InvalidOperationException($"Multiple constructors accepting all given argument types have been found in type '{instanceType}'. There should only be one applicable constructor."); - } - - matchingConstructor = constructor; - parameterMap = tempParameterMap; - } - } - - return matchingConstructor != null; - } - - // Tries to find constructor marked with ActivatorUtilitiesConstructorAttribute - private static bool TryFindPreferredConstructor( - Type instanceType, - Type[] argumentTypes, - ref ConstructorInfo matchingConstructor, - ref int?[] parameterMap) - { - var seenPreferred = false; - foreach (var constructor in instanceType.GetTypeInfo().DeclaredConstructors) - { - if (constructor.IsStatic || !constructor.IsPublic) - { - continue; - } - - if (constructor.IsDefined(typeof(ActivatorUtilitiesConstructorAttribute), false)) - { - if (seenPreferred) - { - ThrowMultipleCtorsMarkedWithAttributeException(); - } - - if (!TryCreateParameterMap(constructor.GetParameters(), argumentTypes, out int?[] tempParameterMap)) - { - ThrowMarkedCtorDoesNotTakeAllProvidedArguments(); - } - - matchingConstructor = constructor; - parameterMap = tempParameterMap; - seenPreferred = true; - } - } - - return matchingConstructor != null; - } - - // Creates an injective parameterMap from givenParameterTypes to assignable constructorParameters. - // Returns true if each given parameter type is assignable to a unique; otherwise, false. - private static bool TryCreateParameterMap(ParameterInfo[] constructorParameters, Type[] argumentTypes, out int?[] parameterMap) - { - parameterMap = new int?[constructorParameters.Length]; - - for (var i = 0; i < argumentTypes.Length; i++) - { - var foundMatch = false; - var givenParameter = argumentTypes[i].GetTypeInfo(); - - for (var j = 0; j < constructorParameters.Length; j++) - { - if (parameterMap[j] != null) - { - // This ctor parameter has already been matched - continue; - } - - if (constructorParameters[j].ParameterType.GetTypeInfo().IsAssignableFrom(givenParameter)) - { - foundMatch = true; - parameterMap[j] = i; - break; - } - } - - if (!foundMatch) - { - return false; - } - } - - return true; - } - - private struct ConstructorMatcher - { - private readonly ConstructorInfo _constructor; - private readonly ParameterInfo[] _parameters; - private readonly object[] _parameterValues; - - public ConstructorMatcher(ConstructorInfo constructor) - { - _constructor = constructor; - _parameters = _constructor.GetParameters(); - _parameterValues = new object[_parameters.Length]; - } - - public int Match(object[] givenParameters) - { - var applyIndexStart = 0; - var applyExactLength = 0; - for (var givenIndex = 0; givenIndex != givenParameters.Length; givenIndex++) - { - var givenType = givenParameters[givenIndex]?.GetType().GetTypeInfo(); - var givenMatched = false; - - for (var applyIndex = applyIndexStart; givenMatched == false && applyIndex != _parameters.Length; ++applyIndex) - { - if (_parameterValues[applyIndex] == null && - _parameters[applyIndex].ParameterType.GetTypeInfo().IsAssignableFrom(givenType)) - { - givenMatched = true; - _parameterValues[applyIndex] = givenParameters[givenIndex]; - if (applyIndexStart == applyIndex) - { - applyIndexStart++; - if (applyIndex == givenIndex) - { - applyExactLength = applyIndex; - } - } - } - } - - if (givenMatched == false) - { - return -1; - } - } - return applyExactLength; - } - - public object CreateInstance(IServiceProvider provider) - { - for (var index = 0; index != _parameters.Length; index++) - { - if (_parameterValues[index] == null) - { - var value = provider.GetService(_parameters[index].ParameterType); - if (value == null) - { - if (!ParameterDefaultValue.TryGetDefaultValue(_parameters[index], out var defaultValue)) - { - throw new InvalidOperationException($"Unable to resolve service for type '{_parameters[index].ParameterType}' while attempting to activate '{_constructor.DeclaringType}'."); - } - else - { - _parameterValues[index] = defaultValue; - } - } - else - { - _parameterValues[index] = value; - } - } - } - -#if NETCOREAPP - return _constructor.Invoke(BindingFlags.DoNotWrapExceptions, binder: null, parameters: _parameterValues, culture: null); -#else - try - { - return _constructor.Invoke(_parameterValues); - } - catch (TargetInvocationException ex) when (ex.InnerException != null) - { - ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); - // The above line will always throw, but the compiler requires we throw explicitly. - throw; - } -#endif - } - } - - private static void ThrowMultipleCtorsMarkedWithAttributeException() - { - throw new InvalidOperationException($"Multiple constructors were marked with {nameof(ActivatorUtilitiesConstructorAttribute)}."); - } - - private static void ThrowMarkedCtorDoesNotTakeAllProvidedArguments() - { - throw new InvalidOperationException($"Constructor marked with {nameof(ActivatorUtilitiesConstructorAttribute)} does not accept all given argument types."); - } - } -} diff --git a/src/Shared/src/ActivatorUtilities/ActivatorUtilitiesConstructorAttribute.cs b/src/Shared/src/ActivatorUtilities/ActivatorUtilitiesConstructorAttribute.cs deleted file mode 100644 index add0af95c85..00000000000 --- a/src/Shared/src/ActivatorUtilities/ActivatorUtilitiesConstructorAttribute.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -#if ActivatorUtilities_In_DependencyInjection -namespace Microsoft.Extensions.DependencyInjection -#else -namespace Microsoft.Extensions.Internal -#endif -{ - /// - /// Marks the constructor to be used when activating type using . - /// - -#if ActivatorUtilities_In_DependencyInjection - public -#else - // Do not take a dependency on this class unless you are explicitly trying to avoid taking a - // dependency on Microsoft.AspNetCore.DependencyInjection.Abstractions. - internal -#endif - class ActivatorUtilitiesConstructorAttribute: Attribute - { - } -} diff --git a/src/Shared/src/ActivatorUtilities/Microsoft.Extensions.ActivatorUtilities.Sources.csproj b/src/Shared/src/ActivatorUtilities/Microsoft.Extensions.ActivatorUtilities.Sources.csproj deleted file mode 100644 index 85545d30c81..00000000000 --- a/src/Shared/src/ActivatorUtilities/Microsoft.Extensions.ActivatorUtilities.Sources.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - true - $(ContentTargetFolders)\cs\netstandard1.0\ - - - - - - diff --git a/src/Shared/src/ActivatorUtilities/ObjectFactory.cs b/src/Shared/src/ActivatorUtilities/ObjectFactory.cs deleted file mode 100644 index 4788769b093..00000000000 --- a/src/Shared/src/ActivatorUtilities/ObjectFactory.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -#if ActivatorUtilities_In_DependencyInjection -namespace Microsoft.Extensions.DependencyInjection -#else -namespace Microsoft.Extensions.Internal -#endif -{ - - /// - /// The result of . - /// - /// The to get service arguments from. - /// Additional constructor arguments. - /// The instantiated type. -#if ActivatorUtilities_In_DependencyInjection - public -#else - internal -#endif - delegate object ObjectFactory(IServiceProvider serviceProvider, object[] arguments); -} \ No newline at end of file diff --git a/src/Shared/src/BenchmarkRunner/AspNetCoreBenchmarkAttribute.cs b/src/Shared/src/BenchmarkRunner/AspNetCoreBenchmarkAttribute.cs deleted file mode 100644 index 0f23867de1d..00000000000 --- a/src/Shared/src/BenchmarkRunner/AspNetCoreBenchmarkAttribute.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using BenchmarkDotNet.Configs; - -namespace BenchmarkDotNet.Attributes -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)] - internal class AspNetCoreBenchmarkAttribute : Attribute, IConfigSource - { - public AspNetCoreBenchmarkAttribute() - : this(typeof(DefaultCoreConfig)) - { - } - - public AspNetCoreBenchmarkAttribute(Type configType) - : this(configType, typeof(DefaultCoreValidationConfig)) - { - } - - public AspNetCoreBenchmarkAttribute(Type configType, Type validationConfigType) - { - ConfigTypes = new Dictionary() - { - { NamedConfiguration.Default, typeof(DefaultCoreConfig) }, - { NamedConfiguration.Validation, typeof(DefaultCoreValidationConfig) }, - { NamedConfiguration.Profile, typeof(DefaultCoreProfileConfig) }, - { NamedConfiguration.Debug, typeof(DefaultCoreDebugConfig) }, - { NamedConfiguration.PerfLab, typeof(DefaultCorePerfLabConfig) }, - }; - - if (configType != null) - { - ConfigTypes[NamedConfiguration.Default] = configType; - } - - if (validationConfigType != null) - { - ConfigTypes[NamedConfiguration.Validation] = validationConfigType; - } - } - - public IConfig Config - { - get - { - if (!ConfigTypes.TryGetValue(ConfigName ?? NamedConfiguration.Default, out var configType)) - { - var message = $"Could not find a configuration matching {ConfigName}. " + - $"Known configurations: {string.Join(", ", ConfigTypes.Keys)}"; - throw new InvalidOperationException(message); - } - - return (IConfig)Activator.CreateInstance(configType, Array.Empty()); - } - } - - public Dictionary ConfigTypes { get; } - - public static string ConfigName { get; set; } = NamedConfiguration.Default; - - public static class NamedConfiguration - { - public static readonly string Default = "default"; - public static readonly string Validation = "validation"; - public static readonly string Profile = "profile"; - public static readonly string Debug = "debug"; - public static readonly string PerfLab = "perflab"; - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/DefaultCoreConfig.cs b/src/Shared/src/BenchmarkRunner/DefaultCoreConfig.cs deleted file mode 100644 index 7cad2fd106f..00000000000 --- a/src/Shared/src/BenchmarkRunner/DefaultCoreConfig.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Columns; -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Diagnosers; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Exporters; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Toolchains.CsProj; -using BenchmarkDotNet.Toolchains.DotNetCli; -using BenchmarkDotNet.Validators; - -namespace BenchmarkDotNet.Attributes -{ - internal class DefaultCoreConfig : ManualConfig - { - public DefaultCoreConfig() - { - Add(ConsoleLogger.Default); - Add(MarkdownExporter.GitHub); - - Add(MemoryDiagnoser.Default); - Add(StatisticColumn.OperationsPerSecond); - Add(DefaultColumnProviders.Instance); - - Add(JitOptimizationsValidator.FailOnError); - - Add(Job.Core -#if NETCOREAPP2_1 - .With(CsProjCoreToolchain.From(NetCoreAppSettings.NetCoreApp21)) -#elif NETCOREAPP3_0 - .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.0", null, ".NET Core 3.0"))) -#elif NETCOREAPP3_1 - .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp3.1", null, ".NET Core 3.1"))) -#elif NETCOREAPP5_0 - .With(CsProjCoreToolchain.From(new NetCoreAppSettings("netcoreapp5.0", null, ".NET Core 5.0"))) -#else -#error Target frameworks need to be updated. -#endif - .With(new GcMode { Server = true }) - .With(RunStrategy.Throughput)); - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/DefaultCoreDebugConfig.cs b/src/Shared/src/BenchmarkRunner/DefaultCoreDebugConfig.cs deleted file mode 100644 index f399c712bfc..00000000000 --- a/src/Shared/src/BenchmarkRunner/DefaultCoreDebugConfig.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Validators; - -namespace BenchmarkDotNet.Attributes -{ - internal class DefaultCoreDebugConfig : ManualConfig - { - public DefaultCoreDebugConfig() - { - Add(ConsoleLogger.Default); - Add(JitOptimizationsValidator.DontFailOnError); - - Add(Job.InProcess - .With(RunStrategy.Throughput)); - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/DefaultCorePerfLabConfig.cs b/src/Shared/src/BenchmarkRunner/DefaultCorePerfLabConfig.cs deleted file mode 100644 index d8fe46385c5..00000000000 --- a/src/Shared/src/BenchmarkRunner/DefaultCorePerfLabConfig.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Columns; -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Diagnosers; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Exporters; -using BenchmarkDotNet.Exporters.Csv; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Validators; - -namespace BenchmarkDotNet.Attributes -{ - internal class DefaultCorePerfLabConfig : ManualConfig - { - public DefaultCorePerfLabConfig() - { - Add(ConsoleLogger.Default); - - Add(MemoryDiagnoser.Default); - Add(StatisticColumn.OperationsPerSecond); - Add(new ParamsSummaryColumn()); - Add(DefaultColumnProviders.Statistics, DefaultColumnProviders.Diagnosers, DefaultColumnProviders.Target); - - // TODO: When upgrading to BDN 0.11.1, use Add(DefaultColumnProviders.Descriptor); - // DefaultColumnProviders.Target is deprecated - - Add(JitOptimizationsValidator.FailOnError); - - Add(Job.InProcess - .With(RunStrategy.Throughput)); - - Add(MarkdownExporter.GitHub); - - Add(new CsvExporter( - CsvSeparator.Comma, - new Reports.SummaryStyle - { - PrintUnitsInHeader = true, - PrintUnitsInContent = false, - TimeUnit = Horology.TimeUnit.Microsecond, - SizeUnit = SizeUnit.KB - })); - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/DefaultCoreProfileConfig.cs b/src/Shared/src/BenchmarkRunner/DefaultCoreProfileConfig.cs deleted file mode 100644 index 395f425e245..00000000000 --- a/src/Shared/src/BenchmarkRunner/DefaultCoreProfileConfig.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Columns; -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Diagnosers; -using BenchmarkDotNet.Engines; -using BenchmarkDotNet.Exporters; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Validators; - -namespace BenchmarkDotNet.Attributes -{ - internal class DefaultCoreProfileConfig : ManualConfig - { - public DefaultCoreProfileConfig() - { - Add(ConsoleLogger.Default); - Add(MarkdownExporter.GitHub); - - Add(MemoryDiagnoser.Default); - Add(StatisticColumn.OperationsPerSecond); - Add(DefaultColumnProviders.Instance); - - Add(JitOptimizationsValidator.FailOnError); - - Add(Job.InProcess - .With(RunStrategy.Throughput)); - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/DefaultCoreValidationConfig.cs b/src/Shared/src/BenchmarkRunner/DefaultCoreValidationConfig.cs deleted file mode 100644 index adc887a6140..00000000000 --- a/src/Shared/src/BenchmarkRunner/DefaultCoreValidationConfig.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Jobs; -using BenchmarkDotNet.Loggers; -using BenchmarkDotNet.Toolchains.InProcess; - -namespace BenchmarkDotNet.Attributes -{ - internal class DefaultCoreValidationConfig : ManualConfig - { - public DefaultCoreValidationConfig() - { - Add(ConsoleLogger.Default); - - Add(Job.Dry.With(InProcessToolchain.Instance)); - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/Microsoft.AspNetCore.BenchmarkRunner.Sources.csproj b/src/Shared/src/BenchmarkRunner/Microsoft.AspNetCore.BenchmarkRunner.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/BenchmarkRunner/Microsoft.AspNetCore.BenchmarkRunner.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/BenchmarkRunner/ParameterizedJobConfigAttribute.cs b/src/Shared/src/BenchmarkRunner/ParameterizedJobConfigAttribute.cs deleted file mode 100644 index 5ce0816f4a8..00000000000 --- a/src/Shared/src/BenchmarkRunner/ParameterizedJobConfigAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace BenchmarkDotNet.Attributes -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Assembly)] - internal class ParameterizedJobConfigAttribute: AspNetCoreBenchmarkAttribute - { - public ParameterizedJobConfigAttribute(Type configType) : base(configType) - { - } - } -} diff --git a/src/Shared/src/BenchmarkRunner/ParamsDisplayInfoColumn.cs b/src/Shared/src/BenchmarkRunner/ParamsDisplayInfoColumn.cs deleted file mode 100644 index 2ce4f6ad2f7..00000000000 --- a/src/Shared/src/BenchmarkRunner/ParamsDisplayInfoColumn.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using BenchmarkDotNet.Columns; -using BenchmarkDotNet.Reports; -using BenchmarkDotNet.Running; - -namespace BenchmarkDotNet.Attributes -{ - public class ParamsSummaryColumn : IColumn - { - public string Id => nameof(ParamsSummaryColumn); - public string ColumnName { get; } = "Params"; - public bool IsDefault(Summary summary, Benchmark benchmark) => false; - public string GetValue(Summary summary, Benchmark benchmark) => benchmark.Parameters.DisplayInfo; - public bool IsAvailable(Summary summary) => true; - public bool AlwaysShow => true; - public ColumnCategory Category => ColumnCategory.Params; - public int PriorityInCategory => 0; - public override string ToString() => ColumnName; - public bool IsNumeric => false; - public UnitType UnitType => UnitType.Dimensionless; - public string GetValue(Summary summary, Benchmark benchmark, ISummaryStyle style) => GetValue(summary, benchmark); - public string Legend => $"Summary of all parameter values"; - } -} \ No newline at end of file diff --git a/src/Shared/src/BenchmarkRunner/Program.cs b/src/Shared/src/BenchmarkRunner/Program.cs deleted file mode 100644 index 135dc173ac0..00000000000 --- a/src/Shared/src/BenchmarkRunner/Program.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Text; -using BenchmarkDotNet.Attributes; -using BenchmarkDotNet.Configs; -using BenchmarkDotNet.Running; - -namespace Microsoft.AspNetCore.BenchmarkDotNet.Runner -{ - partial class Program - { - private static TextWriter _standardOutput; - private static StringBuilder _standardOutputText; - - static partial void BeforeMain(string[] args); - - private static int Main(string[] args) - { - BeforeMain(args); - - AssignConfiguration(ref args); - var summaries = BenchmarkSwitcher.FromAssembly(typeof(Program).GetTypeInfo().Assembly) - .Run(args, ManualConfig.CreateEmpty()); - - foreach (var summary in summaries) - { - if (summary.HasCriticalValidationErrors) - { - return Fail(summary, nameof(summary.HasCriticalValidationErrors)); - } - - foreach (var report in summary.Reports) - { - if (!report.BuildResult.IsGenerateSuccess) - { - return Fail(report, nameof(report.BuildResult.IsGenerateSuccess)); - } - - if (!report.BuildResult.IsBuildSuccess) - { - return Fail(report, nameof(report.BuildResult.IsBuildSuccess)); - } - - if (!report.AllMeasurements.Any()) - { - return Fail(report, nameof(report.AllMeasurements)); - } - } - } - - return 0; - } - - private static int Fail(object o, string message) - { - _standardOutput?.WriteLine(_standardOutputText.ToString()); - - Console.Error.WriteLine("'{0}' failed, reason: '{1}'", o, message); - return 1; - } - - private static void AssignConfiguration(ref string[] args) - { - var argsList = args.ToList(); - if (argsList.Remove("--validate") || argsList.Remove("--validate-fast")) - { - // Compat: support the old style of passing a config that is used by our build system. - SuppressConsole(); - AspNetCoreBenchmarkAttribute.ConfigName = AspNetCoreBenchmarkAttribute.NamedConfiguration.Validation; - args = argsList.ToArray(); - return; - } - - var index = argsList.IndexOf("--config"); - if (index >= 0 && index < argsList.Count -1) - { - AspNetCoreBenchmarkAttribute.ConfigName = argsList[index + 1]; - argsList.RemoveAt(index + 1); - argsList.RemoveAt(index); - args = argsList.ToArray(); - return; - } - - if (Debugger.IsAttached) - { - Console.WriteLine("Using the debug config since you are debugging. I hope that's OK!"); - Console.WriteLine("Specify a configuration with --config to override"); - AspNetCoreBenchmarkAttribute.ConfigName = AspNetCoreBenchmarkAttribute.NamedConfiguration.Debug; - return; - } - } - - private static void SuppressConsole() - { - _standardOutput = Console.Out; - _standardOutputText = new StringBuilder(); - Console.SetOut(new StringWriter(_standardOutputText)); - } - } -} diff --git a/src/Shared/src/EmptyDisposable.cs b/src/Shared/src/EmptyDisposable.cs deleted file mode 100644 index d2a643a1ef7..00000000000 --- a/src/Shared/src/EmptyDisposable.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.FileProviders -{ - internal class EmptyDisposable : IDisposable - { - public static EmptyDisposable Instance { get; } = new EmptyDisposable(); - - private EmptyDisposable() - { - } - - public void Dispose() - { - } - } -} diff --git a/src/Shared/src/HashCodeCombiner/HashCodeCombiner.cs b/src/Shared/src/HashCodeCombiner/HashCodeCombiner.cs deleted file mode 100644 index ccff4df8340..00000000000 --- a/src/Shared/src/HashCodeCombiner/HashCodeCombiner.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections; -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace Microsoft.Extensions.Internal -{ - internal struct HashCodeCombiner - { - private long _combinedHash64; - - public int CombinedHash - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get { return _combinedHash64.GetHashCode(); } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private HashCodeCombiner(long seed) - { - _combinedHash64 = seed; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Add(IEnumerable e) - { - if (e == null) - { - Add(0); - } - else - { - var count = 0; - foreach (object o in e) - { - Add(o); - count++; - } - Add(count); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator int(HashCodeCombiner self) - { - return self.CombinedHash; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Add(int i) - { - _combinedHash64 = ((_combinedHash64 << 5) + _combinedHash64) ^ i; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Add(string s) - { - var hashCode = (s != null) ? s.GetHashCode() : 0; - Add(hashCode); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Add(object o) - { - var hashCode = (o != null) ? o.GetHashCode() : 0; - Add(hashCode); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void Add(TValue value, IEqualityComparer comparer) - { - var hashCode = value != null ? comparer.GetHashCode(value) : 0; - Add(hashCode); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static HashCodeCombiner Start() - { - return new HashCodeCombiner(0x1505L); - } - } -} diff --git a/src/Shared/src/HashCodeCombiner/Microsoft.Extensions.HashCodeCombiner.Sources.csproj b/src/Shared/src/HashCodeCombiner/Microsoft.Extensions.HashCodeCombiner.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/HashCodeCombiner/Microsoft.Extensions.HashCodeCombiner.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/HostFactoryResolver/HostFactoryResolver.cs b/src/Shared/src/HostFactoryResolver/HostFactoryResolver.cs deleted file mode 100644 index 71829d4dd4b..00000000000 --- a/src/Shared/src/HostFactoryResolver/HostFactoryResolver.cs +++ /dev/null @@ -1,113 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; - -namespace Microsoft.Extensions.Hosting -{ - internal class HostFactoryResolver - { - public static readonly string BuildWebHost = nameof(BuildWebHost); - public static readonly string CreateWebHostBuilder = nameof(CreateWebHostBuilder); - public static readonly string CreateHostBuilder = nameof(CreateHostBuilder); - - public static Func ResolveWebHostFactory(Assembly assembly) - { - return ResolveFactory(assembly, BuildWebHost); - } - - public static Func ResolveWebHostBuilderFactory(Assembly assembly) - { - return ResolveFactory(assembly, CreateWebHostBuilder); - } - - public static Func ResolveHostBuilderFactory(Assembly assembly) - { - return ResolveFactory(assembly, CreateHostBuilder); - } - - private static Func ResolveFactory(Assembly assembly, string name) - { - var programType = assembly?.EntryPoint?.DeclaringType; - if (programType == null) - { - return null; - } - - var factory = programType.GetTypeInfo().GetDeclaredMethod(name); - if (!IsFactory(factory)) - { - return null; - } - - return args => (T)factory.Invoke(null, new object[] { args }); - } - - // TReturn Factory(string[] args); - private static bool IsFactory(MethodInfo factory) - { - return factory != null - && typeof(TReturn).IsAssignableFrom(factory.ReturnType) - && factory.GetParameters().Length == 1 - && typeof(string[]).Equals(factory.GetParameters()[0].ParameterType); - } - - // Used by EF tooling without any Hosting references. Looses some return type safety checks. - public static Func ResolveServiceProviderFactory(Assembly assembly) - { - // Prefer the older patterns by default for back compat. - var webHostFactory = ResolveWebHostFactory(assembly); - if (webHostFactory != null) - { - return args => - { - var webHost = webHostFactory(args); - return GetServiceProvider(webHost); - }; - } - - var webHostBuilderFactory = ResolveWebHostBuilderFactory(assembly); - if (webHostBuilderFactory != null) - { - return args => - { - var webHostBuilder = webHostBuilderFactory(args); - var webHost = Build(webHostBuilder); - return GetServiceProvider(webHost); - }; - } - - var hostBuilderFactory = ResolveHostBuilderFactory(assembly); - if (hostBuilderFactory != null) - { - return args => - { - var hostBuilder = hostBuilderFactory(args); - var host = Build(hostBuilder); - return GetServiceProvider(host); - }; - } - - return null; - } - - private static object Build(object builder) - { - var buildMethod = builder.GetType().GetMethod("Build"); - return buildMethod?.Invoke(builder, Array.Empty()); - } - - private static IServiceProvider GetServiceProvider(object host) - { - if (host == null) - { - return null; - } - var hostType = host.GetType(); - var servicesProperty = hostType.GetTypeInfo().GetDeclaredProperty("Services"); - return (IServiceProvider)servicesProperty.GetValue(host); - } - } -} diff --git a/src/Shared/src/HostFactoryResolver/Microsoft.Extensions.HostFactoryResolver.Sources.csproj b/src/Shared/src/HostFactoryResolver/Microsoft.Extensions.HostFactoryResolver.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/HostFactoryResolver/Microsoft.Extensions.HostFactoryResolver.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/NonCapturingTimer/Microsoft.Extensions.NonCapturingTimer.Sources.csproj b/src/Shared/src/NonCapturingTimer/Microsoft.Extensions.NonCapturingTimer.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/NonCapturingTimer/Microsoft.Extensions.NonCapturingTimer.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/NonCapturingTimer/NonCapturingTimer.cs b/src/Shared/src/NonCapturingTimer/NonCapturingTimer.cs deleted file mode 100644 index 7b37db3db7f..00000000000 --- a/src/Shared/src/NonCapturingTimer/NonCapturingTimer.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; - -namespace Microsoft.Extensions.Internal -{ - // A convenience API for interacting with System.Threading.Timer in a way - // that doesn't capture the ExecutionContext. We should be using this (or equivalent) - // everywhere we use timers to avoid rooting any values stored in asynclocals. - internal static class NonCapturingTimer - { - public static Timer Create(TimerCallback callback, object state, TimeSpan dueTime, TimeSpan period) - { - if (callback == null) - { - throw new ArgumentNullException(nameof(callback)); - } - - // Don't capture the current ExecutionContext and its AsyncLocals onto the timer - bool restoreFlow = false; - try - { - if (!ExecutionContext.IsFlowSuppressed()) - { - ExecutionContext.SuppressFlow(); - restoreFlow = true; - } - - return new Timer(callback, state, dueTime, period); - } - finally - { - // Restore the current ExecutionContext - if (restoreFlow) - { - ExecutionContext.RestoreFlow(); - } - } - } - } -} diff --git a/src/Shared/src/ParameterDefaultValue/Microsoft.Extensions.ParameterDefaultValue.Sources.csproj b/src/Shared/src/ParameterDefaultValue/Microsoft.Extensions.ParameterDefaultValue.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/ParameterDefaultValue/Microsoft.Extensions.ParameterDefaultValue.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/ParameterDefaultValue/ParameterDefaultValue.cs b/src/Shared/src/ParameterDefaultValue/ParameterDefaultValue.cs deleted file mode 100644 index c55b7a3cb7f..00000000000 --- a/src/Shared/src/ParameterDefaultValue/ParameterDefaultValue.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; - -namespace Microsoft.Extensions.Internal -{ - internal class ParameterDefaultValue - { - private static readonly Type _nullable = typeof(Nullable<>); - - public static bool TryGetDefaultValue(ParameterInfo parameter, out object defaultValue) - { - bool hasDefaultValue; - var tryToGetDefaultValue = true; - defaultValue = null; - - try - { - hasDefaultValue = parameter.HasDefaultValue; - } - catch (FormatException) when (parameter.ParameterType == typeof(DateTime)) - { - // Workaround for https://github.com/dotnet/corefx/issues/12338 - // If HasDefaultValue throws FormatException for DateTime - // we expect it to have default value - hasDefaultValue = true; - tryToGetDefaultValue = false; - } - - if (hasDefaultValue) - { - if (tryToGetDefaultValue) - { - defaultValue = parameter.DefaultValue; - } - - // Workaround for https://github.com/dotnet/corefx/issues/11797 - if (defaultValue == null && parameter.ParameterType.IsValueType) - { - defaultValue = Activator.CreateInstance(parameter.ParameterType); - } - - // Handle nullable enums - if (defaultValue != null && - parameter.ParameterType.IsGenericType && - parameter.ParameterType.GetGenericTypeDefinition() == _nullable - ) - { - var underlyingType = Nullable.GetUnderlyingType(parameter.ParameterType); - if (underlyingType != null && underlyingType.IsEnum) - { - defaultValue = Enum.ToObject(underlyingType, defaultValue); - } - } - } - - return hasDefaultValue; - } - } -} diff --git a/src/Shared/src/ProviderAliasUtilities/ProviderAliasUtilities.cs b/src/Shared/src/ProviderAliasUtilities/ProviderAliasUtilities.cs deleted file mode 100644 index ee925c66412..00000000000 --- a/src/Shared/src/ProviderAliasUtilities/ProviderAliasUtilities.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; - -namespace Microsoft.Extensions.Logging -{ - internal static class ProviderAliasUtilities - { - private const string AliasAttibuteTypeFullName = "Microsoft.Extensions.Logging.ProviderAliasAttribute"; - private const string AliasAttibuteAliasProperty = "Alias"; - - internal static string GetAlias(Type providerType) - { - foreach (var attribute in providerType.GetTypeInfo().GetCustomAttributes(inherit: false)) - { - if (attribute.GetType().FullName == AliasAttibuteTypeFullName) - { - var valueProperty = attribute - .GetType() - .GetProperty(AliasAttibuteAliasProperty, BindingFlags.Public | BindingFlags.Instance); - - if (valueProperty != null) - { - return valueProperty.GetValue(attribute) as string; - } - } - } - - return null; - } - } -} \ No newline at end of file diff --git a/src/Shared/src/TypeNameHelper/Microsoft.Extensions.TypeNameHelper.Sources.csproj b/src/Shared/src/TypeNameHelper/Microsoft.Extensions.TypeNameHelper.Sources.csproj deleted file mode 100644 index dec7fff6e5f..00000000000 --- a/src/Shared/src/TypeNameHelper/Microsoft.Extensions.TypeNameHelper.Sources.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Shared/src/TypeNameHelper/TypeNameHelper.cs b/src/Shared/src/TypeNameHelper/TypeNameHelper.cs deleted file mode 100644 index 31b7d8a7918..00000000000 --- a/src/Shared/src/TypeNameHelper/TypeNameHelper.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using System.Collections.Generic; - -namespace Microsoft.Extensions.Internal -{ - internal static class TypeNameHelper - { - private const char DefaultNestedTypeDelimiter = '+'; - - private static readonly Dictionary _builtInTypeNames = new Dictionary - { - { typeof(void), "void" }, - { typeof(bool), "bool" }, - { typeof(byte), "byte" }, - { typeof(char), "char" }, - { typeof(decimal), "decimal" }, - { typeof(double), "double" }, - { typeof(float), "float" }, - { typeof(int), "int" }, - { typeof(long), "long" }, - { typeof(object), "object" }, - { typeof(sbyte), "sbyte" }, - { typeof(short), "short" }, - { typeof(string), "string" }, - { typeof(uint), "uint" }, - { typeof(ulong), "ulong" }, - { typeof(ushort), "ushort" } - }; - - public static string GetTypeDisplayName(object item, bool fullName = true) - { - return item == null ? null : GetTypeDisplayName(item.GetType(), fullName); - } - - /// - /// Pretty print a type name. - /// - /// The . - /// true to print a fully qualified name. - /// true to include generic parameter names. - /// true to include generic parameters. - /// Character to use as a delimiter in nested type names - /// The pretty printed type name. - public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter) - { - var builder = new StringBuilder(); - ProcessType(builder, type, new DisplayNameOptions(fullName, includeGenericParameterNames, includeGenericParameters, nestedTypeDelimiter)); - return builder.ToString(); - } - - private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options) - { - if (type.IsGenericType) - { - var genericArguments = type.GetGenericArguments(); - ProcessGenericType(builder, type, genericArguments, genericArguments.Length, options); - } - else if (type.IsArray) - { - ProcessArrayType(builder, type, options); - } - else if (_builtInTypeNames.TryGetValue(type, out var builtInName)) - { - builder.Append(builtInName); - } - else if (type.IsGenericParameter) - { - if (options.IncludeGenericParameterNames) - { - builder.Append(type.Name); - } - } - else - { - var name = options.FullName ? type.FullName : type.Name; - builder.Append(name); - - if (options.NestedTypeDelimiter != DefaultNestedTypeDelimiter) - { - builder.Replace(DefaultNestedTypeDelimiter, options.NestedTypeDelimiter, builder.Length - name.Length, name.Length); - } - } - } - - private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options) - { - var innerType = type; - while (innerType.IsArray) - { - innerType = innerType.GetElementType(); - } - - ProcessType(builder, innerType, options); - - while (type.IsArray) - { - builder.Append('['); - builder.Append(',', type.GetArrayRank() - 1); - builder.Append(']'); - type = type.GetElementType(); - } - } - - private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options) - { - var offset = 0; - if (type.IsNested) - { - offset = type.DeclaringType.GetGenericArguments().Length; - } - - if (options.FullName) - { - if (type.IsNested) - { - ProcessGenericType(builder, type.DeclaringType, genericArguments, offset, options); - builder.Append(options.NestedTypeDelimiter); - } - else if (!string.IsNullOrEmpty(type.Namespace)) - { - builder.Append(type.Namespace); - builder.Append('.'); - } - } - - var genericPartIndex = type.Name.IndexOf('`'); - if (genericPartIndex <= 0) - { - builder.Append(type.Name); - return; - } - - builder.Append(type.Name, 0, genericPartIndex); - - if (options.IncludeGenericParameters) - { - builder.Append('<'); - for (var i = offset; i < length; i++) - { - ProcessType(builder, genericArguments[i], options); - if (i + 1 == length) - { - continue; - } - - builder.Append(','); - if (options.IncludeGenericParameterNames || !genericArguments[i + 1].IsGenericParameter) - { - builder.Append(' '); - } - } - builder.Append('>'); - } - } - - private readonly struct DisplayNameOptions - { - public DisplayNameOptions(bool fullName, bool includeGenericParameterNames, bool includeGenericParameters, char nestedTypeDelimiter) - { - FullName = fullName; - IncludeGenericParameters = includeGenericParameters; - IncludeGenericParameterNames = includeGenericParameterNames; - NestedTypeDelimiter = nestedTypeDelimiter; - } - - public bool FullName { get; } - - public bool IncludeGenericParameters { get; } - - public bool IncludeGenericParameterNames { get; } - - public char NestedTypeDelimiter { get; } - } - } -} diff --git a/src/Shared/test/HashCodeCombinerTest.cs b/src/Shared/test/HashCodeCombinerTest.cs deleted file mode 100644 index 7cda9779583..00000000000 --- a/src/Shared/test/HashCodeCombinerTest.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Xunit; - -namespace Microsoft.Extensions.Internal -{ - public class HashCodeCombinerTest - { - [Fact] - public void GivenTheSameInputs_ItProducesTheSameOutput() - { - var hashCode1 = new HashCodeCombiner(); - var hashCode2 = new HashCodeCombiner(); - - hashCode1.Add(42); - hashCode1.Add("foo"); - hashCode2.Add(42); - hashCode2.Add("foo"); - - Assert.Equal(hashCode1.CombinedHash, hashCode2.CombinedHash); - } - - [Fact] - public void HashCode_Is_OrderSensitive() - { - var hashCode1 = HashCodeCombiner.Start(); - var hashCode2 = HashCodeCombiner.Start(); - - hashCode1.Add(42); - hashCode1.Add("foo"); - - hashCode2.Add("foo"); - hashCode2.Add(42); - - Assert.NotEqual(hashCode1.CombinedHash, hashCode2.CombinedHash); - } - } -} diff --git a/src/Shared/test/HostFactoryResolverTests.cs b/src/Shared/test/HostFactoryResolverTests.cs deleted file mode 100644 index add47ced07b..00000000000 --- a/src/Shared/test/HostFactoryResolverTests.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; -using System; -using Xunit; - -namespace Microsoft.Extensions.Hosting.Tests -{ - public class HostFactoryResolverTests - { - [Fact] - public void BuildWebHostPattern_CanFindWebHost() - { - var factory = HostFactoryResolver.ResolveWebHostFactory(typeof(BuildWebHostPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void BuildWebHostPattern_CanFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(BuildWebHostPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void BuildWebHostPattern__Invalid_CantFindWebHost() - { - var factory = HostFactoryResolver.ResolveWebHostFactory(typeof(BuildWebHostInvalidSignature.Program).Assembly); - - Assert.Null(factory); - } - - [Fact] - public void BuildWebHostPattern__Invalid_CantFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(BuildWebHostInvalidSignature.Program).Assembly); - - Assert.Null(factory); - } - - [Fact] - public void CreateWebHostBuilderPattern_CanFindWebHostBuilder() - { - var factory = HostFactoryResolver.ResolveWebHostBuilderFactory(typeof(CreateWebHostBuilderPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void CreateWebHostBuilderPattern_CanFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(CreateWebHostBuilderPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void CreateWebHostBuilderPattern__Invalid_CantFindWebHostBuilder() - { - var factory = HostFactoryResolver.ResolveWebHostBuilderFactory(typeof(CreateWebHostBuilderInvalidSignature.Program).Assembly); - - Assert.Null(factory); - } - - [Fact] - public void CreateWebHostBuilderPattern__InvalidReturnType_CanFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(CreateWebHostBuilderInvalidSignature.Program).Assembly); - - Assert.NotNull(factory); - Assert.Null(factory(Array.Empty())); - - } - - [Fact] - public void CreateHostBuilderPattern_CanFindHostBuilder() - { - var factory = HostFactoryResolver.ResolveHostBuilderFactory(typeof(CreateHostBuilderPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void CreateHostBuilderPattern_CanFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(CreateHostBuilderPatternTestSite.Program).Assembly); - - Assert.NotNull(factory); - Assert.IsAssignableFrom(factory(Array.Empty())); - } - - [Fact] - public void CreateHostBuilderPattern__Invalid_CantFindHostBuilder() - { - var factory = HostFactoryResolver.ResolveHostBuilderFactory(typeof(CreateHostBuilderInvalidSignature.Program).Assembly); - - Assert.Null(factory); - } - - [Fact] - public void CreateHostBuilderPattern__Invalid_CantFindServiceProvider() - { - var factory = HostFactoryResolver.ResolveServiceProviderFactory(typeof(CreateHostBuilderInvalidSignature.Program).Assembly); - - Assert.Null(factory); - } - } -} diff --git a/src/Shared/test/Microsoft.Extensions.Sources.Tests.csproj b/src/Shared/test/Microsoft.Extensions.Sources.Tests.csproj index 5d7cd465c1c..8c0d5ab96fa 100644 --- a/src/Shared/test/Microsoft.Extensions.Sources.Tests.csproj +++ b/src/Shared/test/Microsoft.Extensions.Sources.Tests.csproj @@ -7,21 +7,7 @@ - - - - - - - - - - + Exclude="..\src\ReferenceAssemblyInfo.cs" /> diff --git a/src/Shared/test/NonCapturingTimerTest.cs b/src/Shared/test/NonCapturingTimerTest.cs deleted file mode 100644 index 7feaa42be7e..00000000000 --- a/src/Shared/test/NonCapturingTimerTest.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Xunit; - -namespace Microsoft.Extensions.Internal -{ - public class NonCapturingTimerTest - { - [Fact] - public async Task NonCapturingTimer_DoesntCaptureExecutionContext() - { - // Arrange - var message = new AsyncLocal(); - message.Value = "Hey, this is a value stored in the execuion context"; - - var tcs = new TaskCompletionSource(); - - // Act - var timer = NonCapturingTimer.Create((_) => - { - // Observe the value based on the current execution context - tcs.SetResult(message.Value); - }, state: null, dueTime: TimeSpan.FromMilliseconds(1), Timeout.InfiniteTimeSpan); - - // Assert - var messageFromTimer = await tcs.Task; - timer.Dispose(); - - // ExecutionContext didn't flow to timer callback - Assert.Null(messageFromTimer); - - // ExecutionContext was restored - Assert.NotNull(await Task.Run(() => message.Value)); - } - } -} diff --git a/src/Shared/test/TypeNameHelperTest.cs b/src/Shared/test/TypeNameHelperTest.cs deleted file mode 100644 index 963be9579f9..00000000000 --- a/src/Shared/test/TypeNameHelperTest.cs +++ /dev/null @@ -1,305 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Xunit; - -namespace Microsoft.Extensions.Internal -{ - public class TypeNameHelperTest - { - [Theory] - // Predefined Types - [InlineData(typeof(int), "int")] - [InlineData(typeof(List), "System.Collections.Generic.List")] - [InlineData(typeof(Dictionary), "System.Collections.Generic.Dictionary")] - [InlineData(typeof(Dictionary>), "System.Collections.Generic.Dictionary>")] - [InlineData(typeof(List>), "System.Collections.Generic.List>")] - // Classes inside NonGeneric class - [InlineData(typeof(A), - "Microsoft.Extensions.Internal.TypeNameHelperTest+A")] - [InlineData(typeof(B), - "Microsoft.Extensions.Internal.TypeNameHelperTest+B")] - [InlineData(typeof(C), - "Microsoft.Extensions.Internal.TypeNameHelperTest+C")] - [InlineData(typeof(B>), - "Microsoft.Extensions.Internal.TypeNameHelperTest+B>")] - [InlineData(typeof(C>), - "Microsoft.Extensions.Internal.TypeNameHelperTest+C>")] - // Classes inside Generic class - [InlineData(typeof(Outer.D), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Outer+D")] - [InlineData(typeof(Outer.E), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Outer+E")] - [InlineData(typeof(Outer.F), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Outer+F")] - [InlineData(typeof(Level1.Level2.Level3), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Level1+Level2+Level3")] - [InlineData(typeof(Outer.E.E>), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Outer+E+E>")] - [InlineData(typeof(Outer.F.E>), - "Microsoft.Extensions.Internal.TypeNameHelperTest+Outer+F+E>")] - [InlineData(typeof(OuterGeneric.InnerNonGeneric.InnerGeneric.InnerGenericLeafNode), - "Microsoft.Extensions.Internal.TypeNameHelperTest+OuterGeneric+InnerNonGeneric+InnerGeneric+InnerGenericLeafNode")] - public void Can_pretty_print_CLR_full_name(Type type, string expected) - { - Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type)); - } - - [Fact] - public void DoesNotPrintNamespace_ForGenericTypes_IfNullOrEmpty() - { - // Arrange - var type = typeof(ClassInGlobalNamespace); - - // Act & Assert - Assert.Equal("ClassInGlobalNamespace", TypeNameHelper.GetTypeDisplayName(type)); - } - - [Theory] - // Predefined Types - [InlineData(typeof(int), "int")] - [InlineData(typeof(List), "List")] - [InlineData(typeof(Dictionary), "Dictionary")] - [InlineData(typeof(Dictionary>), "Dictionary>")] - [InlineData(typeof(List>), "List>")] - // Classes inside NonGeneric class - [InlineData(typeof(A), "A")] - [InlineData(typeof(B), "B")] - [InlineData(typeof(C), "C")] - [InlineData(typeof(C>), "C>")] - [InlineData(typeof(B>), "B>")] - // Classes inside Generic class - [InlineData(typeof(Outer.D), "D")] - [InlineData(typeof(Outer.E), "E")] - [InlineData(typeof(Outer.F), "F")] - [InlineData(typeof(Outer.F.E>), "F>")] - [InlineData(typeof(Outer.E.E>), "E>")] - [InlineData(typeof(OuterGeneric.InnerNonGeneric.InnerGeneric.InnerGenericLeafNode), "InnerGenericLeafNode")] - public void Can_pretty_print_CLR_name(Type type, string expected) - { - Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type, false)); - } - - [Theory] - [InlineData(typeof(void), "void")] - [InlineData(typeof(bool), "bool")] - [InlineData(typeof(byte), "byte")] - [InlineData(typeof(char), "char")] - [InlineData(typeof(decimal), "decimal")] - [InlineData(typeof(double), "double")] - [InlineData(typeof(float), "float")] - [InlineData(typeof(int), "int")] - [InlineData(typeof(long), "long")] - [InlineData(typeof(object), "object")] - [InlineData(typeof(sbyte), "sbyte")] - [InlineData(typeof(short), "short")] - [InlineData(typeof(string), "string")] - [InlineData(typeof(uint), "uint")] - [InlineData(typeof(ulong), "ulong")] - [InlineData(typeof(ushort), "ushort")] - public void Returns_common_name_for_built_in_types(Type type, string expected) - { - Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type)); - } - - [Theory] - [InlineData(typeof(int[]), true, "int[]")] - [InlineData(typeof(string[][]), true, "string[][]")] - [InlineData(typeof(int[,]), true, "int[,]")] - [InlineData(typeof(bool[,,,]), true, "bool[,,,]")] - [InlineData(typeof(A[,][,,]), true, "Microsoft.Extensions.Internal.TypeNameHelperTest+A[,][,,]")] - [InlineData(typeof(List), true, "System.Collections.Generic.List")] - [InlineData(typeof(List[,][,,]), false, "List[,][,,]")] - public void Can_pretty_print_array_name(Type type, bool fullName, string expected) - { - Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type, fullName)); - } - - public static TheoryData GetOpenGenericsTestData() - { - var openDictionaryType = typeof(Dictionary<,>); - var genArgsDictionary = openDictionaryType.GetGenericArguments(); - genArgsDictionary[0] = typeof(B<>); - var closedDictionaryType = openDictionaryType.MakeGenericType(genArgsDictionary); - - var openLevelType = typeof(Level1<>.Level2<>.Level3<>); - var genArgsLevel = openLevelType.GetGenericArguments(); - genArgsLevel[1] = typeof(string); - var closedLevelType = openLevelType.MakeGenericType(genArgsLevel); - - var openInnerType = typeof(OuterGeneric<>.InnerNonGeneric.InnerGeneric<,>.InnerGenericLeafNode<>); - var genArgsInnerType = openInnerType.GetGenericArguments(); - genArgsInnerType[3] = typeof(bool); - var closedInnerType = openInnerType.MakeGenericType(genArgsInnerType); - - return new TheoryData - { - { typeof(List<>), false, "List<>" }, - { typeof(Dictionary<,>), false , "Dictionary<,>" }, - { typeof(List<>), true , "System.Collections.Generic.List<>" }, - { typeof(Dictionary<,>), true , "System.Collections.Generic.Dictionary<,>" }, - { typeof(Level1<>.Level2<>.Level3<>), true, "Microsoft.Extensions.Internal.TypeNameHelperTest+Level1<>+Level2<>+Level3<>" }, - { - typeof(PartiallyClosedGeneric<>).BaseType, - true, - "Microsoft.Extensions.Internal.TypeNameHelperTest+C<, int>" - }, - { - typeof(OuterGeneric<>.InnerNonGeneric.InnerGeneric<,>.InnerGenericLeafNode<>), - true, - "Microsoft.Extensions.Internal.TypeNameHelperTest+OuterGeneric<>+InnerNonGeneric+InnerGeneric<,>+InnerGenericLeafNode<>" - }, - { - closedDictionaryType, - true, - "System.Collections.Generic.Dictionary,>" - }, - { - closedLevelType, - true, - "Microsoft.Extensions.Internal.TypeNameHelperTest+Level1<>+Level2+Level3<>" - }, - { - closedInnerType, - true, - "Microsoft.Extensions.Internal.TypeNameHelperTest+OuterGeneric<>+InnerNonGeneric+InnerGeneric<,>+InnerGenericLeafNode" - } - }; - } - - [Theory] - [MemberData(nameof(GetOpenGenericsTestData))] - public void Can_pretty_print_open_generics(Type type, bool fullName, string expected) - { - Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type, fullName)); - } - - public static TheoryData GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSetData => - new TheoryData - { - { typeof(B<>),"Microsoft.Extensions.Internal.TypeNameHelperTest+B" }, - { typeof(C<,>),"Microsoft.Extensions.Internal.TypeNameHelperTest+C" }, - { typeof(PartiallyClosedGeneric<>).BaseType,"Microsoft.Extensions.Internal.TypeNameHelperTest+C" }, - { typeof(Level1<>.Level2<>),"Microsoft.Extensions.Internal.TypeNameHelperTest+Level1+Level2" }, - }; - - [Theory] - [MemberData(nameof(GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSetData))] - public void GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSet(Type type, string expected) - { - // Arrange & Act - var actual = TypeNameHelper.GetTypeDisplayName(type, fullName: true, includeGenericParameterNames: true); - - // Assert - Assert.Equal(expected, actual); - } - - public static TheoryData GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSetData => - new TheoryData - { - { typeof(B<>),"B" }, - { typeof(C<,>),"C" }, - { typeof(PartiallyClosedGeneric<>).BaseType,"C" }, - { typeof(Level1<>.Level2<>),"Level2" }, - }; - - [Theory] - [MemberData(nameof(GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSetData))] - public void GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSet(Type type, string expected) - { - // Arrange & Act - var actual = TypeNameHelper.GetTypeDisplayName(type, fullName: false, includeGenericParameterNames: true); - - // Assert - Assert.Equal(expected, actual); - } - - public static TheoryData FullTypeNameData - { - get - { - return new TheoryData - { - // Predefined Types - { typeof(int), "int" }, - { typeof(List), "System.Collections.Generic.List" }, - { typeof(Dictionary), "System.Collections.Generic.Dictionary" }, - { typeof(Dictionary>), "System.Collections.Generic.Dictionary" }, - { typeof(List>), "System.Collections.Generic.List" }, - - // Classes inside NonGeneric class - { typeof(A), "Microsoft.Extensions.Internal.TypeNameHelperTest.A" }, - { typeof(B), "Microsoft.Extensions.Internal.TypeNameHelperTest.B" }, - { typeof(C), "Microsoft.Extensions.Internal.TypeNameHelperTest.C" }, - { typeof(C>), "Microsoft.Extensions.Internal.TypeNameHelperTest.C" }, - { typeof(B>), "Microsoft.Extensions.Internal.TypeNameHelperTest.B" }, - - // Classes inside Generic class - { typeof(Outer.D), "Microsoft.Extensions.Internal.TypeNameHelperTest.Outer.D" }, - { typeof(Outer.E), "Microsoft.Extensions.Internal.TypeNameHelperTest.Outer.E" }, - { typeof(Outer.F), "Microsoft.Extensions.Internal.TypeNameHelperTest.Outer.F" }, - { typeof(Outer.F.E>),"Microsoft.Extensions.Internal.TypeNameHelperTest.Outer.F" }, - { typeof(Outer.E.E>), "Microsoft.Extensions.Internal.TypeNameHelperTest.Outer.E" } - }; - } - } - - [Theory] - [MemberData(nameof(FullTypeNameData))] - public void Can_PrettyPrint_FullTypeName_WithoutGenericParametersAndNestedTypeDelimiter(Type type, string expectedTypeName) - { - // Arrange & Act - var displayName = TypeNameHelper.GetTypeDisplayName(type, fullName: true, includeGenericParameters: false, nestedTypeDelimiter: '.'); - - // Assert - Assert.Equal(expectedTypeName, displayName); - } - - private class A { } - - private class B { } - - private class C { } - - private class PartiallyClosedGeneric : C { } - - private class Outer - { - public class D { } - - public class E { } - - public class F { } - } - - private class OuterGeneric - { - public class InnerNonGeneric - { - public class InnerGeneric - { - public class InnerGenericLeafNode { } - - public class InnerLeafNode { } - } - } - } - - private class Level1 - { - public class Level2 - { - public class Level3 - { - } - } - } - } -} - -internal class ClassInGlobalNamespace -{ -} diff --git a/src/Shared/testassets/BuildWebHostInvalidSignature/BuildWebHostInvalidSignature.csproj b/src/Shared/testassets/BuildWebHostInvalidSignature/BuildWebHostInvalidSignature.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/BuildWebHostInvalidSignature/BuildWebHostInvalidSignature.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/BuildWebHostInvalidSignature/Program.cs b/src/Shared/testassets/BuildWebHostInvalidSignature/Program.cs deleted file mode 100644 index 2de3ff84f1a..00000000000 --- a/src/Shared/testassets/BuildWebHostInvalidSignature/Program.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace BuildWebHostInvalidSignature -{ - public class Program - { - static void Main(string[] args) - { - } - - // Missing string[] args - public static IWebHost BuildWebHost() => null; - } -} diff --git a/src/Shared/testassets/BuildWebHostPatternTestSite/BuildWebHostPatternTestSite.csproj b/src/Shared/testassets/BuildWebHostPatternTestSite/BuildWebHostPatternTestSite.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/BuildWebHostPatternTestSite/BuildWebHostPatternTestSite.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/BuildWebHostPatternTestSite/Program.cs b/src/Shared/testassets/BuildWebHostPatternTestSite/Program.cs deleted file mode 100644 index 0263907c00a..00000000000 --- a/src/Shared/testassets/BuildWebHostPatternTestSite/Program.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace BuildWebHostPatternTestSite -{ - public class Program - { - static void Main(string[] args) - { - } - - public static IWebHost BuildWebHost(string[] args) => new WebHost(); - } -} diff --git a/src/Shared/testassets/CreateHostBuilderInvalidSignature/CreateHostBuilderInvalidSignature.csproj b/src/Shared/testassets/CreateHostBuilderInvalidSignature/CreateHostBuilderInvalidSignature.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/CreateHostBuilderInvalidSignature/CreateHostBuilderInvalidSignature.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/CreateHostBuilderInvalidSignature/Program.cs b/src/Shared/testassets/CreateHostBuilderInvalidSignature/Program.cs deleted file mode 100644 index ec374f92b66..00000000000 --- a/src/Shared/testassets/CreateHostBuilderInvalidSignature/Program.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace CreateHostBuilderInvalidSignature -{ - public class Program - { - public static void Main(string[] args) - { - var webHost = CreateHostBuilder(null, args).Build(); - } - - // Extra parameter - private static IHostBuilder CreateHostBuilder(object extraParam, string[] args) => null; - } -} diff --git a/src/Shared/testassets/CreateHostBuilderPatternTestSite/CreateHostBuilderPatternTestSite.csproj b/src/Shared/testassets/CreateHostBuilderPatternTestSite/CreateHostBuilderPatternTestSite.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/CreateHostBuilderPatternTestSite/CreateHostBuilderPatternTestSite.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/CreateHostBuilderPatternTestSite/Program.cs b/src/Shared/testassets/CreateHostBuilderPatternTestSite/Program.cs deleted file mode 100644 index 28388151348..00000000000 --- a/src/Shared/testassets/CreateHostBuilderPatternTestSite/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace CreateHostBuilderPatternTestSite -{ - public class Program - { - public static void Main(string[] args) - { - var webHost = CreateHostBuilder(args).Build(); - } - - // Do not change the signature of this method. It's used for tests. - private static HostBuilder CreateHostBuilder(string[] args) => - new HostBuilder(); - } -} diff --git a/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/CreateWebHostBuilderInvalidSignature.csproj b/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/CreateWebHostBuilderInvalidSignature.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/CreateWebHostBuilderInvalidSignature.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/Program.cs b/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/Program.cs deleted file mode 100644 index 7e5aadcbb1c..00000000000 --- a/src/Shared/testassets/CreateWebHostBuilderInvalidSignature/Program.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace CreateWebHostBuilderInvalidSignature -{ - public class Program - { - static void Main(string[] args) - { - } - - // Wrong return type - public static IWebHost CreateWebHostBuilder(string[] args) => new WebHost(); - } -} diff --git a/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/CreateWebHostBuilderPatternTestSite.csproj b/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/CreateWebHostBuilderPatternTestSite.csproj deleted file mode 100644 index 05ca293b6ea..00000000000 --- a/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/CreateWebHostBuilderPatternTestSite.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - Exe - - - - - - - diff --git a/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/Program.cs b/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/Program.cs deleted file mode 100644 index 000f58d442e..00000000000 --- a/src/Shared/testassets/CreateWebHostBuilderPatternTestSite/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using MockHostTypes; - -namespace CreateWebHostBuilderPatternTestSite -{ - public class Program - { - public static void Main(string[] args) - { - var webHost = CreateWebHostBuilder(args).Build(); - } - - // Do not change the signature of this method. It's used for tests. - private static IWebHostBuilder CreateWebHostBuilder(string[] args) => - new WebHostBuilder(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/Host.cs b/src/Shared/testassets/MockHostTypes/Host.cs deleted file mode 100644 index 145f2ddc6a7..00000000000 --- a/src/Shared/testassets/MockHostTypes/Host.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace MockHostTypes -{ - public class Host : IHost - { - public IServiceProvider Services { get; } = new ServiceProvider(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/HostBuilder.cs b/src/Shared/testassets/MockHostTypes/HostBuilder.cs deleted file mode 100644 index 91e914167cd..00000000000 --- a/src/Shared/testassets/MockHostTypes/HostBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace MockHostTypes -{ - public class HostBuilder : IHostBuilder - { - public IHost Build() => new Host(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/IHost.cs b/src/Shared/testassets/MockHostTypes/IHost.cs deleted file mode 100644 index ee7892a917c..00000000000 --- a/src/Shared/testassets/MockHostTypes/IHost.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace MockHostTypes -{ - public interface IHost - { - IServiceProvider Services { get; } - } -} diff --git a/src/Shared/testassets/MockHostTypes/IHostBuilder.cs b/src/Shared/testassets/MockHostTypes/IHostBuilder.cs deleted file mode 100644 index 98cfd67da1f..00000000000 --- a/src/Shared/testassets/MockHostTypes/IHostBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace MockHostTypes -{ - public interface IHostBuilder - { - IHost Build(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/IWebHost.cs b/src/Shared/testassets/MockHostTypes/IWebHost.cs deleted file mode 100644 index bede6764de8..00000000000 --- a/src/Shared/testassets/MockHostTypes/IWebHost.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace MockHostTypes -{ - public interface IWebHost - { - IServiceProvider Services { get; } - } -} diff --git a/src/Shared/testassets/MockHostTypes/IWebHostBuilder.cs b/src/Shared/testassets/MockHostTypes/IWebHostBuilder.cs deleted file mode 100644 index 27e5b6ff4a4..00000000000 --- a/src/Shared/testassets/MockHostTypes/IWebHostBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace MockHostTypes -{ - public interface IWebHostBuilder - { - IWebHost Build(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/MockHostTypes.csproj b/src/Shared/testassets/MockHostTypes/MockHostTypes.csproj deleted file mode 100644 index 57b6e1ae58f..00000000000 --- a/src/Shared/testassets/MockHostTypes/MockHostTypes.csproj +++ /dev/null @@ -1,7 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - - - diff --git a/src/Shared/testassets/MockHostTypes/ServiceProvider.cs b/src/Shared/testassets/MockHostTypes/ServiceProvider.cs deleted file mode 100644 index b70ab7c6a53..00000000000 --- a/src/Shared/testassets/MockHostTypes/ServiceProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace MockHostTypes -{ - public class ServiceProvider : IServiceProvider - { - public object GetService(Type serviceType) => null; - } -} diff --git a/src/Shared/testassets/MockHostTypes/WebHost.cs b/src/Shared/testassets/MockHostTypes/WebHost.cs deleted file mode 100644 index e16fa2a0040..00000000000 --- a/src/Shared/testassets/MockHostTypes/WebHost.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace MockHostTypes -{ - public class WebHost : IWebHost - { - public IServiceProvider Services { get; } = new ServiceProvider(); - } -} diff --git a/src/Shared/testassets/MockHostTypes/WebHostBuilder.cs b/src/Shared/testassets/MockHostTypes/WebHostBuilder.cs deleted file mode 100644 index b8a78aac697..00000000000 --- a/src/Shared/testassets/MockHostTypes/WebHostBuilder.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace MockHostTypes -{ - public class WebHostBuilder : IWebHostBuilder - { - public IWebHost Build() => new WebHost(); - } -} diff --git a/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/Microsoft.Internal.Extensions.Refs.csproj b/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/Microsoft.Internal.Extensions.Refs.csproj deleted file mode 100644 index c89ec063a04..00000000000 --- a/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/Microsoft.Internal.Extensions.Refs.csproj +++ /dev/null @@ -1,83 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework) - - - false - true - false - - true - true - - - TargetingPack - ref/$(TargetFramework)/ - - - false - - - none - false - false - false - false - false - - - false - - - true - - - - - - - - - - - - - - $(BuildDependsOn); - _ResolveTargetingPackContent; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_PackageFiles Include="@(RefPackContent)" PackagePath="$(RefAssemblyPackagePath)" /> - - - - diff --git a/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/build/Microsoft.Internal.Extensions.Refs.props b/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/build/Microsoft.Internal.Extensions.Refs.props deleted file mode 100644 index b9e1840ed22..00000000000 --- a/src/TargetingPack/Microsoft.Internal.Extensions.Refs/ref/build/Microsoft.Internal.Extensions.Refs.props +++ /dev/null @@ -1,5 +0,0 @@ - - - $(MSBuildThisFileDirectory)..\ref\netcoreapp5.0\ - - diff --git a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/Internal.AspNetCore.Analyzers.csproj b/src/TestingUtils/Internal.AspNetCore.Analyzers/src/Internal.AspNetCore.Analyzers.csproj deleted file mode 100644 index 2ce18ea5b79..00000000000 --- a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/Internal.AspNetCore.Analyzers.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - ASP.NET Core internal use analyzers. - netstandard1.3 - $(PackageTags);analyzers - $(NoWarn);CS1591 - analyzers/dotnet/cs/ - - false - true - true - true - - - - - - - diff --git a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubternalityAnalyzer.cs b/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubternalityAnalyzer.cs deleted file mode 100644 index b66aa38c2ee..00000000000 --- a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubternalityAnalyzer.cs +++ /dev/null @@ -1,279 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Immutable; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Diagnostics; - -namespace Internal.AspNetCore.Analyzers -{ - [DiagnosticAnalyzer(LanguageNames.CSharp)] - public class PubternalityAnalyzer : DiagnosticAnalyzer - { - public PubternalityAnalyzer() - { - SupportedDiagnostics = ImmutableArray.Create(new[] - { - PubturnalityDescriptors.PUB0001, - PubturnalityDescriptors.PUB0002 - }); - } - - public override ImmutableArray SupportedDiagnostics { get; } - - public override void Initialize(AnalysisContext context) - { - context.EnableConcurrentExecution(); - - context.RegisterCompilationStartAction(analysisContext => - { - analysisContext.RegisterSymbolAction(symbolAnalysisContext => AnalyzeTypeUsage(symbolAnalysisContext), SymbolKind.Namespace); - analysisContext.RegisterSyntaxNodeAction(syntaxContext => AnalyzeTypeUsage(syntaxContext), SyntaxKind.IdentifierName); - }); - } - - private void AnalyzeTypeUsage(SymbolAnalysisContext context) - { - var ns = (INamespaceSymbol)context.Symbol; - if (IsInternal(ns)) - { - return; - } - - foreach (var namespaceOrTypeSymbol in ns.GetMembers()) - { - if (namespaceOrTypeSymbol.IsType) - { - CheckType((ITypeSymbol)namespaceOrTypeSymbol, context); - } - } - } - - private void CheckType(ITypeSymbol typeSymbol, SymbolAnalysisContext context) - { - if (IsPrivate(typeSymbol) || IsPrivate(typeSymbol.ContainingType)) - { - return; - } - - if (typeSymbol.BaseType != null) - { - CheckType(context, typeSymbol.BaseType, typeSymbol.DeclaringSyntaxReferences); - } - - foreach (var member in typeSymbol.GetMembers()) - { - CheckMember(context, member); - } - - foreach (var innerType in typeSymbol.GetTypeMembers()) - { - CheckType(innerType, context); - } - - if (typeSymbol is INamedTypeSymbol namedTypeSymbol) - { - // Check delegate signatures - if (namedTypeSymbol.DelegateInvokeMethod != null) - { - CheckMethod(context, namedTypeSymbol.DelegateInvokeMethod); - } - } - } - - private void CheckMember(SymbolAnalysisContext context, ISymbol symbol) - { - if (IsPrivate(symbol)) - { - return; - } - - switch (symbol) - { - case IFieldSymbol fieldSymbol: - { - CheckType(context, fieldSymbol.Type, fieldSymbol.DeclaringSyntaxReferences); - break; - } - case IPropertySymbol propertySymbol: - { - CheckType(context, propertySymbol.Type, propertySymbol.DeclaringSyntaxReferences); - break; - } - case IMethodSymbol methodSymbol: - { - // Skip compiler generated members that we already explicitly check - switch (methodSymbol.MethodKind) - { - case MethodKind.EventAdd: - case MethodKind.EventRaise: - case MethodKind.EventRemove: - case MethodKind.PropertyGet: - case MethodKind.PropertySet: - case MethodKind.DelegateInvoke: - case MethodKind.Ordinary when methodSymbol.ContainingType.TypeKind == TypeKind.Delegate: - return; - } - - CheckMethod(context, methodSymbol); - break; - } - case IEventSymbol eventSymbol: - CheckType(context, eventSymbol.Type, eventSymbol.DeclaringSyntaxReferences); - break; - } - } - - private void CheckMethod(SymbolAnalysisContext context, IMethodSymbol methodSymbol) - { - if (IsPrivate(methodSymbol)) - { - return; - } - - foreach (var parameter in methodSymbol.Parameters) - { - CheckType(context, parameter.Type, parameter.DeclaringSyntaxReferences); - } - - CheckType(context, methodSymbol.ReturnType, methodSymbol.DeclaringSyntaxReferences); - } - - private static bool IsPrivate(ISymbol symbol) - { - return symbol != null && - (symbol.DeclaredAccessibility == Accessibility.Private || - symbol.DeclaredAccessibility == Accessibility.Internal || - IsInternal(symbol.ContainingNamespace)); - } - - private void CheckAttributes(SymbolAnalysisContext context, ImmutableArray attributes) - { - foreach (var attributeData in attributes) - { - CheckType(context, attributeData.AttributeClass, attributeData.ApplicationSyntaxReference); - } - } - - private void CheckType(SymbolAnalysisContext context, ITypeSymbol symbol, SyntaxReference syntax) - { - var pubternalType = GetPubternalType(symbol); - if (pubternalType != null) - { - ReportPUB0001(context, pubternalType, syntax); - } - } - private void CheckType(SymbolAnalysisContext context, ITypeSymbol symbol, ImmutableArray syntaxReferences) - { - var pubternalType = GetPubternalType(symbol); - if (pubternalType != null) - { - foreach (var syntaxReference in syntaxReferences) - { - ReportPUB0001(context, pubternalType, syntaxReference); - } - } - } - - private static void ReportPUB0001(SymbolAnalysisContext context, ITypeSymbol pubternalType, SyntaxReference syntax) - { - var syntaxNode = syntax.GetSyntax(); - var location = syntaxNode.GetLocation(); - - if (syntaxNode is BaseTypeDeclarationSyntax baseTypeDeclarationSyntax) - { - location = baseTypeDeclarationSyntax.Identifier.GetLocation(); - } - - if (syntaxNode is DelegateDeclarationSyntax delegateDeclarationSyntax) - { - location = delegateDeclarationSyntax.ReturnType.GetLocation(); - } - - if (syntaxNode is BasePropertyDeclarationSyntax propertyDeclaration) - { - location = propertyDeclaration.Type.GetLocation(); - } - - if (syntaxNode is MethodDeclarationSyntax method) - { - location = method.ReturnType.GetLocation(); - } - - if (syntaxNode is VariableDeclaratorSyntax variableDeclarator) - { - if (variableDeclarator.Parent is VariableDeclarationSyntax fieldDeclaration) - { - location = fieldDeclaration.Type.GetLocation(); - } - } - - context.ReportDiagnostic(Diagnostic.Create(PubturnalityDescriptors.PUB0001, location, pubternalType.ToDisplayString())); - } - - private ITypeSymbol GetPubternalType(ITypeSymbol symbol) - { - if (IsInternal(symbol.ContainingNamespace)) - { - return symbol; - } - else - { - if (symbol is INamedTypeSymbol namedTypeSymbol && namedTypeSymbol.IsGenericType) - { - foreach (var argument in namedTypeSymbol.TypeArguments) - { - var argumentSymbol = GetPubternalType(argument); - if (argumentSymbol != null) - { - return argumentSymbol; - } - } - } - } - - return null; - } - - private void AnalyzeTypeUsage(SyntaxNodeAnalysisContext syntaxContext) - { - var identifier = (IdentifierNameSyntax)syntaxContext.Node; - - var symbolInfo = ModelExtensions.GetTypeInfo(syntaxContext.SemanticModel, identifier, syntaxContext.CancellationToken); - if (symbolInfo.Type == null) - { - return; - } - - var type = symbolInfo.Type; - if (!IsInternal(type.ContainingNamespace)) - { - // don't care about non-pubternal type references - return; - } - - if (!syntaxContext.ContainingSymbol.ContainingAssembly.Equals(type.ContainingAssembly)) - { - syntaxContext.ReportDiagnostic(Diagnostic.Create(PubturnalityDescriptors.PUB0002, identifier.GetLocation(), type.ToDisplayString())); - } - } - - private static bool IsInternal(INamespaceSymbol ns) - { - while (ns != null) - { - if (ns.Name == "Internal") - { - return true; - } - - ns = ns.ContainingNamespace; - } - - return false; - } - } -} diff --git a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubturnalityDescriptors.cs b/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubturnalityDescriptors.cs deleted file mode 100644 index 6064ebaf348..00000000000 --- a/src/TestingUtils/Internal.AspNetCore.Analyzers/src/PubturnalityDescriptors.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.CodeAnalysis; - -namespace Internal.AspNetCore.Analyzers -{ - internal class PubturnalityDescriptors - { - public static DiagnosticDescriptor PUB0001 = new DiagnosticDescriptor( - "PUB0001", - "Pubternal type in public API", - "Pubternal type ('{0}') usage in public API", - "Usage", - DiagnosticSeverity.Warning, true); - - public static DiagnosticDescriptor PUB0002 = new DiagnosticDescriptor( - "PUB0002", - "Cross assembly pubternal reference", - "Cross assembly pubternal type ('{0}') reference", - "Usage", - DiagnosticSeverity.Error, false); - } -} diff --git a/src/TestingUtils/Internal.AspNetCore.Analyzers/test/Internal.AspNetCore.Analyzers.Tests.csproj b/src/TestingUtils/Internal.AspNetCore.Analyzers/test/Internal.AspNetCore.Analyzers.Tests.csproj deleted file mode 100644 index 99dcca9dc17..00000000000 --- a/src/TestingUtils/Internal.AspNetCore.Analyzers/test/Internal.AspNetCore.Analyzers.Tests.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net472 - true - - false - - - - - - - - diff --git a/src/TestingUtils/Internal.AspNetCore.Analyzers/test/PubternabilityAnalyzerTests.cs b/src/TestingUtils/Internal.AspNetCore.Analyzers/test/PubternabilityAnalyzerTests.cs deleted file mode 100644 index ebcd5fa1e8c..00000000000 --- a/src/TestingUtils/Internal.AspNetCore.Analyzers/test/PubternabilityAnalyzerTests.cs +++ /dev/null @@ -1,260 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis; -using Microsoft.AspNetCore.Analyzer.Testing; -using Xunit; -using Xunit.Abstractions; - -namespace Internal.AspNetCore.Analyzers.Tests -{ - public class PubternabilityAnalyzerTests : DiagnosticVerifier - { - - private const string InternalDefinitions = @" -namespace A.Internal.Namespace -{ - public class C {} - public delegate C CD (); - public class CAAttribute: System.Attribute {} - - public class Program - { - public static void Main() {} - } -}"; - public PubternabilityAnalyzerTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) - { - } - - [Theory] - [MemberData(nameof(PublicMemberDefinitions))] - public async Task PublicExposureOfPubternalTypeProducesPUB0001(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - public class T - {{ - {member} - }} -}}"); - var diagnostic = Assert.Single(await GetDiagnostics(code.Source)); - Assert.Equal("PUB0001", diagnostic.Id); - AnalyzerAssert.DiagnosticLocation(code.DefaultMarkerLocation, diagnostic.Location); - } - - [Theory] - [MemberData(nameof(PublicMemberWithAllowedDefinitions))] - public async Task PublicExposureOfPubternalMembersSometimesAllowed(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - public class T - {{ - {member} - }} -}}"); - Assert.Empty(await GetDiagnostics(code.Source)); - } - - - [Theory] - [MemberData(nameof(PublicTypeDefinitions))] - public async Task PublicExposureOfPubternalTypeProducesInTypeDefinitionPUB0001(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - {member} -}}"); - var diagnostic = Assert.Single(await GetDiagnostics(code.Source)); - Assert.Equal("PUB0001", diagnostic.Id); - AnalyzerAssert.DiagnosticLocation(code.DefaultMarkerLocation, diagnostic.Location); - } - - [Theory] - [MemberData(nameof(PublicMemberDefinitions))] - public async Task PrivateUsageOfPubternalTypeDoesNotProduce(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - internal class T - {{ - {member} - }} -}}"); - var diagnostics = await GetDiagnostics(code.Source); - Assert.Empty(diagnostics); - } - - [Theory] - [MemberData(nameof(PrivateMemberDefinitions))] - public async Task PrivateUsageOfPubternalTypeDoesNotProduceInPublicClasses(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - public class T - {{ - {member} - }} -}}"); - var diagnostics = await GetDiagnostics(code.Source); - Assert.Empty(diagnostics); - } - - - [Theory] - [MemberData(nameof(PublicTypeWithAllowedDefinitions))] - public async Task PublicExposureOfPubternalTypeSometimesAllowed(string member) - { - var code = GetSourceFromNamespaceDeclaration($@" -namespace A -{{ - {member} -}}"); - var diagnostics = await GetDiagnostics(code.Source); - Assert.Empty(diagnostics); - } - - [Theory] - [MemberData(nameof(PrivateMemberDefinitions))] - [MemberData(nameof(PublicMemberDefinitions))] - public async Task DefinitionOfPubternalCrossAssemblyProducesPUB0002(string member) - { - var code = TestSource.Read($@" -using A.Internal.Namespace; -namespace A -{{ - internal class T - {{ - {member} - }} -}}"); - - var diagnostic = Assert.Single(await GetDiagnosticWithProjectReference(code.Source)); - Assert.Equal("PUB0002", diagnostic.Id); - AnalyzerAssert.DiagnosticLocation(code.DefaultMarkerLocation, diagnostic.Location); - } - - [Theory] - [MemberData(nameof(TypeUsages))] - public async Task UsageOfPubternalCrossAssemblyProducesPUB0002(string usage) - { - var code = TestSource.Read($@" -using A.Internal.Namespace; -namespace A -{{ - public class T - {{ - private void M() - {{ - {usage} - }} - }} -}}"); - var diagnostic = Assert.Single(await GetDiagnosticWithProjectReference(code.Source)); - Assert.Equal("PUB0002", diagnostic.Id); - AnalyzerAssert.DiagnosticLocation(code.DefaultMarkerLocation, diagnostic.Location); - } - - public static IEnumerable PublicMemberDefinitions => - ApplyModifiers(MemberDefinitions, "public", "protected"); - - public static IEnumerable PublicMemberWithAllowedDefinitions => - ApplyModifiers(AllowedMemberDefinitions, "public"); - - public static IEnumerable PublicTypeDefinitions => - ApplyModifiers(TypeDefinitions, "public"); - - public static IEnumerable PublicTypeWithAllowedDefinitions => - ApplyModifiers(AllowedDefinitions, "public"); - - public static IEnumerable PrivateMemberDefinitions => - ApplyModifiers(MemberDefinitions, "private", "internal"); - - public static IEnumerable TypeUsages => - ApplyModifiers(TypeUsageStrings, string.Empty); - - public static string[] MemberDefinitions => new [] - { - "/*MM*/C c;", - "T(/*MM*/C c) {}", - "/*MM*/CD c { get; }", - "event /*MM*/CD c;", - "delegate /*MM*/C WOW();" - }; - - public static string[] TypeDefinitions => new [] - { - "delegate /*MM*/C WOW();", - "class /*MM*/T: P { } public class P {}", - "class /*MM*/T: C {}", - "class T { public class /*MM*/T1: C { } }" - }; - - public static string[] AllowedMemberDefinitions => new [] - { - "T([CA]int c) {}", - "[CA] MOD int f;", - "[CA] MOD int f { get; set; }", - "[CA] MOD class CC { }" - }; - - public static string[] AllowedDefinitions => new [] - { - "class T: I { } interface I {}" - }; - - public static string[] TypeUsageStrings => new [] - { - "/*MM*/var c = new C();", - "/*MM*/CD d = () => null;", - "var t = typeof(/*MM*/CAAttribute);" - }; - - private static IEnumerable ApplyModifiers(string[] code, params string[] mods) - { - foreach (var mod in mods) - { - foreach (var s in code) - { - if (s.Contains("MOD")) - { - yield return new object[] { s.Replace("MOD", mod) }; - } - else - { - yield return new object[] { mod + " " + s }; - } - } - } - } - - private TestSource GetSourceFromNamespaceDeclaration(string namespaceDefinition) - { - return TestSource.Read("using A.Internal.Namespace;" + InternalDefinitions + namespaceDefinition); - } - - private Task GetDiagnosticWithProjectReference(string code) - { - var libraray = CreateProject(InternalDefinitions); - - var mainProject = CreateProject(code).AddProjectReference(new ProjectReference(libraray.Id)); - - return GetDiagnosticsAsync(mainProject.Documents.ToArray(), new PubternalityAnalyzer(), new [] { "PUB0002" }); - } - - private Task GetDiagnostics(string code) - { - return GetDiagnosticsAsync(new[] { code }, new PubternalityAnalyzer(), new [] { "PUB0002" }); - } - } -} diff --git a/src/TestingUtils/Microsoft.AspNetCore.Analyzer.Testing/src/Microsoft.AspNetCore.Analyzer.Testing.csproj b/src/TestingUtils/Microsoft.AspNetCore.Analyzer.Testing/src/Microsoft.AspNetCore.Analyzer.Testing.csproj index bea19007163..2ae5406ec16 100644 --- a/src/TestingUtils/Microsoft.AspNetCore.Analyzer.Testing/src/Microsoft.AspNetCore.Analyzer.Testing.csproj +++ b/src/TestingUtils/Microsoft.AspNetCore.Analyzer.Testing/src/Microsoft.AspNetCore.Analyzer.Testing.csproj @@ -9,7 +9,7 @@ false true - true + false From af363c6d384b6688bcd2a98f3f87a4cc48cf845b Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 7 Apr 2020 00:27:15 -0700 Subject: [PATCH 2/5] Remove reference assemblies and associated logic --- Directory.Build.props | 4 - Directory.Build.targets | 10 +- eng/Versions.props | 8 +- eng/repo.targets | 8 -- eng/scripts/GenerateReferenceAssemblies.ps1 | 9 -- eng/targets/ReferenceAssembly.targets | 99 ------------- eng/targets/ResolveReferences.targets | 27 +--- ...rosoft.Extensions.Caching.SqlServer.csproj | 12 -- ...nsions.Caching.SqlServer.netstandard2.0.cs | 41 ------ ...tensions.Caching.StackExchangeRedis.csproj | 12 -- ...ching.StackExchangeRedis.netstandard2.0.cs | 39 ------ ...nsions.Configuration.NewtonsoftJson.csproj | 12 -- ...iguration.NewtonsoftJson.netstandard2.0.cs | 39 ------ ...rosoft.Extensions.DiagnosticAdapter.csproj | 14 -- ...Extensions.DiagnosticAdapter.netcoreapp.cs | 132 ------------------ ...nsions.DiagnosticAdapter.netstandard2.0.cs | 120 ---------------- ...icrosoft.Extensions.Hosting.Systemd.csproj | 10 -- ...tensions.Hosting.Systemd.netstandard2.1.cs | 46 ------ ....Extensions.Hosting.WindowsServices.csproj | 18 --- ....Hosting.WindowsServices.netstandard2.0.cs | 35 ----- ....Hosting.WindowsServices.netstandard2.1.cs | 35 ----- .../Microsoft.Extensions.Http.Polly.csproj | 12 -- ...ft.Extensions.Http.Polly.netstandard2.0.cs | 41 ------ src/Shared/src/ReferenceAssemblyInfo.cs | 11 -- 24 files changed, 5 insertions(+), 789 deletions(-) delete mode 100644 eng/scripts/GenerateReferenceAssemblies.ps1 delete mode 100644 eng/targets/ReferenceAssembly.targets delete mode 100644 src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.csproj delete mode 100644 src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.netstandard2.0.cs delete mode 100644 src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.csproj delete mode 100644 src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.netstandard2.0.cs delete mode 100644 src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.csproj delete mode 100644 src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.netstandard2.0.cs delete mode 100644 src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.csproj delete mode 100644 src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netcoreapp.cs delete mode 100644 src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netstandard2.0.cs delete mode 100644 src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj delete mode 100644 src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.netstandard2.1.cs delete mode 100644 src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.csproj delete mode 100644 src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.0.cs delete mode 100644 src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.1.cs delete mode 100644 src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.csproj delete mode 100644 src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.netstandard2.0.cs delete mode 100644 src/Shared/src/ReferenceAssemblyInfo.cs diff --git a/Directory.Build.props b/Directory.Build.props index c9d0418f567..ffb694d9f18 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,9 +14,6 @@ true true - false - true - $(MSBuildProjectName)-ref true @@ -73,5 +70,4 @@ - diff --git a/Directory.Build.targets b/Directory.Build.targets index c0d4440fb84..99d4ee21efa 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -29,12 +29,9 @@ - true + true true - - true - false @@ -45,13 +42,8 @@ IsImplicitlyDefined="true" /> - - - - - diff --git a/eng/Versions.props b/eng/Versions.props index aebf1bae253..4c6a4723b88 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -12,13 +12,7 @@ $(MajorVersion).$(MinorVersion).$(PatchVersion) preview 4 - $(VersionPrefix).0 - - $(MajorVersion).$(MinorVersion).0.0 + $(VersionPrefix).0 0.1.$(PatchVersion) - - - @(_ResultTargetFramework) - - @(ProjectListContentItem->'%(Identity)', '%0A') - -]]> - - - - - - - - - - - - <_RefSourceFileTFM>$(TargetFramework) - <_RefSourceFileTFM Condition="$(TargetFramework.StartsWith('netcoreapp'))">netcoreapp - <_RefProjectFileTFM>$(TargetFramework) - <_RefProjectFileTFM Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'">%24(DefaultNetCoreTargetFramework) - - <_RefSourceOutputPath>$([System.IO.Directory]::GetParent('$(MSBuildProjectDirectory)'))/ref/ - <_RefSourceFileName>$(AssemblyName).$(_RefSourceFileTFM).cs - <_RefSourceFileOutputPath>$(_RefSourceOutputPath)$(_RefSourceFileName) - - - - <_ReferenceDirectoriesWithDuplicates Include="@(ReferencePath->'%(RootDir)%(Directory)'->TrimEnd('\'))" /> - <_ReferencePathDirectories Include="%(_ReferenceDirectoriesWithDuplicates.Identity)" /> - - - - <_GenAPICommand Condition="'$(MSBuildRuntimeType)' == 'core'">"$(DotNetTool)" --roll-forward-on-no-candidate-fx 2 "$(_GenAPIPath)" - <_GenAPICmd>$(_GenAPICommand) - <_GenAPICmd>$(_GenAPICmd) "$(TargetPath)" - <_GenAPICmd>$(_GenAPICmd) --lib-path "@(_ReferencePathDirectories)" - <_GenAPICmd>$(_GenAPICmd) --out "$(_RefSourceFileOutputPath)" - <_GenAPICmd>$(_GenAPICmd) --header-file "$(RepoRoot)/eng/LicenseHeader.txt" - <_GenAPICmd>$(_GenAPICmd) --exclude-api-list "$(RepoRoot)/eng/GenAPI.exclusions.txt" - - - - - - - - - - - - - - - @(FilteredOriginalReferences->'', '%0A ') - -]]> - - - - - - - - - \ No newline at end of file diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index a5ef49da852..91153b3d8d2 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -52,14 +52,6 @@ true true false - - - true - false - - - true - false @@ -92,14 +84,10 @@ Exclude="@(_UnusedProjectReferenceProvider)" /> - + false - - true - - @@ -189,11 +177,11 @@ <_ExplicitPackageReference Remove="@(_ExplicitPackageReference)" /> - - @@ -218,20 +206,11 @@ - - $(MSBuildProjectDirectory)/../ref/ - $([MSBuild]::MakeRelative($(RepoRoot), '$(ReferenceAssemblyDirectory)$(MSBuildProjectFile)')) - - - - - $([MSBuild]::ValueOrDefault($(IsAspNetCoreApp),'false')) $([MSBuild]::ValueOrDefault($(IsShippingPackage),'false')) $([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath))) - $(ReferenceAssemblyProjectFileRelativePath) diff --git a/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.csproj b/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.csproj deleted file mode 100644 index 0259e794e1f..00000000000 --- a/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - - - - - - - - diff --git a/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.netstandard2.0.cs b/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.netstandard2.0.cs deleted file mode 100644 index c445811abd6..00000000000 --- a/src/Caching/SqlServer/ref/Microsoft.Extensions.Caching.SqlServer.netstandard2.0.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Caching.SqlServer -{ - public partial class SqlServerCache : Microsoft.Extensions.Caching.Distributed.IDistributedCache - { - public SqlServerCache(Microsoft.Extensions.Options.IOptions options) { } - public byte[] Get(string key) { throw null; } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task GetAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Refresh(string key) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task RefreshAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Remove(string key) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task RemoveAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Set(string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task SetAsync(string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class SqlServerCacheOptions : Microsoft.Extensions.Options.IOptions - { - public SqlServerCacheOptions() { } - public string ConnectionString { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public System.TimeSpan DefaultSlidingExpiration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public System.TimeSpan? ExpiredItemsDeletionInterval { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - Microsoft.Extensions.Caching.SqlServer.SqlServerCacheOptions Microsoft.Extensions.Options.IOptions.Value { get { throw null; } } - public string SchemaName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public Microsoft.Extensions.Internal.ISystemClock SystemClock { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public string TableName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - } -} -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class SqlServerCachingServicesExtensions - { - public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddDistributedSqlServerCache(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action setupAction) { throw null; } - } -} diff --git a/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.csproj b/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.csproj deleted file mode 100644 index 31f974d8e60..00000000000 --- a/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - - - - - - - - diff --git a/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.netstandard2.0.cs b/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.netstandard2.0.cs deleted file mode 100644 index 5de2b8e17d6..00000000000 --- a/src/Caching/StackExchangeRedis/ref/Microsoft.Extensions.Caching.StackExchangeRedis.netstandard2.0.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Caching.StackExchangeRedis -{ - public partial class RedisCache : Microsoft.Extensions.Caching.Distributed.IDistributedCache, System.IDisposable - { - public RedisCache(Microsoft.Extensions.Options.IOptions optionsAccessor) { } - public void Dispose() { } - public byte[] Get(string key) { throw null; } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task GetAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Refresh(string key) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task RefreshAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Remove(string key) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task RemoveAsync(string key, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - public void Set(string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - public System.Threading.Tasks.Task SetAsync(string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options, System.Threading.CancellationToken token = default(System.Threading.CancellationToken)) { throw null; } - } - public partial class RedisCacheOptions : Microsoft.Extensions.Options.IOptions - { - public RedisCacheOptions() { } - public string Configuration { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public StackExchange.Redis.ConfigurationOptions ConfigurationOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - public string InstanceName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - Microsoft.Extensions.Caching.StackExchangeRedis.RedisCacheOptions Microsoft.Extensions.Options.IOptions.Value { get { throw null; } } - } -} -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class StackExchangeRedisCacheServiceCollectionExtensions - { - public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddStackExchangeRedisCache(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action setupAction) { throw null; } - } -} diff --git a/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.csproj b/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.csproj deleted file mode 100644 index 044991b251f..00000000000 --- a/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - - - - - - - - diff --git a/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.netstandard2.0.cs b/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.netstandard2.0.cs deleted file mode 100644 index 35a192a48cc..00000000000 --- a/src/Configuration/Config.NewtonsoftJson/ref/Microsoft.Extensions.Configuration.NewtonsoftJson.netstandard2.0.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Configuration -{ - public static partial class NewtonsoftJsonConfigurationExtensions - { - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, Microsoft.Extensions.FileProviders.IFileProvider provider, string path, bool optional, bool reloadOnChange) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.Action configureSource) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonFile(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, string path, bool optional, bool reloadOnChange) { throw null; } - public static Microsoft.Extensions.Configuration.IConfigurationBuilder AddNewtonsoftJsonStream(this Microsoft.Extensions.Configuration.IConfigurationBuilder builder, System.IO.Stream stream) { throw null; } - } -} -namespace Microsoft.Extensions.Configuration.NewtonsoftJson -{ - public partial class NewtonsoftJsonConfigurationProvider : Microsoft.Extensions.Configuration.FileConfigurationProvider - { - public NewtonsoftJsonConfigurationProvider(Microsoft.Extensions.Configuration.NewtonsoftJson.NewtonsoftJsonConfigurationSource source) : base (default(Microsoft.Extensions.Configuration.FileConfigurationSource)) { } - public override void Load(System.IO.Stream stream) { } - } - public partial class NewtonsoftJsonConfigurationSource : Microsoft.Extensions.Configuration.FileConfigurationSource - { - public NewtonsoftJsonConfigurationSource() { } - public override Microsoft.Extensions.Configuration.IConfigurationProvider Build(Microsoft.Extensions.Configuration.IConfigurationBuilder builder) { throw null; } - } - public partial class NewtonsoftJsonStreamConfigurationProvider : Microsoft.Extensions.Configuration.StreamConfigurationProvider - { - public NewtonsoftJsonStreamConfigurationProvider(Microsoft.Extensions.Configuration.NewtonsoftJson.NewtonsoftJsonStreamConfigurationSource source) : base (default(Microsoft.Extensions.Configuration.StreamConfigurationSource)) { } - public override void Load(System.IO.Stream stream) { } - } - public partial class NewtonsoftJsonStreamConfigurationSource : Microsoft.Extensions.Configuration.StreamConfigurationSource - { - public NewtonsoftJsonStreamConfigurationSource() { } - public override Microsoft.Extensions.Configuration.IConfigurationProvider Build(Microsoft.Extensions.Configuration.IConfigurationBuilder builder) { throw null; } - } -} diff --git a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.csproj b/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.csproj deleted file mode 100644 index 57dd0b0c7de..00000000000 --- a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - netstandard2.0;netcoreapp2.0 - - - - - - - - - - diff --git a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netcoreapp.cs b/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netcoreapp.cs deleted file mode 100644 index 64dc376cf3a..00000000000 --- a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netcoreapp.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DiagnosticAdapter -{ - public partial class DiagnosticNameAttribute : System.Attribute - { - public DiagnosticNameAttribute(string name) { } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - } - public partial class DiagnosticSourceAdapter : System.IObserver> - { - public DiagnosticSourceAdapter(object target) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled, Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter methodAdapter) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled, Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter methodAdapter) { } - public bool IsEnabled(string diagnosticName) { throw null; } - public bool IsEnabled(string diagnosticName, object arg1, object arg2 = null) { throw null; } - void System.IObserver>.OnCompleted() { } - void System.IObserver>.OnError(System.Exception error) { } - void System.IObserver>.OnNext(System.Collections.Generic.KeyValuePair value) { } - public void Write(string diagnosticName, object parameters) { } - } - public partial interface IDiagnosticSourceMethodAdapter - { - System.Func Adapt(System.Reflection.MethodInfo method, System.Type inputType); - } - public partial class ProxyDiagnosticSourceMethodAdapter : Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter - { - public ProxyDiagnosticSourceMethodAdapter() { } - public System.Func Adapt(System.Reflection.MethodInfo method, System.Type inputType) { throw null; } - } -} -namespace Microsoft.Extensions.DiagnosticAdapter.Infrastructure -{ - public partial interface IProxy - { - T Upwrap(); - } - public partial interface IProxyFactory - { - TProxy CreateProxy(object obj); - } -} -namespace Microsoft.Extensions.DiagnosticAdapter.Internal -{ - public partial class InvalidProxyOperationException : System.InvalidOperationException - { - public InvalidProxyOperationException(string message) { } - } - public static partial class ProxyAssembly - { - public static System.Reflection.Emit.TypeBuilder DefineType(string name, System.Reflection.TypeAttributes attributes, System.Type baseType, System.Type[] interfaces) { throw null; } - } - public abstract partial class ProxyBase : Microsoft.Extensions.DiagnosticAdapter.Infrastructure.IProxy - { - public readonly System.Type WrappedType; - protected ProxyBase(System.Type wrappedType) { } - public abstract object UnderlyingInstanceAsObject { get; } - public T Upwrap() { throw null; } - } - public partial class ProxyBase : Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyBase where T : class - { - public readonly T Instance; - public ProxyBase(T instance) : base (default(System.Type)) { } - public T UnderlyingInstance { get { throw null; } } - public override object UnderlyingInstanceAsObject { get { throw null; } } - } - public partial class ProxyEnumerable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public ProxyEnumerable(System.Collections.Generic.IEnumerable source, System.Type proxyType) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public partial class ProxyEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable - { - public ProxyEnumerator(System.Collections.Generic.IEnumerator source, System.Type proxyType) { } - public TTargetElement Current { get { throw null; } } - object System.Collections.IEnumerator.Current { get { throw null; } } - public void Dispose() { } - public bool MoveNext() { throw null; } - public void Reset() { } - } - } - public partial class ProxyFactory : Microsoft.Extensions.DiagnosticAdapter.Infrastructure.IProxyFactory - { - public ProxyFactory() { } - public TProxy CreateProxy(object obj) { throw null; } - } - public partial class ProxyList : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable - { - public ProxyList(System.Collections.Generic.IList source) { } - protected ProxyList(System.Collections.Generic.IList source, System.Type proxyType) { } - public int Count { get { throw null; } } - public TTargetElement this[int index] { get { throw null; } } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public static partial class ProxyMethodEmitter - { - public static System.Func CreateProxyMethod(System.Reflection.MethodInfo method, System.Type inputType) { throw null; } - } - public partial class ProxyTypeCache : System.Collections.Concurrent.ConcurrentDictionary, Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult> - { - public ProxyTypeCache() { } - } - public partial class ProxyTypeCacheResult - { - public ProxyTypeCacheResult() { } - public System.Reflection.ConstructorInfo Constructor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public string Error { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public bool IsError { get { throw null; } } - public System.Tuple Key { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public System.Type Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public static Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult FromError(System.Tuple key, string error) { throw null; } - public static Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult FromType(System.Tuple key, System.Type type, System.Reflection.ConstructorInfo constructor) { throw null; } - } - public static partial class ProxyTypeEmitter - { - public static System.Type GetProxyType(Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCache cache, System.Type targetType, System.Type sourceType) { throw null; } - } -} -namespace System.Diagnostics -{ - public static partial class DiagnosticListenerExtensions - { - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target) { throw null; } - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target, System.Func isEnabled) { throw null; } - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target, System.Func isEnabled) { throw null; } - } -} diff --git a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netstandard2.0.cs b/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netstandard2.0.cs deleted file mode 100644 index a01011d5631..00000000000 --- a/src/DiagnosticAdapter/ref/Microsoft.Extensions.DiagnosticAdapter.netstandard2.0.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DiagnosticAdapter -{ - public partial class DiagnosticNameAttribute : System.Attribute - { - public DiagnosticNameAttribute(string name) { } - public string Name { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - } - public partial class DiagnosticSourceAdapter : System.IObserver> - { - public DiagnosticSourceAdapter(object target) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled, Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter methodAdapter) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled) { } - public DiagnosticSourceAdapter(object target, System.Func isEnabled, Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter methodAdapter) { } - public bool IsEnabled(string diagnosticName) { throw null; } - public bool IsEnabled(string diagnosticName, object arg1, object arg2 = null) { throw null; } - void System.IObserver>.OnCompleted() { } - void System.IObserver>.OnError(System.Exception error) { } - void System.IObserver>.OnNext(System.Collections.Generic.KeyValuePair value) { } - public void Write(string diagnosticName, object parameters) { } - } - public partial interface IDiagnosticSourceMethodAdapter - { - System.Func Adapt(System.Reflection.MethodInfo method, System.Type inputType); - } - public partial class ProxyDiagnosticSourceMethodAdapter : Microsoft.Extensions.DiagnosticAdapter.IDiagnosticSourceMethodAdapter - { - public ProxyDiagnosticSourceMethodAdapter() { } - public System.Func Adapt(System.Reflection.MethodInfo method, System.Type inputType) { throw null; } - } -} -namespace Microsoft.Extensions.DiagnosticAdapter.Infrastructure -{ - public partial interface IProxy - { - T Upwrap(); - } - public partial interface IProxyFactory - { - TProxy CreateProxy(object obj); - } -} -namespace Microsoft.Extensions.DiagnosticAdapter.Internal -{ - public partial class InvalidProxyOperationException : System.InvalidOperationException - { - public InvalidProxyOperationException(string message) { } - } - public abstract partial class ProxyBase : Microsoft.Extensions.DiagnosticAdapter.Infrastructure.IProxy - { - public readonly System.Type WrappedType; - protected ProxyBase(System.Type wrappedType) { } - public abstract object UnderlyingInstanceAsObject { get; } - public T Upwrap() { throw null; } - } - public partial class ProxyBase : Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyBase where T : class - { - public readonly T Instance; - public ProxyBase(T instance) : base (default(System.Type)) { } - public T UnderlyingInstance { get { throw null; } } - public override object UnderlyingInstanceAsObject { get { throw null; } } - } - public partial class ProxyEnumerable : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - public ProxyEnumerable(System.Collections.Generic.IEnumerable source, System.Type proxyType) { } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - public partial class ProxyEnumerator : System.Collections.Generic.IEnumerator, System.Collections.IEnumerator, System.IDisposable - { - public ProxyEnumerator(System.Collections.Generic.IEnumerator source, System.Type proxyType) { } - public TTargetElement Current { get { throw null; } } - object System.Collections.IEnumerator.Current { get { throw null; } } - public void Dispose() { } - public bool MoveNext() { throw null; } - public void Reset() { } - } - } - public partial class ProxyFactory : Microsoft.Extensions.DiagnosticAdapter.Infrastructure.IProxyFactory - { - public ProxyFactory() { } - public TProxy CreateProxy(object obj) { throw null; } - } - public partial class ProxyList : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.IEnumerable - { - public ProxyList(System.Collections.Generic.IList source) { } - protected ProxyList(System.Collections.Generic.IList source, System.Type proxyType) { } - public int Count { get { throw null; } } - public TTargetElement this[int index] { get { throw null; } } - public System.Collections.Generic.IEnumerator GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class ProxyTypeCache : System.Collections.Concurrent.ConcurrentDictionary, Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult> - { - public ProxyTypeCache() { } - } - public partial class ProxyTypeCacheResult - { - public ProxyTypeCacheResult() { } - public System.Reflection.ConstructorInfo Constructor { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public string Error { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public bool IsError { get { throw null; } } - public System.Tuple Key { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public System.Type Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } } - public static Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult FromError(System.Tuple key, string error) { throw null; } - public static Microsoft.Extensions.DiagnosticAdapter.Internal.ProxyTypeCacheResult FromType(System.Tuple key, System.Type type, System.Reflection.ConstructorInfo constructor) { throw null; } - } -} -namespace System.Diagnostics -{ - public static partial class DiagnosticListenerExtensions - { - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target) { throw null; } - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target, System.Func isEnabled) { throw null; } - public static System.IDisposable SubscribeWithAdapter(this System.Diagnostics.DiagnosticListener diagnostic, object target, System.Func isEnabled) { throw null; } - } -} diff --git a/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj b/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj deleted file mode 100644 index 798cfdcc1d9..00000000000 --- a/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - netstandard2.1 - - - - - - diff --git a/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.netstandard2.1.cs b/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.netstandard2.1.cs deleted file mode 100644 index 958fbce10dc..00000000000 --- a/src/Hosting/Systemd/ref/Microsoft.Extensions.Hosting.Systemd.netstandard2.1.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Hosting -{ - public static partial class SystemdHostBuilderExtensions - { - public static Microsoft.Extensions.Hosting.IHostBuilder UseSystemd(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder) { throw null; } - } -} -namespace Microsoft.Extensions.Hosting.Systemd -{ - public partial interface ISystemdNotifier - { - bool IsEnabled { get; } - void Notify(Microsoft.Extensions.Hosting.Systemd.ServiceState state); - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public partial struct ServiceState - { - private object _dummy; - private int _dummyPrimitive; - public static readonly Microsoft.Extensions.Hosting.Systemd.ServiceState Ready; - public static readonly Microsoft.Extensions.Hosting.Systemd.ServiceState Stopping; - public ServiceState(string state) { throw null; } - public override string ToString() { throw null; } - } - public static partial class SystemdHelpers - { - public static bool IsSystemdService() { throw null; } - } - public partial class SystemdLifetime : Microsoft.Extensions.Hosting.IHostLifetime, System.IDisposable - { - public SystemdLifetime(Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Hosting.Systemd.ISystemdNotifier systemdNotifier, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory) { } - public void Dispose() { } - public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - } - public partial class SystemdNotifier : Microsoft.Extensions.Hosting.Systemd.ISystemdNotifier - { - public SystemdNotifier() { } - public bool IsEnabled { get { throw null; } } - public void Notify(Microsoft.Extensions.Hosting.Systemd.ServiceState state) { } - } -} diff --git a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.csproj b/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.csproj deleted file mode 100644 index 2d582b402f8..00000000000 --- a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - netstandard2.0;netstandard2.1 - - - - - - - - - - - - - - diff --git a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.0.cs b/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.0.cs deleted file mode 100644 index c5d244f7b18..00000000000 --- a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.0.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Hosting -{ - public static partial class WindowsServiceLifetimeHostBuilderExtensions - { - public static Microsoft.Extensions.Hosting.IHostBuilder UseWindowsService(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder) { throw null; } - public static Microsoft.Extensions.Hosting.IHostBuilder UseWindowsService(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configure) { throw null; } - } - public partial class WindowsServiceLifetimeOptions - { - public WindowsServiceLifetimeOptions() { } - public string ServiceName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - } -} -namespace Microsoft.Extensions.Hosting.WindowsServices -{ - public static partial class WindowsServiceHelpers - { - public static bool IsWindowsService() { throw null; } - } - public partial class WindowsServiceLifetime : System.ServiceProcess.ServiceBase, Microsoft.Extensions.Hosting.IHostLifetime - { - public WindowsServiceLifetime(Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptions optionsAccessor) { } - public WindowsServiceLifetime(Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptions optionsAccessor, Microsoft.Extensions.Options.IOptions windowsServiceOptionsAccessor) { } - protected override void Dispose(bool disposing) { } - protected override void OnShutdown() { } - protected override void OnStart(string[] args) { } - protected override void OnStop() { } - public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - } -} diff --git a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.1.cs b/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.1.cs deleted file mode 100644 index c5d244f7b18..00000000000 --- a/src/Hosting/WindowsServices/ref/Microsoft.Extensions.Hosting.WindowsServices.netstandard2.1.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.Hosting -{ - public static partial class WindowsServiceLifetimeHostBuilderExtensions - { - public static Microsoft.Extensions.Hosting.IHostBuilder UseWindowsService(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder) { throw null; } - public static Microsoft.Extensions.Hosting.IHostBuilder UseWindowsService(this Microsoft.Extensions.Hosting.IHostBuilder hostBuilder, System.Action configure) { throw null; } - } - public partial class WindowsServiceLifetimeOptions - { - public WindowsServiceLifetimeOptions() { } - public string ServiceName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } } - } -} -namespace Microsoft.Extensions.Hosting.WindowsServices -{ - public static partial class WindowsServiceHelpers - { - public static bool IsWindowsService() { throw null; } - } - public partial class WindowsServiceLifetime : System.ServiceProcess.ServiceBase, Microsoft.Extensions.Hosting.IHostLifetime - { - public WindowsServiceLifetime(Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptions optionsAccessor) { } - public WindowsServiceLifetime(Microsoft.Extensions.Hosting.IHostEnvironment environment, Microsoft.Extensions.Hosting.IHostApplicationLifetime applicationLifetime, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.Extensions.Options.IOptions optionsAccessor, Microsoft.Extensions.Options.IOptions windowsServiceOptionsAccessor) { } - protected override void Dispose(bool disposing) { } - protected override void OnShutdown() { } - protected override void OnStart(string[] args) { } - protected override void OnStop() { } - public System.Threading.Tasks.Task StopAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - public System.Threading.Tasks.Task WaitForStartAsync(System.Threading.CancellationToken cancellationToken) { throw null; } - } -} diff --git a/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.csproj b/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.csproj deleted file mode 100644 index c9ae0be226c..00000000000 --- a/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - - - - - - - - diff --git a/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.netstandard2.0.cs b/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.netstandard2.0.cs deleted file mode 100644 index 496dce709b9..00000000000 --- a/src/HttpClientFactory/Polly/ref/Microsoft.Extensions.Http.Polly.netstandard2.0.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.Extensions.DependencyInjection -{ - public static partial class PollyHttpClientBuilderExtensions - { - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, Polly.IAsyncPolicy policy) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Func> policySelector) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Func> policyFactory, System.Func keySelector) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandler(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Func> policySelector) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Func, System.Net.Http.HttpRequestMessage, Polly.IAsyncPolicy> policySelector) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddPolicyHandlerFromRegistry(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, string policyKey) { throw null; } - public static Microsoft.Extensions.DependencyInjection.IHttpClientBuilder AddTransientHttpErrorPolicy(this Microsoft.Extensions.DependencyInjection.IHttpClientBuilder builder, System.Func, Polly.IAsyncPolicy> configurePolicy) { throw null; } - } - public static partial class PollyServiceCollectionExtensions - { - public static Polly.Registry.IPolicyRegistry AddPolicyRegistry(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { throw null; } - public static Polly.Registry.IPolicyRegistry AddPolicyRegistry(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Polly.Registry.IPolicyRegistry registry) { throw null; } - } -} -namespace Microsoft.Extensions.Http -{ - public partial class PolicyHttpMessageHandler : System.Net.Http.DelegatingHandler - { - public PolicyHttpMessageHandler(Polly.IAsyncPolicy policy) { } - public PolicyHttpMessageHandler(System.Func> policySelector) { } - [System.Diagnostics.DebuggerStepThroughAttribute] - protected override System.Threading.Tasks.Task SendAsync(System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { throw null; } - protected virtual System.Threading.Tasks.Task SendCoreAsync(System.Net.Http.HttpRequestMessage request, Polly.Context context, System.Threading.CancellationToken cancellationToken) { throw null; } - } -} -namespace Polly -{ - public static partial class HttpRequestMessageExtensions - { - public static Polly.Context GetPolicyExecutionContext(this System.Net.Http.HttpRequestMessage request) { throw null; } - public static void SetPolicyExecutionContext(this System.Net.Http.HttpRequestMessage request, Polly.Context context) { } - } -} diff --git a/src/Shared/src/ReferenceAssemblyInfo.cs b/src/Shared/src/ReferenceAssemblyInfo.cs deleted file mode 100644 index 360ef465e60..00000000000 --- a/src/Shared/src/ReferenceAssemblyInfo.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// Reference assemblies should have the ReferenceAssemblyAttribute. -[assembly:System.Runtime.CompilerServices.ReferenceAssembly] - -// Reference assemblies should have the 0x70 flag which prevents them from loading. -// This flag sets AssemblyName.ProcessorArchitecture to None. There is no public API for this. -// Cref https://github.com/dotnet/coreclr/blob/64ca544ecf55490675e72b853e98ebc8cc75a4fe/src/System.Private.CoreLib/src/System/Reflection/AssemblyName.CoreCLR.cs#L74 -[assembly:System.Reflection.AssemblyFlags((System.Reflection.AssemblyNameFlags)0x70)] From 10d2ec43cbc5bae0c7b5df2b5c484dcb65891e52 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 7 Apr 2020 00:30:54 -0700 Subject: [PATCH 3/5] Cleanup slns and projects --- Extensions.sln | 200 ------------------------------------ eng/ProjectReferences.props | 18 ++-- src/Logging/Logging.sln | 49 --------- 3 files changed, 8 insertions(+), 259 deletions(-) diff --git a/Extensions.sln b/Extensions.sln index aee412cc3d3..b12b21c534c 100644 --- a/Extensions.sln +++ b/Extensions.sln @@ -15,20 +15,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Source EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestingUtils", "TestingUtils", "{3DBE2341-7244-4095-A60C-A0AF7E187C9B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Internal.AspNetCore.Analyzers", "src\TestingUtils\Internal.AspNetCore.Analyzers\src\Internal.AspNetCore.Analyzers.csproj", "{62EF7870-CA1F-4815-BC80-8477D358A16C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Internal.AspNetCore.Analyzers.Tests", "src\TestingUtils\Internal.AspNetCore.Analyzers\test\Internal.AspNetCore.Analyzers.Tests.csproj", "{9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Analyzer.Testing", "src\TestingUtils\Microsoft.AspNetCore.Analyzer.Testing\src\Microsoft.AspNetCore.Analyzer.Testing.csproj", "{1C16FAC7-9658-4E51-BFB0-0C0370851682}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Testing", "src\TestingUtils\Microsoft.AspNetCore.Testing\src\Microsoft.AspNetCore.Testing.csproj", "{418FC05F-E652-4D52-BEF5-EDC1C58F7EF1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Testing.Tests", "src\TestingUtils\Microsoft.AspNetCore.Testing\test\Microsoft.AspNetCore.Testing.Tests.csproj", "{22258F62-7F60-40AE-8BD8-5743EC212181}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DependencyInjection", "DependencyInjection", "{3924E1C4-745C-4127-95A5-38456A2BB4EB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.DependencyInjection.Specification.Tests", "src\DependencyInjection\DI.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj", "{49BA92B1-8721-4587-9D5B-A6A375855180}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Configuration", "Configuration", "{0ACE94D2-2AA1-4067-BAE1-5F9D2544FD3C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Logging", "Logging", "{36DFDB12-6055-43D9-8027-B052667AD34F}" @@ -37,12 +29,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Loggin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Analyzer.Tests", "src\Logging\Logging.Analyzers\test\Microsoft.Extensions.Logging.Analyzer.Tests.csproj", "{938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.AzureAppServices", "src\Logging\Logging.AzureAppServices\src\Microsoft.Extensions.Logging.AzureAppServices.csproj", "{91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.AzureAppServices.Tests", "src\Logging\Logging.AzureAppServices\test\Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj", "{92B4C424-DA96-464E-B9DA-4D3ECB4176ED}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Testing", "src\Logging\Logging.Testing\src\Microsoft.Extensions.Logging.Testing.csproj", "{BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{26D1BCE2-F638-4984-993D-6BF781E0C652}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "src\Logging\samples\SampleApp\SampleApp.csproj", "{4904B307-625D-4E3B-B156-A833583ABAF1}" @@ -91,26 +77,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericHostSample", "src\Ho EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleMsmqHost", "src\Hosting\samples\SampleMsmqHost\SampleMsmqHost.csproj", "{1A203DA9-D706-4094-B549-2611C6DA38F4}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildWebHostInvalidSignature", "src\Shared\testassets\BuildWebHostInvalidSignature\BuildWebHostInvalidSignature.csproj", "{A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BuildWebHostPatternTestSite", "src\Shared\testassets\BuildWebHostPatternTestSite\BuildWebHostPatternTestSite.csproj", "{46EE8C21-DC4A-4BD6-B4D6-1919EA720396}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateHostBuilderInvalidSignature", "src\Shared\testassets\CreateHostBuilderInvalidSignature\CreateHostBuilderInvalidSignature.csproj", "{BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateHostBuilderPatternTestSite", "src\Shared\testassets\CreateHostBuilderPatternTestSite\CreateHostBuilderPatternTestSite.csproj", "{7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateWebHostBuilderInvalidSignature", "src\Shared\testassets\CreateWebHostBuilderInvalidSignature\CreateWebHostBuilderInvalidSignature.csproj", "{8B5184A7-74FC-4966-B68D-ABF65474B355}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CreateWebHostBuilderPatternTestSite", "src\Shared\testassets\CreateWebHostBuilderPatternTestSite\CreateWebHostBuilderPatternTestSite.csproj", "{45512470-32BC-4AAF-BBF2-4457F03319E2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MockHostTypes", "src\Shared\testassets\MockHostTypes\MockHostTypes.csproj", "{71F6D695-8165-4654-BE94-DA8DC0799F8E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaselineGenerator", "eng\tools\BaselineGenerator\BaselineGenerator.csproj", "{DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{B0D89499-D1FA-4113-88C7-B82AB1D98EB6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "testassets", "testassets", "{15AC3300-D335-4C5C-9E3A-22F26904AB26}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting.Systemd", "src\Hosting\Systemd\src\Microsoft.Extensions.Hosting.Systemd.csproj", "{86C50991-634A-41BB-86EE-22B09A3EAD2D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting.Systemd.Tests", "src\Hosting\Systemd\test\Microsoft.Extensions.Hosting.Systemd.Tests.csproj", "{C85BC039-863D-4577-AECF-681A8ACA601A}" @@ -169,30 +139,6 @@ Global {33E57F0C-3CDB-4EB8-B6BE-6A0875B42EDE}.Release|x64.Build.0 = Release|Any CPU {33E57F0C-3CDB-4EB8-B6BE-6A0875B42EDE}.Release|x86.ActiveCfg = Release|Any CPU {33E57F0C-3CDB-4EB8-B6BE-6A0875B42EDE}.Release|x86.Build.0 = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|x64.ActiveCfg = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|x64.Build.0 = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|x86.ActiveCfg = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Debug|x86.Build.0 = Debug|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|Any CPU.Build.0 = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|x64.ActiveCfg = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|x64.Build.0 = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|x86.ActiveCfg = Release|Any CPU - {62EF7870-CA1F-4815-BC80-8477D358A16C}.Release|x86.Build.0 = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|x64.ActiveCfg = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|x64.Build.0 = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|x86.ActiveCfg = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Debug|x86.Build.0 = Debug|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|Any CPU.Build.0 = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|x64.ActiveCfg = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|x64.Build.0 = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|x86.ActiveCfg = Release|Any CPU - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A}.Release|x86.Build.0 = Release|Any CPU {1C16FAC7-9658-4E51-BFB0-0C0370851682}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1C16FAC7-9658-4E51-BFB0-0C0370851682}.Debug|Any CPU.Build.0 = Debug|Any CPU {1C16FAC7-9658-4E51-BFB0-0C0370851682}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -229,18 +175,6 @@ Global {22258F62-7F60-40AE-8BD8-5743EC212181}.Release|x64.Build.0 = Release|Any CPU {22258F62-7F60-40AE-8BD8-5743EC212181}.Release|x86.ActiveCfg = Release|Any CPU {22258F62-7F60-40AE-8BD8-5743EC212181}.Release|x86.Build.0 = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|Any CPU.Build.0 = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|x64.ActiveCfg = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|x64.Build.0 = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|x86.ActiveCfg = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Debug|x86.Build.0 = Debug|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|Any CPU.ActiveCfg = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|Any CPU.Build.0 = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|x64.ActiveCfg = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|x64.Build.0 = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|x86.ActiveCfg = Release|Any CPU - {49BA92B1-8721-4587-9D5B-A6A375855180}.Release|x86.Build.0 = Release|Any CPU {41DF3B4F-9E3C-4D4B-A824-FC5B2094A1C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {41DF3B4F-9E3C-4D4B-A824-FC5B2094A1C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {41DF3B4F-9E3C-4D4B-A824-FC5B2094A1C8}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -265,42 +199,6 @@ Global {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x64.Build.0 = Release|Any CPU {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x86.ActiveCfg = Release|Any CPU {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x86.Build.0 = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|x64.ActiveCfg = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|x64.Build.0 = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|x86.ActiveCfg = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Debug|x86.Build.0 = Debug|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|Any CPU.Build.0 = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|x64.ActiveCfg = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|x64.Build.0 = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|x86.ActiveCfg = Release|Any CPU - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB}.Release|x86.Build.0 = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|x64.ActiveCfg = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|x64.Build.0 = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|x86.ActiveCfg = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Debug|x86.Build.0 = Debug|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|Any CPU.Build.0 = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|x64.ActiveCfg = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|x64.Build.0 = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|x86.ActiveCfg = Release|Any CPU - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED}.Release|x86.Build.0 = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|x64.ActiveCfg = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|x64.Build.0 = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|x86.ActiveCfg = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Debug|x86.Build.0 = Debug|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|Any CPU.Build.0 = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|x64.ActiveCfg = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|x64.Build.0 = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|x86.ActiveCfg = Release|Any CPU - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063}.Release|x86.Build.0 = Release|Any CPU {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|Any CPU.Build.0 = Debug|Any CPU {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -505,90 +403,6 @@ Global {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x64.Build.0 = Release|Any CPU {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x86.ActiveCfg = Release|Any CPU {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x86.Build.0 = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|x64.ActiveCfg = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|x64.Build.0 = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|x86.ActiveCfg = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Debug|x86.Build.0 = Debug|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|Any CPU.Build.0 = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|x64.ActiveCfg = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|x64.Build.0 = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|x86.ActiveCfg = Release|Any CPU - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D}.Release|x86.Build.0 = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|Any CPU.Build.0 = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|x64.ActiveCfg = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|x64.Build.0 = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|x86.ActiveCfg = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Debug|x86.Build.0 = Debug|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|Any CPU.ActiveCfg = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|Any CPU.Build.0 = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|x64.ActiveCfg = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|x64.Build.0 = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|x86.ActiveCfg = Release|Any CPU - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396}.Release|x86.Build.0 = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|x64.ActiveCfg = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|x64.Build.0 = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Debug|x86.Build.0 = Debug|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|Any CPU.Build.0 = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|x64.ActiveCfg = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|x64.Build.0 = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|x86.ActiveCfg = Release|Any CPU - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA}.Release|x86.Build.0 = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|x64.ActiveCfg = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|x64.Build.0 = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|x86.ActiveCfg = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Debug|x86.Build.0 = Debug|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|Any CPU.Build.0 = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|x64.ActiveCfg = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|x64.Build.0 = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|x86.ActiveCfg = Release|Any CPU - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C}.Release|x86.Build.0 = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|x64.ActiveCfg = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|x64.Build.0 = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|x86.ActiveCfg = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Debug|x86.Build.0 = Debug|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|Any CPU.Build.0 = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|x64.ActiveCfg = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|x64.Build.0 = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|x86.ActiveCfg = Release|Any CPU - {8B5184A7-74FC-4966-B68D-ABF65474B355}.Release|x86.Build.0 = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|x64.ActiveCfg = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|x64.Build.0 = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|x86.ActiveCfg = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Debug|x86.Build.0 = Debug|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|Any CPU.Build.0 = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|x64.ActiveCfg = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|x64.Build.0 = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|x86.ActiveCfg = Release|Any CPU - {45512470-32BC-4AAF-BBF2-4457F03319E2}.Release|x86.Build.0 = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|x64.ActiveCfg = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|x64.Build.0 = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|x86.ActiveCfg = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Debug|x86.Build.0 = Debug|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|Any CPU.Build.0 = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|x64.ActiveCfg = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|x64.Build.0 = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|x86.ActiveCfg = Release|Any CPU - {71F6D695-8165-4654-BE94-DA8DC0799F8E}.Release|x86.Build.0 = Release|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -681,17 +495,11 @@ Global {EB6915B4-60EC-458F-B5E1-D896AB13363F} = {13B8928D-1FE1-4B9D-8B2C-E3248612052B} {FD3FE2BE-7DB4-4A12-AE3F-68476749A514} = {13B8928D-1FE1-4B9D-8B2C-E3248612052B} {33E57F0C-3CDB-4EB8-B6BE-6A0875B42EDE} = {36617B81-CF74-4FCB-A7CA-E95DF3CA92FC} - {62EF7870-CA1F-4815-BC80-8477D358A16C} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} - {9D0EDBEC-22F9-4C3C-9349-B5888F709B6A} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} {1C16FAC7-9658-4E51-BFB0-0C0370851682} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} {418FC05F-E652-4D52-BEF5-EDC1C58F7EF1} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} {22258F62-7F60-40AE-8BD8-5743EC212181} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} - {49BA92B1-8721-4587-9D5B-A6A375855180} = {3924E1C4-745C-4127-95A5-38456A2BB4EB} {41DF3B4F-9E3C-4D4B-A824-FC5B2094A1C8} = {36DFDB12-6055-43D9-8027-B052667AD34F} {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1} = {36DFDB12-6055-43D9-8027-B052667AD34F} - {91CC7F32-CEA6-4039-94EE-B1000DBE0DBB} = {36DFDB12-6055-43D9-8027-B052667AD34F} - {92B4C424-DA96-464E-B9DA-4D3ECB4176ED} = {36DFDB12-6055-43D9-8027-B052667AD34F} - {BEA4DCA4-E98A-4CFA-BFF3-C9F887CDB063} = {36DFDB12-6055-43D9-8027-B052667AD34F} {26D1BCE2-F638-4984-993D-6BF781E0C652} = {36DFDB12-6055-43D9-8027-B052667AD34F} {4904B307-625D-4E3B-B156-A833583ABAF1} = {26D1BCE2-F638-4984-993D-6BF781E0C652} {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} @@ -713,15 +521,7 @@ Global {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} = {6868A014-43FD-4047-B536-30D5D159D9D4} {97AE13C4-B72C-4E30-8835-FF1603A9E224} = {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} {1A203DA9-D706-4094-B549-2611C6DA38F4} = {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} - {A73FD5A1-DA46-432A-9824-BA5FC56C2D3D} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {46EE8C21-DC4A-4BD6-B4D6-1919EA720396} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {BAF702CC-5BD2-4CD1-A16D-B899AA86B6AA} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {7BA970A0-FDEC-44C7-AB6E-3C1A0F22BA5C} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {8B5184A7-74FC-4966-B68D-ABF65474B355} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {45512470-32BC-4AAF-BBF2-4457F03319E2} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} - {71F6D695-8165-4654-BE94-DA8DC0799F8E} = {15AC3300-D335-4C5C-9E3A-22F26904AB26} {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A} = {B0D89499-D1FA-4113-88C7-B82AB1D98EB6} - {15AC3300-D335-4C5C-9E3A-22F26904AB26} = {36617B81-CF74-4FCB-A7CA-E95DF3CA92FC} {86C50991-634A-41BB-86EE-22B09A3EAD2D} = {6868A014-43FD-4047-B536-30D5D159D9D4} {C85BC039-863D-4577-AECF-681A8ACA601A} = {6868A014-43FD-4047-B536-30D5D159D9D4} {452F9F79-40E8-4B1C-8857-404062886080} = {6868A014-43FD-4047-B536-30D5D159D9D4} diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index b826b22cb9d..c25379b554c 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -1,17 +1,15 @@ - + + + + + + + - - - - - - - - - + diff --git a/src/Logging/Logging.sln b/src/Logging/Logging.sln index be57a54204d..2e37e2cc988 100644 --- a/src/Logging/Logging.sln +++ b/src/Logging/Logging.sln @@ -9,16 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Loggin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Analyzer.Tests", "Logging.Analyzers\test\Microsoft.Extensions.Logging.Analyzer.Tests.csproj", "{812B2A56-0550-4D93-9438-11A4088CF4B1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Logging.AzureAppServices", "Logging.AzureAppServices", "{3F871B4D-1FB8-4C8D-ABBB-B56E1F673C60}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.AzureAppServices", "Logging.AzureAppServices\src\Microsoft.Extensions.Logging.AzureAppServices.csproj", "{D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.AzureAppServices.Tests", "Logging.AzureAppServices\test\Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj", "{02F4F160-F036-4A67-AB8F-A869E772B8DA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Logging.Testing", "Logging.Testing", "{C5D6C69C-815D-4258-A482-A5F3297D1316}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Testing", "Logging.Testing\src\Microsoft.Extensions.Logging.Testing.csproj", "{4EC41A5E-44ED-43AD-8912-8ADF69BE675D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{83353E14-BAFC-400F-AF6D-E5C3B24087B1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "samples\SampleApp\SampleApp.csproj", "{09942046-F632-4CD5-8523-5F2C0236EDE0}" @@ -57,42 +47,6 @@ Global {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x64.Build.0 = Release|Any CPU {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x86.ActiveCfg = Release|Any CPU {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x86.Build.0 = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|x64.ActiveCfg = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|x64.Build.0 = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|x86.ActiveCfg = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Debug|x86.Build.0 = Debug|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|Any CPU.Build.0 = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|x64.ActiveCfg = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|x64.Build.0 = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|x86.ActiveCfg = Release|Any CPU - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C}.Release|x86.Build.0 = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|x64.ActiveCfg = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|x64.Build.0 = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|x86.ActiveCfg = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Debug|x86.Build.0 = Debug|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|Any CPU.Build.0 = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|x64.ActiveCfg = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|x64.Build.0 = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|x86.ActiveCfg = Release|Any CPU - {02F4F160-F036-4A67-AB8F-A869E772B8DA}.Release|x86.Build.0 = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|x64.ActiveCfg = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|x64.Build.0 = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|x86.ActiveCfg = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Debug|x86.Build.0 = Debug|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|Any CPU.Build.0 = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|x64.ActiveCfg = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|x64.Build.0 = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|x86.ActiveCfg = Release|Any CPU - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D}.Release|x86.Build.0 = Release|Any CPU {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -112,9 +66,6 @@ Global GlobalSection(NestedProjects) = preSolution {55C59899-8662-4C2C-9919-5EF1064D0F27} = {8CADF521-7074-40F0-8CA9-75ED45718609} {812B2A56-0550-4D93-9438-11A4088CF4B1} = {8CADF521-7074-40F0-8CA9-75ED45718609} - {D7B8BBFC-C880-484F-88B4-A2A9B418EE7C} = {3F871B4D-1FB8-4C8D-ABBB-B56E1F673C60} - {02F4F160-F036-4A67-AB8F-A869E772B8DA} = {3F871B4D-1FB8-4C8D-ABBB-B56E1F673C60} - {4EC41A5E-44ED-43AD-8912-8ADF69BE675D} = {C5D6C69C-815D-4258-A482-A5F3297D1316} {09942046-F632-4CD5-8523-5F2C0236EDE0} = {83353E14-BAFC-400F-AF6D-E5C3B24087B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution From 3a99a49f593bc3a8f5cce5211efe518ab5806091 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 7 Apr 2020 01:21:12 -0700 Subject: [PATCH 4/5] Remove sample --- Extensions.sln | 177 ------------------ .../MemoryCacheConcurencySample.csproj | 12 -- .../MemoryCacheConcurencySample/Program.cs | 107 ----------- .../MemoryCacheFileWatchSample.csproj | 13 -- .../MemoryCacheFileWatchSample/Program.cs | 50 ----- .../WatchedFiles/example.txt | 1 - .../MemoryCacheSample.csproj | 12 -- .../MemoryCacheWeakReferenceExtensions.cs | 33 ---- .../samples/MemoryCacheSample/Program.cs | 118 ------------ .../samples/MemoryCacheSample/WeakToken.cs | 37 ---- .../ProfilingSample/ProfilingSample.csproj | 12 -- .../samples/ProfilingSample/Program.cs | 48 ----- .../samples/RedisCacheSample/Program.cs | 77 -------- .../RedisCacheSample/RedisCacheSample.csproj | 12 -- .../SqlServerCacheConcurencySample/Program.cs | 119 ------------ .../SqlServerCacheConcurencySample.csproj | 19 -- .../config.json | 5 - .../samples/SqlServerCacheSample/Program.cs | 91 --------- .../SqlServerCacheSample.csproj | 18 -- .../samples/SqlServerCacheSample/config.json | 5 - src/Hosting/Hosting.sln | 18 -- .../GenericHostSample.csproj | 16 -- .../samples/GenericHostSample/MyContainer.cs | 10 - .../GenericHostSample/MyContainerFactory.cs | 22 --- .../samples/GenericHostSample/MyServiceA.cs | 38 ---- .../samples/GenericHostSample/MyServiceB.cs | 59 ------ .../ProgramExternallyControlled.cs | 54 ------ .../GenericHostSample/ProgramFullControl.cs | 60 ------ .../GenericHostSample/ProgramHelloWorld.cs | 30 --- .../ProgramNoDisposeHangs.cs | 26 --- .../Properties/launchSettings.json | 10 - .../WindowsServiceControlled.cs | 26 --- .../samples/SampleMsmqHost/MsmqConnection.cs | 84 --------- .../samples/SampleMsmqHost/MsmqOptions.cs | 19 -- .../samples/SampleMsmqHost/MsmqProcessor.cs | 41 ---- .../samples/SampleMsmqHost/MsmqService.cs | 48 ----- src/Hosting/samples/SampleMsmqHost/Program.cs | 90 --------- .../SampleMsmqHost/SampleMsmqHost.csproj | 19 -- .../HttpClientFactorySample.csproj | 17 -- .../HttpClientFactorySample/Program.cs | 144 -------------- src/Logging/Logging.sln | 17 -- .../samples/SampleApp/LoggerExtensions.cs | 39 ---- src/Logging/samples/SampleApp/Program.cs | 88 --------- .../samples/SampleApp/SampleApp.csproj | 24 --- src/Logging/samples/SampleApp/logging.json | 15 -- 45 files changed, 1980 deletions(-) delete mode 100644 src/Caching/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj delete mode 100644 src/Caching/samples/MemoryCacheConcurencySample/Program.cs delete mode 100644 src/Caching/samples/MemoryCacheFileWatchSample/MemoryCacheFileWatchSample.csproj delete mode 100644 src/Caching/samples/MemoryCacheFileWatchSample/Program.cs delete mode 100644 src/Caching/samples/MemoryCacheFileWatchSample/WatchedFiles/example.txt delete mode 100644 src/Caching/samples/MemoryCacheSample/MemoryCacheSample.csproj delete mode 100644 src/Caching/samples/MemoryCacheSample/MemoryCacheWeakReferenceExtensions.cs delete mode 100644 src/Caching/samples/MemoryCacheSample/Program.cs delete mode 100644 src/Caching/samples/MemoryCacheSample/WeakToken.cs delete mode 100644 src/Caching/samples/ProfilingSample/ProfilingSample.csproj delete mode 100644 src/Caching/samples/ProfilingSample/Program.cs delete mode 100644 src/Caching/samples/RedisCacheSample/Program.cs delete mode 100644 src/Caching/samples/RedisCacheSample/RedisCacheSample.csproj delete mode 100644 src/Caching/samples/SqlServerCacheConcurencySample/Program.cs delete mode 100644 src/Caching/samples/SqlServerCacheConcurencySample/SqlServerCacheConcurencySample.csproj delete mode 100644 src/Caching/samples/SqlServerCacheConcurencySample/config.json delete mode 100644 src/Caching/samples/SqlServerCacheSample/Program.cs delete mode 100644 src/Caching/samples/SqlServerCacheSample/SqlServerCacheSample.csproj delete mode 100644 src/Caching/samples/SqlServerCacheSample/config.json delete mode 100644 src/Hosting/samples/GenericHostSample/GenericHostSample.csproj delete mode 100644 src/Hosting/samples/GenericHostSample/MyContainer.cs delete mode 100644 src/Hosting/samples/GenericHostSample/MyContainerFactory.cs delete mode 100644 src/Hosting/samples/GenericHostSample/MyServiceA.cs delete mode 100644 src/Hosting/samples/GenericHostSample/MyServiceB.cs delete mode 100644 src/Hosting/samples/GenericHostSample/ProgramExternallyControlled.cs delete mode 100644 src/Hosting/samples/GenericHostSample/ProgramFullControl.cs delete mode 100644 src/Hosting/samples/GenericHostSample/ProgramHelloWorld.cs delete mode 100644 src/Hosting/samples/GenericHostSample/ProgramNoDisposeHangs.cs delete mode 100644 src/Hosting/samples/GenericHostSample/Properties/launchSettings.json delete mode 100644 src/Hosting/samples/GenericHostSample/WindowsServiceControlled.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/MsmqConnection.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/MsmqOptions.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/MsmqProcessor.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/MsmqService.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/Program.cs delete mode 100644 src/Hosting/samples/SampleMsmqHost/SampleMsmqHost.csproj delete mode 100644 src/HttpClientFactory/samples/HttpClientFactorySample/HttpClientFactorySample.csproj delete mode 100644 src/HttpClientFactory/samples/HttpClientFactorySample/Program.cs delete mode 100644 src/Logging/samples/SampleApp/LoggerExtensions.cs delete mode 100644 src/Logging/samples/SampleApp/Program.cs delete mode 100644 src/Logging/samples/SampleApp/SampleApp.csproj delete mode 100644 src/Logging/samples/SampleApp/logging.json diff --git a/Extensions.sln b/Extensions.sln index b12b21c534c..e18596f8ff5 100644 --- a/Extensions.sln +++ b/Extensions.sln @@ -29,28 +29,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Loggin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Analyzer.Tests", "src\Logging\Logging.Analyzers\test\Microsoft.Extensions.Logging.Analyzer.Tests.csproj", "{938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{26D1BCE2-F638-4984-993D-6BF781E0C652}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "src\Logging\samples\SampleApp\SampleApp.csproj", "{4904B307-625D-4E3B-B156-A833583ABAF1}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Caching", "Caching", "{02578551-8E49-4313-938C-E4A7CD1F4A0D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5A8C3C52-0F11-4C76-9B89-B41BBD246EFF}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryCacheConcurencySample", "src\Caching\samples\MemoryCacheConcurencySample\MemoryCacheConcurencySample.csproj", "{A308369B-9F36-4C5F-BADD-3881B8809431}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryCacheFileWatchSample", "src\Caching\samples\MemoryCacheFileWatchSample\MemoryCacheFileWatchSample.csproj", "{7B9E5147-9CB7-46A3-BCD7-C42985776016}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MemoryCacheSample", "src\Caching\samples\MemoryCacheSample\MemoryCacheSample.csproj", "{513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProfilingSample", "src\Caching\samples\ProfilingSample\ProfilingSample.csproj", "{AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RedisCacheSample", "src\Caching\samples\RedisCacheSample\RedisCacheSample.csproj", "{7B10C34A-BE9D-4680-9434-8D08DE090D1C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlServerCacheConcurencySample", "src\Caching\samples\SqlServerCacheConcurencySample\SqlServerCacheConcurencySample.csproj", "{F9F25DB4-E581-4F16-99C2-F3E708020D02}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SqlServerCacheSample", "src\Caching\samples\SqlServerCacheSample\SqlServerCacheSample.csproj", "{EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Caching.SqlServer", "src\Caching\SqlServer\src\Microsoft.Extensions.Caching.SqlServer.csproj", "{45C19036-F1BD-4524-A264-ECDEDE75AF95}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Caching.SqlServer.Tests", "src\Caching\SqlServer\test\Microsoft.Extensions.Caching.SqlServer.Tests.csproj", "{E7E4545D-115F-4928-8EDA-EFB8B93D88FE}" @@ -65,18 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Http.P EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Http.Polly.Tests", "src\HttpClientFactory\Polly\test\Microsoft.Extensions.Http.Polly.Tests.csproj", "{BE74CE89-456C-44E4-9C27-10755372C17D}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{89B8541F-FEC6-4D5E-9557-DD8C566CF536}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpClientFactorySample", "src\HttpClientFactory\samples\HttpClientFactorySample\HttpClientFactorySample.csproj", "{F047546D-EABA-4E60-AAB3-739C7C2407B1}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Hosting", "Hosting", "{6868A014-43FD-4047-B536-30D5D159D9D4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericHostSample", "src\Hosting\samples\GenericHostSample\GenericHostSample.csproj", "{97AE13C4-B72C-4E30-8835-FF1603A9E224}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleMsmqHost", "src\Hosting\samples\SampleMsmqHost\SampleMsmqHost.csproj", "{1A203DA9-D706-4094-B549-2611C6DA38F4}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BaselineGenerator", "eng\tools\BaselineGenerator\BaselineGenerator.csproj", "{DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{B0D89499-D1FA-4113-88C7-B82AB1D98EB6}" @@ -199,102 +169,6 @@ Global {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x64.Build.0 = Release|Any CPU {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x86.ActiveCfg = Release|Any CPU {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1}.Release|x86.Build.0 = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|x64.ActiveCfg = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|x64.Build.0 = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|x86.ActiveCfg = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Debug|x86.Build.0 = Debug|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|Any CPU.Build.0 = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|x64.ActiveCfg = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|x64.Build.0 = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|x86.ActiveCfg = Release|Any CPU - {4904B307-625D-4E3B-B156-A833583ABAF1}.Release|x86.Build.0 = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|x64.ActiveCfg = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|x64.Build.0 = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|x86.ActiveCfg = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Debug|x86.Build.0 = Debug|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|Any CPU.Build.0 = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|x64.ActiveCfg = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|x64.Build.0 = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|x86.ActiveCfg = Release|Any CPU - {A308369B-9F36-4C5F-BADD-3881B8809431}.Release|x86.Build.0 = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|x64.ActiveCfg = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|x64.Build.0 = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|x86.ActiveCfg = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Debug|x86.Build.0 = Debug|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|Any CPU.Build.0 = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|x64.ActiveCfg = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|x64.Build.0 = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|x86.ActiveCfg = Release|Any CPU - {7B9E5147-9CB7-46A3-BCD7-C42985776016}.Release|x86.Build.0 = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|x64.ActiveCfg = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|x64.Build.0 = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|x86.ActiveCfg = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Debug|x86.Build.0 = Debug|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|Any CPU.Build.0 = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|x64.ActiveCfg = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|x64.Build.0 = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|x86.ActiveCfg = Release|Any CPU - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C}.Release|x86.Build.0 = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|x64.ActiveCfg = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|x64.Build.0 = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|x86.ActiveCfg = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Debug|x86.Build.0 = Debug|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|Any CPU.Build.0 = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|x64.ActiveCfg = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|x64.Build.0 = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|x86.ActiveCfg = Release|Any CPU - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32}.Release|x86.Build.0 = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|x64.ActiveCfg = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|x64.Build.0 = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|x86.ActiveCfg = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Debug|x86.Build.0 = Debug|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|Any CPU.Build.0 = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|x64.ActiveCfg = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|x64.Build.0 = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|x86.ActiveCfg = Release|Any CPU - {7B10C34A-BE9D-4680-9434-8D08DE090D1C}.Release|x86.Build.0 = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|x64.ActiveCfg = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|x64.Build.0 = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|x86.ActiveCfg = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Debug|x86.Build.0 = Debug|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|Any CPU.Build.0 = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|x64.ActiveCfg = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|x64.Build.0 = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|x86.ActiveCfg = Release|Any CPU - {F9F25DB4-E581-4F16-99C2-F3E708020D02}.Release|x86.Build.0 = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|x64.ActiveCfg = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|x64.Build.0 = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|x86.ActiveCfg = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Debug|x86.Build.0 = Debug|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|Any CPU.Build.0 = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|x64.ActiveCfg = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|x64.Build.0 = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|x86.ActiveCfg = Release|Any CPU - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F}.Release|x86.Build.0 = Release|Any CPU {45C19036-F1BD-4524-A264-ECDEDE75AF95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {45C19036-F1BD-4524-A264-ECDEDE75AF95}.Debug|Any CPU.Build.0 = Debug|Any CPU {45C19036-F1BD-4524-A264-ECDEDE75AF95}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -367,42 +241,6 @@ Global {BE74CE89-456C-44E4-9C27-10755372C17D}.Release|x64.Build.0 = Release|Any CPU {BE74CE89-456C-44E4-9C27-10755372C17D}.Release|x86.ActiveCfg = Release|Any CPU {BE74CE89-456C-44E4-9C27-10755372C17D}.Release|x86.Build.0 = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|x64.ActiveCfg = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|x64.Build.0 = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|x86.ActiveCfg = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Debug|x86.Build.0 = Debug|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|Any CPU.Build.0 = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|x64.ActiveCfg = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|x64.Build.0 = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|x86.ActiveCfg = Release|Any CPU - {F047546D-EABA-4E60-AAB3-739C7C2407B1}.Release|x86.Build.0 = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|x64.ActiveCfg = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|x64.Build.0 = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|x86.ActiveCfg = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Debug|x86.Build.0 = Debug|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|Any CPU.Build.0 = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|x64.ActiveCfg = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|x64.Build.0 = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|x86.ActiveCfg = Release|Any CPU - {97AE13C4-B72C-4E30-8835-FF1603A9E224}.Release|x86.Build.0 = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|x64.ActiveCfg = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|x64.Build.0 = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|x86.ActiveCfg = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Debug|x86.Build.0 = Debug|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|Any CPU.Build.0 = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x64.ActiveCfg = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x64.Build.0 = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x86.ActiveCfg = Release|Any CPU - {1A203DA9-D706-4094-B549-2611C6DA38F4}.Release|x86.Build.0 = Release|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -500,27 +338,12 @@ Global {22258F62-7F60-40AE-8BD8-5743EC212181} = {3DBE2341-7244-4095-A60C-A0AF7E187C9B} {41DF3B4F-9E3C-4D4B-A824-FC5B2094A1C8} = {36DFDB12-6055-43D9-8027-B052667AD34F} {938990D7-422A-44B2-AA6C-1AE6F4FF2CB1} = {36DFDB12-6055-43D9-8027-B052667AD34F} - {26D1BCE2-F638-4984-993D-6BF781E0C652} = {36DFDB12-6055-43D9-8027-B052667AD34F} - {4904B307-625D-4E3B-B156-A833583ABAF1} = {26D1BCE2-F638-4984-993D-6BF781E0C652} - {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} - {A308369B-9F36-4C5F-BADD-3881B8809431} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {7B9E5147-9CB7-46A3-BCD7-C42985776016} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {513B8AD3-7FB0-4A39-A1C1-7815EDEDCD9C} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {AC725F62-25D5-4BD8-AE8B-3B243AEF0B32} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {7B10C34A-BE9D-4680-9434-8D08DE090D1C} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {F9F25DB4-E581-4F16-99C2-F3E708020D02} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} - {EDE48870-D0E2-4D71-AE6A-EDFB4EB4ED5F} = {5A8C3C52-0F11-4C76-9B89-B41BBD246EFF} {45C19036-F1BD-4524-A264-ECDEDE75AF95} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} {E7E4545D-115F-4928-8EDA-EFB8B93D88FE} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} {3438B2A7-6DF5-4816-89C7-D6537C85A54D} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} {CD082E64-8537-4C8E-82DD-01BDC913B191} = {02578551-8E49-4313-938C-E4A7CD1F4A0D} {5FA185EF-DA0B-449B-8CDC-D56E9B0A178A} = {2930377F-5CDC-4826-A885-B5AE5CAF9EB3} {BE74CE89-456C-44E4-9C27-10755372C17D} = {2930377F-5CDC-4826-A885-B5AE5CAF9EB3} - {89B8541F-FEC6-4D5E-9557-DD8C566CF536} = {2930377F-5CDC-4826-A885-B5AE5CAF9EB3} - {F047546D-EABA-4E60-AAB3-739C7C2407B1} = {89B8541F-FEC6-4D5E-9557-DD8C566CF536} - {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} = {6868A014-43FD-4047-B536-30D5D159D9D4} - {97AE13C4-B72C-4E30-8835-FF1603A9E224} = {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} - {1A203DA9-D706-4094-B549-2611C6DA38F4} = {1E6620AC-11B3-4EB4-9E4B-ED2C6F1674FE} {DE47CB52-3E6F-4A6A-910E-AE118A00CE1A} = {B0D89499-D1FA-4113-88C7-B82AB1D98EB6} {86C50991-634A-41BB-86EE-22B09A3EAD2D} = {6868A014-43FD-4047-B536-30D5D159D9D4} {C85BC039-863D-4577-AECF-681A8ACA601A} = {6868A014-43FD-4047-B536-30D5D159D9D4} diff --git a/src/Caching/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj b/src/Caching/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj deleted file mode 100644 index eba2e7db569..00000000000 --- a/src/Caching/samples/MemoryCacheConcurencySample/MemoryCacheConcurencySample.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - diff --git a/src/Caching/samples/MemoryCacheConcurencySample/Program.cs b/src/Caching/samples/MemoryCacheConcurencySample/Program.cs deleted file mode 100644 index bb3849119ba..00000000000 --- a/src/Caching/samples/MemoryCacheConcurencySample/Program.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Memory; - -namespace MemoryCacheSample -{ - public class Program - { - private const string Key = "MyKey"; - private static readonly Random Random = new Random(); - private static MemoryCacheEntryOptions _cacheEntryOptions; - - public static void Main() - { - _cacheEntryOptions = GetCacheEntryOptions(); - - IMemoryCache cache = new MemoryCache(new MemoryCacheOptions()); - - SetKey(cache, "0"); - - PeriodicallyReadKey(cache, TimeSpan.FromSeconds(1)); - - PeriodicallyRemoveKey(cache, TimeSpan.FromSeconds(11)); - - PeriodicallySetKey(cache, TimeSpan.FromSeconds(13)); - - Console.ReadLine(); - Console.WriteLine("Shutting down"); - } - - private static void SetKey(IMemoryCache cache, string value) - { - Console.WriteLine("Setting: " + value); - cache.Set(Key, value, _cacheEntryOptions); - } - - private static MemoryCacheEntryOptions GetCacheEntryOptions() - { - return new MemoryCacheEntryOptions() - .SetAbsoluteExpiration(TimeSpan.FromSeconds(7)) - .SetSlidingExpiration(TimeSpan.FromSeconds(3)) - .RegisterPostEvictionCallback(AfterEvicted, state: null); - } - - private static void AfterEvicted(object key, object value, EvictionReason reason, object state) - { - Console.WriteLine("Evicted. Value: " + value + ", Reason: " + reason); - } - - private static void PeriodicallySetKey(IMemoryCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - SetKey(cache, "A"); - } - }); - } - - private static void PeriodicallyReadKey(IMemoryCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - if (Random.Next(3) == 0) // 1/3 chance - { - // Allow values to expire due to sliding refresh. - Console.WriteLine("Read skipped, random choice."); - } - else - { - Console.Write("Reading..."); - if (!cache.TryGetValue(Key, out object result)) - { - result = cache.Set(Key, "B", _cacheEntryOptions); - } - Console.WriteLine("Read: " + (result ?? "(null)")); - } - } - }); - } - - private static void PeriodicallyRemoveKey(IMemoryCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - Console.WriteLine("Removing..."); - cache.Remove(Key); - } - }); - } - } -} diff --git a/src/Caching/samples/MemoryCacheFileWatchSample/MemoryCacheFileWatchSample.csproj b/src/Caching/samples/MemoryCacheFileWatchSample/MemoryCacheFileWatchSample.csproj deleted file mode 100644 index bf8385bb31a..00000000000 --- a/src/Caching/samples/MemoryCacheFileWatchSample/MemoryCacheFileWatchSample.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - - diff --git a/src/Caching/samples/MemoryCacheFileWatchSample/Program.cs b/src/Caching/samples/MemoryCacheFileWatchSample/Program.cs deleted file mode 100644 index 4e534135256..00000000000 --- a/src/Caching/samples/MemoryCacheFileWatchSample/Program.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.FileProviders; - -namespace MemoryCacheFileWatchSample -{ - public class Program - { - public static void Main(string[] args) - { - var cache = new MemoryCache(new MemoryCacheOptions()); - var greeting = ""; - var cacheKey = "cache_key"; - var fileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "WatchedFiles")); - - do - { - if (!cache.TryGetValue(cacheKey, out greeting)) - { - using (var streamReader = new StreamReader(fileProvider.GetFileInfo("example.txt").CreateReadStream())) - { - greeting = streamReader.ReadToEnd(); - cache.Set(cacheKey, greeting, new MemoryCacheEntryOptions() - //Telling the cache to depend on the IChangeToken from watching examples.txt - .AddExpirationToken(fileProvider.Watch("example.txt")) - .RegisterPostEvictionCallback( - (echoKey, value, reason, substate) => - { - Console.WriteLine($"{echoKey} : {value} was evicted due to {reason}"); - })); - Console.WriteLine($"{cacheKey} updated from source."); - } - } - else - { - Console.WriteLine($"{cacheKey} retrieved from cache."); - } - - Console.WriteLine(greeting); - Console.WriteLine("Press any key to continue. Press the ESC key to exit"); - } - while (Console.ReadKey(true).Key != ConsoleKey.Escape); - } - } -} diff --git a/src/Caching/samples/MemoryCacheFileWatchSample/WatchedFiles/example.txt b/src/Caching/samples/MemoryCacheFileWatchSample/WatchedFiles/example.txt deleted file mode 100644 index 05eac029fa0..00000000000 --- a/src/Caching/samples/MemoryCacheFileWatchSample/WatchedFiles/example.txt +++ /dev/null @@ -1 +0,0 @@ -Hello World \ No newline at end of file diff --git a/src/Caching/samples/MemoryCacheSample/MemoryCacheSample.csproj b/src/Caching/samples/MemoryCacheSample/MemoryCacheSample.csproj deleted file mode 100644 index eba2e7db569..00000000000 --- a/src/Caching/samples/MemoryCacheSample/MemoryCacheSample.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - diff --git a/src/Caching/samples/MemoryCacheSample/MemoryCacheWeakReferenceExtensions.cs b/src/Caching/samples/MemoryCacheSample/MemoryCacheWeakReferenceExtensions.cs deleted file mode 100644 index abecfc2b552..00000000000 --- a/src/Caching/samples/MemoryCacheSample/MemoryCacheWeakReferenceExtensions.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; - -namespace Microsoft.Extensions.Caching.Memory -{ - public static class MemoryCacheWeakReferenceExtensions - { - public static TItem GetWeak(this IMemoryCache cache, object key) where TItem : class - { - if (cache.TryGetValue>(key, out WeakReference reference)) - { - reference.TryGetTarget(out TItem value); - return value; - } - return null; - } - - public static TItem SetWeak(this IMemoryCache cache, object key, TItem value) where TItem : class - { - using (var entry = cache.CreateEntry(key)) - { - var reference = new WeakReference(value); - entry.AddExpirationToken(new WeakToken(reference)); - entry.Value = reference; - } - - return value; - } - } -} diff --git a/src/Caching/samples/MemoryCacheSample/Program.cs b/src/Caching/samples/MemoryCacheSample/Program.cs deleted file mode 100644 index 6ef78d24de4..00000000000 --- a/src/Caching/samples/MemoryCacheSample/Program.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Primitives; - -namespace MemoryCacheSample -{ - public class Program - { - public static void Main() - { - IMemoryCache cache = new MemoryCache(new MemoryCacheOptions()); - object result; - string key = "Key"; - object newObject = new object(); - object state = new object(); - - // Basic CRUD operations: - - // Create / Overwrite - result = cache.Set(key, newObject); - result = cache.Set(key, new object()); - - // Retrieve, null if not found - result = cache.Get(key); - - // Retrieve - bool found = cache.TryGetValue(key, out result); - - // Store and Get using weak references - result = cache.SetWeak(key, newObject); - result = cache.GetWeak(key); - - // Delete - cache.Remove(key); - - // Cache entry configuration: - - // Stays in the cache as long as possible - result = cache.Set( - key, - new object(), - new MemoryCacheEntryOptions().SetPriority(CacheItemPriority.NeverRemove)); - - // Automatically remove if not accessed in the given time - result = cache.Set( - key, - new object(), - new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(5))); - - // Automatically remove at a certain time - result = cache.Set( - key, - new object(), - new MemoryCacheEntryOptions().SetAbsoluteExpiration(DateTimeOffset.UtcNow.AddDays(2))); - - // Automatically remove at a certain time, which is relative to UTC now - result = cache.Set( - key, - new object(), - new MemoryCacheEntryOptions().SetAbsoluteExpiration(relative: TimeSpan.FromMinutes(10))); - - // Automatically remove if not accessed in the given time - // Automatically remove at a certain time (if it lives that long) - result = cache.Set( - key, - new object(), - new MemoryCacheEntryOptions() - .SetSlidingExpiration(TimeSpan.FromMinutes(5)) - .SetAbsoluteExpiration(DateTimeOffset.UtcNow.AddDays(2))); - - // Callback when evicted - var options = new MemoryCacheEntryOptions() - .RegisterPostEvictionCallback( - (echoKey, value, reason, substate) => - { - Console.WriteLine(echoKey + ": '" + value + "' was evicted due to " + reason); - }); - result = cache.Set(key, new object(), options); - - // Remove on token expiration - var cts = new CancellationTokenSource(); - options = new MemoryCacheEntryOptions() - .AddExpirationToken(new CancellationChangeToken(cts.Token)) - .RegisterPostEvictionCallback( - (echoKey, value, reason, substate) => - { - Console.WriteLine(echoKey + ": '" + value + "' was evicted due to " + reason); - }); - result = cache.Set(key, new object(), options); - - // Fire the token to see the registered callback being invoked - cts.Cancel(); - - // Expire an entry if the dependent entry expires - using (var entry = cache.CreateEntry("key1")) - { - // expire this entry if the entry with key "key2" expires. - entry.Value = "value1"; - cts = new CancellationTokenSource(); - entry.RegisterPostEvictionCallback( - (echoKey, value, reason, substate) => - { - Console.WriteLine(echoKey + ": '" + value + "' was evicted due to " + reason); - }); - - cache.Set("key2", "value2", new CancellationChangeToken(cts.Token)); - } - - // Fire the token to see the registered callback being invoked - cts.Cancel(); - } - } -} diff --git a/src/Caching/samples/MemoryCacheSample/WeakToken.cs b/src/Caching/samples/MemoryCacheSample/WeakToken.cs deleted file mode 100644 index 97201440a29..00000000000 --- a/src/Caching/samples/MemoryCacheSample/WeakToken.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.Primitives; - -namespace Microsoft.Extensions.Caching.Memory -{ - public class WeakToken : IChangeToken where T : class - { - private WeakReference _reference; - - public WeakToken(WeakReference reference) - { - _reference = reference; - } - - public bool ActiveChangeCallbacks - { - get { return false; } - } - - public bool HasChanged - { - get - { - return !_reference.TryGetTarget(out T ignored); - } - } - - public IDisposable RegisterChangeCallback(Action callback, object state) - { - throw new NotSupportedException(); - } - } -} diff --git a/src/Caching/samples/ProfilingSample/ProfilingSample.csproj b/src/Caching/samples/ProfilingSample/ProfilingSample.csproj deleted file mode 100644 index eba2e7db569..00000000000 --- a/src/Caching/samples/ProfilingSample/ProfilingSample.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - diff --git a/src/Caching/samples/ProfilingSample/Program.cs b/src/Caching/samples/ProfilingSample/Program.cs deleted file mode 100644 index bcf88dabd4c..00000000000 --- a/src/Caching/samples/ProfilingSample/Program.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Memory; - -namespace ProfilingSample -{ - public class Program - { - public static void Main(string[] args) - { - // Runs several concurrent threads that access an item that periodically expires and is re-created. - MemoryCache cache = new MemoryCache(new MemoryCacheOptions()); - string key = "MyKey"; - - var options = new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.FromMilliseconds(50)); - - var tasks = new List(); - for (int threads = 0; threads < 100; threads++) - { - var task = Task.Run(() => - { - for (int i = 0; i < 110000; i++) - { - if (!cache.TryGetValue(key, out object value)) - { - // Fake expensive object creation. - for (int j = 0; j < 1000000; j++) - { - } - - cache.Set(key, new object(), options); - } - } - }); - tasks.Add(task); - } - - Console.WriteLine("Running"); - Task.WaitAll(tasks.ToArray()); - Console.WriteLine("Done"); - } - } -} diff --git a/src/Caching/samples/RedisCacheSample/Program.cs b/src/Caching/samples/RedisCacheSample/Program.cs deleted file mode 100644 index a50df8cd403..00000000000 --- a/src/Caching/samples/RedisCacheSample/Program.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Caching.StackExchangeRedis; - -namespace RedisCacheSample -{ - public class Program - { - public static void Main(string[] args) - { - RunSampleAsync().Wait(); - } - - /// - /// This sample assumes that a redis server is running on the local machine. You can set this up by doing the following: - /// Install this chocolatey package: http://chocolatey.org/packages/redis-64/ - /// run "redis-server" from command prompt. - /// - /// The that represents the asynchronous operation. - public static async Task RunSampleAsync() - { - var key = "myKey"; - var message = "Hello, World!"; - var value = Encoding.UTF8.GetBytes(message); - - Console.WriteLine("Connecting to cache"); - var cache = new RedisCache(new RedisCacheOptions - { - Configuration = "localhost", - InstanceName = "SampleInstance" - }); - Console.WriteLine("Connected"); - - Console.WriteLine($"Setting value '{message}' in cache"); - await cache.SetAsync(key, value, new DistributedCacheEntryOptions()); - Console.WriteLine("Set"); - - Console.WriteLine("Getting value from cache"); - value = await cache.GetAsync(key); - if (value != null) - { - Console.WriteLine("Retrieved: " + Encoding.UTF8.GetString(value)); - } - else - { - Console.WriteLine("Not Found"); - } - - Console.WriteLine("Refreshing value in cache"); - await cache.RefreshAsync(key); - Console.WriteLine("Refreshed"); - - Console.WriteLine("Removing value from cache"); - await cache.RemoveAsync(key); - Console.WriteLine("Removed"); - - Console.WriteLine("Getting value from cache again"); - value = await cache.GetAsync(key); - if (value != null) - { - Console.WriteLine("Retrieved: " + Encoding.UTF8.GetString(value)); - } - else - { - Console.WriteLine("Not Found"); - } - - Console.ReadLine(); - } - } -} diff --git a/src/Caching/samples/RedisCacheSample/RedisCacheSample.csproj b/src/Caching/samples/RedisCacheSample/RedisCacheSample.csproj deleted file mode 100644 index 6e02195b08b..00000000000 --- a/src/Caching/samples/RedisCacheSample/RedisCacheSample.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - diff --git a/src/Caching/samples/SqlServerCacheConcurencySample/Program.cs b/src/Caching/samples/SqlServerCacheConcurencySample/Program.cs deleted file mode 100644 index f4d4241cdec..00000000000 --- a/src/Caching/samples/SqlServerCacheConcurencySample/Program.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Caching.Memory; -using Microsoft.Extensions.Caching.SqlServer; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; - -namespace SqlServerCacheConcurrencySample -{ - /// - /// This sample requires setting up a Microsoft SQL Server based cache database. - /// 1. Install the .NET Core sql-cache tool globally by installing the dotnet-sql-cache package. - /// 2. Create a new database in the SQL Server or use an existing one. - /// 3. Run the command "dotnet sql-cache create " to setup the table and indexes. - /// 4. Run this sample by doing "dotnet run" - /// - public class Program - { - private const string Key = "MyKey"; - private static readonly Random Random = new Random(); - private static DistributedCacheEntryOptions _cacheEntryOptions; - - public static void Main() - { - var configurationBuilder = new ConfigurationBuilder(); - configurationBuilder - .AddJsonFile("config.json") - .AddEnvironmentVariables(); - var configuration = configurationBuilder.Build(); - - _cacheEntryOptions = new DistributedCacheEntryOptions(); - _cacheEntryOptions.SetSlidingExpiration(TimeSpan.FromSeconds(10)); - - var cache = new SqlServerCache(new SqlServerCacheOptions() - { - ConnectionString = configuration["ConnectionString"], - SchemaName = configuration["SchemaName"], - TableName = configuration["TableName"] - }); - - SetKey(cache, "0"); - - PeriodicallyReadKey(cache, TimeSpan.FromSeconds(1)); - - PeriodciallyRemoveKey(cache, TimeSpan.FromSeconds(11)); - - PeriodciallySetKey(cache, TimeSpan.FromSeconds(13)); - - Console.ReadLine(); - Console.WriteLine("Shutting down"); - } - - private static void SetKey(IDistributedCache cache, string value) - { - Console.WriteLine("Setting: " + value); - cache.Set(Key, Encoding.UTF8.GetBytes(value), _cacheEntryOptions); - } - - private static void PeriodciallySetKey(IDistributedCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - SetKey(cache, "A"); - } - }); - } - - private static void PeriodicallyReadKey(IDistributedCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - if (Random.Next(3) == 0) // 1/3 chance - { - // Allow values to expire due to sliding refresh. - Console.WriteLine("Read skipped, random choice."); - } - else - { - Console.Write("Reading..."); - object result = cache.Get(Key); - if (result != null) - { - cache.Set(Key, Encoding.UTF8.GetBytes("B"), _cacheEntryOptions); - } - Console.WriteLine("Read: " + (result ?? "(null)")); - } - } - }); - } - - private static void PeriodciallyRemoveKey(IDistributedCache cache, TimeSpan interval) - { - Task.Run(async () => - { - while (true) - { - await Task.Delay(interval); - - Console.WriteLine("Removing..."); - cache.Remove(Key); - } - }); - } - } -} diff --git a/src/Caching/samples/SqlServerCacheConcurencySample/SqlServerCacheConcurencySample.csproj b/src/Caching/samples/SqlServerCacheConcurencySample/SqlServerCacheConcurencySample.csproj deleted file mode 100644 index 2921fac1716..00000000000 --- a/src/Caching/samples/SqlServerCacheConcurencySample/SqlServerCacheConcurencySample.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - - - - - - - - diff --git a/src/Caching/samples/SqlServerCacheConcurencySample/config.json b/src/Caching/samples/SqlServerCacheConcurencySample/config.json deleted file mode 100644 index c432196b700..00000000000 --- a/src/Caching/samples/SqlServerCacheConcurencySample/config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ConnectionString": "Server=localhost;Database=CacheConcurrencySampleDb;Trusted_Connection=True;", - "SchemaName": "dbo", - "TableName": "CacheConcurrencySample" -} \ No newline at end of file diff --git a/src/Caching/samples/SqlServerCacheSample/Program.cs b/src/Caching/samples/SqlServerCacheSample/Program.cs deleted file mode 100644 index da4cf2cdea1..00000000000 --- a/src/Caching/samples/SqlServerCacheSample/Program.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Caching.SqlServer; -using Microsoft.Extensions.Configuration; - -namespace SqlServerCacheSample -{ - /// - /// This sample requires setting up a Microsoft SQL Server based cache database. - /// 1. Install the .NET Core sql-cache tool globally by installing the dotnet-sql-cache package. - /// 2. Create a new database in the SQL Server or use an existing one. - /// 3. Run the command "dotnet sql-cache create " to setup the table and indexes. - /// 4. Run this sample by doing "dotnet run" - /// - public class Program - { - public static void Main() - { - RunSampleAsync().Wait(); - } - - public static async Task RunSampleAsync() - { - var configurationBuilder = new ConfigurationBuilder(); - var configuration = configurationBuilder - .AddJsonFile("config.json") - .AddEnvironmentVariables() - .Build(); - - var key = Guid.NewGuid().ToString(); - var message = "Hello, World!"; - var value = Encoding.UTF8.GetBytes(message); - - Console.WriteLine("Connecting to cache"); - var cache = new SqlServerCache(new SqlServerCacheOptions() - { - ConnectionString = configuration["ConnectionString"], - SchemaName = configuration["SchemaName"], - TableName = configuration["TableName"] - }); - - Console.WriteLine("Connected"); - - Console.WriteLine("Cache item key: {0}", key); - Console.WriteLine($"Setting value '{message}' in cache"); - await cache.SetAsync( - key, - value, - new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(10))); - Console.WriteLine("Set"); - - Console.WriteLine("Getting value from cache"); - value = await cache.GetAsync(key); - if (value != null) - { - Console.WriteLine("Retrieved: " + Encoding.UTF8.GetString(value, 0, value.Length)); - } - else - { - Console.WriteLine("Not Found"); - } - - Console.WriteLine("Refreshing value in cache"); - await cache.RefreshAsync(key); - Console.WriteLine("Refreshed"); - - Console.WriteLine("Removing value from cache"); - await cache.RemoveAsync(key); - Console.WriteLine("Removed"); - - Console.WriteLine("Getting value from cache again"); - value = await cache.GetAsync(key); - if (value != null) - { - Console.WriteLine("Retrieved: " + Encoding.UTF8.GetString(value, 0, value.Length)); - } - else - { - Console.WriteLine("Not Found"); - } - - Console.ReadLine(); - } - } -} diff --git a/src/Caching/samples/SqlServerCacheSample/SqlServerCacheSample.csproj b/src/Caching/samples/SqlServerCacheSample/SqlServerCacheSample.csproj deleted file mode 100644 index bb5f8cfbe3d..00000000000 --- a/src/Caching/samples/SqlServerCacheSample/SqlServerCacheSample.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - - - - - - - - - diff --git a/src/Caching/samples/SqlServerCacheSample/config.json b/src/Caching/samples/SqlServerCacheSample/config.json deleted file mode 100644 index 6eb7beb7644..00000000000 --- a/src/Caching/samples/SqlServerCacheSample/config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ConnectionString": "Server=localhost;Database=CacheSampleDb;Trusted_Connection=True;", - "SchemaName": "dbo", - "TableName": "CacheSample" -} \ No newline at end of file diff --git a/src/Hosting/Hosting.sln b/src/Hosting/Hosting.sln index d1f06396417..915de316df9 100644 --- a/src/Hosting/Hosting.sln +++ b/src/Hosting/Hosting.sln @@ -3,12 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28527.54 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenericHostSample", "samples\GenericHostSample\GenericHostSample.csproj", "{7301C61C-0B4E-4CAE-97F7-13E8FF72D121}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleMsmqHost", "samples\SampleMsmqHost\SampleMsmqHost.csproj", "{50586D64-6326-4CDB-9023-3A4D027263CF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{D754FD75-091F-48DF-B3DA-91D0DB601E8B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting.Systemd", "Systemd\src\Microsoft.Extensions.Hosting.Systemd.csproj", "{A7356D45-9A20-493C-9C95-EEF54727D931}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Hosting.Systemd.Tests", "Systemd\test\Microsoft.Extensions.Hosting.Systemd.Tests.csproj", "{0A1C6C61-F5C6-4688-8C86-3B4D8DB0E6FF}" @@ -23,14 +17,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7301C61C-0B4E-4CAE-97F7-13E8FF72D121}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7301C61C-0B4E-4CAE-97F7-13E8FF72D121}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7301C61C-0B4E-4CAE-97F7-13E8FF72D121}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7301C61C-0B4E-4CAE-97F7-13E8FF72D121}.Release|Any CPU.Build.0 = Release|Any CPU - {50586D64-6326-4CDB-9023-3A4D027263CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {50586D64-6326-4CDB-9023-3A4D027263CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {50586D64-6326-4CDB-9023-3A4D027263CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {50586D64-6326-4CDB-9023-3A4D027263CF}.Release|Any CPU.Build.0 = Release|Any CPU {A7356D45-9A20-493C-9C95-EEF54727D931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A7356D45-9A20-493C-9C95-EEF54727D931}.Debug|Any CPU.Build.0 = Debug|Any CPU {A7356D45-9A20-493C-9C95-EEF54727D931}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -51,10 +37,6 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {7301C61C-0B4E-4CAE-97F7-13E8FF72D121} = {D754FD75-091F-48DF-B3DA-91D0DB601E8B} - {50586D64-6326-4CDB-9023-3A4D027263CF} = {D754FD75-091F-48DF-B3DA-91D0DB601E8B} - EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {6F68EA96-ED05-47B1-A422-FF13D7154E99} EndGlobalSection diff --git a/src/Hosting/samples/GenericHostSample/GenericHostSample.csproj b/src/Hosting/samples/GenericHostSample/GenericHostSample.csproj deleted file mode 100644 index d23233d9f01..00000000000 --- a/src/Hosting/samples/GenericHostSample/GenericHostSample.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net461 - GenericHostSample.WindowsServiceControlled - Exe - latest - - - - - - - - - diff --git a/src/Hosting/samples/GenericHostSample/MyContainer.cs b/src/Hosting/samples/GenericHostSample/MyContainer.cs deleted file mode 100644 index ecaf7dc2ee0..00000000000 --- a/src/Hosting/samples/GenericHostSample/MyContainer.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace GenericHostSample -{ - internal class MyContainer - { - } -} \ No newline at end of file diff --git a/src/Hosting/samples/GenericHostSample/MyContainerFactory.cs b/src/Hosting/samples/GenericHostSample/MyContainerFactory.cs deleted file mode 100644 index d8ef5fea4e4..00000000000 --- a/src/Hosting/samples/GenericHostSample/MyContainerFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.DependencyInjection; - -namespace GenericHostSample -{ - internal class MyContainerFactory : IServiceProviderFactory - { - public MyContainer CreateBuilder(IServiceCollection services) - { - return new MyContainer(); - } - - public IServiceProvider CreateServiceProvider(MyContainer containerBuilder) - { - throw new NotImplementedException(); - } - } -} \ No newline at end of file diff --git a/src/Hosting/samples/GenericHostSample/MyServiceA.cs b/src/Hosting/samples/GenericHostSample/MyServiceA.cs deleted file mode 100644 index d71b6b26a35..00000000000 --- a/src/Hosting/samples/GenericHostSample/MyServiceA.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace GenericHostSample -{ - public class MyServiceA : BackgroundService - { - public MyServiceA(ILoggerFactory loggerFactory) - { - Logger = loggerFactory.CreateLogger(); - } - - public ILogger Logger { get; } - - protected override async Task ExecuteAsync(CancellationToken stoppingToken) - { - Logger.LogInformation("MyServiceA is starting."); - - stoppingToken.Register(() => Logger.LogInformation("MyServiceA is stopping.")); - - while (!stoppingToken.IsCancellationRequested) - { - Logger.LogInformation("MyServiceA is doing background work."); - - await Task.Delay(TimeSpan.FromSeconds(5), stoppingToken); - } - - Logger.LogInformation("MyServiceA background task is stopping."); - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/MyServiceB.cs b/src/Hosting/samples/GenericHostSample/MyServiceB.cs deleted file mode 100644 index 821d06610c8..00000000000 --- a/src/Hosting/samples/GenericHostSample/MyServiceB.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace GenericHostSample -{ - public class MyServiceB : IHostedService, IDisposable - { - private bool _stopping; - private Task _backgroundTask; - - public MyServiceB(ILoggerFactory loggerFactory) - { - Logger = loggerFactory.CreateLogger(); - } - - public ILogger Logger { get; } - - public Task StartAsync(CancellationToken cancellationToken) - { - Logger.LogInformation("MyServiceB is starting."); - _backgroundTask = BackgroundTask(); - return Task.CompletedTask; - } - - private async Task BackgroundTask() - { - while (!_stopping) - { - await Task.Delay(TimeSpan.FromSeconds(7)); - Logger.LogInformation("MyServiceB is doing background work."); - } - - Logger.LogInformation("MyServiceB background task is stopping."); - } - - public async Task StopAsync(CancellationToken cancellationToken) - { - Logger.LogInformation("MyServiceB is stopping."); - _stopping = true; - if (_backgroundTask != null) - { - // TODO: cancellation - await _backgroundTask; - } - } - - public void Dispose() - { - Logger.LogInformation("MyServiceB is disposing."); - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/ProgramExternallyControlled.cs b/src/Hosting/samples/GenericHostSample/ProgramExternallyControlled.cs deleted file mode 100644 index b3856e61891..00000000000 --- a/src/Hosting/samples/GenericHostSample/ProgramExternallyControlled.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace GenericHostSample -{ - public class ProgramExternallyControlled - { - private IHost _host; - - public ProgramExternallyControlled() - { - _host = new HostBuilder() - .UseServiceProviderFactory(new MyContainerFactory()) - .ConfigureLogging(logging => - { - logging.AddConsole(); - }) - .ConfigureContainer((hostContext, container) => - { - }) - .ConfigureAppConfiguration((hostContext, config) => - { - config.AddEnvironmentVariables(); - config.AddJsonFile("appsettings.json", optional: true); - }) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - services.AddHostedService(); - }) - .Build(); - } - - public void Start() - { - _host.Start(); - } - - public async Task StopAsync() - { - await _host.StopAsync(TimeSpan.FromSeconds(5)); - _host.Dispose(); - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/ProgramFullControl.cs b/src/Hosting/samples/GenericHostSample/ProgramFullControl.cs deleted file mode 100644 index f909e6fb681..00000000000 --- a/src/Hosting/samples/GenericHostSample/ProgramFullControl.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace GenericHostSample -{ - public class ProgramFullControl - { - public static async Task Main(string[] args) - { - var host = new HostBuilder() - .UseServiceProviderFactory(new MyContainerFactory()) - .ConfigureContainer((hostContext, container) => - { - }) - .ConfigureLogging(logging => - { - logging.AddConsole(); - }) - .ConfigureAppConfiguration((hostContext, config) => - { - config.AddEnvironmentVariables(); - config.AddJsonFile("appsettings.json", optional: true); - config.AddCommandLine(args); - }) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - services.AddHostedService(); - }) - .Build(); - - var s = host.Services; - - using (host) - { - Console.WriteLine("Starting!"); - - await host.StartAsync(); - - Console.WriteLine("Started! Press to stop."); - - Console.ReadLine(); - - Console.WriteLine("Stopping!"); - - await host.StopAsync(); - - Console.WriteLine("Stopped!"); - } - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/ProgramHelloWorld.cs b/src/Hosting/samples/GenericHostSample/ProgramHelloWorld.cs deleted file mode 100644 index 90c290f65b6..00000000000 --- a/src/Hosting/samples/GenericHostSample/ProgramHelloWorld.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - - -namespace GenericHostSample -{ - public class ProgramHelloWorld - { - public static async Task Main(string[] args) - { - var builder = Host.CreateDefaultBuilder() - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - services.AddHostedService(); - }); - - await builder.RunConsoleAsync(options => - { - options.SuppressStatusMessages = false; - }); - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/ProgramNoDisposeHangs.cs b/src/Hosting/samples/GenericHostSample/ProgramNoDisposeHangs.cs deleted file mode 100644 index 83e9d16b516..00000000000 --- a/src/Hosting/samples/GenericHostSample/ProgramNoDisposeHangs.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - - -namespace GenericHostSample -{ - public class ProgramNoDisposeHangs - { - public static async Task Main(string[] args) - { - // Hangs due to #1363 - var host = CreateHostBuilder(args).Build(); - await host.StartAsync(); - await host.StopAsync(); - } - - public static IHostBuilder CreateHostBuilder(string[] args) => - Host.CreateDefaultBuilder(args) - .ConfigureServices(services => services.AddHostedService()); - } -} diff --git a/src/Hosting/samples/GenericHostSample/Properties/launchSettings.json b/src/Hosting/samples/GenericHostSample/Properties/launchSettings.json deleted file mode 100644 index cbfbceda874..00000000000 --- a/src/Hosting/samples/GenericHostSample/Properties/launchSettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "profiles": { - "GenericHostSample": { - "commandName": "Project", - "environmentVariables": { - "DOTNET_ENVIRONMENT": "Development" - } - } - } -} diff --git a/src/Hosting/samples/GenericHostSample/WindowsServiceControlled.cs b/src/Hosting/samples/GenericHostSample/WindowsServiceControlled.cs deleted file mode 100644 index 587919a3f1f..00000000000 --- a/src/Hosting/samples/GenericHostSample/WindowsServiceControlled.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace GenericHostSample -{ - public class WindowsServiceControlled - { - public static async Task Main(string[] args) - { - var builder = Host.CreateDefaultBuilder(args) - .ConfigureServices((hostContext, services) => - { - services.AddHostedService(); - services.AddHostedService(); - }); - - builder.UseWindowsService(); - await builder.Build().RunAsync(); - } - } -} diff --git a/src/Hosting/samples/SampleMsmqHost/MsmqConnection.cs b/src/Hosting/samples/SampleMsmqHost/MsmqConnection.cs deleted file mode 100644 index 5b9e4679b90..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/MsmqConnection.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Messaging; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; - -namespace SampleMsmqHost -{ - public interface IMsmqConnection - { - void SendText(string text); - - Task ReceiveAsync(CancellationToken cancellationToken); - } - - public class MsmqConnection : IMsmqConnection, IDisposable - { - private readonly MessageQueue _queue; - - public MsmqOptions Options { get; } - - public ILogger Logger { get; } - - public MsmqConnection(IOptions options, ILogger logger) - { - Options = options?.Value ?? throw new ArgumentNullException(nameof(options)); - Logger = logger ?? throw new ArgumentNullException(nameof(logger)); - - _queue = OpenQueue(); - } - - private MessageQueue OpenQueue() - { - Logger.LogInformation("Opening Queue: Path={0}; AccessMode={1};", Options.Path, Options.AccessMode); - - return new MessageQueue(Options.Path, Options.SharedModeDenyReceive, Options.EnableCache, Options.AccessMode); - } - - public void Dispose() - { - Logger.LogInformation("Closing Queue"); - - _queue?.Dispose(); - } - - public void SendText(string text) - { - // send the text message as UTF7 - using (var stream = new MemoryStream()) - using (var writer = new StreamWriter(stream, Encoding.UTF7)) - using (var message = new Message()) - { - writer.Write(text); - writer.Flush(); - - message.BodyStream = stream; - - _queue.Send(message); - } - } - - public async Task ReceiveAsync(CancellationToken cancellationToken) - { - var tcs = new TaskCompletionSource(); - using (cancellationToken.Register(obj => ((TaskCompletionSource)obj).TrySetCanceled(), tcs)) - { - // wait for a message to arrive or cancellation - var receiveTask = Task.Factory.FromAsync(_queue.BeginReceive(), _queue.EndReceive); - if (receiveTask != await Task.WhenAny(receiveTask, tcs.Task)) - throw new OperationCanceledException(cancellationToken); - - return receiveTask.Result; - } - } - - } -} \ No newline at end of file diff --git a/src/Hosting/samples/SampleMsmqHost/MsmqOptions.cs b/src/Hosting/samples/SampleMsmqHost/MsmqOptions.cs deleted file mode 100644 index e78f1e7604e..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/MsmqOptions.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Messaging; - -namespace SampleMsmqHost -{ - public class MsmqOptions - { - public string Path { get; set; } - - public bool SharedModeDenyReceive { get; set; } = false; - - public bool EnableCache { get; set; } = false; - - public QueueAccessMode AccessMode { get; set; } = QueueAccessMode.SendAndReceive; - } -} \ No newline at end of file diff --git a/src/Hosting/samples/SampleMsmqHost/MsmqProcessor.cs b/src/Hosting/samples/SampleMsmqHost/MsmqProcessor.cs deleted file mode 100644 index a1f1dd40f74..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/MsmqProcessor.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using System.Messaging; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; - -namespace SampleMsmqHost -{ - public interface IMsmqProcessor - { - Task ProcessMessageAsync(Message message, CancellationToken cancellationToken); - } - - public class MsmqProcessor : IMsmqProcessor - { - private readonly ILogger _logger; - - public MsmqProcessor(ILogger logger) - { - _logger = logger ?? throw new ArgumentNullException(nameof(logger)); - } - - public async Task ProcessMessageAsync(Message message, CancellationToken cancellationToken) - { - // we assume the message contains text encoded as UTF7 - using (var reader = new StreamReader(message.BodyStream, Encoding.UTF7)) - { - var text = await reader.ReadToEndAsync(); - - _logger.LogInformation("Received Message: {0}", text); - } - } - - } -} \ No newline at end of file diff --git a/src/Hosting/samples/SampleMsmqHost/MsmqService.cs b/src/Hosting/samples/SampleMsmqHost/MsmqService.cs deleted file mode 100644 index 438cb50d63f..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/MsmqService.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace SampleMsmqHost -{ - public class MsmqService : BackgroundService - { - public ILogger Logger { get; } - - public IMsmqConnection Connection { get; } - - public IMsmqProcessor Processor { get; } - - public MsmqService(ILogger logger, IMsmqConnection connection, IMsmqProcessor processor) - { - Logger = logger ?? throw new ArgumentNullException(nameof(logger)); - Connection = connection ?? throw new ArgumentNullException(nameof(connection)); - Processor = processor ?? throw new ArgumentNullException(nameof(processor)); - } - - protected override async Task ExecuteAsync(CancellationToken cancellationToken) - { - Logger.LogInformation("Begin Receive Loop"); - try - { - while (!cancellationToken.IsCancellationRequested) - { - using (var message = await Connection.ReceiveAsync(cancellationToken)) - { - await Processor.ProcessMessageAsync(message, cancellationToken); - } - } - } - finally - { - Logger.LogInformation("End Receive Loop"); - } - } - - } -} \ No newline at end of file diff --git a/src/Hosting/samples/SampleMsmqHost/Program.cs b/src/Hosting/samples/SampleMsmqHost/Program.cs deleted file mode 100644 index e99465b7fe0..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/Program.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Messaging; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; - -namespace SampleMsmqHost -{ - public static class Program - { - // Before running this program, please make sure to install MSMQ - // and create the ".\private$\SampleQueue" queue on your local machine. - - public static async Task Main(string[] args) - { - var host = new HostBuilder() - .ConfigureAppConfiguration(config => - { - config.AddEnvironmentVariables(); - config.AddJsonFile("appsettings.json", optional: true); - config.AddCommandLine(args); - }) - .ConfigureLogging(factory => - { - factory.AddConsole(); - }) - .ConfigureServices(services => - { - services.AddOptions(); - - services.Configure(options => - { - options.Path = @".\private$\SampleQueue"; - options.AccessMode = QueueAccessMode.SendAndReceive; - }); - - services.AddSingleton(); - services.AddTransient(); - services.AddTransient(); - }) - .Build(); - - using (host) - { - // start the MSMQ host - await host.StartAsync(); - - // read and dispatch messages to the MSMQ queue - StartReadLoop(host); - - // wait for the MSMQ host to shutdown - await host.WaitForShutdownAsync(); - } - } - - private static void StartReadLoop(IHost host) - { - var connection = host.Services.GetRequiredService(); - var applicationLifetime = host.Services.GetRequiredService(); - - // run the read loop in a background thread so that it can be stopped with CTRL+C - Task.Run(() => ReadLoop(connection, applicationLifetime.ApplicationStopping)); - } - - private static void ReadLoop(IMsmqConnection connection, CancellationToken cancellationToken) - { - Console.WriteLine("Enter your text message and press ENTER..."); - - while (!cancellationToken.IsCancellationRequested) - { - // read a text message from the user - cancellationToken.ThrowIfCancellationRequested(); - var text = Console.ReadLine(); - - // send the text message to the queue - cancellationToken.ThrowIfCancellationRequested(); - if (!string.IsNullOrEmpty(text)) - connection.SendText(text); - } - } - - } -} diff --git a/src/Hosting/samples/SampleMsmqHost/SampleMsmqHost.csproj b/src/Hosting/samples/SampleMsmqHost/SampleMsmqHost.csproj deleted file mode 100644 index 212d28ddaf2..00000000000 --- a/src/Hosting/samples/SampleMsmqHost/SampleMsmqHost.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - Exe - - net461 - latest - - - - - - - - - - - - diff --git a/src/HttpClientFactory/samples/HttpClientFactorySample/HttpClientFactorySample.csproj b/src/HttpClientFactory/samples/HttpClientFactorySample/HttpClientFactorySample.csproj deleted file mode 100644 index 7dd2e8e9627..00000000000 --- a/src/HttpClientFactory/samples/HttpClientFactorySample/HttpClientFactorySample.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - $(DefaultNetCoreTargetFramework);net461 - portable - Exe - - - - - - - - - - - diff --git a/src/HttpClientFactory/samples/HttpClientFactorySample/Program.cs b/src/HttpClientFactory/samples/HttpClientFactorySample/Program.cs deleted file mode 100644 index f25b1906a4f..00000000000 --- a/src/HttpClientFactory/samples/HttpClientFactorySample/Program.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Net.Http; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json.Linq; -using Polly; - -namespace HttpClientFactorySample -{ - public class Program - { - public static void Main(string[] args) => Run().GetAwaiter().GetResult(); - - public static async Task Run() - { - var serviceCollection = new ServiceCollection(); - serviceCollection.AddLogging(b => - { - b.AddFilter((category, level) => true); // Spam the world with logs. - - // Add console logger so we can see all the logging produced by the client by default. - b.AddConsole(c => c.IncludeScopes = true); - }); - - Configure(serviceCollection); - - var services = serviceCollection.BuildServiceProvider(); - - Console.WriteLine("Creating a client..."); - var github = services.GetRequiredService(); - - Console.WriteLine("Sending a request..."); - var response = await github.GetJson(); - - var data = await response.Content.ReadAsAsync(); - Console.WriteLine("Response data:"); - Console.WriteLine(data); - - Console.WriteLine("Press the ANY key to exit..."); - Console.ReadKey(); - } - - public static void Configure(IServiceCollection services) - { - var registry = services.AddPolicyRegistry(); - - var timeout = Policy.TimeoutAsync(TimeSpan.FromSeconds(10)); - var longTimeout = Policy.TimeoutAsync(TimeSpan.FromSeconds(30)); - - registry.Add("regular", timeout); - registry.Add("long", longTimeout); - - services.AddHttpClient("github", c => - { - c.BaseAddress = new Uri("https://api.github.com/"); - - c.DefaultRequestHeaders.Add("Accept", "application/vnd.github.v3+json"); // GitHub API versioning - c.DefaultRequestHeaders.Add("User-Agent", "HttpClientFactory-Sample"); // GitHub requires a user-agent - }) - - // Build a totally custom policy using any criteria - .AddPolicyHandler(Policy.TimeoutAsync(TimeSpan.FromSeconds(10))) - - // Use a specific named policy from the registry. Simplest way, policy is cached for the - // lifetime of the handler. - .AddPolicyHandlerFromRegistry("regular") - - // Run some code to select a policy based on the request - .AddPolicyHandler((request) => - { - return request.Method == HttpMethod.Get ? timeout : longTimeout; - }) - - // Run some code to select a policy from the registry based on the request - .AddPolicyHandlerFromRegistry((reg, request) => - { - return request.Method == HttpMethod.Get ? - reg.Get>("regular") : - reg.Get>("long"); - }) - - // Build a policy that will handle exceptions, 408s, and 500s from the remote server - .AddTransientHttpErrorPolicy(p => p.RetryAsync()) - - .AddHttpMessageHandler(() => new RetryHandler()) // Retry requests to github using our retry handler - .AddTypedClient(); - } - - private class GitHubClient - { - public GitHubClient(HttpClient httpClient) - { - HttpClient = httpClient; - } - - public HttpClient HttpClient { get; } - - // Gets the list of services on github. - public async Task GetJson() - { - var request = new HttpRequestMessage(HttpMethod.Get, "/"); - - var response = await HttpClient.SendAsync(request).ConfigureAwait(false); - response.EnsureSuccessStatusCode(); - - return response; - } - } - - private class RetryHandler : DelegatingHandler - { - public int RetryCount { get; set; } = 5; - - protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) - { - for (var i = 0; i < RetryCount; i++) - { - try - { - return await base.SendAsync(request, cancellationToken); - } - catch (HttpRequestException) when (i == RetryCount - 1) - { - throw; - } - catch (HttpRequestException) - { - // Retry - await Task.Delay(TimeSpan.FromMilliseconds(50)); - } - } - - // Unreachable. - throw null; - } - } - } -} diff --git a/src/Logging/Logging.sln b/src/Logging/Logging.sln index 2e37e2cc988..afbdf6334c9 100644 --- a/src/Logging/Logging.sln +++ b/src/Logging/Logging.sln @@ -9,10 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Loggin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Logging.Analyzer.Tests", "Logging.Analyzers\test\Microsoft.Extensions.Logging.Analyzer.Tests.csproj", "{812B2A56-0550-4D93-9438-11A4088CF4B1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{83353E14-BAFC-400F-AF6D-E5C3B24087B1}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp", "samples\SampleApp\SampleApp.csproj", "{09942046-F632-4CD5-8523-5F2C0236EDE0}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,18 +43,6 @@ Global {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x64.Build.0 = Release|Any CPU {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x86.ActiveCfg = Release|Any CPU {812B2A56-0550-4D93-9438-11A4088CF4B1}.Release|x86.Build.0 = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|x64.ActiveCfg = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|x64.Build.0 = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|x86.ActiveCfg = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Debug|x86.Build.0 = Debug|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|Any CPU.Build.0 = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|x64.ActiveCfg = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|x64.Build.0 = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|x86.ActiveCfg = Release|Any CPU - {09942046-F632-4CD5-8523-5F2C0236EDE0}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -66,7 +50,6 @@ Global GlobalSection(NestedProjects) = preSolution {55C59899-8662-4C2C-9919-5EF1064D0F27} = {8CADF521-7074-40F0-8CA9-75ED45718609} {812B2A56-0550-4D93-9438-11A4088CF4B1} = {8CADF521-7074-40F0-8CA9-75ED45718609} - {09942046-F632-4CD5-8523-5F2C0236EDE0} = {83353E14-BAFC-400F-AF6D-E5C3B24087B1} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A31D96AD-9FA6-4FC0-8A00-0185A80751CC} diff --git a/src/Logging/samples/SampleApp/LoggerExtensions.cs b/src/Logging/samples/SampleApp/LoggerExtensions.cs deleted file mode 100644 index 58745c897fa..00000000000 --- a/src/Logging/samples/SampleApp/LoggerExtensions.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using Microsoft.Extensions.Logging; - -namespace SampleApp -{ - internal static class LoggerExtensions - { - private static Func _purchaseOrderScope; - private static Action _programStarting; - private static Action _programStopping; - - static LoggerExtensions() - { - _purchaseOrderScope = LoggerMessage.DefineScope("PO:{PurchaseOrder}"); - _programStarting = LoggerMessage.Define(LogLevel.Information, 1, "Starting at '{StartTime}' and 0x{Hello:X} is hex of 42"); - _programStopping = LoggerMessage.Define(LogLevel.Information, 2, "Stopping at '{StopTime}'"); - } - - public static IDisposable PurchaseOrderScope(this ILogger logger, string purchaseOrder) - { - return _purchaseOrderScope(logger, purchaseOrder); - } - - public static void ProgramStarting(this ILogger logger, DateTimeOffset startTime, int hello, Exception exception = null) - { - _programStarting(logger, startTime, hello, exception); - } - - public static void ProgramStopping(this ILogger logger, DateTimeOffset stopTime, Exception exception = null) - { - _programStopping(logger, stopTime, exception); - } - } -} - diff --git a/src/Logging/samples/SampleApp/Program.cs b/src/Logging/samples/SampleApp/Program.cs deleted file mode 100644 index f5717cd05b3..00000000000 --- a/src/Logging/samples/SampleApp/Program.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.IO; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using ILogger = Microsoft.Extensions.Logging.ILogger; - -namespace SampleApp -{ - public class Program - { - public static void Main(string[] args) - { - var loggingConfiguration = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("logging.json", optional: false, reloadOnChange: true) - .Build(); - - // A Web App based program would configure logging via the WebHostBuilder. - // Create a logger factory with filters that can be applied across all logger providers. - var loggerFactory = LoggerFactory.Create(builder => - { - builder - .AddConfiguration(loggingConfiguration.GetSection("Logging")) - .AddFilter("Microsoft", LogLevel.Warning) - .AddFilter("System", LogLevel.Warning) - .AddFilter("SampleApp.Program", LogLevel.Debug) - .AddConsole() - .AddEventLog(); - }); - - // Make sure to dispose ILoggerFactory - using (loggerFactory) - { - var logger = loggerFactory.CreateLogger(); - - logger.LogInformation("Starting"); - - var startTime = DateTimeOffset.Now; - logger.LogInformation(1, "Started at '{StartTime}' and 0x{Hello:X} is hex of 42", startTime, 42); - // or - logger.ProgramStarting(startTime, 42); - - using (logger.PurchaseOrderScope("00655321")) - { - try - { - throw new Exception("Boom"); - } - catch (Exception ex) - { - logger.LogCritical(1, ex, "Unexpected critical error starting application"); - logger.LogError(1, ex, "Unexpected error"); - logger.LogWarning(1, ex, "Unexpected warning"); - } - - using (logger.BeginScope("Main")) - { - - logger.LogInformation("Waiting for user input"); - - string input; - do - { - Console.WriteLine("Enter some test to log more, or 'quit' to exit."); - input = Console.ReadLine(); - - logger.LogInformation("User typed '{input}' on the command line", input); - logger.LogWarning("The time is now {Time}, it's getting late!", DateTimeOffset.Now); - } - while (input != "quit"); - } - } - - var endTime = DateTimeOffset.Now; - logger.LogInformation(2, "Stopping at '{StopTime}'", endTime); - // or - logger.ProgramStopping(endTime); - - logger.LogInformation("Stopping"); - } - } - } -} diff --git a/src/Logging/samples/SampleApp/SampleApp.csproj b/src/Logging/samples/SampleApp/SampleApp.csproj deleted file mode 100644 index e1f5904b7e7..00000000000 --- a/src/Logging/samples/SampleApp/SampleApp.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net461;$(DefaultNetCoreTargetFramework) - Exe - - - - - PreserveNewest - - - - - - - - - - - - - - diff --git a/src/Logging/samples/SampleApp/logging.json b/src/Logging/samples/SampleApp/logging.json deleted file mode 100644 index 98454d5dba1..00000000000 --- a/src/Logging/samples/SampleApp/logging.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - }, - "Console": - { - "IncludeScopes": "true", - "TimestampFormat": "[HH:mm:ss] ", - "LogToStandardErrorThreshold": "Warning" - } - } -} \ No newline at end of file From ffc982464f4c58e929e80ec4ff4118ed9c6b2abf Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 7 Apr 2020 01:32:00 -0700 Subject: [PATCH 5/5] Fix codecheck --- eng/scripts/CodeCheck.ps1 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/eng/scripts/CodeCheck.ps1 b/eng/scripts/CodeCheck.ps1 index 44c03626c74..48e73317572 100644 --- a/eng/scripts/CodeCheck.ps1 +++ b/eng/scripts/CodeCheck.ps1 @@ -82,11 +82,6 @@ try { & $PSScriptRoot\GenerateProjectList.ps1 } - Write-Host "Re-generating references assemblies" - Invoke-Block { - & $PSScriptRoot\GenerateReferenceAssemblies.ps1 - } - Write-Host "Re-generating package baselines" $dotnet = 'dotnet' if ($ci) { @@ -108,7 +103,7 @@ try { foreach ($file in $changedFiles) { if ($file -eq $changedFilesExclusion) {continue} $filePath = Resolve-Path "${repoRoot}/${file}" - LogError "Generated code is not up to date in $file. You might need to regenerate the reference assemblies or project list (see docs/ReferenceAssemblies.md and docs/ReferenceResolution.md)" -filepath $filePath + LogError "Generated code is not up to date in $file. You might need to regenerate the project list (see docs/ReferenceResolution.md)" -filepath $filePath & git --no-pager diff --ignore-space-change $filePath } }