Skip to content

Views from RCL not found after app rebuild in preview 6 #11315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SonicGD opened this issue Jun 18, 2019 · 8 comments · Fixed by dotnet/razor#686
Closed

Views from RCL not found after app rebuild in preview 6 #11315

SonicGD opened this issue Jun 18, 2019 · 8 comments · Fixed by dotnet/razor#686
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed

Comments

@SonicGD
Copy link
Contributor

SonicGD commented Jun 18, 2019

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]
@SonicGD SonicGD changed the title Views from RCL not found after app rebuild Views from RCL not found after app rebuild in preview 6 Jun 18, 2019
@mkArtakMSFT mkArtakMSFT added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Jun 18, 2019
@pranavkm pranavkm self-assigned this Jun 18, 2019
@pranavkm pranavkm added this to the 3.0.0-preview7 milestone Jun 18, 2019
@pranavkm pranavkm added bug This issue describes a behavior which is not expected - a bug. Working labels Jun 18, 2019
@pranavkm
Copy link
Contributor

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

@pranavkm
Copy link
Contributor

Filed #11389 to track verifying this for the preview7 release.

@SonicGD
Copy link
Contributor Author

SonicGD commented Jun 19, 2019

Thanks!

@los93sol
Copy link

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

@pranavkm
Copy link
Contributor

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

@los93sol
Copy link

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?

@pranavkm
Copy link
Contributor

pranavkm commented Jun 20, 2019

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.

@los93sol
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants