Issue

You have a workflow that should start when an item is added to a SharePoint list, but when adding an item to the list the workflow does not start. If you check the host server log  located at [PROGRAM FILES]\K2\Host Server\Bin, you find an error that contains the text:

  • Could not load file or assembly 'SourceCode.EventBus.SharePoint15.ProcessStarter.dll' or one of its dependencies.
    Or
  • Could not load file or assembly 'SourceCode.EventBus.MessageBusRecorder.dll' or one of its dependencies.

Full error text:

Error","EventBus","7498","General","EventQueueProcessing.Process","7498 An error has occurred: System.Exception: Could not load file or assembly 'SourceCode.EventBus.SharePoint15.ProcessStarter.dll' or one of its dependencies. The system cannot find the path specified. : The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

at SourceCode.EventBus.Server.EventQueueProcessing.ExecuteAssembly(Int32 CustomEventInstanceID, Int32 CustomEventID, ResolvedPolicyMapping resolvedPolicyMapping, Boolean isConditional, Int32 eventTypeID)

at SourceCode.EventBus.Server.EventQueueProcessing.ProcessEvent(Int32 ID)","anonymous","0.0.0.0","SA-LABSDLX:E:\Program Files (x86)\K2\Host Server\Bin",

You can also confirm that you have this issue by performing the Select statement below against the K2 database to see the file path in the asmFullName column of the [Eventbus].[EventPolicyMapping] table. If the path to the file is not the same as the path to your K2 installation, you can expect to see this issue in your environment.

Select * from [Eventbus].[EventPolicyMapping]

For example, suppose that K2 is installed in E:\Program Files (x86)\K2\ but the asmFullName column values show the path to the DLLs as:

  • C:\Program Files\K2\Host Server\Bin\SourceCode.EventBus.MessageBusRecorder.dll
  • C:\Program Files\K2\Host Server\Bin\SourceCode.EventBus.SharePoint15.ProcessStarter.dll

Because the paths in the database do not align with the actual installation path of K2, you may see the Could not load file or assembly... error message. 

Cause

K2 was installed in the default location (C:\Program Files\K2\ for K2 Five and C:\Program Files (x86)\K2\ for K2 blackpearl), then uninstalled and reinstalled to a non-default folder. The paths to the event bus DLLs are not updated in the K2 database, causing the issue.

Workaround

To fix the issue, change the path to the DLLs in the K2 database to the correct folder.

Run this script against your K2 database to change the file path. Edit the script for your environment by substituting the {incorrect path} value and {correct path} value with those for your system. For example, REPLACE(asmFullName,'C:\Program Files\K2\Host Server\Bin\','E:\Program Files (x86)\K2\Host Server\Bin\')

UPDATE [K2].[Eventbus].[EventPolicyMapping]
SET asmFullName = REPLACE(asmFullName,'{incorrect path}','{correct path}')