Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't implement derived class from class that use System.Numerics.Matrix3x2. #437

Closed
omanuke opened this issue Oct 10, 2016 · 2 comments
Closed
Labels

Comments

@omanuke
Copy link

omanuke commented Oct 10, 2016

I declared class that uses System.Numerics.Matrix3x2 as property setter and getter in PCL Profile7.
Then I implement class in Windows8.1 Store App that derived from this class and try to set value of System.Numerics.Matrix3x2 to CanvasDrawingSession.Transform.
This raises compile error like below.
type must be 'System.Numerics.Matrix3x2' to match overridden member 'NoteAppCommon.NoteViewEtc.Graphics3.Transform'
If I declare this base class in Windows8.1 Store App,build succeed.

I attached the picture.In left side I declared Graphics3 as PCL lib. In right side I declared Graphics2 and Win2DGraphics2 and Win2DGraphics3. Graphics2 is same to Graphics3 except class name.
If I compile,Win2dGraphics2 will succeed and Win2dGraphics3 will fail with error above.

Is this related to the conversion like Why does Win2D include three different sets of vector and matrix types?.
Or System.Numerics.Matrix3x2 in PCL is treated as different class from System.Numerics.Matrix3x2 in Store App?

source

@shawnhar
Copy link
Member

The 8.1 version of Win2D dates from before the numerics types were properly understood by the CLR and WinRT, so includes its own local version of those types instead. These have the same struct names and functionality but are not interchangeable with the version provided by System.Numerics.Vectors, which is used on Win10+.

When you build against the 8.1 version of Win2D, you must use the numerics types provided by the Win2D 8.1 nuget package, and not the versions from System.Numerics.Vectors. The Win2D version of these types will not work in a PCL because Win2D is processor architecture specific. Therefore all your code that uses these types needs to be built targeting 8.1 Store.

For Win10 and above, Win2D uses the standard System.Numerics.Vectors math types and no longer provides its own local version, so PCL referencing the vector types should work as expected.

@omanuke
Copy link
Author

omanuke commented Oct 11, 2016

Thank for your quick reply.
OK,I abandon to use PCL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants