每当使用Matrix3DHelper.Multiply的System.MethodAccessException

时间:2018-11-03 23:01:00

标签: .net uwp

当我调用Windows.UI.Xaml.Media.Media3D.Matrix3DHelper.Multiply在运行时抛出System.MethodAccessException。

Matrix3D matrix1 = new Matrix3D();
matrix1.M11 = 0.7;
Matrix3D matrix2 = new Matrix3D();
matrix2.M23 = 0.2;

var combined = Matrix3DHelper.Multiply(matrix1, matrix2); // throws error here

这是一个包含的类,方法是公共的。方法是not in the documentation !!!

我做错了还是这是一个错误?

清理repro项目here

1 个答案:

答案 0 :(得分:2)

Matrix3DHelper.Multiply已记录在案-您的链接指向MatrixHelper,而不是Matrix3DHelper。

文档说不要从.Net使用它:

  

C#和Microsoft Visual Basic代码应改为使用乘法运算符。

// Instead of this:
//   var combined = Matrix3DHelper.Multiply(matrix1, matrix2);
// do this:
var combined = matrix1 * matrix2;