OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.35k stars 2.37k forks source link

Trouble with hot reload in OC 1.8.3 and net8.0 #16504

Closed DavidStania closed 3 weeks ago

DavidStania commented 1 month ago

Hello everyone, I have a problem with HotReload in VS2022 17.10.5 (current). No changes are applied. The application has to be restarted again and again to apply changes.

I have made several attempts:

  1. Asp Net Core WebApp with .net8.0 without OC No problems! All changes are applied immediately.
  2. Asp Net Core WebApp with .net7.0 with OC 1.7.2 No problems! All changes are applied immediately. Also changes in the modules themselves.
  3. Asp Net Core WebApp with .net8.0 with OC 1.8.3 No changes are applied. However, HotReload registers changes.

I have recorded a video to demonstrate this. I currently have the problem on 4 independent computers.

I would be grateful for any advice!

github-actions[bot] commented 1 month ago

We triaged this issue and set the milestone according to the priority we think is appropriate (see the docs on how we triage and prioritize issues).

This indicates when the core team may start working on it. However, if you'd like to contribute, we'd warmly welcome you to do that anytime. See our guide on contributions here.

Piedone commented 1 month ago

Could you please check with the latest main? This is what I see there, it works for me:

https://github.com/user-attachments/assets/ad126189-dc79-4269-bc98-2c0d38d4ece3

Note that apart from saving the cshtml file, I didn't do anything, the browser reloaded itself.

DavidStania commented 1 month ago

I have tested it with the latest version. Exactly the same result. I noticed that when I executed the dotnet watch command, the following message appeared: "Skipping configuring browser-refresh middleware since the target framework version is not supported. For more information see 'https://aka.ms/dotnet/watch/unsupported-tfm'." So I had to specify the command with the framework dotnet watch --framework net8.0. The browser is also reloaded. As can be seen in your video. But without any changes.

Piedone commented 1 month ago

Just to confirm, you did the same as I did, with the latest main, with the latest VS, and in contrast to the video, don't seem changes to a cshtml file appear?

DavidStania commented 1 month ago

I can confirm. 100% the same like you did.

https://github.com/user-attachments/assets/d6ce983a-d5bd-4370-b270-4caecba598c9

Piedone commented 1 month ago

Hmm. This looks like more of an issue with Razor Runtime Compilation rather than Hot Reload.

A couple of things:

  1. Is this line hit for you?
  2. What happens if you turn Hot Reload off under Options -> Debugging -> General?
DavidStania commented 1 month ago

image

This line is not hit cause 'refs' folder not exists! But I don't know why. There is only a 'ref' folder here 'G:_Applications\repos\OrchardCore\src\OrchardCore.Cms.Web\obj\Debug\net8.0\ref'

If I create the folder manually, it remains empty during debugging and I only get an error page. image

Piedone commented 1 month ago

Hmm. What happens if you turn Hot Reload off under Options -> Debugging -> General?

DavidStania commented 1 month ago

Strange!

Hot reload is disabled in global settings image And also in startprofile image But if changes exists: image

Piedone commented 1 month ago

I don't know what's happening.

DavidStania commented 1 month ago

I told you. Very strange! And this is happens on 4 independent development machines.

shinexyt commented 3 weeks ago

Same issue: #15946

Piedone commented 3 weeks ago

Indeed, closing as a duplicate.