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

NullReferenceException on GetEnumDescription #208

Open
yefka opened this issue Sep 24, 2020 · 0 comments
Open

NullReferenceException on GetEnumDescription #208

yefka opened this issue Sep 24, 2020 · 0 comments

Comments

@yefka
Copy link

yefka commented Sep 24, 2020

Hi, I got an issue with

New Issue · abelsilvaswaggerwcf - Google Chrome

The issue occurs while opening the swagger webpage, on this line in DefinitionsBuilder.cs :
DescriptionAttribute[] array = (DescriptionAttribute[])value.GetType().GetField(value.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), inherit: false);

the value is System.Reflection.TypeAttributes.Public, and System.Reflection.TypeAttributes.Public.GetType().GetField(System.Reflection.TypeAttributes.Public.ToString()) returns null, so GetCustomAttributes raises this exception.

yefka added a commit to yefka/swaggerwcf that referenced this issue Sep 24, 2020
Avoid NullReferenceException in some cases (see abelsilva#208)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant