Announcement

Collapse
No announcement yet.

[CLOSED] [#3502] Casting error/bug - May relate to invariance

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [CLOSED] [#3502] Casting error/bug - May relate to invariance

    The issue seems to be in the Bridge is function. It tries to validate the cast but for this path, it just validates it on object/string basis. Invariance allows casting an IInterface<out T> from IIterface<Sub> to IIterface<Base>. This seems to be completely missing in this case. (isAssignableFrom in this case is unset on the type).

    Here is a sample reproduction of the issue.
    https://deck.net/101b1e11f6d2a5904f75de24e9b5753a

    This issue is fairly critical, but we do have a workaround: cast to the base type before creating the 'list'.

    Thanks,
    selinc.
    Last edited by geoffrey.mcgill; 2018-03-27 @ 10:12 PM.

  • selinc
    replied
    Thank you Fabricio + Geoff!

    Appreciate the promptness.

    Leave a comment:


  • fabricio.murta
    replied
    The fix was submitted and merged upstream! It will be available next Bridge release (currently would be 17.0.0).
    The github issue that handled this problem is #3502.

    Leave a comment:


  • geoffrey.mcgill
    replied
    Thanks for the update. We have this scheduled to fix right away.

    Leave a comment:


  • selinc
    replied
    Here are the updated samples (I missed an out keyword):
    https://deck.net/7e74dc32521e99298c8d3361f9cffc63

    https://dotnetfiddle.net/lLu3Ta

    Leave a comment:


  • geoffrey.mcgill
    replied
    Hi selinc,

    Can you take a look at sample again and confirm that the scenario should be working in native C#?

    When I run the sample in native C# I get the same Unable to cast object run-time exception.

    https://deck.net/443880c49540671ecc05195a5401bf71

    https://dotnetfiddle.net/mCpzMy

    We're running a few more tests, but please post an updated Deck if updates to the original sample are required to fully demonstrate the failing scenario.


    Leave a comment:


  • geoffrey.mcgill
    replied
    Hi selinc. Thanks for the report. We are investigating right now.

    Leave a comment:

Working...
X