-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Live reloading not working #15613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Just checking to make sure - can you run the app in visual studio by using the combination "Ctrl+F5" … then make a change in html/code , save it , go back to browser and refresh again |
Hi @lohithgn , same problem. Ctrl+F5 didn't solve it. |
did you wait after your change as I have found that sometimes it takes a long time to recompile the files and have had to wait over 30 seconds for the change to be reflected in the browser. |
@tezine Any errors showing up in the browser console? Also, when you manually build the app do you get any build failures? |
Hi @danroth27 , no errors displayed.
But I have to execute the project using the command line:
It would be nice to have auto reload and without |
Strange! Auto rebuild should work out of the box with Blazor 0.5.1. What version of VS do you have? I assume this is with the default Blazor project template? Can you confirm that these are the exact repro steps?:
Expected: You see the changes. Is that correct? |
Hi @danroth27 , |
Unfortunately I'm not able to reproduce this. I have VS 2017 15.8 Preview 2 with Blazor 0.5.1. I have .NET Core SDK 2.1.302, but I can't imagine that would make a difference. @SteveSandersonMS Is there a way to track down the cause of an autobuild failure? |
From the phrasing (e.g., "auto reload"), it sounds like @tezine wants/expects the browser to refresh automatically when saving changes to source files. That's not what we do currently. We might do in the future but the implementation isn't trivial. As @danroth27 was trying to clarify with his suggested steps, it's necessary to F5 in the browser after saving changes to source files. This should trigger an auto-recompilation as part of the page reload. If that's what you're trying and it doesn't show your changes on reload, the main question is which project template are you using?
If you try the other one of these templates, does auto-rebuild work for you there? Are there any compile errors in your app? If there are, compilation will fail so the browser will continue to get the output of the last successful compilation. @danroth27 We log any exceptions in our VS extension to the VS "output" window. Any runtime exceptions would be logged to the process output (e.g., command line if running directly on Kestrel, or "ASP.NET Core Output" tab if running on IIS Express). |
Hi @SteveSandersonMS and @danroth27 , to clarify: If I simply execute the project from Visual Studio using IIS or dotnet run, the changes are not reloaded after Ctrl+F5. Whenever I press Ctrl+F5, it displays the old content. |
I tried out the attached project. I downloaded it to my machine, opened it in VS, commented out the I do see the behavior you describe if I run the app in the debugger in VS (F5 instead of Ctrl-F5). This is expected, as we don't currently support attaching the debugger to client-side Blazor from VS. To use autobuild you need to run without the debugger. I'm out of suggestions at this point. Maybe try reinstalling the Blazor VSIX? |
Hi, you can use auto rebuilt with automatic page refresh. No need to push Ctrl-F5. I build a demo how to setup : https://github.com/martasp/BlazorLiveReload |
Closing as there is no further action on our side. |
It seems that live reloading is broken with 0.6.0
SDK version 2.1.403 Modify a file, e.g. Counter.cshtml and hit F5 in the browser does not show the changes. |
@sven5 Nothing watches for file changes when you just do The auto build support should work in VS though. What version of VS are you using? |
@danroth27 I'm using VS 15.8.6. |
@danroth27 I am experiencing the same thing. VS2017 15.8.6. ASP.NET Core Blazor Language Services 15.7.20181002.2. SDK version 2.1.403. I created the project via the templates in VS2017; both Blazor (Server-side in ASP.NET Core) and Blazor (ASP.NET Core hosted). The only way I have gotten it to work is to run the Server project under IIS Express. If I set it to run under the console, then refreshing does not reflect any new changes. I have to restart the console for it to take effect. Attempting to put |
OK, let's see if we can get to the bottom of this. I haven't been able to repro this yet, so I'll need your help. A couple of things to clarify:
|
One more clarification: when using the ASP.NET Core hosted Blazor template or the server-side template, then the Razor files you want to watch are typically in a separate project, so you need to use a broader include: |
I completely understand. I am having trouble with the manual refresh process. If I make a change in a .cshtml file, save it, and manually refresh the browser, there are certain cases where my changes are not reflected.
Bingo! That is what I was missing. I was creating projects using both the ASP.NET Core hosted Blazor template and the server-side template. I was also trying to use
Thanks, that explains why auto rebuild does not work with the ASP.NET Core Hosted project template when running the Server project directly from VS itself. Does that also explain why auto rebuild does not work with the server-side template when running the Server project directly? Does the server-side template also need to run behind IIS Express (or with
It does support running under the debugger behind IIS Express with the server-side template, correct? Assuming that is the case, should auto rebuild work? That is the only other scenario I encountered where it did not. I can see that being problematic, but I wanted to double-check. Thank you very much for your help with this! |
Yes, good point. For the Blazor templates that include ASP.NET Core server projects you can run the ASP.NET Core projects the debugger - it's the Blazor projects that you shouldn't run under the debugger. However, auto rebuild is disabled when you run the ASP.NET Core server projects under the debugger. I've tried to clarify this above. |
@danroth27 However, I've had a problem that auto build didn't work in my Visual Studio. I was able to found the root cause: It seems auto-build only works when the Environment is set to |
That is strange. I'm seeing this as well. I'm following up with the web tools folks to try to understand what's going on here. |
I probably totally spaced on this F5 vs. Ctrl-F5 difference, but now understanding this, the live reloading is working as well as I'd want (for now) :) I wonder if this nuance could perhaps be better emphasized in the documentation? |
@danroth27 perhaps I'm missing something: running with the debugger has totally been working for me. Except it doesn't live-reload saves to the .cshtml files. It was that nuance that surprised me. Perhaps some clarification in that regard? Btw, this was the thread that made me realize this: https://github.com/aspnet/Blazor/issues/1428#issuecomment-422459641 |
imho, debugging currently works only for server-side Blazor Apps. |
After reading this thread carefully and getting nowhere here's what I had to do. |
Hi,
Live reloading is not working on version 0.5.1.
I'm using dotnet sdk 2.1.300 under Windows 64.
Whenever I change a html content, it's not updated in the browser. I tested using Chrome, pressing F5, cache disabled and debug mode.
Is this working anyhow?
I also tested using dotnet blazor serve without success.
The text was updated successfully, but these errors were encountered: