【发布时间】:2017-08-27 18:44:18
【问题描述】:
我有一段代码获取 JSON 响应并检查是否存在 .error 字段
dynamic jsonResponse = JsonConvert.DeserializeObject(responseString);
if (jsonResponse.error != null) { error = jsonResponse.error; }
else
{
success = true;
}
当它没有使用 .NET Native 工具链编译时,它会成功运行,但在使用它构建时会产生错误(在 jsonResponse.error 上)。
这是什么原因?还有其他与本机代码不兼容的类似行为吗?
编辑:事实证明,即使 JSON 中有一个“错误”键,我们仍然会收到错误。例外是:
System.Reflection.MissingMetadataException: ''Microsoft.CSharp.RuntimeBinder.CSharpGetMemberBinder' is missing metadata. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=392859'
【问题讨论】:
标签: c# dynamic json.net .net-native