diff --git a/src/Microsoft.AspNetCore.Mvc.Abstractions/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Abstractions/baseline.netcore.json
index 8463c95ddf..3aa89a7a76 100644
--- a/src/Microsoft.AspNetCore.Mvc.Abstractions/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Abstractions/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Abstractions, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.ActionContext",
diff --git a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/baseline.netcore.json
index 8b8fbb0648..eb22f9fc45 100644
--- a/src/Microsoft.AspNetCore.Mvc.ApiExplorer/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.ApiExplorer/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.ApiExplorer, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.ApiExplorer, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.ApiExplorer.ApiDescriptionExtensions",
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartFactory.cs
index 6524ba6bae..71dc6a0b41 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartFactory.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartFactory.cs
@@ -19,27 +19,17 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
///
public abstract class ApplicationPartFactory
{
- public static readonly string DefaultContextName = "Default";
-
- ///
- /// Default implementation for .
- ///
- public static ApplicationPartFactory Default { get; } = new DefaultApplicationPartFactory();
-
///
/// Gets one or more instances for the specified .
///
/// The .
- ///
- /// The context name. By default, value of this parameter is .
- ///
- public abstract IEnumerable GetApplicationParts(Assembly assembly, string context);
+ public abstract IEnumerable GetApplicationParts(Assembly assembly);
///
/// Gets the for the specified assembly.
///
/// An assembly may specify an using .
- /// Otherwise, is used.
+ /// Otherwise, is used.
///
///
/// The .
@@ -54,7 +44,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
var provideAttribute = assembly.GetCustomAttribute();
if (provideAttribute == null)
{
- return ApplicationPartFactory.Default;
+ return DefaultApplicationPartFactory.Instance;
}
var type = provideAttribute.GetFactoryType();
@@ -68,18 +58,5 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
return (ApplicationPartFactory)Activator.CreateInstance(type);
}
-
- private class DefaultApplicationPartFactory : ApplicationPartFactory
- {
- public override IEnumerable GetApplicationParts(Assembly assembly, string context)
- {
- if (assembly == null)
- {
- throw new ArgumentNullException(nameof(assembly));
- }
-
- yield return new AssemblyPart(assembly);
- }
- }
}
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartManager.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartManager.cs
index 3de5a48338..1636c61df7 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartManager.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/ApplicationPartManager.cs
@@ -59,7 +59,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
foreach (var assembly in applicationAssemblies)
{
var partFactory = ApplicationPartFactory.GetApplicationPartFactory(assembly);
- foreach (var part in partFactory.GetApplicationParts(assembly, context: ApplicationPartFactory.DefaultContextName))
+ foreach (var part in partFactory.GetApplicationParts(assembly))
{
ApplicationParts.Add(part);
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/DefaultApplicationPartFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/DefaultApplicationPartFactory.cs
new file mode 100644
index 0000000000..60a08f7974
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/DefaultApplicationPartFactory.cs
@@ -0,0 +1,44 @@
+// 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 System.Reflection;
+
+namespace Microsoft.AspNetCore.Mvc.ApplicationParts
+{
+ ///
+ /// Default .
+ ///
+ public class DefaultApplicationPartFactory : ApplicationPartFactory
+ {
+ ///
+ /// Gets an instance of .
+ ///
+ public static DefaultApplicationPartFactory Instance { get; } = new DefaultApplicationPartFactory();
+
+ ///
+ /// Gets the sequence of instances that are created by this instance of .
+ ///
+ /// Applications may use this method to get the same behavior as this factory produces during MVC's default part discovery.
+ ///
+ ///
+ /// The .
+ /// The sequence of instances.
+ public static IEnumerable GetDefaultApplicationParts(Assembly assembly)
+ {
+ if (assembly == null)
+ {
+ throw new ArgumentNullException(nameof(assembly));
+ }
+
+ yield return new AssemblyPart(assembly);
+ }
+
+ ///
+ public override IEnumerable GetApplicationParts(Assembly assembly)
+ {
+ return GetDefaultApplicationParts(assembly);
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/NullApplicationPartFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/NullApplicationPartFactory.cs
index 06e48018e5..6fe7ff39ff 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/NullApplicationPartFactory.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/NullApplicationPartFactory.cs
@@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
public class NullApplicationPartFactory : ApplicationPartFactory
{
///
- public override IEnumerable GetApplicationParts(Assembly assembly, string context)
+ public override IEnumerable GetApplicationParts(Assembly assembly)
{
return Enumerable.Empty();
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/RelatedAssemblyAttribute.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/RelatedAssemblyAttribute.cs
index aa796cdb55..b9f6cdb2d7 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/RelatedAssemblyAttribute.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationParts/RelatedAssemblyAttribute.cs
@@ -50,10 +50,14 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
throw new ArgumentNullException(nameof(assembly));
}
- return GetRelatedAssemblies(assembly, throwOnError, AssemblyLoadFileDelegate);
+ return GetRelatedAssemblies(assembly, throwOnError, File.Exists, AssemblyLoadFileDelegate);
}
- internal static IReadOnlyList GetRelatedAssemblies(Assembly assembly, bool throwOnError, Func loadFile)
+ internal static IReadOnlyList GetRelatedAssemblies(
+ Assembly assembly,
+ bool throwOnError,
+ Func fileExists,
+ Func loadFile)
{
if (assembly == null)
{
@@ -74,7 +78,8 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
}
var assemblyName = assembly.GetName().Name;
- var assemblyDirectory = Path.GetDirectoryName(assembly.CodeBase);
+ var assemblyLocation = GetAssemblyLocation(assembly);
+ var assemblyDirectory = Path.GetDirectoryName(assemblyLocation);
var relatedAssemblies = new List();
for (var i = 0; i < attributes.Length; i++)
@@ -87,7 +92,7 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
}
var relatedAssemblyLocation = Path.Combine(assemblyDirectory, attribute.AssemblyFileName + ".dll");
- if (!File.Exists(relatedAssemblyLocation))
+ if (!fileExists(relatedAssemblyLocation))
{
if (throwOnError)
{
@@ -107,5 +112,15 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
return relatedAssemblies;
}
+
+ internal static string GetAssemblyLocation(Assembly assembly)
+ {
+ if (Uri.TryCreate(assembly.CodeBase, UriKind.Absolute, out var result) && result.IsFile)
+ {
+ return result.LocalPath;
+ }
+
+ return assembly.Location;
+ }
}
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Core/baseline.netcore.json
index d139d0ebb6..3ce4e5517f 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Core/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Core, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Builder.MvcApplicationBuilderExtensions",
@@ -19488,6 +19488,11 @@
"Name": "etag",
"Type": "Microsoft.Net.Http.Headers.EntityTagHeaderValue",
"DefaultValue": "null"
+ },
+ {
+ "Name": "enableRangeProcessing",
+ "Type": "System.Boolean",
+ "DefaultValue": "True"
}
],
"ReturnType": "System.ValueTuple",
diff --git a/src/Microsoft.AspNetCore.Mvc.Cors/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Cors/baseline.netcore.json
index 9cb6f11a5c..6f857b41c5 100644
--- a/src/Microsoft.AspNetCore.Mvc.Cors/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Cors/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Cors, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Cors, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.Extensions.DependencyInjection.MvcCorsMvcCoreBuilderExtensions",
diff --git a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/baseline.netcore.json
index b55e227cd8..b2daa8e4ff 100644
--- a/src/Microsoft.AspNetCore.Mvc.DataAnnotations/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.DataAnnotations/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.DataAnnotations, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.DataAnnotations, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.HiddenInputAttribute",
diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/baseline.netcore.json
index 3f0d0b0f49..46e30719ac 100644
--- a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Formatters.Json, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Formatters.Json, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.JsonPatchExtensions",
@@ -366,6 +366,14 @@
"Visibility": "Protected",
"GenericParameter": []
},
+ {
+ "Kind": "Method",
+ "Name": "get_PublicSerializerSettings",
+ "Parameters": [],
+ "ReturnType": "Newtonsoft.Json.JsonSerializerSettings",
+ "Visibility": "Public",
+ "GenericParameter": []
+ },
{
"Kind": "Method",
"Name": "WriteObject",
diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/baseline.netcore.json
index a6b0e5e2df..999ceb982b 100644
--- a/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Formatters.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Formatters.Xml, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DataMemberRequiredBindingMetadataProvider",
diff --git a/src/Microsoft.AspNetCore.Mvc.Localization/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Localization/baseline.netcore.json
index ad3f54cf30..07fa9302db 100644
--- a/src/Microsoft.AspNetCore.Mvc.Localization/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Localization/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Localization, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Localization, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.Localization.HtmlLocalizer",
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/CompiledRazorAssemblyApplicationPartFactory.cs b/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/CompiledRazorAssemblyApplicationPartFactory.cs
index d4b4243592..daee08d222 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/CompiledRazorAssemblyApplicationPartFactory.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/ApplicationParts/CompiledRazorAssemblyApplicationPartFactory.cs
@@ -12,8 +12,15 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
///
public class CompiledRazorAssemblyApplicationPartFactory : ApplicationPartFactory
{
- ///
- public override IEnumerable GetApplicationParts(Assembly assembly, string configuration)
+ ///
+ /// Gets the sequence of instances that are created by this instance of .
+ ///
+ /// Applications may use this method to get the same behavior as this factory produces during MVC's default part discovery.
+ ///
+ ///
+ /// The .
+ /// The sequence of instances.
+ public static IEnumerable GetDefaultApplicationParts(Assembly assembly)
{
if (assembly == null)
{
@@ -22,5 +29,8 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
yield return new CompiledRazorAssemblyPart(assembly);
}
+
+ ///
+ public override IEnumerable GetApplicationParts(Assembly assembly) => GetDefaultApplicationParts(assembly);
}
}
diff --git a/src/Microsoft.AspNetCore.Mvc.Razor/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Razor/baseline.netcore.json
index a6d672cd17..8bb444c938 100644
--- a/src/Microsoft.AspNetCore.Mvc.Razor/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Razor/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.Razor, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.Razor.HelperResult",
diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.RazorPages/baseline.netcore.json
index 53420dc594..f09d520e8e 100644
--- a/src/Microsoft.AspNetCore.Mvc.RazorPages/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.RazorPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.RazorPages, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.Internal.MvcRazorPagesDiagnosticSourceExtensions",
diff --git a/src/Microsoft.AspNetCore.Mvc.TagHelpers/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.TagHelpers/baseline.netcore.json
index 0769735973..a18e83fff7 100644
--- a/src/Microsoft.AspNetCore.Mvc.TagHelpers/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.TagHelpers/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.TagHelpers, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary",
diff --git a/src/Microsoft.AspNetCore.Mvc.Testing/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.Testing/baseline.netcore.json
index 7a73a41bfd..9e26dfeeb6 100644
--- a/src/Microsoft.AspNetCore.Mvc.Testing/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Testing/baseline.netcore.json
@@ -1,2 +1 @@
-{
-}
\ No newline at end of file
+{}
\ No newline at end of file
diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/baseline.netcore.json
index 585377619c..3307f2ac69 100644
--- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.ViewFeatures, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.ViewFeatures, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.AspNetCore.Mvc.AutoValidateAntiforgeryTokenAttribute",
@@ -17816,7 +17816,7 @@
},
{
"Kind": "Method",
- "Name": "DateTimeInputTemplate",
+ "Name": "DateTimeOffsetTemplate",
"Parameters": [
{
"Name": "htmlHelper",
diff --git a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json
index 0c6895d69e..6e5fbd84f8 100644
--- a/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.WebApiCompatShim/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.WebApiCompatShim, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc.WebApiCompatShim, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "System.Net.Http.HttpRequestMessageExtensions",
diff --git a/src/Microsoft.AspNetCore.Mvc/baseline.netcore.json b/src/Microsoft.AspNetCore.Mvc/baseline.netcore.json
index a845f84d38..c6b3ff95ff 100644
--- a/src/Microsoft.AspNetCore.Mvc/baseline.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc/baseline.netcore.json
@@ -1,5 +1,5 @@
{
- "AssemblyIdentity": "Microsoft.AspNetCore.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
+ "AssemblyIdentity": "Microsoft.AspNetCore.Mvc, Version=2.0.3.0, Culture=neutral, PublicKeyToken=adb9793829ddae60",
"Types": [
{
"Name": "Microsoft.Extensions.DependencyInjection.MvcServiceCollectionExtensions",
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/RelatedAssemblyPartTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/RelatedAssemblyPartTest.cs
index 8f3bbdb47c..efce8dfaad 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/RelatedAssemblyPartTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationParts/RelatedAssemblyPartTest.cs
@@ -67,20 +67,46 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
};
var relatedAssembly = typeof(RelatedAssemblyPartTest).Assembly;
- try
+ var result = RelatedAssemblyAttribute.GetRelatedAssemblies(assembly, throwOnError: true, file => true, file =>
{
- File.WriteAllBytes(destination, new byte[0]);
- var result = RelatedAssemblyAttribute.GetRelatedAssemblies(assembly, throwOnError: true, file =>
- {
- Assert.Equal(file, destination);
- return relatedAssembly;
- });
- Assert.Equal(new[] { relatedAssembly }, result);
- }
- finally
+ Assert.Equal(file, destination);
+ return relatedAssembly;
+ });
+ Assert.Equal(new[] { relatedAssembly }, result);
+ }
+
+ [Fact]
+ public void GetAssemblyLocation_UsesCodeBase()
+ {
+ // Arrange
+ var destination = Path.Combine(AssemblyDirectory, "RelatedAssembly.dll");
+ var codeBase = "file://x/file/Assembly.dll";
+ var expected = new Uri(codeBase).LocalPath;
+ var assembly = new TestAssembly
{
- File.Delete(destination);
- }
+ CodeBaseSettable = codeBase,
+ };
+
+ // Act
+ var actual = RelatedAssemblyAttribute.GetAssemblyLocation(assembly);
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void GetAssemblyLocation_UsesLocation_IfCodeBaseIsNotLocal()
+ {
+ // Arrange
+ var destination = Path.Combine(AssemblyDirectory, "RelatedAssembly.dll");
+ var expected = Path.Combine(AssemblyDirectory, "Some-Dir", "Assembly.dll");
+ var assembly = new TestAssembly
+ {
+ CodeBaseSettable = "https://www.microsoft.com/test.dll",
+ LocationSettable = expected,
+ };
+
+ // Act
+ var actual = RelatedAssemblyAttribute.GetAssemblyLocation(assembly);
+ Assert.Equal(expected, actual);
}
private class TestAssembly : Assembly
@@ -92,7 +118,13 @@ namespace Microsoft.AspNetCore.Mvc.ApplicationParts
public string AttributeAssembly { get; set; }
- public override string CodeBase => Path.Combine(AssemblyDirectory, "MyAssembly.dll");
+ public string CodeBaseSettable { get; set; } = Path.Combine(AssemblyDirectory, "MyAssembly.dll");
+
+ public override string CodeBase => CodeBaseSettable;
+
+ public string LocationSettable { get; set; } = Path.Combine(AssemblyDirectory, "MyAssembly.dll");
+
+ public override string Location => LocationSettable;
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
{