Skip to content

[wasm][debugger] Support calling get_Item passing decimal, float or double as parameter. - #90260

Merged
thaystg merged 6 commits into
dotnet:mainfrom
thaystg:thays_fix_76014
Aug 14, 2023
Merged

[wasm][debugger] Support calling get_Item passing decimal, float or double as parameter.#90260
thaystg merged 6 commits into
dotnet:mainfrom
thaystg:thays_fix_76014

Conversation

@thaystg

@thaystg thaystg commented Aug 9, 2023

Copy link
Copy Markdown
Member

Fixes #76014

@thaystg
thaystg requested a review from ilonatommy August 9, 2023 18:24
@thaystg
thaystg requested a review from radical as a code owner August 9, 2023 18:24
@ghost ghost added the area-Debugger-mono label Aug 9, 2023
@ghost ghost assigned thaystg Aug 9, 2023
@ghost

ghost commented Aug 9, 2023

Copy link
Copy Markdown

Tagging subscribers to this area: @thaystg
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #76014

Author: thaystg
Assignees: -
Labels:

area-Debugger-mono

Milestone: -

@ilonatommy ilonatommy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job

Comment thread src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Comment thread src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs Outdated
else if (expected == ElementType.R8)
Write(expected, objValue["value"].Value<double>());
else
Write(expected, objValue["value"].Value<int>());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we cast then we probably need all cases:

  • ElementType.I2,
  • ElementType.I4,
  • ElementType.I8,
  • ElementType.R4,
  • ElementType.R8,
  • ElementType.U2,
  • ElementType.U4,
  • ElementType.U8.
    Or..let's test if adding tests with them won't throw here, maybe cast to int to all other cases is enough.

("f[shortString]", TBool(false)),
("f[aFloat]", TNumber(1)),
("f[aDouble]", TNumber(2)),
("f[aDecimal]", TNumber(3)) // object

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests corresponding to the comment in MonoSDBHelper.

return false;
break;
default:
return true;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're missing on this list:

  • ElementType.U1,
  • ElementType.Ptr,
  • ElementType.I1,
  • ElementType.ValueType,
  • ElementType.Ptr,
  • ElementType.Void,


var signature = methodDef.Signature;
var sigReader = Assembly.asmMetadataReader.GetBlobReader(signature);
var decoder = new SignatureDecoder<ElementType, object>(_signatureTypeProvider, Assembly.asmMetadataReader, genericContext: null);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

genericContext: null - 👍 for adding the param name!

Comment thread src/mono/wasm/debugger/BrowserDebugProxy/SignatureTypeProvider.cs Outdated
@radical radical changed the title [wasm][debugger] Support calling get_Item passing decimal, float or double as parameter. [wasm][debugger] Support calling get_Item passing decimal, float or double as parameter. Aug 10, 2023
return false;
break;
case ElementType.Char:
if (parameterType != "string" && parameterType != "symbol")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also need a == "object" check?

}
}

private static bool CheckParametersCompatibility(ElementType? typeCode, JObject value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: typeCode -> paramTypeCode

var parameterType = value["type"]?.Value<string>();
var parameterClassName = value["className"]?.Value<string>();

switch (typeCode.Value)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do IIUC that we are checking if value can be passed as an argument to a method with parameter type typeCode?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes.

Comment on lines +557 to +559
case ElementType.Object:
if (parameterType != "object")
return false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do IIUC that we are checking if value can be passed as an argument to a method with parameter type typeCode?
If so, then shouldn't param type == object accept anything?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a method is expecting an object, can we call it passing a integer? I don't think so.

Comment on lines +552 to +553
var parameterType = value["type"]?.Value<string>();
var parameterClassName = value["className"]?.Value<string>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these instead be argumentType, and argumentClassName?

Comment thread src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs Outdated
Comment thread src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Comment thread src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
@ghost ghost added the needs-author-action An issue or pull request that requires more info or actions from the author. label Aug 10, 2023
@ghost ghost removed the needs-author-action An issue or pull request that requires more info or actions from the author. label Aug 11, 2023
@thaystg

thaystg commented Aug 14, 2023

Copy link
Copy Markdown
Member Author

/azp run runtime-wasm-dbgtests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@thaystg

thaystg commented Aug 14, 2023

Copy link
Copy Markdown
Member Author

/azp run runtime

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@thaystg
thaystg merged commit b76fe90 into dotnet:main Aug 14, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[wasm][debugger] Support indexing Dictionary by object key

3 participants