dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.37k stars 9.99k forks source link

The layout view '...' could not be located #14574

Closed arex388 closed 5 years ago

arex388 commented 5 years ago

Describe the bug

I've upgraded a complex .NET Core 2.2 solution to .NET Core 3.0 over the weekend, and I am now running into somewhat random, but completely inexplicable issues when debugging the ASP.NET Core projects.

The complexity of the solution is that there are five "main" ASP.NET Core projects, and one "shared" ASP.NET Core project. The shared project is set as a class library output. It is an ASP.NET Core project so I can work with TypeScript properly, and for base views. I attempted to make a Razor Class Library before but I couldn't get it work, gave up and moved on with my life.

The shared project has some views in a Features folder, in this case _Layout.cshtml. This view is used by two other main projects.

When I attempt to run the projects from Visual Studio, F5 or CTRL+F5, I am always greeted by this exception:

InvalidOperationException: The layout view '~/Features/_Layout.cshtml' could not be located. The following locations were searched: ~/Features/_Layout.cshtml

The only thing I've found to make the exception go away is to edit the project's file and either comment or un-comment the <AddRazorMvcSupport>true</AddRazorMvcSupport> property and re-run. Making changes, rebuilding, and debugging after that works fine.

To be honest, I'm not sure if that is a real property, I saw it either in GitHub issue discussion or a SO thread and copied it over and I can't find the link to it anymore. It was part of the Razor SDK. For all I know, commenting or un-commenting anything at random in the project file will fix the issue, I just haven't tested it.

This does not appear to be an issue when the project is published in release mode to IIS. This only appears to be an issue when debugging through Visual Studio.

I cannot manually test using the CLI because I use named URLs for debugging which are required for the app's functionality, and manually running the apps gives it localhost as the URL.

Looking through the output folder, the shared project's .View.dll file is there as expected.

To Reproduce

  1. Using Windows 10, 1903 (forced me into an upgrade on Friday, was 1803 before that)
  2. Using ASP.NET Core 3.0
  3. Using Visual Studio 16.3.1
  4. Create two ASP.NET Core projects.
    • Set one to output as a class library, this is the "shared" project now.
    • Add a _Layout.cshtml file to the shared project.
    • Add a view to the other "main" project that references the layout from the shared project.

To be honest, I'm not sure if this will reproduce the error. My projects do a lot of other things such as authentication and authorization, etc., that are almost impossible to describe here without writing a book and exposing, potentially, private business logic.

The production server is Windows Server 2019, 1809 on AWS.

The bottom line is that this issue occurred as a result of either upgrading to Visual Studio 16.3 or .NET Core 3.0. This never occurred while I was on Visual Studio 16.2 and .NET Core 2.2.

Expected behavior

I expect the view in the shared project to be found and used, always.

Additional context

Here is the stack trace:

Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, string executingFilePath, string layoutPath)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, string contentType, Nullable<int> statusCode)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0<TFilter, TFilterAsync>(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext<TFilter, TFilterAsync>(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
REDACTED.Web.ApplicationUserMiddleware.InvokeAsync(HttpContext context, IApplicationUserServices services) in ApplicationUserMiddleware.cs
+
            await Next(context);
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Arex388.AspNetCore.HtmlMinifierMiddleware.InvokeAsync(HttpContext context)
Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in MiniProfilerMiddleware.cs
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
arex388 commented 5 years ago

After posting this I remembered that I thankfully made a copy of the solution before doing the upgrade to .NET Core 3.0. I restored the copy and ran it several times by closing IIS Express and CTRL+F5-ing. Each run was successful and no exception was thrown.

This rules out Visual Studio as being the culprit and points to .NET Core 3.0 exclusively, as far as I can interpret the test result.

arex388 commented 5 years ago

I've also confirmed that any random change to the project file triggers the "fix". I just tried adding an empty PropertyGroup and it was enough to stop the exception.

pranavkm commented 5 years ago

@arex388 I tried an app based on your steps - https://github.com/pranavkm/repro/tree/14574 - and I can't reproduce the view lookup failing. Could you try playing around with it to see if it's problematic for you?

One thing that might help would be turn on the logging in your application to Debug and it might provide hints as to what's causing the lookup to fail.

arex388 commented 5 years ago

@pranavkm, I added the debug logging and captured this:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://REDACTED/  
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful.
Microsoft.EntityFrameworkCore.Database.Command: Information: Executing DbCommand [Parameters=[@__identity_UserId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT [t].[Id], [t].[Name], [t].[Id0], [t0].[Hash], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
FROM (
    SELECT TOP(2) [u].[Id], [u].[Name], [p].[Id] AS [Id0]
    FROM [Users] AS [u]
    INNER JOIN [Profiles] AS [p] ON [u].[ProfileId] = [p].[Id]
    WHERE ([u].[Id] = @__identity_UserId_0) AND @__identity_UserId_0 IS NOT NULL
) AS [t]
LEFT JOIN (
    SELECT DISTINCT [p2].[Hash], [p0].[PermissionSetId], [p0].[ProfileId], [p1].[Id], [p2].[Id] AS [Id0]
    FROM [ProfilePermissionSets] AS [p0]
    INNER JOIN [PermissionSets] AS [p1] ON [p0].[PermissionSetId] = [p1].[Id]
    INNER JOIN [Permissions] AS [p2] ON [p1].[Id] = [p2].[PermissionSetId]
    WHERE [p1].[IsActive] = CAST(1 AS bit)
) AS [t0] ON [t].[Id0] = [t0].[ProfileId]
ORDER BY [t].[Id], [t].[Id0], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executing endpoint 'REDACTED'
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Route matched with {action = "Dashboard", controller = "Default"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Dashboard() on controller REDACTED.
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Information: Executing ViewResult, running view Dashboard.
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Mvc.Razor.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action REDACTED in 378.76320000000004ms
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'REDACTED'
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Arex388.AspNetCore.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.

System.InvalidOperationException: The layout view '~/Features/_Layout.cshtml' could not be located. The following locations were searched:
~/Features/_Layout.cshtml
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, String executingFilePath, String layoutPath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at REDACTED.Web.ApplicationUserMiddleware.InvokeAsync(HttpContext context, IApplicationUserServices services) in REDACTED:line 52
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Arex388.AspNetCore.HtmlMinifierMiddleware.InvokeAsync(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 107
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 912.1462ms 500 text/html; charset=utf-8

I thought it had something to do with a NuGet package I've made, Arex388.AspNetCore, because it was targeting .NET Core 2.2 and maybe that was creating conflicts. This morning I upgraded it to .NET Core 3.0, targeting the Web SDK, and updated the solution. Unfortunately, it hasn't helped.

I see a bunch of exceptions being thrown in System.Private.CoreLib.dll, but haven't a clue how to find out why they're being thrown. Do you have any recommendations? Thanks!

pranavkm commented 5 years ago

@arex388 these look like Information logs. Could you change the log level for everything in config to Debug? See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-3.0#log-filtering

arex388 commented 5 years ago

@pranavkm I changed the log level for all to Debug:

"Logging": {
    "LogLevel": {
        "Default": "Debug"
    }
}

Is this correct for what you wanted? This is what I captured. It doesn't look anymore revealing to me though:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://admin.REDACTED.local/  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: The request path / does not match a supported file type
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: 2 candidate(s) found for the request path '/'
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)' with route pattern '' is valid for the request path '/'
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Gone (REDACTED.Web.Admin)' with route pattern '{*url}' is valid for the request path '/'
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: Debug: Request matched endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: Debug: AuthenticationScheme: Identity.Application was successfully authenticated.
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful.
Microsoft.EntityFrameworkCore.Database.Command: Debug: Creating DbCommand for 'ExecuteReader'.
Microsoft.EntityFrameworkCore.Database.Command: Debug: Created DbCommand for 'ExecuteReader' (1ms).
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Opening connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Opened connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Command: Information: Executing DbCommand [Parameters=[@__identity_UserId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT [t].[Id], [t].[Name], [t].[Id0], [t0].[Hash], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
FROM (
    SELECT TOP(2) [u].[Id], [u].[Name], [p].[Id] AS [Id0]
    FROM [Users] AS [u]
    INNER JOIN [Profiles] AS [p] ON [u].[ProfileId] = [p].[Id]
    WHERE ([u].[Id] = @__identity_UserId_0) AND @__identity_UserId_0 IS NOT NULL
) AS [t]
LEFT JOIN (
    SELECT DISTINCT [p2].[Hash], [p0].[PermissionSetId], [p0].[ProfileId], [p1].[Id], [p2].[Id] AS [Id0]
    FROM [ProfilePermissionSets] AS [p0]
    INNER JOIN [PermissionSets] AS [p1] ON [p0].[PermissionSetId] = [p1].[Id]
    INNER JOIN [Permissions] AS [p2] ON [p1].[Id] = [p2].[PermissionSetId]
    WHERE [p1].[IsActive] = CAST(1 AS bit)
) AS [t0] ON [t].[Id0] = [t0].[ProfileId]
ORDER BY [t].[Id], [t].[Id0], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
Microsoft.EntityFrameworkCore.Database.Command: Debug: Executed DbCommand (71ms) [Parameters=[@__identity_UserId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT [t].[Id], [t].[Name], [t].[Id0], [t0].[Hash], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
FROM (
    SELECT TOP(2) [u].[Id], [u].[Name], [p].[Id] AS [Id0]
    FROM [Users] AS [u]
    INNER JOIN [Profiles] AS [p] ON [u].[ProfileId] = [p].[Id]
    WHERE ([u].[Id] = @__identity_UserId_0) AND @__identity_UserId_0 IS NOT NULL
) AS [t]
LEFT JOIN (
    SELECT DISTINCT [p2].[Hash], [p0].[PermissionSetId], [p0].[ProfileId], [p1].[Id], [p2].[Id] AS [Id0]
    FROM [ProfilePermissionSets] AS [p0]
    INNER JOIN [PermissionSets] AS [p1] ON [p0].[PermissionSetId] = [p1].[Id]
    INNER JOIN [Permissions] AS [p2] ON [p1].[Id] = [p2].[PermissionSetId]
    WHERE [p1].[IsActive] = CAST(1 AS bit)
) AS [t0] ON [t].[Id0] = [t0].[ProfileId]
ORDER BY [t].[Id], [t].[Id0], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
Microsoft.EntityFrameworkCore.Database.Command: Debug: A data reader was disposed.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Closing connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Closed connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executing endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Route matched with {action = "Dashboard", controller = "Default"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Dashboard() on controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin).
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of authorization filters (in the following order): None
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of resource filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of action filters (in the following order): Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter (Order: -2147483648), Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000), StackExchange.Profiling.Internal.ProfilingActionFilter (Order: 0)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of exception filters (in the following order): None
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of result filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter, StackExchange.Profiling.Internal.ProfilingActionFilter (Order: 0)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Executing controller factory for controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Executed controller factory for controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine: Debug: View lookup cache hit for view 'Dashboard' in controller 'Default'.
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Information: Executing ViewResult, running view Dashboard.
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Debug: The view path '/Features/Default/Dashboard.cshtml' was found in 1.6172ms.
Exception thrown: 'System.InvalidOperationException' in Microsoft.AspNetCore.Mvc.Razor.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin) in 301.954ms
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in Arex388.AspNetCore.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware: Debug: System.InvalidOperationException occurred, checking if Entity Framework recorded this exception as resulting from a failed database operation.
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware: Debug: Entity Framework did not record any exceptions due to failed database operations. This means the current exception is not a failed Entity Framework database operation, or the current exception occurred from a DbContext that was not obtained from request services.
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Exception thrown: 'System.InvalidOperationException' in System.Private.CoreLib.dll
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.

System.InvalidOperationException: The layout view '~/Features/_Layout.cshtml' could not be located. The following locations were searched:
~/Features/_Layout.cshtml
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.GetLayoutPage(ViewContext context, String executingFilePath, String layoutPath)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderLayoutAsync(ViewContext context, ViewBufferTextWriter bodyWriter)
   at Microsoft.AspNetCore.Mvc.Razor.RazorView.RenderAsync(ViewContext context)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ViewContext viewContext, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor.ExecuteAsync(ActionContext actionContext, IView view, ViewDataDictionary viewData, ITempDataDictionary tempData, String contentType, Nullable`1 statusCode)
   at Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
   at Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at REDACTED.Web.ApplicationUserMiddleware.InvokeAsync(HttpContext context, IApplicationUserServices services) in E:\Visual Studio\REDACTED\REDACTED.Web\Middlewares\ApplicationUserMiddleware.cs:line 52
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Arex388.AspNetCore.HtmlMinifierMiddleware.InvokeAsync(HttpContext context)
   at Arex388.AspNetCore.AntiFaviconMiddleware.InvokeAsync(HttpContext context)
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 107
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 874.8821ms 500 text/html; charset=utf-8
arex388 commented 5 years ago

And here's the successful result after editing the project file:

Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://admin.REDACTED.local/  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: The request path / does not match a supported file type
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: 2 candidate(s) found for the request path '/'
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)' with route pattern '' is valid for the request path '/'
Microsoft.AspNetCore.Routing.Matching.DfaMatcher: Debug: Endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Gone (REDACTED.Web.Admin)' with route pattern '{*url}' is valid for the request path '/'
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: Debug: Request matched endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: Debug: AuthenticationScheme: Identity.Application was successfully authenticated.
Microsoft.AspNetCore.Authorization.DefaultAuthorizationService: Information: Authorization was successful.
Microsoft.EntityFrameworkCore.Database.Command: Debug: Creating DbCommand for 'ExecuteReader'.
Microsoft.EntityFrameworkCore.Database.Command: Debug: Created DbCommand for 'ExecuteReader' (0ms).
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Opening connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Opened connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Command: Information: Executing DbCommand [Parameters=[@__identity_UserId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT [t].[Id], [t].[Name], [t].[Id0], [t0].[Hash], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
FROM (
    SELECT TOP(2) [u].[Id], [u].[Name], [p].[Id] AS [Id0]
    FROM [Users] AS [u]
    INNER JOIN [Profiles] AS [p] ON [u].[ProfileId] = [p].[Id]
    WHERE ([u].[Id] = @__identity_UserId_0) AND @__identity_UserId_0 IS NOT NULL
) AS [t]
LEFT JOIN (
    SELECT DISTINCT [p2].[Hash], [p0].[PermissionSetId], [p0].[ProfileId], [p1].[Id], [p2].[Id] AS [Id0]
    FROM [ProfilePermissionSets] AS [p0]
    INNER JOIN [PermissionSets] AS [p1] ON [p0].[PermissionSetId] = [p1].[Id]
    INNER JOIN [Permissions] AS [p2] ON [p1].[Id] = [p2].[PermissionSetId]
    WHERE [p1].[IsActive] = CAST(1 AS bit)
) AS [t0] ON [t].[Id0] = [t0].[ProfileId]
ORDER BY [t].[Id], [t].[Id0], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
Microsoft.EntityFrameworkCore.Database.Command: Debug: Executed DbCommand (70ms) [Parameters=[@__identity_UserId_0='?' (DbType = Int32)], CommandType='Text', CommandTimeout='30']
SELECT [t].[Id], [t].[Name], [t].[Id0], [t0].[Hash], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
FROM (
    SELECT TOP(2) [u].[Id], [u].[Name], [p].[Id] AS [Id0]
    FROM [Users] AS [u]
    INNER JOIN [Profiles] AS [p] ON [u].[ProfileId] = [p].[Id]
    WHERE ([u].[Id] = @__identity_UserId_0) AND @__identity_UserId_0 IS NOT NULL
) AS [t]
LEFT JOIN (
    SELECT DISTINCT [p2].[Hash], [p0].[PermissionSetId], [p0].[ProfileId], [p1].[Id], [p2].[Id] AS [Id0]
    FROM [ProfilePermissionSets] AS [p0]
    INNER JOIN [PermissionSets] AS [p1] ON [p0].[PermissionSetId] = [p1].[Id]
    INNER JOIN [Permissions] AS [p2] ON [p1].[Id] = [p2].[PermissionSetId]
    WHERE [p1].[IsActive] = CAST(1 AS bit)
) AS [t0] ON [t].[Id0] = [t0].[ProfileId]
ORDER BY [t].[Id], [t].[Id0], [t0].[PermissionSetId], [t0].[ProfileId], [t0].[Id], [t0].[Id0]
Microsoft.EntityFrameworkCore.Database.Command: Debug: A data reader was disposed.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Closing connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.EntityFrameworkCore.Database.Connection: Debug: Closed connection to database 'REDACTED' on server 'REDACTED'.
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executing endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Route matched with {action = "Dashboard", controller = "Default"}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Dashboard() on controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin).
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of authorization filters (in the following order): None
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of resource filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of action filters (in the following order): Microsoft.AspNetCore.Mvc.Filters.ControllerActionFilter (Order: -2147483648), Microsoft.AspNetCore.Mvc.ModelBinding.UnsupportedContentTypeFilter (Order: -3000), StackExchange.Profiling.Internal.ProfilingActionFilter (Order: 0)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of exception filters (in the following order): None
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Execution plan of result filters (in the following order): Microsoft.AspNetCore.Mvc.ViewFeatures.Filters.SaveTempDataFilter, StackExchange.Profiling.Internal.ProfilingActionFilter (Order: 0)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Executing controller factory for controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Debug: Executed controller factory for controller REDACTED.Web.Admin.Features.Default.DefaultController (REDACTED.Web.Admin)
Microsoft.AspNetCore.Mvc.Razor.RazorViewEngine: Debug: View lookup cache hit for view 'Dashboard' in controller 'Default'.
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Information: Executing ViewResult, running view Dashboard.
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Debug: The view path '/Features/Default/Dashboard.cshtml' was found in 1.6991ms.
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin), Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template  for REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin) resulting in  and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin), Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Devices" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Devices" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /devices and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /devices
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Accounts" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Accounts" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /accounts and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /accounts
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Users" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Users" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /users and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /users
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Reports" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Reports" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /reports and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /reports
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Search" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Search" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /search and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /search
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template iot-console/{action:slugify=Default} for Route: iot-console/{action:slugify=Default}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Settings" } with default values { "action": "Default", "controller": "IoTConsole" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Failed to process the template {controller:slugify}/{id:int}/{action:slugify=Edit} for Route: {controller:slugify}/{id:int}/{action:slugify=Edit}. A required route value is missing, or has a different value from the required default values. Supplied ambient values { "action": "Dashboard", "controller": "Default" } and { "action": "Default", "controller": "Settings" } with default values { "action": "Edit" }
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template {controller:slugify}/{action:slugify=Default} for Route: {controller:slugify}/{action:slugify=Default} resulting in /settings and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /settings
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Found the endpoints REDACTED.Web.Admin.Features.Default.DefaultController.SignOut (REDACTED.Web.Admin), Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} for address Microsoft.AspNetCore.Routing.RouteValuesAddress
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Successfully processed template sign-out for REDACTED.Web.Admin.Features.Default.DefaultController.SignOut (REDACTED.Web.Admin) resulting in /sign-out and 
Microsoft.AspNetCore.Routing.DefaultLinkGenerator: Debug: Link generation succeeded for endpoints REDACTED.Web.Admin.Features.Default.DefaultController.SignOut (REDACTED.Web.Admin), Route: iot-console/{action:slugify=Default}, Route: {controller:slugify}/{id:int}/{action:slugify=Edit}, Route: {controller:slugify}/{action:slugify=Default} with result /sign-out
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor: Information: Executed ViewResult - view Dashboard executed in 32.7506ms.
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker: Information: Executed action REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin) in 36.129400000000004ms
Microsoft.AspNetCore.Routing.EndpointMiddleware: Information: Executed endpoint 'REDACTED.Web.Admin.Features.Default.DefaultController.Dashboard (REDACTED.Web.Admin)'
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 136.6117ms 200 text/html; charset=utf-8
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://admin.REDACTED.local/styles.min.css?v=3pN9pDIy-rDvQq99S7lpEC_9uJvPG0iGtf7m-Ft4WGI  
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 GET http://admin.REDACTED.local/scripts.min.js?v=CsQXqQ0o4ZA9DrPF5z7kHSSNdbrKGybNnvT2XgKdP94  
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Information: The file /scripts.min.js was not modified
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Information: The file /styles.min.css was not modified
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: Handled. Status code: 304 File: /scripts.min.js
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: Debug: Handled. Status code: 304 File: /styles.min.css
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 8.3436ms 304 text/css
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 6.4619ms 304 application/javascript
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 POST http://admin.REDACTED.local/mini-profiler-resources/results application/json 45
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 POST http://admin.REDACTED.local/mini-profiler-resources/results application/json 45
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request starting HTTP/1.1 POST http://admin.REDACTED.local/mini-profiler-resources/results application/json 798
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 3.0225ms 200 application/json
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 3.0225ms 200 application/json
Microsoft.AspNetCore.Hosting.Diagnostics: Information: Request finished in 6.151800000000001ms 200 application/json

The exceptions in System.Private.CoreLib.dll are gone and the view is loaded as expected.

pranavkm commented 5 years ago

Yeah, I guess the logging doesn't really help figuring out why it couldn't be found. Could you walk me through what triggers the failure? I listed a sample app earlier, were you able to reproduce the problem using it?

arex388 commented 5 years ago

I ran the sample app, but it didn't reproduce the error. There are drastic differences between the sample app and my apps, starting with the file structure. I'm following the Vertical Slices structure with Features folders. And it just gets more complex from there with AWS Systems Manager to load keys, and connection strings, extensions to build up the IServiceCollection and IApplicationBuilder, so on and so forth.

The exception consistently occurs when I open Visual Studio, load the solution, and run the project. If I then edit the project file and re-run it the exception goes away. If I close and re-open Visual Studio, the process repeats. Sometimes if I have Visual Studio open for a long time after I've forced the exception to go away, it will throw again, and then I have to do the project edit dance.

Again, running my back up of the solution while it was still in .NET Core 2.2 with the same version of Visual Studio, there are not problems. This only occurred after upgrading to .NET Core 3.0. It may not even be a .NET Core 3.0 issue, but and issue with the config files for the solution? I had to go into them and manually remove artifacts that were just left over from before to fix other issues during the upgrade.

I don't know how feasible this is, but would it be possible for you and I to do a remote session so you can see what's happening directly? There's just no real way for me to say do this, this and this to reproduce it.

I've also got another random issue going on with EF Core since the upgrade to 3.0, referenced here: https://github.com/aspnet/EntityFrameworkCore/issues/18145. It's possible the two are somehow related? I tried making a slimmed down sample solution following my structure as close as possible, and I can't reproduce it. The only difference is that the sample solution started out as 3.0 from the beginning and wasn't upgraded from 2.2.

Somehow I have a feeling that the real fix will be for me to start a new 3.0 solution and copy everything over from the current solution, but that just sounds like a nightmare and makes no guarantees that with any other future version I won't have the same problem when upgrading.

arex388 commented 5 years ago

Two weeks into this, I have discovered a few things, mostly that I am SoL.

First, I decided to create a new .NET Core 3.0 solution and I spent three days copying the code to it. That didn't help at all.

Second, I made a VirtualBox VM and installed a fresh copy of Visual Studio 16.3.4 to it. After running it the issue was no longer there, so it looks like the conclusion is that VS is messed up. I guess having VS 2013, 2017, and 2019, and constantly patching them is bound to cause incompatibility.

I would use the VM to continue development, but it seems that performance is real bad even though its on an i7-4790K, and an EVO 970 M.2... Also, since the solution starts up four Gulp watch tasks, each one likes to use 25% of the CPU for some reason (thanks Node) so just sitting idle the VM is using 100% of the CPU. Probably has something to do with the storage being virtualized. I would try Hyper-V, but even though I install it, the management console is missing, so SoL there too. Yay!

Honestly, VS 2019 seems be at the root of the issue, and frankly it seems to have regressed in stability vs 2017. Besides all of the issues I've been having above, IntelliSense never works anymore, and I constantly get yellow bars telling me some component has crashed, like say renaming a file.

The real solution it seems is to do a fresh install of my entire computer, which is something I don't have the time for. I've already wasted far too many days trying to figure out and fix tooling and framework problems rather than actually developing the project that has a month left to release...

// rage quit

arex388 commented 5 years ago

I went through the process of reinstalling Windows, Visual Studio and everything else on my computer earlier this week. I installed VS 16.3.4 and it seemed to resolve the issue... until VS 16.3.5 update came out two days later and the issue is back. So... It seems to point once again at an incompatibility between VS and .NET Core 3.0, especially as VS updates.

arex388 commented 4 years ago

So, I've been living around this issue by hacking the project file every time it threw, but yesterday it decided to rear its ugly head on the published version. I've finally resolved it by using more hacks. I took advantage of my Gulp configuration to watch the project that has the Razor views, and if they change to copy them to the project that's actually using them. This way they're compiled along with the other views in the project and everything works fine.

The conclusion is that in .NET Core 3.0 generally on first run additional view DLLs are not being loaded and thus the views in them are never found. I don't know if it's a runtime issue or something else, but it's exists. I also don't know if Razor Class Libraries are affected, since I'm not using one instead opting for an ASP.NET Core app set to compile as a library.