File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ async Task MultiplexingWriteLoop()
9898 }
9999
100100 connector = await OpenNewConnector (
101- command . Connection ! ,
101+ command . InternalConnection ! ,
102102 new NpgsqlTimeout ( TimeSpan . FromSeconds ( Settings . Timeout ) ) ,
103103 async: true ,
104104 CancellationToken . None ) ;
Original file line number Diff line number Diff line change @@ -260,4 +260,24 @@ public async Task As_DbDataSource([Values] bool async)
260260 ? await command. ExecuteScalarAsync( )
261261 : command. ExecuteScalar( ) , Is. EqualTo( 1 ) ) ;
262262 }
263+
264+ [ Test , IssueLink ( "https://github.com/npgsql/npgsql/issues/4840" ) ]
265+ public async Task Multiplexing_connectionless_command_open_connection ( )
266+ {
267+ var csb = new NpgsqlConnectionStringBuilder ( ConnectionString )
268+ {
269+ Multiplexing = true
270+ } ;
271+ await using var dataSource = NpgsqlDataSource . Create ( csb . ConnectionString ) ;
272+
273+ await using var conn = await dataSource . OpenConnectionAsync ( ) ;
274+ await using var _ = await conn . BeginTransactionAsync ( ) ;
275+
276+ await using var command = dataSource . CreateCommand ( ) ;
277+ command . CommandText = "SELECT 1" ;
278+
279+ await using var reader = await command . ExecuteReaderAsync ( ) ;
280+ Assert . True ( reader . Read ( ) ) ;
281+ Assert . That ( reader . GetInt32 ( 0 ) , Is . EqualTo ( 1 ) ) ;
282+ }
263283}
You can’t perform that action at this time.
0 commit comments