@@ -198,6 +198,24 @@ public async Task InspectGenericValueTypeArrayLocals2(int line, int col, string
198198 frame_idx : frame_idx ,
199199 use_cfo : use_cfo ) ;
200200
201+ async Task < JToken > GetObjectWithCFO ( string objectId , JObject fn_args = null )
202+ {
203+ var fn_decl = "function () { return this; }" ;
204+ var cfo_args = JObject . FromObject ( new
205+ {
206+ functionDeclaration = fn_decl ,
207+ objectId = objectId
208+ } ) ;
209+
210+ if ( fn_args != null )
211+ cfo_args [ "arguments" ] = fn_args ;
212+
213+ // callFunctionOn
214+ var result = await cli . SendCommand ( "Runtime.callFunctionOn" , cfo_args , token ) ;
215+
216+ return await GetProperties ( result . Value [ "result" ] [ "objectId" ] ? . Value < string > ( ) , fn_args ) ;
217+ }
218+
201219 async Task TestSimpleArrayLocals ( int line , int col , string entry_method_name , string method_name , string etype_name ,
202220 string local_var_name_prefix , object [ ] array , object [ ] array_elem_props ,
203221 bool test_prev_frame = false , int frame_idx = 0 , bool use_cfo = false )
@@ -215,8 +233,8 @@ async Task TestSimpleArrayLocals(int line, int col, string entry_method_name, st
215233
216234 var locals = await GetProperties ( pause_location [ "callFrames" ] [ frame_idx ] [ "callFrameId" ] . Value < string > ( ) ) ;
217235 Assert . Equal ( 4 , locals . Count ( ) ) ;
218- CheckArray ( locals , $ "{ local_var_name_prefix } _arr", $ "{ etype_name } []", array ? . Length ?? 0 ) ;
219- CheckArray ( locals , $ "{ local_var_name_prefix } _arr_empty", $ "{ etype_name } []", 0 ) ;
236+ CheckArray ( locals , $ "{ local_var_name_prefix } _arr", $ "{ etype_name } []", $ " { etype_name } [ { array ? . Length ?? 0 } ]" ) ;
237+ CheckArray ( locals , $ "{ local_var_name_prefix } _arr_empty", $ "{ etype_name } []", $ " { etype_name } [0]" ) ;
220238 CheckObject ( locals , $ "{ local_var_name_prefix } _arr_null", $ "{ etype_name } []", is_null : true ) ;
221239 CheckBool ( locals , "call_other" , test_prev_frame ) ;
222240
@@ -264,24 +282,6 @@ async Task TestSimpleArrayLocals(int line, int col, string entry_method_name, st
264282
265283 var props = await GetObjectOnFrame ( pause_location [ "callFrames" ] [ frame_idx ] , $ "{ local_var_name_prefix } _arr_empty") ;
266284 await CheckProps ( props , new object [ 0 ] , "${local_var_name_prefix}_arr_empty" ) ;
267-
268- async Task < JToken > GetObjectWithCFO ( string objectId , JObject fn_args = null )
269- {
270- var fn_decl = "function () { return this; }" ;
271- var cfo_args = JObject . FromObject ( new
272- {
273- functionDeclaration = fn_decl ,
274- objectId = objectId
275- } ) ;
276-
277- if ( fn_args != null )
278- cfo_args [ "arguments" ] = fn_args ;
279-
280- // callFunctionOn
281- var result = await cli . SendCommand ( "Runtime.callFunctionOn" , cfo_args , token ) ;
282-
283- return await GetProperties ( result . Value [ "result" ] [ "objectId" ] ? . Value < string > ( ) , fn_args ) ;
284- }
285285 }
286286
287287 [ Theory ]
@@ -313,10 +313,10 @@ public async Task InspectObjectArrayMembers(bool use_cfo)
313313 await CheckProps ( c_props , new
314314 {
315315 id = TString ( "c#id" ) ,
316- ClassArrayProperty = TArray ( "DebuggerTests.SimpleClass[]" , 3 ) ,
317- ClassArrayField = TArray ( "DebuggerTests.SimpleClass[]" , 3 ) ,
318- PointsProperty = TArray ( "DebuggerTests.Point[]" , 2 ) ,
319- PointsField = TArray ( "DebuggerTests.Point[]" , 2 )
316+ ClassArrayProperty = TArray ( "DebuggerTests.SimpleClass[]" , "DebuggerTests.SimpleClass[3]" ) ,
317+ ClassArrayField = TArray ( "DebuggerTests.SimpleClass[]" , "DebuggerTests.SimpleClass[3]" ) ,
318+ PointsProperty = TArray ( "DebuggerTests.Point[]" , "DebuggerTests.Point[2]" ) ,
319+ PointsField = TArray ( "DebuggerTests.Point[]" , "DebuggerTests.Point[2]" )
320320 } ,
321321 "c"
322322 ) ;
@@ -382,8 +382,8 @@ public async Task InspectValueTypeArrayLocalsStaticAsync(bool use_cfo)
382382 await CheckProps ( frame_locals , new
383383 {
384384 call_other = TBool ( false ) ,
385- gvclass_arr = TArray ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[]" , 2 ) ,
386- gvclass_arr_empty = TArray ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[]" ) ,
385+ gvclass_arr = TArray ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[]" , "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[2]" ) ,
386+ gvclass_arr_empty = TArray ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[]" , "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[0]" ) ,
387387 gvclass_arr_null = TObject ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>[]" , is_null : true ) ,
388388 gvclass = TValueType ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>" ) ,
389389 // BUG: this shouldn't be null!
@@ -448,7 +448,7 @@ public async Task InspectValueTypeArrayLocalsInstanceAsync(bool use_cfo)
448448 {
449449 t1 = TObject ( "DebuggerTests.SimpleGenericStruct<DebuggerTests.Point>" ) ,
450450 @this = TObject ( "DebuggerTests.ArrayTestsClass" ) ,
451- point_arr = TArray ( "DebuggerTests.Point[]" , 2 ) ,
451+ point_arr = TArray ( "DebuggerTests.Point[]" , "DebuggerTests.Point[2]" ) ,
452452 point = TValueType ( "DebuggerTests.Point" )
453453 } , "InspectValueTypeArrayLocalsInstanceAsync#locals" ) ;
454454
@@ -642,6 +642,59 @@ public async Task InvalidAccessors() => await CheckInspectLocalsAtBreakpointSite
642642 AssertEqual ( "undefined" , res . Value [ "result" ] ? [ "type" ] ? . ToString ( ) , "Expected to get undefined result for non-existant accessor" ) ;
643643 }
644644 } ) ;
645+
646+ [ Theory ]
647+ [ InlineData ( false ) ]
648+ [ InlineData ( true ) ]
649+ public async Task InspectPrimitiveTypeMultiArrayLocals ( bool use_cfo )
650+ {
651+ var debugger_test_loc = "dotnet://debugger-test.dll/debugger-array-test.cs" ;
652+
653+ var eval_expr = "window.setTimeout(function() { invoke_static_method (" +
654+ $ "'[debugger-test] DebuggerTests.MultiDimensionalArray:run'" +
655+ "); }, 1);" ;
645656
657+ var pause_location = await EvaluateAndCheck ( eval_expr , debugger_test_loc , 343 , 12 , "run" ) ;
658+
659+ var locals = await GetProperties ( pause_location [ "callFrames" ] [ 0 ] [ "callFrameId" ] . Value < string > ( ) ) ;
660+ Assert . Equal ( 3 , locals . Count ( ) ) ;
661+ var int_arr_1 = ! use_cfo ?
662+ await GetProperties ( locals [ 0 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) :
663+ await GetObjectWithCFO ( ( locals [ 0 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) ) ;
664+
665+ CheckNumber ( int_arr_1 , "0" , 0 ) ;
666+ CheckNumber ( int_arr_1 , "1" , 1 ) ;
667+ var int_arr_2 = ! use_cfo ?
668+ await GetProperties ( locals [ 1 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) :
669+ await GetObjectWithCFO ( ( locals [ 1 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) ) ;
670+ CheckNumber ( int_arr_2 , "0, 0" , 0 ) ;
671+ CheckNumber ( int_arr_2 , "0, 1" , 1 ) ;
672+ CheckNumber ( int_arr_2 , "0, 2" , 2 ) ;
673+ CheckNumber ( int_arr_2 , "1, 0" , 10 ) ;
674+ CheckNumber ( int_arr_2 , "1, 1" , 11 ) ;
675+ CheckNumber ( int_arr_2 , "1, 2" , 12 ) ;
676+
677+ var int_arr_3 = ! use_cfo ?
678+ await GetProperties ( locals [ 2 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) :
679+ await GetObjectWithCFO ( ( locals [ 2 ] [ "value" ] [ "objectId" ] . Value < string > ( ) ) ) ;
680+ CheckNumber ( int_arr_3 , "0, 0, 0" , 0 ) ;
681+ CheckNumber ( int_arr_3 , "0, 0, 1" , 1 ) ;
682+ CheckNumber ( int_arr_3 , "0, 0, 2" , 2 ) ;
683+ CheckNumber ( int_arr_3 , "0, 1, 0" , 10 ) ;
684+ CheckNumber ( int_arr_3 , "0, 1, 1" , 11 ) ;
685+ CheckNumber ( int_arr_3 , "0, 1, 2" , 12 ) ;
686+ CheckNumber ( int_arr_3 , "0, 2, 0" , 20 ) ;
687+ CheckNumber ( int_arr_3 , "0, 2, 1" , 21 ) ;
688+ CheckNumber ( int_arr_3 , "0, 2, 2" , 22 ) ;
689+ CheckNumber ( int_arr_3 , "1, 0, 0" , 100 ) ;
690+ CheckNumber ( int_arr_3 , "1, 0, 1" , 101 ) ;
691+ CheckNumber ( int_arr_3 , "1, 0, 2" , 102 ) ;
692+ CheckNumber ( int_arr_3 , "1, 1, 0" , 110 ) ;
693+ CheckNumber ( int_arr_3 , "1, 1, 1" , 111 ) ;
694+ CheckNumber ( int_arr_3 , "1, 1, 2" , 112 ) ;
695+ CheckNumber ( int_arr_3 , "1, 2, 0" , 120 ) ;
696+ CheckNumber ( int_arr_3 , "1, 2, 1" , 121 ) ;
697+ CheckNumber ( int_arr_3 , "1, 2, 2" , 122 ) ;
698+ }
646699 }
647700}
0 commit comments