[UWP]与Linq的.NET Native Crash [英] [UWP].NET Native Crash with Linq

查看:61
本文介绍了[UWP]与Linq的.NET Native Crash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下行导致我的应用程序崩溃与.NET Native:

The following line cause my app crash with .NET Native:

var transformedPointQuery = trackSeg.Select(x => GetGCJCoord(x.Position));

path = new Geopath(transformedPointQuery);

path = new Geopath(transformedPointQuery);

其中trackSeg为List< Waypoint>,GetGCJCoord返回BasicGeoposition。

Where trackSeg is List<Waypoint>, and GetGCJCoord returns BasicGeoposition.

Waypoint的定义是:

The definition of Waypoint is:

    class Waypoint : GpxElement
    {
        //time
        public DateTime? Time { get; set; }
        public BasicGeoposition Position { get; set; }
    }

在调试模式下,我收到以下消息:

In debug mode, I got the following message:

(System.Linq.Enumerable.WhereSelectListIterator< Maps.Waypoint,Windows.Devices.Geolocation.BasicGeoposition>)缺少互操作类型编组数据。要启用互操作类型编组数据,请将MarshalObject指令添加到应用程序rd.xml
文件中。有关详细信息,请访问http://go.microsoft.com/fwlink/?LinkID=393965

(System.Linq.Enumerable.WhereSelectListIterator<Maps.Waypoint,Windows.Devices.Geolocation.BasicGeoposition>) is missing interop type marshalling data. To enable interop type marshalling data, add a MarshalObject directive to the application rd.xml file. For more information, please visit http://go.microsoft.com/fwlink/?LinkID=393965

我应该如何处理rd.xml文件?我尝试了所有我能理解的内容,但我对编组没有任何了解。

What should I do to the rd.xml file? I tried all I can understand, but I don't know anything about marshalling.

推荐答案

我解决了这个问题,但我更加困惑。

I solved the problem but I got even more confused.

我将代码更改为以下内容:

I changed the code to the following:

var transformedPointQuery = trackSeg.Select(x => GetGCJCoord(x.Position));
var list = transformedPointQuery.ToArray();
path = new Geopath(list);


然后崩溃不再发生。

Then the crash no longer happens.


这篇关于[UWP]与Linq的.NET Native Crash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆