Test failing in TeamCity that doesn't fail anywhere else

I have a test that fails when run from TeamCity but doesn't fail anywhere else.

The test runs fine on my dev machine.  The test runs fine when I run the test from the command line on the build agent machine where the test ran that failed inside TeamCity.  It even runs just fine on the build agent machine when I load the test results from "C:\BuildAgent\temp\buildTmp" into Visual Studio and rerun the test with the assemblies that were used during the TeamCity build.

The build agent service is running from the same account that I use to log into the build agent machine to do my experiments.

It is very strange and I can’t figure out what is different between the run in initiated by TeamCity and every other run.  In one case an exception is being thrown from what looks like a Keyboard handler inside of WPF and everywhere else there is no exceptions being thrown.  Anyone have any ideas what could be different and causing this issue?

9 comments
Comment actions Permalink

Hello Patrick,

  I'd suggest to provide at least more information about the failure - there is no way to figure out what's going on in your case, given that there is no failure text, build log, even build runner type.

  Regards,
  KIR

0
Comment actions Permalink

The build runner is MSBuild 2008 Runner. There isn't much interesting in the build log outside of the exception being thrown.  The build log does have the MSTest command that was used to run the tests which as I stated above runs just fine from a normal command line prompt outside of TeamCity.  If there is something from the build log that might be useful to check out, I would love to know what it is.  The error message from the test is below.

System.NullReferenceException: Object reference not set to an instance of an object..
at System.Windows.Documents.TextStore.OnGotFocus()
at System.Windows.Documents.TextEditor.OnGotKeyboardFocus(Object sender, KeyboardFocusChangedEventArgs e)
at System.Windows.Controls.Primitives.TextBoxBase.OnGotKeyboardFocus(KeyboardFocusChangedEventArgs e)
at System.Windows.UIElement.OnGotKeyboardFocusThunk(Object sender, KeyboardFocusChangedEventArgs e)
at System.Windows.Input.KeyboardFocusChangedEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.KeyboardDevice.ChangeFocus(DependencyObject focus, Int32 timestamp)
at System.Windows.Input.KeyboardDevice.TryChangeFocus(DependencyObject newFocus, IKeyboardInputProvider keyboardInputProvider, Boolean askOld, Boolean askNew, Boolean forceToNullIfFailed)
at System.Windows.Input.KeyboardDevice.Focus(DependencyObject focus, Boolean askOld, Boolean askNew)
at System.Windows.Input.KeyboardDevice.Focus(IInputElement element)
at System.Windows.UIElement.Focus()
at System.Windows.Input.KeyboardNavigation.Navigate(DependencyObject currentElement, TraversalRequest request, ModifierKeys modifierKeys, DependencyObject firstElement)
at System.Windows.FrameworkElement.MoveFocus(TraversalRequest request)
at Divelements.SandDock.DockableWindow.x5b7f6ddd07ded8cd()
at Divelements.SandDock.Primitives.UnpinnedTray.x14a318f01ef2c711(DockableWindow x76b3d9d2638e5ecd, Boolean x53c0846b47593790)
at Divelements.SandDock.DockableWindow.x6d1b64d6c637a91d(Boolean x53c0846b47593790)
at Divelements.SandDock.DockableWindow.Open(WindowOpenMethod openMethod)
at Divelements.SandDock.DockableWindow.Open()

0
Comment actions Permalink

Could you please check build agent service is running under non SYSTEM account.

If the was not the issue, please try the following:
- stop build agent service
- open <build Agent>/bin folder
- start agent.bat start command
- you will see build agent console
- try running the build to that agent
- what is the result?

Thanks!

0
Comment actions Permalink

The test passes in this scenario.  What is the difference when starting the build agent this way compared to having the BuildAgent service run under the same account?

0
Comment actions Permalink

The difference is in desktop. Does is work under some administrative account as service?

Running as LOCAL SYSTEM may introduce some issues when tests uses windows forms.

0
Comment actions Permalink

I do not have it running under the Local System account.  I have the service running under an administrator account.

0
Comment actions Permalink

Is there any more information on this?  At this point the only thing I can think of is to change the system to not run as a service but launch the agent from the Startup Folder and have the machine auto login.  This is not an ideal setup, but the only thing I can think of to get it to work without some more information about what could be different about the system running as a service compared to on the desktop.

0
Comment actions Permalink

If test passes when started by agent launched via agent.bat then it seems there is nothing we can do. If you would write a service which will start your test you would experience the same problem. It seems your tests just can't be launched from the windows service.

0
Comment actions Permalink

Le 30/09/2009 18:12, Patrick Williams a ecrit :

Is there any more information on this?  At this point the only thing I can think of is to change the system to not run as a service but launch the agent from the Startup Folder and have the machine auto login.  This is not an ideal setup, but the only thing I can think of to get it to work without some more information about what could be different about the system running as a service compared to on the desktop.


In the log message there are traces about some Window opening, is it
from your tests :

  at Divelements.SandDock.DockableWindow.Open(WindowOpenMethod openMethod)
  at Divelements.SandDock.DockableWindow.Open()

The only difference between an executable launch throught a service, or
in cmd line, is that in a service, displaying a window is not possible,
so it may be the reason why your tests fail.

Gérald

0

Please sign in to leave a comment.