Zzz – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /* MIT License
2  
3 Copyright (c) 2016 JetBrains http://www.jetbrains.com
4  
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
11  
12 The above copyright notice and this permission notice shall be included in all
13 copies or substantial portions of the Software.
14  
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 SOFTWARE. */
22  
23 using System;
24  
25 // ReSharper disable UnusedType.Global
26  
27 #pragma warning disable 1591
28 // ReSharper disable UnusedMember.Global
29 // ReSharper disable MemberCanBePrivate.Global
30 // ReSharper disable UnusedAutoPropertyAccessor.Global
31 // ReSharper disable IntroduceOptionalParameters.Global
32 // ReSharper disable MemberCanBeProtected.Global
33 // ReSharper disable InconsistentNaming
34  
35 namespace Configuration.Annotations
36 {
37 /// <summary>
38 /// Indicates that the value of the marked element could be <c>null</c> sometimes,
39 /// so checking for <c>null</c> is required before its usage.
40 /// </summary>
41 /// <example>
42 /// <code>
43 /// [CanBeNull] object Test() => null;
44 ///
45 /// void UseTest() {
46 /// var p = Test();
47 /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException'
48 /// }
49 /// </code>
50 /// </example>
51 [AttributeUsage(
52 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
53 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
54 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
55 public sealed class CanBeNullAttribute : Attribute
56 {
57 }
58  
59 /// <summary>
60 /// Indicates that the value of the marked element can never be <c>null</c>.
61 /// </summary>
62 /// <example>
63 /// <code>
64 /// [NotNull] object Foo() {
65 /// return null; // Warning: Possible 'null' assignment
66 /// }
67 /// </code>
68 /// </example>
69 [AttributeUsage(
70 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
71 AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event |
72 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)]
73 public sealed class NotNullAttribute : Attribute
74 {
75 }
76  
77 /// <summary>
78 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task
79 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
80 /// or of the Lazy.Value property can never be null.
81 /// </summary>
82 /// <example>
83 /// <code>
84 /// public void Foo([ItemNotNull]List&lt;string&gt; books)
85 /// {
86 /// foreach (var book in books) {
87 /// if (book != null) // Warning: Expression is always true
88 /// Console.WriteLine(book.ToUpper());
89 /// }
90 /// }
91 /// </code>
92 /// </example>
93 [AttributeUsage(
94 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
95 AttributeTargets.Delegate | AttributeTargets.Field)]
96 public sealed class ItemNotNullAttribute : Attribute
97 {
98 }
99  
100 /// <summary>
101 /// Can be applied to symbols of types derived from IEnumerable as well as to symbols of Task
102 /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property
103 /// or of the Lazy.Value property can be null.
104 /// </summary>
105 /// <example>
106 /// <code>
107 /// public void Foo([ItemCanBeNull]List&lt;string&gt; books)
108 /// {
109 /// foreach (var book in books)
110 /// {
111 /// // Warning: Possible 'System.NullReferenceException'
112 /// Console.WriteLine(book.ToUpper());
113 /// }
114 /// }
115 /// </code>
116 /// </example>
117 [AttributeUsage(
118 AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property |
119 AttributeTargets.Delegate | AttributeTargets.Field)]
120 public sealed class ItemCanBeNullAttribute : Attribute
121 {
122 }
123  
124 /// <summary>
125 /// Indicates that the marked method builds string by the format pattern and (optional) arguments.
126 /// The parameter, which contains the format string, should be given in the constructor. The format string
127 /// should be in <see cref="string.Format(IFormatProvider,string,object[])" />-like form.
128 /// </summary>
129 /// <example>
130 /// <code>
131 /// [StringFormatMethod("message")]
132 /// void ShowError(string message, params object[] args) { /* do something */ }
133 ///
134 /// void Foo() {
135 /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string
136 /// }
137 /// </code>
138 /// </example>
139 [AttributeUsage(
140 AttributeTargets.Constructor | AttributeTargets.Method |
141 AttributeTargets.Property | AttributeTargets.Delegate)]
142 public sealed class StringFormatMethodAttribute : Attribute
143 {
144 /// <param name="formatParameterName">
145 /// Specifies which parameter of an annotated method should be treated as the format string
146 /// </param>
147 public StringFormatMethodAttribute([NotNull] string formatParameterName)
148 {
149 FormatParameterName = formatParameterName;
150 }
151  
152 [NotNull]
153 public string FormatParameterName { get; }
154 }
155  
156 /// <summary>
157 /// Indicates that the marked parameter is a message template where placeholders are to be replaced by the following
158 /// arguments
159 /// in the order in which they appear
160 /// </summary>
161 /// <example>
162 /// <code>
163 /// void LogInfo([StructuredMessageTemplate]string message, params object[] args) { /* do something */ }
164 ///
165 /// void Foo() {
166 /// LogInfo("User created: {username}"); // Warning: Non-existing argument in format string
167 /// }
168 /// </code>
169 /// </example>
170 [AttributeUsage(AttributeTargets.Parameter)]
171 public sealed class StructuredMessageTemplateAttribute : Attribute
172 {
173 }
174  
175 /// <summary>
176 /// Use this annotation to specify a type that contains static or const fields
177 /// with values for the annotated property/field/parameter.
178 /// The specified type will be used to improve completion suggestions.
179 /// </summary>
180 /// <example>
181 /// <code>
182 /// namespace TestNamespace
183 /// {
184 /// public class Constants
185 /// {
186 /// public static int INT_CONST = 1;
187 /// public const string STRING_CONST = "1";
188 /// }
189 ///
190 /// public class Class1
191 /// {
192 /// [ValueProvider("TestNamespace.Constants")] public int myField;
193 /// public void Foo([ValueProvider("TestNamespace.Constants")] string str) { }
194 ///
195 /// public void Test()
196 /// {
197 /// Foo(/*try completion here*/);//
198 /// myField = /*try completion here*/
199 /// }
200 /// }
201 /// }
202 /// </code>
203 /// </example>
204 [AttributeUsage(
205 AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field,
206 AllowMultiple = true)]
207 public sealed class ValueProviderAttribute : Attribute
208 {
209 public ValueProviderAttribute([NotNull] string name)
210 {
211 Name = name;
212 }
213  
214 [NotNull]
215 public string Name { get; }
216 }
217  
218 /// <summary>
219 /// Indicates that the integral value falls into the specified interval.
220 /// It's allowed to specify multiple non-intersecting intervals.
221 /// Values of interval boundaries are inclusive.
222 /// </summary>
223 /// <example>
224 /// <code>
225 /// void Foo([ValueRange(0, 100)] int value) {
226 /// if (value == -1) { // Warning: Expression is always 'false'
227 /// ...
228 /// }
229 /// }
230 /// </code>
231 /// </example>
232 [AttributeUsage(
233 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property |
234 AttributeTargets.Method | AttributeTargets.Delegate,
235 AllowMultiple = true)]
236 public sealed class ValueRangeAttribute : Attribute
237 {
238 public ValueRangeAttribute(long from, long to)
239 {
240 From = from;
241 To = to;
242 }
243  
244 public ValueRangeAttribute(ulong from, ulong to)
245 {
246 From = from;
247 To = to;
248 }
249  
250 public ValueRangeAttribute(long value)
251 {
252 From = To = value;
253 }
254  
255 public ValueRangeAttribute(ulong value)
256 {
257 From = To = value;
258 }
259  
260 public object From { get; }
261  
262 public object To { get; }
263 }
264  
265 /// <summary>
266 /// Indicates that the integral value never falls below zero.
267 /// </summary>
268 /// <example>
269 /// <code>
270 /// void Foo([NonNegativeValue] int value) {
271 /// if (value == -1) { // Warning: Expression is always 'false'
272 /// ...
273 /// }
274 /// }
275 /// </code>
276 /// </example>
277 [AttributeUsage(
278 AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property |
279 AttributeTargets.Method | AttributeTargets.Delegate)]
280 public sealed class NonNegativeValueAttribute : Attribute
281 {
282 }
283  
284 /// <summary>
285 /// Indicates that the function argument should be a string literal and match
286 /// one of the parameters of the caller function. This annotation is used for paramerers
287 /// like 'string paramName' parameter of the <see cref="System.ArgumentNullException" /> constuctor.
288 /// </summary>
289 /// <example>
290 /// <code>
291 /// void Foo(string param) {
292 /// if (param == null)
293 /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol
294 /// }
295 /// </code>
296 /// </example>
297 [AttributeUsage(AttributeTargets.Parameter)]
298 public sealed class InvokerParameterNameAttribute : Attribute
299 {
300 }
301  
302 /// <summary>
303 /// Indicates that the method is contained in a type that implements
304 /// <c>System.ComponentModel.INotifyPropertyChanged</c> interface and this method
305 /// is used to notify that some property value changed.
306 /// </summary>
307 /// <remarks>
308 /// The method should be non-static and conform to one of the supported signatures:
309 /// <list>
310 /// <item>
311 /// <c>NotifyChanged(string)</c>
312 /// </item>
313 /// <item>
314 /// <c>NotifyChanged(params string[])</c>
315 /// </item>
316 /// <item>
317 /// <c>NotifyChanged{T}(Expression{Func{T}})</c>
318 /// </item>
319 /// <item>
320 /// <c>NotifyChanged{T,U}(Expression{Func{T,U}})</c>
321 /// </item>
322 /// <item>
323 /// <c>SetProperty{T}(ref T, T, string)</c>
324 /// </item>
325 /// </list>
326 /// </remarks>
327 /// <example>
328 /// <code>
329 /// public class Foo : INotifyPropertyChanged {
330 /// public event PropertyChangedEventHandler PropertyChanged;
331 ///
332 /// [NotifyPropertyChangedInvocator]
333 /// protected virtual void NotifyChanged(string propertyName) { ... }
334 ///
335 /// string _name;
336 ///
337 /// public string Name {
338 /// get { return _name; }
339 /// set { _name = value; NotifyChanged("LastName"); /* Warning */ }
340 /// }
341 /// }
342 /// </code>
343 /// Examples of generated notifications:
344 /// <list>
345 /// <item>
346 /// <c>NotifyChanged("Property")</c>
347 /// </item>
348 /// <item>
349 /// <c>NotifyChanged(() =&gt; Property)</c>
350 /// </item>
351 /// <item>
352 /// <c>NotifyChanged((VM x) =&gt; x.Property)</c>
353 /// </item>
354 /// <item>
355 /// <c>SetProperty(ref myField, value, "Property")</c>
356 /// </item>
357 /// </list>
358 /// </example>
359 [AttributeUsage(AttributeTargets.Method)]
360 public sealed class NotifyPropertyChangedInvocatorAttribute : Attribute
361 {
362 public NotifyPropertyChangedInvocatorAttribute()
363 {
364 }
365  
366 public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName)
367 {
368 ParameterName = parameterName;
369 }
370  
371 [CanBeNull]
372 public string ParameterName { get; }
373 }
374  
375 /// <summary>
376 /// Describes dependency between method input and output.
377 /// </summary>
378 /// <syntax>
379 /// <p>Function Definition Table syntax:</p>
380 /// <list>
381 /// <item>FDT ::= FDTRow [;FDTRow]*</item>
382 /// <item>FDTRow ::= Input =&gt; Output | Output &lt;= Input</item>
383 /// <item>Input ::= ParameterName: Value [, Input]*</item>
384 /// <item>Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value}</item>
385 /// <item>Value ::= true | false | null | notnull | canbenull</item>
386 /// </list>
387 /// If the method has a single input parameter, its name could be omitted.<br />
388 /// Using <c>halt</c> (or <c>void</c>/<c>nothing</c>, which is the same) for the method output
389 /// means that the method doesn't return normally (throws or terminates the process).<br />
390 /// Value <c>canbenull</c> is only applicable for output parameters.<br />
391 /// You can use multiple <c>[ContractAnnotation]</c> for each FDT row, or use single attribute
392 /// with rows separated by the semicolon. There is no notion of order rows, all rows are checked
393 /// for applicability and applied per each program state tracked by the analysis engine.<br />
394 /// </syntax>
395 /// <examples>
396 /// <list>
397 /// <item>
398 /// <code>
399 /// [ContractAnnotation("=&gt; halt")]
400 /// public void TerminationMethod()
401 /// </code>
402 /// </item>
403 /// <item>
404 /// <code>
405 /// [ContractAnnotation("null &lt;= param:null")] // reverse condition syntax
406 /// public string GetName(string surname)
407 /// </code>
408 /// </item>
409 /// <item>
410 /// <code>
411 /// [ContractAnnotation("s:null =&gt; true")]
412 /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty()
413 /// </code>
414 /// </item>
415 /// <item>
416 /// <code>
417 /// // A method that returns null if the parameter is null,
418 /// // and not null if the parameter is not null
419 /// [ContractAnnotation("null =&gt; null; notnull =&gt; notnull")]
420 /// public object Transform(object data)
421 /// </code>
422 /// </item>
423 /// <item>
424 /// <code>
425 /// [ContractAnnotation("=&gt; true, result: notnull; =&gt; false, result: null")]
426 /// public bool TryParse(string s, out Person result)
427 /// </code>
428 /// </item>
429 /// </list>
430 /// </examples>
431 [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
432 public sealed class ContractAnnotationAttribute : Attribute
433 {
434 public ContractAnnotationAttribute([NotNull] string contract)
435 : this(contract, false)
436 {
437 }
438  
439 public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates)
440 {
441 Contract = contract;
442 ForceFullStates = forceFullStates;
443 }
444  
445 [NotNull]
446 public string Contract { get; }
447  
448 public bool ForceFullStates { get; }
449 }
450  
451 /// <summary>
452 /// Indicates whether the marked element should be localized.
453 /// </summary>
454 /// <example>
455 /// <code>
456 /// [LocalizationRequiredAttribute(true)]
457 /// class Foo {
458 /// string str = "my string"; // Warning: Localizable string
459 /// }
460 /// </code>
461 /// </example>
462 [AttributeUsage(AttributeTargets.All)]
463 public sealed class LocalizationRequiredAttribute : Attribute
464 {
465 public LocalizationRequiredAttribute() : this(true)
466 {
467 }
468  
469 public LocalizationRequiredAttribute(bool required)
470 {
471 Required = required;
472 }
473  
474 public bool Required { get; }
475 }
476  
477 /// <summary>
478 /// Indicates that the value of the marked type (or its derivatives)
479 /// cannot be compared using '==' or '!=' operators and <c>Equals()</c>
480 /// should be used instead. However, using '==' or '!=' for comparison
481 /// with <c>null</c> is always permitted.
482 /// </summary>
483 /// <example>
484 /// <code>
485 /// [CannotApplyEqualityOperator]
486 /// class NoEquality { }
487 ///
488 /// class UsesNoEquality {
489 /// void Test() {
490 /// var ca1 = new NoEquality();
491 /// var ca2 = new NoEquality();
492 /// if (ca1 != null) { // OK
493 /// bool condition = ca1 == ca2; // Warning
494 /// }
495 /// }
496 /// }
497 /// </code>
498 /// </example>
499 [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)]
500 public sealed class CannotApplyEqualityOperatorAttribute : Attribute
501 {
502 }
503  
504 /// <summary>
505 /// When applied to a target attribute, specifies a requirement for any type marked
506 /// with the target attribute to implement or inherit specific type or types.
507 /// </summary>
508 /// <example>
509 /// <code>
510 /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement
511 /// class ComponentAttribute : Attribute { }
512 ///
513 /// [Component] // ComponentAttribute requires implementing IComponent interface
514 /// class MyComponent : IComponent { }
515 /// </code>
516 /// </example>
517 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
518 [BaseTypeRequired(typeof(Attribute))]
519 public sealed class BaseTypeRequiredAttribute : Attribute
520 {
521 public BaseTypeRequiredAttribute([NotNull] Type baseType)
522 {
523 BaseType = baseType;
524 }
525  
526 [NotNull]
527 public Type BaseType { get; }
528 }
529  
530 /// <summary>
531 /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library),
532 /// so this symbol will be ignored by usage-checking inspections. <br />
533 /// You can use <see cref="ImplicitUseKindFlags" /> and <see cref="ImplicitUseTargetFlags" />
534 /// to configure how this attribute is applied.
535 /// </summary>
536 /// <example>
537 /// <code>
538 /// [UsedImplicitly]
539 /// public class TypeConverter {}
540 ///
541 /// public class SummaryData
542 /// {
543 /// [UsedImplicitly(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature)]
544 /// public SummaryData() {}
545 /// }
546 ///
547 /// [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors | ImplicitUseTargetFlags.Default)]
548 /// public interface IService {}
549 /// </code>
550 /// </example>
551 [AttributeUsage(AttributeTargets.All)]
552 public sealed class UsedImplicitlyAttribute : Attribute
553 {
554 public UsedImplicitlyAttribute()
555 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
556 {
557 }
558  
559 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags)
560 : this(useKindFlags, ImplicitUseTargetFlags.Default)
561 {
562 }
563  
564 public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags)
565 : this(ImplicitUseKindFlags.Default, targetFlags)
566 {
567 }
568  
569 public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
570 {
571 UseKindFlags = useKindFlags;
572 TargetFlags = targetFlags;
573 }
574  
575 public ImplicitUseKindFlags UseKindFlags { get; }
576  
577 public ImplicitUseTargetFlags TargetFlags { get; }
578 }
579  
580 /// <summary>
581 /// Can be applied to attributes, type parameters, and parameters of a type assignable from <see cref="System.Type" />
582 /// .
583 /// When applied to an attribute, the decorated attribute behaves the same as <see cref="UsedImplicitlyAttribute" />.
584 /// When applied to a type parameter or to a parameter of type <see cref="System.Type" />,
585 /// indicates that the corresponding type is used implicitly.
586 /// </summary>
587 [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)]
588 public sealed class MeansImplicitUseAttribute : Attribute
589 {
590 public MeansImplicitUseAttribute()
591 : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default)
592 {
593 }
594  
595 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags)
596 : this(useKindFlags, ImplicitUseTargetFlags.Default)
597 {
598 }
599  
600 public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags)
601 : this(ImplicitUseKindFlags.Default, targetFlags)
602 {
603 }
604  
605 public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags)
606 {
607 UseKindFlags = useKindFlags;
608 TargetFlags = targetFlags;
609 }
610  
611 [UsedImplicitly]
612 public ImplicitUseKindFlags UseKindFlags { get; }
613  
614 [UsedImplicitly]
615 public ImplicitUseTargetFlags TargetFlags { get; }
616 }
617  
618 /// <summary>
619 /// Specifies the details of implicitly used symbol when it is marked
620 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />.
621 /// </summary>
622 [Flags]
623 public enum ImplicitUseKindFlags
624 {
625 Default = Access | Assign | InstantiatedWithFixedConstructorSignature,
626  
627 /// <summary>Only entity marked with attribute considered used.</summary>
628 Access = 1,
629  
630 /// <summary>Indicates implicit assignment to a member.</summary>
631 Assign = 2,
632  
633 /// <summary>
634 /// Indicates implicit instantiation of a type with fixed constructor signature.
635 /// That means any unused constructor parameters won't be reported as such.
636 /// </summary>
637 InstantiatedWithFixedConstructorSignature = 4,
638  
639 /// <summary>Indicates implicit instantiation of a type.</summary>
640 InstantiatedNoFixedConstructorSignature = 8
641 }
642  
643 /// <summary>
644 /// Specifies what is considered to be used implicitly when marked
645 /// with <see cref="MeansImplicitUseAttribute" /> or <see cref="UsedImplicitlyAttribute" />.
646 /// </summary>
647 [Flags]
648 public enum ImplicitUseTargetFlags
649 {
650 Default = Itself,
651  
652 Itself = 1,
653  
654 /// <summary>Members of the type marked with the attribute are considered used.</summary>
655 Members = 2,
656  
657 /// <summary> Inherited entities are considered used. </summary>
658 WithInheritors = 4,
659  
660 /// <summary>Entity marked with the attribute and all its members considered used.</summary>
661 WithMembers = Itself | Members
662 }
663  
664 /// <summary>
665 /// This attribute is intended to mark publicly available API,
666 /// which should not be removed and so is treated as used.
667 /// </summary>
668 [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
669 [AttributeUsage(AttributeTargets.All, Inherited = false)]
670 public sealed class PublicAPIAttribute : Attribute
671 {
672 public PublicAPIAttribute()
673 {
674 }
675  
676 public PublicAPIAttribute([NotNull] string comment)
677 {
678 Comment = comment;
679 }
680  
681 [CanBeNull]
682 public string Comment { get; }
683 }
684  
685 /// <summary>
686 /// Tells the code analysis engine if the parameter is completely handled when the invoked method is on stack.
687 /// If the parameter is a delegate, indicates that delegate can only be invoked during method execution
688 /// (the delegate can be invoked zero or multiple times, but not stored to some field and invoked later,
689 /// when the containing method is no longer on the execution stack).
690 /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed.
691 /// If <see cref="RequireAwait" /> is true, the attribute will only takes effect if the method invocation is located
692 /// under the 'await' expression.
693 /// </summary>
694 [AttributeUsage(AttributeTargets.Parameter)]
695 public sealed class InstantHandleAttribute : Attribute
696 {
697 /// <summary>
698 /// Require the method invocation to be used under the 'await' expression for this attribute to take effect on code
699 /// analysis engine.
700 /// Can be used for delegate/enumerable parameters of 'async' methods.
701 /// </summary>
702 public bool RequireAwait { get; set; }
703 }
704  
705 /// <summary>
706 /// Indicates that a method does not make any observable state changes.
707 /// The same as <c>System.Diagnostics.Contracts.PureAttribute</c>.
708 /// </summary>
709 /// <example>
710 /// <code>
711 /// [Pure] int Multiply(int x, int y) => x * y;
712 ///
713 /// void M() {
714 /// Multiply(123, 42); // Warning: Return value of pure method is not used
715 /// }
716 /// </code>
717 /// </example>
718 [AttributeUsage(AttributeTargets.Method)]
719 public sealed class PureAttribute : Attribute
720 {
721 }
722  
723 /// <summary>
724 /// Indicates that the return value of the method invocation must be used.
725 /// </summary>
726 /// <remarks>
727 /// Methods decorated with this attribute (in contrast to pure methods) might change state,
728 /// but make no sense without using their return value. <br />
729 /// Similarly to <see cref="PureAttribute" />, this attribute
730 /// will help to detect usages of the method when the return value is not used.
731 /// Optionally, you can specify a message to use when showing warnings, e.g.
732 /// <code>[MustUseReturnValue("Use the return value to...")]</code>.
733 /// </remarks>
734 [AttributeUsage(AttributeTargets.Method)]
735 public sealed class MustUseReturnValueAttribute : Attribute
736 {
737 public MustUseReturnValueAttribute()
738 {
739 }
740  
741 public MustUseReturnValueAttribute([NotNull] string justification)
742 {
743 Justification = justification;
744 }
745  
746 [CanBeNull]
747 public string Justification { get; }
748 }
749  
750 /// <summary>
751 /// This annotation allows to enforce allocation-less usage patterns of delegates for performance-critical APIs.
752 /// When this annotation is applied to the parameter of delegate type, IDE checks the input argument of this parameter:
753 /// * When lambda expression or anonymous method is passed as an argument, IDE verifies that the passed closure
754 /// has no captures of the containing local variables and the compiler is able to cache the delegate instance
755 /// to avoid heap allocations. Otherwise the warning is produced.
756 /// * IDE warns when method name or local function name is passed as an argument as this always results
757 /// in heap allocation of the delegate instance.
758 /// </summary>
759 /// <remarks>
760 /// In C# 9.0 code IDE would also suggest to annotate the anonymous function with 'static' modifier
761 /// to make use of the similar analysis provided by the language/compiler.
762 /// </remarks>
763 [AttributeUsage(AttributeTargets.Parameter)]
764 public sealed class RequireStaticDelegateAttribute : Attribute
765 {
766 public bool IsError { get; set; }
767 }
768  
769 /// <summary>
770 /// Indicates the type member or parameter of some type, that should be used instead of all other ways
771 /// to get the value of that type. This annotation is useful when you have some "context" value evaluated
772 /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one.
773 /// </summary>
774 /// <example>
775 /// <code>
776 /// class Foo {
777 /// [ProvidesContext] IBarService _barService = ...;
778 ///
779 /// void ProcessNode(INode node) {
780 /// DoSomething(node, node.GetGlobalServices().Bar);
781 /// // ^ Warning: use value of '_barService' field
782 /// }
783 /// }
784 /// </code>
785 /// </example>
786 [AttributeUsage(
787 AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method |
788 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct |
789 AttributeTargets.GenericParameter)]
790 public sealed class ProvidesContextAttribute : Attribute
791 {
792 }
793  
794 /// <summary>
795 /// Indicates that a parameter is a path to a file or a folder within a web project.
796 /// Path can be relative or absolute, starting from web root (~).
797 /// </summary>
798 [AttributeUsage(AttributeTargets.Parameter)]
799 public sealed class PathReferenceAttribute : Attribute
800 {
801 public PathReferenceAttribute()
802 {
803 }
804  
805 public PathReferenceAttribute([NotNull][PathReference] string basePath)
806 {
807 BasePath = basePath;
808 }
809  
810 [CanBeNull]
811 public string BasePath { get; }
812 }
813  
814 /// <summary>
815 /// An extension method marked with this attribute is processed by code completion
816 /// as a 'Source Template'. When the extension method is completed over some expression, its source code
817 /// is automatically expanded like a template at call site.
818 /// </summary>
819 /// <remarks>
820 /// Template method body can contain valid source code and/or special comments starting with '$'.
821 /// Text inside these comments is added as source code when the template is applied. Template parameters
822 /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs.
823 /// Use the <see cref="MacroAttribute" /> attribute to specify macros for parameters.
824 /// </remarks>
825 /// <example>
826 /// In this example, the 'forEach' method is a source template available over all values
827 /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block:
828 /// <code>
829 /// [SourceTemplate]
830 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; xs) {
831 /// foreach (var x in xs) {
832 /// //$ $END$
833 /// }
834 /// }
835 /// </code>
836 /// </example>
837 [AttributeUsage(AttributeTargets.Method)]
838 public sealed class SourceTemplateAttribute : Attribute
839 {
840 }
841  
842 /// <summary>
843 /// Allows specifying a macro for a parameter of a <see cref="SourceTemplateAttribute">source template</see>.
844 /// </summary>
845 /// <remarks>
846 /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression
847 /// is defined in the <see cref="MacroAttribute.Expression" /> property. When applied on a method, the target
848 /// template parameter is defined in the <see cref="MacroAttribute.Target" /> property. To apply the macro silently
849 /// for the parameter, set the <see cref="MacroAttribute.Editable" /> property value = -1.
850 /// </remarks>
851 /// <example>
852 /// Applying the attribute on a source template method:
853 /// <code>
854 /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")]
855 /// public static void forEach&lt;T&gt;(this IEnumerable&lt;T&gt; collection) {
856 /// foreach (var item in collection) {
857 /// //$ $END$
858 /// }
859 /// }
860 /// </code>
861 /// Applying the attribute on a template method parameter:
862 /// <code>
863 /// [SourceTemplate]
864 /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) {
865 /// /*$ var $x$Id = "$newguid$" + x.ToString();
866 /// x.DoSomething($x$Id); */
867 /// }
868 /// </code>
869 /// </example>
870 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)]
871 public sealed class MacroAttribute : Attribute
872 {
873 /// <summary>
874 /// Allows specifying a macro that will be executed for a <see cref="SourceTemplateAttribute">source template</see>
875 /// parameter when the template is expanded.
876 /// </summary>
877 [CanBeNull]
878 public string Expression { get; set; }
879  
880 /// <summary>
881 /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed.
882 /// </summary>
883 /// <remarks>
884 /// If the target parameter is used several times in the template, only one occurrence becomes editable;
885 /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence,
886 /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1.
887 /// </remarks>
888 public int Editable { get; set; }
889  
890 /// <summary>
891 /// Identifies the target parameter of a <see cref="SourceTemplateAttribute">source template</see> if the
892 /// <see cref="MacroAttribute" /> is applied on a template method.
893 /// </summary>
894 [CanBeNull]
895 public string Target { get; set; }
896 }
897  
898 /// <summary>
899 /// Indicates how method, constructor invocation, or property access
900 /// over collection type affects the contents of the collection.
901 /// When applied to a return value of a method indicates if the returned collection
902 /// is created exclusively for the caller (CollectionAccessType.UpdatedContent) or
903 /// can be read/updated from outside (CollectionAccessType.Read | CollectionAccessType.UpdatedContent)
904 /// Use <see cref="CollectionAccessType" /> to specify the access type.
905 /// </summary>
906 /// <remarks>
907 /// Using this attribute only makes sense if all collection methods are marked with this attribute.
908 /// </remarks>
909 /// <example>
910 /// <code>
911 /// public class MyStringCollection : List&lt;string&gt;
912 /// {
913 /// [CollectionAccess(CollectionAccessType.Read)]
914 /// public string GetFirstString()
915 /// {
916 /// return this.ElementAt(0);
917 /// }
918 /// }
919 /// class Test
920 /// {
921 /// public void Foo()
922 /// {
923 /// // Warning: Contents of the collection is never updated
924 /// var col = new MyStringCollection();
925 /// string x = col.GetFirstString();
926 /// }
927 /// }
928 /// </code>
929 /// </example>
930 [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property |
931 AttributeTargets.ReturnValue)]
932 public sealed class CollectionAccessAttribute : Attribute
933 {
934 public CollectionAccessAttribute(CollectionAccessType collectionAccessType)
935 {
936 CollectionAccessType = collectionAccessType;
937 }
938  
939 public CollectionAccessType CollectionAccessType { get; }
940 }
941  
942 /// <summary>
943 /// Provides a value for the <see cref="CollectionAccessAttribute" /> to define
944 /// how the collection method invocation affects the contents of the collection.
945 /// </summary>
946 [Flags]
947 public enum CollectionAccessType
948 {
949 /// <summary>Method does not use or modify content of the collection.</summary>
950 None = 0,
951  
952 /// <summary>Method only reads content of the collection but does not modify it.</summary>
953 Read = 1,
954  
955 /// <summary>Method can change content of the collection but does not add new elements.</summary>
956 ModifyExistingContent = 2,
957  
958 /// <summary>Method can add new elements to the collection.</summary>
959 UpdatedContent = ModifyExistingContent | 4
960 }
961  
962 /// <summary>
963 /// Indicates that the marked method is assertion method, i.e. it halts the control flow if
964 /// one of the conditions is satisfied. To set the condition, mark one of the parameters with
965 /// <see cref="AssertionConditionAttribute" /> attribute.
966 /// </summary>
967 [AttributeUsage(AttributeTargets.Method)]
968 public sealed class AssertionMethodAttribute : Attribute
969 {
970 }
971  
972 /// <summary>
973 /// Indicates the condition parameter of the assertion method. The method itself should be
974 /// marked by <see cref="AssertionMethodAttribute" /> attribute. The mandatory argument of
975 /// the attribute is the assertion type.
976 /// </summary>
977 [AttributeUsage(AttributeTargets.Parameter)]
978 public sealed class AssertionConditionAttribute : Attribute
979 {
980 public AssertionConditionAttribute(AssertionConditionType conditionType)
981 {
982 ConditionType = conditionType;
983 }
984  
985 public AssertionConditionType ConditionType { get; }
986 }
987  
988 /// <summary>
989 /// Specifies assertion type. If the assertion method argument satisfies the condition,
990 /// then the execution continues. Otherwise, execution is assumed to be halted.
991 /// </summary>
992 public enum AssertionConditionType
993 {
994 /// <summary>Marked parameter should be evaluated to true.</summary>
995 IS_TRUE = 0,
996  
997 /// <summary>Marked parameter should be evaluated to false.</summary>
998 IS_FALSE = 1,
999  
1000 /// <summary>Marked parameter should be evaluated to null value.</summary>
1001 IS_NULL = 2,
1002  
1003 /// <summary>Marked parameter should be evaluated to not null value.</summary>
1004 IS_NOT_NULL = 3
1005 }
1006  
1007 /// <summary>
1008 /// Indicates that the marked method unconditionally terminates control flow execution.
1009 /// For example, it could unconditionally throw exception.
1010 /// </summary>
1011 [Obsolete("Use [ContractAnnotation('=> halt')] instead")]
1012 [AttributeUsage(AttributeTargets.Method)]
1013 public sealed class TerminatesProgramAttribute : Attribute
1014 {
1015 }
1016  
1017 /// <summary>
1018 /// Indicates that the method is a pure LINQ method, with postponed enumeration (like Enumerable.Select,
1019 /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters
1020 /// of delegate type by analyzing LINQ method chains.
1021 /// </summary>
1022 [AttributeUsage(AttributeTargets.Method)]
1023 public sealed class LinqTunnelAttribute : Attribute
1024 {
1025 }
1026  
1027 /// <summary>
1028 /// Indicates that IEnumerable passed as a parameter is not enumerated.
1029 /// Use this annotation to suppress the 'Possible multiple enumeration of IEnumerable' inspection.
1030 /// </summary>
1031 /// <example>
1032 /// <code>
1033 /// static void ThrowIfNull&lt;T&gt;([NoEnumeration] T v, string n) where T : class
1034 /// {
1035 /// // custom check for null but no enumeration
1036 /// }
1037 ///
1038 /// void Foo(IEnumerable&lt;string&gt; values)
1039 /// {
1040 /// ThrowIfNull(values, nameof(values));
1041 /// var x = values.ToList(); // No warnings about multiple enumeration
1042 /// }
1043 /// </code>
1044 /// </example>
1045 [AttributeUsage(AttributeTargets.Parameter)]
1046 public sealed class NoEnumerationAttribute : Attribute
1047 {
1048 }
1049  
1050 /// <summary>
1051 /// Indicates that the marked parameter, field, or property is a regular expression pattern.
1052 /// </summary>
1053 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1054 public sealed class RegexPatternAttribute : Attribute
1055 {
1056 }
1057  
1058 /// <summary>
1059 /// Language of injected code fragment inside marked by <see cref="LanguageInjectionAttribute" /> string literal.
1060 /// </summary>
1061 public enum InjectedLanguage
1062 {
1063 CSS,
1064  
1065 HTML,
1066  
1067 JAVASCRIPT,
1068  
1069 JSON,
1070  
1071 XML
1072 }
1073  
1074 /// <summary>
1075 /// Indicates that the marked parameter, field, or property is accepting a string literal
1076 /// containing code fragment in a language specified by the <see cref="InjectedLanguage" />.
1077 /// </summary>
1078 /// <example>
1079 /// <code>
1080 /// void Foo([LanguageInjection(InjectedLanguage.CSS, Prefix = "body{", Suffix = "}")] string cssProps)
1081 /// {
1082 /// // cssProps should only contains a list of CSS properties
1083 /// }
1084 /// </code>
1085 /// </example>
1086 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1087 public sealed class LanguageInjectionAttribute : Attribute
1088 {
1089 public LanguageInjectionAttribute(InjectedLanguage injectedLanguage)
1090 {
1091 InjectedLanguage = injectedLanguage;
1092 }
1093  
1094 /// <summary>Specify a language of injected code fragment.</summary>
1095 public InjectedLanguage InjectedLanguage { get; }
1096  
1097 /// <summary>Specify a string that "precedes" injected string literal.</summary>
1098 [CanBeNull]
1099 public string Prefix { get; set; }
1100  
1101 /// <summary>Specify a string that "follows" injected string literal.</summary>
1102 [CanBeNull]
1103 public string Suffix { get; set; }
1104 }
1105  
1106 /// <summary>
1107 /// Prevents the Member Reordering feature from tossing members of the marked class.
1108 /// </summary>
1109 /// <remarks>
1110 /// The attribute must be mentioned in your member reordering patterns.
1111 /// </remarks>
1112 [AttributeUsage(
1113 AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)]
1114 public sealed class NoReorderAttribute : Attribute
1115 {
1116 }
1117  
1118 /// <summary>
1119 /// <para>
1120 /// Defines the code search template using the Structural Search and Replace syntax.
1121 /// It allows you to find and, if necessary, replace blocks of code that match a specific pattern.
1122 /// Search and replace patterns consist of a textual part and placeholders.
1123 /// Textural part must contain only identifiers allowed in the target language and will be matched exactly (white
1124 /// spaces, tabulation characters, and line breaks are ignored).
1125 /// Placeholders allow matching variable parts of the target code blocks.
1126 /// A placeholder has the following format: $placeholder_name$- where placeholder_name is an arbitrary identifier.
1127 /// </para>
1128 /// <para>
1129 /// Available placeholders:
1130 /// <list type="bullet">
1131 /// <item>$this$ - expression of containing type</item>
1132 /// <item>$thisType$ - containing type</item>
1133 /// <item>$member$ - current member placeholder</item>
1134 /// <item>
1135 /// $qualifier$ - this placeholder is available in the replace pattern and can be used to insert qualifier
1136 /// expression matched by the $member$ placeholder.
1137 /// (Note that if $qualifier$ placeholder is used, then $member$ placeholder will match only qualified
1138 /// references)
1139 /// </item>
1140 /// <item>$expression$ - expression of any type</item>
1141 /// <item>$identifier$ - identifier placeholder</item>
1142 /// <item>$args$ - any number of arguments</item>
1143 /// <item>$arg$ - single argument</item>
1144 /// <item>$arg1$ ... $arg10$ - single argument</item>
1145 /// <item>$stmts$ - any number of statements</item>
1146 /// <item>$stmt$ - single statement</item>
1147 /// <item>$stmt1$ ... $stmt10$ - single statement</item>
1148 /// <item>$name{Expression, 'Namespace.FooType'}$ - expression with 'Namespace.FooType' type</item>
1149 /// <item>$expression{'Namespace.FooType'}$ - expression with 'Namespace.FooType' type</item>
1150 /// <item>$name{Type, 'Namespace.FooType'}$ - 'Namespace.FooType' type</item>
1151 /// <item>$type{'Namespace.FooType'}$ - 'Namespace.FooType' type</item>
1152 /// <item>$statement{1,2}$ - 1 or 2 statements</item>
1153 /// </list>
1154 /// </para>
1155 /// <para>
1156 /// Note that you can also define your own placeholders of the supported types and specify arguments for each
1157 /// placeholder type.
1158 /// This can be done using the following format: $name{type, arguments}$. Where 'name' - is the name of your
1159 /// placeholder,
1160 /// 'type' - is the type of your placeholder (one of the following: Expression, Type, Identifier, Statement,
1161 /// Argument, Member),
1162 /// 'arguments' - arguments list for your placeholder. Each placeholder type supports it's own arguments, check
1163 /// examples below for mode details.
1164 /// Placeholder type may be omitted and determined from the placeholder name, if name has one of the following
1165 /// prefixes:
1166 /// <list type="bullet">
1167 /// <item>expr, expression - expression placeholder, e.g. $exprPlaceholder{}$, $expressionFoo{}$</item>
1168 /// <item>arg, argument - argument placeholder, e.g. $argPlaceholder{}$, $argumentFoo{}$</item>
1169 /// <item>ident, identifier - identifier placeholder, e.g. $identPlaceholder{}$, $identifierFoo{}$</item>
1170 /// <item>stmt, statement - statement placeholder, e.g. $stmtPlaceholder{}$, $statementFoo{}$</item>
1171 /// <item>type - type placeholder, e.g. $typePlaceholder{}$, $typeFoo{}$</item>
1172 /// <item>member - member placeholder, e.g. $memberPlaceholder{}$, $memberFoo{}$</item>
1173 /// </list>
1174 /// </para>
1175 /// <para>
1176 /// Expression placeholder arguments:
1177 /// <list type="bullet">
1178 /// <item>
1179 /// expressionType - string value in single quotes, specifies full type name to match (empty string by
1180 /// default)
1181 /// </item>
1182 /// <item>exactType - boolean value, specifies if expression should have exact type match (false by default)</item>
1183 /// </list>
1184 /// Examples:
1185 /// <list type="bullet">
1186 /// <item>
1187 /// $myExpr{Expression, 'Namespace.FooType', true}$ - defines expression placeholder, matching
1188 /// expressions of the 'Namespace.FooType' type with exact matching.
1189 /// </item>
1190 /// <item>
1191 /// $myExpr{Expression, 'Namespace.FooType'}$ - defines expression placeholder, matching expressions of
1192 /// the 'Namespace.FooType' type or expressions which can be implicitly converted to 'Namespace.FooType'.
1193 /// </item>
1194 /// <item>$myExpr{Expression}$ - defines expression placeholder, matching expressions of any type.</item>
1195 /// <item>
1196 /// $exprFoo{'Namespace.FooType', true}$ - defines expression placeholder, matching expressions of the
1197 /// 'Namespace.FooType' type with exact matching.
1198 /// </item>
1199 /// </list>
1200 /// </para>
1201 /// <para>
1202 /// Type placeholder arguments:
1203 /// <list type="bullet">
1204 /// <item>type - string value in single quotes, specifies full type name to match (empty string by default)</item>
1205 /// <item>exactType - boolean value, specifies if expression should have exact type match (false by default)</item>
1206 /// </list>
1207 /// Examples:
1208 /// <list type="bullet">
1209 /// <item>
1210 /// $myType{Type, 'Namespace.FooType', true}$ - defines type placeholder, matching 'Namespace.FooType'
1211 /// types with exact matching.
1212 /// </item>
1213 /// <item>
1214 /// $myType{Type, 'Namespace.FooType'}$ - defines type placeholder, matching 'Namespace.FooType' types or
1215 /// types, which can be implicitly converted to 'Namespace.FooType'.
1216 /// </item>
1217 /// <item>$myType{Type}$ - defines type placeholder, matching any type.</item>
1218 /// <item>
1219 /// $typeFoo{'Namespace.FooType', true}$ - defines types placeholder, matching 'Namespace.FooType' types
1220 /// with exact matching.
1221 /// </item>
1222 /// </list>
1223 /// </para>
1224 /// <para>
1225 /// Identifier placeholder arguments:
1226 /// <list type="bullet">
1227 /// <item>
1228 /// nameRegex - string value in single quotes, specifies regex to use for matching (empty string by
1229 /// default)
1230 /// </item>
1231 /// <item>nameRegexCaseSensitive - boolean value, specifies if name regex is case sensitive (true by default)</item>
1232 /// <item>type - string value in single quotes, specifies full type name to match (empty string by default)</item>
1233 /// <item>exactType - boolean value, specifies if expression should have exact type match (false by default)</item>
1234 /// </list>
1235 /// Examples:
1236 /// <list type="bullet">
1237 /// <item>
1238 /// $myIdentifier{Identifier, 'my.*', false, 'Namespace.FooType', true}$ - defines identifier
1239 /// placeholder, matching identifiers (ignoring case) starting with 'my' prefix with 'Namespace.FooType'
1240 /// type.
1241 /// </item>
1242 /// <item>
1243 /// $myIdentifier{Identifier, 'my.*', true, 'Namespace.FooType', true}$ - defines identifier placeholder,
1244 /// matching identifiers (case sensitively) starting with 'my' prefix with 'Namespace.FooType' type.
1245 /// </item>
1246 /// <item>
1247 /// $identFoo{'my.*'}$ - defines identifier placeholder, matching identifiers (case sensitively) starting
1248 /// with 'my' prefix.
1249 /// </item>
1250 /// </list>
1251 /// </para>
1252 /// <para>
1253 /// Statement placeholder arguments:
1254 /// <list type="bullet">
1255 /// <item>minimalOccurrences - minimal number of statements to match (-1 by default)</item>
1256 /// <item>maximalOccurrences - maximal number of statements to match (-1 by default)</item>
1257 /// </list>
1258 /// Examples:
1259 /// <list type="bullet">
1260 /// <item>$myStmt{Statement, 1, 2}$ - defines statement placeholder, matching 1 or 2 statements.</item>
1261 /// <item>$myStmt{Statement}$ - defines statement placeholder, matching any number of statements.</item>
1262 /// <item>$stmtFoo{1, 2}$ - defines statement placeholder, matching 1 or 2 statements.</item>
1263 /// </list>
1264 /// </para>
1265 /// <para>
1266 /// Argument placeholder arguments:
1267 /// <list type="bullet">
1268 /// <item>minimalOccurrences - minimal number of arguments to match (-1 by default)</item>
1269 /// <item>maximalOccurrences - maximal number of arguments to match (-1 by default)</item>
1270 /// </list>
1271 /// Examples:
1272 /// <list type="bullet">
1273 /// <item>$myArg{Argument, 1, 2}$ - defines argument placeholder, matching 1 or 2 arguments.</item>
1274 /// <item>$myArg{Argument}$ - defines argument placeholder, matching any number of arguments.</item>
1275 /// <item>$argFoo{1, 2}$ - defines argument placeholder, matching 1 or 2 arguments.</item>
1276 /// </list>
1277 /// </para>
1278 /// <para>
1279 /// Member placeholder arguments:
1280 /// <list type="bullet">
1281 /// <item>
1282 /// docId - string value in single quotes, specifies XML documentation id of the member to match (empty
1283 /// by default)
1284 /// </item>
1285 /// </list>
1286 /// Examples:
1287 /// <list type="bullet">
1288 /// <item>
1289 /// $myMember{Member, 'M:System.String.IsNullOrEmpty(System.String)'}$ - defines member placeholder,
1290 /// matching 'IsNullOrEmpty' member of the 'System.String' type.
1291 /// </item>
1292 /// <item>
1293 /// $memberFoo{'M:System.String.IsNullOrEmpty(System.String)'}$ - defines member placeholder, matching
1294 /// 'IsNullOrEmpty' member of the 'System.String' type.
1295 /// </item>
1296 /// </list>
1297 /// </para>
1298 /// <para>
1299 /// For more information please refer to the
1300 /// <a href="https://www.jetbrains.com/help/resharper/Navigation_and_Search__Structural_Search_and_Replace.html">
1301 /// Structural
1302 /// Search and Replace
1303 /// </a>
1304 /// article.
1305 /// </para>
1306 /// </summary>
1307 [AttributeUsage(
1308 AttributeTargets.Method
1309 | AttributeTargets.Constructor
1310 | AttributeTargets.Property
1311 | AttributeTargets.Field
1312 | AttributeTargets.Event
1313 | AttributeTargets.Interface
1314 | AttributeTargets.Class
1315 | AttributeTargets.Struct
1316 | AttributeTargets.Enum,
1317 AllowMultiple = true,
1318 Inherited = false)]
1319 public sealed class CodeTemplateAttribute : Attribute
1320 {
1321 public CodeTemplateAttribute(string searchTemplate)
1322 {
1323 SearchTemplate = searchTemplate;
1324 }
1325  
1326 /// <summary>
1327 /// Structural search pattern to use in the code template.
1328 /// Pattern includes textual part, which must contain only identifiers allowed in the target language,
1329 /// and placeholders, which allow matching variable parts of the target code blocks.
1330 /// </summary>
1331 public string SearchTemplate { get; }
1332  
1333 /// <summary>
1334 /// Message to show when the search pattern was found.
1335 /// You can also prepend the message text with "Error:", "Warning:", "Suggestion:" or "Hint:" prefix to specify the
1336 /// pattern severity.
1337 /// Code patterns with replace template produce suggestions by default.
1338 /// However, if replace template is not provided, then warning severity will be used.
1339 /// </summary>
1340 public string Message { get; set; }
1341  
1342 /// <summary>
1343 /// Structural search replace pattern to use in code template replacement.
1344 /// </summary>
1345 public string ReplaceTemplate { get; set; }
1346  
1347 /// <summary>
1348 /// Replace message to show in the light bulb.
1349 /// </summary>
1350 public string ReplaceMessage { get; set; }
1351  
1352 /// <summary>
1353 /// Apply code formatting after code replacement.
1354 /// </summary>
1355 public bool FormatAfterReplace { get; set; } = true;
1356  
1357 /// <summary>
1358 /// Whether similar code blocks should be matched.
1359 /// </summary>
1360 public bool MatchSimilarConstructs { get; set; }
1361  
1362 /// <summary>
1363 /// Automatically insert namespace import directives or remove qualifiers that become redundant after the template is
1364 /// applied.
1365 /// </summary>
1366 public bool ShortenReferences { get; set; }
1367  
1368 /// <summary>
1369 /// String to use as a suppression key.
1370 /// By default the following suppression key is used 'CodeTemplate_SomeType_SomeMember',
1371 /// where 'SomeType' and 'SomeMember' are names of the associated containing type and member to which this attribute is
1372 /// applied.
1373 /// </summary>
1374 public string SuppressionKey { get; set; }
1375 }
1376  
1377 #region ASP.NET
1378  
1379 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
1380 public sealed class AspChildControlTypeAttribute : Attribute
1381 {
1382 public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType)
1383 {
1384 TagName = tagName;
1385 ControlType = controlType;
1386 }
1387  
1388 [NotNull]
1389 public string TagName { get; }
1390  
1391 [NotNull]
1392 public Type ControlType { get; }
1393 }
1394  
1395 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
1396 public sealed class AspDataFieldAttribute : Attribute
1397 {
1398 }
1399  
1400 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)]
1401 public sealed class AspDataFieldsAttribute : Attribute
1402 {
1403 }
1404  
1405 [AttributeUsage(AttributeTargets.Property)]
1406 public sealed class AspMethodPropertyAttribute : Attribute
1407 {
1408 }
1409  
1410 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
1411 public sealed class AspRequiredAttributeAttribute : Attribute
1412 {
1413 public AspRequiredAttributeAttribute([NotNull] string attribute)
1414 {
1415 Attribute = attribute;
1416 }
1417  
1418 [NotNull]
1419 public string Attribute { get; }
1420 }
1421  
1422 [AttributeUsage(AttributeTargets.Property)]
1423 public sealed class AspTypePropertyAttribute : Attribute
1424 {
1425 public AspTypePropertyAttribute(bool createConstructorReferences)
1426 {
1427 CreateConstructorReferences = createConstructorReferences;
1428 }
1429  
1430 public bool CreateConstructorReferences { get; }
1431 }
1432  
1433 #endregion
1434  
1435 #region ASP.NET MVC
1436  
1437 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1438 AllowMultiple = true)]
1439 public sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute
1440 {
1441 public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format)
1442 {
1443 Format = format;
1444 }
1445  
1446 [NotNull]
1447 public string Format { get; }
1448 }
1449  
1450 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1451 AllowMultiple = true)]
1452 public sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute
1453 {
1454 public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format)
1455 {
1456 Format = format;
1457 }
1458  
1459 [NotNull]
1460 public string Format { get; }
1461 }
1462  
1463 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1464 AllowMultiple = true)]
1465 public sealed class AspMvcAreaViewLocationFormatAttribute : Attribute
1466 {
1467 public AspMvcAreaViewLocationFormatAttribute([NotNull] string format)
1468 {
1469 Format = format;
1470 }
1471  
1472 [NotNull]
1473 public string Format { get; }
1474 }
1475  
1476 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1477 AllowMultiple = true)]
1478 public sealed class AspMvcMasterLocationFormatAttribute : Attribute
1479 {
1480 public AspMvcMasterLocationFormatAttribute([NotNull] string format)
1481 {
1482 Format = format;
1483 }
1484  
1485 [NotNull]
1486 public string Format { get; }
1487 }
1488  
1489 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1490 AllowMultiple = true)]
1491 public sealed class AspMvcPartialViewLocationFormatAttribute : Attribute
1492 {
1493 public AspMvcPartialViewLocationFormatAttribute([NotNull] string format)
1494 {
1495 Format = format;
1496 }
1497  
1498 [NotNull]
1499 public string Format { get; }
1500 }
1501  
1502 [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property,
1503 AllowMultiple = true)]
1504 public sealed class AspMvcViewLocationFormatAttribute : Attribute
1505 {
1506 public AspMvcViewLocationFormatAttribute([NotNull] string format)
1507 {
1508 Format = format;
1509 }
1510  
1511 [NotNull]
1512 public string Format { get; }
1513 }
1514  
1515 /// <summary>
1516 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1517 /// is an MVC action. If applied to a method, the MVC action name is calculated
1518 /// implicitly from the context. Use this attribute for custom wrappers similar to
1519 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
1520 /// </summary>
1521 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1522 AttributeTargets.Property)]
1523 public sealed class AspMvcActionAttribute : Attribute
1524 {
1525 public AspMvcActionAttribute()
1526 {
1527 }
1528  
1529 public AspMvcActionAttribute([NotNull] string anonymousProperty)
1530 {
1531 AnonymousProperty = anonymousProperty;
1532 }
1533  
1534 [CanBeNull]
1535 public string AnonymousProperty { get; }
1536 }
1537  
1538 /// <summary>
1539 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC area.
1540 /// Use this attribute for custom wrappers similar to
1541 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String)</c>.
1542 /// </summary>
1543 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1544 public sealed class AspMvcAreaAttribute : Attribute
1545 {
1546 public AspMvcAreaAttribute()
1547 {
1548 }
1549  
1550 public AspMvcAreaAttribute([NotNull] string anonymousProperty)
1551 {
1552 AnonymousProperty = anonymousProperty;
1553 }
1554  
1555 [CanBeNull]
1556 public string AnonymousProperty { get; }
1557 }
1558  
1559 /// <summary>
1560 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is
1561 /// an MVC controller. If applied to a method, the MVC controller name is calculated
1562 /// implicitly from the context. Use this attribute for custom wrappers similar to
1563 /// <c>System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String)</c>.
1564 /// </summary>
1565 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1566 AttributeTargets.Property)]
1567 public sealed class AspMvcControllerAttribute : Attribute
1568 {
1569 public AspMvcControllerAttribute()
1570 {
1571 }
1572  
1573 public AspMvcControllerAttribute([NotNull] string anonymousProperty)
1574 {
1575 AnonymousProperty = anonymousProperty;
1576 }
1577  
1578 [CanBeNull]
1579 public string AnonymousProperty { get; }
1580 }
1581  
1582 /// <summary>
1583 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC Master. Use this attribute
1584 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, String)</c>.
1585 /// </summary>
1586 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1587 public sealed class AspMvcMasterAttribute : Attribute
1588 {
1589 }
1590  
1591 /// <summary>
1592 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC model type. Use this attribute
1593 /// for custom wrappers similar to <c>System.Web.Mvc.Controller.View(String, Object)</c>.
1594 /// </summary>
1595 [AttributeUsage(AttributeTargets.Parameter)]
1596 public sealed class AspMvcModelTypeAttribute : Attribute
1597 {
1598 }
1599  
1600 /// <summary>
1601 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC
1602 /// partial view. If applied to a method, the MVC partial view name is calculated implicitly
1603 /// from the context. Use this attribute for custom wrappers similar to
1604 /// <c>System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String)</c>.
1605 /// </summary>
1606 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1607 AttributeTargets.Property)]
1608 public sealed class AspMvcPartialViewAttribute : Attribute
1609 {
1610 }
1611  
1612 /// <summary>
1613 /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method.
1614 /// </summary>
1615 [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
1616 public sealed class AspMvcSuppressViewErrorAttribute : Attribute
1617 {
1618 }
1619  
1620 /// <summary>
1621 /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template.
1622 /// Use this attribute for custom wrappers similar to
1623 /// <c>System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String)</c>.
1624 /// </summary>
1625 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1626 public sealed class AspMvcDisplayTemplateAttribute : Attribute
1627 {
1628 }
1629  
1630 /// <summary>
1631 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC editor template.
1632 /// Use this attribute for custom wrappers similar to
1633 /// <c>System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String)</c>.
1634 /// </summary>
1635 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1636 public sealed class AspMvcEditorTemplateAttribute : Attribute
1637 {
1638 }
1639  
1640 /// <summary>
1641 /// ASP.NET MVC attribute. Indicates that the marked parameter is an MVC template.
1642 /// Use this attribute for custom wrappers similar to
1643 /// <c>System.ComponentModel.DataAnnotations.UIHintAttribute(System.String)</c>.
1644 /// </summary>
1645 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1646 public sealed class AspMvcTemplateAttribute : Attribute
1647 {
1648 }
1649  
1650 /// <summary>
1651 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1652 /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly
1653 /// from the context. Use this attribute for custom wrappers similar to
1654 /// <c>System.Web.Mvc.Controller.View(Object)</c>.
1655 /// </summary>
1656 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1657 AttributeTargets.Property)]
1658 public sealed class AspMvcViewAttribute : Attribute
1659 {
1660 }
1661  
1662 /// <summary>
1663 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1664 /// is an MVC view component name.
1665 /// </summary>
1666 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1667 public sealed class AspMvcViewComponentAttribute : Attribute
1668 {
1669 }
1670  
1671 /// <summary>
1672 /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter
1673 /// is an MVC view component view. If applied to a method, the MVC view component view name is default.
1674 /// </summary>
1675 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method | AttributeTargets.Field |
1676 AttributeTargets.Property)]
1677 public sealed class AspMvcViewComponentViewAttribute : Attribute
1678 {
1679 }
1680  
1681 /// <summary>
1682 /// ASP.NET MVC attribute. When applied to a parameter of an attribute,
1683 /// indicates that this parameter is an MVC action name.
1684 /// </summary>
1685 /// <example>
1686 /// <code>
1687 /// [ActionName("Foo")]
1688 /// public ActionResult Login(string returnUrl) {
1689 /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK
1690 /// return RedirectToAction("Bar"); // Error: Cannot resolve action
1691 /// }
1692 /// </code>
1693 /// </example>
1694 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]
1695 public sealed class AspMvcActionSelectorAttribute : Attribute
1696 {
1697 }
1698  
1699 #endregion
1700  
1701 #region ASP.NET Routing
1702  
1703 /// <summary>
1704 /// Indicates that the marked parameter, field, or property is a route template.
1705 /// </summary>
1706 /// <remarks>
1707 /// This attribute allows IDE to recognize the use of web frameworks' route templates
1708 /// to enable syntax highlighting, code completion, navigation, rename and other features in string literals.
1709 /// </remarks>
1710 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1711 public sealed class RouteTemplateAttribute : Attribute
1712 {
1713 }
1714  
1715 /// <summary>
1716 /// Indicates that the marked type is custom route parameter constraint,
1717 /// which is registered in application's Startup with name <c>ConstraintName</c>
1718 /// </summary>
1719 /// <remarks>
1720 /// You can specify <c>ProposedType</c> if target constraint matches only route parameters of specific type,
1721 /// it will allow IDE to create method's parameter from usage in route template
1722 /// with specified type instead of default <c>System.String</c>
1723 /// and check if constraint's proposed type conflicts with matched parameter's type
1724 /// </remarks>
1725 [AttributeUsage(AttributeTargets.Class)]
1726 public sealed class RouteParameterConstraintAttribute : Attribute
1727 {
1728 public RouteParameterConstraintAttribute([NotNull] string constraintName)
1729 {
1730 ConstraintName = constraintName;
1731 }
1732  
1733 [NotNull]
1734 public string ConstraintName { get; }
1735  
1736 [CanBeNull]
1737 public Type ProposedType { get; set; }
1738 }
1739  
1740 /// <summary>
1741 /// Indicates that the marked parameter, field, or property is an URI string.
1742 /// </summary>
1743 /// <remarks>
1744 /// This attribute enables code completion, navigation, rename and other features
1745 /// in URI string literals assigned to annotated parameter, field or property.
1746 /// </remarks>
1747 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1748 public sealed class UriStringAttribute : Attribute
1749 {
1750 public UriStringAttribute()
1751 {
1752 }
1753  
1754 public UriStringAttribute(string httpVerb)
1755 {
1756 HttpVerb = httpVerb;
1757 }
1758  
1759 [CanBeNull]
1760 public string HttpVerb { get; }
1761 }
1762  
1763 /// <summary>
1764 /// Indicates that the marked method declares routing convention for ASP.NET
1765 /// </summary>
1766 /// <remarks>
1767 /// IDE will analyze all usages of methods marked with this attribute,
1768 /// and will add all routes to completion, navigation and other features over URI strings
1769 /// </remarks>
1770 [AttributeUsage(AttributeTargets.Method)]
1771 public sealed class AspRouteConventionAttribute : Attribute
1772 {
1773 public AspRouteConventionAttribute()
1774 {
1775 }
1776  
1777 public AspRouteConventionAttribute(string predefinedPattern)
1778 {
1779 PredefinedPattern = predefinedPattern;
1780 }
1781  
1782 [CanBeNull]
1783 public string PredefinedPattern { get; }
1784 }
1785  
1786 /// <summary>
1787 /// Indicates that the marked method parameter contains default route values of routing convention for ASP.NET
1788 /// </summary>
1789 [AttributeUsage(AttributeTargets.Parameter)]
1790 public sealed class AspDefaultRouteValuesAttribute : Attribute
1791 {
1792 }
1793  
1794 /// <summary>
1795 /// Indicates that the marked method parameter contains constraints on route values of routing convention for ASP.NET
1796 /// </summary>
1797 [AttributeUsage(AttributeTargets.Parameter)]
1798 public sealed class AspRouteValuesConstraintsAttribute : Attribute
1799 {
1800 }
1801  
1802 /// <summary>
1803 /// Indicates that the marked parameter or property contains routing order provided by ASP.NET routing attribute
1804 /// </summary>
1805 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
1806 public sealed class AspRouteOrderAttribute : Attribute
1807 {
1808 }
1809  
1810 /// <summary>
1811 /// Indicates that the marked parameter or property contains HTTP verbs provided by ASP.NET routing attribute
1812 /// </summary>
1813 [AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
1814 public sealed class AspRouteVerbsAttribute : Attribute
1815 {
1816 }
1817  
1818 /// <summary>
1819 /// Indicates that the marked attribute is used for attribute routing in ASP.NET
1820 /// </summary>
1821 /// <remarks>
1822 /// IDE will analyze all usages of attributes marked with this attribute,
1823 /// and will add all routes to completion, navigation and other features over URI strings
1824 /// </remarks>
1825 [AttributeUsage(AttributeTargets.Class)]
1826 public sealed class AspAttributeRoutingAttribute : Attribute
1827 {
1828 public string HttpVerb { get; set; }
1829 }
1830  
1831 /// <summary>
1832 /// Indicates that the marked method declares ASP.NET Minimal API endpoint
1833 /// </summary>
1834 /// <remarks>
1835 /// IDE will analyze all usages of methods marked with this attribute,
1836 /// and will add all routes to completion, navigation and other features over URI strings
1837 /// </remarks>
1838 [AttributeUsage(AttributeTargets.Method)]
1839 public sealed class AspMinimalApiDeclarationAttribute : Attribute
1840 {
1841 public string HttpVerb { get; set; }
1842 }
1843  
1844 /// <summary>
1845 /// Indicates that the marked parameter contains ASP.NET Minimal API endpoint handler
1846 /// </summary>
1847 [AttributeUsage(AttributeTargets.Parameter)]
1848 public sealed class AspMinimalApiHandlerAttribute : Attribute
1849 {
1850 }
1851  
1852 #endregion
1853  
1854 #region Razor
1855  
1856 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)]
1857 public sealed class HtmlElementAttributesAttribute : Attribute
1858 {
1859 public HtmlElementAttributesAttribute()
1860 {
1861 }
1862  
1863 public HtmlElementAttributesAttribute([NotNull] string name)
1864 {
1865 Name = name;
1866 }
1867  
1868 [CanBeNull]
1869 public string Name { get; }
1870 }
1871  
1872 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)]
1873 public sealed class HtmlAttributeValueAttribute : Attribute
1874 {
1875 public HtmlAttributeValueAttribute([NotNull] string name)
1876 {
1877 Name = name;
1878 }
1879  
1880 [NotNull]
1881 public string Name { get; }
1882 }
1883  
1884 /// <summary>
1885 /// Razor attribute. Indicates that the marked parameter or method is a Razor section.
1886 /// Use this attribute for custom wrappers similar to
1887 /// <c>System.Web.WebPages.WebPageBase.RenderSection(String)</c>.
1888 /// </summary>
1889 [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)]
1890 public sealed class RazorSectionAttribute : Attribute
1891 {
1892 }
1893  
1894 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1895 public sealed class RazorImportNamespaceAttribute : Attribute
1896 {
1897 public RazorImportNamespaceAttribute([NotNull] string name)
1898 {
1899 Name = name;
1900 }
1901  
1902 [NotNull]
1903 public string Name { get; }
1904 }
1905  
1906 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1907 public sealed class RazorInjectionAttribute : Attribute
1908 {
1909 public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName)
1910 {
1911 Type = type;
1912 FieldName = fieldName;
1913 }
1914  
1915 [NotNull]
1916 public string Type { get; }
1917  
1918 [NotNull]
1919 public string FieldName { get; }
1920 }
1921  
1922 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1923 public sealed class RazorDirectiveAttribute : Attribute
1924 {
1925 public RazorDirectiveAttribute([NotNull] string directive)
1926 {
1927 Directive = directive;
1928 }
1929  
1930 [NotNull]
1931 public string Directive { get; }
1932 }
1933  
1934 [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
1935 public sealed class RazorPageBaseTypeAttribute : Attribute
1936 {
1937 public RazorPageBaseTypeAttribute([NotNull] string baseType)
1938 {
1939 BaseType = baseType;
1940 }
1941  
1942 public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName)
1943 {
1944 BaseType = baseType;
1945 PageName = pageName;
1946 }
1947  
1948 [NotNull]
1949 public string BaseType { get; }
1950  
1951 [CanBeNull]
1952 public string PageName { get; }
1953 }
1954  
1955 [AttributeUsage(AttributeTargets.Method)]
1956 public sealed class RazorHelperCommonAttribute : Attribute
1957 {
1958 }
1959  
1960 [AttributeUsage(AttributeTargets.Property)]
1961 public sealed class RazorLayoutAttribute : Attribute
1962 {
1963 }
1964  
1965 [AttributeUsage(AttributeTargets.Method)]
1966 public sealed class RazorWriteLiteralMethodAttribute : Attribute
1967 {
1968 }
1969  
1970 [AttributeUsage(AttributeTargets.Method)]
1971 public sealed class RazorWriteMethodAttribute : Attribute
1972 {
1973 }
1974  
1975 [AttributeUsage(AttributeTargets.Parameter)]
1976 public sealed class RazorWriteMethodParameterAttribute : Attribute
1977 {
1978 }
1979  
1980 #endregion
1981  
1982 #region XAML
1983  
1984 /// <summary>
1985 /// XAML attribute. Indicates the type that has <c>ItemsSource</c> property and should be treated
1986 /// as <c>ItemsControl</c>-derived type, to enable inner items <c>DataContext</c> type resolve.
1987 /// </summary>
1988 [AttributeUsage(AttributeTargets.Class)]
1989 public sealed class XamlItemsControlAttribute : Attribute
1990 {
1991 }
1992  
1993 /// <summary>
1994 /// XAML attribute. Indicates the property of some <c>BindingBase</c>-derived type, that
1995 /// is used to bind some item of <c>ItemsControl</c>-derived type. This annotation will
1996 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
1997 /// </summary>
1998 /// <remarks>
1999 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or
2000 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute.
2001 /// </remarks>
2002 [AttributeUsage(AttributeTargets.Property)]
2003 public sealed class XamlItemBindingOfItemsControlAttribute : Attribute
2004 {
2005 }
2006  
2007 /// <summary>
2008 /// XAML attribute. Indicates the property of some <c>Style</c>-derived type, that
2009 /// is used to style items of <c>ItemsControl</c>-derived type. This annotation will
2010 /// enable the <c>DataContext</c> type resolve for XAML bindings for such properties.
2011 /// </summary>
2012 /// <remarks>
2013 /// Property should have the tree ancestor of the <c>ItemsControl</c> type or
2014 /// marked with the <see cref="XamlItemsControlAttribute" /> attribute.
2015 /// </remarks>
2016 [AttributeUsage(AttributeTargets.Property)]
2017 public sealed class XamlItemStyleOfItemsControlAttribute : Attribute
2018 {
2019 }
2020  
2021 /// <summary>
2022 /// XAML attribute. Indicates that DependencyProperty has <c>OneWay</c> binding mode by default.
2023 /// </summary>
2024 /// <remarks>
2025 /// This attribute must be applied to DependencyProperty's CLR accessor property if it is present, to
2026 /// DependencyProperty descriptor field otherwise.
2027 /// </remarks>
2028 [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
2029 public sealed class XamlOneWayBindingModeByDefaultAttribute : Attribute
2030 {
2031 }
2032  
2033 /// <summary>
2034 /// XAML attribute. Indicates that DependencyProperty has <c>TwoWay</c> binding mode by default.
2035 /// </summary>
2036 /// <remarks>
2037 /// This attribute must be applied to DependencyProperty's CLR accessor property if it is present, to
2038 /// DependencyProperty descriptor field otherwise.
2039 /// </remarks>
2040 [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
2041 public sealed class XamlTwoWayBindingModeByDefaultAttribute : Attribute
2042 {
2043 }
2044  
2045 #endregion
2046 }