Roslyn: Unknown Hard Error - OutOfMemoryException - large solution with many analyzers (100+)

Created on 6 Apr 2016  Â·  51Comments  Â·  Source: dotnet/roslyn

Version Used:
Visual Studio 2015 Update 2

Steps to Reproduce:

  1. Loading a solution with round about 150 projects
  2. do nothing :) - in case you working it will not crash
  3. 3.

Actual Behavior:
Unknown hard error:

Event Log 1:

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.Collections.Immutable.ImmutableArray.CreateRange[TSource,TResult](ImmutableArray`1 items, Func`2 selector)
   at Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamespaceSymbol.get_DeclaringSyntaxReferences()
   at Microsoft.CodeAnalysis.CSharp.Symbol.Microsoft.CodeAnalysis.ISymbol.get_DeclaringSyntaxReferences()
   at Microsoft.CodeAnalysis.Diagnostics.SymbolDeclaredCompilationEvent.<>c__DisplayClass1_0.<.ctor>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.OnCompilationEventsGenerated_NoLock(ImmutableArray`1 compilationEvents, SyntaxTree filterTreeOpt, AnalyzerDriver driver, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.GenerateSimulatedCompilationSourceEvents(SyntaxTree tree, Compilation compilation, Func`4 getCachedSemanticModel, AnalyzerDriver driver, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.<GenerateSimulatedCompilationEventsAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.<ComputeAnalyzerDiagnosticsAsync>d__52.MoveNext()
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.FatalError.ReportUnlessCanceled(System.Exception)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers+<ComputeAnalyzerDiagnosticsAsync>d__52.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers+<ComputeAnalyzerDiagnosticsAsync>d__52.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.Diagnostics.CompilationWithAnalyzers+<GetAnalyzerDriverAsync>d__53.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.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Threading.Tasks.UnwrapPromise`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.UnwrapPromise`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+<>c__DisplayClass36_0+<<Initialize>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.Diagnostics.AnalyzerDriver+<GetAnalyzerActionsAsync>d__83.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.Diagnostics.AnalyzerManager+<GetAnalyzerActionsAsync>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 Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager+<GetCompilationAnalysisScopeAsync>d__8.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.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(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()

Event Log 2:

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.Collections.Immutable.ImmutableArray.CreateRange[TSource,TResult](ImmutableArray`1 items, Func`2 selector)
   at Microsoft.CodeAnalysis.CSharp.Symbols.SourceNamespaceSymbol.get_DeclaringSyntaxReferences()
   at Microsoft.CodeAnalysis.CSharp.Symbol.Microsoft.CodeAnalysis.ISymbol.get_DeclaringSyntaxReferences()
   at Microsoft.CodeAnalysis.Diagnostics.SymbolDeclaredCompilationEvent.<>c__DisplayClass1_0.<.ctor>b__0()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at System.Lazy`1.get_Value()
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.OnCompilationEventsGenerated_NoLock(ImmutableArray`1 compilationEvents, SyntaxTree filterTreeOpt, AnalyzerDriver driver, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.GenerateSimulatedCompilationSourceEvents(SyntaxTree tree, Compilation compilation, Func`4 getCachedSemanticModel, AnalyzerDriver driver, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Diagnostics.AnalysisState.<GenerateSimulatedCompilationEventsAsync>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.<ComputeAnalyzerDiagnosticsAsync>d__52.MoveNext()
Stack:
   at System.Environment.FailFast(System.String, System.Exception)
   at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception)
   at Microsoft.CodeAnalysis.FatalError.Report(System.Exception, System.Action`1<System.Exception>)
   at Microsoft.CodeAnalysis.FatalError.ReportUnlessCanceled(System.Exception)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers+<ComputeAnalyzerDiagnosticsAsync>d__52.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
   at Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers+<ComputeAnalyzerDiagnosticsAsync>d__52.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.Diagnostics.CompilationWithAnalyzers+<GetAnalyzerDriverAsync>d__53.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.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Threading.Tasks.UnwrapPromise`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetFromTask(System.Threading.Tasks.Task, Boolean)
   at System.Threading.Tasks.UnwrapPromise`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
   at System.Threading.Tasks.Task.FinishContinuations()
   at System.Threading.Tasks.Task.FinishStageThree()
   at System.Threading.Tasks.Task`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.Threading.Tasks.VoidTaskResult)
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[[System.Threading.Tasks.VoidTaskResult, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetResult(System.Threading.Tasks.Task`1<System.Threading.Tasks.VoidTaskResult>)
   at Microsoft.CodeAnalysis.Diagnostics.AnalyzerDriver+<>c__DisplayClass36_0+<<Initialize>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.Diagnostics.AnalyzerDriver+<GetAnalyzerActionsAsync>d__83.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.Diagnostics.AnalyzerManager+<GetAnalyzerActionsAsync>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 Microsoft.CodeAnalysis.Diagnostics.AnalyzerManager+<GetCompilationAnalysisScopeAsync>d__8.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.FinishStageTwo()
   at System.Threading.Tasks.Task.Finish(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()
Area-Analyzers Bug Tenet-Performance Tenet-Reliability

Most helpful comment

@Blubern Looking at your dump, it seems you have resharper installed. There seem to be a very large count of analyzers running over your solution - and the analyzer state tracking is taking up lot of VM. Can you try the following workarounds:

  1. Disable "Full solution analysis" for your project by going to Tools -> Options -> Text Editor -> C#(or Basic) -> Advanced -> Uncheck "Enable full solution analysis"
  2. If the above doesn't resolve your issue, can you try disabling resharper and see if that works?

We are investing in replacing the IDE diagnostic engine in Update3, which is aimed at improving the IDE performance for intellisense diagnostics. We will ensure that we add more analyzer stress tests to our perf suite.

All 51 comments

The analysis engine appears in both call stacks, so assigning to the analyzers area for investigation.

@Blubern Can you please share a memory dump? You can attach debugger from another VS instance and click Debug -> Save Dump As when you hit the exception or reach very high memory usage

@mavasani
I Uploaded the file. You will get an email. The Password for the download is 5qqIKIoh
Let me know if you need something more.

@Blubern Looking at your dump, it seems you have resharper installed. There seem to be a very large count of analyzers running over your solution - and the analyzer state tracking is taking up lot of VM. Can you try the following workarounds:

  1. Disable "Full solution analysis" for your project by going to Tools -> Options -> Text Editor -> C#(or Basic) -> Advanced -> Uncheck "Enable full solution analysis"
  2. If the above doesn't resolve your issue, can you try disabling resharper and see if that works?

We are investing in replacing the IDE diagnostic engine in Update3, which is aimed at improving the IDE performance for intellisense diagnostics. We will ensure that we add more analyzer stress tests to our perf suite.

@Blubern any luck with the workarounds?

@mavasani
Yes i had luck with workaround number 1.
resharper is still activated

Can i provide more information to repruduce the bug?
Please feel free to ask.

@Blubern Would you be able to share a minimal repro solution where you encountered this issue?
Meanwhile, I am trying to conjure up a repro myself (adding tons of analyzers to Roslyn.sln, which has 100+ projects). I have opened up a work item https://github.com/dotnet/roslyn/issues/10464 to ensure we add a rolling stress/performance test to cover this scenario.

@Blubern did you install any analyzer packages for your solution? Is the diagnostic count in your error list extremely large?

I am also wondering if you saw the following message in the IDE when the memory usage was shoting up.

disable_full_sln_analysis

We added this notification in Update2 to inform about low VM situations and automatically turn off full solution analysis. When I try to repro this with Roslyn.sln + 100s of analyzers, the VM reaches near the VM max soon and the full solution analysis gets turned off with the above message and the VM usage significantly drops down.

FYI @heejaechang: The low VM detection fix might not be working in all cases, as shown by this bug. Additionally, we need to improve the scalability of our analyzer execution in the IDE in Update3.

it tries to reduce chance of OOM, but it can’t prevent it completely. The warning doesn’t mean we won’t OOM.

  • heejae

From: Manish Vasani [mailto:[email protected]]
Sent: Tuesday, April 12, 2016 11:02 AM
To: dotnet/roslyn [email protected]
Cc: HeeJae Chang Heejae.[email protected]
Subject: Re: [dotnet/roslyn] Unknown Hard Error - OutOfMemoryException (#10365)

I am also wondering if you saw the following message in the IDE when the memory usage was shoting up.

[disable_full_sln_analysis]https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fcloud.githubusercontent.com%2fassets%2f10605811%2f14470317%2fa2fe0e16-009d-11e6-83e7-2f6998dd1798.png&data=01%7c01%7cHeejae.Chang%40microsoft.com%7c5b728902e80d4176446408d362fc89f7%7c72f988bf86f141af91ab2d7cd011db47%7c1&sdata=UhJIrVqYgmsU%2b05bgPXfX30nI3Q%2btcoemvoGQ2MwX5U%3d

We added this fix in Update2 to detect low VM situations and automatically turn off full solution analysis. When I try to repro this with Roslyn.sln + 100s of analyzers, the VM reaches near the VM max soon and the full solution analysis gets turned off with the above message and the VM usage significantly drops down.

FYI @heejaechanghttps://github.com/heejaechang: The low VM detection fix might not be working in all cases, as shown by this bug. Additionally, we need to improve the scalability of our analyzer execution in the IDE in Update3.

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/roslyn/issues/10365#issuecomment-209032006

@mavasani
@heejaechang

I saw the message with low memory since update 2.
Its true that i had some analyzer. I'm using the https://github.com/DotNetAnalyzers/StyleCopAnalyzers in every Project exception Unit Test Projects. Can it be that it is a bug in the StyleCopAnalyzers Project?

Should i still try to create a test solution?

Can you provide us a memory dump?

  • heejae

From: Tobias Allweier [mailto:[email protected]]
Sent: Tuesday, April 12, 2016 12:03 PM
To: dotnet/roslyn [email protected]
Cc: HeeJae Chang Heejae.[email protected]
Subject: Re: [dotnet/roslyn] Unknown Hard Error - OutOfMemoryException (#10365)

@mavasanihttps://github.com/mavasani
@heejaechanghttps://github.com/heejaechang

I saw the message with low memory sind update 2.
Its true that i hand some analyzer. I'm using the https://github.com/DotNetAnalyzers/StyleCopAnalyzers in every Project exception Unit Test Projects. Can it be that it is a bug in the StyleCopAnalyzers Project?

Should i still try to create a test solution?

—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com/dotnet/roslyn/issues/10365#issuecomment-209055173

@mavasani
Can you share the dump with @heejaechang ?

@Blubern That is not a bug in StyleCop analyzers - it just has large number of analyzers and for a solution of such large size, our VS IDE analyzer engine just doesn't seem to be scaling well. I hit the low VM warning in Roslyn.sln with StyleCopAnalyzers turned on in around 2-3 minutes - devenv VM jumped to 2.5 GB.

@heejaechang I'll forward you the details about the dump and my analysis offline.

I think we have a repro now - enable StyleCop.Analyzers 1.0.0 on Roslyn.sln and within few minutes you will hit the Low VM warning with memory usage nearing 3 GB.

I am moving this to @heejaechang as we should address and verify this as part of his OOP work for Update3. HeeJae, please assign this to @basoundr for verification after we switch to new DiagnosticService engine - we should verify the memory usage for the above mentioned scenario before marking this as verified.

I just hit an OOM with "StyleCop.Analyzers 1.0.0 on Roslyn.sln" (basically checkout the branch https://github.com/mavasani/roslyn/tree/EnableStyleCopAnalyzers and open Roslyn.sln in VS). I am investigating the dump to confirm it is the same issue as reported by @Blubern and if so we have a valid repro and test case.

I can confirm that the dump I got from my OOM also matches the one reported here. Below are the biggest offenders:

085b1e28   798802     38342496 System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[Microsoft.CodeAnalysis.Diagnostics.AnalysisState+DeclarationAnalyzerStateData, Microsoft.CodeAnalysis]]
73a4dc28  1302091     39346796 System.Object[]
153c9230  1248966     39966912 Microsoft.CodeAnalysis.Diagnostics.DiagnosticService+<>c__DisplayClass14_0
739f835c  1259462     40302784 System.Action`1[[System.Threading.Tasks.Task, mscorlib]]
73a43800  1260354     40331328 System.Action
06d16bd0  2175765     43515300 Microsoft.CodeAnalysis.Diagnostics.EngineV1.DiagnosticIncrementalAnalyzer+ArgumentKey
111731f4  1249566     44984376 Microsoft.CodeAnalysis.Diagnostics.DiagnosticsUpdatedArgs
153cae30        3     45215364 System.Collections.Generic.Dictionary`2+Entry[[System.Object, mscorlib],[Microsoft.CodeAnalysis.Diagnostics.DiagnosticService+Data, Microsoft.CodeAnalysis.Features]][]
739f9194  2516310     50326200 System.Threading.Tasks.StandardTaskContinuation
0a83495c  1256856     60329088 System.Threading.Tasks.ContinuationResultTaskFromTask`1[[System.Threading.Tasks.Task, mscorlib]]
71768708  1256889     60330672 System.Threading.Tasks.UnwrapPromise`1[[System.Threading.Tasks.TaskExtensions+VoidResult, System.Core]]
101cc5ac  1259153     60439344 System.Threading.Tasks.ContinuationResultTaskFromTask`1[[System.Boolean, mscorlib]]
65ff5e50  2513708     80438656 System.Func`2[[System.Threading.Tasks.Task, mscorlib],[System.Threading.Tasks.Task, mscorlib]]
7436a704  2518109     80579488 System.Func`2[[System.Threading.Tasks.Task, mscorlib],[System.Boolean, mscorlib]]
73a42430  2517815    100712600 System.Threading.Tasks.Task+ContingentProperties
73a4b424  2517915    110788260 System.Threading.ExecutionContext
73a4d834  1144571    142361474 System.String
00465950   881583    146119034      Free
73a4f680    98009    238484364 System.Int32[]
142d8680     4936    451255904 System.Collections.Generic.Dictionary`2+Entry[[Microsoft.CodeAnalysis.ISymbol, Microsoft.CodeAnalysis],[System.Collections.Generic.Dictionary`2[[System.Int32, mscorlib],[Microsoft.CodeAnalysis.Diagnostics.AnalysisState+DeclarationAnalyzerStateData, Microsoft.CodeAnalysis]], mscorlib]][]
142d8888     4936    451988064 System.Collections.Generic.Dictionary`2+Entry[[Microsoft.CodeAnalysis.Diagnostics.CompilationEvent, Microsoft.CodeAnalysis],[Microsoft.CodeAnalysis.Diagnostics.AnalysisState+AnalyzerStateData, Microsoft.CodeAnalysis]][]

@mavasani, @heejaechang, see also #10655 for another repro. You don't need a lot of analyzers, just keep opening and closing solutions with analyzers. @mjcheetham spent a lot of time looking at it, and can help with further info if you need it.

We experience similar issues with our Refactoring Essentials extension (see https://github.com/icsharpcode/RefactoringEssentials/issues/159). This is how we could reproduce the high RAM consumption (or even OOM) quite well:

  1. Check out or download SharpDevelop and RefactoringEssentials project code.
  2. Open SharpDevelop solution in VS.
  3. Wait until RE collects more than 4000 analyzer messages (see "Error List")
  4. Directly open RefactoringEssentials solution without closing the previous one.
  5. See RAM consumption of VS explode. VS will hang for some time (needing ca. 3 GB RAM) and finally crash.

As @blairmcg already mentioned this issue seems to be connected to closing and opening solutions, especially with many analyzers or while analysis is still ongoing.

I just checked in a fix related to this.
https://github.com/dotnet/roslyn/pull/10715

also, confirmed this improve this situation.
https://github.com/dotnet/roslyn/pull/10509

see more info from here
https://github.com/dotnet/roslyn/issues/10655

To summarize:

  1. Original issue raised by @Blubern has been fixed with https://github.com/dotnet/roslyn/pull/10616. We are hoping to push this fix into the next microupdate.
  2. Issue raised by @blairmcg has been fixed by @heejaechang and is already the part of the next microupdate.

Are microupdates available for the public to install? Would really like to have these fixes since my team's project is badly affected by these bugs.

@dpuza

  1. Issue raised by @Blubern has a workaround. See https://github.com/dotnet/roslyn/issues/10365#issuecomment-208843210. We hope to have a fix for this issue in the next microupdate (which should be 2-3 weeks from now).
  2. Issue #10655 has been fixed by @heejaechang and the fix should be part of the microupdate planned soon (hopefully this week).

Update:

  1. Original issue raised by @Blubern has been fixed in Roslyn master and will be part of Update3. For Update2, the recommendation is to turn off full solution analysis and use explicit built to get full solution analyzer diagnostics. However, if you want to try out latest Roslyn bits with the fix (just a VSIX install) - please get in touch with @morrisjoe and he can assist you.
  2. Fix for Issue #10655 is available with VS2015 Microupdate 2.3: https://msdn.microsoft.com/en-us/library/mt695655.aspx

@morrisjoe I would like the VSIX for this fix as mentioned by @mavasani above

@dpuza you can download ir for here if you want to verify that it is fixed

@ScottGross Yes.

Clarification on the VSIX - The VSIX is basically the latest nightly bits of Roslyn, not just the performance fix for full solution analysis. You can verify that the full solution analysis performance has improved post Update2, but you might hit some new issues in unrelated features as these are nightly bits, which haven't gone through rigorous testing. Recommendation is to uninstall the VSIX if you hit other issues that you didn't see in Update2.

@mavasani One of the comments in that Connect item (a comment by Clabough) mentions the seemingly same problem happened when editing a large ASPX file, despite full solution analysis for C# being already disabled. Would it be possible to verify this?

I have a few questions about the general performance of VS, please:

  1. Is the micro-update at https://msdn.microsoft.com/en-us/library/mt695655.aspx considered stable and therefore safe to install?
  2. Can the Roslyn VSIX be installed on top of the micro-update?
  3. @mavasani you mentioned Update 3 - when is this going to be released?
  1. Yes, the micro-update is stable
  2. The VSIX will install on top of the microupdate
  3. This is currently targeted for update 3. I don't know if these fixes will make it into a micro-update

@jmarolf thank you very much for your reply. However, I can see now that I need to clarify my third question - when is Update 3 going to be released?

Unfortunately, I can't comment on when VS releases are

@jmarolf I understand, how about an approximate time then? Within a month, three months, six months?

Could you also help with this problem: I've just installed the micro-update but my About window shows 14.0.25123.00 instead of 14.0.25130.00 as indicated at https://msdn.microsoft.com/en-us/library/mt695655.aspx#Anchor_1?

@ddobrev HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\devenv\1033 has a Version key which is the _base_ VS Version (such as Update 2) and UpdateVersion which is the latest micro-update version that is installed on your machine

@jmarolf on my machine Version is 14.0.23107 and UpdateVersion is 14.0.25123, is this correct if the micro-update has been installed?

looks like I steered you wrong. according to http://versionof.net/ you have VS RTM with Update 2 installed. I'll look up how you can check the micro-update version

I understand, thank you for your time. I'll check as soon as you let me know.

I had the same problem and I have installed the micro-update and VSIX and now I have this problem
error : Project 'xyz' could not be opened because the Visual C# 2015 compiler could not be created. Please re-install Visual Studio.
For version in HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\DevDiv\vs\Servicing\14.0\devenv\1033 and I have 14.0.23107
And for UpdateVersion I have 14.0.25123

@mzaatar your VS might have messed up. can you close all VS instances and open VS developer command prompt and then do

devenv /updateconfiguration

@heejaechang Thanks for quick response but now the VS crashes when I'm trying to open the mentioned project :(

@mzaatar if you can give me dump, I can take a look to see why it is crashing. but also, before going through the dump route, you could try clean your solution up and then open such as git clean -xdf

I had the same problem of @mzaatar with the VSIX.... I had to reinstall VS and the problem persist, Then i checked the installation log to find that the installer think that roselyn package is installed but it's not. I manually run the uninstaller and then reinstall VS. It was a nightmare and lost an entire day to solve. I thnik the VSIX mess up VS.... :(

@KodaPOwER Reinstalling the VS didn't solve the problem :( I will get a fresh copy of Windows VM tonight. That's why I'm using Windows under Mac OS!

@KodaPOwER @mzaatar @jmarolf can we get activitylog from VS by running it by devenv /log or dump to see what got messed up?

@KodaPOwER @mzaatar Just wanted to update you. I believe this issue is being caused by a a bug in how visual studio installs extensions. Sorry I don't have more to report than that. As soon as I have a fix you can apply I'll let you know.

@jmarolf That's have sense. @mzaatar I have now repaired my visual studio installation with this steps:

  1. Uninstalled visual studio with Microsoft Visual Studio Total Uninstaller finded on microsoft github
  2. Deleted all package in c:\ProgramData\PackageCache
  3. Full reinstall of Visual Studio upgraded at the very last version.

Now I'm fully operational, i can compile, intellisense works and i can even debug :-P
Now the only problem that remain is the message "Low memory detected. Full solution analysis disabled for this solution" even if the solution wide analysis is already disabled.

@KodaPOwER @mzaatar you should only need to run devenv /updateconfiguration form an administrative developer prompt to get back to a working state if you see package load failures.

Was this page helpful?
0 / 5 - 0 ratings