I was happy to see that CodeRush for Roslyn finally left the beta phase and ended up on my download page. So I uninstalled CodeRush "Classic" to replace it with CRR on one of my machines (where I only do C# with VS2015).
While startup and interaction seemed a lot snappier and quicker than before, there is one major issue I keep hitting:
I use Git for source control, and I mainly work from command line (no Visual Studio plugins or anything). After switching between branches (using "git checkout the-other-branch"), VS mostly tells me that the project files changed and that it has to reload (with the big dialog that has "Reload All", "Reload", "Ignore All", "Ignore" buttons). Hitting "Reload All" does what I expected from Visual Studio (ie. reloading the changed projects), but compared to CR Classic and Visual Studio with CRR disabled, it spikes to 100% CPU and stays there for a couple of minutes, only showing the "Visual Studio is currently busy" popup.
Disabling CRR gets the old behavior back, so I thought I'd report it over here first before going to Microsofts' Connect (should it be Roslyn related).
The Solutions in question are average size I guess, with 15 projects (7 of which are test projects), about 7k files and a total of 500k LOC (counting everything, not just actual source).
The machine running this is an Intel Core i7 6700 with 32 GB RAM and both Solutions and Visual Studio/CRR on an SSD.
On average, one or two of the projects have changed between branches due to other developers adding/removing files.
Hi Emmanuel,
I tried to reproduce the issue (by switching between branches) but failed. To help us diagnose which operation caused this slowdown, would you please collect performance data using the PerfView tool from Microsoft?
Follow these steps:
1. Download and Run PerfView.
2. Select the Collect=>Collect menu item.
3. Watch when the Visual Studio editor hangs and then press the "Start Collection" button on the PerfView window.
4. Collect information for about 20-30 seconds and press the "Stop Collection" button.
5. Wait until merging is finished.
6. Send a zip file to us.
As a temporary workaround, I suggest you close an active solution in VS before switching branches to avoid reloading changed projects.
Hi Alex,
I noticed that I'm used to building right away once VS is back up (so either Ctrl+Shift+B, F5 or Ctrl+F5), which might play into that. Sometimes, VS hangs right away, while at other times it simply shows the popup "This takes longer than expected" while being available very sluggishly.
I'm currently uploading the Zip, but it will take some time.
Regards, Emanuel
Emanuel,
Thank you for sending the performance data. We have researched them and found a possible cause of the slowdown, and we will work on improving the performance. We will update the ticket once we have any results. Thank you for your patience.
Great, glad I could help!
If you need anything else, don't hesitate to ask.
Thank you for your cooperation, Emanuel!
Hi Emanuel,
We have made changes based on your performance report. Please install the build from the link below, try to reproduce this problem, and let me know your results:
DevExpress.CodeRush.Roslyn-16.1.6.16249.vsix
Hi Andrew,
VS appears to be more responsive at first, but it still runs at 100% CPU and then eats up RAM over the course of a few minutes. While I technically could work with the solution, it stalls a little every now and then while consuming more and more RAM. After reaching about 3 GB, VS just quit with an OutOfMemoryException (which doesn't even appear to be inside CRR):
Application: devenv.exe Framework Version: v4.0.30319 Description: The application requested process termination through System.Environment.FailFast(string message). Message: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.GetTaskForResult(TResult result) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetResult(TResult result) at Microsoft.CodeAnalysis.DocumentState.<GetSyntaxTreeAsync>d__34.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine) at Microsoft.CodeAnalysis.DocumentState.GetSyntaxTreeAsync(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Solution.CompilationTracker.<BuildDeclarationCompilationFromScratchAsync>d__24.MoveNext() Stack: at System.Environment.FailFast(System.String, System.Exception) at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action`1<System.Exception>) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportUnlessCanceled(System.Exception) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildDeclarationCompilationFromScratchAsync>d__24.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetTaskForResult(System.__Canon) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.__Canon) at Microsoft.CodeAnalysis.DocumentState+<GetSyntaxTreeAsync>d__34.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.DocumentState+<GetSyntaxTreeAsync>d__34, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<GetSyntaxTreeAsync>d__34 ByRef) at Microsoft.CodeAnalysis.DocumentState.GetSyntaxTreeAsync(System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildDeclarationCompilationFromScratchAsync>d__24.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildDeclarationCompilationFromScratchAsync>d__24, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<BuildDeclarationCompilationFromScratchAsync>d__24 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.BuildDeclarationCompilationFromScratchAsync(Microsoft.CodeAnalysis.Solution, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildCompilationInfoFromScratchAsync>d__23.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.CodeAnalysis.Solution+CompilationTracker+CompilationInfo, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildCompilationInfoFromScratchAsync>d__23, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<BuildCompilationInfoFromScratchAsync>d__23 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.BuildCompilationInfoFromScratchAsync(Microsoft.CodeAnalysis.Solution, State, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker.BuildCompilationInfoAsync(Microsoft.CodeAnalysis.Solution, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__21.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.CodeAnalysis.Solution+CompilationTracker+CompilationInfo, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__21, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<GetOrBuildCompilationInfoAsync>d__21 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.GetOrBuildCompilationInfoAsync(Microsoft.CodeAnalysis.Solution, Boolean, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker.GetCompilationAsync(Microsoft.CodeAnalysis.Solution, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetMetadataReferenceAsync>d__33.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetMetadataReferenceAsync>d__33, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<GetMetadataReferenceAsync>d__33 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.GetMetadataReferenceAsync(Microsoft.CodeAnalysis.Solution, Microsoft.CodeAnalysis.ProjectState, Microsoft.CodeAnalysis.ProjectReference, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution.GetMetadataReferenceAsync(Microsoft.CodeAnalysis.ProjectReference, Microsoft.CodeAnalysis.ProjectState, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<FinalizeCompilationAsync>d__29.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.CodeAnalysis.Solution+CompilationTracker+CompilationInfo, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<FinalizeCompilationAsync>d__29, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<FinalizeCompilationAsync>d__29 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.FinalizeCompilationAsync(Microsoft.CodeAnalysis.Solution, Microsoft.CodeAnalysis.Compilation, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildCompilationInfoFromScratchAsync>d__23.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.CodeAnalysis.Solution+CompilationTracker+CompilationInfo, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<BuildCompilationInfoFromScratchAsync>d__23, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<BuildCompilationInfoFromScratchAsync>d__23 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.BuildCompilationInfoFromScratchAsync(Microsoft.CodeAnalysis.Solution, State, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker.BuildCompilationInfoAsync(Microsoft.CodeAnalysis.Solution, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__21.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[Microsoft.CodeAnalysis.Solution+CompilationTracker+CompilationInfo, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]].Start[[Microsoft.CodeAnalysis.Solution+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__21, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<GetOrBuildCompilationInfoAsync>d__21 ByRef) at Microsoft.CodeAnalysis.Solution+CompilationTracker.GetOrBuildCompilationInfoAsync(Microsoft.CodeAnalysis.Solution, Boolean, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution+CompilationTracker.GetCompilationAsync(Microsoft.CodeAnalysis.Solution, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Solution.GetCompilationAsync(Microsoft.CodeAnalysis.Project, System.Threading.CancellationToken) at Microsoft.CodeAnalysis.Document+<GetSemanticModelAsync>d__24.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[Microsoft.CodeAnalysis.Document+<GetSemanticModelAsync>d__24, Microsoft.CodeAnalysis.Workspaces, Version=1.3.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]](<GetSemanticModelAsync>d__24 ByRef) at Microsoft.CodeAnalysis.Document.GetSemanticModelAsync(System.Threading.CancellationToken) at DevExpress.CodeRush.TestRunner.Core.DocumentChangesAnalyzer+<ProcessChangesAsync>d__13.MoveNext() at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Start[[DevExpress.CodeRush.TestRunner.Core.DocumentChangesAnalyzer+<ProcessChangesAsync>d__13, DevExpress.CodeRush.TestRunner, Version=16.1.6.0, Culture=neutral, PublicKeyToken=79868b8147b5eae4]](<ProcessChangesAsync>d__13 ByRef) at DevExpress.CodeRush.TestRunner.Core.DocumentChangesAnalyzer.ProcessChangesAsync(Microsoft.CodeAnalysis.Document, System.Collections.Generic.IEnumerable`1<Microsoft.CodeAnalysis.Text.TextSpan>, System.Collections.Generic.IEnumerable`1<Microsoft.CodeAnalysis.ISymbol>) at DevExpress.CodeRush.TestRunner.Core.DocumentChangesAnalyzer+<>c__DisplayClass20_0+<<ProcessChangesAsync>b__0>d.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.__Canon) at Microsoft.CodeAnalysis.TextDocumentState+<GetTextAsync>d__26.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.__Canon) at Microsoft.CodeAnalysis.RecoverableTextAndVersion+<GetValueAsync>d__12.MoveNext() at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run() at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.FinishContinuations() at System.Threading.Tasks.Task.FinishStageThree() at System.Threading.Tasks.Task`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.__Canon) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.__Canon) at Roslyn.Utilities.AsyncLazy`1+Request[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CompleteFromTaskSynchronously(System.Threading.Tasks.Task`1<System.__Canon>) at Roslyn.Utilities.AsyncLazy`1+Request[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CompleteFromTaskSynchronouslyStub(System.Object) at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() at System.Threading.Tasks.Task.ExecutionContextCallback(System.Object) at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef) at System.Threading.Tasks.Task.ExecuteEntry(Boolean) at System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
I could probably do another performance report, but it seems a little too obvious (to me at least) that something is wrong.
Just for reference, merely opening the solution to idle with that build pushes VS to about 500 MB of RAM usage, while having CRR disabled does about 440-450 MB (which isn't too terribly different). Switching branches is a >3 GB OOM with CRR and about 780 MB without (which also indicates that VS itself isn't exactly innocent there; I also have a Connect issue open for about a year regarding general performance when XAML is involved, which barely gets anywhere).
Any thoughts on how to continue from here?
Please accept my apologies, I have sent an incorrect build. Install the build from the link below and let me know your results.
DevExpress.CodeRush.Roslyn-16.1.6.16273.vsix
Happens to the best of us, no harm done :)
That one looks a little more promising, Solution to idle is around 450 MB (pretty much the same as without CRR), after switching the branch it comfortably goes to about 720 MB and then drops down again to 550-600 MB (which looks about as good as it gets, with the rest of VS doing its thing).
The Solution stays responsive with that build, but hovers around 15% CPU usage (that is, a full core) - and I'm guessing thats something around the Roslyn infrastructure (or the initial solution parse of CRR)…and I believe that has been the case with the official build to, so nothing I'm too worried about.
I'll keep CRR enabled and see how VS behaves, then report back to you. But so far, it looks good!
Thanks, Emanuel
I'm happy to hear that the problem is not reproducible on your side. If you have any future difficulties, feel free to contact us.
A day later, and CRR still breezes as if nothing ever happened. I'm happy with that fix, thanks guys!
You are welcome.