Hey!
Fairley new to the assembly/plugin part, so I have a working assembly code on (on-premise) v9.0 that we needed to update a single line in it (just a regex to check a string field against), and once I update it, it starts producing various errors, any idea what the issue might be?
the old regex:
Regex repeatedRegex = new Regex(@"(\d)\1+$"); if (repeatedRegex.IsMatch(contactMobileNumber.Substring(2))) { throw new InvalidMessageException("Invalid repeated mobile number"); }
the updated regex:
Regex repeatedRegex = new Regex(@"(\d)\1{6,7}"); if (repeatedRegex.IsMatch(contactMobileNumber.Substring(2))) { throw new InvalidMessageException("Invalid repeated mobile number"); }
the errors I started getting are the following:
Url = , Exception = System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: Exception output:: System.Data.SqlClient.SqlException (0x80131904): New transaction is not allowed because there are other threads running in the session. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 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.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String transactionName, TransactionManagerIsolationLevel iso... (Fault Detail is equal to Exception details: ErrorCode: 0x80040216 Message: Exception output:: System.Data.SqlClient.SqlException (0x80131904): New transaction is not allowed because there are other threads running in the session. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 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.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteTransactionManagerRequest(Byte[] buffer, TransactionManagerRequestType request, String ...).
Url = , Exception = System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: System.InvalidOperationException: The connection was not closed. The connection's current state is open. at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.Crm.CrmDbConnection.InternalOpenWithRetry(IDbConnection connection, String descriptionText) at Microsoft.Crm.CrmDbConnection.GetCreateAndOpenConnection() at Microsoft.Crm.CrmDbConnection.Open() at Microsoft.Crm.SqlExecutionContext.InitConnectionAndTransaction() at Microsoft.Crm.SqlExecutionContext.EnsureBeginRequest() at Microsoft.Crm.SqlExecutionContext.get_Connection() at Microsoft.Crm.BusinessEntities.ExecutionContext.OnErrorRequest() at Micros... (Fault Detail is equal to Exception details: ErrorCode: 0x80040216 Message: System.InvalidOperationException: The connection was not closed. The connection's current state is open. at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at Microsoft.Crm.CrmDbConnection.InternalOpenWithRetry(IDbConnection connection, String descriptionText) at Microsoft.Crm.CrmDbConnection.GetCreateAndOpenConnection() at Microsoft.Crm.CrmDbConnection.Open() at Microsoft.Crm.SqlExecutionContext.InitConnectionAndTransaction() at Microsoft.Crm.SqlExecutionContext.EnsureBeginRequest() at Microsoft.Crm.SqlExecutionContext.get_Connection() at Microsoft.Crm.BusinessEnt...).
Url = , Exception = System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: SqlTrans - Encountered disposed Transaction when it should not be disposed (Fault Detail is equal to Exception details: ErrorCode: 0x80040218 Message: SqlTrans - Encountered disposed Transaction when it should not be disposed TimeStamp: 2023-06-13T09:11:36.9232978Z -- Exception details: ErrorCode: 0x80040218 Message: SqlTrans - Encountered disposed Transaction when it should not be disposed TimeStamp: 2023-06-13T09:11:36.9232978Z -- Exception details: ErrorCode: 0x80040216 Message: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'CrmTransaction'.: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #8756C8B3 TimeStamp: 2023-06-13T09:11:36.9232978Z -- ).