-
Notifications
You must be signed in to change notification settings - Fork 163
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
VMSerializer dispatch with arrays #149
Comments
Adding to line 44 will fix it too? if (viewModel is string || viewModel is JArray || !viewModel.GetType().GetTypeInfo().IsClass)
return Convert.ToString(viewModel); If you could send me a PR with a unit test, I'll incorporate it in the next release. |
Yes, adding it to line 44 works too. I will try to make a PR (it will be my first on github ever). |
I hope it's ok that I just added a unit test to the existing SimpleListVM-test. I kind of had everything needed to make a sample with an array of id's. |
#149 Add JArray check to VMSerializer.
Thank you, and congrats on your first successful github PR :) 👍 |
Hi,
it seems since the 3.1 update a change in VMSerializer.Serialize causes an application that sends an array of integers in a dispatch/UpdateVM (e. g. NewValue = "[\r\n 481,\r\n 541\r\n]" in ) to get an exception since a JArray cannot be JSON-serialised.
For me, adding these 2 rows in VMSerializer at row 49, solved the issue and made the application continue to work as before (i made a local copy of the project and added a reference to that instead of the nuget to be able to debug).
if (viewModel is JArray)
{
return viewModel.ToString();
}
Not sure if this is a feasible solution to be part of a future release, but if it is, could you please include this fix?
It worked nicely in the 3.0.1 release, so there might be an prettier fix.
Best Regards
Mikael
The text was updated successfully, but these errors were encountered: