Namespace: ArkaneSystems.Arkane.Annotations
The ArkaneSystems.Arkane.Annotations namespace provides attributes that communicate intent to static analysis tools such as Roslyn analyzers, ReSharper, or Rider. They have no effect at runtime.
[AttributeUsage(AttributeTargets.All, Inherited = false)]
public sealed class PublicAPIAttribute : AttributeMarks a type or member as part of the library's intentional public API. Any symbol tagged [PublicAPI] will not be reported as unused by static analysis, even if no internal references to it exist within the same assembly.
[PublicAPI]
public class MyLibraryClass { ... }
[PublicAPI("Consumed by the external plugin system")]
public static void RegisterPlugin(IPlugin plugin) { ... }An optional Comment string can explain why the member is considered public API.
| Property | Type | Description |
|---|---|---|
Comment |
string |
Optional explanation of why this is public API |
[AttributeUsage(AttributeTargets.All)]
public sealed class UsedImplicitlyAttribute : AttributeMarks a symbol as being used implicitly — for example via reflection, a dependency injection container, or an external framework — so that static analysis tools do not report it as unused.
// A class instantiated by a DI container
[UsedImplicitly]
public class MyService { }
// A constructor called by a serialiser with a fixed signature
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature)]
public MyService(ILogger logger) { }
// An interface whose implementors are all considered used
[UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)]
public interface IHandler { }| Property | Type | Description |
|---|---|---|
UseKindFlags |
ImplicitUseKindFlags |
How the symbol is implicitly used |
TargetFlags |
ImplicitUseTargetFlags |
Which parts of the symbol are considered used |
Reason |
string |
Optional explanation |
[AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter | AttributeTargets.Parameter)]
public sealed class MeansImplicitUseAttribute : AttributeApplied to a custom attribute class to make that attribute behave like [UsedImplicitly]. Any symbol decorated with the custom attribute will be treated as implicitly used.
This is how PublicAPIAttribute itself works — it is decorated with [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)], which means every type or member tagged [PublicAPI] is automatically treated as used along with all of its members.
// All members of types decorated with [MyFrameworkComponent] will be treated as used
[MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)]
public sealed class MyFrameworkComponentAttribute : Attribute { }| Property | Type | Description |
|---|---|---|
UseKindFlags |
ImplicitUseKindFlags |
How decorated symbols are considered used |
TargetFlags |
ImplicitUseTargetFlags |
Which parts of decorated symbols are considered used |
Specifies how a symbol is considered to be implicitly used.
| Value | Description |
|---|---|
Default |
Equivalent to Access | Assign | InstantiatedWithFixedConstructorSignature |
Access |
The symbol is read or accessed implicitly |
Assign |
The symbol is assigned implicitly |
InstantiatedWithFixedConstructorSignature |
The type is instantiated with a specific constructor; unused constructor parameters are suppressed |
InstantiatedNoFixedConstructorSignature |
The type is instantiated implicitly with no fixed constructor signature |
Specifies which parts of a symbol are considered used.
| Value | Description |
|---|---|
Default |
Equivalent to Itself |
Itself |
Only the symbol itself is considered used |
Members |
The symbol's members are considered used |
WithInheritors |
Inheriting or implementing types are considered used |
WithMembers |
The symbol and all its members are considered used (Itself | Members) |