This project is read-only.


Attributes derived from FactAttribute are not detected as tests


If I for instance declare the following class:
public sealed class OtherFactAttribute : FactAttribute
    public OtherFactAttribute()
The plugin behaves very strangely in files where some tests are marked with [OtherFact]. It seems that whenever one ore more such attributes are in a file, the plugin fails to detect new tests in the file. Files with OtherFacts are also not detected at VS startup.

I am running version 1.6.0, on VS 2013 with R# Build
Closed Mar 22, 2014 at 1:00 PM by mattellis
Fixed in 1.6.2, on the extension gallery


bfibrich wrote Mar 8, 2014 at 11:10 AM

Yes, this looks like it is broken. I have managed to get the R# test runner to show the unit tests in the gutter bu reverting to 1.3 (it seems broken beyond that).

The procedure I followed is described at

mattellis wrote Mar 20, 2014 at 1:18 PM

I'm afraid I can't reproduce this. I'm using the latest pre-release version available on the extension manager - 1.6.1-EAP-20140221. And it's working fine with custom fact attributes. They're recognised, as are standard fact attributes, and they're recognised at project startup, too.

It's worth pointing out that Theory is a custom fact attribute. There's no special support for it - it's recognised because it derives from FactAttribute.

Could you try again with 1.6.1-EAP-20140221, please? Make sure the extension manager has "Include pre-release" selected so you can see it. If it's still an issue, could you try clearing the ReSharper caches (ReSharper -> Options -> General -> Clear caches). Then a step-by-step repro would be really helpful.

JonasHoegh wrote Mar 20, 2014 at 2:10 PM

I can still reproduce this on 1.6.1-EAP-2014-0221:

  1. Create new class library project.
  2. Add xunit .net nuget package
  3. Add empty class file and declare OtherfactAttribute in it.
  4. Add a class file "BrokenClass.cs" with a fact-based and an otherfact-based test.
  5. Add a class file "WorkingClass.cs" with two fact-based tests.
  6. Restart VS
  7. Reopen the project
  8. The tests in BrokenClass.cs are not recognized as tests, but the tests in WorkingClass.cs are.
    public class BrokenClass
        public void Foo()

        public void Bar()
    public class WorkingClass
        public void Foo()


        public void Bar()

Is there a log file I can inspect from the plugin or similar?

JonasHoegh wrote Mar 20, 2014 at 2:18 PM

FYI, if I add the extensions package and a similar class with a Theory attribute, the problem does not affect the class in question

JonasHoegh wrote Mar 20, 2014 at 2:21 PM

I know this sounds dumb, but it seems the problem only occurs if the OtherFactAttribute contains an empty default constructor (as written above)

JonasHoegh wrote Mar 20, 2014 at 2:28 PM

More weirdness:

The following works:
  • No constructor declared in OtherFactAttribute
  • Default constructor that explicitly calls base()
The following fails:
  • Default constructor that does not explicitly call base
I have no idea how resharper test discovery interfaces with your plugin, but I guess this may just as well be a bug in resharper?

mattellis wrote Mar 20, 2014 at 6:11 PM

Thanks for the repro - that's absolutely brilliant! The plugin is throwing an exception when trying to process the default constructor. Silly mistake on my part - I'm assuming if there's a constructor, there has to be call to base. I'll get it fixed shortly (hopefully before tomorrow lunchtime), and the update will be available in the extension manager.

JonasHoegh wrote Mar 20, 2014 at 8:13 PM

Thanks for your help, and for a great plugin

mattellis wrote Mar 21, 2014 at 11:51 AM

Fixed in changeset 226c68e50fc4

bfibrich wrote Mar 26, 2014 at 10:22 AM

I can confirm this is working in R# 8.2 and v1.6.2

Many thanks for fixing and most of all the awesome plugin!