我正在使用 PostSharp 向 WebMethod 添加方面。
下面是我的方面(它什么都不做......不想编译):
public class MyAspect : OnMethodBoundaryAspect, ISerializable
{
public override void OnException(MethodExecutionEventArgs eventArgs)
{
}
public override void OnEntry(MethodExecutionEventArgs eventArgs)
{
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
}
我的网络方法看起来像:
[MyAspect]
[WebMethod]
public void MyWebMethod()
{
//...
}
当我构建项目时,出现错误:
Erreur 346 PostSharp:无法序列化方面: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
它告诉我我的方面没有被标记为可序列化......
我能做些什么?仅供参考,在项目的其余部分,我对这些方面没有任何问题。