283 references to Location
Microsoft.CodeAnalysis (6)
Binding\BindingDiagnosticBag.cs (3)
209=> Add(useSiteInfo, static node => node.Location, node); 212=> AddDiagnostics(useSiteInfo, static node => node.Location, node); 274=> Add(useSiteInfo, static node => node.Location, node);
CodeGen\ILBuilderEmit.cs (1)
758_diagnostics.Add(messageProvider.CreateDiagnostic(code, syntax?.Location ?? Location.None));
Emit\Context.cs (1)
23public Location? Location => _syntaxNode?.Location ?? SyntaxReference?.GetLocation();
Symbols\Attributes\CommonAttributeData.cs (1)
437arguments.Diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MethodImplAttributeAsyncCannotBeUsed, arguments.AttributeSyntaxOpt.Location));
Microsoft.CodeAnalysis.CSharp (266)
Binder\Binder.cs (3)
533diagnostics.Add(new CSDiagnostic(info, syntax.Location)); 543diagnostics.Add(new CSDiagnostic(new CSDiagnosticInfo(code), syntax.Location)); 548diagnostics.Add(new CSDiagnostic(new CSDiagnosticInfo(code, args), syntax.Location));
Binder\Binder.ValueChecks.cs (4)
1328diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, local.Syntax.Location, localSymbol); 1344diagnostics.Add(ErrorCode.ERR_RefLocalOrParamExpected, node.Location); 1462diagnostics.Add(ErrorCode.WRN_AssignmentToLockOrDispose, parameter.Syntax.Location, parameterSymbol.Name); 5537diagnostics.Add(ErrorCode.ERR_InternalError, node.Location);
Binder\Binder_AnonymousTypes.cs (1)
94fieldSyntaxNodes[i].Location,
Binder\Binder_Await.cs (2)
451new ConstraintsHelper.CheckConstraintsArgs(@this.Compilation, @this.Conversions, includeNullability: false, node.Location, tempDiagnostics))) 516new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, diagnostics));
Binder\Binder_Conversions.cs (25)
367ReportUseSite(conversion.Method, diagnostics, syntax.Location); 608.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(Compilation, Conversions, includeNullability: false, syntax.Location, diagnostics)); 1610ReportUseSite(collectionBuilderMethod, diagnostics, syntax.Location); 1618Compilation, Conversions, includeNullability: false, syntax.Location, diagnostics)); 1660diagnostics.Add(ErrorCode.ERR_NoNewAbstract, syntax.Location, namedType); 1708syntax.Location, 1750ReportConstructorUseSiteDiagnostics(node.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo); 1781ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo); 2452source.Syntax.Location, 2723diagnostics.Add(ErrorCode.ERR_NoNewAbstract, syntax.Location, analysis.Operator.ContainingType); 2904typeAndSyntax.Syntax.Location, 2920syntax.Location, 3008lambdaParameter.TryGetFirstLocation() ?? lambdaSymbol.SyntaxNode.Location); 3026ReportUnsafeIfNotAllowed(syntax.Location, diagnostics, disallowedUnder: MemorySafetyRules.Legacy); 3266return !methodSymbol.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, node.Location, diagnostics)); 3319diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, receiverOpt.Type, memberSymbol.Name); 3324diagnostics.Add(ErrorCode.ERR_ObjectRequired, node.Location, memberSymbol); 3333diagnostics.Add(ErrorCode.ERR_InitializerAddHasWrongSignature, node.Location, memberSymbol); 3338diagnostics.Add(ErrorCode.ERR_BadAwaitArg, node.Location, receiverOpt.Type); 3342diagnostics.Add(ErrorCode.ERR_ObjectProhibited, node.Location, memberSymbol); 3349diagnostics.Add(ErrorCode.ERR_ObjectRequired, node.Location, memberSymbol); 3363diagnostics.Add(code, errorNode.Location, memberSymbol); 3645if (!MethodIsCompatibleWithDelegateOrFunctionPointer(receiverOpt, isExtensionMethod, selectedMethod, delegateOrFuncPtrType, syntax.Location, diagnostics) || 3655Error(diagnostics, ErrorCode.ERR_DelegateOnConditional, syntax.Location, selectedMethod); 3663Error(diagnostics, ErrorCode.ERR_PartialMethodToDelegate, syntax.Location, selectedMethod);
Binder\Binder_Deconstruct.cs (3)
521locationsBuilder.Add(element.Syntax.Location); 572locationsBuilder.Add(variable.Syntax.Location); 585syntax.Location,
Binder\Binder_Expressions.cs (39)
360diagnostics.Add(op.NoCommonTypeError, op.Syntax.Location, trueArg, falseArg); 495diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterInFieldInitializer, syntax.Location, parameter); 2865diagnostics.Add(ErrorCode.ERR_ConvertToStaticClass, syntax.Location, targetType); 2871diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, syntax.Location, targetType); 2882diagnostics.Add(ErrorCode.ERR_AmbigUDConv, syntax.Location, originalUserDefinedConversions[0], originalUserDefinedConversions[1], operand.Display, targetType); 2889diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher1.First, distinguisher1.Second); 2900!MethodGroupConversionDoesNotExistOrHasErrors((BoundMethodGroup)operand, (NamedTypeSymbol)targetType, syntax.Location, diagnostics, out _)) 2902diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, MessageID.IDS_SK_METHOD.Localize(), targetType); 2957diagnostics.Add(errorCode, syntax.Location, ((BoundUnconvertedAddressOfOperator)operand).Operand.Name, targetType); 2964diagnostics.Add(ErrorCode.ERR_NoExplicitConv, syntax.Location, distinguisher.First, distinguisher.Second); 3779diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentAttributeMalformed, unconvertedString.Syntax.Location, correspondingParameter, handlerType); 3889unconvertedString.Syntax.Location, 3908arguments[argumentIndex].Syntax.Location, 5141diagnostics.Add(ErrorCode.WRN_CapturedPrimaryConstructorParameterPassedToBase, syntax.Location, parameter); 5524diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, node.Location, type, 0); 5606hasErrors = MethodGroupConversionDoesNotExistOrHasErrors(methodGroup, type, node.Location, diagnostics, out conversion); 5613diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location); 5648diagnostics.Add(ErrorCode.ERR_MethDelegateMismatch, node.Location, 5674diagnostics.Add(ErrorCode.ERR_MethodNameExpected, argument.Syntax.Location); 5733diagnostics.Add(ErrorCode.ERR_InstantiatingStaticClass, node.Location, type); 6142diagnostics.Add(ErrorCode.ERR_InterpolatedStringsReferencingInstanceCannotBeInObjectInitializers, argument.Syntax.Location); 6374diagnostics.Add(ErrorCode.ERR_RequiredMembersMustBeAssignedValue, initializerExpression.Syntax.Location, requiredMember); 6394_ => creationSyntax.Location 6858diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type); 6917typeNode.Location, 6954ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo); 7039ReportConstructorUseSiteDiagnostics(typeNode.Location, diagnostics, suppressUnsupportedRequiredMembersError: false, in overloadResolutionUseSiteInfo); 7123diagnostics.Add(ErrorCode.ERR_NoNewAbstract, node.Location, type); 7235diagnostics.Add(ErrorCode.ERR_BadCtorArgCount, typeNode.Location, interfaceType, analyzedArguments.Arguments.Count); 7264diagnostics.Add(ErrorCode.ERR_NoNewTyvar, node.Location, typeParameter); 7279diagnostics.Add(ErrorCode.ERR_NewTyvarWithArgs, node.Location, typeParameter); 8441diagnostics.Add(new CSDiagnostic(lookupError, name.Location)); 9101diagnostics.Add(errorInfo, expression.Location); 9105propertyResult.ReportDiagnostics(binder, expression.Location, expression, diagnostics, memberName, left, left.Syntax, actualReceiverArguments, symbols, 9225diagnostics.Add(ErrorCode.ERR_RuntimeDoesNotSupportRefFields, node.Location); 9917diagnostics.Add(errorOpt ?? new CSDiagnosticInfo(ErrorCode.ERR_BadIndexLHS, expr.Display), node.Location); 10464location: syntax.Location, 11560var location = syntax.Location; 11751diagnostics.Add(new CSDiagnostic(diagnosticInfo, access.Syntax.Location));
Binder\Binder_InterpolatedString.cs (6)
112diagnostics.Add(ErrorCode.WRN_AlignmentMagnitude, alignment.Syntax.Location, alignmentConstant.Int32Value, magnitudeLimit); 804diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerCreationCannotUseDynamic, syntax.Location, interpolatedStringHandlerType.Name); 939parameterNamesAndLocationsBuilder.Add(("alignment", insert.Alignment.Syntax.Location)); 945parameterNamesAndLocationsBuilder.Add(("format", insert.Format.Syntax.Location)); 989diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnMalformed, part.Syntax.Location, method); 999diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerMethodReturnInconsistent, part.Syntax.Location, method, expected);
Binder\Binder_Invocation.cs (8)
173node.Location, 387diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_MethodNameExpected), expression.Location); 1038(typeArgumentsOpt.IsDefault || ((MethodSymbol)(object)result.Member).CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability: false, syntax.Location, candidateDiagnostics)))) 1449diagnostics.Add(ErrorCode.ERR_BadAttributeParamDefaultArgument, syntax.Location, parameter.Name); 1678diagnostics.Add(ErrorCode.ERR_BadAttributeArgument, syntax.Location); 1742diagnostics.Add(ErrorCode.ERR_NotNullRefDefaultParameter, syntax.Location, parameter.Name, parameterType); 2448diagnostics.Add(ErrorCode.ERR_NameofExtensionMethod, methodGroup.Syntax.Location); 2555node.Location,
Binder\Binder_Operators.cs (2)
6002diagnostics.Add(ErrorCode.ERR_RefConditionalDifferentTypes, falseExpr.Syntax.Location, trueType); 6040diagnostics.Add(_inUnsafeRegion ? ErrorCode.WRN_MismatchedRefEscapeInTernary : ErrorCode.ERR_MismatchedRefEscapeInTernary, node.Location);
Binder\Binder_Patterns.cs (15)
254diagnostics.Add(ErrorCode.ERR_IsPatternImpossible, node.Location, expression.Type); 272diagnostics.Add(ErrorCode.WRN_IsPatternAlways, node.Location, expression.Type); 293diagnostics.Add(ErrorCode.WRN_GivenExpressionNeverMatchesPattern, node.Location); 301diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesConstant, node.Location); 309diagnostics.Add(ErrorCode.WRN_GivenExpressionAlwaysMatchesPattern, node.Location); 665diagnostics.Add(ErrorCode.ERR_CannotMatchOnINumberBase, node.Location, inputType); 871diagnostics.Add(ErrorCode.ERR_ValueCantBeNull, expression.Syntax.Location, inputType); 881diagnostics.Add(ErrorCode.ERR_PatternWrongType, expression.Syntax.Location, inputType, expression.Display); 893expression.Syntax.Location, inputType, expression.Display, new CSharpRequiredLanguageVersion(requiredVersion)); 912if (MessageID.IDS_FeatureSpanCharConstantPattern.CheckFeatureAvailability(diagnostics, Compilation, node.Location)) 931diagnostics.Add(ErrorCode.ERR_PatternSpanCharCannotBeStringNull, convertedExpression.Syntax.Location, inputType); 1001diagnostics.Add(ErrorCode.ERR_PatternWrongType, expression.Syntax.Location, caseType, expression.Display); 1011diagnostics.Add(ErrorCode.ERR_UnionMatchingWrongPattern, expression.Syntax.Location, unionType); 1042diagnostics.Add(ErrorCode.ERR_PointerTypeInPatternMatching, typeSyntax.Location); 1685diagnostics.Add(ErrorCode.ERR_TupleElementNameMismatch, node.Location, name, $"Item{tupleIndex + 1}");
Binder\Binder_Query.cs (8)
815node.Location 823new AnonymousTypeField(fieldName, fieldValue.Syntax.Location, TypeWithAnnotations.Create(TypeOrError(fieldValue)), RefKind.None, ScopedKind.None); 944diagnostics.Add(ErrorCode.ERR_NullNotValid, node.Location); 948diagnostics.Add(ErrorCode.ERR_DefaultLiteralNotValid, node.Location); 952diagnostics.Add(ErrorCode.ERR_ImplicitObjectCreationNotValid, node.Location); 956diagnostics.Add(ErrorCode.ERR_BadSKunknown, ultimateReceiver.Syntax.Location, ((BoundNamespaceExpression)ultimateReceiver).NamespaceSymbol, MessageID.IDS_SK_NAMESPACE.Localize()); 961diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, MessageID.IDS_AnonMethod.Localize(), methodName); 983diagnostics.Add(ErrorCode.ERR_QueryNoProvider, node.Location, "void", methodName);
Binder\Binder_Statements.cs (7)
1315if (CheckManagedAddr(Compilation, elementType, initializerSyntax.Location, diagnostics)) 1347additionalDiagnostics.Add(ErrorCode.WRN_PatternBadSignature, initializer.Syntax.Location, initializer.Type, "fixed", patternMethodSymbol); 1473diagnostics.Add(ErrorCode.ERR_VoidAssignment, op1.Syntax.Location); 2041_ => node.Location, 2270diagnostics.Add(ErrorCode.ERR_InternalError, syntax.Location); 2503var location = nodeForError.Location; 3480return node.Location;
Binder\Binder_Symbols.cs (13)
1343diagnostics.Add(diagnosticInfo, node.Location); 1645type.CheckConstraintsForNamedType(new ConstraintsHelper.CheckConstraintsArgs(this.Compilation, this.Conversions, includeNullability, typeSyntax.Location, diagnostics), 1760diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, syntax.Location, descriptor.DeclaringTypeMetadataName, descriptor.Name); 1834return GetWellKnownType(type, diagnostics, node.Location); 1852return GetWellKnownType(compilation, type, diagnostics, node.Location); 2076diagnostics.Add(ErrorCode.WRN_SameFullNameThisNsAgg, where.Location, originalSymbols, 2087diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggNs, where.Location, originalSymbols, 2098diagnostics.Add(ErrorCode.WRN_SameFullNameThisAggAgg, where.Location, originalSymbols, 2318diagnostics.Add(info, where.Location); 2339diagnostics.Add(errorInfo, where.Location); 2372diagnostics.Add(errorInfo, where.Location); 2420diagnostics.Add(new CSDiagnostic(result.Error, where.Location)); 2632var location = where.Location;
Binder\Binder_TupleOperators.cs (2)
325Location location = ((BoundTupleExpression)(useRight ? right : left)).Arguments[i].Syntax.Parent.Location; 414ImmutableArray<Location> elementLocations = elements.SelectAsArray(e => e.Syntax.Location);
Binder\BindingDiagnosticBag.cs (2)
97return ReportUseSite(symbol, static node => node.Location, node); 162=> Add(code, syntax.Location, args);
Binder\ForEachLoopBinder.cs (20)
244messageId.CheckFeatureAvailability(diagnostics, Compilation, collectionExpr.Syntax.Location); 823diagnostics.Add(errorCode, collectionSyntax.Location, 948diagnostics.Add(ErrorCode.ERR_NullNotValid, collectionExpr.Syntax.Location); 953diagnostics.Add(ErrorCode.ERR_AnonMethGrpInForEach, collectionSyntax.Location, collectionExpr.Display); 970diagnostics.Add(ErrorCode.ERR_BadDynamicAwaitForEach, collectionSyntax.Location); 994diagnostics.Add(ErrorCode.ERR_ForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetEnumeratorMethodName); 1001diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName); 1065diagnostics.Add(isAsync ? ErrorCode.ERR_BadGetAsyncEnumerator : ErrorCode.ERR_BadGetEnumerator, collectionSyntax.Location, getEnumeratorMethod.ReturnType, getEnumeratorMethod); 1081diagnostics.Add(isAsync ? ErrorCode.ERR_MultipleIAsyncEnumOfT : ErrorCode.ERR_MultipleIEnumOfT, errorLocationSyntax.Location, unwrappedCollectionExprType, 1108diagnostics, errorLocationSyntax.Location, isOptional: false); 1116diagnostics.Add(ErrorCode.ERR_AwaitForEachMissingMember, collectionSyntax.Location, unwrappedCollectionExprType, WellKnownMemberNames.GetAsyncEnumeratorMethodName); 1146diagnostics, errorLocationSyntax.Location, isOptional: false); 1153currentPropertyGetter = (MethodSymbol)GetWellKnownTypeMember(Compilation, WellKnownMember.System_Collections_Generic_IAsyncEnumerator_T__get_Current, diagnostics, errorLocationSyntax.Location, isOptional: false); 1466diagnostics.Add(ErrorCode.WRN_PatternNotPublicOrNotInstance, collectionSyntax.Location, patternType, patternName.Localize(), result); 1502diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, patternType, MessageID.IDS_Collection.Localize(), 1600diagnostics.Add(ErrorCode.WRN_PatternIsAmbiguous, collectionSyntax.Location, collectionExpr.Type, MessageID.IDS_Collection.Localize(), 1607location: collectionSyntax.Location, 1759diagnostics.Add(ErrorCode.WRN_PatternBadSignature, collectionSyntax.Location, enumeratorType, MessageID.IDS_Collection.Localize(), patternMemberCandidate); 1931diagnostics.Add(lookupResult.Error, collectionSyntax.Location); 1937diagnostics.Add(ErrorCode.ERR_NoSuchMember, collectionSyntax.Location, patternType, memberName);
Binder\Semantics\Conversions\Conversions.cs (3)
368expr.Syntax.Location, 379expr.Syntax.Location, 391binder: binder, location: expr.Syntax.Location, nodeOpt: expr.Syntax, diagnostics: overloadDiagnostics,
Binder\SwitchBinder.cs (1)
267diagnostics.Add(ErrorCode.WRN_GotoCaseShouldConvert, node.Location, SwitchGoverningType);
Binder\SwitchBinder_Patterns.cs (1)
120diagnostics.Add(ErrorCode.ERR_DuplicateCaseLabel, syntax.Location, cp.ConstantValue.GetValueToDisplay());
Binder\SwitchExpressionBinder.cs (1)
80diagnostics.Add(ErrorCode.ERR_SwitchArmSubsumed, arm.Pattern.Syntax.Location);
Binder\UsingStatementBinder.cs (1)
207MessageID.IDS_FeatureDisposalPattern.CheckFeatureAvailability(diagnostics, originalBinder.Compilation, syntax.Location);
CodeGen\EmitConversion.cs (1)
425_diagnostics.Add(ErrorCode.ERR_BadDelegateConstructor, syntax.Location, delegateType);
CodeGen\EmitStatement.cs (2)
711_diagnostics.Add(ErrorCode.ERR_ModuleEmitFailure, block.Syntax.Location, ((Cci.INamedEntity)_module).Name, "Exception handling is not allowed in exception filters"); 940_diagnostics.Add(ErrorCode.ERR_ModuleEmitFailure, statement.Syntax.Location, ((Cci.INamedEntity)_module).Name, "Exception handling is not allowed in exception filters");
Compilation\CSharpCompilation.cs (1)
1955diagnostics.Add(ErrorCode.ERR_SimpleProgramNotAnExecutable, simpleProgramEntryPointSymbol.ReturnTypeSyntax.Location);
Compilation\CSharpSemanticModel.cs (1)
5295var lineSpan = nameSyntax.Location.GetLineSpan().Span.Start;
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (3)
479location = originatingSyntax.Location; 508Location sourceLocation = originatingSyntax.Location; 530Location sourceLocation = originatingSyntax.Location;
Compiler\MethodBodySynthesizer.cs (1)
371syntax.Location));
Compiler\TypeCompilationState.cs (1)
232diagnostics.Add(ErrorCode.ERR_IndirectRecursiveConstructorCall, syntax.Location, method1);
Emitter\Model\PEModuleBuilder.cs (5)
977syntaxNodeOpt != null ? syntaxNodeOpt.Location : NoLocation.Singleton); 1143diagnostics.Add(new CSDiagnostic(diagInfo ?? new CSDiagnosticInfo(ErrorCode.ERR_BogusType, string.Empty), syntaxNodeOpt == null ? NoLocation.Singleton : syntaxNodeOpt.Location)); 1247var location = syntaxNodeOpt == null ? NoLocation.Singleton : syntaxNodeOpt.Location; 2114if (Binder.TryGetOptionalWellKnownType(Compilation, arrayWellKnownType, diagnostics, syntaxNode.Location, out var existingType)) 2151Symbol.ReportUseSiteDiagnostic(info, diagnostics, syntaxNode.Location);
Emitter\NoPia\EmbeddedEvent.cs (2)
84diagnostics.Add(errorInfo, syntaxNodeOpt?.Location ?? NoLocation.Singleton); 116diagnostics.Add(syntaxNodeOpt == null ? NoLocation.Singleton : syntaxNodeOpt.Location, useSiteInfo.Diagnostics);
Emitter\NoPia\EmbeddedTypesManager.cs (4)
81syntaxNodeOpt != null ? syntaxNodeOpt.Location : NoLocation.Singleton); 118syntaxNodeOpt != null ? syntaxNodeOpt.Location : NoLocation.Singleton); 216diagnostics.Add(errorInfo, syntaxNodeOpt?.Location ?? NoLocation.Singleton); 395diagnostics.Add(new CSDiagnostic(info, syntaxOpt == null ? NoLocation.Singleton : syntaxOpt.Location));
Errors\DiagnosticBagExtensions.cs (1)
67return !useSiteDiagnostics.IsNullOrEmpty() && diagnostics.Add(node.Location, useSiteDiagnostics);
Errors\MessageID.cs (2)
372static tuple => tuple.location ?? tuple.syntax.Location, 400static tuple => tuple.location ?? tuple.syntax.Location,
FlowAnalysis\AbstractFlowPass.cs (1)
898Diagnostics.Add(ErrorCode.ERR_InternalError, node.Syntax.Location);
FlowAnalysis\ControlFlowPass.cs (1)
341var sourceLocation = node.Syntax.Location;
FlowAnalysis\DefiniteAssignment.cs (12)
1195Diagnostics.Add(ErrorCode.ERR_UseDefViolationOut, node.Location, symbolName); 1200Diagnostics.Add(ErrorCode.ERR_UseDefViolation, node.Location, symbolName); 1248Diagnostics.Add(ErrorCode.WRN_UseDefViolationThisSupportedVersion, node.Location); 1254node.Location, 1266Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName); 1276Diagnostics.Add(hasAssociatedProperty ? ErrorCode.ERR_UseDefViolationProperty : ErrorCode.ERR_UseDefViolationField, node.Location, symbolName); 1294node.Location, 1302node.Location, 1309node.Location, 1577LeaveParameter(param, node.Syntax, paramExpr.Syntax.Location); 2514_unsafeAddressTakenVariables.Add(variable, node.Syntax.Location); 2669_unsafeAddressTakenVariables.Add(receiver, node.Syntax.Location);
FlowAnalysis\NullableWalker.cs (8)
1361Diagnostics.Add(ErrorCode.WRN_ParameterConditionallyDisallowsNull, syntax.Location, parameter.Name, sense ? "true" : "false"); 8249ReportDiagnostic(ErrorCode.WRN_DisallowNullAttributeForbidsMaybeNullAssignment, node.Location); 8919Diagnostics.Add(pair.UseSiteInfo.DiagnosticInfo, syntax.Location); 8949Diagnostics.Add(pair.UseSiteInfo.DiagnosticInfo, syntax.Location); 9368var locations = tupleOpt.TupleElements.SelectAsArray((element, location) => element.TryGetFirstLocation() ?? location, node.Syntax.Location); 9372tupleOpt.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(compilation, _conversions, includeNullability: true, node.Syntax.Location, diagnostics: null), 10893ReportNullabilityMismatchWithTargetDelegate(group.Syntax.Location, delegateType, delegateInvokeMethod, method, node.IsExtensionMethod); 10965ReportNullabilityMismatchWithTargetDelegate(arg.Syntax.Location, delegateType, delegateInvokeMethod, argInvokeMethod, invokedAsExtensionMethod: false);
Lowering\AsyncRewriter\AsyncMethodBuilderMemberCollection.cs (6)
356F.Diagnostics.Add(ErrorCode.ERR_WrongArityAsyncReturn, F.Syntax.Location, builderType); 367F.Diagnostics.Add(ErrorCode.ERR_BadAsyncReturn, F.Syntax.Location); 462F.Syntax.Location); 494F.Diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, F.Syntax.Location, builderType, methodName); 520F.Syntax.Location); 530F.Syntax.Location);
Lowering\AsyncRewriter\AsyncMethodToStateMachineRewriter.cs (1)
656onCompleted.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(F.Compilation, F.Compilation.Conversions, includeNullability: false, F.Syntax.Location, this.Diagnostics));
Lowering\AsyncRewriter\AsyncRewriter.cs (2)
132return Binder.GetWellKnownTypeMember(F.Compilation, member, bag, body.Syntax.Location); 258startMethod.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(F.Compilation, F.Compilation.Conversions, includeNullability: false, F.Syntax.Location, diagnostics));
Lowering\AsyncRewriter\RuntimeAsyncRewriter.cs (1)
121node.Syntax.Location,
Lowering\ClosureConversion\ClosureConversion.Analysis.Tree.cs (1)
701_diagnostics.Add(ErrorCode.ERR_SpecialByRefInLambda, syntax.Location, type);
Lowering\ClosureConversion\ExpressionLambdaRewriter.cs (1)
121diagnostics.Add(ErrorCode.ERR_MissingPredefinedMember, node.Syntax.Location, r.ExpressionType, "Lambda");
Lowering\DiagnosticsPass_ExpressionTrees.cs (1)
61_diagnostics.Add(code, node.Syntax.Location, args);
Lowering\DiagnosticsPass_Warnings.cs (2)
332_diagnostics.Add(ErrorCode.WRN_BadRefCompareLeft, node.Syntax.Location, t); 337_diagnostics.Add(ErrorCode.WRN_BadRefCompareRight, node.Syntax.Location, t);
Lowering\IteratorRewriter\IteratorRewriter.cs (1)
166bag.ReportUseSite(getter, body.Syntax.Location);
Lowering\LocalRewriter\LocalRewriter.cs (1)
347location = node.Syntax.Location;
Lowering\LocalRewriter\LocalRewriter_Conversion.cs (3)
133node.Syntax.Location, 763_factory.ModuleBuilderOpt.EnsureParamCollectionAttributeExists(_diagnostics, node.Location); 846rewrittenOperand.Syntax.Location,
Lowering\LocalRewriter\LocalRewriter_Event.cs (2)
37_diagnostics.Add(errorInfo, node.Syntax.Location); 278_diagnostics.Add(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, invocationListProperty.ContainingType, accessorName), syntax.Location);
Lowering\StateMachineRewriter\IteratorAndAsyncCaptureWalker.cs (3)
94diagnostics.Add(ErrorCode.ERR_ByRefTypeAndAwait, syntax.Location, local.TypeWithAnnotations); 100diagnostics.Add(ErrorCode.ERR_RefLocalAcrossAwait, syntax.Location); 112diagnostics.Add(ErrorCode.ERR_ByRefTypeAndAwait, syntax.Location, parameter.TypeWithAnnotations);
Lowering\StateMachineRewriter\RefInitializationHoister.cs (2)
243_factory.Diagnostics.Add(ErrorCode.ERR_RefReturningCallAndAwait, _factory.Syntax.Location, call.Method); 263_factory.Diagnostics.Add(ErrorCode.ERR_RefConditionalAndAwait, _factory.Syntax.Location);
Lowering\SyntheticBoundNodeFactory.cs (3)
329var diagnostic = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, memberDescriptor.DeclaringTypeMetadataName, memberDescriptor.Name), Syntax.Location); 376var diagnostic = new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.ERR_MissingPredefinedMember, memberDescriptor.DeclaringTypeMetadataName, memberDescriptor.Name), Syntax.Location); 1243return Throw(Null(Binder.GetWellKnownType(Compilation, Microsoft.CodeAnalysis.WellKnownType.System_Exception, Diagnostics, Syntax.Location)));
Symbols\Attributes\SourceAttributeData.cs (1)
167return GetAttributeArgumentSyntax(parameterIndex).Location;
Symbols\ConstantValueUtils.cs (3)
91diagnostics.Add(ErrorCode.ERR_InvalidConstantDeclarationType, initValueNode.Location, thisSymbol, typeSymbol); 123diagnostics.Add(ErrorCode.ERR_NotNullConstRefField, initValueNode.Location, thisSymbol, typeSymbol); 139diagnostics.Add(ErrorCode.ERR_NotConstantExpression, initValueNode.Location, thisSymbol);
Symbols\ConstraintsHelper.cs (1)
663var location = ordinal == NamedTypeSymbol.ValueTupleRestIndex ? typeSyntax.Location : elementLocations[ordinal + offset];
Symbols\MethodSymbol.cs (2)
1053diagnostics?.Add(ErrorCode.ERR_UnmanagedCallersOnlyRequiresStatic, node!.Location); 1059diagnostics?.Add(ErrorCode.ERR_UnmanagedCallersOnlyMethodOrTypeCannotBeGeneric, node!.Location);
Symbols\Source\LambdaSymbol.cs (1)
239return ImmutableArray.Create<Location>(_syntax.Location);
Symbols\Source\ParameterHelpers.cs (1)
595internal static Location GetParameterLocation(ParameterSymbol parameter) => parameter.GetNonNullSyntaxNode().Location;
Symbols\Source\SourceComplexParameterSymbol.cs (2)
284parameterEqualsValue.Value.Syntax.Location); 958diagnostics.Add(ErrorCode.ERR_ParamDefaultValueDiffersFromAttribute, syntax.Location);
Symbols\Source\SourceLocalSymbol.cs (3)
367diagnostics.Add(ForbiddenDiagnostic, reference.Location, reference); 424diagnostics.Add(ForbiddenDiagnostic, reference.Location, reference); 450diagnostics.Add(ForbiddenDiagnostic, reference.Location, reference);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (2)
1437diagnostics.Add(ErrorCode.ERR_CannotUseRefInUnmanagedCallersOnly, syntax.Location); 1453diagnostics.Add(ErrorCode.ERR_CannotUseManagedTypeInUnmanagedCallersOnly, syntax.Location, type, (isParam ? MessageID.IDS_Parameter : MessageID.IDS_Return).Localize());
Symbols\Source\SourceTypeParameterSymbol.cs (2)
280DeclaringCompilation.EnsureIsUnmanagedAttributeExists(diagnostics, this.GetNonNullSyntaxNode().Location, ModifyCompilationForAttributeEmbedding()); 317Location getLocation() => this.GetNonNullSyntaxNode().Location;
Symbols\Symbol.cs (2)
529foreach (var descendant in parent.DescendantNodesAndSelf(c => c.Location.SourceSpan.Contains(location.SourceSpan))) 531if (descendant is TNode && descendant.Location.SourceSpan.Contains(location.SourceSpan))
Symbols\Tuples\TupleTypeSymbol.cs (3)
65constructedType.CheckConstraints(new ConstraintsHelper.CheckConstraintsArgs(compilation, compilation.Conversions, includeNullability, syntax.Location, diagnostics), 299diagnostics.Add(ErrorCode.WRN_TupleLiteralNameMismatch, literal.Arguments[i].Syntax.Parent!.Location, sourceName, destination); 503diagnostics.Add(useSiteInfo, static syntax => syntax?.Location ?? Location.None, syntax);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (9)
Diagnostics\DiagnosticAnalyzerTests.cs (3)
59context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(s_CA9999_UseOfVariableThatStartsWithX, id.Location, id.Identifier.ValueText)); 2344ReportDiagnosticsCore(addDiagnostic, node.Location, $"Node: {node.ToString()}"); 2349ReportDiagnosticsCore(addDiagnostic, operation.Syntax.Location, $"Operation: {name}");
FieldKeywordTests.cs (2)
13040context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor_Field, walker.FieldReference.Syntax.Location)); 13043context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor_Invalid, walker.Invalid.Syntax.Location));
Semantics\OutVarTests.cs (2)
35652Assert.Equal(tree, identifierBefore.Location.SourceTree); 35658Assert.Null(identifierAfter.Location.SourceTree);
Semantics\PatternMatchingTests2.cs (2)
2041var gotModel = model.TryGetSpeculativeSemanticModel(returnStatement.Location.SourceSpan.Start, modifiedReturnStatement, out var speculativeModel); 2082var gotModel = model.TryGetSpeculativeSemanticModel(returnStatement.Location.SourceSpan.Start, modifiedReturnStatement, out var speculativeModel);
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (2)
Semantics\ImplicitObjectCreationTests.cs (2)
4149int nodeLocation = node.Location.SourceSpan.Start; 4176int nodeLocation = node.Location.SourceSpan.Start;