-
Notifications
You must be signed in to change notification settings - Fork 4k
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
How to disable live code compilation/analysis in Visual Studio 2017? #24513
Comments
💭 This may be a case where the feature was so infrequently used that it became prone to higher rates of regression bugs between releases (lack of use meant bugs in the behavior were not detected). /cc @kuhlenh |
Disabling full solution analysis does not disable analysis in the current file. In between VS 2013 and VS 2015 we removed the option to disable design-time analysis. Sounds like this is a request to bring that feature back. |
I do not find syntax error squiggles that distracting because most of the time I pay attention to them only after I finish writing particular code snippet. But I can see where Stack Overflow OP is coming from. For experienced developer live error squiggles may look like false positives. Is it correct that you can't disable design-time analysis using registry key? Can you do that using Language Service and Editor Extensions? |
There is no way to disable analysis today. |
🔗 I marked Bc42024 Visual Basic and VB.NET unused local variable as a duplicate of this issue. |
This comment has been minimized.
This comment has been minimized.
@d4e666 Would you be willing to collect some perf traces to help get to the bottom of any slowdowns you're seeing? Thanks! |
here is the guidance for getting a perf trace.
Under Tools -> Options you can disable CodeLens Not a complete solution but hopefully it can get rid of some of the clutter for you. |
@d4e666 Here are the instructions on collecting and reporting perf issues: https://github.com/dotnet/roslyn/wiki/Reporting-Visual-Studio-crashes-and-performance-issues This would be very helpful in terms of determining what is the root cause of the problem. Thanks!
'test code detection' can be disabled here:
Sorry... this is garbled. I don't know what this is referring to.
In general, the features which are costly can be disabled. If performance tracing reveals something that is an issue, but can't be disabled, we can add options for it. But without tracing, there's no way to know what the root cause is. For example, you mentioned you didn't like experiences pauses. However, there is no way to know (without a trace) what is causing that pause. It may be something in Roslyn. It may be something in Resharper. It may be something in some other extension you're using. If any of those end up using the UI thread in an inappropriate manner, you may experience pauses. We'll need the tracing data to know what's up. Thanks! |
@d4e666 your comment was hidden as it violates our code of conduct. Please keep future contributions in line with the COC or we may have to consider banning your account from this organization. |
@d4e666 Here are the instructions on collecting and reporting perf issues: https://github.com/dotnet/roslyn/wiki/Reporting-Visual-Studio-crashes-and-performance-issues This would be very helpful in terms of determining what is the root cause of the problem. Thanks! |
Since you ignored the warning I've blocked your account. We all have passion and want to see the right thing happen, but insulting and yelling at us isn't a productive mode of discourse. If you have any concerns, please contact conduct@dotnetfoundation.org. |
Hi, I'm running Visual Studio 2017 on a 32GB/i7/win10 machine. Words cannot describe the slowness and frustration. On each and every code change, it hangs. I see that the live code analysis is running in the background. Is there a way to disable the live code analysis? |
Everything is off, beside the code analysis on build, but code analysis run in background when open/edit/save file (.cs) some times runs on a single file other times on all opened files. Before, I had same setup on same machine Win10 64 + VS 2017 no problem, after reinstalling windows this issue appeared. |
Found a workaround, Code Analysis still runs at any action on opened file but editor is quite faster. Tools -> Options -> Text Editor -> C# (in my case) -> Advanced -> Perform editor feature analysis in external process (experimental) Another place that can cause slow code analysis might be included analyses from nuget packages. I removed those AWSSDK analyzers. |
Hi, |
I'd appreciate an update as well. There's a number of questions about how to opt out of live code analysis on Stackoverflow and some frustration that it's not supported. On Google, the top searches triggered by typing "Visual Studio live code analysis" are
On Bing, the corresponding top searches are
I've had various exchanges with the Visual Studio team on a number of incarnations of this issue since 2006. While live analysis performance on VS 2017 was acceptable on the solutions I work with I'm finding it intrusive with the VS 2019 nugets, to the point where it interferes with fundamental operations like scrolling. There also seem to be problems with either thread leaks or infinite loops which require Visual Studio restarts to recover from in 16.1.3. These are particularly tedious as having the CPU pinned at 100% predictably makes VS slow to exit. I like live code analysis and find it quite useful but, during its episodes of poor behavior, it's not a feature which adds value. As such it seems appropriate to offer some form of opt out. While Code Analysis is being deprecated, something I think it gets right is its ability to run the ruleset on demand and get out of the way the rest of the time. It seems like this is currently semi-supported in that one can make a .ruleset file with few or no analyzers, switch projects to reduced .rulesets to duck some of the compute cost, and switch the projects back later. This is awkward and doesn't appear to be getting discovered by users. It also has the less than ideal result of opting out of warning level issues while retaining the overhead for information level issues like changing "out Foo ignored" to "out Foo _". It'd be valuable to have a design which preferentially allowed opting out of live informationals but still caught the more significant coding time concerns (e.g. missing Dispose() calls and CurrentCulture/InvariantCulture risks). VS has had a model somewhat like this for CodeLens for some time. Personally, I opt out of CodeLens completely as it's too much of a drag on UX responsiveness but use find all references as a pay as you need it alternative regularly. I wouldn't really want to do this with live analysis but it'd be great if there was a way quickly move an entire solution between live analyses levels to manage background compute costs. |
There seems to be a lot of pain around this feature online doing a simple search. Is it really difficult to just add a flag to just disable code analysis until roslyn is a bit more performant for those of us who wish to do so? For me, it kills my productivity with missed keystrokes and an unresponsive UI. A simple reg entry to turn it off would be appreciated! |
Especially for the folks that use R# for productivity, Roslyn has a huge impact on general performance in VS. There are moments, where VS just hangs, mouse clicks take a second or two to get recognized, typing lags etc. (that's with Windows Defender already disabled). And it gets worse with every major version change. I understand, that Roslyn is a needed feature for general VS users, but for Resharper users, Roslyn's analysis is just a nuisance, kills your productivity and brings nothing new to the table that Resharper doesn't at least provide as well. Obviously, the VS team is well aware of the performance problems, because they implemented this nice little yellow info bar, that tells you every couple of seconds, that Resharper is to blame. The truth is though, that VS and Resharper worked fluently together until Roslyn came along. So until Roslyn can fully replace Resharper, the option to disabling as much of Roslyn's analysis as possible, is a highly needed feature. Is this on the agenda of the team, or can the pros and cons or possibilities be discussed here @CyrusNajmabadi @sharwell ? |
@lauxjpn We work hard to fix all cases that get reported with traces that we can investigate. You can find the instructions here: https://aka.ms/reportPerf. Unfortunately, the number of different user configurations is almost unimaginatively gigantic, so there is no realistic way for us to confidently address your specific scenario without the additional information. Each release tends to behave like this:
Most people who move from the first category to the third category do so because they were able to capture the scenario in a way that allowed us to focus our investigation on it. |
This issue is likely to be addressed as part of #38429. |
I for one need to disable live code analysis not because it is slow (which it is) but rather because it is so annoying when VS complains about a missing |
vs2008 certainly checked many things in a live fashion. It didn't check more primarily due to limitations in the implementation which made narrow and incremental checking hard. But it would give live errors for all sorts of things :) That said, i have no problem with an option to disable live editor squiggles. Either as a specific option, or as part of a larger "lightweight editing" mode. Tagging @mavasani for context as he's been looking into this. |
Yes, we are actively planning for some top level option(s) or a more fine grained knob with multiple settings which would allow users to customize their preferred mode of operation and background analysis. |
@mavasani Thanks! |
I think it's important that we not try to do anything outside the norm or documentation of the format here: https://editorconfig.org/#file-format-details If the community around editorconfig adopts and supports these, then i'd have no problem with us doing the same. However, until then, I would prefer to stick with what is simple and effective and easily tooled across the ecosystem. |
I think you are reading what I write too literally. When I said internal ID, I didn't mean hidden -- I meant what analyzer is using internally.
Are you allowed to say in which version will this UI be released?
I guess file format itself is good enough, I just wish that the syntax for diagnostics message configuration was the same as the one for the editor formatting configuration.
Me neither, I was just pointing out that
Somehow I don't think that will happen soon. They seem to be happy with INI file format. |
It should be in whatever the very next release of roslyn is. It's possibly already been released in preview form. @jmarolf do you know?
Sure. but the benefit of this is that there's no guess work. You just take whatever ID we're showing you anywhere, and you use that. I do agree that there should be something in the editorconfig to help make the ID understandable. Sam outlined an approach that i think would work well.
Then i would prefer to stick with that. I don't want us going and breaking with convention :) |
This is currently available in Visual Studio 16.10 Preview 2 |
Good to know, given that release channels is on 16.9.4, I believe 16.10 is not that far away. |
Regarding the Live Code Analyzers options in a project property page:
I think the confusion is that this option is not available for .NET Framework projects. And legacy .NET Framework projects are likely to be larger and more prone to performance issues that would cause someone to need this option in the first place :-) The property page in Visual Studio really ought to include a note on how to disable Live Code Analyzers for .NET projects. It could just link here: https://docs.microsoft.com/en-us/visualstudio/code-quality/disable-code-analysis?view=vs-2019#net-framework-projects It was very confusing and in fact I installed a whole different preview version of VS to try to get it working! |
How happy i was using AMD Ryzen 7 5800x with 32gb of RAM quad-threaded along with Samsung EVO 970+ SSD on my home PC with 3 Chrome windows opened(30-50+ tabs each), with Ubuntu running VirtualBox, 5 messangers, IntellIj IDE running with zero latency or lagging Until i get to know what is Roslyn Code Analysis is in Visual Studio.... That one program while everything other is shut down kills my PC completly in a way that i even get black screen blinking while video driver crashes to respond or something That is worst experience i ever get by running a program. I read about advantages that this cool-great-feauture gives and i dont want ANY of it, no matter how great they are. Can pls someone tell how to remove this thing out of my PC forever ?!?! PLEASSEEEEEEEEE |
@AntonGrekov our server does absolutely nothing with the video subsystem. If you are having crashes there it is an issue with your hardware.
Please report an issue using visual studio and have it include a trace. We can see what has gone wrong. You can use the instructions here: https://docs.microsoft.com/en-us/visualstudio/ide/how-to-increase-chances-of-performance-issue-being-fixed?view=vs-2019#slowness-and-high-cpu-issues |
@CyrusNajmabadi This thing is drains absolutly all my RAM memory. Due to this video driver crashes, because of memory lack. Today i even wasnt unable to open WIndows Task Mgr - it errored due memory lacking. All that just after Roslyn Code Ananlysis started to work with my project - i didn't even build or debug project, just opened project that was opened 10-20 times before and didnt had any changes at all...... I hardly made a screenshot because if i would try to make a screenshot 1-2 minute later ScreenShot software would also crash because of a memory lack due Rosly Code Memory RAM killer drainer software. I tried reinstalling VisualStudio but that not seems to be an issue, the main problem is huge memory leak by Roslyn Code Analysis How to fix it ? You can see at screenshot it drains 17 GB !!! of RAM and its just a beggining, in 10-20 secs later it drains 22 GB and then goes to max 24 GB limit (Just no more RAM in my PC, it could go even to 50 GB) |
@AntonGrekov please see the comments in #24513 (comment) This process is container where many components from many teams run in. We will need a reported trace to determine what the issue is here and which team will need to investigate. |
@AntonGrekov there is a link provided to get the appropriate diagnostic information and traces so that the appropriate team can fix it. Please follow the instructions there. Thanks. |
I've reported a problem with wide detailed data range to microsoft team via Report a problem tool |
@AntonGrekov can you link me to your report? |
@CyrusNajmabadi sure, https://developercommunity.visualstudio.com/t/RoslynCodeAnalysisServiceexe-drains-UPT/10091268 even if all code analys is switched off and even if Roslyn Analyzer package is not installed via nugget it still kicks in for 25-27GB until it breaks whole OS. Fresh new Windows install just exact same behaviour I found one way to counter this: if visual studio is started on some project file(not any source code file) RAM usage may grow at max to 10 GB or even stay at 2-5GB. After around 3-5 mins it drops to 1.5 GB and now i can open sources and work normally If project is opened with any source file at start - RoslyCodeAnalysisService kicks in and drammatically grows in RAM usage to 14GB in around 30 secs, and keep growing until it errors itself or OS hang on..... Also that happens only on my project, which i won't say big. It has a lot of migrations, and some logic. I can't upload that project since it is commercial one Also, i am already thinking on buying 32 GB more, but that might not help, it could just take 57GB's and still crash UPDATE: even with "working" method when you start working with sources it still drains 23-25 GB's and crashes.... |
As mentinoed, this is a generic component host. Your issue may have nothing to do with code analysis. That said, thanks for the link, i'll look at it immediately. |
@AntonGrekov i don't see any perf traces included with your report. Did you follow the instructions linked previously (https://docs.microsoft.com/en-us/visualstudio/ide/how-to-increase-chances-of-performance-issue-being-fixed?view=vs-2019#slowness-and-high-cpu-issues)? Specifically, we need you to include the information related to |
@CyrusNajmabadi I dont quite remember but probably i did Report a problem, because i remember of many log files that were submitted while creating new issue. Anyway i followed suggested link and made a new recording, now for sure. https://developercommunity.visualstudio.com/t/RoslynCodeAnalysisService-drains-upto-25/10093330 |
Looks like it's still uploading and processing the data. Can you ping me tomorrow on this and i can look? |
@CyrusNajmabadi Sure, tomorrow i need to work on project that requires me to use VS, so i won't forget. Some more info: launching proejct with any file opened rather than sources seems to help as i mentioned above. open solution with initial project file(not source) - wait for 5-10 mins - ram rush seems to calm down and stops - now you can use VS At some point ram taken freezes at 10-12 gb, sometimes 2-4 and after launching debug it resets to 1.4gb and stays there |
@CyrusNajmabadi MS requrested record problem in first issue, did that as well |
Hey @AntonGrekov i don't see a trace attached to https://developercommunity.visualstudio.com/t/RoslynCodeAnalysisService-drains-upto-25/10093330. But i do see one attached to https://developercommunity.visualstudio.com/t/RoslynCodeAnalysisServiceexe-drains-UPT/10091268. Will look asap. |
Trace shows teh entirety of the time in: Interestingly the memory allocation hit is here: as a massive single outlier in the total memory allocated here: This indicates one of a few possibilities here:
'3' seems very likely, but i can't rule out '1' or '2'. Would you be willing to zip up all your sources and send them to me? I could then do a simple parsing analysis to see what is likely causing this. In hte meantime. @333fred @jcouv do you know of any existing issues with parsing anonymous-types, or anything we have fixed in this area that could be causing '3'? Looking at the code, i can see we do have a loop that does |
@AntonGrekov I'm going to open a new issue on this and migrate this information there. |
Issue opened as: #62603 |
Marking as 'need more info'. We will need information from @AntonGrekov to make progress on this. See: #62603 |
This was closed based on the discussion of performance it seems, not based on the original issue: to disable live code analysis. There is no resolution for that. |
Version Used: 2.6.0.6232903
Visual Studio 2017 marks
Bar()
with red squiggle before project is built:Is it possible to alter this behavior to show errors only after manually triggered build?
In Error List I see that the error message is produced by IntelliSense. I tried to disable full solution analysis in Text Editor options, set
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\Roslyn\Internal\OnOff\Features\Squiggles
registry to0
, alter analyzer Active Rule Set.For more information see Disable 'Show live semantic errors' for C# in Visual Studio 2017 and How to disable real time compilation in Visual Studio 2015 discussions on Stack Overflow.
The text was updated successfully, but these errors were encountered: