Sunday, June 19, 2011

TFS 2010 - Unable to stop build

I came across an issue where a build was stuck for days with the message:
There was no endpoint listening at http://machinename:9191/Build/v3.0/Services/Agent/282 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

When I tried to stop the build, I was shown the error:
TF215104: Failed to stop build: it did not respond to a workflow cancellation request." When I went to the build agent and tried to delete the agent, I was shown the error:
Cannot remove build agent from build controller because it is currently reserved for a build

I unregistered the build service, tried to stop the build, registered the build service again and kept repeating the steps multiple times. I finally had luck and the build was stopped.
I registered the build service again and everything was smooth.

If you have write access to the TFS Warehouse, you can delete the build agent by following the steps at http://sleepcanwait.blogspot.com/2010/07/cannot-remove-build-agent-from-build.html 

Saturday, June 18, 2011

TFS 2010 Test Controller - Disk runs out of space

You must have observed that the disk on test controller runs out of space pretty fast. This is because of the files being stored in localappdata%\VSEQT\QTController\TestRunStorage which never get deleted. There are two options:

Option1:
Add a key ControllerJobSpooling in \Microsoft Visual Studio 10.0\Common7\IDE\QTController.exe.config and set its value to false. Then restart the test controller service.
Also refer http://blogs.msdn.com/b/shivash/archive/2011/01/21/using-visual-studio-test-controller-with-mtm-and-disk-out-of-space-issues.aspx

Option2:
Create a batch file with this command:
rmdir /s /q "C:\Users\<serviceaccount>\AppData\Local\VSEQT\QTController"
Then create a scheduled task which calls this batch file at regular intervals.

VS 2010 TestSettings - Ignore Dependent Assemblies

The testsettings in VS2010 tries to copy the dependent assemblies to the test output directory by default.
However, there might be situations where you would not want to copy the dependent assemblies. These dependent assemblies can be ignored by using the attribute ignoredDependentAssemblies

The below example shows how to ignore the dependent assemblies A, B and C and also to add a deployment item a.csv. You will need to restart Visual Studio after making this change.

<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Local" id="46d8e12e-16c0-4ba4-9dd9-eda66fb2ccc6" xmlns="
http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
  <Description>These are default test settings for a local test run.</Description>
  <Deployment ignoredDependentAssemblies="(?i:^A|^B|^C)">
    <DeploymentItem filename="TestProjectA\a.csv"/>
  </Deployment>
  .....

Thursday, June 16, 2011

How to Kill open connections to a Database

I came across a scenario when I wanted to restore a Database. However I was getting an error saying the databse is already in use. I needed to find who was connected to the databse and kill that connection.
So I first ran the command exec sp_who
This gave me the spid of the connection.
Then I ran the commad kill _spid to kill this connection.

Saturday, June 11, 2011

Why is Debugging in VS slow and takes forever saying "Loading Symbols..."

I encountered an issue in one of my Win 2K8 server machine where debugging a simple application in Visual Studio was taking forever. Everything was fine if you run the application but as soon as you tried debugging it, the performance was really slow and it took forever saying "Loading Symbols..."

When I went to Tool->Options->Debugging->Symbols, I found that it was referring to an environment variable _NT_SYMBOL_PATH whose value was some url which wasn't reachable.

I deleted this environment variable from My Computer->Properties->Advanced System Settings->Advanced->Environment Variables... and everything was fine after that. I was able to debug the application without any issues.