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

Error if Service call returns collection of Result DTOs #8

Closed
donaldgray opened this issue Sep 28, 2016 · 0 comments
Closed

Error if Service call returns collection of Result DTOs #8

donaldgray opened this issue Sep 28, 2016 · 0 comments
Labels

Comments

@donaldgray
Copy link
Contributor

A null reference exception is being thrown if a Service call returns a generic collection (e.g. IEnumerable).

E.g.

// This is fine
public ReturnDto Any(RequestDto){}

// As is this
public ReturnDto[] Any(RequestDto){}

// This is not
public IEnumerable<ReturnDto> Any(RequestDto){}

The issue is the call to Type.GetElementType() is returning null when the resourceType is an IEnumerable collection (PropertyEnricherManager ln46).

Type.GetElementType() is for Array types, need to update to use Type.GetGenericArguments if IEnumerable. See http://stackoverflow.com/questions/7072088/why-does-type-getelementtype-return-null

@donaldgray donaldgray added the bug label Sep 28, 2016
wwwlicious added a commit that referenced this issue Sep 30, 2016
Only setting AllowMultiple on request types and request properties
Only setting IsCollection on response types and response properties
Fixing issue #8 for reflection enrichers
Updated sources doc
@wwwlicious wwwlicious mentioned this issue Sep 30, 2016
wwwlicious added a commit that referenced this issue Sep 30, 2016
Only setting AllowMultiple on request types and request properties
Only setting IsCollection on response types and response properties
Fixing issue #8 for reflection enrichers
Updated sources doc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants