Aspnetcore: Views from RCL not found after app rebuild in preview 6

Created on 18 Jun 2019  路  8Comments  路  Source: dotnet/aspnetcore

Describe the bug

Hello. After update to preview6 views from RCL works only for clean app build. After app rebuild views can't be found.

To Reproduce

Steps to reproduce the behavior:

  1. Clone this example - https://github.com/SonicGD/rclbug30p6
  2. do dotnet run in src/app
  3. Open https://localhost:5001/test in browser
  4. See Hello, world!
  5. Stop app
  6. Change anything in app, for example uncomment lines in src/app/Controllers/TestController.cs
  7. do dotnet run again
  8. Reload https://localhost:5001/test
  9. See error
System.InvalidOperationException: The view 'Index' was not found. The following locations were searched:
/Views/Test/Index.cshtml
/Views/Shared/Index.cshtml
/Pages/Shared/Index.cshtml
   at Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable`1 originalLocations)
   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 Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

After dotnet clean next run will work.

Expected behavior

Page open successfully.

Screenshots

First run:
image

Second run:
image

Additional context

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.0.100-preview6-012264
 Commit:    be3f0c1a03

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18917
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100-preview6-012264\

Host (useful for support):
  Version: 3.0.0-preview6-27804-01
  Commit:  fdf81c6faf

.NET Core SDKs installed:
  2.1.602 [C:\Program Files\dotnet\sdk]
  2.1.604 [C:\Program Files\dotnet\sdk]
  2.2.204 [C:\Program Files\dotnet\sdk]
  3.0.100-preview6-012264 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview6.19307.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0-preview6-27804-01 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Done area-mvc bug

All 8 comments

@mkArtakMSFT picking this up since it's kinda bad.

Filed https://github.com/aspnet/AspNetCore/issues/11389 to track verifying this for the preview7 release.

Thanks!

Thank you! Any idea when preview7 is targetted to drop?

The preview cadence is monthly. I'm working on another SDK fix in this area, but if it's super problematic, you could consider patching your SDK locally or grabbing a preview7 build from https://github.com/dotnet/core-sdk

Thanks for the info, I also noticed that when I have a project referenced to an RCL project and I edit my razor pages in the main project that I have to stop and restart the project for the changes to be served. Will this address that scenario as well?

I edit my razor pages in the main project that I have to stop and restart the project for the changes to be served

Do you have runtime compilation enabled - https://docs.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-3.0#runtime-compilation?

Also with the most recent VS preview release, changes to cshtml files (in the main app) should auto rebuild your application.

Thank you, wasn鈥檛 aware of that one! Just switched from VS preview to release and went to 3.0 preview at the same time and didn鈥檛 realize VS preview was doing things for me before.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rmarinho picture rmarinho  路  78Comments

danroth27 picture danroth27  路  79Comments

mkArtakMSFT picture mkArtakMSFT  路  89Comments

glennc picture glennc  路  117Comments

barrytang picture barrytang  路  89Comments