Topic
After upgrading past Automation K2 5.7 (i.e. Automation K2 5.8+), the following error appears when adding a new SmartForms Client Event or editing an existing event using K2 Studio or K2 for Visual Studio:
"An exception occurred. Exception:Exception has been thrown by the target on an invocation.
mscorlib at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at SourceCode.EnvironmentSettings.Client.EnvironmentPluginType.CreatePluginInstance() at SourceCode.EnvironmentSettings.Client.EnvironmentPluginTypeCollection.GetItemByType(Type type) at SourceCode.Workflow.Plugins.EnvironmentSettings.EnvironmentRootCacheManager.GetPlugin(Type pluginType) at SourceCode.Workflow.Wizards.Forms.WizardHelper.SetContext(IServiceProvider service, FormsContextEnum enumValue, String[] treePath) at SourceCode.Workflow.Wizards.Forms.Pages.ClientEvent.SelectFormStatePage.Activate() at SourceCode.Workflow.Wizards.Forms.Pages.ClientEvent.SelectFormStatePage.OnActivate() at SourceCode.Workflow.WizardFramework.WizardPage.SourceCode.Framework.IWizardPage.Activate() at SourceCode.Workflow.WizardFramework.PropertyWizard.ActivateCurrentPage() at SourceCode.Workflow.WizardFramework.PropertyWizard.OnNavigateToPage(WizardPage destinationPage, Direction direction) at SourceCode.Workflow.WizardFramework.PropertyWizard.set_CurrentPage(WizardPage value) at SourceCode.Workflow.WizardFramework.PropertyWizard.OnNext(IWizardHostService host) at SourceCode.Workflow.WizardFramework.PropertyWizard.SourceCode.Framework.IPropertyWizard.Next(IWizardHostService host) at SourceCode.Workflow.DesignerFramework.WizardHost.ShowNextPage()"
Instructions
Since no new code fixes are to be issued for the legacy workflow designers, the following steps can be taken as a workaround:
1) Move a SourceCode.Workflow.Plugins.Forms.dll file from a working 5.7 environment onto the K2 5.8+ server
2) Take a backup of the existing SourceCode.Workflow.Plugins.Forms.dll file
[Install Drive]:\Program Files\K2\Bin\SourceCode.Workflow.Plugins.Forms.dll
3) Copy the K2 5.7 SourceCode.Workflow.Plugins.Forms.dll file into the above location
4) Open a command prompt window
5) Remove the existing SourceCode.Workflow.Plugins.Forms.dll file from the GAC with the following commands:
cd "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools"
gacutil -u "SourceCode.Workflow.Plugins.Forms"
Note: The path from the first command may need to be altered depending on the server setup
6) Add the older DLL file to the GAC with the following command:
gacutil -i "[Install Drive]:\Program Files\K2\Bin\SourceCode.Workflow.Plugins.Forms.dll"
Note: [Install Drive] will need to be replaced with the actual drive where K2 has been installed.