diff --git a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.cs b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.cs index 961ab055cee8b820535e6e361e23f32d63a7c9c7..643e80ff5918484af2e65fe17abe5bcb24574255 100644 --- a/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.cs +++ b/src/Features/Core/Portable/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.StateManager.cs @@ -133,6 +133,12 @@ public ImmutableArray CreateBuildOnlyProjectStateSet(Project project) // we always include compiler analyzer in build only state var compilerAnalyzer = _analyzerManager.GetCompilerDiagnosticAnalyzer(project.Language); + if (compilerAnalyzer == null) + { + // only way to get here is if MEF is corrupted. + FailFast.OnFatalException(new Exception("How can this happen?")); + } + StateSet compilerStateSet; if (hostStateSetMap.TryGetValue(compilerAnalyzer, out compilerStateSet)) {