Skip to content
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

Can't JSON Deserialize BacnetAddress #54

Closed
drosenba opened this issue Apr 10, 2020 · 3 comments
Closed

Can't JSON Deserialize BacnetAddress #54

drosenba opened this issue Apr 10, 2020 · 3 comments

Comments

@drosenba
Copy link

I'd like to use Newtonsoft.Json to serialize and then deserialize a List
I can serialize it, but I can't deserialize it. Why doesn't BacnetAddress have a default constructor? Can it? :)

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type System.IO.BACnet.BacnetAddress. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path '[0].Address.net', line 1, position 19.

@gralin
Copy link
Member

gralin commented Apr 26, 2020

@drosenba sure, this class could have all constructor arguments with default values which would solve your issue. Which branch are you using?

@drosenba
Copy link
Author

drosenba commented Apr 27, 2020

Nuget package BACnet.Core (1.0.30)

@gralin
Copy link
Member

gralin commented May 6, 2020

@drosenba that package comes from a fork of this repository, becuase the original nuget from here still doesn't have .net core version up on nuget. I will try to publish it but since it was added in version 2 which has some breaking changes, it might be a beta at first.

https://www.nuget.org/packages/bacnet/

@gralin gralin closed this as completed May 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants