Skip to content
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

Generate dynamic type-checks in .NET bindings #3640

Closed
RomainMuller opened this issue Jul 1, 2022 · 1 comment · Fixed by #3668
Closed

Generate dynamic type-checks in .NET bindings #3640

RomainMuller opened this issue Jul 1, 2022 · 1 comment · Fixed by #3668
Assignees

Comments

@RomainMuller
Copy link
Contributor

Generate dynamic type-checking code as part of the generated bindings, so that users get language-specific error messages when they fail to comply with the type requirements of members.

Since this language is statically type-checked by the compiler, runtime type-checking is only useful/necessary in places where type unions are involved (those being implemented as opaque types in the language).

@RomainMuller RomainMuller self-assigned this Jul 20, 2022
RomainMuller added a commit that referenced this issue Jul 21, 2022
Weaving runtime type checks around union-typed parameters to help
developers receive actionable error messages in case mistakes are made.
The checks are only woven if the `DEBUG` preprocessor constant is set,
which means these checks will not be done on `Release` builds, which
optimize for speed.

Fixes #3640
@mergify mergify bot closed this as completed in #3668 Aug 9, 2022
mergify bot pushed a commit that referenced this issue Aug 9, 2022
Weaving runtime type checks around union-typed parameters to help
developers receive actionable error messages in case mistakes are made.
The checks are only performed if the
`Amazon.JSII.Runtime.Configuration.RuntimeTypeChecking` configuration
property is `true` (which it is by default).

A pre-processor macro such as `DEBUG` could not be used as the packages
published to NuGet are already built and this does not afford any control
to the end-user.

Fixes #3640



---

By submitting this pull request, I confirm that my contribution is made under the terms of the [Apache 2.0 license].

[Apache 2.0 license]: https://www.apache.org/licenses/LICENSE-2.0
@github-actions
Copy link
Contributor

github-actions bot commented Aug 9, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant