DataAction / AdoNetCore.AseClient

AdoNetCore.AseClient - a .NET Core DB Provider for SAP ASE
Apache License 2.0
107 stars 45 forks source link

ExecuteScalar fails to throw exception #182

Closed ngvtien closed 4 years ago

ngvtien commented 4 years ago

Describe the bug ExecuteScalar fails to throw an exception when expected

To Reproduce If you run the c# code below with the appropriate instances of connection and command created, no exception is being throw

using (var connection = .... ) { using (var command = ....) { command.CommandType = CommandType.Text; command.CommandText = $"SELECT 1 /0 As Error"; return command.ExecuteScalar(); } }

Expected behavior "Divide by zero occurred.".

Environment

Additional context In line 397 of InternalConnection.cs class when readerSource.TrySetException(ex) call fail we should continue throw it up the stack i.e if (!readerSource.TrySetException(ex)) { throw; }