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
{{ message }}
Repository navigation
[wasm][debugger] Support indexing Dictionary by object key #76014
Tests: in DebuggerTests.EvaluateOnCallFrameTests.EvaluateUserDefinedIndexingByNonIntLocals uncomment lines:
// ("f[aDecimal]", TNumber(3))
and fix. Decimal is treated as an object. We can handle indexing by it e.g. by adding in GetElementIndexInfo in case of (arg.Expression is IdentifierNameSyntax)
// indexObject={
// "type": "object",
// "value": null,
// "description": "3.34",
// "className": "System.Decimal",
// "objectId": "dotnet:valuetype:9",
// "isValueType": true
// }
if (indexObject["type"].ToString() == "object") // e.g. System.Decimal behaves this way
{
elementIdxStr.Append(indexObject["description"].ToString()); // or resolving value
}
else
{
elementIdxStr.Append(indexObject["value"].ToString());
}
But when one class has multiple indexers like we have in our tests, then in Task<JObject> Resolve(ElementAccessExpressionSyntax elementAccess, Dictionary<string, JObject> memberAccessValues, JObject indexObject, List<string> variableDefinitions, CancellationToken token) we'll get multiple "get_Item" methods. In case of Decimal, it is sent as 4th method out of 6 and the 2nd method is public bool this[string key3] => key3.Length > 3;. We are trying all possible methods till one works (does not throw an exception) and by coincidence the boolean-returning method does not throw. That's why we resolve a wrong value by mistake. We return
changed the title [-][wasm[[debugger] Support indexing Dictionary by object key[/-][+][wasm][debugger] Support indexing Dictionary by object key[/+]on Sep 22, 2022
Activity
[-][wasm[[debugger] Support indexing Dictionary by object key[/-][+][wasm][debugger] Support indexing Dictionary by object key[/+]