Bug 9681 - category filters not saved by nunit addin
Summary: category filters not saved by nunit addin
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: NUnit ()
Version: Trunk
Hardware: PC Linux
: Low normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2013-01-20 10:06 UTC by Csaba Halász
Modified: 2017-09-26 11:51 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

*non-working* patch (1.69 KB, text/plain)
2013-01-20 10:06 UTC, Csaba Halász

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Csaba Halász 2013-01-20 10:06:28 UTC
Created attachment 3246 [details]
*non-working* patch

Configure some category filter using the "options" entry in the right-click
context menu for test groups in unit test view then close the solution. If you reopen it the settings will no longer be there, and looking in the appropriate csproj file you can see nothing has been saved.

I have traced this problem to how NUnitService is registering its property at runtime. It's using MonoDevelop.Projects.Services.ProjectService.DataContext directly, so it goes behind the back of ProjectService.OnPropertiesExtensionChanged which means ProjectService.DataContextChanged will not fire and thus the actual MSBuildProjectService.DataContext will not be updated (recreated) hence the property won't be saved.

I have tried the attached simple fix to move the registration to the addin xml and it sort-of works. Problem is, MonoDevelop cannot read back the settings it writes, saying "Error while trying to load the project 'foo.csproj': Could not set property 'UnitTestInformation' in type 'DotNetProjectConfiguration'". This occurs only when MonoDevelop is exited and restarted, closing and reopening the solution without exiting MonoDevelop works.

Here is a section of the csproj:

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
        <Test Path="">
          <Options EnableFilter="True" Exclude="True" ctype="NUnitCategoryOptions">

I find it suspicious that there are 2 levels of <UnitTestInformation>. If I remove one the project loads without error but also without the settings.
Comment 1 Mike Krüger 2013-01-21 03:11:58 UTC
I'll look at it after the feature stop.
Comment 2 Marius Ungureanu 2017-09-26 11:51:05 UTC
UnitTestInformation is no longer supported by the addin. Marking as RESOLVED INVALID.