parent
ce53675b87
commit
e749a80b30
|
|
@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
|||
protected virtual Type GetViewInfoContainerType(AssemblyPart assemblyPart)
|
||||
{
|
||||
#if NETSTANDARD1_6
|
||||
if (!assemblyPart.Assembly.IsDynamic && assemblyPart.Assembly.Location != null)
|
||||
if (!assemblyPart.Assembly.IsDynamic && !string.IsNullOrEmpty(assemblyPart.Assembly.Location))
|
||||
{
|
||||
var precompiledAssemblyFileName = assemblyPart.Assembly.GetName().Name
|
||||
+ PrecompiledViewsAssemblySuffix
|
||||
|
|
|
|||
|
|
@ -90,6 +90,23 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
|||
Assert.Empty(feature.Views);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PopulateFeature_DoesNotFail_IfAssemblyHasEmptyLocation()
|
||||
{
|
||||
// Arrange
|
||||
var assembly = new AssemblyWithEmptyLocation();
|
||||
var applicationPartManager = new ApplicationPartManager();
|
||||
applicationPartManager.ApplicationParts.Add(new AssemblyPart(assembly));
|
||||
applicationPartManager.FeatureProviders.Add(new ViewsFeatureProvider());
|
||||
var feature = new ViewsFeature();
|
||||
|
||||
// Act
|
||||
applicationPartManager.PopulateFeature(feature);
|
||||
|
||||
// Assert
|
||||
Assert.Empty(feature.Views);
|
||||
}
|
||||
|
||||
private class TestableViewsFeatureProvider : ViewsFeatureProvider
|
||||
{
|
||||
private readonly Dictionary<AssemblyPart, Type> _containerLookup;
|
||||
|
|
@ -125,5 +142,12 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
|
|||
{
|
||||
}
|
||||
}
|
||||
|
||||
private class AssemblyWithEmptyLocation : Assembly
|
||||
{
|
||||
public override string Location => string.Empty;
|
||||
|
||||
public override string FullName => typeof(ViewsFeatureProviderTest).GetTypeInfo().Assembly.FullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue