我有使用Castle DynamicProxy代理代码调用的代码。在Intercept(Iinvocation调用)中,我使用NewtonSoft来Json序列化调用。
Newtonsoft.Json.JsonConvert.SerializeObject(invocation.Method);
在Framework中,这看起来很简洁:
{
"Name": "FastLoadDataAsJson","AssemblyName": "TinyData,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null","Classname": "Dimension2.Core.Database.TinyData","Signature": "Byte[] FastLoadDataAsJson(System.String,System.String,System.String)","Signature2": "System.Byte[] FastLoadDataAsJson(System.String,"MemberType": 8,"GenericArguments": null
}
在.Net Core项目中,相同的序列化调用首先会出现以下异常:
为类型为“ System.Reflection.RuntimeModule”的属性“ ManifestModule”检测到自引用循环。路径“模块。组装”。
我可以使用Newtonsoft.Json.ReferenceLoopHandling.Ignore设置来解决它
但是我得到的JSON长93,000行!!!到底是怎么回事?看来调用完全不同。除了长度以外,属性是不同的,例如,没有Signature和Signature2属性。
简洁的Json框架似乎完全适合描述我们需要进行的调用。那么,Core为什么如此不同?我担心我缺少有关Castle,Core或两者的重要信息。