I have a custom activity that I developed a year ago for a site in SharePoint 2010. The custom activity calls a string method which contains three strings parameters.

Here is the relevant part of the .ACTIONS file:

<RuleDesigner Sentence="Search by %1 of profile ID %2 of Type %3 result %4 ">
    <FieldBind Field="Cedula" Text="cedulaUsuario" Id="1" DesignerType="TextArea"/>
    <FieldBind Field="Perfil" Text="idPerfil" Id="2" DesignerType="TextArea"/>
    <FieldBind Field="TipoAsignacion" Text="tipoAsignacion" Id="3" DesignerType="TextArea"/>
    <FieldBind Field="TxtError" Text="txtError" Id="4" DesignerType="ParameterNames"/>
    <Parameter Name="Cedula" Type="System.String, mscorlib" Direction="In"/>
    <Parameter Name="Perfil" Type="System.String, mscorlib" Direction="In"/>
    <Parameter Name="TipoAsignacion" Type="System.String, mscorlib" Direction="In"/>
    <Parameter Name="TxtError" Type="System.String, mscorlib" Direction="Out"/>
    <Parameter Name="__Context" Type="Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions" Direction="In" />

The logic of the custom activity basically makes CRUD operations in a SQL database; this is not the problem yet, the main problem is the execution of the custom activity itself.

Current problems

For an unknown reason, this specific custom activity doesn't work anymore, so, I have to create a new workflow with the custom activity added on it using SharePoint Designer (for testing); but when I tried to publish, I received this error:

Errors where found when compiling the workflow. The workflow files were saved but cannot be run.

In the advanced section appear:

Unexpected error on server associating the workflow

I found on internet1 that this error occurs because the Temp folder is missing, and it was right. I have to create the Temp folder at C:\Users\<install>\AppData\Local\ location and inside the Temp folder, create a read-only text file (.txt).

After this change, another problem ocurrs:

Checking the SharePoint logs, it appears that the TxtError output parameter isn't generated. Instead a TxtErrorFlow appears in the log files:

0x1DEC  SharePoint Foundation           Legacy Workflow Infrastructure  72fs    Unexpected  RunWorkflow: Microsoft.SharePoint.SPException: <Error><CompilerError Line="93" Column="123" Text="Could not find property or event 'TxtErrorFlow' on type 'Glogic.AsignaciondeElementos.Code.AsignacionCode'." /></Error>     at Microsoft.SharePoint.Workflow.SPNoCodeXomlCompiler.LoadXomlAssembly(SPWorkflowAssociation association, SPWeb web)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.LoadDeclarativeAssembly(SPWorkflowAssociation association, Boolean fallback)     at Microsoft.SharePoint.Workflow.SPWinOeHostServices.CreateInstance(SPWorkflow workflow)     at Microsoft.SharePoint.Workflow.SPWinOeEngine.RunWorkflow(SPWorkflowHostService host, SPWorkflow workflow, Collection`1 events, TimeSpan timeOut)     at Microsoft.SharePoint.Workflow.SPWorkflowManager.RunWorkflowElev(SPWorkflow w... f9ef5d9d-fa5f-c053-5312-d7978deecd95

I renamed the TxtError variable after bad copy/paste sample code from another current functional custom activity.

After made the following changes:

  • Rename and rewrite manually the TxtError variable in the FieldBind and Parameter tags in the .ACTIONS file.
  • Clean, Build and Deploy in Visual Studio 2012.
  • Update .wsp file using PoweShell command.
  • Execute iisreset command.
  • Clear SPD cache of my PC.

Appears the following error in the SharePoint logs:

System.NullReferenceException: Object reference not set to an instance of an object. at Glogic.AsignaciondeElementos.Code.AsignacionCode.get_TxtError() at Glogic.AsignaciondeElementos.Code.AsignacionCode.AsignarElementosAlUsuario(String cedulaUsuario, String idPerfil, String tipoAsignacion) at Glogic.AsignaciondeElementos.Code.AsignacionCode.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()

(Both errors occurs when the workflow is manually activated).

Each publish event made, deletes temporal files at quoted location at previous lines. I really don't know what else I can do for solve that custom activity renders/build correctly and useful again.

I have found several similar questions on internet, but the get_TxtError() shown in the SharePoint logs continues.

1 I couldn't get the original link source, but the described steps are the relevant part of the source.

  • Since this may not be considered a full answer I put it as a comment instead. After deploy, execute IISRESET command and view the .actions file in the WorkFlow mapped folder for check if has the same structure (no missing spaces, case-sensitive, etc...), the custom action now is selectable, however, the previous workflow is lost (I can't select it anymore), so I have to create a new one. Commented Feb 16, 2016 at 16:13

1 Answer 1


Using the following code provided in this reference for register info in the SharePoint log files:

SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory("My Category", TraceSeverity.Unexpected, EventSeverity.Error), TraceSeverity.Unexpected, "unexpected error");

I could check the log files and read that the TxtError variable is null.

After check this reference in MSDN, it seems that the TxtError parameter needs an additional property declared in code, that property is called PropertyMetadata.

So, my DependencyProperty variable was:

public static DependencyProperty TxtErrorProperty = DependencyProperty.Register("TxtErrorFlow", typeof(string), typeof(MyClassSample));

Adding the PropertyMetadata property, the result is:

public static DependencyProperty TxtErrorProperty = DependencyProperty.Register("TxtErrorFlow", typeof(string), typeof(MyClassSample), new PropertyMetadata(""));

After following these steps:

  • Clean, Build and Deploy solution (in Visual Studio 2012).
  • Update .wsp file using PoweShell command.
  • Execute iisreset /noforce command.

The custom activity and the complete workflow worked again.

Side notes

During my tests, I lost some workflows which contains my custom activity; in SharePoint Designer, after selecting the workflow the screen shows:

Image taken from this question. SharePoint Designer workflow not showing

And I couldn't recover those workflows. As an advice, I suggest:

  • ALWAYS make a backup of your original workflow and a copy.
  • If you need work in the same workflow, use the copy instead; otherwise, create a new workflow with the log to history list action and the custom activity only.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.