79 references to Add
Microsoft.CodeAnalysis.CSharp (79)
Binder\Binder_Symbols.cs (1)
2813
diagnostics?.
Add
(ErrorCode.WRN_ErrorOverride, getLocation(data), diagInfo, (int)diagInfo.Code);
Compilation\CSharpCompilation.cs (3)
3555
diagnostics.
Add
(ErrorCode.ERR_ModuleEmitFailure, NoLocation.Singleton, ((Cci.INamedEntity)moduleBeingBuilt).Name,
3706
_diagnostics.
Add
(ErrorCode.ERR_FileTypeNonUniquePath, location, symbol, filePath);
3937
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);
171
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)
689
diagnostics.
Add
(ErrorCode.ERR_ExportedTypeConflictsWithDeclaration, NoLocation.Singleton, type, type.ContainingModule);
693
diagnostics.
Add
(ErrorCode.ERR_ForwardedTypeConflictsWithDeclaration, NoLocation.Singleton, type);
709
diagnostics.
Add
(ErrorCode.ERR_ExportedTypesConflict, NoLocation.Singleton, type, type.ContainingModule, contender, contender.ContainingModule);
714
diagnostics.
Add
(ErrorCode.ERR_ForwardedTypeConflictsWithExportedType, NoLocation.Singleton, type, type.ContainingAssembly, contender, contender.ContainingModule);
719
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,
264
diagnostics.
Add
(ErrorCode.ERR_InvalidAttributeArgument, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), node.GetErrorDisplayName());
270
diagnostics.
Add
(ErrorCode.ERR_InvalidNamedArgument, node.ArgumentList.Arguments[namedArgumentIndex].Location, parameterName);
281
diagnostics.
Add
(ErrorCode.ERR_MarshalUnmanagedTypeNotValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
286
diagnostics.
Add
(ErrorCode.ERR_MarshalUnmanagedTypeOnlyValidForFields, ((CSharpAttributeData)attribute).GetAttributeArgumentLocation(parameterIndex), unmanagedTypeName);
292
diagnostics.
Add
(ErrorCode.ERR_AttributeParameterRequired1, node.Name.Location, parameterName);
298
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);
379
Diagnostics.
Add
(isLastSection ? ErrorCode.ERR_SwitchFallOut : ErrorCode.ERR_SwitchFallThrough,
FlowAnalysis\DefiniteAssignment.cs (18)
498
Diagnostics.
Add
(
505
Diagnostics.
Add
(
523
Diagnostics.
Add
(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
542
Diagnostics.
Add
(ErrorCode.ERR_ParamUnassigned, location, parameter.Name);
627
diagnostics.
Add
(newCode, diagnostic.Location, args);
694
diagnostics.
Add
(ErrorCode.ERR_LocalCantBeFixedAndHoisted, location, captured.Name);
1243
Diagnostics.
Add
(ErrorCode.ERR_UseDefViolationOut, node.Location, symbolName);
1248
Diagnostics.
Add
(ErrorCode.ERR_UseDefViolation, node.Location, symbolName);
1300
Diagnostics.
Add
(
1314
Diagnostics.
Add
(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1324
Diagnostics.
Add
(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName);
1340
Diagnostics.
Add
(
1348
Diagnostics.
Add
(
1355
Diagnostics.
Add
(
1963
Diagnostics.
Add
((primaryCtor.ContainingType is { IsRecord: true } or { IsRecordStruct: true }) ?
2332
Diagnostics.
Add
(assigned && _writtenVariables.Contains(symbol) ? ErrorCode.WRN_UnreferencedVarAssg : ErrorCode.WRN_UnreferencedVar, symbol.GetFirstLocationOrNone(), symbol.Name);
2351
Diagnostics.
Add
(ErrorCode.WRN_UnreferencedLocalFunction, symbol.GetFirstLocationOrNone(), symbol.Name);
2380
Diagnostics.
Add
(ErrorCode.ERR_FixedLocalInLambda, new SourceLocation(node.Syntax), localSymbol);
FlowAnalysis\NullableWalker.cs (7)
1093
Diagnostics.
Add
(ErrorCode.WRN_MemberNotNull, syntax.GetLocation(), member.Name);
1162
Diagnostics.
Add
(ErrorCode.WRN_MemberNotNullWhen, syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation(), member.Name, sense ? "true" : "false");
1334
Diagnostics.
Add
(ErrorCode.WRN_ParameterDisallowsNull, location, parameter.Name);
1361
Diagnostics.
Add
(ErrorCode.WRN_ParameterConditionallyDisallowsNull, syntax.Location, parameter.Name, sense ? "true" : "false");
1420
Diagnostics.
Add
(ErrorCode.WRN_ParameterNotNullIfNotNull, location, outputParam.Name, inputParam.Name);
1425
Diagnostics.
Add
(ErrorCode.WRN_ReturnNotNullIfNotNull, location, inputParam.Name);
2706
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)
1014
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)
477
diagnostics.
Add
(
Symbols\Source\SourceAssemblySymbol.cs (5)
2737
diagnostics.
Add
(ErrorCode.WRN_UnreferencedEvent, associatedPropertyOrEvent.GetFirstLocationOrNone(), associatedPropertyOrEvent);
2742
diagnostics.
Add
(ErrorCode.WRN_UnreferencedField, field.GetFirstLocationOrNone(), field);
2746
diagnostics.
Add
(ErrorCode.WRN_UnassignedInternalRefField, field.GetFirstLocationOrNone(), field);
2750
diagnostics.
Add
(ErrorCode.WRN_UnassignedInternalField, field.GetFirstLocationOrNone(), field, DefaultValue(field.Type));
2770
diagnostics.
Add
(ErrorCode.WRN_UnreferencedFieldAssg, field.GetFirstLocationOrNone(), field);
Symbols\Source\SourceMemberContainerSymbol.cs (1)
518
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);
688
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, location, identifierValueText);
699
diagnostics.
Add
(ErrorCode.ERR_DuplicateAlias, usingDirective.Location, identifierValueText);
775
diagnostics.
Add
(ErrorCode.ERR_BadUsingType, usingDirective.NamespaceOrType.Location, imported);
779
diagnostics.
Add
(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ?
793
diagnostics.
Add
(ErrorCode.ERR_BadUsingNamespace, usingDirective.NamespaceOrType.Location, imported);
800
diagnostics.
Add
(ErrorCode.ERR_GlobalUsingStaticFileType, usingDirective.NamespaceOrType.Location, imported);
805
diagnostics.
Add
(!globalUsingNamespacesOrTypes.IsEmpty && getOrCreateUniqueGlobalUsingsNotInTree(ref uniqueGlobalUsings, globalUsingNamespacesOrTypes, declarationSyntax.SyntaxTree).Contains(imported) ?
820
diagnostics.
Add
(ErrorCode.ERR_BadUsingStaticType, usingDirective.NamespaceOrType.Location, imported.GetKindText());
832
diagnostics.
Add
(ErrorCode.ERR_BadSKknown, usingDirective.NamespaceOrType.Location,
Symbols\Symbol_Attributes.cs (1)
223
arguments.Diagnostics.DiagnosticBag.
Add
(ErrorCode.ERR_ExplicitReservedAttr, arguments.AttributeSyntaxOpt.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName);