diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs
index 7ad99a2afe..478d21eed8 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeature.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
@@ -9,6 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
///
/// Specifies the list of used in Razor compilation.
///
+ [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
public class MetadataReferenceFeature
{
///
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs
index f5a42ace01..8050671a1f 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/MetadataReferenceFeatureProvider.cs
@@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
/// uses for registered instances to create
/// .
///
+ [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
public class MetadataReferenceFeatureProvider : IApplicationFeatureProvider
{
///
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs
index 5b11ce10e3..df09623169 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Compilation/RazorReferenceManager.cs
@@ -1,6 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Collections.Generic;
using Microsoft.CodeAnalysis;
@@ -9,6 +10,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
///
/// Manages compilation references for Razor compilation.
///
+ [Obsolete("This type is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
public abstract class RazorReferenceManager
{
///
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
index 7dddf090bd..236eb88fa2 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/DependencyInjection/MvcRazorMvcCoreBuilderExtensions.cs
@@ -65,10 +65,12 @@ namespace Microsoft.Extensions.DependencyInjection
private static void AddRazorViewEngineFeatureProviders(IMvcCoreBuilder builder)
{
+#pragma warning disable CS0618 // Type or member is obsolete
if (!builder.PartManager.FeatureProviders.OfType().Any())
{
builder.PartManager.FeatureProviders.Add(new MetadataReferenceFeatureProvider());
}
+#pragma warning restore CS0618 // Type or member is obsolete
if (!builder.PartManager.FeatureProviders.OfType().Any())
{
@@ -146,7 +148,9 @@ namespace Microsoft.Extensions.DependencyInjection
internal static void AddRazorViewEngineServices(IServiceCollection services)
{
services.TryAddSingleton();
+#pragma warning disable CS0618 // Type or member is obsolete
services.TryAddSingleton();
+#pragma warning restore CS0618 // Type or member is obsolete
services.TryAddEnumerable(
ServiceDescriptor.Transient, MvcRazorMvcViewOptionsSetup>());
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs
index 93703d49c9..496d2f9ee7 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/CSharpCompiler.cs
@@ -19,7 +19,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
public class CSharpCompiler
{
+#pragma warning disable CS0618 // Type or member is obsolete
private readonly RazorReferenceManager _referenceManager;
+#pragma warning restore CS0618 // Type or member is obsolete
private readonly IHostingEnvironment _hostingEnvironment;
private bool _optionsInitialized;
private CSharpParseOptions _parseOptions;
@@ -27,7 +29,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
private EmitOptions _emitOptions;
private bool _emitPdb;
+#pragma warning disable CS0618 // Type or member is obsolete
public CSharpCompiler(RazorReferenceManager manager, IHostingEnvironment hostingEnvironment)
+#pragma warning restore CS0618 // Type or member is obsolete
{
_referenceManager = manager ?? throw new ArgumentNullException(nameof(manager));
_hostingEnvironment = hostingEnvironment ?? throw new ArgumentNullException(nameof(hostingEnvironment));
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs
index f1d59ef770..04965e52a4 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/DefaultRazorReferenceManager.cs
@@ -11,7 +11,9 @@ using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
+#pragma warning disable CS0618 // Type or member is obsolete
public class DefaultRazorReferenceManager : RazorReferenceManager
+#pragma warning restore CS0618 // Type or member is obsolete
{
private readonly ApplicationPartManager _partManager;
private readonly IList _additionalMetadataReferences;
@@ -24,7 +26,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
IOptions optionsAccessor)
{
_partManager = partManager;
+#pragma warning disable CS0618 // Type or member is obsolete
_additionalMetadataReferences = optionsAccessor.Value.AdditionalCompilationReferences;
+#pragma warning restore CS0618 // Type or member is obsolete
}
public override IReadOnlyList CompilationReferences
@@ -41,7 +45,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
private IReadOnlyList GetCompilationReferences()
{
+#pragma warning disable CS0618 // Type or member is obsolete
var feature = new MetadataReferenceFeature();
+#pragma warning restore CS0618 // Type or member is obsolete
_partManager.PopulateFeature(feature);
var applicationReferences = feature.MetadataReferences;
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs
index ead4b29630..5479991463 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/LazyMetadataReferenceFeature.cs
@@ -11,9 +11,13 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
public class LazyMetadataReferenceFeature : IMetadataReferenceFeature
{
+#pragma warning disable CS0618 // Type or member is obsolete
private readonly RazorReferenceManager _referenceManager;
+#pragma warning restore CS0618 // Type or member is obsolete
+#pragma warning disable CS0618 // Type or member is obsolete
public LazyMetadataReferenceFeature(RazorReferenceManager referenceManager)
+#pragma warning restore CS0618 // Type or member is obsolete
{
_referenceManager = referenceManager;
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs
index 4ef67017d1..560b1493d6 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/Internal/RazorViewCompilerProvider.cs
@@ -75,7 +75,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
_fileProviderAccessor.FileProvider,
_razorProjectEngine,
_csharpCompiler,
+#pragma warning disable CS0618 // Type or member is obsolete
_viewEngineOptions.CompilationCallback,
+#pragma warning restore CS0618 // Type or member is obsolete
feature.ViewDescriptors,
_compilationMemoryCacheProvider.CompilationMemoryCache,
_logger);
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
index 532c924d32..8ae0120211 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/RazorViewEngineOptions.cs
@@ -157,6 +157,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
/// Gets the instances that should be included in Razor compilation, along with
/// those discovered by s.
///
+ [Obsolete("This property is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
public IList AdditionalCompilationReferences { get; } = new List();
///
@@ -166,6 +167,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor
///
/// Customizations made here would not reflect in tooling (Intellisense).
///
+ [Obsolete("This property is obsolete and will be removed in a future version. See https://aka.ms/AA1x4gg for details.")]
public Action CompilationCallback
{
get => _compilationCallback;
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
index 07054bed8a..2d3b8b9456 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/LinkTagHelper.cs
@@ -257,8 +257,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
// not function properly.
Href = output.Attributes[HrefAttributeName]?.Value as string;
- Mode mode;
- if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out mode))
+ if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out var mode))
{
// No attributes matched so we have nothing to do
return;
@@ -295,8 +294,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
if (mode == Mode.Fallback && HasStyleSheetLinkType(output.Attributes))
{
- string resolvedUrl;
- if (TryResolveUrl(FallbackHref, resolvedUrl: out resolvedUrl))
+ if (TryResolveUrl(FallbackHref, resolvedUrl: out string resolvedUrl))
{
FallbackHref = resolvedUrl;
}
@@ -395,17 +393,15 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
private bool HasStyleSheetLinkType(TagHelperAttributeList attributes)
{
- TagHelperAttribute relAttribute;
- if (!attributes.TryGetAttribute(RelAttributeName, out relAttribute) ||
+ if (!attributes.TryGetAttribute(RelAttributeName, out var relAttribute) ||
relAttribute.Value == null)
{
return false;
}
var attributeValue = relAttribute.Value;
- var contentValue = attributeValue as IHtmlContent;
var stringValue = attributeValue as string;
- if (contentValue != null)
+ if (attributeValue is IHtmlContent contentValue)
{
contentValue.WriteTo(StringWriter, HtmlEncoder);
stringValue = StringWriter.ToString();
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs b/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
index 3d0ca2d33f..15f7323db3 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/ScriptTagHelper.cs
@@ -221,8 +221,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
// not function properly.
Src = output.Attributes[SrcAttributeName]?.Value as string;
- Mode mode;
- if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out mode))
+ if (!AttributeMatcher.TryDetermineMode(context, ModeDetails, Compare, out var mode))
{
// No attributes matched so we have nothing to do
return;
@@ -259,8 +258,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers
if (mode == Mode.Fallback)
{
- string resolvedUrl;
- if (TryResolveUrl(FallbackSrc, resolvedUrl: out resolvedUrl))
+ if (TryResolveUrl(FallbackSrc, resolvedUrl: out string resolvedUrl))
{
FallbackSrc = resolvedUrl;
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/MetadataReferenceFeatureProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/MetadataReferenceFeatureProviderTest.cs
index fe05fdb561..8f9653c70d 100644
--- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/MetadataReferenceFeatureProviderTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Compilation/MetadataReferenceFeatureProviderTest.cs
@@ -8,6 +8,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
{
+#pragma warning disable CS0618 // Type or member is obsolete
public class MetadataReferenceFeatureProviderTest
{
[Fact]
@@ -48,4 +49,5 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
reference => reference.Display.Equals(currentAssembly.Location));
}
}
+#pragma warning restore CS0618 // Type or member is obsolete
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcCoreBuilderExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcCoreBuilderExtensionsTest.cs
index 6ea2e2afb5..bb0ae3360b 100644
--- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcCoreBuilderExtensionsTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/DependencyInjection/MvcRazorMvcCoreBuilderExtensionsTest.cs
@@ -66,7 +66,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.DependencyInjection
builder.AddRazorViewEngine();
// Assert
+#pragma warning disable CS0618 // Type or member is obsolete
Assert.Single(builder.PartManager.FeatureProviders.OfType());
+#pragma warning restore CS0618 // Type or member is obsolete
}
[Fact]
@@ -83,7 +85,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.DependencyInjection
builder.AddRazorViewEngine();
// Assert
+#pragma warning disable CS0618 // Type or member is obsolete
Assert.Single(builder.PartManager.FeatureProviders.OfType());
+#pragma warning restore CS0618 // Type or member is obsolete
}
[Fact]
@@ -92,7 +96,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.DependencyInjection
// Arrange
var services = new ServiceCollection();
var builder = services.AddMvcCore();
+#pragma warning disable CS0618 // Type or member is obsolete
var metadataReferenceFeatureProvider = new MetadataReferenceFeatureProvider();
+#pragma warning restore CS0618 // Type or member is obsolete
builder.PartManager.FeatureProviders.Add(metadataReferenceFeatureProvider);
// Act
@@ -100,7 +106,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.DependencyInjection
// Assert
var actual = Assert.Single(
- builder.PartManager.FeatureProviders.OfType());
+#pragma warning disable CS0618 // Type or member is obsolete
+ collection: builder.PartManager.FeatureProviders.OfType());
+#pragma warning restore CS0618 // Type or member is obsolete
Assert.Same(metadataReferenceFeatureProvider, actual);
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/CSharpCompilerTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/CSharpCompilerTest.cs
index 3faddaa0e6..8c3440db2a 100644
--- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/CSharpCompilerTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/CSharpCompilerTest.cs
@@ -17,6 +17,10 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
public class CSharpCompilerTest
{
+#pragma warning disable CS0618 // Type or member is obsolete
+ private readonly RazorReferenceManager ReferenceManager = Mock.Of();
+#pragma warning restore CS0618 // Type or member is obsolete
+
[Theory]
[InlineData(null)]
[InlineData("")]
@@ -24,8 +28,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
// Arrange
var hostingEnvironment = Mock.Of(e => e.ApplicationName == name);
- var referenceManager = Mock.Of();
- var compiler = new CSharpCompiler(referenceManager, hostingEnvironment);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment);
// Act
var options = compiler.GetDependencyContextCompilationOptions();
@@ -41,8 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
var hostingEnvironment = new Mock();
hostingEnvironment.SetupGet(e => e.ApplicationName)
.Returns(typeof(Controller).GetTypeInfo().Assembly.GetName().Name);
- var referenceManager = Mock.Of();
- var compiler = new CSharpCompiler(referenceManager, hostingEnvironment.Object);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment.Object);
// Act
var options = compiler.GetDependencyContextCompilationOptions();
@@ -58,7 +60,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
var hostingEnvironment = new Mock();
hostingEnvironment.SetupGet(e => e.ApplicationName)
.Returns(GetType().GetTypeInfo().Assembly.GetName().Name);
- var compiler = new CSharpCompiler(Mock.Of(), hostingEnvironment.Object);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment.Object);
// Act & Assert
var parseOptions = compiler.ParseOptions;
@@ -78,7 +80,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
var hostingEnvironment = new Mock();
hostingEnvironment.SetupGet(e => e.EnvironmentName)
.Returns(environment);
- var compiler = new CSharpCompiler(Mock.Of(), hostingEnvironment.Object);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment.Object);
// Act & Assert
var compilationOptions = compiler.CSharpCompilationOptions;
@@ -96,7 +98,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
var hostingEnvironment = new Mock();
hostingEnvironment.SetupGet(e => e.EnvironmentName)
.Returns(environment);
- var compiler = new CSharpCompiler(Mock.Of(), hostingEnvironment.Object);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment.Object);
// Act & Assert
var parseOptions = compiler.ParseOptions;
@@ -108,7 +110,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
// Arrange
var hostingEnvironment = Mock.Of(h => h.EnvironmentName == "Development");
- var compiler = new CSharpCompiler(Mock.Of(), hostingEnvironment);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment);
// Act & Assert
var compilationOptions = compiler.CSharpCompilationOptions;
@@ -138,7 +140,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
{
// Arrange
var hostingEnvironment = Mock.Of(h => h.EnvironmentName == "Development");
- var compiler = new CSharpCompiler(Mock.Of(), hostingEnvironment);
+ var compiler = new CSharpCompiler(ReferenceManager, hostingEnvironment);
// Act & Assert
var parseOptions = compiler.ParseOptions;
@@ -163,10 +165,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var compilationOptions = compiler.ParseOptions;
@@ -191,10 +192,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: "portable",
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var emitOptions = compiler.EmitOptions;
@@ -219,10 +219,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: "embedded",
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var emitOptions = compiler.EmitOptions;
@@ -247,10 +246,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: "none",
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
Assert.False(compiler.EmitPdb);
@@ -273,10 +271,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var compilationOptions = compiler.CSharpCompilationOptions;
@@ -300,10 +297,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var compilationOptions = compiler.CSharpCompilationOptions;
@@ -327,10 +323,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var compilationOptions = compiler.CSharpCompilationOptions;
@@ -354,10 +349,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act & Assert
var parseOptions = compiler.ParseOptions;
@@ -383,9 +377,8 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
debugType: null,
emitEntryPoint: null,
generateXmlDocumentation: null);
- var referenceManager = Mock.Of();
var hostingEnvironment = Mock.Of();
- var compiler = new TestCSharpCompiler(referenceManager, hostingEnvironment, dependencyContextOptions);
+ var compiler = new TestCSharpCompiler(ReferenceManager, hostingEnvironment, dependencyContextOptions);
// Act
var syntaxTree = compiler.CreateSyntaxTree(SourceText.From(content));
@@ -399,7 +392,9 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Internal
private readonly DependencyContextCompilationOptions _options;
public TestCSharpCompiler(
+#pragma warning disable CS0618 // Type or member is obsolete
RazorReferenceManager referenceManager,
+#pragma warning restore CS0618 // Type or member is obsolete
IHostingEnvironment hostingEnvironment,
DependencyContextCompilationOptions options)
: base(referenceManager, hostingEnvironment)
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRazorReferenceManagerTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRazorReferenceManagerTest.cs
index dc8cd4a3d0..c6435cd36e 100644
--- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRazorReferenceManagerTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/DefaultRazorReferenceManagerTest.cs
@@ -12,6 +12,7 @@ using Xunit;
namespace Microsoft.AspNetCore.Mvc.Razor.Test.Internal
{
+#pragma warning disable CS0618 // Type or member is obsolete
public class DefaultRazorReferenceManagerTest
{
[Fact]
@@ -52,4 +53,5 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Test.Internal
return applicationPartManager;
}
}
+#pragma warning restore CS0618 // Type or member is obsolete
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs
index 21840806ba..0c68fed85f 100644
--- a/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Razor.Test/Internal/RazorViewCompilerTest.cs
@@ -824,7 +824,9 @@ this should fail";
private static TestRazorViewCompiler GetViewCompiler(
TestFileProvider fileProvider = null,
Action compilationCallback = null,
+#pragma warning disable CS0618 // Type or member is obsolete
RazorReferenceManager referenceManager = null,
+#pragma warning restore CS0618 // Type or member is obsolete
IList precompiledViews = null,
CSharpCompiler csharpCompiler = null)
{
@@ -858,6 +860,7 @@ this should fail";
return viewCompiler;
}
+#pragma warning disable CS0618 // Type or member is obsolete
private static RazorReferenceManager CreateReferenceManager(IOptions options)
{
var applicationPartManager = new ApplicationPartManager();
@@ -867,6 +870,7 @@ this should fail";
return new DefaultRazorReferenceManager(applicationPartManager, options);
}
+#pragma warning restore CS0618 // Type or member is obsolete
private class TestRazorViewCompiler : RazorViewCompiler
{
@@ -900,7 +904,9 @@ this should fail";
private class TestCSharpCompiler : CSharpCompiler
{
+#pragma warning disable CS0618 // Type or member is obsolete
public TestCSharpCompiler(RazorReferenceManager manager, IHostingEnvironment hostingEnvironment)
+#pragma warning restore CS0618 // Type or member is obsolete
: base(manager, hostingEnvironment)
{
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
index a9fa6f7d9c..f2700f2a97 100644
--- a/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Test/MvcServiceCollectionExtensionsTest.cs
@@ -214,7 +214,9 @@ namespace Microsoft.AspNetCore.Mvc
Assert.Collection(manager.FeatureProviders,
feature => Assert.IsType(feature),
feature => Assert.IsType(feature),
+#pragma warning disable CS0618 // Type or member is obsolete
feature => Assert.IsType(feature),
+#pragma warning restore CS0618 // Type or member is obsolete
feature => Assert.IsType(feature),
feature => Assert.IsType(feature),
#pragma warning disable CS0618 // Type or member is obsolete
diff --git a/test/WebSites/ControllersFromServicesWebSite/AssemblyMetadataReferenceFeatureProvider.cs b/test/WebSites/ControllersFromServicesWebSite/AssemblyMetadataReferenceFeatureProvider.cs
index 99c96ceb38..63f1877a45 100644
--- a/test/WebSites/ControllersFromServicesWebSite/AssemblyMetadataReferenceFeatureProvider.cs
+++ b/test/WebSites/ControllersFromServicesWebSite/AssemblyMetadataReferenceFeatureProvider.cs
@@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis;
namespace ControllersFromServicesWebSite
{
+#pragma warning disable CS0618 // Type or member is obsolete
public class AssemblyMetadataReferenceFeatureProvider : IApplicationFeatureProvider
{
public void PopulateFeature(IEnumerable parts, MetadataReferenceFeature feature)
@@ -17,4 +18,5 @@ namespace ControllersFromServicesWebSite
feature.MetadataReferences.Add(MetadataReference.CreateFromFile(currentAssembly.Location));
}
}
+#pragma warning restore CS0618 // Type or member is obsolete
}