80 references to Add
Microsoft.CodeAnalysis.CSharp (80)
Binder\Binder_Symbols.cs (1)
2850
diagnostics?.
Add
(ErrorCode.WRN_ErrorOverride, getLocation(data), diagInfo, (int)diagInfo.Code);
Compilation\CSharpCompilation.cs (3)
3675
diagnostics.
Add
(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, ((Cci.INamedEntity)moduleBeingBuilt).Name,
3826
_diagnostics.
Add
(ErrorCode.ERR_FileTypeNonUniquePath, location, symbol, filePath);
4058
diagnostics.
Add
(ErrorCode.WRN_ConflictingChecksum, new SourceLocation(checksumDirective), path);
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (6)
304
includeDiagnostics.
Add
(ErrorCode.WRN_InvalidInclude, location, subMessage);
315
includeDiagnostics.
Add
(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.XmlReferencesNotSupported)));
325
includeDiagnostics.
Add
(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, new CodeAnalysisResourcesLocalizableErrorArgument(nameof(CodeAnalysisResources.FileNotFound)));
346
includeDiagnostics.
Add
(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, e.Message);
358
includeDiagnostics.
Add
(ErrorCode.WRN_FailedInclude, location, filePathValue, xpathValue, errorMessage);
405
includeDiagnostics.
Add
(ErrorCode.WRN_XMLParseIncludeError, errorLocation, GetDescription(e)); //NOTE: location is in included file.
Emitter\EditAndContinue\EmitHelpers.cs (2)
106
diagnostics.
Add
(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, compilation.AssemblyName, e.Message);
179
diagnostics.
Add
(
Emitter\Model\AttributeDataAdapter.cs (1)
46
context.Diagnostics.
Add
(ErrorCode.ERR_NotAnAttributeClass, context.Location ?? NoLocation.Singleton, this.AttributeClass);
Emitter\Model\PEModuleBuilder.cs (5)
748
diagnostics.
Add
(ErrorCode.ERR_ExportedTypeConflictsWithDeclaration, NoLocation.Singleton, type, type.ContainingModule);
752
diagnostics.
Add
(ErrorCode.ERR_ForwardedTypeConflictsWithDeclaration, NoLocation.Singleton, type);
768
diagnostics.
Add
(ErrorCode.ERR_ExportedTypesConflict, NoLocation.Singleton, type, type.ContainingModule, contender, contender.ContainingModule);
773
diagnostics.
Add
(ErrorCode.ERR_ForwardedTypeConflictsWithExportedType, NoLocation.Singleton, type, type.ContainingAssembly, contender, contender.ContainingModule);
778
diagnostics.
Add
(ErrorCode.ERR_ForwardedTypesConflict, NoLocation.Singleton, type, type.ContainingAssembly, contender, contender.ContainingAssembly);
Errors\MessageProvider.cs (8)
207
diagnostics.
Add
(ErrorCode.ERR_DuplicateImport, location,
214
diagnostics.
Add
(ErrorCode.ERR_DuplicateImportSimple, location,
265
diagnostics.
Add
(ErrorCode.ERR_InvalidAttributeArgument, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), node.GetErrorDisplayName());
271
diagnostics.
Add
(ErrorCode.ERR_InvalidNamedArgument, node.ArgumentList.Arguments[namedArgumentIndex].Location, parameterName);
282
diagnostics.
Add
(ErrorCode.ERR_MarshalUnmanagedTypeNotValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
287
diagnostics.
Add
(ErrorCode.ERR_MarshalUnmanagedTypeOnlyValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
293
diagnostics.
Add
(ErrorCode.ERR_AttributeParameterRequired1, node.Name.Location, parameterName);
299
diagnostics.
Add
(ErrorCode.ERR_AttributeParameterRequired2, node.Name.Location, parameterName1, parameterName2);
FlowAnalysis\ControlFlowPass.cs (2)
219
Diagnostics.
Add
(ErrorCode.ERR_LabelNotFound, loc, ((BoundGotoStatement)pending.Branch).Label.Name);
380
Diagnostics.
Add
(isLastSection ? ErrorCode.ERR_SwitchFallOut : ErrorCode.ERR_SwitchFallThrough,
FlowAnalysis\DefiniteAssignment.cs (18)
449
Diagnostics.
Add
(
456
Diagnostics.
Add
(
474
Diagnostics.
Add
(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
493
Diagnostics.
Add
(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
578
diagnostics.
Add
(newCode, diagnostic.Location, args);
645
diagnostics.
Add
(ErrorCode.ERR_LocalCantBeFixedAndHoisted, location, captured.Name);
1195
Diagnostics.
Add
(ErrorCode.ERR_UseDefViolationOut, node.Location, symbolName);
1200
Diagnostics.
Add
(ErrorCode.ERR_UseDefViolation, node.Location, symbolName);
1252
Diagnostics.
Add
(
1266
Diagnostics.
Add
(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1276
Diagnostics.
Add
(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1292
Diagnostics.
Add
(
1300
Diagnostics.
Add
(
1307
Diagnostics.
Add
(
1915
Diagnostics.
Add
((primaryCtor.ContainingType is { IsRecord: true } or { IsRecordStruct: true }) ?
2284
Diagnostics.
Add
(assigned && _writtenVariables.Contains(symbol) ? ErrorCode.WRN_UnreferencedVarAssg : ErrorCode.WRN_UnreferencedVar, symbol.GetFirstLocationOrNone(), symbol.Name);
2303
Diagnostics.
Add
(ErrorCode.WRN_UnreferencedLocalFunction, symbol.GetFirstLocationOrNone(), symbol.Name);
2332
Diagnostics.
Add
(ErrorCode.ERR_FixedLocalInLambda, new SourceLocation(node.Syntax), localSymbol);
FlowAnalysis\NullableWalker.cs (7)
1110
Diagnostics.
Add
(ErrorCode.WRN_MemberNotNull, syntax.GetLocation(), member.Name);
1179
Diagnostics.
Add
(ErrorCode.WRN_MemberNotNullWhen, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation(), member.Name, sense ? "true" : "false");
1351
Diagnostics.
Add
(ErrorCode.WRN_ParameterDisallowsNull, location, parameter.Name);
1378
Diagnostics.
Add
(ErrorCode.WRN_ParameterConditionallyDisallowsNull, syntax.Location, parameter.Name, sense ? "true" : "false");
1437
Diagnostics.
Add
(ErrorCode.WRN_ParameterNotNullIfNotNull, location, outputParam.Name, inputParam.Name);
1442
Diagnostics.
Add
(ErrorCode.WRN_ReturnNotNullIfNotNull, location, inputParam.Name);
2741
Diagnostics.
Add
(errorCode, location, arguments);
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (1)
701
_diagnostics.
Add
(ErrorCode.ERR_SpecialByRefInLambda, syntax.Location, type);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (2)
94
diagnostics.
Add
(ErrorCode.ERR_ByRefTypeAndAwait, syntax.Location, local.TypeWithAnnotations);
112
diagnostics.
Add
(ErrorCode.ERR_ByRefTypeAndAwait, syntax.Location, parameter.TypeWithAnnotations);
Symbols\AssemblySymbol.cs (1)
1027
warnings.
Add
(ErrorCode.WRN_MultiplePredefTypes, NoLocation.Singleton, result, result.ContainingAssembly);
Symbols\ReferenceManager.cs (1)
106
diagnostics.
Add
(ErrorCode.ERR_AssemblySpecifiedForLinkAndRef, NoLocation.Singleton, duplicateReference.Display, primaryReference.Display);
Symbols\Source\ModifierUtils.cs (1)
510
diagnostics.
Add
(
Symbols\Source\SourceAssemblySymbol.cs (5)
2758
diagnostics.
Add
(ErrorCode.WRN_UnreferencedEvent, associatedPropertyOrEvent.GetFirstLocationOrNone(), associatedPropertyOrEvent);
2763
diagnostics.
Add
(ErrorCode.WRN_UnreferencedField, field.GetFirstLocationOrNone(), field);
2767
diagnostics.
Add
(ErrorCode.WRN_UnassignedInternalRefField, field.GetFirstLocationOrNone(), field);
2771
diagnostics.
Add
(ErrorCode.WRN_UnassignedInternalField, field.GetFirstLocationOrNone(), field, DefaultValue(field.Type));
2791
diagnostics.
Add
(ErrorCode.WRN_UnreferencedFieldAssg, field.GetFirstLocationOrNone(), field);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
543
diagnostics.
Add
(ErrorCode.WRN_LowerCaseTypeName, location, name);
Symbols\Source\SourceNamespaceSymbol.AliasesAndUsings.cs (13)
301
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, pair.Value.Alias.GetFirstLocation(), pair.Key);
334
diagnostics.
Add
(ErrorCode.HDN_DuplicateWithGlobalUsing, namespaceOrType.UsingDirective!.NamespaceOrType.Location, namespaceOrType.NamespaceOrType);
370
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, externAlias.Alias.GetFirstLocation(), externAlias.Alias.Name);
492
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, existingAlias.Alias.GetFirstLocation(), existingAlias.Alias.Name);
689
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, location, identifierValueText);
700
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, usingDirective.Location, identifierValueText);
788
diagnostics.
Add
(ErrorCode.ERR_BadUsingType, usingDirective.NamespaceOrType.Location, imported);
792
diagnostics.
Add
(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ?
806
diagnostics.
Add
(ErrorCode.ERR_BadUsingNamespace, usingDirective.NamespaceOrType.Location, imported);
813
diagnostics.
Add
(ErrorCode.ERR_GlobalUsingStaticFileType, usingDirective.NamespaceOrType.Location, imported);
818
diagnostics.
Add
(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ?
834
diagnostics.
Add
(ErrorCode.ERR_BadUsingStaticType, usingDirective.NamespaceOrType.Location, imported.GetKindText());
846
diagnostics.
Add
(ErrorCode.ERR_BadSKknown, usingDirective.NamespaceOrType.Location,
Symbols\Symbol_Attributes.cs (2)
223
arguments.Diagnostics.DiagnosticBag.
Add
(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName);
235
arguments.Diagnostics.DiagnosticBag.
Add
(ErrorCode.ERR_AttributeCannotBeAppliedManually, arguments.AttributeSyntaxOpt!.Location, args: [AttributeDescription.MetadataUpdateDeletedAttribute.FullName]);