C
C#15mo ago
Dongle

❔ [Trimming] Enum.Parse

What do I have to specify in [DynamicallyAccessedMembers] to make sure that Enum.Parse(Type, String) works properly in trimming?
7 Replies
Dongle
DongleOP15mo ago
For instance, take this code
public class SomeReflectionThing
{
private Type _enumType;
public SomeReflectionThing(Type enumType)
{
// We assume it's an enum.
_enumType = enumType;
}
public object Parse(string input)
=> Enum.Parse(_enumType, input);
}
public class SomeReflectionThing
{
private Type _enumType;
public SomeReflectionThing(Type enumType)
{
// We assume it's an enum.
_enumType = enumType;
}
public object Parse(string input)
=> Enum.Parse(_enumType, input);
}
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Dongle
DongleOP15mo ago
It involved quite some other reflection stuff as well, I was just trying to give some kind of minimal sample
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Dongle
DongleOP15mo ago
Well, in the .NET source code, the Enum(Type, string) function also isn't annotated
reflectronic
reflectronic15mo ago
my guess is that enum members are not trimmed
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server