@@ -502,7 +502,7 @@ protected unsafe void WriteBigEndian<T>(T val) where T : struct
502502 base . Write ( data ) ;
503503 }
504504
505- private void Write < T > ( ElementType type , T value ) where T : struct => Write ( ( byte ) type , value ) ;
505+ internal void Write < T > ( ElementType type , T value ) where T : struct => Write ( ( byte ) type , value ) ;
506506
507507 private void Write < T1 , T2 > ( T1 type , T2 value ) where T1 : struct where T2 : struct
508508 {
@@ -514,11 +514,11 @@ public void WriteObj(DotnetObjectId objectId, MonoSDBHelper SdbHelper)
514514 {
515515 if ( objectId . Scheme == "object" )
516516 {
517- Write ( ElementType . Class , int . Parse ( objectId . Value ) ) ;
517+ Write ( ElementType . Class , objectId . Value ) ;
518518 }
519519 else if ( objectId . Scheme == "valuetype" )
520520 {
521- Write ( SdbHelper . valueTypes [ int . Parse ( objectId . Value ) ] . valueTypeBuffer ) ;
521+ Write ( SdbHelper . valueTypes [ objectId . Value ] . valueTypeBuffer ) ;
522522 }
523523 }
524524 public async Task < bool > WriteConst ( LiteralExpressionSyntax constValue , MonoSDBHelper SdbHelper , CancellationToken token )
@@ -1537,6 +1537,13 @@ public async Task<JObject> InvokeMethod(ArraySegment<byte> valueTypeBuffer, int
15371537 return await CreateJObjectForVariableValue ( retDebuggerCmdReader , varName , false , - 1 , false , token ) ;
15381538 }
15391539
1540+ public async Task < JObject > InvokeMethodInObject ( int objectId , int methodId , string varName , CancellationToken token )
1541+ {
1542+ using var commandParamsObjWriter = new MonoBinaryWriter ( ) ;
1543+ commandParamsObjWriter . Write ( ElementType . Class , objectId ) ;
1544+ return await InvokeMethod ( commandParamsObjWriter . GetParameterBuffer ( ) , methodId , varName , token ) ;
1545+ }
1546+
15401547 public async Task < int > GetPropertyMethodIdByName ( int typeId , string propertyName , CancellationToken token )
15411548 {
15421549 using var retDebuggerCmdReader = await GetTypePropertiesReader ( typeId , token ) ;
@@ -1559,13 +1566,14 @@ public async Task<int> GetPropertyMethodIdByName(int typeId, string propertyName
15591566 return - 1 ;
15601567 }
15611568
1562- public async Task < JArray > CreateJArrayForProperties ( int typeId , ArraySegment < byte > object_buffer , JArray attributes , bool isAutoExpandable , string objectId , bool isOwn , CancellationToken token )
1569+ public async Task < JArray > CreateJArrayForProperties ( int typeId , ArraySegment < byte > object_buffer , JArray attributes , bool isAutoExpandable , string objectIdStr , bool isOwn , CancellationToken token )
15631570 {
15641571 JArray ret = new JArray ( ) ;
15651572 using var retDebuggerCmdReader = await GetTypePropertiesReader ( typeId , token ) ;
15661573 if ( retDebuggerCmdReader == null )
15671574 return null ;
1568-
1575+ if ( ! DotnetObjectId . TryParse ( objectIdStr , out DotnetObjectId objectId ) )
1576+ return null ;
15691577 var nProperties = retDebuggerCmdReader . ReadInt32 ( ) ;
15701578 for ( int i = 0 ; i < nProperties ; i ++ )
15711579 {
@@ -1595,11 +1603,11 @@ public async Task<JArray> CreateJArrayForProperties(int typeId, ArraySegment<byt
15951603 get = new
15961604 {
15971605 type = "function" ,
1598- objectId = $ "{ objectId } :methodId :{ getMethodId } ",
1606+ objectId = $ "dotnet:methodId: { objectId . Value } :{ getMethodId } ",
15991607 className = "Function" ,
16001608 description = "get " + propertyNameStr + " ()" ,
16011609 methodId = getMethodId ,
1602- objectIdValue = objectId
1610+ objectIdValue = objectIdStr
16031611 } ,
16041612 name = propertyNameStr
16051613 } ) ;
@@ -2054,10 +2062,10 @@ public async Task<JArray> GetHoistedLocalVariables(int objectId, JArray asyncLoc
20542062 {
20552063 if ( DotnetObjectId . TryParse ( asyncLocal ? [ "value" ] ? [ "objectId" ] ? . Value < string > ( ) , out DotnetObjectId dotnetObjectId ) )
20562064 {
2057- if ( int . TryParse ( dotnetObjectId . Value , out int objectIdToGetInfo ) && ! objectsAlreadyRead . Contains ( objectIdToGetInfo ) )
2065+ if ( ! objectsAlreadyRead . Contains ( dotnetObjectId . Value ) )
20582066 {
2059- var asyncLocalsFromObject = await GetObjectValues ( objectIdToGetInfo , GetObjectCommandOptions . WithProperties , token ) ;
2060- var hoistedLocalVariable = await GetHoistedLocalVariables ( objectIdToGetInfo , asyncLocalsFromObject , token ) ;
2067+ var asyncLocalsFromObject = await GetObjectValues ( dotnetObjectId . Value , GetObjectCommandOptions . WithProperties , token ) ;
2068+ var hoistedLocalVariable = await GetHoistedLocalVariables ( dotnetObjectId . Value , asyncLocalsFromObject , token ) ;
20612069 asyncLocalsFull = new JArray ( asyncLocalsFull . Union ( hoistedLocalVariable ) ) ;
20622070 }
20632071 }
@@ -2295,7 +2303,7 @@ public async Task<JArray> GetValuesFromDebuggerProxyAttribute(int objectId, int
22952303
22962304 var retMethod = await InvokeMethod ( invokeParamsWriter . GetParameterBuffer ( ) , methodId , "methodRet" , token ) ;
22972305 DotnetObjectId . TryParse ( retMethod ? [ "value" ] ? [ "objectId" ] ? . Value < string > ( ) , out DotnetObjectId dotnetObjectId ) ;
2298- var displayAttrs = await GetObjectValues ( int . Parse ( dotnetObjectId . Value ) , GetObjectCommandOptions . WithProperties | GetObjectCommandOptions . ForDebuggerProxyAttribute , token ) ;
2306+ var displayAttrs = await GetObjectValues ( dotnetObjectId . Value , GetObjectCommandOptions . WithProperties | GetObjectCommandOptions . ForDebuggerProxyAttribute , token ) ;
22992307 return displayAttrs ;
23002308 }
23012309 }
@@ -2385,7 +2393,7 @@ public async Task<JArray> GetObjectValues(int objectId, GetObjectCommandOptions
23852393 if ( ! getCommandType . HasFlag ( GetObjectCommandOptions . WithProperties ) )
23862394 return ret ;
23872395 using var commandParamsObjWriter = new MonoBinaryWriter ( ) ;
2388- commandParamsObjWriter . WriteObj ( new DotnetObjectId ( "object" , $ " { objectId } " ) , this ) ;
2396+ commandParamsObjWriter . WriteObj ( new DotnetObjectId ( "object" , objectId ) , this ) ;
23892397 var props = await CreateJArrayForProperties ( typeId [ i ] , commandParamsObjWriter . GetParameterBuffer ( ) , ret , getCommandType . HasFlag ( GetObjectCommandOptions . ForDebuggerProxyAttribute ) , $ "dotnet:object:{ objectId } ", i == 0 , token ) ;
23902398 ret = new JArray ( ret . Union ( props ) ) ;
23912399
0 commit comments