We have an NUnit test project with 1000 tests or so. The project contains high level component test mainly for a custom WPF control. The test process frequently fails on our build server (TeamCity) with:
InvalidOperationException "LocalDataStoreSlot storage has been freed"
mscorlib.dll!System.LocalDataStore.GetData(System.LocalDataStoreSlot slot)
mscorlib.dll!System.Threading.Thread.GetData(System.LocalDataStoreSlot slot)
WindowsBase.dll!System.Windows.Interop.ComponentDispatcher.CurrentThreadData.get() ...
The tests contain [RequiresSTA] attributes, Window.Show(), Dispatcher operations etc... so it is definitely not a regular unit test project.
The failure looks totally random, we have revisions where it occurs with 80% chance, however most of the time it doesn't happen at all. Absolutely mysterious, sometimes simple changes in the production code -like changing styles in the xaml code- triggers the failures, then the next change in the production code fixes it.
This specific random like failure makes our developer team pretty upset sometimes, our extended build system is hampered seriously by this failure.
We could very rarely reproduce it locally running the project with nunit-console.exe.
Have you guys ever seen such a test process failure? Any hints how to resolve this issue would be highly appreciated.
Thanks