You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unit test that is part of UnitTestParseTests where a runtime cast of a Guid to an int is passing, it should fail and does in a .net core test.
nanoFramework area: (C# code)
nf-Interpreter
VS version: (2017 | 2019 )
VS extension version:
Target:
Device capabilities output:
Description
Cast to int works because the current implementation of Guid uses uint8 as it's base type, and not a unique data type.
Detailed repro steps so we can see the same problem
Run NFUnitTestSystemLib/UnitTestParseTests/box_unbox_Test_1
Other suggested things
Need to do the work to make Guid an actual data type.
Expected behaviour
You should not be able to cast at runtime from a Guid to an int (or any other type). Normally this behavior is caught at compile time, but as in the test case you can use object types as intermediates to allow a runtime (late) cast of the objects.
Sample Project
Screenshot
Additional context
I've made an effort to fix the bug
Have tried this but ran into a number of problems, so backed out to complete other issue. This issue is to document the special case of Guid.
The text was updated successfully, but these errors were encountered:
@edleno2 I've fixed this is the interpreter by adding a new know type for GUID and adding a new check when executing unbox.any to make sure the cast from GUID is not possible.
Details about Problem
Unit test that is part of UnitTestParseTests where a runtime cast of a Guid to an int is passing, it should fail and does in a .net core test.
nanoFramework area: (C# code)
nf-Interpreter
VS version: (2017 | 2019 )
VS extension version:
Target:
Device capabilities output:
Description
Cast to int works because the current implementation of Guid uses uint8 as it's base type, and not a unique data type.
Detailed repro steps so we can see the same problem
Other suggested things
Need to do the work to make Guid an actual data type.
Expected behaviour
You should not be able to cast at runtime from a Guid to an int (or any other type). Normally this behavior is caught at compile time, but as in the test case you can use object types as intermediates to allow a runtime (late) cast of the objects.
Sample Project
Screenshot
Additional context
I've made an effort to fix the bug
Have tried this but ran into a number of problems, so backed out to complete other issue. This issue is to document the special case of Guid.
The text was updated successfully, but these errors were encountered: