Skip to content

CS0246 error in a razor view points to a generated file (.g.cshtml.cs) instead of the actual view (.cshtml) #8790

@yepeekai

Description

@yepeekai

If your rename a model used in a razor view (.cshtml) The build output will display an error but for a generated file (.g.cshtml.cs) instead of displaying it for the actual source (.cshtml) It is not possible to double click on the error to see the source.

To Reproduce

1- Rename the class for a model used in a view
2- Compile

Expected behavior

The error should be listed in the output window and in the error window and the error must be correctly linked to the view source file Views\SomeController\SomeView.cshtml

Actual behavior

The error is listed but is linked to a generated cs file: obj\Debug\netcoreapp2.2\Razor\Views\SomeController\SomeView.g.cshtml.cs
I have tested this behavior in both VS2017 15.9.9 and VS2019 RC.3

Metadata

Metadata

Assignees

Labels

area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions