Archive for the tag 'TeamCity'

TeamCity - Build failed on WPF Unit Tests

I have been working today with Jeremy Millers’ ScreenBinder stuff and ran into a problem today with the tests. The tests all passed fine in Visual Studio, and with rake at the command line on my computer. The problem however came when I checked the code into source control, I got a nasty test failure message in TeamCity:

 

BuildError

Here is the error: Test(s) failed. System.Runtime.InteropServices.COMException : The program issued a command but the command length is incorrect. (Exception from HRESULT: 0×80070018)

So I did some googling around and found there is a bug in the .NET Framework 3.5 SP1 regarding this issue. So a little more work and I found a work around. I believe this bug only pertains to WPF stuff.

 

Workaround

On the build agent do the following:

  1. Stop the TeamCity Build Agent service (Start –> Run –> services.msc –> TeamCity Build Agent –> Right Click –> Stop)
  2. Browse to the service file (C:\TeamCity\BuildAgent\launcher\bin)
    Files1
  3. Right click TeamCityAgentService-windows-x86-32.exe and click Properties
  4. Go to the Compatibility Tab
    Properties1
  5. Click Show settings for all users
  6. Change the Compatibility mode to be Windows XP (Service Pack 2)
    Properties2
  7. Click OK a few times to close all the windows
  8. Start the TeamCity Build Agent service.

You should now have a working build with WPF unit tests. Hope this helps somebody out as I was banging my head on the wall trying to figure it out.

Success01