SNOW-993872: System.NullReferenceException when executing Command when CommandText is not set #838
Labels
enhancement
The issue is a request for improvement or a new feature
status-fixed_awaiting_release
The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector.
Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!
2.1.4
Any
E.g. .net framework 4.5.2 or .net standard 2.0
.NET 6
What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
Exception below is thrown when trying to run an ExecuteNonQuery()/ExecuteScalar() on a SnowflakeDbCommand object with no CommandText.
System.NullReferenceException: 'Object reference not set to an instance of an object.'
What did you expect to see?
What should have happened and what happened instead?
Just state that CommandText is not there or empty.
Can you set logging to DEBUG and collect the logs?
https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors
There is an example in READMD.md file showing you how to enable logging.
No, but I bet not checking the existence of the actual SQL in the TrimSql() method is why.
snowflake-connector-net/Snowflake.Data/Core/SFStatement.cs
Line 652 in aaa32fd
Here's the partial stack trace:
at Snowflake.Data.Core.SFStatement.TrimSql(String originalSql)
at Snowflake.Data.Core.SFStatement.Execute(Int32 timeout, String sql, Dictionary`2 bindings, Boolean describeOnly)
at Snowflake.Data.Client.SnowflakeDbCommand.ExecuteNonQuery()
[... My code after this]
The text was updated successfully, but these errors were encountered: