@@ -1144,5 +1144,30 @@ await debugService.SetCommandBreakpointsAsync(
11441144 Assert . Contains ( childVars , i => i . Name is "Exists" && i . ValueString is "$true" ) ;
11451145 Assert . Contains ( childVars , i => i . Name is "LastAccessTime" ) ;
11461146 }
1147+
1148+ // Verifies Issue #1686
1149+ [ Fact ]
1150+ public async Task DebuggerToStringShouldMarshallToPipeline ( )
1151+ {
1152+ CommandBreakpointDetails breakpoint = CommandBreakpointDetails . Create ( "__BreakDebuggerToStringShouldMarshallToPipeline" ) ;
1153+ await debugService . SetCommandBreakpointsAsync ( new [ ] { breakpoint } ) . ConfigureAwait ( true ) ;
1154+
1155+ // Execute the script and wait for the breakpoint to be hit
1156+ Task _ = ExecuteVariableScriptFileAsync ( ) ;
1157+ AssertDebuggerStopped ( commandBreakpointDetails : breakpoint ) ;
1158+
1159+ VariableDetailsBase [ ] vars = await GetVariables ( VariableContainerDetails . ScriptScopeName ) . ConfigureAwait ( true ) ;
1160+ VariableDetailsBase customToStrings = Array . Find ( vars , i => i . Name is "$CustomToStrings" ) ;
1161+ Assert . True ( customToStrings . IsExpandable ) ;
1162+ Assert . Equal ( "[System.Object[]]" , customToStrings . Type ) ;
1163+ VariableDetailsBase [ ] childVars = await debugService . GetVariables ( customToStrings . Id , CancellationToken . None ) . ConfigureAwait ( true ) ;
1164+ // Check everything but the last variable (which is "Raw View")
1165+ Assert . Equal ( 1001 , childVars . Length ) ; // 1000 custom variables plus "Raw View"
1166+ Assert . All ( childVars . Take ( childVars . Length - 1 ) , i =>
1167+ {
1168+ Assert . Equal ( "HELLO" , i . ValueString ) ;
1169+ Assert . Equal ( "[CustomToString]" , i . Type ) ;
1170+ } ) ;
1171+ }
11471172 }
11481173}
0 commit comments