JC
JC
CC#
Created by xriba on 5/7/2024 in #help
✅ Hosted Service running as Windows Service
echo.websocket.org doesn't look like it's available anymore https://www.lob.com/blog/websocket-org-is-down-here-is-an-alternative so that may explain why you're unable to connect to it in your StartAsync.
19 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
I think you're recursively entering the same serializer by trying to deserialize the derived type.
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
take a look at changing StepSpecial? stepSpecial = serializer.Deserialize<StepSpecial>(reader); to StepSpecial? stepSpecial = jObject.ToObject<StepSpecial>(serializer);
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
As far as your current converter is concerned
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
but you probably want to add a descriminator field
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
You could take a look at https://github.com/dmitry-bym/JsonKnownTypes if you're going to stick with netwonsoft
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
JsonDerivedTypeAttribute would probably be what you're looking for, if .NET 7+ is your target
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
Now, I'll assume you are not planning to allow typenamehandling
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
I don't know if that's something trivially done by System.Text.Json. If you try to deserialize to Step[], you're going to get an array of Step only.
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
I think the problem, as I understand it, is that you have Step[] as your target, but want to include derived classes as a part of the result
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
STJ can have some behavior thats unexpected, but generally reasonable. If you're serializing to an interface, only the members of that interface will be serialized.
61 replies
CC#
Created by Elio on 4/26/2024 in #help
✅ JSON Deserialize Derived Class
If you're already deep into Newtonsoft with things like custom converters switching to STJ might not be trivial
61 replies