I recently built up a new VM for my team and decided to use JetBrains UnitRun. After installing UnitRun I started up Visual Studio 2005 I was greeted with the exception:
“JetBrains.ReSharper.Util.InternalErrorException: No such interface supportedStackTrace…..”
I also noticed that the [Test] attribute was not colored making it look like it was not being resolved though everything compiled just fine. Turns out it is the namespacing. This is not a UnitRun issue it is a Visual Studio issue. I have something that looks like:
4 using NUnit.Framework;
5
6 namespace Foo.Bar.Test.UnitTests
7 {
8 [TestFixture]
9 public class MockFixture
10 {
11 [Test]
12 public void ExceptionIsDrivingMeNuts()
13 {
14 }
15 }
16 }
Notice the namespace has the “Foo.Bar.Test.UnitTests” and that [Test] attribute is not colored. Visual Studio is resolving [Test] as the namespace “Foo.Bar.Test” instead of NUnit.Framework.TestAttribute. So why have I not seen this sooner? Well I use Resharper which resolves it to the correct reference and thus colors it correctly. Looks like Visual Studio walks the using statements/namespace in reverse order and the first string match it finds it uses it. This is illustrated by the below which works.
5 namespace Foo.Bar.Test.UnitTests
6 {
7 using NUnit.Framework;
8
9 [TestFixture]
10 public class MockFixture
11 {
12 [Test]
13 public void ExceptionIsDrivingMeNuts()
14 {
17 }
This is not something I’m willing to live with. The underlying problem is the namespace so the fix I’m going with is to update the namespace to “Foo.Bar.Tests.UnitTests” which produces the below which works great.
6 namespace Foo.Bar.Tests.UnitTests
I guess another fix is to get everyone using Resharper…
Remember Me
Powered by: newtelligence dasBlog 2.1.8102.813
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
E-mail
Theme design by Jelle Druyts