MasterDevs / ChromeDevTools

.NET library to interact with the Chrome Debugger
MIT License
135 stars 90 forks source link

Fix deserialisation of responses #6

Closed qmfrederik closed 8 years ago

qmfrederik commented 8 years ago

The Result property of the CommandResponse<T> object was never being assigned in my case.

I tracked it down to Result having a private setter, which Newtonsoft.Json apparently never tries to assign values to (at least in the most recent versions).

You can workaround this by creating a custom ContractResolver.

This PR implements that behavior, and allows for the creators of the CommandResponseFactory to pass a customer serializer if they so desire. I also made the MessageContractResolver you ship public, as I for example wanted to re-use that one in my code (I manually serialize the CommandRequests to the wire).

I added a unit test which can act as a non-regression test for this fix.

qmfrederik commented 8 years ago

I think this is actually the same issue as #4, so this PR should help you resolve that one, too.

qmfrederik commented 8 years ago

... and probably this solves #1 as well :)

brewdente commented 8 years ago

This is great news! I noticed that the build failed. Is it easily fixable?