IsNemoEqualTrue/monitor-table-change-with-sqltabledependency

System.Data.SqlClient.SqlException (0x80131904): The conversation timer cannot be set beyond the conversation's lifetime. Invalid object name

Closed this issue · 4 comments

I am working on some old already written code, it is giving the error, I have no clue why this error is coming.

C# Code:

SqlTableDependency<MyClass> _TableDependency = null;
_TableDependency = new SqlTableDependency<MyClass>(_connectionString, tableName: "MyTable", schemaName: "dbo");
_TableDependency.OnChanged += TableStatus_OnChanged;
_TableDependency.OnError += Table_OnError;
_TableDependency.OnStatusChanged += TableDependency_OnStatusChanged;
_TableDependency.Start(timeOut: 180, watchDogTimeOut: 240);

It is always going in the Table_OnError and giving the below error.

System.Data.SqlClient.SqlException (0x80131904): The conversation timer cannot be set beyond the conversation's lifetime. Invalid object name 'dbo.dbo_MyTable_11a96ea1-4b7a-4c29-89aa-a4fbaf4a9917_Receiver'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.CompleteAsyncExecuteReader(Boolean isInternal, Boolean forDescribeParameterEncryption) at System.Data.SqlClient.SqlCommand.InternalEndExecuteReader(IAsyncResult asyncResult, String endMethod, Boolean isInternal) at System.Data.SqlClient.SqlCommand.EndExecuteReaderInternal(IAsyncResult asyncResult) at System.Data.SqlClient.SqlCommand.EndExecuteReaderAsync(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task`1 promise, Boolean requiresSynchronization) ClientConnectionId:48cb72fd-b15e-497e-aed5-7ccd61add874 Error Number:8410,State:1,Class:16

I found someone recently added few new columns to MyTable, So I deleted these new columns and tried again, it is still giving the same error.

I am using the 1.0.2.16 version NuGet package.
SQL Server Version: Microsoft SQL Server 2019 (RTM-CU9) (KB5000642) - 15.0.4102.2 (X64) Jan 25 2021 20:16:12 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows Server 2019 Datacenter 10.0 (Build 17763: ) (Hypervisor)

Please use the latest NuGet version

Thank you.

But what can be the reason?

First of all, you are using a very very very old version.
So, the first thing to do is upgrade nuget package.
Then let me know if the problem persist.