We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider the following definition:
class Base { public int Field1; } class Derived<T> : Base { public T? Field2; }
... then the following code will fail when the Fields property is called:
Fields
var ctype = typeof(Derived<int>).ToContextualType(); foreach (var f in ctype.Fields) { Console.WriteLine(f.Name); }
The reason is explained in a frustrating NSwag bug reported here: RicoSuter/NSwag#4842 (comment)
This is using Namotion.Reflection 3.1.1.
After some further digging, it looks like in the master bransh of Namotion, this was corrected. Merged pull request #151 (comment)
_fields = Type.GetRuntimeFields().Select(field => { if (field.DeclaringType is { IsGenericType: true }) { var genericType = field.DeclaringType.GetGenericTypeDefinition(); var genericField = genericType.GetRuntimeField(field.Name); if (genericField != null && genericField.FieldType.IsGenericParameter) { var actualType = GenericArguments[genericField.FieldType.GenericParameterPosition]; var actualIndex = actualType._nullableFlagsIndex; return new ContextualFieldInfo(field, ref actualIndex, actualType._nullableFlags); } } var index = 0; return new ContextualFieldInfo(field, ref index, null); }).ToArray();
... but I don't know how to proceed to generate a new version of NSwag with this included.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider the following definition:
... then the following code will fail when the
Fields
property is called:The reason is explained in a frustrating NSwag bug reported here: RicoSuter/NSwag#4842 (comment)
This is using Namotion.Reflection 3.1.1.
After some further digging, it looks like in the master bransh of Namotion, this was corrected.
Merged pull request #151 (comment)
... but I don't know how to proceed to generate a new version of NSwag with this included.
The text was updated successfully, but these errors were encountered: