Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.net-native enum.GetValues trouble

I'm trying to make my app (for Windows 10) working under .NET native.

I got stuck with the following issue: Enum.GetValues fails at runtime with metadata is missing. I managed to simplify test case for this problem (in real life my code looks different). In portable library I have:

public enum enumValues
{        
    A1,     
    B1,        
    C1,
}

public class fff
{
    public static object GetClass2Value()
    {
        return enumValues.B1;
    }
}

In my Universal Windows app I call the following code:

Array aaa = Enum.GetValues(fff.GetClass2Value().GetType());

I receive the following exception:

Additional information: 'enumlibportable.enumValues[]' is missing metadata.

The problem is that I have no idea what to add to Default.rd.xml. I've tried to add different rd strings (enum subtype, enumValues class, enumValues[] etc.) using microsoft tool http://go.microsoft.com/fwlink/?LinkID=392859, but had no luck.

UPDATE: I know that the following code will work for my testcase Enum.GetValues(typeof(enumValue)), but I can't use it in my real project since I don't know the exact enum type in my real project.

like image 381
Access Denied Avatar asked Sep 08 '15 07:09

Access Denied


1 Answers

It doesn't make sense to me, but the following RD string worked for my testcase:

<Type Name="enumlibportable.enumValues[]" Browse="Required All"/>
like image 131
Access Denied Avatar answered Oct 11 '22 00:10

Access Denied