-
Notifications
You must be signed in to change notification settings - Fork 198
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
Hot Reload Takes Nearly 45 Seconds to Update #7626
Comments
@pranavkm I know that you've been looking into this already. Is there another issue to dupe this against? |
same for me its just not flawless yet... :( |
This is a duplicate of dotnet/aspnetcore#32867. |
I have similar issue, but just a lot worse. For a slightly complicated page (~450 lines of razor, a few loops etc.) hot-reload from VS2022 takes 2:30 (2 minutes and 30 seconds) of really hammering the CPU to apply changes, and after that the changes still does not get rendered, and I have to restart the app. Using the suggested workaround using It's only this extreme for this particular page. For very simple pages it's working OK, and changes are applied within 10 seconds. I've tried to find if it's any particular code on this page that is "bad" by process of elimination, and I can't find any specific error but in-line loops just seems to absolutely kill the performance. |
I do apologize for the confusion here. According to this comment, this should have been addressed in preview2? This was my understanding when I posted my last comment, which seems to have contributed to the issue being locked. 😇 But now it appears with subsequent updates that this is slated for .NET7, if I understand correctly. I am totally fine with this as long as it is being communicated correctly so that we're not operating under false impression/understanding. For instance, I wouldn't have posted my last comment on dotnet/aspnetcore#32867 as I was under the impression that a fix had already been checked in as per the previous comment (which I probably misunderstood). In any case, please know that I for one truly appreciate all the effort being applied there with this task and the project as a whole. You are truly moving mountains over there. 🙏 |
Based on this PR, it is being backported to .NET 6.0.3: It was told that it will come in VS 17.2 (see last comment in the PR linked above). I don't know the ETA for that. Even 17.1 is yet to be released. |
Ahhhhh 17.2, not to be confused with 17.1 Preview 2, as I was doing. :) Thank you for the pointer and correction, @CommonLoon102. |
@Mike-E-angelo 17.2 preview1 would ship the same day 17.1 ships (part way thru February 2022). |
17.2 Preview 1 is out but it is still 40 seconds to do a "hot" reload. |
Not really related to this issue other than if I wasn't doing this, then I wouldn't be here in the first place. :) I recently announced my product that is built on your tech and is responsible for finding all these issues. 😁 https://alpha.starbeam.one/about/acknowledgements I have a shout out to you there @pranavkm. Thank you for all your great work over there. 🙏 |
Me and my team are working on a big scale project right now and we decided to update to .NET 6.0 and we have the same issue with our windows users. It looks like it works perfectly fine in the M1 Mac version. Also we noticed that some of our code that includes SQL Server works slower, noticeably slower. I, myself, use hot reload very much but i don't mind debugging every time, but it's the same speed so i do not bother. |
No comment given on the reversion, but it appears it was leading to problems such as this one, which I ran into yesterday: (Reference: #5697 (comment)) |
Is there still any hope that the community will get a 3-4 seconds hot-reload time instead of 40-45 seconds? Is this still considered fixable? The issue is there since .NET 6 release and the new previews didn't bring any improvements. I also can't see a fix for this in the .NET 7 roadmap. I'm asking because we need to consider this when we deciding about the technology we want to use in new projects. |
Not looking too promising here. Any further update, @pranavkm? |
I do most of my development using |
It depends on the file you edit. I have files which reload in a second with |
For the VS hot reload performance we have a PR out in the SDK repo, which should improve things. dotnet/sdk#24928 For |
Thank you for taking the time to update us, and for all your efforts out there @chsienki & team. 🙏 |
@Mike-E-angelo , we've made some pretty significant changes to help address this in the past year and are continuing to make investments in this area. That said, what is your current experience with Hot Reload now that VS 17.8 is out? Is it still similar in order of magnitude to "45 seconds"? |
Thank you for your inquiry @phil-allen-msft. Unfortunately, this has only gotten worse over time. I did enable it in my solution via 17.9.0 Preview 1.1 and it now takes 2.5 minutes for a simple update. Captured here for your review: https://developercommunity.visualstudio.com/t/Hot-Reload-Takes-Over-Two-Minutes-to-Upd/10536525 |
@Mike-E-angelo Damn, sorry to hear it's gotten slower again! From the trace I can see we seem to be doing a lot of Razor work which isn't expected. Would you be able to take an ETL trace locally using PerfView? There is a counter that isn't yet enabled in the VS report a problem tool that should give us much deeper insights into what's going on with the Razor generator when we Hot Reload. If you can upload it to the VS feedback ticket we might have an easier time understanding what's going on. PerfView instructions
You can leave the settings as default except for:
Choose 'Start Collection' and perform a
|
I can confirm that it still takes a lot of time. To be honest I don't even use the feature that much anymore because it takes that long time. |
Agreed. I disabled this feature when it became clear no effort was being made to address this for those building real-world applications. I am currently working with 48K lines of Razor here and feeling especially abandoned ATM. 😞
I appreciate the nod, @chsienki. 😅 The requested ETL is here for your review: If I were to guess, my money is on #6919, as a single line of difference in my csproj currently takes over 20 seconds to compile these days. #8371 may also be contributing. Or both/other. 💥 |
The only way I get hot reload working from VS with Blazor is by using a custom launch profile that is basically a dot net watch. I can't debug then. Found this workaround here somewhere on github. |
@Mike-E-angelo How many projects do you have? Have you tried separating out as much components as possible? Then you can even have only a few components per project, so having a lot of projects with a few components. It might not help at all, just some brainstorming from my side. Also, try to have small files, only a few dozens of lines in a razor file. Also, have .razor files separated from .razor.cs files. So instead of having a |
I appreciate the assistance/thoughts/suggestions @CommonLoon102. 🙏 They are, unfortunately, more than I have gotten to date from the Razor team despite dozens of bug reports, directly appealing for any feedback to improve my situation, and even providing my solution at one point for further investigation. As I have received zero guidance in such regard, I am of the impression that there is nothing that can be viably done ATM for my outstanding issues and that I have simply out-coded them for the time being. 😅
159 at present. 😬
I have indeed, and this was my first inclination toward remediation. I do have feature-based projects and these do fare better with compile times. However, I have found these ultimately do not do much good as there is always work being done in the primary application/csproj in some way that gets it to compile, leading to the grief anyways.
Nodding along with your way of thinking. I have this rocking for C# files ATM with nearly 170K lines of code over 12.5K files, averaging ~13.5 lines of code per file ATM. Razor's a different animal for me as it's newer and I haven't landed on a corresponding style that lends itself to such orientation. I'll keep this in mind going forward and see if I can improve this.
Potentially good advice but TBH I am attached to the |
@Mike-E-angelo Thanks so much for that trace, it was extremely helpful. I found a bug where we were incorrectly re-compiling every razor file on hot reload, as opposed to just the things that changed (see #9717). This fix should make every hot reload operation except for the first one a whole lot faster. Note: #6919 means that the first time you hot reload in a Visual Studio session it will still be slow, but every other hot reload for the lifetime of that VS instance should then be faster. We're actively working on fixing the first edit thing, but it's a big complicated architectural issue that will take several VS releases to completely fix. |
That is good news @chsienki I appreciate hearing that we're making strides here. Every little bit helps me feel better about my investments with your tech. 🙏
I hate to ask, but what the wait for the first edit thing will be like after #9717 is applied? Will it still be 2+ minutes? Or will it be the 20 seconds that I am currently encountering with #6919? Additionally, if I understand you correctly, it sounds like it is going to take a few more years for this issue along with #6919 to be fully addressed, which is surprising, to say the least. 😭 Having more investment and focus placed on this issue would be greatly appreciated. Thank you for your continued consideration. |
@Mike-E-angelo Obviously can't give concrete timelines to get the re-architecting done, but it's being actively worked on. Think in the order of months, not years to get it out. For those interested in why/what we're doing: today the Razor generator is special cased in Visual Studio; it doesn't actually run when you're typing. Instead, the razor tooling uses the Razor APIs to directly generate code and dynamically push that into Roslyn for design time. This is a historical artifact and a combination of how things used to work, and different parts of Razor being developed at different times by different teams. On a 'full' build (i.e F5) VBCSCompiler is invoked where the generator is enabled, and nothing is special cased. When you hot reload, an incremental build is performed to calculate the deltas that need to be applied to the process. But that incremental build is based of the design-time build where razor was suppressed. That means that on the first hot reload you perform the generator has to run from scratch and compile everything again, which as you can imagine is slow. On subsequent edits the generator caches are now full and the generator only needs to compile the things that have changed. (At least, that is true as of #9717; the bug was that we were accidentally dumping the caches between runs) The re-architecting we're doing aims to switch design time builds to use the generator, with no special casing needed. This has several advantages, but one of them is that when you do a hot reload the first time, the caches will already be full and it only needs to do the minimal work needed to bring everything up to date, meaning it will be fast. As you can imagine, changing the way the Roslyn and Razor in VS interact is a pretty big lift, spread out across multiple teams, and there are multiple steps we need to get done before we can even be in a position to make the main change. But the work has started and we're making progress! It'll get there, I promise. |
That is much better news for my world, @chsienki. 🙏 When I hear "version" I am thinking Visual Studio 18 vs 19, etc. If I understand correctly those are taking a year each, hence my initial understanding and resulting concern. If we're talking months instead of years that would be super awesome. I understand that this is a general estimate and is subject to change. I appreciate all the effort, and even more so for taking the time to explain things to everyone. It helps and means a lot to me, personally. Happy Holidays out there to you and the team. ⛄❄ |
@Mike-E-angelo and @chsienki I see milestone is updated to 17.10. Is that still the planning? I hope so :-) |
@LockTar @Mike-E-angelo We've continued working on this during the 17.10 timeframe (see PRs titles containing Fuse and Cohosting for progress) but it seems unlikely at this point that there will be anything user visible yet. |
@chsienki Will this also fix hot reload on non razor files? we have lot of views but If a try to make a change on a .cs controller or other file that is not a view we also have the same issue.
Trace.log:
|
@TiagoAntunesALS Hmm, this shouldn't be affecting cs files at all. @tmat Any thoughts on the above? |
You mean it's slow to apply updates? The issue affects Hot Reload performance in projects containing .razor files regardless of which file you're modifying (.cs/.razor). |
@tmat Yes, slow applying changes, by .razor files are .cshtml also included? We only have those |
Yes. |
Sits through another 2-minute build due to Razor libraries Are we ever going to have this feature? 😁😇 |
@Mike-E-angelo We're still working on it, but it requires a pretty fundamental reworking of the Razor tooling architecture. That's an ongoing project right now. Any PRs you see mentioning Cohosting are part of that effort, and we have a pretty substantial developer investment in delivering that right now. Nothing to try out yet, but we will absolutely ping you as soon as there is :) |
Love to see that effort @chsienki and of course, I cannot help with my snarky commentary from time to time to pass+mark the time. Worth noting that I will have invested five years of my life into Blazor once October hits. 🤯 I am not going anywhere. 👍 |
This issue has been moved from a ticket on Developer Community.
[severity:It's more difficult to complete my work]
Please see attached. Hot Reload now works for me, but takes forever to update, nearly 45 seconds to be more precise.
Original Comments
Feedback Bot on 11/11/2021, 03:48 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.
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: