工作流的事件接收器上下文无效

发布于 2024-08-16 12:15:09 字数 1195 浏览 5 评论 0原文

好吧,又是一个 Sharepoint 奇怪的错误。在我的工作流程中,我收到此错误:

      System.InvalidOperationException: The event receiver context for Workflow is invalid. 
 at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at 
icrosoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds)   

这是当我等待 onTaskChange 事件时。互联网上到处都有人说,当相关令牌或任务ID设置不正确时,就会发生这种情况,但是我已经三重检查,甚至从头开始重建,但还是出现同样的错误。

奇怪的是,如果我在 logtoHistory 活动之前而不是之后移动整个内容,一旦它有帮助。我的意思是,这对我来说没有任何意义。

然而,在这种情况下,没有 logtohistory 事件,我所做的任何事情都无法解决问题。

更新:我发现一旦绑定 onTaskChange 活动的 afterproperties 就会发生这种情况。 ???

更新:这是给我带来麻烦的工作流程部分的图像: 替代文本

它越来越像某种与相关标记相关的设计者错误。如果我在 createTask 上创建一个新的任务令牌,然后将其分配给更新任务、oncreated 和 onchange 任务,但不是 CompleteTask,它将正常工作,直到完成任务(如预期),但如果我还将新令牌设置为完成任务它将在 onChangeTask 上失败。 如果我删除completeTask,它将在onChangeTask 上失败。搞什么??

Ok, another Sharepoint strange error. In my workflow I am getting this error:

      System.InvalidOperationException: The event receiver context for Workflow is invalid. 
 at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext()     at 
icrosoft.SharePoint.SPEventReceiverDefinition.ValidReceiverFields()     at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds)     at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds)   

this is when I wait for onTaskChange event. Everywhere on the internet people say that this happens when either correlation token or taskid are not set properly, however I've triple checked and even rebuilt from scratch and yet the same error.

And the weird thing is that once it helped if I moved the whole thing before a logtoHistory activity and not after it. I mean, that just doesn't make any sense to me.

With this case however, there is no logtohistory event and nothing I do gets me past the problem.

UPDATE: I found out this happens as soon as I bind afterproperties of the onTaskChange activity. ???

UPDATE: here is the image of the part of workflow that is giving me trouble:
alt text

More and more it looks like some kind of designer bug in connection with correlation tokens. If i create a new task token on the createTask and then assign it to update task, oncreated and onchange task, but not CompleteTask it will work ok, until complete task (as expected), but if I also set the new token to the complete task it will fail on onChangeTask.
If I delete the completeTask it will fail on the onChangeTask. WTF??

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离线来电— 2024-08-23 12:15:09

这里的相关标记可能存在问题。您是否使用与整个工作流程中使用的相关令牌不同的相关令牌?

编辑:另一个问题 - 您是否在代码中设置任务的 TaskID 属性?
在我的自定义活动中,我始终将 CreateTask 活动的 TaskID 属性绑定到本地字段 icTaskID。然后,我将 en 事件处理程序添加到 CreateTask 活动的 methodInvoking 事件,并在该事件内执行以下操作

Me.icVisaTaskID = Guid.NewGuid

There might be a problem with correlation tokens here. Are you using a different correlation token than the one used for the whole workflow?

EDIT: Another question - are you setting the TaskID property of the task in your code?
In my custom activities, I always bind the TaskID property of the CreateTask activity to a local field icTaskID. Then, I add a en event handler to the CreateTask activitie's methodInvoking event and inside that event, do the following

Me.icVisaTaskID = Guid.NewGuid
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文