Vector2类型在Win2D绘图方式上不一致

Vector2 types in Win2D drawing method inconsistency

我将在 Windows 10 年迈入 UAP 世界的第一步。

我正在尝试使用 Win2D 库编写一个在 IoT/R-PI2 设备上显示图形的小型应用程序。

我有一个显示单线的绘图方法:

private void Canvas_Draw(CanvasControl sender, CanvasDrawEventArgs args)
{
  var a = new System.Numerics.Vector2(10,10);
  var b = new System.Numerics.Vector2(100,100);

  args.DrawingSession.DrawLine(a,b,Colors.Yellow);
}

VS2015 社区版。 IntelliSense 告诉我,我提供了参数 'a' 和 'b' 不兼容的 vector2 类型。它期待 Windows.Foundation.Numerics.Vector2 而不是 System.Numerics.Vector2.

但是,该程序在桌面和 r-pi 上编译和运行都很好。

我的应用程序的某些部分基于 this tutorial,其中该方法显然采用 System.Numeric.Verctor2 个参数。

我在另一个 post 中读到 Windows 8.1 和 10 之间的 API 以及这个 GitHub issue

我也导入了这个post中提到的包,但它没有改变任何东西。

我不知道这个 post 是否与我的问题有关,但至少它提到了这两个命名空间的问题。

为什么 IntelliSense 将此代码突出显示为错误? VS 中有错误吗?

我是不是做错了什么?

项目:https://github.com/chrisi/IoTCanvas

一些系统/IDE 相关规格:

System.Numerics.Vectors 附带 Windows 10,您无需单独安装。

您看到对 Windows.Foundation.Numerics 的引用的原因是因为 Windows.Foundation.Numerics 是 WinRT 类型的名称。这在 .NET 中被投影为 System.Numerics.Vector2。其他语言可能会以不同的方式投影 - 例如,在 C++/CX 中它是 Windows::Foundation::Numerics::float2。

我强烈怀疑您 运行 遇到了 ReSharper 的问题 - 请参阅 https://github.com/Microsoft/Win2D/issues/145。那里的话是:

This one is fixed in R#10 and the fix will be available in one of the next EAP builds.