public void OnAnalyzerLoadFailed(object sender, AnalyzerLoadFailureEventArgs e) { var reference = sender as AnalyzerFileReference; if (reference == null) { return; } var diagnostic = AnalyzerHelper.CreateAnalyzerLoadFailureDiagnostic(reference.FullPath, e); // diagnostic from host analyzer can never go away var args = DiagnosticsUpdatedArgs.DiagnosticsCreated( id: Tuple.Create(this, reference.FullPath, e.ErrorCode, e.TypeName), workspace: _primaryWorkspace.Workspace, solution: null, projectId: null, documentId: null, diagnostics: ImmutableArray.Create <DiagnosticData>(diagnostic)); // this can be null in test. but in product code, this should never be null. _hostUpdateSource?.RaiseDiagnosticsUpdated(args); }