-
Notifications
You must be signed in to change notification settings - Fork 260
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
InvalidCastException deserializing a SqlException #524
Comments
Looks like you are using the legacy System.Data.SqlClient - have you tried the provider in this repo: Microsoft.Data.SqlClient ? |
Hi @amartini-n I've made PR #527 to fix the issue, please give it a try and let us know! |
You were absolutely right! Sorry for that. |
Thank you @cheenamalhotra, it works.
|
Hi, This would also support any IFormatterConverter implementations. I have not tested it but there might be a problem with since the internal JsonReader of the JsonFormatterConverter has already processed the value. |
Hi @malylemire1 Could you elaborate your concern with an example and how the PR impacts it? |
Hi, What I mean is that changing
To
Is enough change to SqlException to make the test pass. I have pulled the repo and tried it. And it will also support any custom json.net converter for Guid @"""ClientConnectionId"":""GuidUsingCustomConverterValue""}"; |
Thanks @malylemire1 I've included your suggestion in the PR. |
Describe the bug
When deserializing a SqlException from a JSON string by using Newtonsoft JSON I got the following exception.
To reproduce
Expected behavior
I expected to be able to deserialize with no problem an instance of SqlException from its JSON string representation.
Further technical details
Microsoft.Data.SqlClient version: 4.8.1
.NET target: Core 2.2, Core 3.0
SQL Server version: n/a
Operating system: Windows 10.0.17763
The text was updated successfully, but these errors were encountered: