【问题标题】:TFS WorkItemChangedEvent fires twiceTFS WorkItemChangedEvent 触发两次
【发布时间】:2013-06-13 20:25:53
【问题描述】:

我有一个使用

的 TFS2012 插件

公共 EventNotificationStatus ProcessEvent()

获取 WorkItemChangedEvent。它没有做太多,它只是将 WorkItemChangedEvent 添加到消息队列中,以便我以后可以使用不同的服务来获取它。

由于某种原因,该事件总是为我更改的每个工作项触发两次,并将该事件两次添加到我的队列中。

知道为什么吗?

我使用的代码:

    public EventNotificationStatus ProcessEvent(
        TeamFoundationRequestContext requestContext,
        NotificationType notificationType, object notificationEventArgs,
        out int statusCode, out string statusMessage, out ExceptionPropertyCollection properties)
    {
        statusCode = 0;
        properties = null;
        statusMessage = String.Empty;

        try
        {
            if (notificationType == NotificationType.Notification && notificationEventArgs is WorkItemChangedEvent)
            {
                var ev = notificationEventArgs as WorkItemChangedEvent;
                const string queueName = ".\\private$\\tfs";
                var msgQueue = new MessageQueue(queueName);
                var msg = new Message(ev);
                msgQueue.Send(msg, MessageQueueTransactionType.Single);
                Log.Debug(string.Format("Added event for work item #{0} to queue", ev.WorkItemTitle));
            }
        }
        catch (Exception ex)
        {
            Log.Fatal("Error", ex);
            return EventNotificationStatus.ActionDenied;
        }

        return EventNotificationStatus.ActionPermitted;
    }

【问题讨论】:

  • 它必然有不同的属性。您是否检查过该事件以了解它们有什么不同?
  • @PreetSangha:我检查了添加的两个队列消息的正文。它们绝对相同。

标签: c# events


【解决方案1】:

(和往常一样,在我提出问题几分钟后,我就明白了)

今天我学到了: 插件目录中的子文件夹不足以禁用插件。我在“旧”文件夹中备份了旧自动化,但它仍然加载了它。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-13
    • 2012-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多