6
votes

I am building an application but getting an error. Can someone help me to understand how to resolve this?

Exception Message: The request was rejected by the server.Technical information: HTTP code 400: Bad Request (type TeamFoundationServerInvalidRequestException)Exception Stack Trace:
at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse webResponse, WebException webException) at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(TfsMessage requestMessage, HttpWebResponse webResponse, WebException webException, TfsMessage& responseMessage) at Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest() at Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage message, TimeSpan timeout) at Microsoft.TeamFoundation.Client.Channels.TfsHttpRetryChannel.Request(TfsMessage message, TimeSpan timeout) at Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
at Microsoft.TeamFoundation.TestImpact.Client.TestImpactServer.Microsoft.TeamFoundation.TestImpact.Client.ITestImpactServer.PublishBuildChanges(Uri buildUri, CodeChange[] changes) at Microsoft.TeamFoundation.TestImpact.BuildIntegration.BuildActivities.GetImpactedTests.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)Inner Exception Details:Exception Message: The remote server returned an error: (400) Bad Request. (type WebException)Status: ProtocolErrorResponse Status Code: BadRequestResponse Status Message: Bad RequestException Stack Trace:
at System.Net.HttpWebRequest.GetResponse()

3

3 Answers

23
votes

I've just ran into the same issue with TFS2013 and our CI builds.

It seems that the error happens with the Test Impact analyser fails somehow.

You can alter your build configuration to not analyse the test impact.

It depends on which build template you are using, but for Scrum 2013, you'll find it under It's under: Process > Test > Advanced > Analyze Test Impact - set this to false.

0
votes

Jaans' "solution" works for me too, obviously. As for the cause I started seeing this error after enabling obfuscation as part of my TFS build.

Doesn't look like it's possible to disable test impact analysis only for the release configuration - debug is not obfuscated. If I really want the test impact analysis I'll need 2 build definitions and don't build the release configuration for the one where the test impact analysis is enabled.

It's also "interesting" that it breaks the build even if there are no UT.

0
votes

I didn't find why it occurs, but I resolved the error using a loop and a try-catch until get impacted tests succeeded.