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;
156 references to AttributeSyntaxOpt
Microsoft.CodeAnalysis (34)
Symbols\Attributes\CommonAttributeData.cs (9)
407
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
426
messageProvider.ReportInvalidAttributeArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, attribute);
439
arguments.Diagnostics.Add(messageProvider.CreateDiagnostic(messageProvider.ERR_MethodImplAttributeAsyncCannotBeUsed, arguments.
AttributeSyntaxOpt
.Location));
459
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, "MethodCodeType");
482
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
501
messageProvider.ReportInvalidAttributeArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, 0, attribute);
525
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, namedArg.Key);
538
messageProvider.ReportInvalidNamedArgument(arguments.Diagnostics, arguments.
AttributeSyntaxOpt
, position, attribute.AttributeClass, namedArg.Key);
548
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 (122)
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());
282
diagnostics.Add(ErrorCode.ERR_FieldHasMultipleDistinctConstantValues, arguments.
AttributeSyntaxOpt
.Location);
287
diagnostics.Add(ErrorCode.ERR_FieldHasMultipleDistinctConstantValues, arguments.
AttributeSyntaxOpt
.Location);
303
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 (24)
737
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
767
diagnostics.Add(ErrorCode.ERR_DefaultValueUsedWithAttributes, arguments.
AttributeSyntaxOpt
.Name.Location);
773
diagnostics.Add(ErrorCode.ERR_ExplicitParamArrayOrCollection, arguments.
AttributeSyntaxOpt
.Name.Location);
797
ValidateCallerLineNumberAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
801
ValidateCallerFilePathAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
805
ValidateCallerMemberNameAttribute(arguments.
AttributeSyntaxOpt
, diagnostics);
809
ValidateCallerArgumentExpressionAttribute(arguments.
AttributeSyntaxOpt
, attribute, diagnostics);
859
ValidateCancellationTokenAttribute(arguments.
AttributeSyntaxOpt
, (BindingDiagnosticBag)arguments.Diagnostics);
869
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
874
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedTarget, arguments.
AttributeSyntaxOpt
.Location);
878
diagnostics.Add(ErrorCode.ERR_UnscopedScoped, arguments.
AttributeSyntaxOpt
.Location);
899
var syntax = arguments.
AttributeSyntaxOpt
;
1249
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1254
diagnostics.Add(ErrorCode.ERR_TypeIsNotAnInterpolatedStringHandlerType, arguments.
AttributeSyntaxOpt
.Location, Type);
1262
diagnostics.Add(ErrorCode.WRN_InterpolatedStringHandlerArgumentAttributeIgnoredOnLambdaParameters, arguments.
AttributeSyntaxOpt
.Location);
1268
diagnostics.Add(ErrorCode.ERR_InterpolatedStringHandlerArgumentDisallowed, arguments.
AttributeSyntaxOpt
.Location);
1296
diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
!.Location);
1333
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1337
diagnostics.Add(ErrorCode.ERR_NullInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location);
1357
diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location, ContainingSymbol);
1369
diagnostics.Add(ErrorCode.ERR_NotInstanceInvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location, ContainingSymbol);
1380
diagnostics.Add(ErrorCode.ERR_InvalidInterpolatedStringHandlerArgumentName, arguments.
AttributeSyntaxOpt
.Location, name, ContainingSymbol);
1387
diagnostics.Add(ErrorCode.ERR_CannotUseSelfAsInterpolatedStringHandlerArgument, arguments.
AttributeSyntaxOpt
.Location);
1396
diagnostics.Add(ErrorCode.WRN_ParameterOccursAfterInterpolatedStringHandlerParameter, arguments.
AttributeSyntaxOpt
.Location, parameter.Name, this.Name);
Symbols\Source\SourceEventSymbol.cs (1)
370
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);
585
diagnostics.Add(ErrorCode.ERR_SecurityCriticalOrSecuritySafeCriticalOnAsync, arguments.
AttributeSyntaxOpt
.Location, arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
598
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
603
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
608
MessageID.IDS_FeatureModuleInitializers.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
619
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
628
MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
633
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.
AttributeSyntaxOpt
.Location);
642
MessageID.IDS_FeatureOverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
651
arguments.
AttributeSyntaxOpt
);
710
diagnostics.Add(ErrorCode.ERR_AttributeNotOnEventAccessor, arguments.
AttributeSyntaxOpt
.Name.Location, description.FullName, attributeUsage.GetValidTargetsErrorArgument());
714
MessageID.IDS_FeatureObsoleteOnPropertyAccessor.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
790
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
830
RoslynDebug.Assert(arguments.
AttributeSyntaxOpt
?.ArgumentList is object);
840
diagnostics.Add(ErrorCode.ERR_DllImportOnInvalidMethod, arguments.
AttributeSyntaxOpt
.Name.Location);
856
diagnostics.Add(ErrorCode.ERR_DllImportOnGenericMethod, arguments.
AttributeSyntaxOpt
.Name.Location);
864
diagnostics.Add(ErrorCode.ERR_InvalidAttributeArgument, attribute.GetAttributeArgumentLocation(0), arguments.
AttributeSyntaxOpt
.GetErrorDisplayName());
893
diagnostics.Add(ErrorCode.ERR_InvalidNamedArgument, arguments.
AttributeSyntaxOpt
.ArgumentList.Arguments[position].Location, namedArg.Key);
955
Debug.Assert(arguments.
AttributeSyntaxOpt
is object);
960
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeOrdinary, arguments.
AttributeSyntaxOpt
.Location);
970
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeAccessibleOutsideTopLevelType, arguments.
AttributeSyntaxOpt
.Location, Name);
974
diagnostics.Add(arguments.
AttributeSyntaxOpt
, useSiteInfo);
978
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodMustBeStaticParameterlessVoid, arguments.
AttributeSyntaxOpt
.Location, Name);
984
diagnostics.Add(ErrorCode.ERR_ModuleInitializerMethodAndContainingTypesMustNotBeGeneric, arguments.
AttributeSyntaxOpt
.Location, Name);
992
diagnostics.Add(ErrorCode.ERR_ModuleInitializerCannotBeUnmanagedCallersOnly, arguments.
AttributeSyntaxOpt
.Location);
996
if (!hasError && !CallsAreOmitted(arguments.
AttributeSyntaxOpt
.SyntaxTree))
1023
Debug.Assert(arguments.
AttributeSyntaxOpt
is not null);
1024
var attributeNameSyntax = arguments.
AttributeSyntaxOpt
.Name; // used for reporting diagnostics
1167
var attributeSyntax = arguments.
AttributeSyntaxOpt
;
1387
Debug.Assert(arguments.
AttributeSyntaxOpt
!= null);
1391
DecodeUnmanagedCallersOnlyAttributeData(this, arguments.Attribute, arguments.
AttributeSyntaxOpt
.Location, diagnostics);
1393
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);
1191
diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidType, arguments.
AttributeSyntaxOpt
.Name.Location);
1201
diagnostics.Add(ErrorCode.ERR_CollectionBuilderAttributeInvalidMethodName, arguments.
AttributeSyntaxOpt
.Name.Location);
1219
diagnostics.Add(ErrorCode.ERR_AttributeOnBadSymbolType, arguments.
AttributeSyntaxOpt
.Name.Location, arguments.
AttributeSyntaxOpt
.GetErrorDisplayName(), "struct");
1223
diagnostics.Add(ErrorCode.ERR_InlineArrayAttributeOnRecord, arguments.
AttributeSyntaxOpt
.Name.Location);
Symbols\Source\SourcePropertySymbolBase.cs (10)
1532
Debug.Assert(arguments.
AttributeSyntaxOpt
!= null);
1544
ValidateIndexerNameAttribute(attribute, arguments.
AttributeSyntaxOpt
, diagnostics);
1561
diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.
AttributeSyntaxOpt
.Location);
1594
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1599
MessageID.IDS_FeatureMemberNotNull.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1606
diagnostics.Add(ErrorCode.WRN_UnscopedRefAttributeOldRules, arguments.
AttributeSyntaxOpt
.Location);
1615
MessageID.IDS_FeatureRefStructInterfaces.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1620
diagnostics.Add(ErrorCode.ERR_UnscopedRefAttributeUnsupportedMemberTarget, arguments.
AttributeSyntaxOpt
.Location);
1625
MessageID.IDS_FeatureOverloadResolutionPriority.CheckFeatureAvailability(diagnostics, arguments.
AttributeSyntaxOpt
);
1634
arguments.
AttributeSyntaxOpt
);
Symbols\Source\SourceTypeParameterSymbol.cs (1)
429
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
Symbols\Symbol.cs (7)
1548
diagnostics.Add(ErrorCode.ERR_ExplicitDynamicAttr, arguments.
AttributeSyntaxOpt
.Location);
1569
diagnostics.Add(ErrorCode.ERR_ExplicitTupleElementNamesAttribute, arguments.
AttributeSyntaxOpt
.Location);
1575
diagnostics.Add(ErrorCode.ERR_ExplicitNullableAttribute, arguments.
AttributeSyntaxOpt
.Location);
1593
diagnostics.Add(ErrorCode.ERR_ExplicitExtension, arguments.
AttributeSyntaxOpt
.Location);
1599
diagnostics.Add(ErrorCode.ERR_ExplicitRequiredMember, arguments.
AttributeSyntaxOpt
.Location);
1605
diagnostics.Add(ErrorCode.ERR_ExplicitScopedRef, arguments.
AttributeSyntaxOpt
.Location);
1626
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)
246
Debug.Assert((object)arguments.
AttributeSyntaxOpt
!= null);
256
((BindingDiagnosticBag)arguments.Diagnostics).Add(ErrorCode.ERR_DoNotUseFixedBufferAttrOnProperty, arguments.
AttributeSyntaxOpt
.Name.Location);