由于接口已经在图表上,我想明确地显示继承引用.但是我找不到......

visual-studio-2010 visual-studio-2012 visual-studio-2013 visual-studio-2019
尝试在Silverlight中反序列化时出现异常.Test1失败,而Test2成功.我也尝试将TypeNameAssemblyFormat同时用于Simple和Full,但得到相同的结果.Test2可以解析程序集,为什么不能Json.NET?
更新:忘记提及我试图反序列化的类型是在与反序列化发生的silverlight程序集不同的程序集中定义的.
这两个测试都在非Silverlight .NET应用程序中运行.
如何反序列化具有类型名称的json字符串?
private void Test1()
{
JsonSerializerSettings settings = new JsonSerializerSettings();
settings.TypeNameHandling = TypeNameHandling.Objects;
string json1 = "{\"$type\":\"AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly\",\"X\":0.0,\"Y\":0.0,\"SpatialReference\":null}";
try
{
var n1 = JsonConvert.DeserializeObject<NTPoint>(json1, settings);
//Error resolving type specified in JSON 'AmberGIS.NetworkTrace.DTO.NTPoint, NetworkTrace.DTO.Assembly'.
//Could not load file or assembly 'NetworkTrace.DTO.Assembly, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
//The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest.
//(Exception from HRESULT: 0x80131053)
}
catch (Exception ex)
{ …Run Code Online (Sandbox Code Playgroud)