13.2.0.0 generating non-working C# client with ChangeType as a culprit
See original GitHub issueUpgrading from 13.1.6.0 to 13.2.0.0 creates client, that compiles, but does not work (Can’t convert from System.String).
Problem is when client is generated, it tries to serialize json to types with ChangeType:
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
var result_ = (System.Collections.Generic.ICollection<string>)System.Convert.ChangeType(responseData_, typeof(System.Collections.Generic.ICollection<string>));
Old version does this correctly:
var objectResponse_ = await ReadObjectResponseAsync<System.Collections.Generic.ICollection<string>>(response_, headers_).ConfigureAwait(false);
return objectResponse_.Object;
Here is the bug repro for this issue: https://github.com/Enegia/NSwagGeneratorChangeTypeBugRepro
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:14 (9 by maintainers)
Top Results From Across the Web
AMIS, Data Driven Blog - Oracle & Microsoft Azure - RSSing.com
Developers kick off the development process discussing the API with their potential customers, generate use cases, and mock up the API before even...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@scberr thanks, that fixed problem for us too.
We have tons of controllers, so we end up using global filter (startup.cs):
Have the same issue here. Just upgrades and the latest upgrade causes this problem