2 writes to DiagnosticBag
Microsoft.CodeAnalysis (1)
Binding\BindingDiagnosticBag.cs (1)
27DiagnosticBag = diagnosticBag;
Microsoft.CodeAnalysis.VisualBasic (1)
Compilation\VisualBasicCompilation.vb (1)
2274FilterAndAppendAndFreeDiagnostics(result, builder.DiagnosticBag, cancellationToken)
318 references to DiagnosticBag
Microsoft.CodeAnalysis (24)
Binding\BindingDiagnosticBag.cs (17)
30[MemberNotNullWhen(true, nameof(DiagnosticBag))] 31internal bool AccumulatesDiagnostics => DiagnosticBag is object; 35DiagnosticBag?.AddRange(diagnostics); 40DiagnosticBag?.AddRange(diagnostics); 45Debug.Assert(DiagnosticBag is object); 46return DiagnosticBag?.HasAnyResolvedErrors() == true; 51Debug.Assert(DiagnosticBag is object); 52return DiagnosticBag?.HasAnyErrors() == true; 57DiagnosticBag?.Add(diag); 81DiagnosticBag?.Free(); 87return new ImmutableBindingDiagnostic<TAssemblySymbol>(DiagnosticBag?.ToReadOnly() ?? default, DependenciesBag?.ToImmutableArray() ?? default); 105DiagnosticBag?.Clear(); 120AddRange(other.DiagnosticBag); 130DiagnosticBag?.AddRange(bag); 222if (DiagnosticBag is DiagnosticBag diagnosticBag) 292if (DiagnosticBag is object) 294return ReportUseSiteDiagnostic(info, DiagnosticBag, location);
Diagnostic\CommonMessageProvider.cs (7)
264if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 274if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 284if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 294if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 304if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 314if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 324if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag)
Microsoft.CodeAnalysis.CSharp (207)
Binder\Binder.cs (6)
613if (diagnostics.DiagnosticBag is object) 615ReportDiagnosticsIfObsolete(diagnostics.DiagnosticBag, symbol, node, hasBaseReceiver); 702if (diagnostics.DiagnosticBag is object) 704ReportDiagnosticsIfObsolete(diagnostics.DiagnosticBag, symbol, node, hasBaseReceiver, containingMember, containingType, location); 736if (diagnostics.DiagnosticBag is object) 738ReportDiagnosticsIfObsoleteInternal(diagnostics.DiagnosticBag, symbol, node, containingMember, location);
Binder\Binder.ValueChecks.cs (1)
405Debug.Assert(valueKind is (BindValueKind.Assignable or BindValueKind.RefOrOut or BindValueKind.RefAssignable) || diagnostics.DiagnosticBag is null || diagnostics.HasAnyResolvedErrors());
Binder\Binder_Constraints.cs (1)
159else if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag)
Binder\Binder_Crefs.cs (6)
892Debug.Assert(unusedDiagnostics.DiagnosticBag is object); 908unusedDiagnostics.DiagnosticBag.Clear(); 912unusedDiagnostics.DiagnosticBag.Free(); 967Debug.Assert(localDiagnostics.DiagnosticBag is object); 973if (HasNonObsoleteError(localDiagnostics.DiagnosticBag)) 992localDiagnostics.DiagnosticBag.Free();
Binder\Binder_Deconstruct.cs (3)
108diagnostics.AddRange(deconstructionDiagnostics.DiagnosticBag); 120Debug.Assert(diagnostics.DiagnosticBag is object); 210Debug.Assert(diagnostics.DiagnosticBag is object);
Binder\Binder_Expressions.cs (3)
2689diagnostics.AddRange(bag.DiagnosticBag); 2699diagnostics.AddRange(bag.DiagnosticBag); 2708bag.DiagnosticBag.Free();
Binder\Binder_InterpolatedString.cs (2)
617var nonOutConstructorHasArityError = nonOutConstructorDiagnostics.DiagnosticBag?.AsEnumerableWithoutResolution().Any(d => (ErrorCode)d.Code == ErrorCode.ERR_BadCtorArgCount) ?? false; 618var outConstructorHasArityError = outConstructorDiagnostics.DiagnosticBag?.AsEnumerableWithoutResolution().Any(d => (ErrorCode)d.Code == ErrorCode.ERR_BadCtorArgCount) ?? false;
Binder\Binder_Invocation.cs (1)
145Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors());
Binder\Binder_Lambda.cs (1)
380ModifierUtils.ToDeclarationModifiers(syntax.Modifiers, isForTypeDeclaration: false, diagnostics.DiagnosticBag ?? new DiagnosticBag());
Binder\Binder_Symbols.cs (9)
248resultDiagnostics.DiagnosticBag.Free(); 253diagnostics.AddRange(resultDiagnostics.DiagnosticBag); 254resultDiagnostics.DiagnosticBag.Free(); 521if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 2219if (diagnostics.DiagnosticBag is object) 2221Emit.NoPia.EmbeddedTypesManager.IsValidEmbeddableType((NamedTypeSymbol)singleResult, where, diagnostics.DiagnosticBag); 2691return CheckFeatureAvailability(syntax, feature, diagnostics.DiagnosticBag, location); 2700=> CheckFeatureAvailability(syntax, feature, diagnostics.DiagnosticBag, location); 2707return CheckFeatureAvailability(tree, feature, diagnostics.DiagnosticBag, location);
Binder\BindingDiagnosticBag.cs (1)
177DiagnosticBag?.Add(info, location);
Binder\EarlyWellKnownAttributeBinder.cs (1)
34generatedDiagnostics = !dummyDiagnosticBag.DiagnosticBag.IsEmptyWithoutResolution;
Binder\ForEachLoopBinder.cs (2)
481if (createConversionDiagnostics.AccumulatesDiagnostics && !createConversionDiagnostics.DiagnosticBag.IsEmptyWithoutResolution) 486foreach (var d in createConversionDiagnostics.DiagnosticBag.AsEnumerableWithoutResolution())
BoundTree\BoundDiscardExpression.cs (1)
21if (diagnosticsOpt?.DiagnosticBag != null)
BoundTree\UnboundLambda.cs (2)
809bool reachableEndpoint = ControlFlowPass.Analyze(compilation, lambdaSymbol, block, diagnostics.DiagnosticBag); 823if (IsAsync && !ErrorFacts.PreventsSuccessfulDelegateConversion(diagnostics.DiagnosticBag))
BoundTree\VariablePendingInference.cs (1)
53if (diagnosticsOpt?.DiagnosticBag != null)
CodeGen\CodeGenerator.cs (9)
97Debug.Assert(diagnostics.DiagnosticBag != null); 180type: _module.Translate(localSymbol.Type, bodySyntax, _diagnostics.DiagnosticBag), 341_builder.EmitToken(symbol, syntaxNode, _diagnostics.DiagnosticBag); 346EmitTypeReferenceToken(_module.Translate(symbol, syntaxNode, _diagnostics.DiagnosticBag), syntaxNode); 351var methodRef = _module.Translate(method, syntaxNode, _diagnostics.DiagnosticBag, optArgList, needDeclaration: encodeAsRawDefinitionToken); 352_builder.EmitToken(methodRef, syntaxNode, _diagnostics.DiagnosticBag, encodeAsRawDefinitionToken ? Cci.MetadataWriter.RawTokenEncoding.RowId : 0); 357var fieldRef = _module.Translate(symbol, syntaxNode, _diagnostics.DiagnosticBag); 358_builder.EmitToken(fieldRef, syntaxNode, _diagnostics.DiagnosticBag); 363_builder.EmitToken(_module.Translate(symbol).Signature, syntaxNode, _diagnostics.DiagnosticBag);
CodeGen\EmitAddress.cs (1)
409arrayAccess.Syntax, _diagnostics.DiagnosticBag);
CodeGen\EmitArrayInitializer.cs (11)
57_builder.EmitArrayBlockInitializer(data, inits.Syntax, _diagnostics.DiagnosticBag); 431Debug.Assert(_diagnostics.DiagnosticBag is not null, $"Expected non-null {nameof(_diagnostics)}.{nameof(_diagnostics.DiagnosticBag)}"); 572var field = _builder.module.GetFieldForData(data, alignment: 1, wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 574_builder.EmitToken(field, wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 633var field = _builder.module.GetFieldForData(data, alignment: (ushort)specialElementType.SizeInBytes(), wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 635_builder.EmitToken(field, wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 665var cachingField = _builder.module.GetArrayCachingFieldForData(data, _module.Translate(arrayType), wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 671_builder.EmitToken(cachingField, wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 682_builder.EmitArrayBlockInitializer(data, wrappedExpression.Syntax, _diagnostics.DiagnosticBag); 685_builder.EmitToken(cachingField, wrappedExpression.Syntax, _diagnostics.DiagnosticBag);
CodeGen\EmitExpression.cs (12)
806EmitExpression(expression.EmitExpressions.GetValue(expression, _diagnostics.DiagnosticBag), used); 1072_builder.EmitArrayElementLoad(_module.Translate((ArrayTypeSymbol)arrayAccess.Expression.Type), arrayAccess.Expression.Syntax, _diagnostics.DiagnosticBag); 2162_builder.EmitArrayCreation(_module.Translate(arrayType), expression.Syntax, _diagnostics.DiagnosticBag); 2985_builder.EmitArrayElementStore(_module.Translate(arrayType), syntaxNode, _diagnostics.DiagnosticBag); 3354var fieldRef = _module.Translate(field, syntax, _diagnostics.DiagnosticBag, needDeclaration: true); 3357_builder.EmitToken(fieldRef, syntax, _diagnostics.DiagnosticBag, Cci.MetadataWriter.RawTokenEncoding.LiftedVariableId); 3381_builder.EmitToken(_module.GetModuleVersionId(_module.Translate(node.Type, node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag); 3404_builder.EmitToken(_module.GetInstrumentationPayloadRoot(node.AnalysisKind, _module.Translate(node.Type, node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag), node.Syntax, _diagnostics.DiagnosticBag);
CodeGen\EmitStackAllocInitializer.cs (2)
53var field = _builder.module.GetFieldForData(data, alignment: 1, inits.Syntax, _diagnostics.DiagnosticBag); 56_builder.EmitToken(field, inits.Syntax, _diagnostics.DiagnosticBag);
CodeGen\EmitStatement.cs (23)
890_module.Translate(expressionOpt.Type, boundReturnStatement.Syntax, _diagnostics.DiagnosticBag); 1024_module.Translate(catchBlock.ExceptionTypeOpt, catchBlock.Syntax, _diagnostics.DiagnosticBag) : 1025_module.GetSpecialType(SpecialType.System_Object, catchBlock.Syntax, _diagnostics.DiagnosticBag); 1071var exceptionType = _module.Translate(catchBlock.ExceptionTypeOpt, catchBlock.Syntax, _diagnostics.DiagnosticBag); 1074_builder.EmitToken(exceptionType, catchBlock.Syntax, _diagnostics.DiagnosticBag); 1472var privateImplClass = _module.GetPrivateImplClass(syntaxNode, _diagnostics.DiagnosticBag); 1493_builder.EmitToken(stringHashMethodRef, syntaxNode, _diagnostics.DiagnosticBag); 1517sequenceEqualsMethodRef = _module.Translate(sequenceEqualsCharMethod, null, _diagnostics.DiagnosticBag); 1521asSpanMethodRef = _module.Translate(asSpanMethod, null, _diagnostics.DiagnosticBag); 1527stringEqualityMethodRef = _module.Translate(stringEqualityMethod, syntaxNode, _diagnostics.DiagnosticBag); 1611return _module.Translate(spanCharLengthMethod, syntaxNode, _diagnostics.DiagnosticBag); 1618return _module.Translate(stringLengthMethod, syntaxNode, _diagnostics.DiagnosticBag); 1636return _module.Translate(spanCharLengthMethod, null, _diagnostics.DiagnosticBag); 1644return _module.Translate(stringCharsIndexer, syntaxNode, _diagnostics.DiagnosticBag); 1684_builder.EmitToken(stringEqualityMethodRef, syntaxNode, _diagnostics.DiagnosticBag); 1711_builder.EmitToken(asSpanRef, syntaxNode, _diagnostics.DiagnosticBag); 1713_builder.EmitToken(sequenceEqualsRef, syntaxNode, _diagnostics.DiagnosticBag); 1745MetadataConstant compileTimeValue = _module.CreateConstant(local.Type, local.ConstantValue, syntaxNode, _diagnostics.DiagnosticBag); 1776? _module.GetSpecialType(SpecialType.System_IntPtr, syntaxNode, _diagnostics.DiagnosticBag) 1777: _module.Translate(pointedAtType, syntaxNode, _diagnostics.DiagnosticBag); 1783translatedType = _module.Translate(local.Type, syntaxNode, _diagnostics.DiagnosticBag); 1788_module.GetFakeSymbolTokenForIL(translatedType, syntaxNode, _diagnostics.DiagnosticBag); 1880_module.Translate(type, syntaxNode, _diagnostics.DiagnosticBag),
Compilation\CSharpCompilation.cs (14)
1744RoslynDebug.Assert(diagnostics.DiagnosticBag is object); 1818RoslynDebug.Assert(noMainFoundDiagnostics.DiagnosticBag is object); 1914foreach (var diagnostic in noMainFoundDiagnostics.DiagnosticBag.AsEnumerable()) 2672RoslynDebug.Assert(builder.DiagnosticBag is object); 2685AppendLoadDirectiveDiagnostics(builder.DiagnosticBag, _syntaxAndDeclarations, syntaxTree); 2695AppendLoadDirectiveDiagnostics(builder.DiagnosticBag, _syntaxAndDeclarations, syntaxTree); 2719CheckAssemblyName(builder.DiagnosticBag); 2751RoslynDebug.Assert(methodBodyDiagnostics.DiagnosticBag is object); 2754methodBodyDiagnostics.DiagnosticBag.Free(); 2780RoslynDebug.Assert(diagnostics.DiagnosticBag is object); 2790diagnostics: diagnostics.DiagnosticBag, 2871Debug.Assert(discarded.DiagnosticBag is object); 2886discarded.DiagnosticBag.Clear(); 2890discarded.DiagnosticBag.Free();
Compilation\CSharpCompilation.UsingsFromOptionsAndDiagnostics.cs (4)
57Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 66diagnostics.AddRange(directiveDiagnostics.DiagnosticBag); 133Debug.Assert(diagnostics.DiagnosticBag is object); 154semanticDiagnostics.AddRange(diagnostics.DiagnosticBag);
Compiler\ClsComplianceChecker.cs (1)
75var queue = new BindingDiagnosticBag(diagnostics.DiagnosticBag, diagnostics.AccumulatesDependencies ? new ConcurrentSet<AssemblySymbol>() : null);
Compiler\DocumentationCommentCompiler.cs (3)
115if (diagnostics.DiagnosticBag is DiagnosticBag diagnosticBag) 686var diagnosticBag = _diagnostics.DiagnosticBag ?? DiagnosticBag.GetInstance(); 713if (diagnosticBag != _diagnostics.DiagnosticBag)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (2)
654if (bindingDiagnostics.DiagnosticBag?.IsEmptyWithoutResolution == false) 656foreach (Diagnostic diagnostic in bindingDiagnostics.DiagnosticBag.AsEnumerable())
Compiler\MethodBodySynthesizer.cs (2)
252Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors()); 270Debug.Assert(diagnostics.DiagnosticBag is null || diagnostics.HasAnyErrors());
Compiler\MethodCompiler.cs (21)
92Debug.Assert(diagnostics.DiagnosticBag != null); 121Debug.Assert(diagnostics.DiagnosticBag != null); 207moduleBeingBuiltOpt.SetPEEntryPoint(entryPoint, diagnostics.DiagnosticBag); 216Debug.Assert(diagnostics.DiagnosticBag != null); 624_diagnostics.DiagnosticBag, 674foreach (Cci.IMethodDefinition definition in privateImplClass.GetMethods(new EmitContext(_moduleBeingBuiltOpt, null, diagnostics.DiagnosticBag, metadataOnly: false, includePrivateMembers: true))) 687Debug.Assert(diagnostics.DiagnosticBag != null); 734_moduleBeingBuiltOpt.TryCreateVariableSlotAllocator(lambda, lambda.TopLevelMethod, diagnosticsThisMethod.DiagnosticBag) : 735_moduleBeingBuiltOpt.TryCreateVariableSlotAllocator(method, method, diagnosticsThisMethod.DiagnosticBag); 839discardedDiagnostics.DiagnosticBag.Clear(); 1030diagsForCurrentMethod.DiagnosticBag, 1095DefiniteAssignmentPass.Analyze(_compilation, methodSymbol, analyzedInitializers, diagsForCurrentMethod.DiagnosticBag, out _, requireOutParamsAssigned: false); 1113DefiniteAssignmentPass.Analyze(_compilation, methodSymbol, analyzedInitializers, diagsForCurrentMethod.DiagnosticBag, out _, requireOutParamsAssigned: false); 1470lazyVariableSlotAllocator ??= compilationState.ModuleBuilderOpt.TryCreateVariableSlotAllocator(method, method, diagnostics.DiagnosticBag); 1621var importScopeOpt = importChainOpt?.Translate(moduleBuilder, diagnosticsForThisMethod.DiagnosticBag); 1714awaiters[index] = moduleBuilder.EncTranslateLocalVariableType(field.Type, diagnostics.DiagnosticBag); 1726hoistedVariables[index] = new EncHoistedLocalInfo(field.SlotDebugInfo, moduleBuilder.EncTranslateLocalVariableType(field.Type, diagnostics.DiagnosticBag)); 1842Debug.Assert(diagnostics.DiagnosticBag != null); 1855isSufficientLangVersion ? diagnostics.DiagnosticBag : new DiagnosticBag(), 1866diagnostics.DiagnosticBag, 1965diagnostics.DiagnosticBag,
Emitter\Model\PEModuleBuilder.cs (1)
1954return base.GetEmbeddedTypes(diagnostics.DiagnosticBag);
FlowAnalysis\FlowAnalysisPass.cs (2)
52Analyze(compilation, method, block, diagnostics.DiagnosticBag, out needsImplicitReturn, out implicitlyInitializedFields)) 69else if (Analyze(compilation, method, block, diagnostics.DiagnosticBag, out var needsImplicitReturn, out var unusedImplicitlyInitializedFields))
FlowAnalysis\NullableWalker.cs (2)
1378if (diagnostics.DiagnosticBag == null) 1386diagnosticsBag = diagnostics.DiagnosticBag;
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (2)
112if (slotAllocatorOpt == null || !slotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics.DiagnosticBag), F.Diagnostics.DiagnosticBag, out slotIndex))
Lowering\ClosureConversion\ClosureConversion.cs (2)
240Debug.Assert(diagnostics.DiagnosticBag is object); 248diagnostics.DiagnosticBag);
Lowering\LocalRewriter\LocalRewriter.DecisionDagRewriter.cs (1)
923var privateImplClass = module.GetPrivateImplClass(syntaxNode, _localRewriter._diagnostics.DiagnosticBag);
Lowering\LocalRewriter\LocalRewriter_Call.cs (2)
111module.EmbeddedTypesManagerOpt.EmbedMethodIfNeedTo(m.OriginalDefinition.GetCciAdapter(), syntaxNode, _diagnostics.DiagnosticBag); 130module.EmbeddedTypesManagerOpt.EmbedPropertyIfNeedTo(p.OriginalDefinition.GetCciAdapter(), syntaxNode, _diagnostics.DiagnosticBag);
Lowering\LocalRewriter\LocalRewriter_Event.cs (1)
315module.EmbeddedTypesManagerOpt.EmbedEventIfNeedTo(node.Event.GetCciAdapter(), node.Syntax, _diagnostics.DiagnosticBag, isUsedForComAwareEventBinding: true);
Lowering\LocalRewriter\LocalRewriter_SwitchExpression.cs (3)
161var diagnostics = factory.Diagnostics.DiagnosticBag; 176var diagnostics = factory.Diagnostics.DiagnosticBag; 190var diagnostics = factory.Diagnostics.DiagnosticBag;
Lowering\MethodToClassRewriter.cs (1)
60Debug.Assert(diagnostics.DiagnosticBag != null);
Lowering\StateMachineRewriter\MethodToStateMachineRewriter.cs (2)
660F.ModuleBuilderOpt.Translate(fieldType, awaitSyntaxOpt, Diagnostics.DiagnosticBag), 663Diagnostics.DiagnosticBag,
Lowering\StateMachineRewriter\StateMachineRewriter.cs (4)
51Debug.Assert(diagnostics.DiagnosticBag != null); 118var variablesToHoist = IteratorAndAsyncCaptureWalker.Analyze(F.Compilation, method, body, diagnostics.DiagnosticBag); 202F.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, diagnostics.DiagnosticBag), 205diagnostics.DiagnosticBag,
Symbols\Compilation_UsedAssemblies.cs (3)
71RoslynDebug.Assert(diagnostics.DiagnosticBag is object); 78diagnostics.DiagnosticBag.Clear(); 90diagnostics.DiagnosticBag.Free();
Symbols\Source\LocalFunctionSymbol.cs (3)
48syntax.Modifiers.ToDeclarationModifiers(isForTypeDeclaration: false, diagnostics: _declarationDiagnostics.DiagnosticBag); 63ReportErrorIfHasConstraints(syntax.ConstraintClauses, _declarationDiagnostics.DiagnosticBag); 400SourceMemberContainerTypeSymbol.ReportReservedTypeName(identifier.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, location);
Symbols\Source\ModifierUtils.cs (1)
26var result = modifiers.ToDeclarationModifiers(isForTypeDeclaration: false, diagnostics.DiagnosticBag ?? new DiagnosticBag(), isOrdinaryMethod: isOrdinaryMethod);
Symbols\Source\SourceComplexParameterSymbol.cs (4)
242Debug.Assert(diagnostics.DiagnosticBag != null); 257NullableWalker.AnalyzeIfNeeded(binder, parameterEqualsValue, valueSyntax, diagnostics.DiagnosticBag); 345Debug.Assert(diagnostics.DiagnosticBag != null); 346NullableWalker.AnalyzeIfNeeded(binder, parameterEqualsValue, parameterSyntax, diagnostics.DiagnosticBag);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
1769ReportReservedTypeName(identifier?.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, identifier?.GetLocation() ?? Location.None);
Symbols\Source\SourceNamedTypeSymbol.cs (1)
208ReportReservedTypeName(tp.Identifier.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, location);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (6)
728Debug.Assert(directiveDiagnostics.DiagnosticBag is object); 794diagnostics.AddRange(directiveDiagnostics.DiagnosticBag); 921Debug.Assert(diagnostics.DiagnosticBag is object); 946semanticDiagnostics.AddRange(diagnostics.DiagnosticBag); 976semanticDiagnostics.AddRange(diagnostics.DiagnosticBag); 993semanticDiagnostics.AddRange(aliasFromSyntax.AliasTargetDiagnostics.DiagnosticBag!);
Symbols\Source\SourceOrdinaryMethodSymbol.cs (3)
93Debug.Assert(diagnostics.DiagnosticBag is object); 113ReportErrorIfHasConstraints(syntax.ConstraintClauses, diagnostics.DiagnosticBag); 573SourceMemberContainerTypeSymbol.ReportReservedTypeName(identifier.Text, this.DeclaringCompilation, diagnostics.DiagnosticBag, location);
Symbols\Source\SourceOrdinaryMethodSymbolBase.cs (1)
46Debug.Assert(diagnostics.DiagnosticBag is object);
Symbols\Source\SourcePropertySymbolBase.cs (1)
1241Debug.Assert(diagnostics.DiagnosticBag is object);
Symbols\Symbol.cs (3)
890if (diagnostics.DiagnosticBag?.IsEmptyWithoutResolution == false || diagnostics.DependenciesBag?.Count > 0) 897if (diagnostics.DiagnosticBag?.IsEmptyWithoutResolution == false) 899compilation.DeclarationDiagnostics.AddRange(diagnostics.DiagnosticBag);
Symbols\Symbol_Attributes.cs (9)
216Debug.Assert(arguments.Diagnostics.DiagnosticBag is not null); 221arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName); 402Debug.Assert(diagnostics.DiagnosticBag is not null); 413NullableWalker.AnalyzeIfNeeded(binders[i], boundAttribute, boundAttribute.Syntax, diagnostics.DiagnosticBag); 429Debug.Assert(diagnostics.DiagnosticBag is not null); 433!diagnostics.DiagnosticBag.IsEmptyWithoutResolution && 434diagnostics.DiagnosticBag.AsEnumerableWithoutResolution().OfType<DiagnosticWithInfo>().Where(isObsoleteDiagnostic).Any()) 474foreach (Diagnostic d in diagnostics.DiagnosticBag.AsEnumerableWithoutResolution()) 499foreach (Diagnostic d in diagnostics.DiagnosticBag.AsEnumerableWithoutResolution())
Symbols\Tuples\TupleTypeSymbol.cs (2)
61if (diagnostics?.DiagnosticBag is object && ((SourceModuleSymbol)compilation.SourceModule).AnyReferencedAssembliesAreLinked) 64Emit.NoPia.EmbeddedTypesManager.IsValidEmbeddableType(underlyingType, syntax, diagnostics.DiagnosticBag);
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (5)
Symbols\EEMethodSymbol.cs (4)
473var body = _generateMethodBody(this, diagnostics.DiagnosticBag, out declaredLocalsArray, out _lazyResultProperties); 512diagnostics.DiagnosticBag); 527body = (BoundStatement)PlaceholderLocalRewriter.Rewrite(compilation, declaredLocals, body, diagnostics.DiagnosticBag); 636diagnostics.DiagnosticBag);
Symbols\PlaceholderLocalSymbol.cs (1)
188Debug.Assert(diagnostics.DiagnosticBag != null);
Microsoft.CodeAnalysis.VisualBasic (77)
Binding\Binder_Expressions.vb (7)
4701Debug.Assert(operand.Type.IsErrorType() OrElse ignoreDiagnostics.DiagnosticBag.IsEmptyWithoutResolution()) 4740DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag) OrElse 4754Debug.Assert(getAwaiter Is Nothing OrElse Not DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag)) 4788DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag) OrElse 4803Debug.Assert(isCompleted Is Nothing OrElse Not DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag)) 4835DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag) OrElse 4850Debug.Assert(getResult Is Nothing OrElse Not DiagnosticBagHasErrorsOtherThanObsoleteOnes(ignoreDiagnostics.DiagnosticBag))
Binding\Binder_Lambda.vb (3)
24Dim modifiers As SourceMemberFlags = DecodeModifiers(node.SubOrFunctionHeader.Modifiers, asyncIterator, ERRID.ERR_InvalidLambdaModifier, Accessibility.Public, If(diagnostics.DiagnosticBag, New DiagnosticBag())).FoundFlags And asyncIterator 27ReportModifierError(node.SubOrFunctionHeader.Modifiers, ERRID.ERR_InvalidAsyncIteratorModifiers, diagnostics.DiagnosticBag, InvalidAsyncIterator) 301ControlFlowPass.Analyze(New FlowAnalysisInfo(Compilation, lambdaSymbol, block), diagnostics.DiagnosticBag, True)
Binding\Binder_Statements.vb (1)
4039Debug.Assert(If(temporaryDiagnostics.DiagnosticBag?.IsEmptyWithoutResolution, True))
Binding\Binder_Symbols.vb (1)
305Emit.NoPia.EmbeddedTypesManager.IsValidEmbeddableType(DirectCast(typeSymbol, NamedTypeSymbol), typeSyntax, diagBag.DiagnosticBag)
Binding\BindingDiagnosticBag.vb (3)
75Return (DiagnosticBag Is Nothing OrElse DiagnosticBag.IsEmptyWithoutResolution) AndAlso DependenciesBag.IsNullOrEmpty() 168DiagnosticBag?.Add(New VBDiagnostic(info, location))
Binding\EarlyWellKnownAttributeBinder.vb (1)
56generatedDiagnostics = Not diagnostics.DiagnosticBag.IsEmptyWithoutResolution()
Compilation\ClsComplianceChecker.vb (1)
73Dim queue = New BindingDiagnosticBag(diagnostics.DiagnosticBag, New ConcurrentSet(Of AssemblySymbol))
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (1)
630Dim errorLocations = diagnostics.DiagnosticBag.ToReadOnly().SelectAsArray(Function(x) x.Location).WhereAsArray(Function(x) x IsNot Nothing)
Compilation\DocumentationComments\DocumentationCommentCompiler.vb (2)
90MislocatedDocumentationCommentFinder.ReportUnprocessed(filterTree, filterSpanWithinTree, diagnostics.DiagnosticBag, cancellationToken) 93MislocatedDocumentationCommentFinder.ReportUnprocessed(tree, filterSpanWithinTree:=Nothing, diagnostics.DiagnosticBag, cancellationToken)
Compilation\DocumentationComments\DocumentationCommentWalker.vb (1)
157Dim errorLocations = diagnostics.DiagnosticBag.ToReadOnly.SelectAsArray(Function(x) x.Location).WhereAsArray(Function(x) x IsNot Nothing)
Compilation\MethodCompiler.vb (13)
181diagnostics:=diagnostics.DiagnosticBag, 278moduleBeingBuiltOpt.SetPEEntryPoint(entryPoint, diagnostics.DiagnosticBag) 1249processedInitializers.EnsureInitializersAnalyzed(method, diagsForCurrentMethod.DiagnosticBag) 1260If sourceMethod.SetDiagnostics(diagsForCurrentMethod.DiagnosticBag.ToReadOnly()) Then 1514DirectCast(method.AssociatedSymbol, SynthesizedMyGroupCollectionPropertySymbol).RelocateDiagnostics(diagnostics.DiagnosticBag, diagsForCurrentMethod.DiagnosticBag) 1551DirectCast(method.AssociatedSymbol, SynthesizedMyGroupCollectionPropertySymbol).RelocateDiagnostics(diagnostics.DiagnosticBag, diagsForCurrentMethod.DiagnosticBag) 1589Dim codeGen = New CodeGen.CodeGenerator(method, block, builder, moduleBuilder, diagnostics.DiagnosticBag, optimizations, emittingPdb) 1650moduleBuilder.SourceModule.TryGetSourceFile(method.Syntax.SyntaxTree)?.Translate(moduleBuilder, diagnostics.DiagnosticBag), 1664GetStateMachineSlotDebugInfo(moduleBuilder, moduleBuilder.GetSynthesizedFields(stateMachineTypeOpt), variableSlotAllocatorOpt, diagnostics.DiagnosticBag, stateMachineHoistedLocalSlots, stateMachineAwaiterSlots) 1767Analyzer.AnalyzeMethodBody(method, body, diagnostics.DiagnosticBag) 1768DiagnosticsPass.IssueDiagnostics(body, diagnostics.DiagnosticBag, method)
Compilation\VisualBasicCompilation.vb (4)
2178CheckAssemblyName(builder.DiagnosticBag) 2197methodBodyDiagnostics.DiagnosticBag.Free() 2264If Not methodBodyDiagnostics.DiagnosticBag.IsEmptyWithoutResolution Then 2265Dim allDiags = methodBodyDiagnostics.DiagnosticBag.AsEnumerableWithoutResolution()
Lowering\AsyncRewriter\AsyncRewriter.AsyncMethodToClassRewriter.vb (2)
112If Me.SlotAllocatorOpt Is Nothing OrElse Not Me.SlotAllocatorOpt.TryGetPreviousAwaiterSlotIndex(F.CompilationState.ModuleBuilderOpt.Translate(awaiterType, F.Syntax, F.Diagnostics.DiagnosticBag), F.Diagnostics.DiagnosticBag, slotIndex) Then
Lowering\LambdaRewriter\LambdaRewriter.vb (1)
903Dim slotAllocatorOpt = CompilationState.ModuleBuilderOpt.TryCreateVariableSlotAllocator(method, method.TopLevelMethod, Diagnostics.DiagnosticBag)
Lowering\LocalRewriter\LocalRewriter_AddRemoveHandler.vb (1)
288_emitModule.EmbeddedTypesManagerOpt.EmbedEventIfNeedTo([event].GetCciAdapter(), node.Syntax, _diagnostics.DiagnosticBag, isUsedForComAwareEventBinding:=True)
Lowering\LocalRewriter\LocalRewriter_SelectCase.vb (1)
185Dim privateImplClass = _emitModule.GetPrivateImplClass(node.Syntax, _diagnostics.DiagnosticBag)
Lowering\Rewriter.vb (1)
86lazyVariableSlotAllocator = compilationState.ModuleBuilderOpt.TryCreateVariableSlotAllocator(method, method, diagnostics.DiagnosticBag)
Lowering\StateMachineRewriter\StateMachineRewriter.vb (3)
110Dim variablesToHoist = IteratorAndAsyncCaptureWalker.Analyze(New FlowAnalysisInfo(F.CompilationState.Compilation, Me.Method, Me.Body), Me.Diagnostics.DiagnosticBag) 306F.CompilationState.ModuleBuilderOpt.Translate(fieldType, declaratorSyntax, Diagnostics.DiagnosticBag), 309Diagnostics.DiagnosticBag,
Parser\Parser.vb (1)
6144Return CheckFeatureAvailability(diagnostics.DiagnosticBag, location, languageVersion, feature)
Semantics\OverloadResolution.vb (1)
3083Debug.Assert(Not defaultValueDiagnostics.DiagnosticBag.AsEnumerable().Any())
Symbols\Source\SourceFile.vb (2)
142Dim lazyBoundInformation = BindFileInformation(diagBag.DiagnosticBag, cancellationToken) 362diagnostics.AddRange(clauseDiagnostics.DiagnosticBag)
Symbols\Source\SourceMemberContainerTypeSymbol.vb (6)
2559Dim methodSymbol = CreateMethodMember(methodDecl, binder, diagBag.DiagnosticBag) 2578Dim methodSymbol = CreateMethodMember(DirectCast(memberSyntax, MethodBaseSyntax), binder, diagBag.DiagnosticBag) 2590CreateProperty(propertyDecl.PropertyStatement, propertyDecl, binder, diagBag.DiagnosticBag, members, staticInitializers, instanceInitializers) 2599CreateProperty(propertyDecl, Nothing, binder, diagBag.DiagnosticBag, members, staticInitializers, instanceInitializers) 2607CreateEvent(eventDecl, Nothing, binder, diagBag.DiagnosticBag, members) 2611CreateEvent(eventDecl.EventStatement, eventDecl, binder, diagBag.DiagnosticBag, members)
Symbols\Source\SourceMemberFieldSymbol.vb (8)
423diagBag.DiagnosticBag) 429binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_StructCantUseVarSpecifier1, diagBag.DiagnosticBag, SyntaxKind.ProtectedKeyword) 435binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_StructCantUseVarSpecifier1, diagBag.DiagnosticBag, SyntaxKind.WithEventsKeyword) 442binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_ModuleCantUseVariableSpecifier1, diagBag.DiagnosticBag, 466binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_BadConstFlags1, diagBag.DiagnosticBag, SyntaxKind.SharedKeyword) 470binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_BadConstFlags1, diagBag.DiagnosticBag, SyntaxKind.ReadOnlyKeyword) 474binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_BadConstFlags1, diagBag.DiagnosticBag, SyntaxKind.WithEventsKeyword) 478binder.ReportModifierError(syntax.Modifiers, ERRID.ERR_BadConstFlags1, diagBag.DiagnosticBag, SyntaxKind.DimKeyword)
Symbols\Source\SourceModuleSymbol.vb (5)
377binder.BindImportClause(globalImport.Clause, data, diagBagForThisImport.DiagnosticBag) 382For Each d As Diagnostic In diagBagForThisImport.DiagnosticBag.AsEnumerable() 864(Not diagBag.AccumulatesDiagnostics OrElse HasAllLazyDiagnostics(diagBag.DiagnosticBag)) 1035If Not diagBag.DiagnosticBag?.IsEmptyWithoutResolution Then 1036For Each d As Diagnostic In diagBag.DiagnosticBag.AsEnumerableWithoutResolution()
Symbols\Source\SourceNamedTypeSymbol.vb (1)
238Dim foundModifiers = CheckDeclarationModifiers(node, binder, diagBag.DiagnosticBag, accessModifiers)
Symbols\Source\SynthesizedMyGroupCollectionPropertyAccessorSymbol.vb (2)
116For Each diag As VBDiagnostic In bindingDiagnostics.DiagnosticBag.AsEnumerable() 120bindingDiagnostics.DiagnosticBag.Free()
Symbols\Tuples\TupleTypeSymbol.vb (2)
378If diagnostics?.DiagnosticBag IsNot Nothing AndAlso DirectCast(compilation.SourceModule, SourceModuleSymbol).AnyReferencedAssembliesAreLinked Then 380Emit.NoPia.EmbeddedTypesManager.IsValidEmbeddableType(tupleUnderlyingType, syntax, diagnostics.DiagnosticBag)
Symbols\UsedAssemblies.vb (2)
53diagnostics.DiagnosticBag.Clear() 64diagnostics.DiagnosticBag.Free()
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler (5)
Symbols\EEMethodSymbol.vb (5)
459Debug.Assert(diagnostics.DiagnosticBag IsNot Nothing) 461Dim body = _generateMethodBody(Me, diagnostics.DiagnosticBag, _lazyResultProperties) 497DiagnosticsPass.IssueDiagnostics(newBody, diagnostics.DiagnosticBag, Me) 519newBody = DirectCast(PlaceholderLocalRewriter.Rewrite(_compilation, _container, newBody, diagnostics.DiagnosticBag), BoundBlock) 572diagnostics.DiagnosticBag), BoundBlock)