Skip to content

Seq.empty renders as "EmptyEnumerable" #17864

Open
@bartelink

Description

@bartelink

Seq.empty<MyType> renders as the string "EmptyEnumerable" when fed through AspNetCore 8 ObjectResult

The same does not happen for Seq.choose and other such functions when they yield an empty sequence, as they yield a different internal impl type wrapping their output, which in my context winds up producing [] as required

Expected behavior

render as []

Actual behavior

renders as "EmptyEnumerable"

Known workarounds

use Array.empty<MyType> instead

Related information

  • happen to be using JSON.NET and a random mix of middlewares and don't have time to root cause deeper, but it surprised me
  • MyType has a JsonConverter registered
  • Did not yet try with System.Linq.Enumerable.Empty<MyType>()

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions