DotNetHypermedia / DotNetHypermedia

Hal media type server side library for .NET
MIT License
14 stars 6 forks source link

Representation Links ArgumentNullException when Href is not set #19

Closed joeburdick closed 7 years ago

joeburdick commented 7 years ago

Consider this Representation and corresponding SimpleListRepresentation:

public class ItemRepresentation : Representation {}

public class ItemListRepresentation : SimpleListRepresentation<ItemRepresentation>
{
    public ItemListRepresentation() { }

    public ItemListRepresentation(IList<ItemRepresentation> list) : base(list) { }
}

If an ItemListRepresentation contains an ItemRepresentation without Href property set, then RepopulateHyperMedia() on ItemRepresentation will set Links to null, which will cause an ArgumentNullException to be thrown by ToLink(IHypermediaResolver resolver).

Should a more informative exception be thrown somewhere to handle this case?

danbarua commented 7 years ago

Hi @joeburdick

Was this issue meant for WebApi.Hal?

joeburdick commented 7 years ago

Yes. I'm stupid. Sorry about that.