dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.39k stars 10k forks source link

Hot Reload is broken! VS 2022 17.1.0 #40527

Closed vsfeedback closed 2 years ago

vsfeedback commented 2 years ago

This issue has been moved from a ticket on Developer Community.


[regression] [worked-in:17.0.6] I just upgraded from VS 2022 17.0.6 to VS 2022 17.1 this morning. Hot Reload was working correctly when building Blazor Server apps prior to upgrade. After update, HOT RELOAD is BROKEN.


Original Comments

Justin Stefanski on 2/16/2022, 10:43 AM:

Also having issues in Blazor Server/Web Assembly combination apps. Was working better before the update. Am a bit disappointed as I expected improvements with this release. Every time I save and it attempts to Hot Reload, an error pops up saying “This error was not expected, your process might be corrupted and restart the app is recommended.” This is while running without debugging (CTRL+F5).
Restart does not fix the issue. Also deleted the .vs folder.

hot-reload-error-2-16.png

Feedback Bot on 2/16/2022, 05:17 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 2/17/2022, 10:10 PM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

Nick Walker on 2/24/2022, 10:58 AM:

I believe my issue is directly related to this problems as my symptoms are very similar. Creating a new project using blazor server will work just fine. If you take a blazor wasm project and convert it to run in blazor server is when I am able to reproduce the issue. It’s possible it has something to do with dependent libraries.

Start with a basic template Blazor WASM project and then copy and pasted the _Host, _Layout and Program.cs from a basic Blazor Server template, simplify just a tad so the project will run and then you have a reproducible problem.

Please see https://github.com/airwedge1/BlazorApp7 as an example project.

This all worked correctly in 17.0.6

Feedback Bot on 3/1/2022, 07:33 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 3/2/2022, 01:34 AM:

This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.


Original Solutions

(no solutions)

pranavkm commented 2 years ago

VS and dotnet-watch assume that because you have an ASP.NET Core project referencing a BlazorWebAssembly app, there is a Blazor WASM app running in the browser and attempts to send deltas to it which results in the warnings you see here. There are a few ways to tackle this:

a) Instead of referencing a BlazorWASM app, you could move the components to a separate Razor Class Library and reference the new shared library from your Blazor Server and WASM apps. b) Alternatively, you could remove the project capability that causes VS to think you're running a Blazor WebAssembly app. There currently isn't a clean way to do this, but you could do something like this:

- <Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
+ <Project>
+ <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk.BlazorWebAssembly" />
....
+ <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk.BlazorWebAssembly" />
+ <ItemGroup>
+    <ProjectCapability Remove="WebAssembly" />
+ </ItemGroup>
</Project>
somunich commented 2 years ago

Same to me here! on a clean API project, when I attempt to edit and save something hot reload throws me that error.

mrlife commented 2 years ago

@SteveSandersonMS please see https://github.com/dotnet/aspnetcore/issues/39073#issuecomment-1044702453 for issue with Blazor Server, console, and potentially other project types.

ghost commented 2 years ago

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

mkArtakMSFT commented 2 years ago

@mrlife can you please confirm if this is still an issue for you or not?

mrlife commented 2 years ago

Hi @mkArtakMSFT, thanks for checking. My issue was resolved in https://github.com/dotnet/aspnetcore/issues/41776.

mkArtakMSFT commented 2 years ago

Thanks for confirming, @mrlife. Given that the only engagement we've got here is from you and your issue is resolved I'm closing this for now.