Steps to reproduce
I also got an 'Unknown message code: 23' exception. This happens within my 'Postgres Notifications' implementation:
This code has worked with npgsql v5.0.10 without problems:
connectionStr = "Host=127.0.0.1;Username=test;Password=test;Database=TEST;Keepalive=60"
var dbConnection= new NpgsqlConnection(connectionStr );
dbConnection.Open();
dbConnection.Notification += OnConnectionOnNotification;
using (var command = new NpgsqlCommand($"listen myChannel;", dbConnection))
{
command.ExecuteNonQuery();
}
while (!token.IsCancellationRequested)
{
dbConnection.Wait(TimeSpan.FromSeconds(5));
}
But with the latest Version v6.0.3 I got an exception (Unknown message code: 23) when
dbConnection.Wait(TimeSpan.FromSeconds(5));
got called the 2nd time - that happens after 5 seconds.
Changing this : dbConnection.Wait(TimeSpan.FromSeconds(5)); to this : dbConnection.Wait(); caused an exception exactly after 60 seconds (see connection string 'Keepalive'.
I've attached a repo (VS Solution). It also contains a file 'PrepareDatabase.txt' which contains the database script including the required trigger SQL scripts.
Exception message:
Stack trace:
at Npgsql.Util.PGUtil.ValidateBackendMessageCode(BackendMessageCode code)
at Npgsql.Internal.NpgsqlConnector.<g__ReadMessageLong|211_0>d.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Npgsql.Internal.NpgsqlConnector.d__259.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Npgsql.NpgsqlConnection.Wait(Int32 timeout)
at Npgsql.NpgsqlConnection.Wait(TimeSpan timeout)
at DoSubscribe(Subscription objSubscription, CancellationToken token) in MyNotification.cs:line 120
Further technical details
Npgsql version: 6.0.3
PostgreSQL version:9.6
Operating system: WIndows 10
If any further info is needed, please let me know.
NpgsqlUnknownCode23.zip
Steps to reproduce
I also got an 'Unknown message code: 23' exception. This happens within my 'Postgres Notifications' implementation:
This code has worked with npgsql v5.0.10 without problems:
But with the latest Version v6.0.3 I got an exception (Unknown message code: 23) when
dbConnection.Wait(TimeSpan.FromSeconds(5));
got called the 2nd time - that happens after 5 seconds.
Changing this : dbConnection.Wait(TimeSpan.FromSeconds(5)); to this : dbConnection.Wait(); caused an exception exactly after 60 seconds (see connection string 'Keepalive'.
I've attached a repo (VS Solution). It also contains a file 'PrepareDatabase.txt' which contains the database script including the required trigger SQL scripts.
Further technical details
Npgsql version: 6.0.3
PostgreSQL version:9.6
Operating system: WIndows 10
If any further info is needed, please let me know.
NpgsqlUnknownCode23.zip