Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PullRequestComment Event does not appear to work with TFS 2017 #49

Closed
unicron opened this issue Jan 18, 2017 · 16 comments
Closed

PullRequestComment Event does not appear to work with TFS 2017 #49

unicron opened this issue Jan 18, 2017 · 16 comments
Labels

Comments

@unicron
Copy link

unicron commented Jan 18, 2017

Trying to use with self-hosted version of TFS 2017. About page shows the following:

Microsoft Visual Studio Team Foundation Server
Version 15.105.25910.0

Previous versions worked great with TFS 2015! Thanks!

@kria
Copy link
Owner

kria commented Jan 18, 2017

Are you sure you're running TfsNotificationRelay.tfs15-v1.17.0? Look in the windows application log for any errors.

@unicron
Copy link
Author

unicron commented Jan 18, 2017

@kria looks like it IS working for most events, but not for the PullRequestComment event. I'm using Git, and I left the config file with defaults (All) except for the Slack webhookUrl and channels settings. Yes, I am using a fresh download of that version, thanks.

@unicron unicron changed the title Does not appear to work with TFS 2017 PullRequestComment Event does not appear to work with TFS 2017 Jan 18, 2017
@kria kria added the bug label Jan 18, 2017
@kria
Copy link
Owner

kria commented Jan 18, 2017

You're right, PullRequestComment seems broken. Something must have changed between RC2 and RTM. I'll take a look at it.

@unicron
Copy link
Author

unicron commented Jan 18, 2017

@kria I've been trying to figure it out myself in the source, but I'm not sure how to pull the events list. I haven't found any documentation on that particular event either.

@kria
Copy link
Owner

kria commented Jan 18, 2017

Yeah there really isn't any documentation for this stuff, one has to dig into the dll:s. I pushed a fix, I assume you can build it yourself. I found some other stuff I want to fix before doing a new release.

@unicron
Copy link
Author

unicron commented Jan 19, 2017

@kria thanks for your help! I built it from your new branch, but am now seeing errors in my Application Log. I am going to try to debug it a bit myself but here is the detailed message:

TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 1/19/2017 12:05:05 AM
Application Domain: /LM/W3SVC/2/ROOT/tfs-1-131292573966832731
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v4.0.30319
Service Host: 3d82fdb1-b59e-4589-9d19-06802e30d77b (DefaultCollection)
Process Details:
Process Name: w3wp
Process Id: 13952
Thread Id: 10200

Detailed Message: The subscriber TfsNotificationRelay raised an exception while being notified of event Microsoft.VisualStudio.Services.CodeReview.Discussion.WebApi.Events.DiscussionsNotification.
Exception Message: TF401180: The requested pull request was not found. (type GitPullRequestNotFoundException)
Exception Stack Trace: at Microsoft.TeamFoundation.Git.Server.TeamFoundationGitPullRequestService.GetPullRequestDetails(IVssRequestContext requestContext, ITfsGitRepository repository, Int32 pullRequestId)
at DevCore.TfsNotificationRelay.EventHandlers.DiscussionsHandler.CreateNotifications(IVssRequestContext requestContext, DiscussionsNotification args, Int32 maxLines) in C:\Users\bhannemann\Desktop\TfsNotificationRelay.tfs15-v1.17.0\TfsNotificationRelay\TfsNotificationRelay\EventHandlers\DiscussionsHandler.cs:line 111
at DevCore.TfsNotificationRelay.EventHandlers.BaseHandler`1.CreateNotifications(IVssRequestContext requestContext, Object notificationEventArgs, Int32 maxLines) in C:\Users\bhannemann\Desktop\TfsNotificationRelay.tfs15-v1.17.0\TfsNotificationRelay\TfsNotificationRelay\EventHandlers\BaseHandler.cs:line 40
at DevCore.TfsNotificationRelay.EventHandlers.BaseHandler.ProcessEvent(IVssRequestContext requestContext, NotificationType notificationType, Object notificationEventArgs, Int32& statusCode, String& statusMessage, ExceptionPropertyCollection& properties) in C:\Users\bhannemann\Desktop\TfsNotificationRelay.tfs15-v1.17.0\TfsNotificationRelay\TfsNotificationRelay\EventHandlers\BaseHandler.cs:line 86
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationEventService.SubscriptionList.Notify(IVssRequestContext requestContext, NotificationType notificationType, Object notificationEventArgs, String& statusMessage, ExceptionPropertyCollection& properties, Exception& exception)

@kria
Copy link
Owner

kria commented Jan 19, 2017

I haven't seen that one before. It "works on my machine". Do you get it for all PRs or just some? The fact that I'm using something called LegacyCodeReviewArtifactId.Decode seems like a clue. 😄
If you want to troubleshoot it, set logfile in the the config to some path and add logging statements at line 109 in DiscussionsHandler.cs:

Logger.Log("pullRequestId:" + pullRequestId);
Logger.Log("artifactId", artifactId);
Logger.Log("args", args);

@kria
Copy link
Owner

kria commented Jan 26, 2017

Did you find out anything more @unicron? I wasn't able to reproduce it.

@unicron
Copy link
Author

unicron commented Jan 26, 2017

Thanks @kria I'm just now getting around to the log statements. Will report back if I have any further information.

@unicron
Copy link
Author

unicron commented Jan 26, 2017

Looks like the comment does come through in the log. Maybe the format has changed? Here is the log of a comment pasted:

[1/26/2017 9:55:18 PM] pullRequestId:2298
[1/26/2017 9:55:18 PM] artifactId:{
"VisualStudioServerNamespace": "",
"Tool": "CodeReview",
"ArtifactType": "ReviewId",
"ToolSpecificId": "f3b707ab-1384-46b9-9398-aa623d4d3b49/2298"
}
[1/26/2017 9:55:18 PM] args:{
"Threads": [
{
"Id": 29638,
"ArtifactUri": "vstfs:///CodeReview/ReviewId/f3b707ab-1384-46b9-9398-aa623d4d3b49%2f2298",
"PublishedDate": "2017-01-25T23:53:33.04Z",
"LastUpdatedDate": "2017-01-26T21:55:18.853Z",
"Comments": [
{
"Id": 3,
"ParentId": 1,
"ThreadId": 29638,
"Author": {
"id": "5cbe8914-fe6f-4203-b9b8-b075b5d7fc1f",
"displayName": "Brendan Hannemann",
"uniqueName": "xxxx",
"url": "xxxx",
"imageUrl": "xxxx"
},
"Content": "Testing comment.",
"PublishedDate": "2017-01-26T21:55:18.853Z",
"LastUpdatedDate": "2017-01-26T21:55:18.853Z",
"CanDelete": true,
"CommentType": 1
}
],
"Properties": {
"Microsoft.TeamFoundation.Discussion.SupportsMarkdown": {
"$type": "System.Int32",
"$value": 1
},
"Microsoft.VisualStudio.Services.CodeReview.ChangeTrackingId": {
"$type": "System.Int32",
"$value": 1
},
"Microsoft.VisualStudio.Services.CodeReview.FirstComparingIteration": {
"$type": "System.String",
"$value": "1"
},
"Microsoft.VisualStudio.Services.CodeReview.ItemPath": {
"$type": "System.String",
"$value": "/src/app/modules/project/ProjectContents/views/TopicNodeView.ts"
},
"Microsoft.VisualStudio.Services.CodeReview.Right.EndLine": {
"$type": "System.Int32",
"$value": 130
},
"Microsoft.VisualStudio.Services.CodeReview.Right.EndOffset": {
"$type": "System.Int32",
"$value": 38
},
"Microsoft.VisualStudio.Services.CodeReview.Right.StartLine": {
"$type": "System.Int32",
"$value": 130
},
"Microsoft.VisualStudio.Services.CodeReview.Right.StartOffset": {
"$type": "System.Int32",
"$value": 0
},
"Microsoft.VisualStudio.Services.CodeReview.SecondComparingIteration": {
"$type": "System.String",
"$value": "1"
}
},
"Status": 1,
"IsDeleted": false
}
],
"LikeCommentOnly": false,
"WithdrawLikeCommentOnly": false,
"HasUpdatedCommentsOnly": false,
"HasDeletedCommentsOnly": false
}

@kria
Copy link
Owner

kria commented Jan 26, 2017

So weird, that data looks right. The pull request id is right there, how can it not find it. 😕
When you go to the PR, the URL is .../pullrequest/2298, right?
You have tried with other PR:s and you always get the error?
Do you get a successful notification when the PR is created or when you update the status of the PR?

@unicron
Copy link
Author

unicron commented Jan 27, 2017

https://tfs.xxx.com/tfs/DefaultCollection/xxx/_git/xxx/pullrequest/2157 is the format, yeah. It does not seem to work with any PR, existing or new.

For the other notifications, we are getting the created/changed/votes for PRs just fine.

@kria
Copy link
Owner

kria commented Jan 27, 2017

What I wanted to make sure is that the id in the url is the same as the pullRequestId in the log? The other event handlers fetch the pull requests by a different method so I might try changing to that and see if that works better for you.

@unicron
Copy link
Author

unicron commented Jan 27, 2017

Nope, they do not match. The pullRequestId and ArtifactId (the end of that Id, 2298 in the example above) do match, but it does not match the url of the PR so that's the issue. I have yet to figure out any pattern for why it does not match.

@kria
Copy link
Owner

kria commented Jan 29, 2017

Try the prid branch. Hopefully it fixes things. 🙏

@unicron
Copy link
Author

unicron commented Jan 30, 2017

Thanks @kria it is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants