There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
ReliableSqlConnection.ExecuteCommand<T> makes wrong assumptions about return type
Note: this bug concern Azure Integration Pack, more precisely Transient Exception Handling.
ExecuteCommand<T> is the only method available to execute NonQuery, Scalar and Reader.
In my case, we need to use the generic ExecuteScalar with object result, then cast the result in the correct type.
If you use ExecuteCommand<object>(), you will see that a IDataReader is returned instead of an object.
In ReliableSqlConnection.cs, the IsAssignable() method is wrongly used : it's used as <type>.IsAssignableFrom(<base>) instead of <base>.IsAssignableFrom(<type>)
typeof(SqlDataReader).IsAssignableFrom(typeof(IDataReader)) returns false
typeof(IDataReader).IsAssignableFrom(typeof(SqlDataReader)) returns true
So, if (resultType.IsAssignableFrom(typeof(IDataReader))) returns always true for objects, and always false for SqlDataReader.
It works for most case, because I suppose all tests were written with ExecuteCommand<IDataReader> (which works in both cases).
It's the same for XmlReader.
To fix this, what you only need is to reverse the test.
Bonus remark : did you really test the code against ExecuteScalar with DBNull result ? I suppose no, because ReliableSqlConnection change the behavior of IDbCommand.ExecuteScalar when null value is returned.