fix(IPC): serialize with type info

This commit is contained in:
goat 2021-08-29 23:49:31 +02:00
parent abe256ec9a
commit 3fd1637cf0
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -116,12 +116,18 @@ namespace Dalamud.Plugin.Ipc.Internal
}
}
private object ConvertObject(object? obj, Type type)
private object? ConvertObject(object? obj, Type type)
{
try
{
var json = JsonConvert.SerializeObject(obj);
return JsonConvert.DeserializeObject(json, type);
var settings = new JsonSerializerSettings
{
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
TypeNameHandling = TypeNameHandling.Objects,
};
var json = JsonConvert.SerializeObject(obj, settings);
return JsonConvert.DeserializeObject(json, type, settings);
}
catch (Exception ex)
{