Unsupported type for Fields (enum)

871 views Asked by At

I'm attempting to create a binding for an iOS Framework for Xamarin (generated by objective sharpie) and it's stumbling on the type of a field:

Structs.cs:

public enum FooType : byte
{
    A = 0,
    B = 1
}

ApiDefinition.cs:

[Static]
partial interface Constants
{
    // extern const FooType Foo;
    [Field("Foo", "__Internal")]
    FooType Foo { get; }
}

It's generating the error:

Error BI1014: bgen: Unsupported type for Fields: FooType for 'Namespace.Constants Foo'.

Are enums not allowed in fields? How can I work around this error?

Edit: I found this setting, but it doesn't fix the error: Screenshot of setting

Edit 2: Apparently the list of types that can be Fields are quite limited, perhaps I should convert the enum type to Int32?

NSString
NSArray
nint / int / long
nuint / uint / ulong
nfloat / float
double
CGSize
System.IntPtr
Enums

Edit 3: Converting the enum type to Int32 worked, but is this valid? Will the code run correctly and return a valid value?

0

There are 0 answers