Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
addressed feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaybhargavb committed Mar 20, 2015
1 parent 6a6c0d4 commit 82603b0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Microsoft.AspNet.Mvc.Razor/RazorView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private async Task RenderLayoutAsync(ViewContext context,
// A layout page can specify another layout page. We'll need to continue
// looking for layout pages until they're no longer specified.
var previousPage = RazorPage;
var unRenderedSections = new HashSet<string>();
var unrenderedSections = new HashSet<string>();

while (!string.IsNullOrEmpty(previousPage.Layout))
{
Expand All @@ -197,17 +197,16 @@ private async Task RenderLayoutAsync(ViewContext context,
// Verify that RenderBody is called
layoutPage.EnsureBodyWasRendered();

unRenderedSections.ExceptWith(layoutPage.RenderedSections);
unRenderedSections.UnionWith(layoutPage.PreviousSectionWriters.Keys.Except(layoutPage.RenderedSections,
StringComparer.OrdinalIgnoreCase));
unrenderedSections.UnionWith(layoutPage.PreviousSectionWriters.Keys);
unrenderedSections.ExceptWith(layoutPage.RenderedSections);

previousPage = layoutPage;
}

// If not all sections are rendered, throw.
if (unRenderedSections.Any())
if (unrenderedSections.Any())
{
var sectionNames = string.Join(", ", unRenderedSections);
var sectionNames = string.Join(", ", unrenderedSections);
throw new InvalidOperationException(Resources.FormatSectionsNotRendered(sectionNames));
}

Expand Down

0 comments on commit 82603b0

Please sign in to comment.