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

.NET won't cast to parent interface type #982

Closed
1 of 4 tasks
RomainMuller opened this issue Nov 13, 2019 · 0 comments · Fixed by #983
Closed
1 of 4 tasks

.NET won't cast to parent interface type #982

RomainMuller opened this issue Nov 13, 2019 · 0 comments · Fixed by #983
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings (C#, F#, ...) p0

Comments

@RomainMuller
Copy link
Contributor

RomainMuller commented Nov 13, 2019

🐛 Bug Report

Affected Languages

  • TypeScript or Javascript
  • Python
  • Java
  • .NET (C#, F#, ...)

General Information

  • JSII Version: 0.20.x
  • Platform: agnostic

What is the problem?

The automated conversion of types in the .NET runtime checks too strictly and will
refuse to cast to any type that is not EXACTLY declared on the object reference.
In certain cases however, we are casting to a parent interface of the actual declared
interface and this is 100% legal.

Related

Causes aws/aws-cdk#4989

@RomainMuller RomainMuller added bug This issue is a bug. language/dotnet Related to .NET bindings (C#, F#, ...) p0 labels Nov 13, 2019
RomainMuller added a commit that referenced this issue Nov 13, 2019
# Ceci est le premier message de validation :

add minimal repro for #982

# Le message de validation 2 sera ignoré :

# add java version of test
RomainMuller added a commit that referenced this issue Nov 13, 2019
Cast controls were too strict and prevented the framework from
successfully down-casting an object reference to a parent interface of
it's declared type; causing a cast error.

The new code looks for class compatibility using the standard .NET
primitives and successfully performs the requested cast.

Fixes #982
RomainMuller added a commit that referenced this issue Nov 13, 2019
Cast controls were too strict and prevented the framework from
successfully down-casting an object reference to a parent interface of
it's declared type; causing a cast error.

The new code looks for class compatibility using the standard .NET
primitives and successfully performs the requested cast.

Fixes #982
RomainMuller added a commit that referenced this issue Nov 13, 2019
Cast controls were too strict and prevented the framework from
successfully down-casting an object reference to a parent interface of
it's declared type; causing a cast error.

The new code looks for class compatibility using the standard .NET
primitives and successfully performs the requested cast.

Fixes #982
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. language/dotnet Related to .NET bindings (C#, F#, ...) p0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant