-
Notifications
You must be signed in to change notification settings - Fork 245
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
fix(dotnet): AnonymousObject fails runtime type checks #3709
Conversation
The `AnonymousObject` class is used when a value is passed from JS to .NET through a union or `any` typed return point, and there is not sufficient runtime type information on the value to decisively identify its dynamic type. The `AnonymousObject` class will be converted by the jsii runtime to any interface type implicitly (even if that is technically not correct), and it must hence be allowed through runtime type-checks for interfaces. Essentially, this is a blind spot of the runtime type checks, and should not cause valid code to break.
const varName = `__idx_${createHash('sha256') | ||
.update(descr) | ||
.digest('hex') | ||
.slice(0, 6)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but makes the generated code more readable, which makes it less likely that a bad change is missed by human scrutiny.
const varName = `__item_${createHash('sha256') | ||
.update(descr) | ||
.digest('hex') | ||
.slice(0, 6)}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, but makes the generated code more readable, which makes it less likely that a bad change is missed by human scrutiny.
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Merging (with squash)... |
1 similar comment
Merging (with squash)... |
Merging (with squash)... |
@Mergifyio refresh |
✅ Pull request refreshed |
The
AnonymousObject
class is used when a value is passed from JS to.NET through a union or
any
typed return point, and there is notsufficient runtime type information on the value to decisively identify
its dynamic type. The
AnonymousObject
class will be converted by thejsii runtime to any interface type implicitly (even if that is
technically not correct), and it must hence be allowed through runtime
type-checks for interfaces. Essentially, this is a blind spot of the
runtime type checks, and should not cause valid code to break.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.