-
-
Notifications
You must be signed in to change notification settings - Fork 567
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
Inconsistent ObjectInstance.GetOwnProperties #1945
Comments
Adding public methods sounds reasonable as they can be invoked. Would you like to create a PR with some test coverage? |
Sure, I'll go ahead. Technically, I would consider this breaking, since consumers might be relying on the fact that the method in question works the way it does now, so this might warrant a 4.1 release. |
One option is to add new enum flags property to interop options defining returned properties and omit methods for now. |
solved in #1947 |
Version used
4.0.1
Describe the bug
I'm working on a Blazor debugger for Jint. Recently I've encountered a weird inconsistency - if the thing is intentional, feel free to yell at me.
ObjectInstance.GetOwnProperties()
behaves (at least from my perspective) differently for CLRObjectWrapper
and nativeObject
instances.For CLR objects, only properties and fields get reported:
While native objects report properties, which are methods as well. For example:
reports
myFn
when callingGetOwnProperties
on a correspondingJsValue
, while only props and fields are reported for CLR objects as per the code above.While I understand that
myFn
is a property from the JS perspective andpublic void MyFn()
is a method from CLR perspective, it still seems inconsistent, given we report fields from CLR objects already.My understanding is that
GetOwnProperties
is the tool to check from the CLR side, how the JS interpreter sees the given object, hence my suggestion to include methods too.Expected behavior
Methods of CLR objects are reported from
GetOwnProperties
(we includeGetMethods
result in the code above).The text was updated successfully, but these errors were encountered: