private RoslynDiagnosticService(IComponentModel componentModel) { componentModel.ThrowOnNull(nameof(componentModel)); _componentModel = componentModel; DiagnosticAnalyzerServiceType = GetInternalRoslynServiceType(); foreach (Type type in typeof(DocumentId).Assembly.GetTypes()) { if (type.Name == DiagnosticDataTypeName) { DiagnosticDataType = type; } else if (type.Name == DiagnosticDataLocationTypeName) { DiagnosticDataLocationType = type; } } DiagnosticAnalyzerServiceType.ThrowOnNull(nameof(DiagnosticAnalyzerServiceType)); DiagnosticDataType.ThrowOnNull(nameof(DiagnosticDataType)); DiagnosticDataLocationType.ThrowOnNull(nameof(DiagnosticDataLocationType)); _roslynAnalyzersService = GetDiagnosticServiceInstance(componentModel, DiagnosticAnalyzerServiceType); _roslynAnalyzersService.ThrowOnNull(nameof(_roslynAnalyzersService)); _getDiagnosticOnTextSpanMethod = DiagnosticAnalyzerServiceType.GetMethod(GetDiagnosticsForSpanAsyncMethodName); _getDiagnosticOnTextSpanMethod.ThrowOnNull(nameof(_getDiagnosticOnTextSpanMethod)); _taskResultPropertyInfo = GetTaskResultPropertyInfo(DiagnosticDataType); _taskResultPropertyInfo.ThrowOnNull(nameof(_taskResultPropertyInfo)); }