question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Layout not rendered when using await IncludeAsync using .NET Core 3

See original GitHub issue

Describe the bug Layout not being rendered when using await IncludeAsync using .NET Core 3.

To Reproduce The following code does not render the layout.

@inherits RazorLight.TemplatePage<MyModel>
@{
    Layout = "_Layout.cshtml";
}
<p>
    @{

        await IncludeAsync("_LetterHeader.cshtml", Model);
    }

</p>

Note that MyModel implements an interface that is accepted by _LetterHeader.cshtml, but I assume that this is not the issue as the letter header renders fine.

The following does render the layout.

@inherits RazorLight.TemplatePage<MyModel>
@{
    Layout = "_Layout.cshtml";
}
<p>Hello</p>

Expected behavior The layout should be rendered when using await IncludeAsync.

Information (please complete the following information):

  • OS: Windows 10
  • Platform: .NET Core 3.0
  • RazorLight version: current branch as at 28/11/2019
  • Visual Studio version: Visual Studio Community 2019 16.3.4

Additional context None

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
matthewwrencommented, Jan 13, 2020

I believe I have successfully created a Pull Request. Please let me know if that is how you wanted it done. thanks.

2reactions
ronnypmuliawancommented, Jan 6, 2020

Hi all, the Layout is also not rendering on ASP.NET Core 2.2 project.

@jzabroski any timeline to fix this issue or workaround that I can implement?

Information (please complete the following information):

OS: Windows 10 Platform: ASP.NET Core 2.2 RazorLight version: 2.0.0-beta.4 Visual Studio version: Visual Studio Pro 2019 16.4.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Use of await in Razor views
There is a trick you can use to sort of implicitly load data async into the View. First, you define a class that...
Read more >
view Component rendered early not waiting for await ...
Hi I am using first time view Component in my Dotnet core application to get API result data to view. I have created...
Read more >
RazorLight
Use Razor to build templates from Files / EmbeddedResources / Strings / Database or your custom source outside of ASP.NET MVC. No redundant...
Read more >
Using Async, Await, and Task to keep the WinForms UI ...
Using the async/await pattern in WinForms is an easy win, helping prevent one of the most annoying user experiences - a frozen UI....
Read more >
Asynchronous Programming with Async and Await in ASP. ...
In this article we are going to learn how to use async and await keywords in ASP.NET Core, making the solution more scalable....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found