115 references to Add
Microsoft.CodeAnalysis (69)
Binding\BindingDiagnosticBag.cs (1)
57
DiagnosticBag?.
Add
(diag);
CommandLine\AnalyzerConfigSet.cs (2)
514
diagnostics.
Add
(Diagnostic.Create(
537
diagnostics.
Add
(Diagnostic.Create(
CommandLine\CommonCompiler.CompilerEmitStreamProvider.cs (2)
44
diagnostics.
Add
(messageProvider.CreateDiagnostic(diagnosticInfo));
119
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_CantOpenFileWrite, Location.None, _filePath, e.Message));
CommandLine\CommonCompiler.cs (8)
322
diagnostics.
Add
(Diagnostic.Create(
376
diagnostics.
Add
(Diagnostic.Create(ToFileReadDiagnostics(MessageProvider, e, filePath)));
416
diagnostics.
Add
(MessageProvider.CreateDiagnostic(ToFileReadDiagnostics(this.MessageProvider, e, filePath)));
1110
analyzerExceptionDiagnostics.
Add
,
1183
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.FTL_InvalidInputFileName, Location.None, finalPdbFilePath));
1532
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_ErrorBuildingWin32Resource, Location.None, ex.Message));
1566
diagnostics.
Add
(messageProvider.CreateDiagnostic(errorCode, Location.None, fullPath, ex.Message));
1577
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.FTL_InvalidInputFileName, Location.None, path ?? ""));
Compilation.EmitStream.cs (2)
186
diagnostics.
Add
(StrongNameKeys.GetError(strongNameKeys.KeyFilePath, strongNameKeys.KeyContainer,
192
diagnostics.
Add
(StrongNameKeys.GetError(strongNameKeys.KeyFilePath, strongNameKeys.KeyContainer, ex.Message, messageProvider));
Compilation\Compilation.cs (21)
1852
accumulator.
Add
(filtered);
1969
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
1974
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
1979
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2000
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2050
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, NoLocation.Singleton, CodeAnalysisResources.UnrecognizedResourceFileFormat));
2055
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, NoLocation.Singleton, ex.Message));
2068
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, NoLocation.Singleton, CodeAnalysisResources.UnrecognizedResourceFileFormat));
2093
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceNotUnique, Location.None, resource.ResourceName));
2100
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceFileNameNotUnique, Location.None, fileName));
2108
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceFileNameNotUnique, Location.None, fileName));
2119
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceNotUnique, Location.None, name));
2447
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_EncodinglessSyntaxTree, tree.GetRoot().GetLocation()));
3119
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceInModule, Location.None));
3254
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PdbWritingFailed, Location.None, ex.Message));
3259
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PeWritingFailure, Location.None, e.InnerException?.ToString() ?? ""));
3264
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_CantReadResource, Location.None, e.Message, e.InnerException?.Message ?? ""));
3269
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PermissionSetAttributeFileReadError, Location.None, e.FileName, e.PropertyName, e.Message));
3423
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PdbWritingFailed, Location.None, e.Message));
3428
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PeWritingFailure, Location.None, e.InnerException?.ToString() ?? ""));
3433
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PermissionSetAttributeFileReadError, Location.None, e.FileName, e.PropertyName, e.Message));
Diagnostic\CommonMessageProvider.cs (1)
257
diagnostics.
Add
(CreateDiagnostic(ERR_OutputWriteFailed, Location.None, filePath, e.Message));
DiagnosticAnalyzer\AnalyzerDriver.cs (1)
880
allDiagnostics.
Add
(diagnostic);
Emit\EditAndContinue\DefinitionMap.cs (3)
238
diagnostics.
Add
(MessageProvider.CreateDiagnostic(
316
diagnostics.
Add
(MessageProvider.CreateDiagnostic(
357
diagnostics.
Add
(MessageProvider.CreateDiagnostic(
Emit\EditAndContinue\DeltaMetadataWriter.cs (1)
799
Context.Diagnostics.
Add
(messageProvider.CreateDiagnostic(
Emit\EmitOptions.cs (6)
336
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidDebugInformationFormat, Location.None, (int)DebugInformationFormat));
348
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidInstrumentationKind, Location.None, (int)instrumentationKind));
359
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidFileAlignment, Location.None, FileAlignment));
364
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidSubsystemVersion, Location.None, SubsystemVersion.ToString()));
375
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidHashAlgorithmName, Location.None, PdbChecksumAlgorithm.ToString()));
380
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidHashAlgorithmName, Location.None, ""));
MetadataReader\MetadataHelpers.cs (1)
923
diagnostics.
Add
(
PEWriter\MetadataWriter.cs (7)
1357
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, name));
1366
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, path));
1390
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_MetadataNameTooLong, location, namespaceName + "." + mangledTypeName));
1400
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbUsingNameTooLong, location, usingString));
1412
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.WRN_PdbLocalNameTooLong, localDefinition.Location, name));
3119
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
3137
this.Context.Diagnostics.
Add
(this.messageProvider.CreateDiagnostic(this.messageProvider.ERR_TooManyUserStrings, NoLocation.Singleton));
PEWriter\TypeNameSerializer.cs (1)
84
context.Diagnostics.
Add
(messageProvider.CreateDiagnostic(
ReferenceManager\CommonReferenceManager.Resolution.cs (8)
363
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataFileNotAssembly, location, peReference.Display ?? ""));
378
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_LinkedNetmoduleMetadataMustProvideFullPEImage, location, peReference.Display ?? ""));
385
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataFileNotModule, location, peReference.Display ?? ""));
518
diagnostics.
Add
(newDiagnostic);
535
diagnostics.
Add
((Diagnostic)existing);
559
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataFileNotAssembly, Location.None, peReference.Display ?? ""));
807
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataReferencesNotSupported, referenceDirective.Location));
822
diagnostics.
Add
(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataFileNotFound, referenceDirective.Location, referenceDirective.File));
SourceGeneration\GeneratorContexts.cs (1)
101
public void ReportDiagnostic(Diagnostic diagnostic) => _diagnostics.
Add
(diagnostic);
SourceGeneration\GeneratorDriver.cs (2)
367
diagnosticBag?.
Add
(filtered);
388
driverDiagnostics?.
Add
(effective);
SourceGeneration\IncrementalContexts.cs (1)
163
public void ReportDiagnostic(Diagnostic diagnostic) => Diagnostics.
Add
(diagnostic);
Microsoft.CodeAnalysis.CSharp (16)
CommandLine\CSharpCommandLineParser.cs (2)
1745
outputDiagnostics.
Add
(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, valueMemory.ToString()));
1777
outputDiagnostics.
Add
(Diagnostic.Create(CSharp.MessageProvider.Instance, (int)ErrorCode.WRN_DefineIdentifierRequired, id));
CommandLine\CSharpCompiler.cs (2)
188
diagnostics.
Add
(MessageProvider.CreateDiagnostic(info));
361
diagnostics.
Add
(
Compilation\SyntaxAndDeclarationManager.cs (2)
198
diagnostics.
Add
(
208
diagnostics.
Add
(
Emitter\Model\PEAssemblyBuilder.cs (1)
147
context.Diagnostics.
Add
(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_CryptoHashFailed), NoLocation.Singleton));
Emitter\Model\PEModuleBuilder.cs (2)
972
diagnostics.
Add
(new CSDiagnostic(diagInfo ?? new CSDiagnosticInfo(ErrorCode.ERR_BogusType, string.Empty), syntaxNodeOpt == null ? NoLocation.Singleton : syntaxNodeOpt.Location));
1087
diagnostics.
Add
(
Emitter\NoPia\EmbeddedTypesManager.cs (1)
329
diagnostics.
Add
(new CSDiagnostic(info, syntaxOpt == null ? NoLocation.Singleton : syntaxOpt.Location));
Errors\DiagnosticBagExtensions.cs (5)
25
diagnostics.
Add
(diag);
41
diagnostics.
Add
(diag);
49
diagnostics.
Add
(diag);
56
diagnostics.
Add
(diag);
100
diagnostics.
Add
(new CSDiagnostic(info, location));
FlowAnalysis\DefiniteAssignment.cs (1)
570
diagnostics.
Add
(diagnostic);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (1)
CodeGen\CodeGenTests.cs (1)
13278
diagnostics.
Add
(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_IntDivByZero), NoLocation.Singleton));
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler (1)
Rewriters\CapturedVariableRewriter.cs (1)
125
_diagnostics.
Add
(new CSDiagnostic(new CSDiagnosticInfo(errorCode), syntax.Location));
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ExpressionCompiler.UnitTests (2)
MissingAssemblyTests.cs (2)
657
diagnostics.
Add
(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_NoTypeDef, "MissingType", missingIdentity), Location.None));
704
diagnostics.
Add
(new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_NoTypeDef, "MissingType", missingIdentity), Location.None));
Microsoft.CodeAnalysis.Scripting (1)
Script.cs (1)
285
diagnostics.
Add
(messageProvider.CreateDiagnostic(messageProvider.ERR_MetadataFileNotFound, Location.None, unresolved.Reference));
Microsoft.CodeAnalysis.Test.Utilities (1)
Compilation\DiagnosticBagErrorLogger.cs (1)
21
Diagnostics.
Add
(diagnostic);
Microsoft.CodeAnalysis.VisualBasic (21)
Binding\Binder.vb (1)
895
diagBag.
Add
(diag)
Binding\BindingDiagnosticBag.vb (2)
81
diagnosticBag.
Add
(New VBDiagnostic(diagnosticInfo, location))
168
DiagnosticBag?.
Add
(New VBDiagnostic(info, location))
CodeGen\EmitConversion.vb (1)
234
_diagnostics.
Add
(New VBDiagnostic(diagnosticInfo, conversion.Syntax.Location))
CommandLine\VisualBasicCompiler.vb (1)
286
diagnostics.
Add
(
Emit\NoPia\EmbeddedTypesManager.vb (1)
277
diagnostics.
Add
(New VBDiagnostic(info, If(syntaxNodeOpt Is Nothing, NoLocation.Singleton, syntaxNodeOpt.GetLocation())))
Emit\PEAssemblyBuilder.vb (1)
100
context.Diagnostics.
Add
(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_CryptoHashFailed), NoLocation.Singleton))
Emit\SymbolTranslator.vb (2)
144
diagnostics.
Add
(New VBDiagnostic(
235
diagnostics.
Add
(
Errors\DiagnosticBagExtensions.vb (4)
28
diagnostics.
Add
(diag)
44
diagnostics.
Add
(diag)
51
diagnostics.
Add
(diag)
98
diagnostics.
Add
(diag)
Lowering\Diagnostics\DiagnosticsPass_ExpressionLambdas.vb (1)
402
Me._diagnostics.
Add
(New VBDiagnostic(ErrorFactory.ErrorInfo(code), node.Syntax.GetLocation()))
Symbols\Source\SourceMemberContainerTypeSymbol.vb (1)
399
diagnostics.
Add
(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_VarianceInterfaceNesting), Locations(0)))
Symbols\Source\SourceModuleSymbol.vb (2)
1042
sourceFile.DeclarationDiagnostics.
Add
(d)
1044
Me._diagnosticBagDeclare.
Add
(d)
Symbols\Source\SourceNamespaceSymbol.vb (3)
504
diagnostics.
Add
(diag)
522
diagnostics.
Add
(diag)
541
diagnostics.
Add
(diag)
Symbols\Source\SynthesizedMyGroupCollectionPropertySymbol.vb (1)
127
destination.
Add
(diag.WithLocation(diagnosticLocation))
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler (2)
EvaluationContext.vb (1)
364
diagnostics.
Add
(New SimpleMessageDiagnostic(String.Format(Resources.InvalidDebuggerStatement, syntax.Kind)))
Rewriters\CapturedVariableRewriter.vb (1)
158
_diagnostics.
Add
(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_UseOfKeywordNotInInstanceMethod1, syntax.ToString()), syntax.GetLocation()))
Microsoft.CodeAnalysis.VisualBasic.ExpressionEvaluator.ExpressionCompiler.UnitTests (1)
MissingAssemblyTests.vb (1)
529
diagnostics.
Add
(New VBDiagnostic(ErrorFactory.ErrorInfo(ERRID.ERR_UnreferencedAssembly3, missingIdentity, "MissingType"), Location.None))