-
Notifications
You must be signed in to change notification settings - Fork 297
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
System.ArgumentOutOfRangeException on ".ToString()" of SqlException #677
Comments
@BoBiene , Thanks for bringing this to our attention. Can you kindly provide us a sample code resulting in this issue that we can start looking into it? |
Just to add context from what I observe, your error message is "The index was out of range. It must not be negative and smaller than the collection." which seems to occur when this is called: https://github.com/dotnet/SqlClient/blob/master/src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlClient/SqlException.cs#L114 and does your application targets .NET Framework? Kindly confirm.
As I see in .NET Core this is handled: https://github.com/dotnet/SqlClient/blob/master/src/Microsoft.Data.SqlClient/netcore/src/Microsoft/Data/SqlClient/SqlException.cs#L104
Never-the-less I think this should be fixed, along with other places where null checks are missing. cc @JRahnama |
Hi @cheenamalhotra, i can confirm that this issue is only when I target .NET 472, with .NET Core 3.1 it is working. |
Describe the bug
Unable to call ".ToString()" on SqlException
The text was updated successfully, but these errors were encountered: