2016r2 GetTypeInfo Issues

I have methods that no longer compile in 2016r2

Private Function TypeList() As Introspection.TypeInfo() return Array(GetTypeInfo(CWDB.Agreement),_ GetTypeInfo(cwdb.Company),_ GetTypeInfo(cwdb.Member),_ GetTypeInfo(cwdb.xProperty)_ ) End Function

This use to compile fine but now it throws an error:

Am I missing something or did this functionality get broken?

<https://xojo.com/issue/44619>

Has this changed from the betas to the release ?

Just changed from 2016r1 to 2016r2

This project was started within the last month and wasn’t opened in any of the betas.
Is there anyway to work around this? Shouldn’t GetTypeInfo return the introspection.typeinfo and NOT the xojo.introspection.typeinfo?

See #39087 under New Items for 2016r2 in the release notes. It is an intentional change and allows all platforms to use GetTypeInfo.

The problem is that the new xojo.introspection returns Autos instead of Variants, and autos are still a major pain to work with.

I use to be able to just do attribute.value.stringValue
Now I need a ton of helper methods to do anything, like:

[code]Function TextValue(extends a as Auto) As text
Dim info As Xojo.Introspection.TypeInfo = Xojo.Introspection.GetType(a)
#if TargetDesktop or TargetWeb then
if info.Name = “string” then
return CType(a, string).totext
elseif info.name = “variant” then
dim v as Variant = a
return v.TextValue
end
#endif
Select Case info.Name
Case “Integer”
return CType(a, Integer).totext
Case “Int8”
return CType(a, Int8).totext
Case “UInt8”
return CType(a, UInt8).totext
Case “UInt16”
return CType(a, UInt16).totext
Case “UInt32”
return CType(a, UInt32).totext
Case “UInt64”
return CType(a, UInt64).totext
Case “Short”
return CType(a, Short).totext
Case “Byte”
return CType(a, Byte).totext
Case “Int32”
return CType(a, Int32).totext
Case “Int64”
return CType(a, Int64).totext
Case “text”
dim t as text = a
return t
Case “Double”
return CType(a, Double).totext
Else
return “”
end

End Function
[/code]

You need to avoid the Array function for this to work, as the array function uses – if all elements are of the same class – this class as element type:

Private Function TypeList() As Introspection.TypeInfo() Dim arr() As Introspection.TypeInfo arr.Append Array(GetTypeInfo(CWDB.Agreement) arr.Append GetTypeInfo(cwdb.Company) arr.Append GetTypeInfo(cwdb.Member) arr.Append GetTypeInfo(cwdb.xProperty) return arr ) End Function

Or you cast each element when using the Array() function:

Private Function TypeList() As Introspection.TypeInfo() Return Array( _ Introspection.TypeInfo(GetTypeInfo(CWDB.Agreement)), _ Introspection.TypeInfo(GetTypeInfo(cwdb.Company)), _ Introspection.TypeInfo(GetTypeInfo(cwdb.Member)), _ Introspection.TypeInfo(GetTypeInfo(cwdb.xProperty)) _ ) End Function