Fal*_*til 8 c# android json.net xamarin.android xamarin
我的代码有一个非常奇怪的问题,这是一个很新的问题,考虑到半年前我没有它.长话短说,我在Xamarin制作了一个应用程序,大约半年前在所有3家商店(App Store,Google Play和Microsoft Store)上发布了它.
昨天用户报告了Android应用程序的问题,在我修复并重新编译之后,我现在遇到了Json.NET的新错误
例外是
Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Rowlog.Common.Dtos.CompressedTripData. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path 'tripCoordinates', line 1, position 19.
Run Code Online (Sandbox Code Playgroud)
在你问之前,是的Rowlog.Common.Dtos.CompressedTripData确实有一个无参数构造函数(嗯,它根本没有一个,我们都知道它是同一个东西).
就像我说的那样,这是我在Android设备上从服务器加载CompressedTripData对象的时候.在iOS和Windows Phone上加载完全相同的对象可以顺利运行.我猜这是最近Json.NET或Xamarin.Android的变化,这导致了这个问题(其他应用程序大约半年前仍在使用Json.NET库.不确定是否有过任何更新,因为)
有没有其他人遇到类似的问题,如果有的话,你是如何解决它的?
Ste*_*hen 21
在项目属性的"Android选项"选项卡中,有一个"链接器"选项卡."链接"下拉列表中的选定选项是"仅限Sdk程序集"还是"Sdk和用户程序集"?
如果是后者,则在链接时跳过无参数构造函数,因为没有检测到使用.因此将其更改为"仅限Sdk Assemblies".
| 归档时间: |
|
| 查看次数: |
7407 次 |
| 最近记录: |