Announcement

Collapse
No announcement yet.

[CLOSED] [#2467] [16.0] Static auto-intialiser in struct doesn't work (constructor arguements are lost)

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

    [CLOSED] [#2467] [16.0] Static auto-intialiser in struct doesn't work (constructor arguements are lost)

    When the following code is run, in .NET it writes out "123" but Bridge-generated JavaScript writes out "0".

    public class Program
    {
        public static void Main()
        {
            Console.WriteLine(MyStruct.Example.Value);
        }
    }
    
    public struct MyStruct
    {
        public static MyStruct Example { get; } = new MyStruct(123);
        public MyStruct(int value)
        {
            Value = value;
        }
        public int Value { get; }
    }
    Available at http://deck.net/c41c66f54a5b6298819de9fc7bd396fa and https://dotnetfiddle.net/AYTc6H.

    In the struct's "Init" method, the following code may be seen -

    this.Example = new Demo.MyStruct();
    The 123 constructor argument has got lost somewhere along the way.

    #2
    Hi ProductiveRage,

    Thanks for posting this defect and excellent sample demonstrating how to reproduce.

    We'll create an official Issue today and we're already working on a fix. We'll keep this thread updated with our progress.

    Comment


      #3
      Fix for issue #2467 merged into master branch and will be included in the next Bridge.NET release.

      Comment

      Working...
      X