# Not able to override cleanup policy

**URL:** https://www.finalbuilder.com/forums/t/not-able-to-override-cleanup-policy/6089
**Category:** Bugs
**Created:** [May 24, 2017, 2:43am UTC](https://www.finalbuilder.com/forums/t/not-able-to-override-cleanup-policy/6089 "2017-05-24T02:43:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![liidia](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/l/77aa72/32.png) [@liidia](https://www.finalbuilder.com/forums/u/liidia)
#### Post date: [May 24, 2017, 2:43am UTC](https://www.finalbuilder.com/forums/t/not-able-to-override-cleanup-policy/6089/1 "2017-05-24T02:43:28Z")

</div>

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: FaultException`1<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;(Action`1 action, ServiceEndpointOptions options) in W:\CI\_WS\Ws\810776\Source\CT\_Source\Source\Continua.Web\Controllers\ContinuaController.cs:line 853  
&nbsp; &nbsp;at Continua.Web.Builds.Controllers.ConfigWizardController.Cleanup(String id, BuildCleanupPolicyDTO policy, Nullable`1 overridden, Nullable`1 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: &nbsp; &nbsp;at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, \_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 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, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 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: FaultException`1  
  
Message: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.  
  
Stack Trace: &nbsp; &nbsp;at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)  
&nbsp; &nbsp;at SyncInvokeCreatePolicy(Object , Object[] , Object[] )  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)  
&nbsp; &nbsp;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: &nbsp; &nbsp;at System.Data.SqlClient.TdsParser.TdsExecuteRPC(SqlCommand cmd, \_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc, Boolean sync, TaskCompletionSource`1 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, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 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, TaskCompletionSource`1 completion, Int32 startRpc, Int32 startParam)  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task&amp; task, Boolean asyncWrite)<br>&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite)  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()  
&nbsp; &nbsp;at System.Data.SqlClient.SqlCommandSet.ExecuteNonQuery()  
&nbsp; &nbsp;at NHibernate.AdoNet.SqlClientBatchingBatcher.DoExecuteBatch(IDbCommand ps)  
&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatchWithTiming(IDbCommand ps)  
&nbsp; &nbsp;at NHibernate.AdoNet.AbstractBatcher.ExecuteBatch()  
&nbsp; &nbsp;at NHibernate.Engine.ActionQueue.ExecuteActions()  
&nbsp; &nbsp;at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)  
&nbsp; &nbsp;at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)  
&nbsp; &nbsp;at NHibernate.Impl.SessionImpl.Flush()  
&nbsp; &nbsp;at NHibernate.Transaction.AdoTransaction.Commit()  
&nbsp; &nbsp;at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()  
  
, Pre-commit call stack: &nbsp; &nbsp;at Continua.Shared.Data.Hibernate.NHibernateDatabase.SaveChanges()  
&nbsp; &nbsp;at Continua.Modules.Builds.BuildExpirationPolicyManager.CreatePolicy(Project project, Configuration configuration)  
&nbsp; &nbsp;at Continua.Modules.Builds.Services.BuildExpirationPolicyService.CreatePolicy(BuildCleanupPolicyDTO policyDTO, Boolean runNow)  
&nbsp; &nbsp;at SyncInvokeCreatePolicy(Object , Object[] , Object[] )  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage11(MessageRpc& rpc)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ChannelHandler.DispatchAndReleasePump(RequestContext request, Boolean cleanThread, OperationContext currentOperationContext)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ChannelHandler.HandleRequest(RequestContext request, OperationContext currentOperationContext)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ChannelHandler.AsyncMessagePump(IAsyncResult result)  
&nbsp; &nbsp;at System.ServiceModel.Dispatcher.ChannelHandler.OnAsyncReceiveComplete(IAsyncResult result)  
&nbsp; &nbsp;at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  
&nbsp; &nbsp;at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)  
&nbsp; &nbsp;at System.ServiceModel.Channels.TransportDuplexSessionChannel.TryReceiveAsyncResult.OnReceive(IAsyncResult result)  
&nbsp; &nbsp;at System.Runtime.Fx.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)  
&nbsp; &nbsp;at System.Runtime.AsyncResult.Complete(Boolean completedSynchronously)  
&nbsp; &nbsp;at System.ServiceModel.Channels.SynchronizedMessageSource.ReceiveAsyncResult.OnReceiveComplete(Object state)  
&nbsp; &nbsp;at System.ServiceModel.Channels.SessionConnectionReader.OnAsyncReadComplete(Object state)  
&nbsp; &nbsp;at System.ServiceModel.Channels.PipeConnection.OnAsyncReadComplete(Boolean haveResult, Int32 error, Int32 numBytes)  
&nbsp; &nbsp;at System.ServiceModel.Channels.OverlappedContext.CompleteCallback(UInt32 error, UInt32 numBytes, NativeOverlapped\* nativeOverlapped)  
&nbsp; &nbsp;at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped\* nativeOverlapped)  
&nbsp; &nbsp;at System.Threading.\_IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped\* pOVERLAP)  
, Commit time 0ms  
  
This event has been reported 4 times.  
  
Best regards,  
Liidia

---

<div class="post-metadata">

### Author: ![Sparky](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/sparky/32/10_2.png) [@Sparky](https://www.finalbuilder.com/forums/u/Sparky)
#### Post date: [May 25, 2017, 8:20am UTC](https://www.finalbuilder.com/forums/t/not-able-to-override-cleanup-policy/6089/2 "2017-05-25T08:20:19Z")

</div>

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.&nbsp;
