From 79eb0138c7bc1e493342384c5f1899e01d36e976 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Wed, 20 Jan 2016 15:36:46 -0800 Subject: [PATCH] Migrate to using System.Runtime.Loader.AssemblyLoadContext --- .../MvcCoreServiceCollectionExtensions.cs | 6 +++--- src/Microsoft.AspNetCore.Mvc.Core/project.json | 3 ++- .../DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs | 4 ++-- .../Infrastructure/DefaultAssemblyProviderTests.cs | 2 +- .../MvcTestFixture.cs | 2 +- test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs | 1 - 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs index 9670b080cb..bb43662a02 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/MvcCoreServiceCollectionExtensions.cs @@ -61,9 +61,9 @@ namespace Microsoft.Extensions.DependencyInjection // // RuntimeServices // - if (PlatformServices.Default?.LibraryManager != null) + if (DnxPlatformServices.Default?.LibraryManager != null) { - services.TryAddSingleton(PlatformServices.Default.LibraryManager); + services.TryAddSingleton(DnxPlatformServices.Default.LibraryManager); } // @@ -78,7 +78,7 @@ namespace Microsoft.Extensions.DependencyInjection // Action Discovery // // These are consumed only when creating action descriptors, then they can be de-allocated - if (PlatformServices.Default?.LibraryManager != null) + if (DnxPlatformServices.Default?.LibraryManager != null) { services.TryAddTransient(); } diff --git a/src/Microsoft.AspNetCore.Mvc.Core/project.json b/src/Microsoft.AspNetCore.Mvc.Core/project.json index c1452b43a1..ae7be58986 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/project.json +++ b/src/Microsoft.AspNetCore.Mvc.Core/project.json @@ -21,6 +21,7 @@ }, "Microsoft.Extensions.FileProviders.Abstractions": "1.0.0-*", "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", + "Microsoft.Extensions.PlatformAbstractions.Dnx": "1.0.0-*", "Microsoft.Extensions.DependencyModel": "1.0.0-*", "Microsoft.Extensions.ClosedGenericMatcher.Sources": { "version": "1.0.0-*", @@ -59,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs index 0c814f52bc..49042ae384 100644 --- a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs @@ -145,9 +145,9 @@ namespace Microsoft.Extensions.DependencyInjection // Consumed by the Cache tag helper to cache results across the lifetime of the application. services.TryAddSingleton(); - if (PlatformServices.Default?.AssemblyLoadContextAccessor != null) + if (DnxPlatformServices.Default?.AssemblyLoadContextAccessor != null) { - services.TryAddSingleton(PlatformServices.Default.AssemblyLoadContextAccessor); + services.TryAddSingleton(DnxPlatformServices.Default.AssemblyLoadContextAccessor); } } } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs index b4760902e1..9078674a2b 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Infrastructure/DefaultAssemblyProviderTests.cs @@ -250,7 +250,7 @@ namespace Microsoft.AspNetCore.Mvc.Infrastructure private static ILibraryManager GetLibraryManager() { - return PlatformServices.Default.LibraryManager; + return DnxPlatformServices.Default.LibraryManager; } } } diff --git a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs index d744f35e81..7c6d8de9f0 100644 --- a/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs +++ b/test/Microsoft.AspNetCore.Mvc.FunctionalTests/MvcTestFixture.cs @@ -48,7 +48,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests protected virtual void InitializeServices(IServiceCollection services) { - var libraryManager = PlatformServices.Default.LibraryManager; + var libraryManager = DnxPlatformServices.Default.LibraryManager; // When an application executes in a regular context, the application base path points to the root // directory where the application is located, for example .../samples/MvcSample.Web. However, when diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs index 3cb3f719f9..3e62cdc5dc 100644 --- a/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcOptionsSetupTest.cs @@ -249,7 +249,6 @@ namespace Microsoft.AspNetCore.Mvc serviceCollection.AddSingleton(Mock.Of()); serviceCollection.AddSingleton(Mock.Of()); serviceCollection.AddSingleton(Mock.Of()); - serviceCollection.AddSingleton(Mock.Of()); serviceCollection.AddSingleton(Mock.Of()); var applicationEnvironment = new Mock();