-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG generated code fails with runtime error #51
Labels
bug
Something isn't working
Comments
Hi, @johnpfmg |
This issue occurs on the side of the NSwag.Commands library that the Connected service depends on. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
the generated code at line 1493 var dictionary_ = in attached file fails with error below
var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(parameterValues, settings.Value);
var dictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<System.Collections.Generic.Dictionary<string, string>>(json_, _settings.Value);
Assemblies affected
Which assemblies and versions are known to be affected?
Steps to reproduce
using .net core 3.1
add the attached class UnchaseIssueDemo.cs.txt to a console app or other host app.
Run the code
...
Expected result
A clear and concise description of what you expected to happen.
expect generated code to work
Actual result
What is actually happening.
UnchaseIssueDemo.cs.txt
ContentAccessAPIClient.cs.txt
get error
Message=Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'System.Collections.Generic.Dictionary`2[System.String,System.String]' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
ContentAccessAPIClient.cs.txt
If applicable, add screenshots to help explain your problem.
Additional detail
Add any other context about the problem here.
Optional, details of the root cause if known.
The text was updated successfully, but these errors were encountered: