List<'T> appearing in api details UI

Can anyone explain why all our endpoint details pages show List<'T> above ResultStats?

I’ve searched our code base and the phrase List<'T> doesn’t appear anywhere.

It will be likely coming from the use of generics in the response object structure, eg List<T>. The Chinook demo uses AutoQuery endpoints which has QueryResponse as the return type.

From what I can tell without your DTOs, this would be expected, and from your screen shot, IHasPagination is likely doing something similar with generics.

Thanks for getting back to me. I’m not using generics in my Dtos and I’m seeing it on all endpoints…

public interface IHasPagination
{
    public int Skip { get; set; }
    public int Take { get; set; }
}

Can you share your DTOs as an example? Also, could you confirm which version of ServiceStack you are using?

Sure, we’re running ServiceStack 6.3.1

Here’s a basic DTO example…

[Api("Get current server version information.")]
[Route("/version", "GET")]
[Tag("about")]
public class GetServerVersion : IGet, IReturn<ServerVersionResponse>
{

}

public class ServerVersionResponse
{
    public string Company { get; set; }
    public string Description { get; set; }
    public string Copyright { get; set; }
    public string Product { get; set; }
    public string Title { get; set; }
    public string Configuration { get; set; }
    public string Version { get; set; }
    public string InformationalVersion { get; set; }
    public ResponseStatus ResponseStatus { get; set; }
}

And at the bottom of the corresponding UI page you can see the List<'T>.

Thanks @Drammy, Using your provided DTOs, I can’t reproduce the issue. Are you able to create a reproduction of the issue and share it on GitHub? If so I can take a look, find the root cause and have a look at applying a fix.

I’ve downloaded an example app from the start here page on servicestack.net but am struggling to get it to build properly. Will persist in trying…

But the reason for this comment is that I’ve found that if I remove the ResponseStatus from the response DTO the List<'T> disappears

So it is building but I can’t get the UI page to display at all - I just get a blank page.

I’ve only added a single service with a request and response dto. The service works when invoked by the url but the UI page will only appear if I comment out the entire VersionServices class.

I’ve added a repo at https://github.com/Drammy/ss_tlist_recreation

EDIT: @layoric I’ve just realised the push failed, repo is up-to-date now

FYI the blank UI issue is because your Version.cs doesn’t have a namespace, I’ve fixed this issue but please always use a namespace in your DTO project.

When adding the namespace I still can’t repro this issue?

Thanks, that was me rushing the copy and paste…

I can open the UI now so I can try create a repro for you.

The same DTOs and service produce difference results. In the screenshots above you can see the List<'T> and as you say the same DTO in this solution doesn’t.

We’ve a large codebase - any tips on what to try copying in first to try recreate the problem?

Only to copy & paste over DTOs until you can repro it, since it’s showing a generic type definition I’m assuming it’s going to be related to some List<> generic types usage somewhere.

I’d say it’s likely due to not having the concrete type definition when it traverses and inspects a type so all it can include is the generic arg.

None of our DTOs use generics though so I don’t see how it can be the DTOs…

This is a full file search for List<T; most the results are List<Type>.

It’s not List<T>, it’s just referring to using the generic List<> collection class, i.e. typeof(List<>), the T is the argument in the generic List type.

1 Like

Its this DTO here…

Is there a better way of doing this? We want to be able to download a json or csv file of some rows of data without having to find the data inside a response property.

It’s odd that it causes List<'T> to appear in all other endpoint pages as well.

I’ve updated the repo

I’ve changed to use a concrete class inheriting from Collection<> and that has removed all the errant List<'T> references.

OK so I’ve found that returning a Collection like this causes the problems defined in this forum post.

This should now be resolved from the latest v6.3.1+ that’s now available on MyGet.