I'm using PostSharp to add an aspect to a WebMethod.
Below is my aspect (it does nothing... doesn't want to compile):
public class MyAspect : OnMethodBoundaryAspect, ISerializable
{
public override void OnException(MethodExecutionEventArgs eventArgs)
{
}
public override void OnEntry(MethodExecutionEventArgs eventArgs)
{
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
}
And my webmethod looks like :
[MyAspect]
[WebMethod]
public void MyWebMethod()
{
//...
}
When I build the project, there is an error:
Erreur 346 PostSharp: Cannot serialize the aspects: Le type 'xxxx.MyAspect' dans l'assembly 'zzzzz, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' n'est pas marqué comme sérialisable.. unknown_location xxxxx
It tells me that my aspect is not tagged as serializable...
What can I do? FYI, I don't have any problem with such aspects in the rest of the project.