-
-
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
Static members in CLR types act like instance members when marshalled to JS #1977
Comments
This would probably be a breaking change. Would you like to propose a PR and check how existing tests behave? |
OK, I'll do that. |
I've made my changes and they do seem to break two existing tests: |
I think this just needs some think trough, generally exposing statics sounds wrong. Usually checking how JS treats such things with |
Looking at JS's own |
I've done a bit simpler approach with #1981 which also allows reverting back to old behavior if needed. |
Version used
4.0.3
Describe the bug
When adding a CLR type reference to an engine via
TypeReference.CreateTypeReference
, static members in the type act the same way as instance members when used in JS.To Reproduce
Expected behavior
Attempting to read static members on an object instance should return
undefined
, and stringifying an object instance should not include static fields/properties in the result.Additional context
This is especially problematic for types that contain static members of themselves (such as
Guid
withGuid.Empty
), as attempting to stringify instances of these types would result in a cyclic dependency.The text was updated successfully, but these errors were encountered: