Announcement

Collapse
No announcement yet.

[OPEN] [#2924] Reflection bug: External

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

    [OPEN] [#2924] Reflection bug: External

    If Reflected class has external property, then JS error occurs:
    api is not defined
    Code example
    class MyClass
    {
       internal ExtClass api { get; private set; }
    }
    [External]
    [Name("fsapi")]
    class FSApi { }

    #2
    Hi,

    Can you provide full test sample?

    Comment


      #3
      I've reproduced it in DECK
      using Bridge;
      using System;
      using System.Reflection;
      
      class Test {
          public static void Main() {
              var type = typeof(MyClass);
              type.GetProperties();
          }
      }
      
      [Reflectable]
      class MyClass
      {
         internal MyApi api { get; private set; }
      }
      
      [External]
      [Name("api")]
      class MyApi { }

      Comment


        #4
        Hi rumc – It's always best to share a link to the Deck. Sharing a link will help save time and ensure we're all looking at the exact same sample.

        As of Bridge 16.0, the [Reflectable] attribute shouldn't be required. I was able to simplify your sample by removing the [Reflectable] attribute and using statements.

        https://deck.net/7ce606e377b4e85969e686860a1a6f62

        class Test 
        {
            public static void Main() 
            {
                var type = typeof(MyClass);
                type.GetProperties();
            }
        }
        
        class MyClass
        {
           internal MyApi api { get; private set; }
        }
        
        [External]
        [Name("api")]
        class MyApi { }

        Comment


          #5
          Issue #2924 has been created to track this defect.

          Comment


            #6
            As of Bridge 16.0, the [Reflectable] attribute shouldn't be required.
            I disable reflection in my config. Because there are too many classes in my project. I need to reflect only particular one.

            Comment

            Working...
            X