Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnumSelect: Exception when binding to nullable enums #3858

Closed
tjdaniel opened this issue May 11, 2024 · 1 comment · Fixed by #3859
Closed

EnumSelect: Exception when binding to nullable enums #3858

tjdaniel opened this issue May 11, 2024 · 1 comment · Fixed by #3859

Comments

@tjdaniel
Copy link

Hi, there is an issue with EnumSelect after improvements of Version 0.19.0

If I use a nullable Enum as the bound value, e. g.:

<EnumSelect TEnum="Visibility?" Placeholder="Please select visibility" @bind-Value="@model.VisibilityNullable" />

@code {
  private Model model = new();
  public enum Visibility
  {
      Private,
      Public
  }
  
  public class Model
  {
      public Visibility? VisibilityNullable { get; set; }
  }
}

an exception is thrown while initialize/render:

The type initializer for 'AntDesign.EnumHelper1' threw an exception. ---> System.ArgumentException: Method 'Boolean HasFlag(System.Enum)' declared on type 'System.Enum' cannot be called with instance of type 'System.Nullable1[antdesigntest.Models.Visibility]'

@ElderJames
Copy link
Member

Thanks for contacting us @tjdaniel , we have fixed this issue in #3859 and will release in next path version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants