I have a _Layout.cshtml file that contains the following line.
@RenderSection("Scripts", required: false)
And then I have a StorageLayout.cshtml file that specifies _Layout.cshtml as the layout file. StorageLayout.cshtml defines the MainMenu section and contains @RenderBody().
But then my page that uses StorageLayout.cshtml as the layout file gives me an error:
InvalidOperationException: The following sections have been defined but have not been rendered by the page at '/Pages/Shared/_StorageLayout.cshtml': 'Scripts'. To ignore an unrendered section call IgnoreSection("sectionName").
I'm not sure I understand this. The Scripts section is explicitly not required, so why is it an error? And, for that matter, what would be the correct way to implement this section in nested layout files?