Open sandboxFocusImprove this doc

Aspect Errors and Warnings

Messages about aspects: applying aspects to code, multicasting, aspect classes and their advices, introductions, aspect dependencies, and the code that PostSharp generates.

Message Severity Description
LA0001 Error A field of an aspect holds an object that PostSharp cannot serialize.
LA0004 Error An aspect introduces an interface that the target type already implements.
LA0005 Error An aspect introduces an interface whose base interface the target type already implements.
LA0013 Error An aspect class is a private or protected nested class.
LA0014 Error The constructor or a property setter of an aspect throws an exception at build time.
LA0016 Error A composition aspect is applied to an interface, which cannot hold an implementation.
LA0021 Error The serializer type configured for an aspect is not derived from AspectSerializer.
LA0022 Error The serializer type configured for an aspect has no public parameterless constructor.
LA0030 Error An introduced custom attribute has an argument whose value custom attribute metadata cannot store.
LA0031 Error An aspect provider adds an aspect to a property or an event that is not declared in the current assembly.
LA0032 Error An aspect provider adds an aspect to a parameter of a method that PostSharp cannot find.
LA0033 Error An aspect provider adds an aspect to a type, method or field that PostSharp cannot find.
LA0035 Error An aspect provider adds an aspect that is not serialized as an instance instead of a construction.
LA0036 Warning An aspect comes from an assembly that was built without PostSharp.
LA0037 Error A composition aspect introduces a class or another type that is not an interface.
LA0042 Error AspectUtilities.InitializeCurrentAspects is called from a static method.
LA0045 Error AspectUtilities.InitializeCurrentAspects must call an InitializeAspects method that a base class declares as private.
LA0047 Error An aspect uses a custom advice type, derived from Advice or AdviceInstance, that PostSharp cannot weave.
LA0048 Error An advice uses a custom pointcut type, derived from Pointcut, that PostSharp cannot evaluate.
LA0049 Error An advice without pointcut does not accept the kind of declaration to which the aspect is applied.
LA0059 Error A group of advices contains two advices of the same kind, such as two entry advices.
LA0060 Error An aspect introduces a member that the target type already defines.
LA0061 Error An aspect overrides a member of a base type that is not virtual or is sealed.
LA0063 Error An aspect overrides a property that has the same name but a different type.
LA0064 Error An aspect overrides an event that has the same name but a different delegate type.
LA0065 Error An aspect uses a dependency custom attribute derived from AspectDependencyAttribute that PostSharp does not support.
LA0066 Error A custom attribute derives from RequiresAdviceAnalysisAttribute, an infrastructure class of PostSharp.
LA0067 Error A dependency custom attribute on an advice method targets the declaring type.
LA0068 Error An aspect introduces an interface that the aspect class does not implement.
LA0069 Error An aspect that has a single instance for the whole target introduces an interface.
LA0070 Error An aspect overrides a method that the target type or a base type defines as static.
LA0071 Error An aspect replaces a method whose virtuality differs from the IsVirtual property of the introduction.
LA0072 Error An aspect overrides a method whose visibility differs from the visibility of the introduction.
LA0073 Error An aspect copies a custom attribute to a member that already has an attribute of the same type.
LA0074 Error A field of an aspect that imports a member of the target class has an unsupported type.
LA0075 Error An aspect requires a method of the target class that does not exist with the signature of the delegate field.
LA0078 Error A field of an aspect that imports a member of the target class is static.
LA0079 Error An aspect that imports members of the target class has one instance per class instead of one per object.
LA0080 Error An aspect requires a property of the target class that does not exist.
LA0081 Error The type argument of a Property field of an aspect differs from the type of the imported property.
LA0082 Error An aspect requires an event of the target class that does not exist.
LA0083 Error The type argument of an Event field differs from the delegate type of the imported event.
LA0084 Error An advice attribute that applies to methods is on a class, a property or another declaration of the aspect.
LA0085 Error The parameters or the return type of an advice method do not match the signature that its advice requires.
LA0086 Error The Master property of an advice names no advice method of the aspect.
LA0087 Error A method, field or other member of an aspect that carries an advice attribute is not public.
LA0088 Error An aspect applied to the assembly contains an advice that needs a target type.
LA0089 Error An aspect introduces an indexer whose name differs from the indexers of the target type.
LA0099 Error An aspect provider adds an aspect to a kind of declaration that the aspect does not support.
LA0101 Error The method named by a MethodPointcut does not exist or does not have the signature of a pointcut method.
LA0102 Error Several overloads of the method named by a MethodPointcut have the signature of a pointcut method.
LA0103 Error A pointcut method returns a property or an event that PostSharp cannot find.
LA0104 Error A pointcut method returns a parameter of an indexer or another parameter that PostSharp cannot find.
LA0105 Error A pointcut method returns a type, method or field that PostSharp cannot find.
LA0106 Error A pointcut method returns an object that is not a declaration, such as a string.
LA0107 Error The pointcut of an instance advice of an instance-scoped aspect selects a static member.
LA0108 Warning An advice passes its arguments to a virtual method or to a method of another assembly, which disables its optimizations.
LA0109 Error A method pointcut selects a member of a generic type instance or a generic method instance.
LA0110 Error A method pointcut of an instance-scoped aspect selects a member of another type than the target of the aspect.
LA0111 Error An aspect serializes a FieldInfo, which can become invalid when the weaver turns the field into a property.
LA0112 Error An instance-scoped aspect is applied to a member of a struct.
LA0113 Error A method interception aspect is applied to an instance constructor.
LA0114 Error A method interception aspect is applied to a static constructor.
LA0115 Error An aspect dependency applied to the assembly does not name the aspect to which it applies.
LA0116 Warning An aspect provider adds a location interception aspect to a const field.
LA0117 Error An aspect provider describes an aspect with arguments that do not match the aspect class.
LA0118 Error An aspect class has no [PSerializable] attribute, on a target framework without binary serialization.
LA0119 Error An aspect class has neither [PSerializable] nor another serializer.
LA0121 Error A validation aspect has no ValidateValue method for the type of the location it is applied to.
LA0126 Error An aspect that enhances the body of a method targets an abstract method or one of its parameters.
LA0127 Error A location validation aspect is applied to a const field.
LA0130 Error An aspect that enhances the body of a method targets an interface method without a default implementation.
LA0131 Error An aspect serialized with BinaryFormatter holds a reflection object that cannot be emitted.
LA0132 Error An aspect class and its base class define advice methods of the same name.
LA0133 Error A type-level aspect is applied to the special type.
LA0136 Error A location validation aspect is applied to a property that has no setter.
LA0137 Error An advice provided dynamically refers to a field or method that does not belong to the aspect.
LA0138 Error An import advice provided dynamically designates a field or property of another class than the target class.
LA0139 Error An aspect imports a field or an event of the target class into a field that can only receive a property.
LA0140 Error The aspect field of an import advice provided dynamically has an unsupported type.
LA0142 Error An advice method that runs after the construction of an instance does not return void.
LA0143 Error An aspect initialization advice does not have the signature void Method(AspectInitializationReason).
LA0144 Error An advice method returns a value, but its advice requires void.
LA0148 Error An aspect role dependency names a null or empty role.
LA0149 Error A [Serializable] aspect has a delegate field that is not marked as [NonSerialized].
LA0151 Error A parameter of an advice has a binding attribute that this kind of advice does not accept.
LA0152 Error An [Awaiter] parameter is passed by value, or its type does not implement INotifyCompletion.
LA0153 Error Two advices of the same group have [Awaiter] parameters of different types.
LA0154 Warning An entry or resume advice of an async method has a [FlowBehavior] parameter but no [Awaiter] parameter.
LA0155 Error A [FlowBehavior] parameter is passed by value, or is not of type FlowBehavior.
LA0157 Error An aspect with the PSerializable attribute comes from an assembly that PostSharp has not processed.
LA0158 Error An aspect validates the values of a property that has no setter.
LA0160 Error Aspect providers provide each other, so that the discovery of aspects never ends.
LA0161 Warning A type has an internal attribute of PostSharp that requests a debugger enhancement that no plug-in supports.
LA0162 Error A field of an aspect imports a member of the target class without naming it.
LA0163 Error An instance-scoped aspect is applied to a member declared in another assembly.
LA0164 Error A method interception aspect is applied to a method that returns by reference.
LA0165 Error An advice method marked with OnMethodInvokeAsyncAdvice does not return Task.
LA0166 Error A method interception aspect with OnInvokeAsync is applied to a method that does not return Task or Task.
LA0167 Error An aspect is applied to a local function, an anonymous method or another compiler-generated declaration.
LA0171 Error A method interception aspect asks for a fallback to OnInvoke but does not override OnInvoke.
LA0172 Error An async interception advice is applied to a method that does not return Task or Task.
LA0173 Error An async interception advice asks for a fallback, but its group has no non-async interception advice.
LA0174 Error A method boundary or exception aspect is applied to a non-async method whose task or enumerable it cannot wrap.
LA0175 Error A method boundary advice is applied to a non-async method whose task or enumerable it cannot wrap.
LA0179 Error An OnMethodBoundaryAspect or OnExceptionAspect targets an instance constructor of another assembly.
LA0180 Error An OnMethodBoundaryAspect or OnExceptionAspect targets a static constructor of another assembly.
LA0181 Error A method boundary advice targets an instance constructor of another assembly.
LA0182 Error A method boundary advice targets a static constructor of another assembly.
LA0183 Warning An aspect enhances a virtual method of another assembly, which may not behave as expected.
LA0184 Warning A method-level advice is applied to a virtual method of a referenced assembly.
LA0185 Warning A method interception aspect without OnInvokeAsync is applied to an async method.
LA0186 Warning An OnMethodInvokeAdvice advice without an async counterpart is applied to an async method.
LA0187 Error An aspect must advise a method returning a task semantically, but the target framework has no async support.
LA0188 Error An advice must advise a method returning a task semantically, but the target framework has no async support.
LA0189 Error A ref or out parameter of an advice is bound to an in parameter of the target method.
LA0190 Error An aspect is applied to a declaration that is in, or uses, a ref struct such as Span<T>.
LA0191 Error An instance-scoped aspect is applied to an interface or to a member of an interface.
LA0192 Error An introduced method replaces an existing method whose parameter differs by the in modifier.
LA0193 Error The type name of a custom attribute to introduce does not include the name of its assembly.
LA0194 Error An aspect implements the IAspect interface of another version of the PostSharp assembly.
LA0195 Error An event interception aspect or advice targets an instance event of an interface.
LA0196 Error An aspect requires semantic advising that PostSharp does not support for async iterator methods.
LA0197 Error A group of advices requires semantic advising that PostSharp does not support for async iterator methods.
LA0200 Warning An aspect is applied to an aspect class or to one of its members, and is ignored.
LA0201 Error An introduced member carries an internal attribute into another assembly.
LA0202 Error An introduced method has an in parameter, and the target assembly has no IsReadOnlyAttribute.
LA0204 Error An aspect targets a field, property or parameter of function pointer type.
LA0206 Error An aspect class has [Serializable] instead of [PSerializable].
LA0207 Error A parameter of an advice method has more than one advice parameter attribute.
LA0208 Error A parameter of an advice has no binding attribute, so PostSharp does not know which value to pass.
LA0209 Error A parameter of an advice has a binding attribute, but this kind of advice accepts no bound parameters.
LA0210 Error A parameter of an advice has a binding attribute derived by the application from AdviceParameterAttribute.
LA0211 Error The type of a bound advice parameter cannot receive the value of its binding attribute.
LA0212 Error A [ReturnValue] parameter is passed by value in an advice that can only set the return value.
LA0213 Error A bound parameter of an advice is passed by reference, but its binding accepts only parameters passed by value.
LA0214 Error An advice has two parameters bound to the exception or to the return value.
LA0215 Error Two advices bind the same state variable with parameters of different types.
LA0216 Error An advice parameter selects an argument by a negative index.
LA0217 Error The type of a bound advice parameter cannot receive the value of one of the targets.
LA0218 Error An advice that requires the instance of its target is applied to a static member.
LA0219 Error An advice that requires an async call identifier is applied to a method that is not async.
LA0220 Error A type argument of a generic advice cannot be inferred for a target, or violates a constraint.
LA0221 Error A method interception advice has no way to set the return value of the intercepted method.
LA0222 Error An advice binds by reference an argument that PostSharp stores in an array.
LA0223 Error A [This] parameter passed by reference applies to a member of a class instead of a struct.
LA0224 Error An instance constructed advice binds a constructor argument or another value that it does not have.
LA0225 Error An advice binds an argument by an index that the target method does not have.
LA0226 Error An advice binds an argument by a name that the target method does not have.
LA0227 Error An advice binds an argument by its type, but the target method has no parameter of this type.
LA0228 Error An argument selected by its type matches several parameters of the target method.
LA0229 Error An advice parameter bound to the name of the target is not of type string.
LA0230 Error An advice without Group or pointcut could join several groups of its class.
LA0231 Error Two advices of one group set a group property to different values.
LA0233 Warning A [FlowBehavior] or [Arguments] parameter is used in an advice that ignores it.
LA0234 Warning An advice sets the flow behavior both through MethodExecutionArgs and a [FlowBehavior] parameter.
LA0235 Warning A method interception advice writes an argument through an out or ref [Argument] parameter.
LA0236 Warning An advice has several [FlowBehavior] or [Awaiter] parameters.
LA0237 Error A get advice of a field or property has no parameter that gives the value of the location.
LA0238 Error A yield advice that reads the awaited task or method is applied to a method that is not async.
LA0239 Error An advice requires the current task of a method that cannot provide it.
LA0240 Warning A [CurrentTask] parameter is always null because the method is implemented with runtime async.
LA0241 Error An advice requires the return value of a method that has none the advice can access.
LA0242 Error The current task is required in an advice that can run before the method yields.
LA0243 Warning A method boundary advice sets the return value both through an out or ref [ReturnValue] parameter and through MethodExecutionArgs.
LA0244 Error A resume advice requires the current task, but the entry advice of its group can make it run before the task exists.
LA0245 Warning A type parameter of a generic advice method is not used by any bound parameter, so it is always object.
LA0246 Error A [Declaration] parameter is of a type that cannot receive the reflection object of the target.
LA0247 Error An [Exception] parameter is of a type other than Exception, such as a derived exception type.
LA0248 Warning An exception advice has both a MethodExecutionArgs parameter and an out or ref [Exception] parameter.
LA0249 Warning An aspect requests the native code of a type that cannot be instantiated.
LA0250 Warning An OnYield or OnResume advice is applied to an async method, and the project does not set PostSharpCompatibilityLevel.
LA0251 Error An advice uses MatchPointcut, but its aspect is applied to a declaration that is not a type.
LA0252 Error The CompileTimeValidate method of an aspect throws an InvalidAnnotationException.
LA0253 Error A location-level aspect is applied to an extension property of a C# 14 extension block.
LA0254 Warning A method interception advice is applied to an abstract method, whose overrides are not intercepted.
LA0255 Warning The Group property of an advice selects the group that PostSharp infers anyway.
LA0257 Warning Two groups of advices of the same family both apply to the target of the aspect.
LA0258 Error An advice sets both the Group property and the obsolete Master property.
LA0259 Error Two advices of one group each have a pointcut.
LA0260 Error A required [ImportMember] parameter selects a member by its type, but the target type has no member of this type.
LA0261 Error An advice imports a field by reference after another aspect has turned the field into a property.
LA0262 Error An advice imports a field of a struct by reference in an async method or an iterator.
LA0263 Error A required [ImportMember] delegate parameter names a method that does not convert to the delegate type.
LA0264 Error Several overloads convert to the delegate type of an [ImportMember] parameter, and none is more specific.
LA0265 Error An advice requires a method of the target type as an IMethodBinding, but the type has no suitable method of this name.
LA0266 Error An advice imports a method as an IMethodBinding, but the target type has several methods of this name.
LA0267 Error An advice imports a property as Property or an event as Event, but it is not an instance advice of an instance-scoped aspect.
LA0268 Error An aspect attempts to introduce a field in an interface, an enum, a delegate or an assembly.
LA0269 Error An aspect attempts to introduce a field of a type that a field cannot have.
LA0270 Error An aspect attempts to introduce a field with an empty name instead of no name.
LA0271 Error An aspect attempts to introduce a field that the target type already has, and the request is set to fail in this case.
LA0272 Error An aspect attempts to introduce a field by a name that a property, a method or a field of another type already has.
LA0273 Error An aspect attempts to introduce a field by its type, and the target type has several fields of this type.
LA0274 Error An aspect attempts to introduce a dependency on a type that has no instance constructors to receive it.
LA0275 Error An aspect attempts to introduce a dependency of a value type or of an open generic type.
LA0277 Error The delegate type of an [ImportMember] parameter passes a struct as ref to a readonly method instead of in.
LA0278 Error A constructor would get the signature of another constructor once the dependency parameters are added.
LA0279 Error An aspect attempts to introduce an instance field in a type whose fields have explicit offsets.
LA0280 Error An advice parameter bound by [ImportMember] is of type Property<T, TIndex>, which is not supported.
LA0281 Error A required [ImportMember] parameter names a member that the target type does not have, or that the parameter cannot receive.
LA0282 Error An advice imports an instance field by reference on a static method or member.
LA0283 Error An [ImportMember] parameter selects a member by its type, but several members of the target type match.
LA0284 Error An [ImportMember] parameter of a type that imports members by name only has no member name.
LA0285 Error An advice with a required match pointcut applies to no method of the target type.
LA0286 Error An aspect attempts to introduce a dependency, and several existing properties of the dependency type could provide it.