web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Plugin error after updating the code

(0) ShareShare
ReportReport
Posted on by 65

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  --  ).

I have the same question (0)
  • Suggested answer
    ankit_singhal Profile Picture
    560 on at

    Please unregister your plugin once and register again. Hope it will work for you

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 70

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans