6 types derived from Location
Microsoft.CodeAnalysis (5)
Microsoft.CodeAnalysis.VisualBasic (1)
2649 references to Location
ConfigurationSchemaGenerator (10)
CSharpSyntaxGenerator (1)
ILLink.RoslynAnalyzer (46)
TrimAnalysis\ReflectionAccessAnalyzer.cs (13)
27 internal void GetReflectionAccessDiagnostics (Location location, ITypeSymbol typeSymbol, DynamicallyAccessedMemberTypes requiredMemberTypes, bool declaredOnly = false)
56 internal void GetReflectionAccessDiagnosticsForEventsOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags)
62 internal void GetReflectionAccessDiagnosticsForFieldsOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags)
68 internal void GetReflectionAccessDiagnosticsForPropertiesOnTypeHierarchy (Location location, ITypeSymbol typeSymbol, string name, BindingFlags? bindingFlags)
74 internal void GetReflectionAccessDiagnosticsForConstructorsOnType (Location location, ITypeSymbol typeSymbol, BindingFlags? bindingFlags, int? parameterCount)
80 internal void GetReflectionAccessDiagnosticsForPublicParameterlessConstructor (Location location, ITypeSymbol typeSymbol)
86 void ReportRequiresUnreferencedCodeDiagnostic (Location location, AttributeData requiresAttributeData, ISymbol member)
94 internal void GetReflectionAccessDiagnosticsForMethod (Location location, IMethodSymbol methodSymbol)
108 internal void GetTypeHierarchyReflectionAccessDiagnostics (Location location, ISymbol member)
151 internal void GetDiagnosticsForReflectionAccessToDAMOnMethod (Location location, IMethodSymbol methodSymbol)
166 internal void GetReflectionAccessDiagnosticsForProperty (Location location, IPropertySymbol propertySymbol)
174 void GetDiagnosticsForEvent (Location location, IEventSymbol eventSymbol)
184 void GetDiagnosticsForField (Location location, IFieldSymbol fieldSymbol)
Microsoft.Analyzers.Extra (1)
Microsoft.Analyzers.Local.Tests (1)
Microsoft.AspNetCore.Analyzer.Testing (3)
Microsoft.AspNetCore.App.Analyzers (16)
Microsoft.AspNetCore.Components.Analyzers (3)
Microsoft.AspNetCore.Components.Analyzers.Tests (5)
Microsoft.AspNetCore.Components.SdkAnalyzers (3)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (5)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (7)
Microsoft.AspNetCore.Mvc.Analyzers (9)
Microsoft.AspNetCore.Mvc.Api.Analyzers (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (1)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation.Test (3)
Microsoft.AspNetCore.SignalR.Client.SourceGenerator (2)
Microsoft.CodeAnalysis (210)
Binding\BindingDiagnosticBag.cs (10)
217internal bool Add(Location location, CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo)
220internal bool AddDiagnostics(Location location, CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo)
223internal bool AddDiagnostics<TData>(CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo, Func<TData, Location> getLocation, TData data)
230var location = getLocation(data);
259internal bool Add<TData>(CompoundUseSiteInfo<TAssemblySymbol> useSiteInfo, Func<TData, Location> getLocation, TData data)
271protected abstract bool ReportUseSiteDiagnostic(DiagnosticInfo diagnosticInfo, DiagnosticBag diagnosticBag, Location location);
276internal bool Add(UseSiteInfo<TAssemblySymbol> useSiteInfo, Location location)
282internal bool Add<TData>(UseSiteInfo<TAssemblySymbol> info, Func<TData, Location> getLocation, TData data)
293internal bool ReportUseSiteDiagnostic(DiagnosticInfo? info, Location location)
296internal bool ReportUseSiteDiagnostic<TData>(DiagnosticInfo? info, Func<TData, Location> getLocation, TData data)
Compilation\Compilation.cs (30)
1298ImmutableArray<Location?> elementLocations = default,
1339ImmutableArray<Location?> elementLocations)
1389ImmutableArray<Location?> elementLocations)
1403ImmutableArray<Location?> elementLocations,
1415ImmutableArray<Location?> elementLocations = default,
1435ImmutableArray<Location?> elementLocations)
1443ImmutableArray<Location?> elementLocations,
1456ImmutableArray<Location> memberLocations = default,
1525ImmutableArray<Location> memberLocations)
1533ImmutableArray<Location> memberLocations,
2021diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2026diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2031diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2052diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_BadWin32Resource, Location.None, ex.Message));
2145diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceNotUnique, Location.None, resource.ResourceName));
2152diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceFileNameNotUnique, Location.None, fileName));
2160diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceFileNameNotUnique, Location.None, fileName));
2171diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceNotUnique, Location.None, name));
3171diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_ResourceInModule, Location.None));
3306diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PdbWritingFailed, Location.None, ex.Message));
3311diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PeWritingFailure, Location.None, e.InnerException?.ToString() ?? ""));
3316diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_CantReadResource, Location.None, e.Message, e.InnerException?.Message ?? ""));
3321diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PermissionSetAttributeFileReadError, Location.None, e.FileName, e.PropertyName, e.Message));
3483diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PdbWritingFailed, Location.None, e.Message));
3488diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PeWritingFailure, Location.None, e.InnerException?.ToString() ?? ""));
3493diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_PermissionSetAttributeFileReadError, Location.None, e.FileName, e.PropertyName, e.Message));
3588internal abstract int CompareSourceLocations(Location loc1, Location loc2);
3606where TLocation : Location
3622where TLocation : Location
Diagnostic\CommonMessageProvider.cs (5)
80public Diagnostic CreateDiagnostic(int code, Location location)
93public abstract Diagnostic CreateDiagnostic(int code, Location location, params object[] args);
210public abstract void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity);
211public abstract void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity);
257diagnostics.Add(CreateDiagnostic(ERR_OutputWriteFailed, Location.None, filePath, e.Message));
Diagnostic\Diagnostic.cs (28)
43/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
48Location? location,
58/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
68Location? location,
79/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
89Location? location,
90IEnumerable<Location>? additionalLocations,
100/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
115Location? location,
116IEnumerable<Location>? additionalLocations,
127/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
143Location? location,
145IEnumerable<Location>? additionalLocations,
159location: location ?? Location.None,
178/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
205Location? location = null,
206IEnumerable<Location>? additionalLocations = null,
228/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
256Location? location = null,
257IEnumerable<Location>? additionalLocations = null,
277severity, defaultSeverity, isEnabledByDefault, warningLevel, location ?? Location.None, additionalLocations, customTags, properties, isSuppressed);
292return new DiagnosticWithInfo(info, Location.None);
390/// Gets the primary location of the diagnostic, or <see cref="Location.None"/> if no primary location.
392public abstract Location Location { get; }
398public abstract IReadOnlyList<Location> AdditionalLocations { get; }
453internal abstract Diagnostic WithLocation(Location location);
506foreach (var location in AdditionalLocations)
516static bool isLocationWithinSpan(Location location, SyntaxTree tree, TextSpan? filterSpan)
Emit\EmitOptions.cs (6)
336diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidDebugInformationFormat, Location.None, (int)DebugInformationFormat));
348diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidInstrumentationKind, Location.None, (int)instrumentationKind));
359diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidFileAlignment, Location.None, FileAlignment));
364diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidSubsystemVersion, Location.None, SubsystemVersion.ToString()));
375diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidHashAlgorithmName, Location.None, PdbChecksumAlgorithm.ToString()));
380diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_InvalidHashAlgorithmName, Location.None, ""));
ReferenceManager\CommonReferenceManager.Resolution.cs (12)
221ImmutableArray<Location> referenceDirectiveLocations;
269Location location;
277location = Location.None;
475private Metadata? GetMetadata(PortableExecutableReference peReference, CommonMessageProvider messageProvider, Location location, DiagnosticBag diagnostics)
547var metadata = GetMetadata(peReference, MessageProvider, Location.None, diagnostics);
559diagnostics.Add(MessageProvider.CreateDiagnostic(MessageProvider.ERR_MetadataFileNotAssembly, Location.None, peReference.Display ?? ""));
668Location location,
793out ImmutableArray<Location> referenceDirectiveLocations)
796ArrayBuilder<Location>? referenceDirectiveLocationsBuilder = null;
829referenceDirectiveLocationsBuilder = ArrayBuilder<Location>.GetInstance();
855referenceDirectiveLocations = referenceDirectiveLocationsBuilder?.ToImmutableAndFree() ?? ImmutableArray<Location>.Empty;
868private static PortableExecutableReference? ResolveReferenceDirective(string reference, Location location, TCompilation compilation)
Microsoft.CodeAnalysis.CodeStyle (93)
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (26)
25/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
42Location location,
45IEnumerable<Location>? additionalLocations,
72/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
90Location location,
93ImmutableArray<Location> additionalLocations,
94ImmutableArray<Location> additionalUnnecessaryLocations,
109Location location,
113ImmutableArray<Location> additionalLocations,
114ImmutableArray<Location> additionalUnnecessaryLocations)
136/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
158Location location,
161ImmutableArray<Location> additionalLocations,
162ImmutableArray<Location> additionalUnnecessaryLocations,
179Location location,
183ImmutableArray<Location> additionalLocations,
184ImmutableArray<Location> additionalUnnecessaryLocations,
205Location location,
209IEnumerable<Location> additionalLocations,
240/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
257Location location,
260IEnumerable<Location>? additionalLocations,
Microsoft.CodeAnalysis.CodeStyle.Fixes (30)
Microsoft.CodeAnalysis.CSharp (755)
Binder\Binder_Expressions.cs (16)
1016var elementLocations = ArrayBuilder<Location>.GetInstance(arguments.Count);
1492internal static bool CheckManagedAddr(CSharpCompilation compilation, TypeSymbol type, Location location, BindingDiagnosticBag diagnostics, bool errorForManaged = false)
1502internal static bool CheckManagedAddr(CSharpCompilation compilation, TypeSymbol type, ManagedKind managedKind, Location location, BindingDiagnosticBag diagnostics, bool errorForManaged = false)
2482var location = thisOrBaseToken.GetLocation();
4847Location errorLocation;
4916Location errorLocation,
5055static void validateRecordCopyConstructor(MethodSymbol constructor, NamedTypeSymbol baseType, MethodSymbol resultMember, Location errorLocation, BindingDiagnosticBag diagnostics)
6167Location location = creationSyntax switch
7099Location errorLocation,
7200internal static void ReportConstructorUseSiteDiagnostics(Location errorLocation, BindingDiagnosticBag diagnostics, bool suppressUnsupportedRequiredMembersError, in CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
7295diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 1, 1)));
7299diagnostics.Add(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.Create(node.SyntaxTree, new TextSpan(token.Span.End - 2, 1)));
9133Location location;
10863var location = syntax.Location;
10903Location location = null, SyntaxNode node = null)
10936Location getErrorLocation()
Binder\Binder_Symbols.cs (20)
456diagnostics.Add(info, Location.Create(@delegate.SyntaxTree, TextSpan.FromBounds(@delegate.SpanStart, asterisk.Span.End)));
682var locations = ArrayBuilder<Location>.GetInstance(numElements);
748internal static void ReportMissingTupleElementNamesAttributesIfNeeded(CSharpCompilation compilation, Location location, BindingDiagnosticBag diagnostics)
1662internal static NamedTypeSymbol GetSpecialType(CSharpCompilation compilation, SpecialType typeId, Location location, BindingDiagnosticBag diagnostics)
1759internal static bool ReportUseSite(Symbol symbol, BindingDiagnosticBag diagnostics, Location location)
1777internal NamedTypeSymbol GetWellKnownType(WellKnownType type, BindingDiagnosticBag diagnostics, Location location)
1791internal static NamedTypeSymbol GetWellKnownType(CSharpCompilation compilation, WellKnownType type, BindingDiagnosticBag diagnostics, Location location)
1811internal Symbol GetWellKnownTypeMember(WellKnownMember member, BindingDiagnosticBag diagnostics, Location location = null, SyntaxNode syntax = null, bool isOptional = false)
1820internal static Symbol GetWellKnownTypeMember(CSharpCompilation compilation, WellKnownMember member, BindingDiagnosticBag diagnostics, Location location = null, SyntaxNode syntax = null, bool isOptional = false)
1891Location la = snd.GetFirstLocation();
1892Location lb = fst.GetFirstLocation();
2547var location = where.Location;
2628protected virtual AssemblySymbol GetForwardedToAssemblyInUsingNamespaces(string metadataName, ref NamespaceOrTypeSymbol qualifierOpt, BindingDiagnosticBag diagnostics, Location location)
2633protected AssemblySymbol GetForwardedToAssembly(MetadataTypeName metadataName, BindingDiagnosticBag diagnostics, Location location)
2700protected AssemblySymbol GetForwardedToAssembly(string name, int arity, ref NamespaceOrTypeSymbol qualifierOpt, BindingDiagnosticBag diagnostics, Location location)
2738internal static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, BindingDiagnosticBag diagnostics, Location? location = null)
2744internal static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, BindingDiagnosticBag diagnostics, Location location)
2747private static bool CheckFeatureAvailability(SyntaxNode syntax, MessageID feature, DiagnosticBag? diagnostics, Location? location = null)
2753private static bool CheckFeatureAvailability(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, Location location)
2759private static bool CheckFeatureAvailability<TData>(SyntaxTree tree, MessageID feature, DiagnosticBag? diagnostics, TData data, Func<TData, Location> getLocation, bool forceWarning = false)
Binder\BindingDiagnosticBag.cs (8)
105internal bool ReportUseSite(Symbol? symbol, Location location)
108internal bool ReportUseSite<TData>(Symbol? symbol, Func<TData, Location> getLocation, TData data)
149protected override bool ReportUseSiteDiagnostic(DiagnosticInfo diagnosticInfo, DiagnosticBag diagnosticBag, Location location)
154internal CSDiagnosticInfo Add(ErrorCode code, Location location)
167internal CSDiagnosticInfo Add(ErrorCode code, Location location, params object[] args)
174internal CSDiagnosticInfo Add(ErrorCode code, Location location, ImmutableArray<Symbol> symbols, params object[] args)
176var info = new CSDiagnosticInfo(code, args, symbols, ImmutableArray<Location>.Empty);
181internal void Add(DiagnosticInfo? info, Location location)
Binder\InMethodBinder.cs (5)
146RefKind refKind, TypeSymbol returnType, Location errorLocation, BindingDiagnosticBag diagnostics)
242private static bool ReportConflictWithParameter(Symbol parameter, Symbol newSymbol, string name, Location newLocation, BindingDiagnosticBag diagnostics)
247var oldLocation = parameter.GetFirstLocationOrNone();
248Debug.Assert(oldLocation != newLocation || oldLocation == Location.None || newLocation.SourceTree?.GetRoot().ContainsDiagnostics == true,
322internal override bool EnsureSingleDefinition(Symbol symbol, string name, Location location, BindingDiagnosticBag diagnostics)
Binder\Semantics\OverloadResolution\OverloadResolutionResult.cs (19)
190Location location,
478Location badName = arguments.Names[badArg].GetValueOrDefault().Location;
580private static void ReportUnsupportedMetadata(Location location, BindingDiagnosticBag diagnostics, ImmutableArray<Symbol> symbols, MemberResolutionResult<TMember> firstUnsupported)
595private static void ReportWrongCallingConvention(Location location, BindingDiagnosticBag diagnostics, ImmutableArray<Symbol> symbols, MemberResolutionResult<TMember> firstSupported, MethodSymbol target)
623Location location)
642Location location,
697private bool HadReturnMismatch(Location location, BindingDiagnosticBag diagnostics, TypeSymbol delegateOrFunctionPointerType)
718private bool HadConstraintFailure(Location location, BindingDiagnosticBag diagnostics)
743Location location,
799(string badName, Location location) = arguments.Names[badArg].GetValueOrDefault();
819(string badName, Location location) = arguments.Names[badArg].GetValueOrDefault();
833(string name, Location location) = arguments.Names[result.Result.FirstBadArgument].GetValueOrDefault();
859(string badName, Location location) = arguments.Names[badArg].GetValueOrDefault();
882Location location)
927Location location,
966Location location)
1086Location location,
1389private bool HadAmbiguousWorseMethods(BindingDiagnosticBag diagnostics, ImmutableArray<Symbol> symbols, Location location, bool isQuery, BoundExpression receiver, string name)
1453private bool HadAmbiguousBestMethods(BindingDiagnosticBag diagnostics, ImmutableArray<Symbol> symbols, Location location)
Compilation\CSharpCompilation.cs (21)
530diagnostics.Add(ErrorCode.ERR_DebugEntryPointNotSourceMethodDefinition, Location.None);
1779ImmutableArray<Location>.Empty
2134additionalLocations: viableEntryPoints.Select(m => m.GetFirstLocation()).OfType<Location>().AsImmutable());
2450private ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>? _interceptions;
2452internal void AddInterception(ImmutableArray<byte> contentHash, int position, Location attributeLocation, MethodSymbol interceptor)
2458() => new ConcurrentDictionary<(ImmutableArray<byte> ContentHash, int Position), OneOrMany<(Location AttributeLocation, MethodSymbol Interceptor)>>(comparer: InterceptorKeyComparer.Instance));
2479internal (Location AttributeLocation, MethodSymbol Interceptor)? TryGetInterceptor(SimpleNameSyntax? node)
2977var location = syntaxTree.GetLocation(TextSpan.FromBounds(0, 0));
2996new CSharpRequiredLanguageVersion(MessageID.IDS_FeatureNullableReferenceTypes.RequiredVersion())), Location.None));
3612var location = symbol.GetFirstLocation();
3639foreach ((_, OneOrMany<(Location, MethodSymbol)> interceptionsOfAGivenLocation) in _interceptions)
4139ImmutableArray<Location?> elementLocations,
4165ImmutableArray<Location?> elementLocations,
4194ImmutableArray<Location> memberLocations,
4214var location = memberLocations.IsDefault ? Location.None : memberLocations[i];
4219var descriptor = new AnonymousTypeDescriptor(fields.ToImmutableAndFree(), Location.None);
4541internal override int CompareSourceLocations(Location loc1, Location loc2)
4668internal bool HasDynamicEmitAttributes(BindingDiagnosticBag diagnostics, Location location)
4674internal bool HasTupleNamesAttributes(BindingDiagnosticBag diagnostics, Location location) =>
Emitter\Model\PEAssemblyBuilder.cs (7)
368Compilation.CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes.NullablePublicOnlyAttribute, diagnostics, Location.None))
374Compilation.CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes.RefSafetyRulesAttribute, diagnostics, Location.None))
611Binder.ReportUseSite(result, diagnostics, Location.None);
618Binder.ReportUseSite(result, diagnostics, Location.None);
625Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_AttributeUsageAttribute__ctor, diagnostics, Location.None);
626Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_AttributeUsageAttribute__AllowMultiple, diagnostics, Location.None);
627Binder.GetWellKnownTypeMember(compilation, WellKnownMember.System_AttributeUsageAttribute__Inherited, diagnostics, Location.None);
Errors\CSDiagnosticInfo.cs (7)
20private readonly IReadOnlyList<Location> _additionalLocations;
23: this(code, Array.Empty<object>(), ImmutableArray<Symbol>.Empty, ImmutableArray<Location>.Empty)
28: this(code, args, ImmutableArray<Symbol>.Empty, ImmutableArray<Location>.Empty)
33: this(code, args, symbols, ImmutableArray<Location>.Empty)
37internal CSDiagnosticInfo(ErrorCode code, object[] args, ImmutableArray<Symbol> symbols, ImmutableArray<Location> additionalLocations)
42_additionalLocations = additionalLocations.IsDefaultOrEmpty ? SpecializedCollections.EmptyReadOnlyList<Location>() : additionalLocations;
55public override IReadOnlyList<Location> AdditionalLocations => _additionalLocations;
Errors\DiagnosticBagExtensions.cs (6)
21internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location)
37internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location, params object[] args)
45internal static CSDiagnosticInfo Add(this DiagnosticBag diagnostics, ErrorCode code, Location location, ImmutableArray<Symbol> symbols, params object[] args)
47var info = new CSDiagnosticInfo(code, args, symbols, ImmutableArray<Location>.Empty);
53internal static void Add(this DiagnosticBag diagnostics, DiagnosticInfo info, Location location)
83Location location,
Errors\MessageProvider.cs (6)
87public override Diagnostic CreateDiagnostic(int code, Location location, params object[] args)
89var info = new CSDiagnosticInfo((ErrorCode)code, args, ImmutableArray<Symbol>.Empty, ImmutableArray<Location>.Empty);
95return new CSDiagnostic(info, Location.None);
128Location.None,
205public override void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
212public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
FlowAnalysis\NullableWalker.cs (22)
247/// The delegate is invoked by <see cref="VisitConversion(BoundConversion, BoundExpression, Conversion, TypeWithAnnotations, TypeWithState, bool, bool, bool, AssignmentKind, ParameterSymbol, bool, bool, bool, bool, Optional<LocalState>,bool, Location, ArrayBuilder<VisitResult>)"/>.
643var exitLocation = method is SynthesizedPrimaryConstructor || method.DeclaringSyntaxReferences.IsEmpty ? null : method.TryGetFirstLocation();
704void checkMemberStateOnConstructorExit(MethodSymbol constructor, Symbol member, LocalState state, int thisSlot, Location? exitLocation, ImmutableArray<string> membersWithStateEnforcedByRequiredMembers, bool forcePropertyAnalysis)
1272Location location;
1365var location = syntaxOpt?.GetLocation() ?? methodMainNode.Syntax.GetLastToken().GetLocation();
2364Location? location = null)
2571private void ReportNullabilityMismatchInAssignment(Location location, object sourceType, object destinationType)
2628private void ReportNonSafetyDiagnostic(Location location)
2638private void ReportDiagnostic(ErrorCode errorCode, Location location, params object[] arguments)
8694private void ReportNullabilityMismatchWithTargetDelegate(Location location, TypeSymbol targetType, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool invokedAsExtensionMethod)
8712void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, (TypeSymbol targetType, Location location) arg)
8719void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameter, bool topLevel, (TypeSymbol targetType, Location location) arg)
8728private void ReportNullabilityMismatchWithTargetDelegate(Location location, NamedTypeSymbol delegateType, BoundLambda lambda)
8749location = Location.Create(lambdaSyntax.SyntaxTree, new Text.TextSpan(start, lambdaSyntax.ArrowToken.Span.End - start));
8783void reportBadDelegateReturn(BindingDiagnosticBag bag, MethodSymbol targetInvokeMethod, MethodSymbol sourceInvokeMethod, bool topLevel, Location location)
8790void reportBadDelegateParameter(BindingDiagnosticBag bag, MethodSymbol sourceInvokeMethod, MethodSymbol targetInvokeMethod, ParameterSymbol parameterSymbol, bool topLevel, Location location)
8852Location? diagnosticLocation = null,
9184Location getDiagnosticLocation()
9398Location diagnosticLocation)
9456Location operandLocation = conversionOperand.Syntax.GetLocation();
9617Location diagnosticLocation)
10687private void ReportNullabilityMismatchInArgument(Location argumentLocation, TypeSymbol argumentType, ParameterSymbol? parameterOpt, TypeSymbol parameterType, bool forOutput)
Generated\BoundNodes.xml.Generated.cs (3)
6283public BoundUnconvertedObjectCreationExpression(SyntaxNode syntax, ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder, bool hasErrors = false)
6299public ImmutableArray<(string Name, Location Location)?> ArgumentNamesOpt { get; }
6307public BoundUnconvertedObjectCreationExpression Update(ImmutableArray<BoundExpression> arguments, ImmutableArray<(string Name, Location Location)?> argumentNamesOpt, ImmutableArray<RefKind> argumentRefKindsOpt, InitializerExpressionSyntax? initializerOpt, Binder binder)
Symbols\AliasSymbol.cs (5)
50private readonly ImmutableArray<Location> _locations; // NOTE: can be empty for the "global" alias.
55protected AliasSymbol(string aliasName, Symbol containingSymbol, ImmutableArray<Location> locations, bool isExtern)
70return new AliasSymbolFromResolvedTarget(globalNamespace, "global", globalNamespace, ImmutableArray<Location>.Empty, isExtern: false);
118public override ImmutableArray<Location> Locations
436internal AliasSymbolFromResolvedTarget(NamespaceOrTypeSymbol target, string aliasName, Symbol containingSymbol, ImmutableArray<Location> locations, bool isExtern)
Symbols\AnonymousTypes\SynthesizedSymbols\AnonymousType.PropertySymbol.cs (5)
25private readonly ImmutableArray<Location> _locations;
30this(container, field, fieldTypeWithAnnotations, index, ImmutableArray<Location>.Empty, includeBackingField: true)
35this(container, field, field.TypeWithAnnotations, index, ImmutableArray.Create<Location>(field.Location), includeBackingField: false)
44ImmutableArray<Location> locations,
89public override ImmutableArray<Location> Locations
Symbols\Attributes\AttributeData.cs (8)
81internal abstract Location GetAttributeArgumentLocation(int parameterIndex);
399Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
429Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
445Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
459Location syntaxLocation = GetSecurityAttributeActionSyntaxLocation(nodeOpt, typedValue, out displayString);
470private static Location GetSecurityAttributeActionSyntaxLocation(AttributeSyntax? nodeOpt, TypedConstant typedValue, out object displayString)
535Location argSyntaxLocation = nodeOpt?.GetNamedArgumentSyntax(filePropName)?.Location ?? NoLocation.Singleton;
634Location attributeArgumentSyntaxLocation = this.GetAttributeArgumentLocation(0);
Symbols\Compilation_WellKnownMembers.cs (12)
512private void EnsureEmbeddableAttributeExists(EmbeddableAttributes attribute, BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
528internal void EnsureIsReadOnlyAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
533internal void EnsureRequiresLocationAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
538internal void EnsureParamCollectionAttributeExistsAndModifyCompilation(BindingDiagnosticBag? diagnostics, Location location)
543internal void EnsureIsByRefLikeAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
548internal void EnsureIsUnmanagedAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
553internal void EnsureNullableAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
558internal void EnsureNullableContextAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
563internal void EnsureNativeIntegerAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
569internal void EnsureScopedRefAttributeExists(BindingDiagnosticBag? diagnostics, Location location, bool modifyCompilation)
574internal bool CheckIfAttributeShouldBeEmbedded(EmbeddableAttributes attribute, BindingDiagnosticBag? diagnosticsOpt, Location locationOpt)
665private bool CheckIfAttributeShouldBeEmbedded(BindingDiagnosticBag? diagnosticsOpt, Location? locationOpt, WellKnownType attributeType, WellKnownMember attributeCtor, WellKnownMember? secondAttributeCtor = null)
Symbols\ConstraintsHelper.cs (9)
101Location location = typeParameter.GetFirstLocation();
492Location location,
529public readonly Location Location;
533public CheckConstraintsArgs(CSharpCompilation currentCompilation, ConversionsBase conversions, Location location, BindingDiagnosticBag diagnostics) :
538public CheckConstraintsArgs(CSharpCompilation currentCompilation, ConversionsBase conversions, bool includeNullability, Location location, BindingDiagnosticBag diagnostics) :
543public CheckConstraintsArgs(CSharpCompilation currentCompilation, ConversionsBase conversions, bool includeNullability, Location location, BindingDiagnosticBag diagnostics, CompoundUseSiteInfo<AssemblySymbol> template)
561public static CheckConstraintsArgsBoxed Allocate(CSharpCompilation currentCompilation, ConversionsBase conversions, Location location, BindingDiagnosticBag diagnostics)
569public static CheckConstraintsArgsBoxed Allocate(CSharpCompilation currentCompilation, ConversionsBase conversions, bool includeNullability, Location location, BindingDiagnosticBag diagnostics)
602ImmutableArray<Location> elementLocations,
Symbols\Source\ModifierUtils.cs (7)
21Location errorLocation,
43Location errorLocation,
128private static void ReportPartialError(Location errorLocation, BindingDiagnosticBag diagnostics, SyntaxTokenList? modifierTokens)
148Location errorLocation,
194internal static void ReportUnsupportedModifiersForLanguageVersion(DeclarationModifiers modifiers, DeclarationModifiers unsupportedModifiers, Location errorLocation, BindingDiagnosticBag diagnostics, LanguageVersion availableVersion, LanguageVersion requiredVersion)
211internal static void CheckFeatureAvailabilityForStaticAbstractMembersInInterfacesIfNeeded(DeclarationModifiers mods, bool isExplicitInterfaceImplementation, Location location, BindingDiagnosticBag diagnostics)
460internal static bool CheckAccessibility(DeclarationModifiers modifiers, Symbol symbol, bool isExplicitInterfaceImplementation, BindingDiagnosticBag diagnostics, Location errorLocation)
Symbols\Source\SourceAssemblySymbol.cs (13)
573public override ImmutableArray<Location> Locations
2130ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, string>> result = null;
2194private ConcurrentDictionary<string, ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, string>>> _lazyInternalsVisibleToMap;
2196private static Location GetAssemblyAttributeLocationForDiagnostic(AttributeSyntax attributeSyntaxOpt)
2218diagnostics.Add(useSiteInfo, useSiteInfo.DiagnosticInfo is object ? GetAssemblyAttributeLocationForDiagnostic(arguments.AttributeSyntaxOpt) : Location.None))
2272ref ConcurrentDictionary<string, ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, string>>> lazyInternalsVisibleToMap)
2306new ConcurrentDictionary<string, ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, String>>>(StringComparer.OrdinalIgnoreCase), null);
2313Tuple<Location, string> locationAndValue = null;
2320locationAndValue = new Tuple<Location, string>(GetAssemblyAttributeLocationForDiagnostic(nodeOpt), displayName);
2326ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, string>> keys = null;
2333keys = new ConcurrentDictionary<ImmutableArray<byte>, Tuple<Location, String>>();
2402Location attributeArgumentSyntaxLocation = attribute.GetAttributeArgumentLocation(0);
2415Location attributeArgumentSyntaxLocation = attribute.GetAttributeArgumentLocation(0);
Symbols\Source\SourceConstructorSymbol.cs (4)
27Location location,
86Location location,
123NamedTypeSymbol containingType, ConstructorDeclarationSyntax syntax, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics,
165private void CheckModifiers(MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceDestructorSymbol.cs (5)
23base(containingType, syntax.GetReference(), GetSymbolLocation(syntax, out Location location), isIterator: SyntaxFacts.HasYieldOperations(syntax.Body),
64private static (DeclarationModifiers, Flags) MakeModifiersAndFlags(NamedTypeSymbol containingType, DestructorDeclarationSyntax syntax, bool isNullableAnalysisEnabled, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
75private static Location GetSymbolLocation(DestructorDeclarationSyntax syntax, out Location location)
129private static DeclarationModifiers MakeModifiers(NamedTypeSymbol containingType, SyntaxTokenList modifiers, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
Symbols\Source\SourceMemberContainerSymbol_ImplementationChecks.cs (17)
229var info = new CSDiagnosticInfo(ErrorCode.ERR_MixingWinRTEventWithRegular, args, ImmutableArray<Symbol>.Empty, ImmutableArray.Create<Location>(this.GetFirstLocation()));
328Location location = implementingMember.IsFromCompilation(this.DeclaringCompilation)
342protected abstract Location GetCorrespondingBaseListLocation(NamedTypeSymbol @base);
345private Location GetImplementsLocationOrFallback(NamedTypeSymbol implementedInterface)
350internal Location? GetImplementsLocation(NamedTypeSymbol implementedInterface)
695Location symbolLocation = symbol.TryGetFirstLocation();
757var overridingMemberLocation = overridingMember.GetFirstLocation();
869var overridingMemberLocation = overridingMember.GetFirstLocation();
1046var overridingMemberLocation = overridingProperty.GetFirstLocation();
1147Location overridingMemberLocation,
1205Location symbolLocation = overridingSymbol.TryGetFirstLocation();
1216private static readonly ReportMismatchInReturnType<Location> ReportBadReturn =
1217(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, bool topLevel, Location location)
1223private static readonly ReportMismatchInParameterType<Location> ReportBadParameter =
1224(BindingDiagnosticBag diagnostics, MethodSymbol overriddenMethod, MethodSymbol overridingMethod, ParameterSymbol overridingParameter, bool topLevel, Location location)
1558var hidingMemberLocation = hidingMember.GetFirstLocation();
1639private static bool AddHidingAbstractDiagnostic(Symbol hidingMember, Location hidingMemberLocation, Symbol hiddenMember, BindingDiagnosticBag diagnostics, ref bool suppressAccessors)
Symbols\Source\SourceOrdinaryMethodSymbol.cs (8)
50Location location,
90NamedTypeSymbol containingType, Location location, MethodDeclarationSyntax syntax, MethodKind methodKind,
266protected sealed override Location ReturnTypeLocation => GetSyntax().ReturnType.Location;
424private static DeclarationModifiers MakeDeclarationModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, Location location, DeclarationModifiers allowedModifiers, BindingDiagnosticBag diagnostics)
687private static (DeclarationModifiers mods, bool hasExplicitAccessMod) MakeModifiers(MethodDeclarationSyntax syntax, NamedTypeSymbol containingType, MethodKind methodKind, bool hasBody, Location location, BindingDiagnosticBag diagnostics)
793private void CheckModifiers(bool isExplicitInterfaceImplementation, Location location, BindingDiagnosticBag diagnostics)
920Location location,
978Location location,
Symbols\Source\SourcePropertyAccessorSymbol.cs (7)
90Location location,
116Location location,
143Location location,
177Location location,
223NamedTypeSymbol containingType, SourcePropertySymbolBase property, DeclarationModifiers propertyModifiers, Location location,
493bool hasBody, Location location, BindingDiagnosticBag diagnostics, out bool modifierErrors)
524private void CheckModifiers(Location location, bool hasBody, bool isAutoPropertyOrExpressionBodied, BindingDiagnosticBag diagnostics)
Symbols\Source\SourceTypeParameterSymbol.cs (7)
26private readonly ImmutableArray<Location> _locations;
34protected SourceTypeParameterSymbolBase(string name, int ordinal, ImmutableArray<Location> locations, ImmutableArray<SyntaxReference> syntaxRefs)
44public override ImmutableArray<Location> Locations
316Location getLocation() => this.GetNonNullSyntaxNode().Location;
464public SourceTypeParameterSymbol(SourceNamedTypeSymbol owner, string name, int ordinal, VarianceKind varianceKind, ImmutableArray<Location> locations, ImmutableArray<SyntaxReference> syntaxRefs)
609public SourceMethodTypeParameterSymbol(SourceMethodSymbol owner, string name, int ordinal, ImmutableArray<Location> locations, ImmutableArray<SyntaxReference> syntaxRefs)
870public SourceOverridingMethodTypeParameterSymbol(OverriddenMethodTypeParameterMapBase map, string name, int ordinal, ImmutableArray<Location> locations, ImmutableArray<SyntaxReference> syntaxRefs)
Symbols\Source\SourceUserDefinedOperatorSymbolBase.cs (4)
29Location location,
125protected static DeclarationModifiers MakeDeclarationModifiers(MethodKind methodKind, bool inInterface, BaseMethodDeclarationSyntax syntax, Location location, BindingDiagnosticBag diagnostics)
207static void reportModifierIfPresent(DeclarationModifiers result, DeclarationModifiers errorModifier, Location location, BindingDiagnosticBag diagnostics, CSharpRequiredLanguageVersion requiredVersionArgument, string availableVersionArgument)
729var location = this.GetFirstLocation();
Symbols\Synthesized\SynthesizedHotReloadExceptionConstructorSymbol.cs (1)
47Location.None,
Symbols\Tuples\TupleTypeSymbol.cs (21)
31Location? locationOpt,
33ImmutableArray<Location?> elementLocations,
61var locations = locationOpt is null ? ImmutableArray<Location>.Empty : ImmutableArray.Create(locationOpt);
104ImmutableArray<Location?> elementLocations = default,
105ImmutableArray<Location> locations = default)
162ImmutableArray<Location?> newElementLocations,
164ImmutableArray<Location> locations)
504diagnostics.Add(useSiteInfo, static syntax => syntax?.Location ?? Location.None, syntax);
556private ImmutableArray<Location?> TupleElementLocations
626ImmutableArray<Location> locations = getElementLocations(in elementLocations, tupleFieldIndex);
748var location = elementLocations.IsDefault ? null : elementLocations[i];
842static ImmutableArray<Location> getElementLocations(in ImmutableArray<Location?> elementLocations, int tupleFieldIndex)
846return ImmutableArray<Location>.Empty;
849var elementLocation = elementLocations[tupleFieldIndex];
850return elementLocation == null ? ImmutableArray<Location>.Empty : ImmutableArray.Create(elementLocation);
895internal ImmutableArray<Location?> ElementLocations { get; }
904internal ImmutableArray<Location> Locations { get; }
927Locations = ImmutableArray<Location>.Empty;
931ImmutableArray<Location?> elementLocations, ImmutableArray<bool> errorPositions, ImmutableArray<Location> locations)
Microsoft.CodeAnalysis.CSharp.CodeStyle (48)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (23)
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (6)
CommandLineTests.cs (6)
12577new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_LowercaseEllSuffix), Location.None).GetMessage(CultureInfo.InvariantCulture),
12617new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_EmptySwitch), Location.None).GetMessage(CultureInfo.InvariantCulture),
12673new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_UnreferencedField, "C.f"), Location.None).GetMessage(CultureInfo.InvariantCulture),
12741new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_PrecedenceInversion, "from"), Location.None).GetMessage(CultureInfo.InvariantCulture),
12841new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_SequentialOnPartialClass, "MyPartialStruct"), Location.None).GetMessage(CultureInfo.InvariantCulture),
12951new CSDiagnostic(new CSDiagnosticInfo(ErrorCode.WRN_SequentialOnPartialClass, "MyPartialStruct"), Location.None).GetMessage(CultureInfo.InvariantCulture),
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (18)
CodeGen\CodeGenTupleTest.cs (18)
5799var loc1 = Location.Create(tree, new TextSpan(0, 1));
5910var loc1 = Location.Create(tree, new TextSpan(0, 1));
5911var loc2 = Location.Create(tree, new TextSpan(1, 1));
6351var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1));
6387var loc1 = Location.Create(syntaxTree, new TextSpan(0, 1));
6388var loc2 = Location.Create(syntaxTree, new TextSpan(1, 1));
6651tuple2 = comp.CreateTupleTypeSymbol(underlyingType, default(ImmutableArray<string>), default(ImmutableArray<Location>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>));
6693tuple2 = comp.CreateTupleTypeSymbol(underlyingType, default(ImmutableArray<string>), default(ImmutableArray<Location>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>));
6731tuple2 = comp.CreateTupleTypeSymbol(elementTypes, default(ImmutableArray<string>), default(ImmutableArray<Location>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>));
6772tuple2 = comp.CreateTupleTypeSymbol(elementTypes, default(ImmutableArray<string>), default(ImmutableArray<Location>), default(ImmutableArray<CodeAnalysis.NullableAnnotation>));
28996elementLocations: ImmutableArray.Create<Location>(null, null, null, null, null, null, null, null, null),
29014elementLocations: ImmutableArray.Create<Location>(null, null, null, null, null, null, null, null, null),
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (18)
Diagnostics\DiagnosticAnalyzerTests.cs (17)
308var noneDiag = CodeAnalysis.Diagnostic.Create(noneDiagDescriptor, Location.None);
309var infoDiag = CodeAnalysis.Diagnostic.Create(infoDiagDescriptor, Location.None);
310var warningDiag = CodeAnalysis.Diagnostic.Create(warningDiagDescriptor, Location.None);
311var errorDiag = CodeAnalysis.Diagnostic.Create(errorDiagDescriptor, Location.None);
392var noneDiag = Microsoft.CodeAnalysis.Diagnostic.Create(noneDiagDescriptor, Location.None);
393var infoDiag = Microsoft.CodeAnalysis.Diagnostic.Create(infoDiagDescriptor, Location.None);
394var warningDiag = Microsoft.CodeAnalysis.Diagnostic.Create(warningDiagDescriptor, Location.None);
395var errorDiag = Microsoft.CodeAnalysis.Diagnostic.Create(errorDiagDescriptor, Location.None);
445var disabledDiag = CodeAnalysis.Diagnostic.Create(disabledDiagDescriptor, Location.None);
446var enabledDiag = CodeAnalysis.Diagnostic.Create(enabledDiagDescriptor, Location.None);
784context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor1, Location.None));
799registerSyntaxNodeAction(context => { context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor2, Location.None)); },
802registerSyntaxNodeAction(context => { context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(Descriptor3, Location.None)); },
821context.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(descriptor, Location.None));
895compilationContext.ReportDiagnostic(CodeAnalysis.Diagnostic.Create(UnsupportedDescriptor, Location.None));
2336var diagnostic = CodeAnalysis.Diagnostic.Create(Summary, Location.None, sortedCallbackEntityNames.Join(","));
2351private void ReportDiagnosticsCore(Action<Diagnostic> addDiagnostic, Location location, params object[] messageArguments)
Microsoft.CodeAnalysis.CSharp.Features (77)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (23)
SourceGeneration\GeneratorDriverTests.cs (23)
434var diagnostic = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic, Location.None);
666var diagnostic1 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic1, Location.None);
667var diagnostic2 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic2, Location.None);
668var diagnostic3 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic3, Location.None);
713var diagnostic1 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic1, Location.None);
714var diagnostic2 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic2, Location.None);
715var diagnostic3 = Microsoft.CodeAnalysis.Diagnostic.Create(generatorDiagnostic3, Location.None);
1271c.ReportDiagnostic(d.WithLocation(Location.Create(c.Compilation.SyntaxTrees.First(), l)));
1360return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, end)));
3626location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2))));
3659location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)),
3660additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) }));
3690location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2))));
3720location: Location.Create(validSyntaxTree, TextSpan.FromBounds(0, 2)),
3721additionalLocations: new[] { Location.Create(invalidSyntaxTree, TextSpan.FromBounds(0, 2)) }));
3752location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100))));
3784location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)),
3785additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) }));
3815location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 100))));
3844location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2)),
3845additionalLocations: new[] { Location.Create(syntaxTree, TextSpan.FromBounds(0, 100)) }));
3876location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2))));
3906location: Location.Create(syntaxTree, TextSpan.FromBounds(0, 2))));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (17)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (25)
Diagnostics\LocationsTests.cs (8)
91Location locX = new SourceLocation(syntaxTree, xSpan);
92Location locXToCloseBrace = new SourceLocation(syntaxTree, xToCloseBraceSpan);
504Location location = Location.Create("test.txt", new TextSpan(), new LinePositionSpan(new LinePosition(2, 1), new LinePosition(3, 1)));
519Location locationWithoutMapping = Location.Create(filePath, sourceSpan, lineSpan);
520Location locationWithMapping = Location.Create(filePath, sourceSpan, lineSpan, mappedFilePath, mappedLineSpan);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (2)
Microsoft.CodeAnalysis.CSharp.Workspaces (20)
Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests (5)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (7)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (3)
163var documentDiagnostic = CodeAnalysis.Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), ["doc", "error 1"]);
164var projectDiagnostic = CodeAnalysis.Diagnostic.Create(diagnosticDescriptor1, Location.None, ["proj", "error 2"]);
165var syntaxError = CodeAnalysis.Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), ["doc", "syntax error 3"]);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (3)
Microsoft.CodeAnalysis.EditorFeatures2.UnitTests (7)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (3)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp (1)
Microsoft.CodeAnalysis.Features (156)
EditAndContinue\EditSession.cs (6)
140return Diagnostic.Create(descriptor, Location.None);
171await foreach (var location in CreateChangedLocationsAsync(oldProject, newProject, documentAnalyses, cancellationToken).ConfigureAwait(false))
179private static async IAsyncEnumerable<Location> CreateChangedLocationsAsync(Project oldProject, Project newProject, ImmutableArray<DocumentAnalysisResults> documentAnalyses, [EnumeratorCancellation] CancellationToken cancellationToken)
202yield return Location.Create(newTree, GetFirstLineDifferenceSpan(oldText, newText));
208yield return Location.None;
546documentDiagnostics.Add(Diagnostic.Create(descriptor, Location.Create(newDocument.FilePath!, textSpan: default, lineSpan: default), [newDocument.FilePath]));
src\Analyzers\Core\Analyzers\Helpers\DiagnosticHelper.cs (26)
25/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
42Location location,
45IEnumerable<Location>? additionalLocations,
72/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
90Location location,
93ImmutableArray<Location> additionalLocations,
94ImmutableArray<Location> additionalUnnecessaryLocations,
109Location location,
113ImmutableArray<Location> additionalLocations,
114ImmutableArray<Location> additionalUnnecessaryLocations)
136/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
158Location location,
161ImmutableArray<Location> additionalLocations,
162ImmutableArray<Location> additionalUnnecessaryLocations,
179Location location,
183ImmutableArray<Location> additionalLocations,
184ImmutableArray<Location> additionalUnnecessaryLocations,
205Location location,
209IEnumerable<Location> additionalLocations,
240/// <param name="location">An optional primary location of the diagnostic. If null, <see cref="Location"/> will return <see cref="Location.None"/>.</param>
257Location location,
260IEnumerable<Location>? additionalLocations,
Microsoft.CodeAnalysis.Features.UnitTests (5)
EditAndContinue\RemoteEditAndContinueServiceTests.cs (4)
121var diagnostic = Diagnostic.Create(diagnosticDescriptor, Location.Create(syntaxTree, TextSpan.FromBounds(1, 1)));
199var documentDiagnostic = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "some error" });
200var projectDiagnostic = Diagnostic.Create(diagnosticDescriptor1, Location.None, new[] { "proj", "some error" });
201var syntaxError = Diagnostic.Create(diagnosticDescriptor1, Location.Create(syntaxTree, TextSpan.FromBounds(1, 2)), new[] { "doc", "syntax error" });
Microsoft.CodeAnalysis.LanguageServer.Protocol (3)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (5)
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Microsoft.CodeAnalysis.Remote.Workspaces (1)
Microsoft.CodeAnalysis.Scripting (1)
Microsoft.CodeAnalysis.Test.Utilities (37)
Diagnostics\CommonDiagnosticAnalyzers.cs (29)
71var location = context.Tree.GetRoot().GetLocation();
77context.ReportDiagnostic(Diagnostic.Create(Descriptor2, Location.None, s_properties)));
564compilationContext.ReportDiagnostic(Diagnostic.Create(EnabledRule, Location.None));
567compilationContext.ReportDiagnostic(Diagnostic.Create(DisabledRule, Location.None));
825compilationContext.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.None)));
856compilationContext.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.None)));
877compilationContext.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.None)));
918private readonly Location _invalidLocation;
953Diagnostic.Create(Descriptor, Location.None, additionalLocations: new[] { _invalidLocation }) :
1261private void ReportDiagnostic(Action<Diagnostic> addDiagnostic, Location location)
1653var diagnostic = Diagnostic.Create(rule, Location.None, args);
1668private void ReportDiagnosticsCore(Action<Diagnostic> addDiagnostic, Location location, params object[] messageArguments)
1804foreach (var location in symbolContext.Symbol.Locations)
1823var diagnostic = Diagnostic.Create(descriptor, Location.None, treeContext.Tree.FilePath);
1827diagnostic = Diagnostic.Create(UniqueTextFileDescriptor, Location.None, treeContext.Tree.FilePath);
1838var diagnostic = Diagnostic.Create(NumberOfUniqueTextFileDescriptor, Location.None, _textCallbackSet.Count);
2034compilationEndContext.ReportDiagnostic(Diagnostic.Create(SymbolStartedEndedDifferRule, Location.None, symbolsStartedStr, symbolsEndedStr, _analyzerId));
2049diagnostics.Add(Diagnostic.Create(DuplicateStartActionRule, Location.None, symbolStartContext.Symbol.Name, _analyzerId));
2059diagnostics.Add(Diagnostic.Create(DuplicateEndActionRule, Location.None, symbolEndContext.Symbol.Name, _analyzerId));
2064symbolEndContext.ReportDiagnostic(Diagnostic.Create(rule, Location.None, symbolStartContext.Symbol.Name, _analyzerId));
2074operationContext.ReportDiagnostic(Diagnostic.Create(OperationRule, Location.None, symbolStartContext.Symbol.Name, operationContext.ContainingSymbol.Name, operationContext.Operation.Syntax.ToString(), _analyzerId));
2110diagnostics.Add(Diagnostic.Create(SymbolStartedOrderingRule, Location.None, member, symbolStarted, _analyzerId));
2134diagnostics.Add(Diagnostic.Create(SymbolEndedOrderingRule, Location.None, container, symbolEnded, _analyzerId));
2149diagnostics.Add(Diagnostic.Create(OperationOrderingRule, Location.None, symbolStartContext.Symbol, operationContext.Operation.Syntax.ToString(), _analyzerId));
2455Diagnostic.Create(_rule, Location.None, GetSortedSymbolCallbacksString())));
2486compilationContext.ReportDiagnostic(Diagnostic.Create(Descriptor, Location.None)));
2660var location = Location.Create(context.AdditionalFile.Path, _diagnosticSpan, text.Lines.GetLinePositionSpan(_diagnosticSpan));
2951private void HandleCallback(Location analysisLocation, Compilation compilation, Action<Diagnostic> reportDiagnostic, CancellationToken cancellationToken)
Mocks\TestMessageProvider.cs (3)
21public override Diagnostic CreateDiagnostic(int code, Location location, params object[] args)
258public override void ReportDuplicateMetadataReferenceStrong(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
263public override void ReportDuplicateMetadataReferenceWeak(DiagnosticBag diagnostics, Location location, MetadataReference reference, AssemblyIdentity identity, MetadataReference equivalentReference, AssemblyIdentity equivalentIdentity)
Microsoft.CodeAnalysis.UnitTests (10)
Microsoft.CodeAnalysis.VisualBasic (479)
Binding\Binder.vb (9)
659Public Function GetLocation(span As TextSpan) As Location
881Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, location As Location, id As ERRID)
885Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, location As Location, id As ERRID, ParamArray args As Object())
889Public Shared Sub ReportDiagnostic(diagBag As DiagnosticBag, location As Location, info As DiagnosticInfo)
911Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, location As Location, id As ERRID)
915Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, location As Location, id As ERRID, ParamArray args As Object())
919Public Shared Sub ReportDiagnostic(diagBag As BindingDiagnosticBag, location As Location, info As DiagnosticInfo)
932Public Shared Function ReportUseSite(diagBag As BindingDiagnosticBag, location As Location, useSiteInfo As UseSiteInfo(Of AssemblySymbol)) As Boolean
1104location As Location,
Binding\Binder_Query.vb (6)
1961ReportDiagnostic(diagnostics, Location.Create(groupBy.SyntaxTree, GetGroupByOperatorNameSpan(groupBy)), ERRID.ERR_QueryOperatorNotFound, StringConstants.GroupByMethod)
2000ReportDiagnostic(diagnostics, Location.Create(groupBy.SyntaxTree, GetGroupByOperatorNameSpan(groupBy)), ERRID.ERR_QueryOperatorNotFound, StringConstants.GroupByMethod)
2040Location.Create(groupJoin.SyntaxTree, GetQueryOperatorNameSpan(groupJoin.GroupKeyword, groupJoin.JoinKeyword)),
2076Location.Create(groupJoin.SyntaxTree, GetQueryOperatorNameSpan(groupJoin.GroupKeyword, groupJoin.JoinKeyword)),
4664diagnosticLocationOpt:=Location.Create(node.SyntaxTree, operatorNameLocation))
4716ReportDiagnostic(diagnostics, Location.Create(node.SyntaxTree, operatorNameLocation), ERRID.ERR_QueryOperatorNotFound, operatorName)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (13)
40Private _inProgressIncludeElementNodes As HashSet(Of Location)
442Dim location As location = GetIncludeElementLocation(includeElement, currentXmlFilePath, originatingSyntax)
546Private Function ShouldProcessLocation(loc As Location) As Boolean
552Private Function GenerateDiagnostic(suppressDiagnostic As Boolean, loc As Location, id As ERRID, ParamArray arguments As Object()) As String
560Private Function GenerateDiagnostic(loc As Location, id As ERRID, ParamArray arguments As Object()) As String
564Private Function AddIncludeElementLocation(location As Location) As Boolean
566Me._inProgressIncludeElementNodes = New HashSet(Of location)()
572Private Function RemoveIncludeElementLocation(location As Location) As Boolean
579Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
580Dim location As location = includeElement.Annotation(Of location)()
713Private Sub ProcessErrorLocations(currentXmlLocation As XmlLocation, referenceName As String, useSiteInfo As CompoundUseSiteInfo(Of AssemblySymbol), errorLocations As ImmutableArray(Of Location), errid As Nullable(Of ERRID))
767Dim loc As Location = XmlLocation.Create(attribute, currentXmlFilePath)
Errors\MessageProvider.vb (7)
88Public Overrides Function CreateDiagnostic(code As Integer, location As Location, ParamArray args() As Object) As Diagnostic
93Return New VBDiagnostic(info, Location.None)
121Location.None,
386Public Overrides Sub ReportDuplicateMetadataReferenceStrong(diagnostics As DiagnosticBag, location As Location, reference As MetadataReference, identity As AssemblyIdentity, equivalentReference As MetadataReference, equivalentIdentity As AssemblyIdentity)
388DirectCast(location, Location),
393Public Overrides Sub ReportDuplicateMetadataReferenceWeak(diagnostics As DiagnosticBag, location As Location, reference As MetadataReference, identity As AssemblyIdentity, equivalentReference As MetadataReference, equivalentIdentity As AssemblyIdentity)
395DirectCast(location, Location),
Symbols\Attributes\AttributeData.vb (12)
252Friend Shared Function GetArgumentLocation(nodeOpt As AttributeSyntax, argumentIndex As Integer) As Location
256Private Shared Function GetArgumentDisplayAndLocation(nodeOpt As AttributeSyntax, value As Integer, argumentIndex As Integer) As (ArgumentDisplay As String, Location As Location)
269Friend Shared Function GetFirstArgumentLocation(nodeOpt As AttributeSyntax) As Location
273Private Shared Function GetFirstArgumentDisplayAndLocation(nodeOpt As AttributeSyntax, value As Integer) As (ArgumentDisplay As String, Location As Location)
296Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction)
325Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction)
337Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction)
348Dim displayAndLocation As (ArgumentDisplay As String, Location As Location) = GetFirstArgumentDisplayAndLocation(nodeOpt, securityAction)
396Dim argSyntaxLocation As Location = If(arguments.AttributeSyntaxOpt IsNot Nothing,
448Dim location As Location = GetFirstArgumentLocation(nodeOpt)
456Dim location As Location = GetFirstArgumentLocation(node)
498Dim location As Location = GetFirstArgumentLocation(nodeOpt)
Symbols\Source\SourceAssemblySymbol.vb (10)
74Private _lazyInternalsVisibleToMap As ConcurrentDictionary(Of String, ConcurrentDictionary(Of ImmutableArray(Of Byte), Tuple(Of Location, String)))
818Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
914Dim result As ConcurrentDictionary(Of ImmutableArray(Of Byte), Tuple(Of Location, String)) = Nothing
984New ConcurrentDictionary(Of String, ConcurrentDictionary(Of ImmutableArray(Of Byte), Tuple(Of Location, String)))(StringComparer.OrdinalIgnoreCase), Nothing)
991Dim locationAndValue As Tuple(Of Location, String) = Nothing
997locationAndValue = New Tuple(Of Location, String)(If(nodeOpt IsNot Nothing, nodeOpt.GetLocation(), NoLocation.Singleton), displayName)
1003Dim keys As ConcurrentDictionary(Of ImmutableArray(Of Byte), Tuple(Of Location, String)) = Nothing
1007keys = New ConcurrentDictionary(Of ImmutableArray(Of Byte), Tuple(Of Location, String))
1045Dim attributeArgumentSyntaxLocation As Location = GetAssemblyAttributeFirstArgumentLocation(arguments.AttributeSyntaxOpt)
1162Private Shared Function GetAssemblyAttributeFirstArgumentLocation(attributeSyntaxOpt As AttributeSyntax) As Location
Symbols\Source\SourceMemberContainerTypeSymbol.vb (22)
120Dim bestLocation As Location = best.Location
482Private Function GetImplementsLocation(implementedInterface As NamedTypeSymbol, ByRef directInterface As NamedTypeSymbol) As Location
502Private Function GetImplementsLocation(implementedInterface As NamedTypeSymbol) As Location
507Protected MustOverride Function GetInheritsOrImplementsLocation(base As NamedTypeSymbol, getInherits As Boolean) As Location
540location As Location,
971Dim location As Location
1014Dim location As Location
1045Dim location As Location = param.Locations(0)
1085Dim location As Location
1121Dim location As Location
1376Public NotOverridable Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
1786Dim bestPartialMethodLocation As Location = bestPartialMethod.NonMergedLocation
1791Dim bestImplLocation As Location = Nothing
1802Dim candidateLocation As Location = candidate.NonMergedLocation
1896implMethodLocation As Location,
2319Private Sub CheckDefaultPropertyAgainstAllBases(namedType As NamedTypeSymbol, defaultPropertyName As String, location As Location, diagBag As BindingDiagnosticBag)
2331Private Sub CheckDefaultPropertyAgainstBase(defaultPropertyName As String, baseType As NamedTypeSymbol, location As Location, diagBag As BindingDiagnosticBag)
3840Private Sub ReportOverloadsErrors(comparisonResults As SymbolComparisonResults, firstMember As Symbol, secondMember As Symbol, location As Location, diagnostics As BindingDiagnosticBag)
3905Dim location1, location2 As Location
3955Dim location1, location2 As Location
3987Dim location1 As Location = GetImplementsLocation(interface1, directInterface1)
3988Dim location2 As Location = GetImplementsLocation(interface2, directInterface2)
Symbols\SynthesizedSymbols\SynthesizedHotReloadExceptionConstructorSymbol.vb (1)
72Location.None,
Symbols\Tuples\TupleTypeSymbol.vb (21)
19Private ReadOnly _locations As ImmutableArray(Of Location)
21Private ReadOnly _elementLocations As ImmutableArray(Of Location)
158Public Overrides ReadOnly Property Locations As ImmutableArray(Of Location)
332Private Sub New(locationOpt As Location, underlyingType As NamedTypeSymbol, elementLocations As ImmutableArray(Of Location),
336Me.New(If((locationOpt Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(locationOpt)),
340Private Sub New(locations As ImmutableArray(Of Location), underlyingType As NamedTypeSymbol,
341elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String),
360locationOpt As Location,
362elementLocations As ImmutableArray(Of Location),
392Return TupleTypeSymbol.Create(ImmutableArray(Of Location).Empty, tupleCompatibleType, Nothing, Nothing, Nothing)
396Return TupleTypeSymbol.Create(ImmutableArray(Of Location).Empty, tupleCompatibleType, Nothing, elementNames, errorPositions:=Nothing)
399Public Shared Function Create(locationOpt As Location, tupleCompatibleType As NamedTypeSymbol,
400elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String),
403Return TupleTypeSymbol.Create(If((locationOpt Is Nothing), ImmutableArray(Of Location).Empty, ImmutableArray.Create(Of Location)(locationOpt)),
407Public Shared Function Create(locations As ImmutableArray(Of Location), tupleCompatibleType As NamedTypeSymbol,
408elementLocations As ImmutableArray(Of Location), elementNames As ImmutableArray(Of String),
447Dim extensionTuple As TupleTypeSymbol = TupleTypeSymbol.Create(CType(Nothing, Location), tupleCompatibleType, Nothing, Nothing, Nothing)
497Return New TupleTypeSymbol(CType(Nothing, Location), Me._underlyingType, Nothing, newElementNames, Me._elementTypes, Nothing)
Microsoft.CodeAnalysis.VisualBasic.CodeStyle (6)
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (6)
CodeGen\CodeGenTuples.vb (5)
6872Dim loc1 = Location.Create(tree, New TextSpan(0, 1))
6921Dim loc1 = Location.Create(tree, New TextSpan(0, 1))
6922Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
7270Dim loc1 = Location.Create(tree, New TextSpan(0, 1))
7271Dim loc2 = Location.Create(tree, New TextSpan(1, 1))
Microsoft.CodeAnalysis.VisualBasic.ExpressionCompiler (24)
Microsoft.CodeAnalysis.VisualBasic.Features (8)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (34)
Diagnostics\DiagnosticAnalyzerTests.vb (11)
54Dim noneDiag = Microsoft.CodeAnalysis.Diagnostic.Create(noneDiagDescriptor, Location.None)
55Dim infoDiag = Microsoft.CodeAnalysis.Diagnostic.Create(infoDiagDescriptor, Location.None)
56Dim warningDiag = Microsoft.CodeAnalysis.Diagnostic.Create(warningDiagDescriptor, Location.None)
57Dim errorDiag = Microsoft.CodeAnalysis.Diagnostic.Create(errorDiagDescriptor, Location.None)
135Dim noneDiag = Microsoft.CodeAnalysis.Diagnostic.Create(noneDiagDescriptor, Location.None)
136Dim infoDiag = Microsoft.CodeAnalysis.Diagnostic.Create(infoDiagDescriptor, Location.None)
137Dim warningDiag = Microsoft.CodeAnalysis.Diagnostic.Create(warningDiagDescriptor, Location.None)
138Dim errorDiag = Microsoft.CodeAnalysis.Diagnostic.Create(errorDiagDescriptor, Location.None)
188Dim disabledDiag = CodeAnalysis.Diagnostic.Create(disabledDiagDescriptor, Location.None)
189Dim enabledDiag = CodeAnalysis.Diagnostic.Create(enabledDiagDescriptor, Location.None)
361Dim location As Location = Nothing
SourceGeneration\GeneratorDriverTests.vb (15)
312location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4))))
343location:=Location.Create(validSyntaxTree, TextSpan.FromBounds(2, 4)),
344additionalLocations:={Location.Create(invalidSyntaxTree, TextSpan.FromBounds(2, 4))}))
374location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4))))
404location:=Location.Create(validSyntaxTree, TextSpan.FromBounds(2, 4)),
405additionalLocations:={Location.Create(invalidSyntaxTree, TextSpan.FromBounds(2, 4))}))
434location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))))
464location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)),
465additionalLocations:={Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))}))
495location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))))
524location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4)),
525additionalLocations:={Location.Create(syntaxTree, TextSpan.FromBounds(2, 100))}))
554location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4))))
584location:=Location.Create(syntaxTree, TextSpan.FromBounds(2, 4))))
703Return x.Diagnostic.WithLocation(Location.Create(syntaxTree, TextSpan.FromBounds(start, endpoint)))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (9)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (10)
Microsoft.CodeAnalysis.VisualBasic.Workspaces (13)
Microsoft.CodeAnalysis.Workspaces (146)
FindSymbols\ReferenceLocation.cs (10)
32public Location Location { get; }
60/// Otherwise, <see cref="Location.None"/>.
62internal Location ContainingStringLocation { get; }
69Location location,
74Location containingStringLocation)
89internal ReferenceLocation(Document document, IAliasSymbol? alias, Location location, bool isImplicit, SymbolUsageInfo symbolUsageInfo, ImmutableArray<(string key, string value)> additionalProperties, CandidateReason candidateReason)
90: this(document, alias, location, isImplicit, symbolUsageInfo, additionalProperties, candidateReason, containingStringLocation: Location.None)
98internal ReferenceLocation(Document document, Location location, Location containingStringLocation)
117EqualityComparer<Location>.Default.Equals(this.Location, other.Location) &&
Rename\ConflictEngine\ConflictResolver.cs (13)
101var renameSymbolDeclarationLocation = renameLocations.Symbol.Locations.Where(loc => loc.IsInSource).FirstOrDefault();
116Location renameSymbolDeclarationLocation,
180Location originalDeclarationLocation,
189foreach (var implicitUsageConflict in implicitUsageConflicts)
213foreach (var implicitConflict in implicitConflicts)
233IDictionary<Location, Location> reverseMappedLocations,
325private static void AddConflictingSymbolLocations(IEnumerable<ISymbol> conflictingSymbols, MutableConflictResolution conflictResolution, IDictionary<Location, Location> reverseMappedLocations)
329foreach (var newLocation in newSymbol.Locations)
333if (reverseMappedLocations.TryGetValue(newLocation, out var oldLocation))
368var location = GetSymbolLocation(solution, symbol, cancellationToken);
401private static Location? GetSymbolLocation(Solution solution, ISymbol symbol, CancellationToken cancellationToken)
Rename\IRenameRewriterLanguageService.cs (13)
52Task<ImmutableArray<Location>> ComputeDeclarationConflictsAsync(
59IDictionary<Location, Location> reverseMappedLocations,
70Task<ImmutableArray<Location>> ComputeImplicitReferenceConflictsAsync(
85ImmutableArray<Location> ComputePossibleImplicitUsageConflicts(
88Location originalDeclarationLocation,
126public abstract Task<ImmutableArray<Location>> ComputeDeclarationConflictsAsync(string replacementText, ISymbol renamedSymbol, ISymbol renameSymbol, IEnumerable<ISymbol> referencedSymbols, Solution baseSolution, Solution newSolution, IDictionary<Location, Location> reverseMappedLocations, CancellationToken cancellationToken);
127public abstract Task<ImmutableArray<Location>> ComputeImplicitReferenceConflictsAsync(ISymbol renameSymbol, ISymbol renamedSymbol, IEnumerable<ReferenceLocation> implicitReferenceLocations, CancellationToken cancellationToken);
128public abstract ImmutableArray<Location> ComputePossibleImplicitUsageConflicts(ISymbol renamedSymbol, SemanticModel semanticModel, Location originalDeclarationLocation, int newDeclarationLocationStartingPosition, CancellationToken cancellationToken);
135IEnumerable<ISymbol> properties, string newPropertyName, ArrayBuilder<Location> conflicts)
Microsoft.CodeAnalysis.Workspaces.UnitTests (2)
Microsoft.DotNet.CodeAnalysis (1)
Microsoft.Extensions.Logging.Generators (1)
Microsoft.Extensions.Options.SourceGeneration (12)
Parser.cs (11)
100Location? modelTypeLocation = modelType.GetLocation();
101Location lowerLocationInCompilation = modelTypeLocation is not null && modelTypeLocation.SourceTree is not null && _compilation.ContainsSyntaxTree(modelTypeLocation.SourceTree)
266private List<ValidatedMember> GetMembersToValidate(ITypeSymbol modelType, bool speculate, Location lowerLocationInCompilation, ITypeSymbol validatorType)
295Location? memberLocation = member.GetLocation();
296Location location = memberLocation is not null && memberLocation.SourceTree is not null && _compilation.ContainsSyntaxTree(memberLocation.SourceTree)
316private ValidatedMember? GetMemberInfo(ISymbol member, bool speculate, Location location, ITypeSymbol modelType, ITypeSymbol validatorType)
353var attrLoc = attribute.ApplicationSyntaxReference?.GetSyntax().GetLocation();
598private bool LengthBasedAttributeIsTrackedForSubstitution(ITypeSymbol memberType, Location location, ITypeSymbol attributeType, ref string attributeFullQualifiedName)
684private string? AddSynthesizedValidator(ITypeSymbol modelType, ISymbol member, Location location, ITypeSymbol validatorType)
865private void Diag(DiagnosticDescriptor desc, Location? location) =>
868private void Diag(DiagnosticDescriptor desc, Location? location, params object?[]? messageArgs) =>
Microsoft.Gen.ComplianceReports.Unit.Tests (3)
Microsoft.Gen.ContextualOptions.Unit.Tests (3)
Microsoft.Gen.Logging (8)
Parsing\Parser.cs (5)
37Action<DiagnosticDescriptor, Location?, object?[]?> diagReport = Diag; // Keeping one instance of the delegate
78var attrLoc = GetLoggerMessageAttribute(method, sm, symbols);
366(LoggingMethod lm, bool keepMethod) ProcessMethod(MethodDeclarationSyntax method, IMethodSymbol methodSymbol, Location attrLoc)
603private Location? GetLoggerMessageAttribute(MethodDeclarationSyntax methodSyntax, SemanticModel sm, SymbolHolder symbols)
744private void Diag(DiagnosticDescriptor desc, Location? location, params object?[]? messageArgs)
Microsoft.Gen.Logging.Unit.Tests (11)
Microsoft.Gen.Metrics (3)
Microsoft.Gen.Metrics.Unit.Tests (3)
Microsoft.Gen.MetricsReports (3)
Microsoft.Gen.MetricsReports.Unit.Tests (3)
Microsoft.Interop.ComInterfaceGenerator (14)
Analyzers\RuntimeComApiUsageWithSourceGeneratedComAnalyzer.cs (8)
53var methodsOfInterest = new Dictionary<ISymbol, ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>>>(SymbolEqualityComparer.Default);
108if (methodsOfInterest.TryGetValue(operation.TargetMethod.OriginalDefinition, out ImmutableArray<Func<IInvocationOperation, (ITypeSymbol, Location)?>> discoverers))
110foreach (Func<IInvocationOperation, (ITypeSymbol, Location)?> discoverer in discoverers)
113if (typeInfo is (ITypeSymbol targetType, Location diagnosticLocation))
200static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch
206static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeArgumentTypeLookup(int ordinal) => invocation =>
213Location? location = null;
235static Func<IInvocationOperation, (ITypeSymbol Type, Location location)?> CreateTypeOfArgumentTypeLookup(int ordinal) => invocation => invocation.GetArgumentByOrdinal(ordinal).Value switch
Microsoft.Interop.LibraryImportGenerator (2)
Microsoft.Interop.SourceGeneration (50)
DiagnosticExtensions.cs (28)
35Location location = syntaxReference is not null
37: Location.None;
49Location location = syntaxReference is not null
51: Location.None;
57this ImmutableArray<Location> locations,
65this ImmutableArray<Location> locations,
70Location firstLocation = null;
71List<Location> additionalLocations = null;
72foreach (Location location in locations)
88Diagnostic.Create(descriptor, Location.None, properties: properties, args) :
93this Location location,
99location: location.IsInSource ? location : Location.None,
104this Location location,
111location: location.IsInSource ? location : Location.None,
139Location location = syntaxReference is not null
141: Location.None;
153Location location = syntaxReference is not null
155: Location.None;
161this ImmutableArray<Location> locations,
169this ImmutableArray<Location> locations,
174Location firstLocation = null;
175List<Location> additionalLocations = null;
176foreach (Location location in locations)
192DiagnosticInfo.Create(descriptor, Location.None, properties: properties, args) :
197this Location location,
203location: location.IsInSource ? location : Location.None,
208this Location location,
215location: location.IsInSource ? location : Location.None,
DiagnosticInfo.cs (5)
26public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, Location location, params object?[] messageArgs)
38public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, Location location, ImmutableDictionary<string, string>? properties, params object?[] messageArgs)
50public static DiagnosticInfo Create(DiagnosticDescriptor descriptor, Location location, IEnumerable<Location>? additionalLocations, ImmutableDictionary<string, string>? properties, params object?[] messageArgs)
56AdditionalLocations = (additionalLocations ?? ImmutableArray<Location>.Empty).ToSequenceEqualImmutableArray(),
Marshalling\GeneratorDiagnostic.cs (5)
26public abstract DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor, Location location, string elementName);
35public override DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor, Location location, string elementName)
45public sealed record UnnecessaryData(TypePositionInfo TypePositionInfo, ImmutableArray<Location> UnnecessaryDataLocations) : GeneratorDiagnostic(TypePositionInfo, isFatal: false)
50public override DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor, Location location, string elementName)
68public override DiagnosticInfo ToDiagnosticInfo(DiagnosticDescriptor descriptor, Location location, string elementName)
Microsoft.Maui.Controls.BindingSourceGen (15)
Microsoft.Maui.Controls.SourceGen (2)
Microsoft.VisualStudio.LanguageServices (15)
System.Text.Json.SourceGeneration (15)
System.Text.RegularExpressions.Generator (6)
RegexGenerator.Parser.cs (5)
252static Location GetComparableLocation(SyntaxNode syntax)
254var location = syntax.GetLocation();
255return Location.Create(location.SourceTree?.FilePath ?? string.Empty, location.SourceSpan, location.GetLineSpan().Span);
260internal sealed record RegexPatternAndSyntax(RegexType DeclaringType, bool IsProperty, Location DiagnosticLocation, string MemberName, string Modifiers, bool NullableRegex, string Pattern, RegexOptions Options, int? MatchTimeout, CultureInfo Culture, CompilationData CompilationData);
263internal sealed record RegexMethod(RegexType DeclaringType, bool IsProperty, Location DiagnosticLocation, string MemberName, string Modifiers, bool NullableRegex, string Pattern, RegexOptions Options, int? MatchTimeout, RegexTree Tree, AnalysisResults Analysis, CompilationData CompilationData)
System.Windows.Forms.Analyzers (2)
System.Windows.Forms.Analyzers.CSharp (4)