dotnet / dotnet/aspnetcore

Opening MVC F# project after dotnet run shows an unhandled exception while processing the request due to missing files in .NET 11 RC2

Open
#69,220 2 comments 0 reactions 1 assignee Claimed by @Youssef1313 View on GitHub
area-commandlinetools area-mvc
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

**REGRESSION INFO:** Feature change with https://github.com/dotnet/aspnetcore/pull/69114, also works well on 11.0 RC 1

**INSTALL STEPS:**

1. Clean Win11 x64 25h2 ENU
1. Install the .NET 11.0 RC 2 SDK: https://aka.ms/dotnet/11.0.1xx/daily/dotnet-sdk-win-x64.exe
1. Add feed

**Platform**
- [x] Windows
- [x] macOS
- [x] Linux

**Repro Steps**

1. Open a normal Command Prompt
1. Create a MVC F# project and run it
```
dotnet new mvc -lang F# -o MVCFS
cd MVCFS
dotnet run
```

**Actual Result**
There are multiple files missing in the project such as (/Views/Home/Index.cshtml, /Views/Shared/Index.cshtml, /Pages/Shared/Index.cshtml) and checking the projects files confirms that these files are missing.

Image

**Error Call Stack**
```
InvalidOperationException: The view 'Index' was not found. The following locations were searched: /Views/Home/Index.cshtml /Views/Shared/Index.cshtml /Pages/Shared/Index.cshtml
Microsoft.AspNetCore.Mvc.ViewEngines.ViewEngineResult.EnsureSuccessful(IEnumerable originalLocations)
Microsoft.AspNetCore.Mvc.ViewFeatures.ViewResultExecutor.ExecuteAsync(ActionContext context, ViewResult result)
Microsoft.AspNetCore.Mvc.ViewResult.ExecuteResultAsync(ActionContext context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|30_0(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(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_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.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
```
**Note**
1. This issue also related with https://github.com/dotnet/aspnetcore/pull/68841 change
2. **Workaround**:
add the code `.AddRazorRuntimeCompilation()` in program.fs.

Image

also add this package reference in the item group if it is missing
```

```

**Expected**
Project runs successfully without any issues.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.