postshap: OnMethodBoundaryAspect et WebMethod
-
27-09-2019 - |
Question
J'utilise PostSharp d'ajouter un aspect à un WebMethod.
Voici mon aspect (il ne fait rien ... ne veut pas compiler):
public class MyAspect : OnMethodBoundaryAspect, ISerializable
{
public override void OnException(MethodExecutionEventArgs eventArgs)
{
}
public override void OnEntry(MethodExecutionEventArgs eventArgs)
{
}
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
}
}
Et mes regards WebMethod comme:
[MyAspect]
[WebMethod]
public void MyWebMethod()
{
//...
}
Quand je construis le projet, il y a une erreur:
346 PostSharp Erreur: Ne peut pas sérialiser les aspects: Le type 'xxxx.MyAspect' Dans l'assembly 'ZZZZZ, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null' Ne est pas Marqué comme sérialisable .. unknown_location xxxxx
Il me dit que mon aspect n'est pas marqué comme sérialisable ...
Que puis-je faire? Pour votre information, je n'ai aucun problème avec ces aspects dans le reste du projet.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow