No announcement yet.

[CLOSED] [#3251] ObjectCreateMode.Constructor) with struct fails

  • Filter
  • Time
  • Show
Clear All
new posts

    [CLOSED] [#3251] ObjectCreateMode.Constructor) with struct fails

    The following code:

    public struct PlaceKey { }
    results in the following error:

    [ObjectLiteral] with Constructor mode should be inherited from a class with the same options

    I'm sure if this is faulty behaviour and that structs should be allow to use ObjectCreateMode.Constructor? If there is some complication with this (maybe due to structs requiring a default value that isn't null... I'm sure not sure if that could affect it?) then I think that the error text may need tweaking since structs can't inherit from classes.

    If I remove the ObjectCreateMode.Constructor attribute value then I get a different error:

    Bridge.Translator.TranslatorException: [ObjectLiteral] class (plain mode) does not support custom constructors with parameters other than with ObjectLiteralAttribute properties
    EDIT: I realised that the original code sample that I provided won't trigger this error but I'm sure you get the picture - if I have a struct that has a constructor then it will cause this problem. Removing "ObjectCreateMode.Constructor" from the [ObjectLiteral] allows structs to have that attribute on.. but only if they don't have a constructor, which in many places I do.
    Last edited by ProductiveRage; 2017-10-30 @ 01:54 PM.


      Hi ProductiveRage

      Thanks for bringing this to our attention. We will investigate this issue and try to fix right away.

      This thread will be kept updated with our progress.