missing method exception in CallExternalMethodActivity
Hello,
I cant figure out why i'm getting this exception. My statemachine workflow is invoking my custom activity that calls SetSecurity. Anyone?
System.Workflow.Runtime Error: 1 : Execute of Activity symyxSetSecurityActivity1 threw System.MissingMethodException: Method 'Symyx.Framework.Workflow.IWorkflowSecurity.SetSecurity' not found.
<StateInitializationActivity x:Name="InProgressInitialization" Description="In progress initialization">
<ns1
ymyxSetSecurityActivity SecurityObjectId="{ActivityBind SymyxBasicWorkflow,Path=ObjectID}" x:Name="symyxSetSecurityActivity1" ActorPermissions="vault.user1,Right.Access.Write;vault.user2,Right.Access.Read" />
</StateInitializationActivity>
Sniplets from my workflow runtime host:
WorkflowSecurityService securityService = new WorkflowSecurityService();
workflowRuntime_.AddService(securityService);
public class WorkflowSecurityService : IWorkflowSecurity
{
public void SetSecurity(Guid workflowInstanceId, VaultId objectId, string securitySettings)
{
Andrei, thanks.
I'm not sure what you mean exactly. Here's my custom activity that calls SetSecurity method on IWorkflowSecurity.
public partial class SymyxSetSecurityActivity : CallExternalMethodActivity
public SymyxSetSecurityActivity()
{
base.InterfaceType = typeof(Symyx.Framework.Workflow.IWorkflowSecurity);
base.MethodName = "SetSecurity";
}
In my workflow runtime host (winservice), this method is implemented:
WorkflowSecurityService securityService = new WorkflowSecurityService();
workflowRuntime_.AddService(securityService);
Where do i look to see if there's an assembly version mismatch?
One of the ways would be
- Break into debugger when the exception happens.
- Check the loaded Modules (Debug/Windows/Modules menu in Visual Studio), and the paths where assemblies were loaded from.
- Check those locations have most recent assemblies.
Specifically it would be interesting to check assemblies, which define workflow, custom activity, and the IWorkflowSecurity interface.
i attached with the debugger and turned break on exception on. it didnt break on this particular exception.
i checked debug/windows/modules and see that the location where this method lives, symyx.framework.dll, is current in the bin directory of my windows service (this hosts the runtime).
using .net reflector, i see that this dll has
| Declaring Type: | Symyx.Framework.Workflow.WorkflowSecurityService |
| Assembly: | Symyx.Framework, Version=6.0.0.0 |
The exception that cause this thread was saying specifically that SetSecurity is missing. This has nothing to do with the custom activity (e.g., it was able to locate the custom activity and call OnMethodInvoking)?
Here's the custom activity's OnMethodInvoking:
protected override void OnMethodInvoking(System.EventArgs e)
{
this.ParameterBindings["workflowInstanceId"].Value = base.WorkflowInstanceId;
this.ParameterBindings["securitySettings"].Value = this.ActorPermissions;
this.ParameterBindings["objectId"].Value = this.SecurityObjectId;
}
There's gotta be something silly going on here....
You should be able to catch the exception in debugger. Make sure you have the following in Visual Studio:
a) Uncheck "Enable Just My Code (Managed only)" from Tools->Options->Debugging.
b) After you attach to debugee, check "Thrown" for "Common Language Runtime Exceptions" in Debug->Exceptions window.
That should help you catch the exception here.