Windows Defender Real Time Protection Service slowing down Visual Studio etc - windows

Since past two months or so I have been observing a strange phenomenon with the Real Time Protection Service that comes bundled in as a part of Windows Defender on Windows 10.
When this service is set to ON Visual Studio builds take an excruciatingly long time to complete. Visual Studio itself takes forever to launch. Further if there are managed add-ins (written using Visual Studio Tools For Office, VSTO) installed in Outlook, Outlook takes 13-14 seconds to launch! When this service is disabled Outlook again launches within two seconds or so.
I have raised this on Twitter with Windows Support and tried discussing this online with Microsoft Support for an hour without any resolution. Looking around the internet I can see there are users who are reporting same problems such as
http://ardalis.com/speed-up-visual-studio-build-times
Slow page refresh times during development
I have been noticing this for only two months or so. I have tried spinning up new VMs in Azure etc. to test this and in every instance I have noticed this Real TIme Protection Service to be the culprit. My main issue is the Outlook Add In load time to be honest.
I tried posting this on Microsoft answer's site here but so far no luck. I was hoping if anyone here knows how to get this resolved without adding exception for Outlook in Real Time Protection Service (after which the add-ins load as expected within 200 milliseconds).

I had the same symptoms and my problem was fixed by disabling logs in Microsoft .Net Framework Assembly Binding Log Viewer (FUSLOGVW.exe). I forgot that I was running a test and left logging on.
Run the viewer as administrator.
Click Settings button.
Check Log Disabled

Try excluding Visual Studio related file types from Windows Defender like this person did for Delphi:
If you are cool with no protection at all you could disable Windows Defender, but I wouldn't recommend it.

Another answer to this problem, rather than excluding certain file extensions from Real Tme Scanning, is to exclude certain directories. Then you can exclude your Delphi/Visual Studio/Eclipse workspace.
I also found that certain apps during development make heavy use of the tmp dir. You can create a specific temp dir for your dev work and then configure your IDE/dev tools to use that temp dir instead of the system one, and then exclude that temp dir from real-time scanning.

Here are two links to fix performance issues caused by Real-Time scanning, by excluding VS processes and Folders,
thus improving the performance of VS in general but especially when Building.
1- Ready PowerShell script:
Adds Windows Defender exclusions for Visual Studio 2019 by Ryan-Efendy
PS: by default executing scripts is disabled, just enable before executing, and disable after executing
Set-ExecutionPolicy unrestricted
run command
Set-ExecutionPolicy restricted
2- Same but you have to do the steps manually.
Tweaking the environment to speed up Visual Studio by Burak Tasci

Related

Best practices remote debugging using VS2010 under VS2013

I'm looking for tips for those who to develop for Windows XP embedded in Visual Studio2013, then debug in Visual Studio 2010.
The reasons for this are discussed in this Stack Overflow Link on the topic.
Essentially the remote debug protocol changed after VS2010, and the new msvsmon.exe which uses the new VS2013 protocol doesn't support XP embedded debugging. So we are forced into a TWO IDE solution, one for builds, another for debug. VS2013 is used for builds, and VS2010 is used to launch remote debug sessions.
There is some misinformation about the requirement to purchase both VS2013 and VS2010. It appears from the previously mentioned link, that it's possible to obtain the VS2010 debug environment for free. I was able to verify the free download of the components, but haven't had time to validate that the debug environment works. The environment I use consists of a licensed copy of VS2013 and a licensed copy of VS2010.
Here are two initial problems which I haven't seen doing remote debug in the former VS6 msvsmon.exe environment:
1) With VS2013 build projects, VS2010 does not want to open the *.sln file. If I open the VS6 .dsp/.dsw we ported from VS2010 does a "ONE TIME CONVERSION" which destroys my painstakenly built VS2013 build project.
It seems I will have to build TWO different solution spaces, one named SOLUTION_NAME_VS2013 and another SOLUTION_NAME_VS2010. I'm interested to know if there is a more elegant solution to manage 1 set of BUILD files with two different "Highlander" (there can be only one) IDE's.
2) When starting up the project remotely, if it crashes I get one of those annoying "Your program has crashed" dialogs on the Win2012 debug host (running VS2010), which is trapping the crash signal from the debugger. About 30% of the time, it detects the running instance of VS2010, 70% of the time it doesn't.
3) msvmon times out (needs restarting) and requires extra time/mouse clicks to setup over the old vs6 msvcmon.exe
I'm wondering if other Windows Embedded developers have discovered elegant solutions for these issues. I'll post what I find here if I find any more tips moving forward.
For Issue #1: Unable to read VS2013 *.sln file in VS2010.
The problem was that the VERSION of Visual Studio 2010 must be at least SERVICE PACK1. Earlier versions of Visual Studio 2010 cannot read the VS2012/VS2013/VS2015 solution files.
For Issue #2: Your program has crashed dialog preventing signals from reaching debugger.
This Stack Overflow link was helpful. There are multiple ways to suppress the "Your program has crashed" dialog. In my case, users may need to debug new applications on a production system, so changing the setting globally is not ideal.
I choose the solution from this Raymond Chen link it allows me to disable the dialog box on an application by application basis. Since I typically have access to source code I'm debugging this was the best solution for me.
DWORD dwMode = SetErrorMode(SEM_NOGPFAULTERRORBOX);
SetErrorMode(dwMode | SEM_NOGPFAULTERRORBOX);
I still see an issue occasionally with the Windows runtime not seeing the running debugger instance on a crash and wanting to initiate a new one. This seems to happen ~30% of the time. When I figure out what is causing that I will update it here.
Finally, the new remote debug client changed to msvmon.exe which has improved security. To save the extra mouse clicks, the following command is usefull to run on the remote Windows Embedded XP client:
"Path\to\msvsmon.exe" /anyuser /noauth /nosecuritywarn /timeout:2147483646
The /noauth and /anyuser require /nosecuritywarn. /timeout max value keeps the debugger client from terminating after ~ hour of idle time. If your workday is to be spent debugging you don't want it timing out after a coffee/rebuild all break.

Visual Studio 2015 installer hangs during install?

I downloaded the full ISO for Visual Studio Ultimate CTP 6. The installation program got to about the 90% mark, gauging by the progress bar, and just stuck there. There was frequent activity from Superfetch, Anti-malware protection, and other background processes, but the progress bar was dead still. Eventually the background task activity subsided after 20 minutes, but the progress bar still wouldn't budge.
CHEAP TRICK: Open a notepad window and position the left edge of it so it perfectly marks the current position of the progress bar. If it the progress bar doesn't move past the left edge of the notepad window in about an hour, it's probably stuck.
This was a case of one of the sub-installers getting stuck during the install and never completing. Unfortunately when this happens, it looks like the master installer never times out the operation. The trick is to open up the Task Manager in detail mode, and look for a sub-installer process that is showing 0% CPU usage and 0% disk usage, indicating it has died. Then just kill that process and the master installation will resume. In my case, the name of the sub-installer was SecondaryInstaller.exe and according to the installation log it happened while it was trying to install some Android SDK components for the cross platform development modules. It had frozen permanently. I killed it and the master installer completed. When I ran Visual Studio it was fine, although I'm guessing I'll have to do some digging on the Android components install problem.
I temporarily disabled my antivirus (AVG) and restarted the install. That fixed it.
The current version of AVG Free antivirus is incompatible with Microsoft Visual Studio 2015.
It does not allow Visual Studio to be installed on the computer. It gets stuck at "Creating restore point". Visual Studio installs perfectly when AVG is turned off.
Any code compiled in "Release" mode targeting x86 platform/environment (in project properties) does not compile. It compiles successfully when AVG is turned off.
I posted the issues in AVG support forum but no one responded.
Same thing happened to me, and I also tried to terminate secondary process from task manager. Do not do that. It is not a solution, but rather a hack which may cause issues later. In my case, I was not even able to uninstall Visual Studio. I tried both web installation and ISO, same issue.
Here is how it worked finally. I restored my Windows 7 to earliest restore point as possible, when there was nothing installed, so I was sure that there would be no conflicts between the different tools (Java, Android API, etc.)
I started the installation of Visual Studio 2015 Community Release Candidate at 10 p.m. At 7 a.m., it was working on Android API 19-21. A hour later, it was finally preparing Visual Studio.
This means that all you need to do is to actually wait 8 to 9 hours. Don't terminate the secondary installer at risk of breaking your Visual Studio; just wait.
During the installation if you think it has hung (notably during the "Android SDK Setup"), browse to your %temp% directory and order by "Date modified" (descending), there should be a bunch of log files created by the installer.
The one for the "Android SDK Setup" will be named "AndroidSDK_SI.log" (or similar).
Open the file and got to the end of it (Ctrl+End), this should indicate the progress of the current file that is being downloaded.
i.e: "(80%, 349 KiB/s, 99 seconds left)"
Reopening the file, again going to the end, you should see further indication that the download has progressed (or you could just track the modified timestamp of the file [in minutes]).
i.e: "(99%, 351 KiB/s, 1 seconds left)"
Unfortunately, the installer doesn't indicate this progress (it's running in a separate "Java.exe" process, used by the Android SDK).
This seems like a rather long-winded way to check what's happening but does give an indication that the installer hasn't hung and is doing something, albeit very slowly.
I had the same problem when I tried to install VS 2015 RC from ISO. It got stuck during Android SDK Setup (API Level 19 & 21, System Images). For me the problem was metered Wi-Fi connection. The installer didn't download necessary files.
Turning off the Internet connection resolved the problem. When installation finished, it said that some components were not installed and it will try to download and install them later.
Check if your Windows has pending updates. After the restart, installation worked as expected.
Alright so after hours of googling and failed attempts at solving this including many of the suggestions above, I found a solution I tried on a whim and worked for me.
Attempt to install the program, then, when it gets "stuck", cancel it, but don't uninstall.
Then, go to the control panel, go to programs, go and attempt to uninstall it, select "Repair" instead of Uninstall.
"Repairing" Visual Studio appears to have completely worked and was very quick, under 5 minutes and everything seems to work fine.
This issue is becoming very now, specially for users installing visual studio on windows 10 platform. What Microsoft suggests is disable your anti virus and anti malware programs and always run setup with admin permission.
But in my case I have to do lot more things to get rid of this issue:
1. Disabled AVG realtime protaction
2. Disabled AVG from task manager
3. Remove all the files and folders from system temp folder. (You can open it by typing %temp% and hit enter in run prompt)
4. Run setup again as admin
Here is a complete list of incidents that I faced in this issue (visual studio 2015 installation got stuck)
And how I resolved it
I got stuck during Android SDK Setup (API Level 19 and 21) Turning OFF and ON the Internet connection resolved the issue and the installation completed successfully.
My VS 2015 install hung after hours of downloading. The VS installer window said it was still proceeding, but Windows Resource Monitor indicated there had been no networ, disk, or CPU usage by the vs_community.exe process tree for dozens of minutes. Windows Process Explorer revealed wusa.exe at the bottom of this tree (wusa is Windows Update Standalone Installer). Tempted to kill wusa.exe, I instead heeded the warnings in other answers to this question.
After studying other answers here (strongly recommended), I made an educated guess and initiated a restart of my Windows 7 Pro. The restart hung because vs_community.exe would not exit. I therefore selected Cancel on Windows' restart popup.
Windows returned to my user session, and now the VS 2015 install came to life(!) Process Explorer revealed wusa.exe no longer present. I therefore suspect that was the roadblock, but my conscience is clean (I didn't kill wusa.exe, Windows did!)
After awhile the installer displayed the following:
When I clicked Restart Now, Windows restarted to a "Configuring Windows" screen, and completed my VS install.
This solution is a safe mix of killing the sub tasks answer and the waiting answer:
when the installer gets stuck, simply launch the task manager and kill the process
if you attempt to run the app again, it will say that the app installation is not complete
run the installer again, and click on repair
installs fine
When stuck on Visual Studio Preparation:
I killed vs_enterprise.exe with higher PID, Visual Studio threw an error, that "pipe is being closed". Restarted PC & Logged in. Visual Studio started automatically and has completed within 1 minute.
A better approach to find whether one of the subinstallers is blocked is to monitor its Network and Disk I/O activity. Process Explorer from Sysinternals does an excellent job. Android SDK Setup downloads large amounts of data (more than 1GB) and the CPU sits idle waiting for an I/O-bound operation to be completed. Under no circumstances you should attempt to kill any process, or you might risk corrupting your installation of Visual Studio. In the worst case scenario, cancelling and rerunning the setup should help.
Mine froze on the Diagnostic Tools for 3 hours. I tried disabling my firewall and turning off internet among many other attempts to resolve this. In the end the following actions allowed the installer to complete and VS2015 Community edition to launch.
I then opened the latest log file in the %temp% folder, and navigated
to the end of the file.
In the last few log lines there was an entry: "MSI (s) (DC:4C)
[16:28:36:577]: Created Custom Action Server with PID xxxx"
I ended the process with the same PID, and then the installer
continued. I had to do it roughly 3 times in total and then the
installer completed successfully.
All seems to be working OK so far (fingers crossed!!)
For Windows10:
1) Kill VS2015 Process if hung
2) Disable Windows Defender
3) Open VS2015 as Administrator
4) Enable Windows Defender
5) Initial VS2015 startup is complete
I have similar problems, my savior became Windows Safe Mode
STEPS:
Restart Windows in Safe Mode (*run msconfig -> boot -> boot options -> check safe boot -> mode Network)
In Safe Mode:
Enable Windows Installer:
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer" /VE /T REG_SZ /F /D "Service"
Start Windows Installer service:
net start msiserver
Run Visual Studio Updater / Installer
Restart in normal mode (run msconfig -> boot -> boot options -> uncheck safe boot)
I had an issue with the Visual Studio Update 3 installer getting stuck on the "Features" tab at ther very start of installation...it would show only "Update 2 (installed)" and nothing else, with no way to proceed.
After trying some of the other more complex advice here, it turned out, to my surprise, that all I needed to do was use "Run as Administrator" when kicking off the installer. I was under the impression MSI generally runs with Admin privileges (under the Trusted Installer service) but I suppose the VS bootstrapper in this case does not.
I had the same issue. It would hang immediately, as soon as it said "Applying Microsoft Visual Studio 2015." There was only a small sliver in the progress bar. I even let the install run overnight. There was no disk activity or CPU usage from the installer.
What finally worked was to kill the process in Task Manager and restart the computer. As soon as I rebooted, the installer opened up automatically and completed successfully.
In my case the Graphics Tools Windows feature installation was hanging forever.
I've installed the Optional Windows Feature manually and restarted the setup of VS 2015.
I just installed VS 2015 Enterprise on Windows Server 2012 R2. The install was fast until it reached Update 1 which is past the 90% mark on the progress indicator. At that point, it took about 2 hours to complete. Be patient before you try anything more radical.
Mine got stuck applying the .NET 4.6.1 blah... Turning off the internet and disabling Microsoft Security Essentials Real-time protection got things moving again.
Well, I cant find any SecondaryInstaller.exe to stop in task manager and even I dont have any AV rather then Windows Defender so I found something else..
I stopped windows Update from elevated cmd by writing command net stop muauserv and it worked for me...
The update will Retry again for KB2664825 so run the code again in cmd..(because the service starts automatically)
Keep trying and its done for me...!!
I had the same problem on a different context. After trying to repair, uninstall, and reinstall with no solution, I decided to wipe out all Visual Studio remnant by using TotalUninstaller by follower the steps by steps on the link below:
https://github.com/Microsoft/VisualStudioUninstaller/releases
Once everything is removed, I was able to successfully install the software.
Be aware that TotalUninstaller will remove everything related to Visual Studio 2013 to 2015. Earlier version will still be preserved.
I added this solution in case someone has the exact same problem.
I've got same problem and unfortunately the accepted answer which suggests killing SecondaryInstaller.exe messed up installing the optional items. What I've done is basically opening the task manager and locate SecondaryInstaller.exe and right click and click on Open file location. Then run SecondaryInstaller.exe as an administrator.
In my case UAC was disabled (the infamous regedit trick) and so the installer clearly could not handle it.
You could revert back to UAC for the installer, or simply try launching it as admin, it worked for me.
If you are using windows 10, "Windows defender" might be the reason for blocking. mine is hang while installing "Java SE development"
To disable windows defender during the installation phase:
Open Windows Defender by clicking the Start button Picture of the Start button. In the search box, type Defender, and then, in the list of results, click Windows Defender.
Click Settings, and turn off Real-time protection.
I have experienced similar problems with Visual Studio 2015 Update 3.
In my case core issue was corrupted windows installer cache (C:\Windows\Installer)
Here is the line from msi installer log:
MSI (s) (4C:64) [10:40:10:059]: Warning: Local cached package 'C:\WINDOWS\Installer\3442502.msi' is missing.
You should check installation logs if installation cache is corrupted same way.
If it is you should pray for sfc utility to recover system integrity or you would reinstall windows from scratch as corrupted windows installer cache is a complete disaster and a reason to perform clear windows installation immediately.
I had a similar problem. My solution was to switch off the antivirus software (Avast), download the .iso file, mount it (double click in the Windows Explorer on the .iso file), and then run it from the PowerShell with admin rights with the following switches:
.\vs_community.exe /NoWeb /NoRefresh
This way you don't have to go offline or remove your existing installation.
For me it helped to stop the installation service forcefully using task manager. If Visual Studio was installed in Features & Programs then uninstall it, restart computer and try to install it again.
When starting the installation make sure to be have reliable internet connection

What is vshub.exe in the system tray?

I installed Visual Studio 14. Now I have a new app VsHub in the system tray / notification area. What is it? I tried clicking and right-clicking on it, it doesn't do anything.
According to Visual Studio Blog site (http://blogs.msdn.com/b/visualstudio/archive/2014/08/18/visual-studio-14-ctp-3-released.aspx?PageIndex=2&wa=wsignin1.0):
"The Visual Studio Hub is an executable that supports multi-tool
communication across the VS family of apps, service
composition/isolation, and data/compute outside of the Visual Studio
process."
I solved stopping the folliwing Windows service:
Visual Studio Standard Collector Service
After stop, my pc is returned to work correclty, without strange load.
I hope this help you.
I have a slightly more direct solution to this. It's relatively trivial to locate where VSHub.exe and its cohorts are on your hard disk. Just go into that directory, take ownership of all the .exe files contained in it, and for each of them use "Right Click" / "Properties" / Security, and add an ACL that denies execute permissions to everyone.
Problem solved. You will need to re-do this every time you update VS 2015, but on my low power laptop, I simply can't afford the resources to keep all these unnecessary tools running. VS 2015 runs just fine without them: I can edit, build and debug programs without any problems at all.
Sure, I may be missing some of the more esoteric features of VS 2015, but for my use case YAGNI

Compile on-the-fly in Visual Studio 2008 very slow

I'm experiencing some performance problems. When I edit a file, Visual Studio 2008 performs a background (on-the-fly) compilation and then, it updates the error list. During this time, the cursor in the file editor disappears, and the keys I press to move or type more character are buffered.
Once the background compilation is finished, the changes are reflected in the editor (1 - 2 seconds). Every time I edit a file, which happens often, this happens.
How can I fix this problem? If this is not possible, can I disable this automatic build?
I had an odd performance-related issue today. My Microsoft Visual Studio seemed to be taking far too long to perform even the simplest of operations. I Googled around and tried a few ideas that people had such as disabling add-ins or clearing Visual Studio’s recent projects list but those suggestions didn’t seem to solve the problem. I remembered that the Windows SysInternals website had a tool called Process Monitor that would sniff registry and file accesses by any running program.
It seemed to me that Visual Studio was up to something and Process Monitor should help me figure out what it was. I downloaded the most recent version, and after fiddling around a bit with its display filters, ran it and to my horror, I saw that Visual Studio was so slow because it was accessing the more than 10,000 folders in C:\Users\krintoul\AppData\Local\Microsoft\WebSiteCache on most IDE operations. I’m not sure why there were that many folders and moreover, wasn’t sure what Visual Studio was doing with them, but after I zipped those folders up and moved them somewhere else, Visual Studio’s performance improved tremendously.
The Windows SysInternals website has a number of other useful utilities for network management, security, system information and more. Check it out. I’m sure you’ll find something of value.

Visual Studio 2010 Periodically Hangs for Several Seconds

I'm having a problem where VS2010 Ultimate is freezing up every so often for several seconds before returning to normal operation. This happens several times during a session, and is obviously very annoying. I haven't been able to pin it down to any specific activity-- it seems to hang whenever I scroll around in a document, open/create a document, basically anything. Anyone else have this issue or know what might be the cause?
Incompatible add-ons or system configurations can cause Visual Studio issues (performance issue, error, etc).
Fortunately we can try to troubleshoot the issues by referring to the Visual Studio activity log.
Simply run the following command to run Visual Studio 2010 and log its all activities.
DevEnv.exe /log
The log file will be generated to:
XP
%USERPROFILE%\Application Data\Microsoft\Visual Studio\10.0\ActivityLog.xml
Vista & Windows 7
%USERPROFILE%\AppData\Roaming\Microsoft\VisualStudio\10.0\ActivityLog.xml
Once you run it, 2 files will be generated: ActivityLog.xml and ActivityLog.xsl
And when you open the ActivityLog.xml, it will contain something like this:
The problem was solved by deleting the user options file called SolutionName.suo.
Somehow it had gotten very big and probably corrupted. You will only lose your breakpoints and open files as far as I know, but rename it to be safe.
I know people have had problems with computers that are older or don't have as much RAM. I know my use of VS 2010 ultimate can run to 500 MB's sometimes and if you don't have enough RAM, then it will hang for a little.
I've had issues with VS2010 when debugging is running or if I'm opening files from a network drive. I'm not sure as I currently don't have any team server repos connected, but if you do maybe the connection to the repo might be an issue as well.
Turns out the issue was network related. One item in my solution was looking to a mapped network drive, which apparently didn't always respond fast enough.
My solution for that problem was beyond the scope of my thinking. I found it on this website, and it goes like:
Launch Internet Explorer. Go to Internet Options, then Advanced tab. Under the Security group, untick “Check for server certificate revocation“. You may need to restart Visual Studio.
My scenario is that I have network drives with references mapped via VPN. That should have to do with that.
I faced similar issue with Visual Studio 2008. I have not thoroughly investigated the issue though.
Reading your post it seems the behavior at your PC is really annoying, but for me it's not that frequent.
One thing I noticed, the frequency at which this happens is dependent on the RAM size and time elapsed since last setup. I came to this conclusion seeing the performance of machines of my colleagues.
I noticed that my anti-virus software tends to lock down my entire system sometimes. If you have an anti-virus application, you might try disabling it for a moment to see if it is the culprit.
I had a similar issue - that still happened after a /resetsettings, reinstall and using /safemode. For me, the issue was that Assembly Binding logging was turned on ago and I forgot to turn it off, it got to the stage where the log files concerned were >200MB and each append was taking ages...
Managed to find the issue with procmon from sysinternals. Suggest that anyone who comes across a similar issue tries procmon if none of the above solutions help.
My VS2010 would hang as well in a similar fashion.
DevEnv.exe /log would indicate it failed to load strings around the time it would hang.
Reinstalling VS2010 SP1 and deinstalling Resharper to install Resharper 7.1.3 solved the problem.

Resources