Not able to override cleanup policy

Hello

When I try to change and save cleanup policy, I get the next error: “SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM”. It happens on the project and configuration level
. We are using Continua 1.8.1.477. Here are errors and warnings from the event log:

Importance: Error)

Date: Wednesday, May 24, 2017)
Time: 3:02:17 PM)

Message:

Web

The web server reported the following error:
Exception: FaultException1<br><br>Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.<br><br>Stack Trace:&nbsp;<br>Server stack trace:&nbsp;<br>&nbsp; &nbsp;at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)<br>&nbsp; &nbsp;at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object&#91;&#93; ins, Object&#91;&#93; outs, TimeSpan timeout)<br>&nbsp; &nbsp;at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)<br>&nbsp; &nbsp;at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)<br><br>Exception rethrown at &#91;0&#93;:&nbsp;<br>&nbsp; &nbsp;at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)<br>&nbsp; &nbsp;at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)<br>&nbsp; &nbsp;at Continua.Modules.Builds.Common.Services.Contracts.IBuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)<br>&nbsp; &nbsp;at Continua.Web.Builds.Controllers.ConfigWizardController.<>c__DisplayClass30_0.<cleanup>b__0(IBuildExpirationPolicyService x)<br>&nbsp; &nbsp;at Continua.Web.ContinuaController.With&#91;TService&#93;(Action1 action, ServiceEndpointOptions options) in W:\CI_WS\Ws\810776\Source\CT_Source\Source\Continua.Web\Controllers\ContinuaController.cs:line 853
   at Continua.Web.Builds.Controllers.ConfigWizardController.Cleanup(String id, BuildCleanupPolicyDTO policy, Nullable1 overridden, Nullable1 runNow)

Service Exception Details
=======================

Exception: SqlTypeException

Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Stack Trace:    at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource1 completion, Int32 startRpc, Int32 startParam)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task&amp; task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()<br>&nbsp; &nbsp;at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)<br>&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)<br>&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()<br>&nbsp; &nbsp;at NHibernate.Engine.ActionQueue.ExecuteActions()<br>&nbsp; &nbsp;at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)<br>&nbsp; &nbsp;at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)<br>&nbsp; &nbsp;at NHibernate.Impl.SessionImpl.Flush()<br>&nbsp; &nbsp;at NHibernate.Transaction.AdoTransaction.Commit()<br>&nbsp; &nbsp;at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()<br>&nbsp; &nbsp;at Continua.Modules.Builds.BuildExpirationPolicyManager.CreatePolicy(Project project, Configuration configuration)<br>&nbsp; &nbsp;at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)<br><br>This event has been reported 9 times.<br><br>Importance: Warning)<br><br>Date: Wednesday, May 24, 2017)<br>Time: 3:02:17 PM)<br><br>Message:<br><br>Unhandled Fault Exception<br><br>Exception: FaultException1

Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Stack Trace:    at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)
   at SyncInvokeCreatePolicy(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Service Exception Details
=======================

Exception: SqlTypeException

Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.

Stack Trace:    at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource1 completion, Int32 startRpc, Int32 startParam)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task&amp; task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()<br>&nbsp; &nbsp;at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)<br>&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)<br>&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()<br>&nbsp; &nbsp;at NHibernate.Engine.ActionQueue.ExecuteActions()<br>&nbsp; &nbsp;at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)<br>&nbsp; &nbsp;at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)<br>&nbsp; &nbsp;at NHibernate.Impl.SessionImpl.Flush()<br>&nbsp; &nbsp;at NHibernate.Transaction.AdoTransaction.Commit()<br>&nbsp; &nbsp;at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()<br>&nbsp; &nbsp;at Continua.Modules.Builds.BuildExpirationPolicyManager.CreatePolicy(Project project, Configuration configuration)<br>&nbsp; &nbsp;at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)<br><br>This event has been reported 16 times.<br><br>Importance: Error)<br><br>Date: Wednesday, May 24, 2017)<br>Time: 3:02:17 PM)<br><br>Message:<br><br>NHibernateDatabase.SaveChanges<br><br>Error: Could not commit transaction: Exception: SqlTypeException<br><br>Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.<br><br>Stack Trace: &nbsp; &nbsp;at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, _SqlRPC&#91;&#93; rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource1 completion, Int32 startRpc, Int32 startParam)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task&amp; task, Boolean asyncWrite)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()
   at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)
   at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)
   at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()
   at NHibernate.Engine.ActionQueue.ExecuteActions()
   at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
   at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
   at NHibernate.Impl.SessionImpl.Flush()
   at NHibernate.Transaction.AdoTransaction.Commit()
   at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()

, Pre-commit call stack:    at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()
   at Continua.Modules.Builds.BuildExpirationPolicyManager.CreatePolicy(Project project, Configuration configuration)
   at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)
   at SyncInvokeCreatePolicy(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
   at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)
   at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)
   at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)
   at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
   at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
   at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)
   at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
   at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)
   at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)
   at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)
   at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)
   at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
, Commit time 0ms

This event has been reported 4 times.

Best regards,
Liidia

Hi Liidia,

Thank you for reporting this. Which version of SQL Server are you using? This error does not occur using a SQL Server 2016 database however we have identified where this could be an issue with earlier SQL Server versions and have implemented a fix which will be included in the next version.