-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable string properties evaluation of Length and Char[]. #67028
Conversation
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsNeeds fixing indexing with expressions before all the tests will be able to pass.
|
/azp run |
You have several pipelines (over 10) configured to build pull requests in this repository. Specify which pipelines you would like to run by using /azp run [pipelines] command. You can specify multiple pipelines using a comma separated list. |
3edc97d
to
2c9d96d
Compare
2c9d96d
to
cef3404
Compare
0c9a72e
to
8b9a556
Compare
could we add an extra field with the id and use the object logic? |
We would have to introduce this objectId on the runtime side then and that's the biggest problem. It's possible but complicated, that's why I decided on a not too neat but easy fix. @thaystg, you would probably assess it better. Does it pay off to add objectIds for strings for the purpose of its 2 properties evaluation in the debugger? |
Yes, for string is not so difficult as we already have an string_id on runtime side. We just need to change the browserDebugProxy side. |
I'm not sure what is the best approach, because the way that is implemented we only need to "go to" runtime once, to get the string value, and the rest is resolved on BrowserDebugProxy side. |
The current state is that we are able to get some information for strings using the same methods that we are using for objects. If we will be able to get properties the same way, then we agreed on editing this PR and resolving string's properties and also methods on strings. on the runtime. If it's not a case then we will stick to debugger side for both and the PR will not be changed. |
Can't we fallback to compiling the expression, since we have the string value? roslyn can take care of indexing, or properties on the string. |
string local_str = "foobar"; // this is the value that we have
return local_str[0] // or local_str.Length Same as what we do for other stuff. |
So the problem of Length property is solved easily by granting "objectId" to the string. It does not solve indexing yet. |
What you said it true, Roslyn can take care of indexing and properties and that's what this PR was originally doing. I guess you meant that we should not add the logic for this problem to Because we succeeded in granting objectIds for strings, properties problem will be solved the same way as we solve it for objects - talking to runtime. We will avoid confusing people when reading the code this way and avoid making a special "properties extraction process" only for string schema. |
…luated the similarly as on objects.
Failures in staging are caused by #70983. |
There are failures on CI. |
Without this PR evaluation of:
str.Length
str[0]
results in unable to evaluate.
The problem is that we don't get the properties of string from runtime, only its value.
objectId
to strings by saving on the debugger side theirstringId
by which they are identified on the runtime side (see: changes inJObjectValueCreator.cs
).objectId
now, their methods should be invoked the same way as objects's methods - on the runtime side - it seems logical in this situation.GetMethodIdsByName()
. Now we are looking through all of them to make sure none matches the form passed in the expression. Existing tests were enough to test it, e.g. Split has 10 different forms.EvaluateExpression.cs
are connected with correcting a merge error: both ConvertCLRToJSType and ConvertCSharpToJSType were existing, doing the same job but we were not using one of them. This PR merges them into one function as it was supposed to be.