InstancePersistenceException error when you promote certain property types by using Sql Workflow Instance Store in Windows Workflow Foundation 4.0

Article translations Article translations
Article ID: 2022538 - View products that this article applies to.
Expand all | Collapse all

Symptoms

In Windows Workflow Foundation, you try to promote a property of an unsupported type, such as Boolean. In this case, the following InstancePersistenceException error is generated:

The data type 'System.Boolean' for the promoted property '{_http://tempuri.org/}MyBool' is not supported by SQL. Either change the data type to a supported one or promote the property as a binary value.

This exception error causes the persistence command and the persistence episode to fail, and then the instance is aborted.

If the service is self-hosted or web-hosted, this issue creates a diagnostic trace. Additionally, exception errors and warnings are generated in the Event Tracing for Windows (ETW) trace log.

The InstancePersistenceException error in the ETW trace log resembles the following:

<Exception>

<ExceptionType>System.Runtime.DurableInstancing.InstancePersistenceException, System.Runtime.DurableInstancing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</ExceptionType>

<Message>The data type 'System.Boolean' for the promoted property '{http://tempuri.org/}MyBool' is not supported by SQL. Either change the data type to a supported one or promote the property as a binary value.</Message>

<StackTrace> at System.Runtime.Diagnostics.DiagnosticTrace.ExceptionToTraceString(Exception exception) at System.Runtime.Diagnostics.DiagnosticTrace.GetSerializedPayload(Object source, TraceRecord traceRecord, Exception exception, Boolean getServiceReference) at System.Runtime.Diagnostics.DiagnosticTrace.GetSerializedPayload(Object source, TraceRecord traceRecord, Exception exception) at System.Runtime.TraceCore.ThrowingException(DiagnosticTrace trace, String param0, Exception exception) at System.Runtime.ExceptionTrace.TraceException[TException](TException exception, String eventSource) at System.Runtime.ExceptionTrace.TraceException[TException](TException exception) at System.Runtime.ExceptionTrace.AsError(Exception exception) at System.Activities.DurableInstancing.SaveWorkflowAsyncResult.SerializePromotedProperties(SqlParameterCollection parameters, StringBuilder commandTextBuilder, SaveWorkflowCommand saveWorkflowCommand) at System.Activities.DurableInstancing.SaveWorkflowAsyncResult.SerializeAssociatedData(SqlParameterCollection parameters, SaveWorkflowCommand saveWorkflowCommand, StringBuilder commandTextBuilder) at System.Activities.DurableInstancing.SaveWorkflowAsyncResult.GenerateSqlCommand(SqlCommand command) at System.Activities.DurableInstancing.SqlWorkflowInstanceStoreAsyncResult.StartOperation() at System.Activities.DurableInstancing.SqlWorkflowInstanceStoreAsyncResult.StartOperationCallback(Object state) at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, 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) </StackTrace>

<ExceptionString>System.Runtime.DurableInstancing.InstancePersistenceException: The data type 'System.Boolean' for the promoted property '{http://tempuri.org/}MyBool' is not supported by SQL. Either change the data type to a supported one or promote the property as a binary value.</ExceptionString>

</Exception>

Cause

This issue occurs the SQL Workflow Instance Store only allows the elevation of some properties so that these properties can be queried externally

Note This practice of elevating properties is also known as “promoting properties.”

These properties can be of simple types or of a serialized binary type, such as byte[].The SQL Workflow Instance Store enables the definition of workflow properties that can be externally indexed and externally queried by using the Promote method on the SqlWorkflowInstanceStore class.

However, promotion is only supported for some simple types. If you try to promote a property of an unsupported type, such as Boolean, the persistence episode fails and then the instance is aborted. Specifically, you receive an InstancePersistenceException error that causes the failure of the persistence command. Also, during a persistence episode, all the promoted properties to the database are persisted in one command. Because of this behavior, a failure to persist one promoted property causes all other property promotions to also fail.

The following list shows the types that are supported for promotion:

  • String
  •  Guid
  • DateTime
  • Int
  • double
  • float
  • long
  • short
  • byte
  • decimal

Resolution

To resolve this issue, promote a Boolean property, promote the Boolean type as a binary. Or, use a String type or an Int type instead of a Boolean type.

More Information

Properties

Article ID: 2022538 - Last Review: April 13, 2010 - Revision: 1.0
APPLIES TO
  • Windows Workflow Foundation 4.0
Keywords: 
KB2022538

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com