I have a problem with PostSharp. Code like this:
class Program
{
static void Main(string[] args)
{
}
}
interface IA
{
int a { get; set; }
}
[Serializable]
[IntroduceInterface(typeof(IA))]
public class Aaaa : InstanceLevelAspect, IA
{
public int a { get; set; }
}
[Serializable]
[Aaaa]
class B
{
}
Build with PostSharp 2.0 gives class B which is Serializable with fields from interface IA. After build with PostSharp 2.1 IA fileds are not serialized. After decompilation I get that code:
[Serializable]
private class B : IA
{
[NonSerialized]
private Aaaa <>__aspect1;
public B()
{
base.\u002Ector();
this.\u003C\u003Ez__InitializeAspects();
}
{...}
}
In version 2.0 code was almost identical with one difference. There wasn't [NonSerialized] attribute. Is there any way to get it working on 2.1 like on 2.0?
This is by design. The behavior in PostSharp 2.0 was considered buggy and fixed in 2.1. There is no way to go back to the old behavior.