I'm using Microsoft.CodeAnalysis.CSharp.dll in my project. I have a class, the property of this class is an object that had been described in Microsoft.CodeAnalysis.CSharp.dll and connected to my project.
[ProtoContract]
public class FunctionAnnotation :
{
[ProtoMember(1)] public IMethodSymbol Symbol { get; set; }
}
IMethodSymbol
described in Microsoft.CodeAnalysis.CSharp.dll.
I use protobuf-net. When you try to serialize an object it throws an exception:
No serializer defined for type: Microsoft.CodeAnalysis.IMetnodSymbol
It is clear that Microsoft.CodeAnalysis.Method.Symbol is not marked as [ProtoContract]
private void Serialization()
{
string folderName = @"f:/serialization/";
Directory.CreateDirectory(folderName);
int name = this.Symbol.ToString().GetHashCode();
using (FileStream fs = new FileStream("f:/serialization/" + name + ".dat", FileMode.OpenOrCreate))
{
Serializer.Serialize(fs, this);
}
}
What are the options for marking of existing classes? How to solve this problem?