ServiceStack / Issues

Issue Tracker for the commercial versions of ServiceStack
11 stars 8 forks source link

Bug in recursive type handling when fetching dtos using tags #765

Closed jhf closed 2 years ago

jhf commented 2 years ago

We are experiencing a bug when trying to download the dtos when there is a recursive type and we are using tags.

There seems to be a recursion bug in https://github.com/ServiceStack/ServiceStack/blob/fbca08df4bb06514d932321c16b212e6cf7e8aaa/src/ServiceStack/NativeTypes/NativeTypesMetadata.cs#L1035 where recursion should be stopped if the type analysed is recursive, meaning the name is already added.

I've made a project to reproduce available from https://github.com/veridit/ServiceStackRecursiveTypeError that will be deleted once the error is fixed.

mythz commented 2 years ago

This doesn't repro the issue, creating and updating the C# DTOs works as expected:

image

Note: we're only maintaining the dotnet tools CLI for creating/updating ss refs in future

mythz commented 2 years ago

Might be because it's using the latest v5.12.1 on MyGet.

Can you try updating and seeing if it resolves the issue?

jhf commented 2 years ago

With your sequence, you overwrite with a pristine dtos.cs that doesn't contain the IncludeTypes: {Recursive} that you find in the repository.

Try with a git checkout dtos.cs and then run cs-ref dtos.cs.

I'll try with the latest nuget packages in the meantime.

jhf commented 2 years ago

I've updated with the latest ServiceStack 5.12.1 and the error persists, as described.

mythz commented 2 years ago

Should now work with the latest v5.12.1 on MyGet:

$ nuget locals all -clear

Then restore/run the project.

jhf commented 2 years ago

Yes, now the bug is fixed! Thank you for a quick fix :-)

mythz commented 2 years ago

Great happy it's resolved, thx for the repro 👍