AI OnAI Off
Hello again.
I found the problem. Someone was trying to import email recipient list to the server and the text file contained invalid characters like tabulators.
So here's an improvement idea. Validate the incoming data and display clear message to the user what went wrong. Currently error goes to Windows Event Log and that's not really helpful because not everyone has access to the server and only few has necessary administrator rights to view the log.
-Marko
Exception: System.Data.SqlClient.SqlException
Message: Violation of PRIMARY KEY constraint 'PK_tblEPiServerMailAttributeValue'. Cannot insert duplicate key in object 'dbo.tblEPiServerMailAttributeValue'. The duplicate key value is (19, 10f3c226-9d95-410f-b6c5-97b6815fdd2d).
The statement has been terminated.
StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at EPiServer.Common.Data.DatabaseHandler.ExecuteNonQuery(Boolean inTransaction, String sp, CommandType commandType, Object[] args)
at EPiServer.Common.Data.DatabaseHandler.ExecuteNonQuery(Boolean inTransaction, String sp, Object[] args)
at EPiServer.Mail.Sources.Internal.Source.AddAttributeValue(Int32 attributeId, String attributeValue, Guid recipientId)
at EPiServer.Mail.Sources.Internal.Source.AddRecipient(Recipient recipient, RecipientContainer recipientContainer, Hashtable attributes)
at EPiServer.Mail.Sources.Internal.Source.ImportRecipientsFromText(RecipientContainer recipientContainer, Stream currentStream, Char separator)
at EPiServer.Mail.Core.Data.EPiServerMailFactory.ImportRecipients(String name, Stream stream, IRecipientStore store, ISite site)
at EPiServer.Mail.Core.Web.ManageRecipientsControl.ImportRecipients()
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()