Skip to content

Errors CS0115, CS0117 and CS0103 in razor.cs partials and hot reload fails. #47498

@jburman

Description

@jburman

Scenario:

  1. Blazor hybrid app hosted in WinForms.
  2. Run the app with: dotnet watch run
  3. Hot reload was working for a short time
  4. Now, when making a change in a razor page, dotnet watch spams out a bunch of errors that looks like the code from all of the razor.cs partials in my project are no longer associated with the corresponding .razor code.

Here are some examples of different errors...

  • error CS0117: 'object' does not contain a definition for 'OnInitializedAsync'
  • error CS0117: 'object' does not contain a definition for 'OnParametersSet'
  • error CS0117: 'object' does not contain a definition for 'OnAfterRenderAsync'
  • error CS0103: The name 'InvokeAsync' does not exist in the current context
  • error CS0103: The name 'StateHasChanged' does not exist in the current context
  • error CS0115: 'PasswordChange.OnInitializedAsync()': no suitable method found to override
    etc. etc.
    Pretty much any symbol defined in the .razor markup is not resolved, and this occurs for every single component in the project.

====================================
Project Information
====================================

WinExe net6.0-windows enable true enable Debug;Release;Debug_CORECLR;Release_CORECLR Icon.ico

====================================
System Information
====================================

.NET SDK (reflecting any global.json):
Version: 6.0.403
Commit: 2bc18bf292

Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.403\

Host:
Version: 7.0.3
Architecture: x64
Commit: 0a2bda10e8

Metadata

Metadata

Assignees

Labels

Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Needs: ReproIndicates that the team needs a repro project to continue the investigation on this issuearea-commandlinetoolsIncludes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPIfeature-hot-reloadThis issue is related to the Hot Reload feaature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions