2 writes to AttributeSyntaxOpt
Microsoft.CodeAnalysis.CSharp (2)
Symbols\Source\SourceAssemblySymbol.cs (1)
1350
arguments.
AttributeSyntaxOpt
= null;
Symbols\Symbol_Attributes.cs (1)
867
arguments.
AttributeSyntaxOpt
= attributeSyntax;
153 references to AttributeSyntaxOpt
Microsoft.CodeAnalysis (33)
Symbols\Attributes\CommonAttributeData.cs (8)
406
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
425
messageProvider.ReportInvalidAttributeArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, attribute);
444
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, "MethodCodeType");
467
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
486
messageProvider.ReportInvalidAttributeArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, attribute);
510
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, namedArg.Key);
523
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, namedArg.Key);
533
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, namedArg.Key);
Symbols\Attributes\MarshalAsAttributeDecoder.cs (25)
22
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
45
messageProvider.ReportMarshalUnmanagedTypeOnlyValidForFields(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, "ByValArray", arguments.Attribute);
61
messageProvider.ReportMarshalUnmanagedTypeOnlyValidForFields(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, "ByValTStr", arguments.Attribute);
73
messageProvider.ReportMarshalUnmanagedTypeNotValidForFields(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, "VBByRefStr", arguments.Attribute);
87
messageProvider.ReportInvalidAttributeArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, arguments.Attribute);
116
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
134
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
150
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
164
messageProvider.ReportAttributeParameterRequired(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, "MarshalType", "MarshalTypeRef");
176
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
190
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
209
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
230
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
240
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
255
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
262
messageProvider.ReportParameterNotValidForType(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position);
277
arguments.Diagnostics.Add(messageProvider.CreateDiagnostic(warningCode, arguments.
AttributeSyntaxOpt
.GetLocation()));
298
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
314
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
328
messageProvider.ReportParameterNotValidForType(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position);
348
messageProvider.ReportParameterNotValidForType(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, symbolIndex);
368
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
382
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, arguments.Attribute.AttributeClass, namedArg.Key);
390
messageProvider.ReportParameterNotValidForType(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position);
402
messageProvider.ReportAttributeParameterRequired(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, "SizeConst");
Microsoft.CodeAnalysis.CSharp (120)
Symbols\Attributes\AttributeData.cs (6)
220
DeclarativeSecurityAction action = DecodeSecurityAttributeAction(targetSymbol, compilation, arguments.
AttributeSyntaxOpt
, out hasErrors, (BindingDiagnosticBag)arguments.Diagnostics);
230
string? resolvedPathForFixup = DecodePermissionSetAttribute(compilation, arguments.
AttributeSyntaxOpt
, (BindingDiagnosticBag)arguments.Diagnostics);
245
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
246
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_IllegalUnsafe, arguments.
AttributeSyntaxOpt
.Location);
296
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
297
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.WRN_MemberNotNullBadMember, arguments.
AttributeSyntaxOpt
.Location, memberName);
Symbols\Source\FieldSymbolWithAttributesAndModifiers.cs (6)
165
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
185
diagnostics.Add(ErrorCode.ERR_StructOffsetOnBadField, arguments.
AttributeSyntaxOpt
.Name.Location);
193
diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
281
diagnostics.Add(ErrorCode.ERR_FieldHasMultipleDistinctConstantValues, arguments.
AttributeSyntaxOpt
.Location);
286
diagnostics.Add(ErrorCode.ERR_FieldHasMultipleDistinctConstantValues, arguments.
AttributeSyntaxOpt
.Location);
302
diagnostics.Add(ErrorCode.ERR_FieldHasMultipleDistinctConstantValues, arguments.
AttributeSyntaxOpt
.Location);
Symbols\Source\SourceAssemblySymbol.cs (13)
2213
diagnostics.Add(ErrorCode.ERR_InvalidFwdType, GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
));
2219
diagnostics.Add(useSiteInfo, useSiteInfo.DiagnosticInfo is object ? GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
) : Location.None))
2228
diagnostics.Add(ErrorCode.ERR_ForwardedTypeInThisAssembly, GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
), forwardedType);
2234
diagnostics.Add(ErrorCode.ERR_ForwardedTypeIsNested, GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
), forwardedType, forwardedType.ContainingType);
2244
diagnostics.Add(ErrorCode.ERR_InvalidFwdType, GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
));
2264
diagnostics.Add(ErrorCode.ERR_DuplicateTypeForwarder, GetAssemblyAttributeLocationForDiagnostic(arguments.
AttributeSyntaxOpt
), forwardedType);
2373
DecodeOneInternalsVisibleToAttribute(arguments.
AttributeSyntaxOpt
, attribute, diagnostics, index, ref _lazyInternalsVisibleToMap);
2501
attribute.DecodeClassInterfaceAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
2505
ValidateIntegralAttributeNonNegativeArguments(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
2509
ValidateIntegralAttributeNonNegativeArguments(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
2513
string guidString = attribute.DecodeGuidAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
2564
if ((object)arguments.
AttributeSyntaxOpt
!= null)
2567
diagnostics.Add(ErrorCode.ERR_ExplicitExtension, arguments.
AttributeSyntaxOpt
.Location);
Symbols\Source\SourceComplexParameterSymbol.cs (22)
731
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
761
diagnostics.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, arguments.
AttributeSyntaxOpt
.Name.Location);
767
diagnostics.Add(ErrorCode.ERR_ExplicitParamArrayOrCollection, arguments.
AttributeSyntaxOpt
.Name.Location);
791
ValidateCallerLineNumberAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
795
ValidateCallerFilePathAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
799
ValidateCallerMemberNameAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
803
ValidateCallerArgumentExpressionAttribute(arguments.
AttributeSyntaxOpt
, attribute, diagnostics);
852
ValidateCancellationTokenAttribute(arguments.
AttributeSyntaxOpt
, (BindingDiagnosticBag)arguments.Diagnostics);
862
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
867
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedTarget, arguments.
AttributeSyntaxOpt
.Location);
871
diagnostics.Add(ErrorCode.ERR_UnscopedScoped, arguments.
AttributeSyntaxOpt
.Location);
892
var syntax = arguments.
AttributeSyntaxOpt
;
1242
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1247
diagnostics.Add(ErrorCode.ERR_TypeIsNotAnInterpolatedStringHandlerType, arguments.
AttributeSyntaxOpt
.Location, Type);
1255
diagnostics.Add(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, arguments.
AttributeSyntaxOpt
.Location);
1283
diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
!.Location);
1323
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1327
diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location);
1345
diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location, ContainingSymbol);
1356
diagnostics.Add(ErrorCode.ERR_InvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location, name, ContainingSymbol);
1363
diagnostics.Add(ErrorCode.ERR_CannotUseSelfAsInterpolatedStringHandlerArgument, arguments.
AttributeSyntaxOpt
.Location);
1372
diagnostics.Add(ErrorCode.WRN_ParameterOccursAfterInterpolatedStringHandlerParameter, arguments.
AttributeSyntaxOpt
.Location, parameter.Name, this.Name);
Symbols\Source\SourceEventSymbol.cs (1)
366
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.
AttributeSyntaxOpt
!.Location);
Symbols\Source\SourceFieldSymbol.cs (2)
116
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
126
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_DoNotUseFixedBufferAttr, arguments.
AttributeSyntaxOpt
.Name.Location);
Symbols\Source\SourceMethodSymbolWithAttributes.cs (34)
526
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
554
ValidateConditionalAttribute(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
584
diagnostics.Add(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, arguments.
AttributeSyntaxOpt
.Location, arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
597
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
602
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
607
MessageID.IDS_FeatureModuleInitializers.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
618
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
627
MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
632
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.
AttributeSyntaxOpt
.Location);
641
MessageID.IDS_FeatureOverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
650
arguments.
AttributeSyntaxOpt
);
699
diagnostics.Add(ErrorCode.ERR_AttributeNotOnEventAccessor, arguments.
AttributeSyntaxOpt
.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
703
MessageID.IDS_FeatureObsoleteOnPropertyAccessor.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
779
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
818
RoslynDebug.Assert(arguments.
AttributeSyntaxOpt
?.ArgumentList is object);
828
diagnostics.Add(ErrorCode.ERR_DllImportOnInvalidMethod, arguments.
AttributeSyntaxOpt
.Name.Location);
844
diagnostics.Add(ErrorCode.ERR_DllImportOnGenericMethod, arguments.
AttributeSyntaxOpt
.Name.Location);
852
diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
881
diagnostics.Add(ErrorCode.ERR_InvalidNamedArgument, arguments.
AttributeSyntaxOpt
.ArgumentList.Arguments[position].Location, namedArg.Key);
943
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
948
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeOrdinary, arguments.
AttributeSyntaxOpt
.Location);
958
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType, arguments.
AttributeSyntaxOpt
.Location, Name);
962
diagnostics.Add(arguments.
AttributeSyntaxOpt
, useSiteInfo);
966
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid, arguments.
AttributeSyntaxOpt
.Location, Name);
972
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric, arguments.
AttributeSyntaxOpt
.Location, Name);
980
diagnostics.Add(ErrorCode.ERR_ModuleInitializerCannotBeUnmanagedCallersOnly, arguments.
AttributeSyntaxOpt
.Location);
984
if (!hasError && !CallsAreOmitted(arguments.
AttributeSyntaxOpt
.SyntaxTree))
1011
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1012
var attributeNameSyntax = arguments.
AttributeSyntaxOpt
.Name; // used for reporting diagnostics
1155
var attributeSyntax = arguments.
AttributeSyntaxOpt
;
1375
Debug.Assert(arguments.
AttributeSyntaxOpt
!= null);
1379
DecodeUnmanagedCallersOnlyAttributeData(this, arguments.Attribute, arguments.
AttributeSyntaxOpt
.Location, diagnostics);
1381
bool reportedError = CheckAndReportValidUnmanagedCallersOnlyTarget(arguments.
AttributeSyntaxOpt
.Name, diagnostics);
Symbols\Source\SourceModuleSymbol.cs (2)
562
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
573
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
Symbols\Source\SourceNamedTypeSymbol.cs (12)
1097
Debug.Assert(arguments.
AttributeSyntaxOpt
is { });
1106
DecodeAttributeUsageAttribute(attribute, arguments.
AttributeSyntaxOpt
, diagnose: true, diagnosticsOpt: diagnostics);
1118
ValidateConditionalAttribute(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
1122
arguments.GetOrCreateData<TypeWellKnownAttributeData>().GuidString = attribute.DecodeGuidAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
1147
attribute.DecodeClassInterfaceAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
1151
attribute.DecodeInterfaceTypeAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
1160
diagnostics.Add(ErrorCode.ERR_CantUseRequiredAttribute, arguments.
AttributeSyntaxOpt
.Name.Location);
1190
diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidType, arguments.
AttributeSyntaxOpt
.Name.Location);
1200
diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidMethodName, arguments.
AttributeSyntaxOpt
.Name.Location);
1218
diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, arguments.
AttributeSyntaxOpt
.Name.Location, arguments.
AttributeSyntaxOpt
.GetErrorDisplayName(), "struct");
1222
diagnostics.Add(ErrorCode.ERR_InlineArrayAttributeOnRecord, arguments.
AttributeSyntaxOpt
.Name.Location);
Symbols\Source\SourcePropertySymbolBase.cs (10)
1525
Debug.Assert(arguments.
AttributeSyntaxOpt
!= null);
1537
ValidateIndexerNameAttribute(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
1554
diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.
AttributeSyntaxOpt
.Location);
1586
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1591
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1598
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
1607
MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1612
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.
AttributeSyntaxOpt
.Location);
1617
MessageID.IDS_FeatureOverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1626
arguments.
AttributeSyntaxOpt
);
Symbols\Source\SourceTypeParameterSymbol.cs (1)
429
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
Symbols\Symbol.cs (7)
1547
diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.
AttributeSyntaxOpt
.Location);
1568
diagnostics.Add(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, arguments.
AttributeSyntaxOpt
.Location);
1574
diagnostics.Add(ErrorCode.ERR_ExplicitNullableAttribute, arguments.
AttributeSyntaxOpt
.Location);
1592
diagnostics.Add(ErrorCode.ERR_ExplicitExtension, arguments.
AttributeSyntaxOpt
.Location);
1598
diagnostics.Add(ErrorCode.ERR_ExplicitRequiredMember, arguments.
AttributeSyntaxOpt
.Location);
1604
diagnostics.Add(ErrorCode.ERR_ExplicitScopedRef, arguments.
AttributeSyntaxOpt
.Location);
1621
diagnostics.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.
AttributeSyntaxOpt
.Location, attributeDescription.FullName);
Symbols\Symbol_Attributes.cs (2)
219
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
223
arguments.Diagnostics.DiagnosticBag.Add(ErrorCode.ERR_ExplicitReservedAttr, arguments.
AttributeSyntaxOpt
.Location, AttributeDescription.CompilerFeatureRequiredAttribute.FullName);
Symbols\Synthesized\SynthesizedBackingFieldSymbol.cs (2)
238
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
248
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_DoNotUseFixedBufferAttrOnProperty, arguments.
AttributeSyntaxOpt
.Name.Location);