@@ -923,6 +923,16 @@ private static async Task<bool> MarshalTask(string helperMethodName, string help
923
923
return resolved ;
924
924
}
925
925
926
+ private static async Task MarshalTaskReturningInt ( string helperMethodName )
927
+ {
928
+ HelperMarshal . _intValue = 0 ;
929
+
930
+ bool success = await MarshalTask ( helperMethodName , "7" , "App.call_test_method ('InvokeInt', [ result ], 'i');" ) ;
931
+
932
+ Assert . True ( success , $ "{ helperMethodName } didn't succeeded.") ;
933
+ Assert . Equal ( 7 , HelperMarshal . _intValue ) ;
934
+ }
935
+
926
936
[ Fact ]
927
937
public static async Task MarshalSynchronousTask ( )
928
938
{
@@ -938,57 +948,75 @@ public static async Task MarshalAsynchronousTask()
938
948
}
939
949
940
950
[ Fact ]
941
- public static async Task MarshalSynchronousTaskInt ( )
951
+ public static Task MarshalSynchronousTaskInt ( )
942
952
{
943
- HelperMarshal . _intValue = 0 ;
944
-
945
- bool success = await MarshalTask ( "SynchronousTaskInt" , "7" , "App.call_test_method ('InvokeInt', [ result ], 'i');" ) ;
946
-
947
- Assert . True ( success , "SynchronousTask didn't succeeded." ) ;
948
- Assert . Equal ( 7 , HelperMarshal . _intValue ) ;
953
+ return MarshalTaskReturningInt ( "SynchronousTaskInt" ) ;
949
954
}
950
955
951
956
[ Fact ]
952
- public static async Task MarshalAsynchronousTaskInt ( )
957
+ public static Task MarshalAsynchronousTaskInt ( )
953
958
{
954
- HelperMarshal . _intValue = 0 ;
955
-
956
- bool success = await MarshalTask ( "AsynchronousTaskInt" , "7" , "App.call_test_method ('InvokeInt', [ result ], 'i');" ) ;
957
-
958
- Assert . True ( success , "AsynchronousTask didn't succeeded." ) ;
959
- Assert . Equal ( 7 , HelperMarshal . _intValue ) ;
959
+ return MarshalTaskReturningInt ( "AsynchronousTaskInt" ) ;
960
960
}
961
961
962
962
[ Fact ]
963
963
public static async Task MarshalFailedSynchronousTask ( )
964
964
{
965
965
bool success = await MarshalTask ( "FailedSynchronousTask" ) ;
966
-
967
966
Assert . False ( success , "FailedSynchronousTask didn't failed." ) ;
968
967
}
969
968
970
969
[ Fact ]
971
970
public static async Task MarshalFailedAsynchronousTask ( )
972
971
{
973
972
bool success = await MarshalTask ( "FailedAsynchronousTask" ) ;
974
-
975
973
Assert . False ( success , "FailedAsynchronousTask didn't failed." ) ;
976
974
}
977
975
978
976
[ Fact ]
979
- [ Trait ( "Category" , "Marek" ) ]
977
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368" ) ]
978
+ public static async Task MarshalSynchronousValueTaskDoesNotWorkYet ( )
979
+ {
980
+ bool success = await MarshalTask ( "SynchronousValueTask" ) ;
981
+ Assert . True ( success , "SynchronousValueTask didn't succeeded." ) ;
982
+ }
983
+
984
+ [ Fact ]
985
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368" ) ]
980
986
public static async Task MarshalAsynchronousValueTaskDoesNotWorkYet ( )
981
987
{
982
- var exception = await Assert . ThrowsAsync < JSException > ( ( ) => MarshalTask ( "AsynchronousValueTask" ) ) ;
983
- Assert . StartsWith ( "Error: no idea on how to unbox value types" , exception . Message ) ;
988
+ bool success = await MarshalTask ( "AsynchronousValueTask" ) ;
989
+ Assert . True ( success , "AsynchronousValueTask didn't succeeded." ) ;
990
+ }
991
+
992
+ [ Fact ]
993
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368" ) ]
994
+ public static Task MarshalSynchronousValueTaskIntDoesNotWorkYet ( )
995
+ {
996
+ return MarshalTaskReturningInt ( "SynchronousValueTaskInt" ) ;
997
+ }
998
+
999
+ [ Fact ]
1000
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368" ) ]
1001
+ public static Task MarshalAsynchronousValueTaskIntDoesNotWorkYet ( )
1002
+ {
1003
+ return MarshalTaskReturningInt ( "AsynchronousValueTaskInt" ) ;
1004
+ }
1005
+
1006
+ [ Fact ]
1007
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368" ) ]
1008
+ public static async Task MarshalFailedSynchronousValueTaskDoesNotWorkYet ( )
1009
+ {
1010
+ bool success = await MarshalTask ( "FailedSynchronousValueTask" ) ;
1011
+ Assert . False ( success , "FailedSynchronousValueTask didn't failed." ) ;
984
1012
}
985
1013
986
1014
[ Fact ]
987
- [ Trait ( "Category" , "Marek ") ]
988
- public static async Task MarshalAsynchronousValueTaskIntDoesNotWorkYet ( )
1015
+ [ ActiveIssue ( "https://github.com/dotnet/runtime/issues/61368 ") ]
1016
+ public static async Task MarshalFailedAsynchronousValueTaskDoesNotWorkYet ( )
989
1017
{
990
- var exception = await Assert . ThrowsAsync < JSException > ( ( ) => MarshalTask ( "AsynchronousValueTaskInt" , "7" ) ) ;
991
- Assert . StartsWith ( "Error: no idea on how to unbox value types" , exception . Message ) ;
1018
+ bool success = await MarshalTask ( "FailedAsynchronousValueTask" ) ;
1019
+ Assert . False ( success , "FailedAsynchronousValueTask didn't failed." ) ;
992
1020
}
993
1021
}
994
1022
}
0 commit comments