Winify – Blame information for rev 38

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