Hello!
I have build a Custom API with a required EntityCollection request parameter. One use case I have is to sent an empty array but I'm getting a strange error.
- When requesting with no parameter, it fails correctly.
- When requesting with the parameter, with at least one item, it works.
- When requesting with the parameter as as empty array, it errors with 'Object reference not set to an instance of an object.'
The only thoughts I have currently are that Dynamics picks the first item to understand the EntityCollection type but as there are no values it fails inelegantly. I tried setting the Logical Entity Name on the request parameter but I get an error where this can only be set for Entity and EntityReference types.
I recognise one solution could be to make the parameter optional and optionally set it but that's more for the caller...
Why questions to the community are:
- Am I missing something here that would make it work?
- Is this expected (logical) behaviour?
- Are others able to repeat this?
I was able to reprocess this in isolation....