Announcement

Collapse
No announcement yet.

[CLOSED] [#3103] [16.3] default(Type) is not null in some cases

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

    [CLOSED] [#3103] [16.3] default(Type) is not null in some cases

    Hi

    I noticed that when a class is decorated with [ObjectLiteral(ObjectCreateMode.Constructor)], then its default(Type) does not return null. On first glance this seems to be a bug, but I'm not sure if there's some deeper meaning behind this. In any case it messes up my JSON-deserialization, because I check the ResponseText for "null" and then return default(Type) which should be also null for any class type. Surprisingly it works with [ObjectLiteral(ObjectCreateMode.Plain)]

    Reproduction: https://deck.net/ea3681ffd342563c0a8111cef1b72d56

    Thanks,
    Marco


    #2
    I was looking at it, it looks like a bug, if you type:

    defPerson == default(Person)
    // Translates to:
    Bridge.referenceEquals(defPerson, null)
    I think at compile time it can't work out what T will be.

    Comment


      #3
      Fix for the issue (PR #3120) merged into v16.3 branch and will be included in the next Bridge.NET release.

      Comment

      Working...
      X