New Framework incomplete?

So… I keep attempting to use the new framework and also keep seeing “This item does not exist.” SOME (quite a few though) of the new framework items work and do not prompt an error, while others do… it’s all luck of the draw, which makes the old framework so much more appealing at the moment; it still works.

For example, plug this into Xojo, I used HTTPSocket as not to make a complicated mess of uploading project files etc etc.

  Using Xojo.Introspection
  Dim obj as new HTTPSocket
  
  Dim info As TypeInfo = GetInfo(obj)
  
  Dim attrs() As AttributeInfo = GetType(info).GetAttributes
  
  For Each a As AttributeInfo In attrs
    ListBox1.AddRow(a.Name)
  Next

You’ll instantly see when attempting to run, that “GetInfo” does not work and prompts “This item does not exist.” It’s happened for over a dozen attempted usages of the new framework. Is it just me? Are the docs wrong? Have the demos in the docs even been tested?

Quite literally its you using the wrong methods - put your code into an iOS app (replacing the listbox) and you’ll see GetInfo is the OLD framework
So you have a mish mash of old & new there

See http://developer.xojo.com/xojo-introspection

In a desktop app try using fully qualified names

[code] Dim obj as new HTTPSocket

Dim info As TypeInfo = Xojo.Introspection.GetInfo(obj)

Dim attrs() As AttributeInfo = GetType(info).GetAttributes

For Each a As AttributeInfo In attrs
ListBox1.AddRow(a.Name)
Next[/code]
And you’ll get compile errors

I was doing something similar the other day in an iOS app. It does work. I really suggest you do the fully qualified new framework names because I think what you’re seeing is that the compiler is mixing and matching.

dim info as xojo.Introspection.TypeInfo = xojo.Introspection.GetType(new base)

There is no GetInfo, it is called GetType.
There is no GetAttributes, it is called Attributes.

The new framework Introspection namespace works fine for desktop projects. When using the Using clause autocomplete doesn’t work and it will sadly show the members of the old framework classes.

So this will work:

[code]Using Introspection

Dim obj As New HTTPSocket()
Dim info As TypeInfo = GetType(obj)

Dim attrs() As AttributeInfo = info.Attributes

For Each a As AttributeInfo In attrs
ListBox1.AddRow(a.Name)
Next[/code]

[quote=204877:@Eli Ott]There is no GetInfo, it is called GetType.
There is no GetAttributes, it is called Attributes.

The new framework Introspection namespace works fine for desktop projects. When using the Using clause autocomplete doesn’t work and it will sadly show the members of the old framework classes.

So this will work:

[code]Using Introspection

Dim obj As New HTTPSocket()
Dim info As TypeInfo = GetType(obj)

Dim attrs() As AttributeInfo = info.Attributes

For Each a As AttributeInfo In attrs
ListBox1.AddRow(a.Name)
Next[/code][/quote]

Aha! that answered the question. I have an application which uses the old framework absolutely fine, and I’ve been updating the framework to the new framework, so once it becomes a standard, there won’t be a ginormous mess. The code I posted was straight out of the Xojo Documentation; which apparently is very vague or contains a typo.

The exact same example from the docs at http://developer.xojo.com/xojo-introspection-attributeinfo, simply does not work… because it says “GetInfo” not “GetType”. The original code using the old framework uses the GetType method.

Ironically, the docs at http://developer.xojo.com/xojo-introspection show no GetInfo, only GetType :slight_smile:

Oops. This is now fixed.

There are also some examples that show the Introspection stuff here:

  • Examples/iOS/Framework/IntrospectionExample
  • Examples/Xojo Framework/IntrospectionExample

[quote=204888:@Paul Lefebvre]Oops. This is now fixed.

There are also some examples that show the Introspection stuff here:

  • Examples/iOS/Framework/IntrospectionExample
  • Examples/Xojo Framework/IntrospectionExample[/quote]

Thanks Paul for all your hard work! Typos happen :slight_smile: I always appreciate the hard work everyone at Xojo does!