Repository navigation
Done
Labels
Milestone
Description
I've got a reproduction here https://github.com/Braedon-Wooding-Displayr/nunit-filter-bug
Then run the following command;
dotnet test -s .\test.runsettingsit will fail (with the message below)dotnet clean- Update the nunit adapter version to 4.5.0 (you have to clean else it gets confused and will fail to find the dlls)
dotnet test -s .\test.runsettingsit will succeed
When it fails it says
NUnit Adapter 6.0.0.0: Test execution started
Running selected tests in D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll
NUnit3TestExecutor discovered 0 of 0 NUnit test cases using Current Discovery mode, Explicit run
NUnit Adapter 6.0.0.0: Test execution complete
nunit-bug test net8.0 succeeded with 1 warning(s) (1.0s)
C:\Program Files\dotnet\sdk\10.0.100\Microsoft.TestPlatform.targets(48,5): warning No test is available in D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
Test summary: total: 0, failed: 0, succeeded: 0, skipped: 0, duration: 1.0s
Build succeeded with 1 warning(s) in 2.4s
The dmp file being
<?xml version="1.0" encoding="utf-8"?>
<NUnitXml>
<RunningBy>Sources</RunningBy>
<VSTest input/>
<TestPackage>: nunit-bug.dll
</TestPackage>
<TestFilter>
<filter><test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0,1,2,3],3,3,[3])</test></filter>
</TestFilter>
</VSTest input/>
<NUnitDiscoveryInExecution>D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll</NUnitDiscoveryInExecution>
<test-run id='0' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='0'>
<test-suite type='Assembly' id='0-1017' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='0'>
<settings>
<setting name='SynchronousEvents' value='False' />
<setting name='InternalTraceLevel' value='Off' />
<setting name='RandomSeed' value='1412702580' />
<setting name='SkipNonTestAssemblies' value='True' />
<setting name='ProcessModel' value='InProcess' />
<setting name='DomainUsage' value='Single' />
<setting name='DefaultTestNamePattern' value='{m}{a}' />
<setting name='WorkDirectory' value='D:\nunit-bug\bin\Debug\net8.0' />
<setting name='NumberOfTestWorkers' value='20' />
</settings>
<properties>
<property name='_PID' value='25792' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
</test-suite>
</test-run><TestFilter>
(At Execution) <filter><test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0,1,2,3],3,3,[3])</test></filter>
</TestFilter>
<NUnitExecution>D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll</NUnitExecution>
<NUnitTestEvent>
<start-run count='0' start-time='2026-01-28 04:37:12Z' engine-version='3.21.0.0' clr-version='8.0.23'>
<command-line><![CDATA[D:\nunit-bug\bin\Debug\net8.0\testhost.dll --port 55163 --endpoint 127.0.0.1:055163 --role client --parentprocessid 45060 --telemetryoptedin false]]></command-line>
</start-run>
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1014' parentId='' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' type='Assembly' framework-version='4.4.0.0' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='Assembly' id='0-1014' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:37:12.3801703Z' end-time='2026-01-28T04:37:12.3811167Z' duration='0.000960' total='0' passed='0' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId=''>
<properties>
<property name='_PID' value='25792' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
</test-suite>
</NUnitTestEvent>
<NUnitTestEvent>
<test-run id='0' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' total='0' passed='0' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' engine-version='3.21.0.0' clr-version='8.0.23' start-time='2026-01-28 04:37:12Z' end-time='2026-01-28 04:37:12Z' duration='0.013734'>
<command-line><![CDATA[D:\nunit-bug\bin\Debug\net8.0\testhost.dll --port 55163 --endpoint 127.0.0.1:055163 --role client --parentprocessid 45060 --telemetryoptedin false]]></command-line>
<filter>
<test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0,1,2,3],3,3,[3])</test>
</filter>
<test-suite type='Assembly' id='0-1014' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:37:12.3801703Z' end-time='2026-01-28T04:37:12.3811167Z' duration='0.000960' total='0' passed='0' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<settings>
<setting name='SynchronousEvents' value='False' />
<setting name='InternalTraceLevel' value='Off' />
<setting name='RandomSeed' value='1412702580' />
<setting name='SkipNonTestAssemblies' value='True' />
<setting name='ProcessModel' value='InProcess' />
<setting name='DomainUsage' value='Single' />
<setting name='DefaultTestNamePattern' value='{m}{a}' />
<setting name='WorkDirectory' value='D:\nunit-bug\bin\Debug\net8.0' />
<setting name='NumberOfTestWorkers' value='20' />
</settings>
<properties>
<property name='_PID' value='25792' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
</test-suite>
</test-run>
</NUnitTestEvent>
</NUnitXml>
When it succeeds the dmp file is almost identical ... so clearly something is wrong with nunit to me.
<?xml version="1.0" encoding="utf-8"?>
<NUnitXml>
<RunningBy>Sources</RunningBy>
<VSTest input/>
<TestPackage>: nunit-bug.dll
</TestPackage>
<TestFilter>
<filter><test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])</test></filter>
</TestFilter>
</VSTest input/>
<NUnitDiscoveryInExecution>D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll</NUnitDiscoveryInExecution>
<test-run id='0' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='1'>
<test-suite type='Assembly' id='0-1017' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='1'>
<settings>
<setting name='SynchronousEvents' value='False' />
<setting name='InternalTraceLevel' value='Off' />
<setting name='RandomSeed' value='481932321' />
<setting name='SkipNonTestAssemblies' value='True' />
<setting name='ProcessModel' value='InProcess' />
<setting name='DomainUsage' value='Single' />
<setting name='DefaultTestNamePattern' value='{m}{a}' />
<setting name='WorkDirectory' value='D:\nunit-bug\bin\Debug\net8.0' />
<setting name='NumberOfTestWorkers' value='20' />
</settings>
<properties>
<property name='_PID' value='37328' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
<test-suite type='TestSuite' id='0-1018' name='UnitTests' fullname='UnitTests' runstate='Runnable' testcasecount='1'>
<test-suite type='TestSuite' id='0-1019' name='CommonLib' fullname='UnitTests.CommonLib' runstate='Runnable' testcasecount='1'>
<test-suite type='TestFixture' id='0-1020' name='IEnumerableExtensionsTests' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='1'>
<test-suite type='ParameterizedMethod' id='0-1021' name='Slice_IsCorrect' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='1'>
<test-case id='0-1008' name='Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' methodname='Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' seed='1277673427' />
</test-suite>
</test-suite>
</test-suite>
</test-suite>
</test-suite>
</test-run><TestFilter>
(At Execution) <filter><test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])</test></filter>
</TestFilter>
<NUnitExecution>D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll</NUnitExecution>
<NUnitTestEvent>
<start-run count='1' start-time='2026-01-28 04:40:04Z' engine-version='3.15.4.0' clr-version='8.0.23'>
<command-line><![CDATA[D:\nunit-bug\bin\Debug\net8.0\testhost.dll --port 59232 --endpoint 127.0.0.1:059232 --role client --parentprocessid 37216 --telemetryoptedin false]]></command-line>
</start-run>
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1014' parentId='' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' type='Assembly' framework-version='4.4.0.0' />
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1015' parentId='0-1014' name='UnitTests' fullname='UnitTests' type='TestSuite' />
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1016' parentId='0-1015' name='CommonLib' fullname='UnitTests.CommonLib' type='TestSuite' />
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1000' parentId='0-1016' name='IEnumerableExtensionsTests' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests' type='TestFixture' />
</NUnitTestEvent>
<NUnitTestEvent>
<start-suite id='0-1013' parentId='0-1000' name='Slice_IsCorrect' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect' type='ParameterizedMethod' />
</NUnitTestEvent>
<NUnitTestEvent>
<start-test id='0-1008' parentId='0-1013' name='Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' type='TestMethod' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' methodname='Slice_IsCorrect' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-case id='0-1008' name='Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' methodname='Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' seed='1277673427' result='Passed' start-time='2026-01-28T04:40:04.8043715Z' end-time='2026-01-28T04:40:04.8080585Z' duration='0.003748' asserts='0' parentId='0-1013' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='ParameterizedMethod' id='0-1013' name='Slice_IsCorrect' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8042830Z' end-time='2026-01-28T04:40:04.8105753Z' duration='0.006293' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId='0-1000' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='TestFixture' id='0-1000' name='IEnumerableExtensionsTests' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8015095Z' end-time='2026-01-28T04:40:04.8112866Z' duration='0.009777' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId='0-1016' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='TestSuite' id='0-1016' name='CommonLib' fullname='UnitTests.CommonLib' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8003516Z' end-time='2026-01-28T04:40:04.8113211Z' duration='0.010969' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId='0-1015' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='TestSuite' id='0-1015' name='UnitTests' fullname='UnitTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8000260Z' end-time='2026-01-28T04:40:04.8113306Z' duration='0.011304' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId='0-1014' />
</NUnitTestEvent>
<NUnitTestEvent>
<test-suite type='Assembly' id='0-1014' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.7931032Z' end-time='2026-01-28T04:40:04.8113388Z' duration='0.018207' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' parentId=''>
<properties>
<property name='_PID' value='37328' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
</test-suite>
</NUnitTestEvent>
<NUnitTestEvent>
<test-run id='0' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0' engine-version='3.15.4.0' clr-version='8.0.23' start-time='2026-01-28 04:40:04Z' end-time='2026-01-28 04:40:04Z' duration='0.058053'>
<command-line><![CDATA[D:\nunit-bug\bin\Debug\net8.0\testhost.dll --port 59232 --endpoint 127.0.0.1:059232 --role client --parentprocessid 37216 --telemetryoptedin false]]></command-line>
<filter>
<test>UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])</test>
</filter>
<test-suite type='Assembly' id='0-1014' name='nunit-bug.dll' fullname='D:\nunit-bug\bin\Debug\net8.0\nunit-bug.dll' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.7931032Z' end-time='2026-01-28T04:40:04.8113388Z' duration='0.018207' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<settings>
<setting name='SynchronousEvents' value='False' />
<setting name='InternalTraceLevel' value='Off' />
<setting name='RandomSeed' value='481932321' />
<setting name='SkipNonTestAssemblies' value='True' />
<setting name='ProcessModel' value='InProcess' />
<setting name='DomainUsage' value='Single' />
<setting name='DefaultTestNamePattern' value='{m}{a}' />
<setting name='WorkDirectory' value='D:\nunit-bug\bin\Debug\net8.0' />
<setting name='NumberOfTestWorkers' value='20' />
</settings>
<properties>
<property name='_PID' value='37328' />
<property name='_APPDOMAIN' value='testhost' />
</properties>
<test-suite type='TestSuite' id='0-1015' name='UnitTests' fullname='UnitTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8000260Z' end-time='2026-01-28T04:40:04.8113306Z' duration='0.011304' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<test-suite type='TestSuite' id='0-1016' name='CommonLib' fullname='UnitTests.CommonLib' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8003516Z' end-time='2026-01-28T04:40:04.8113211Z' duration='0.010969' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<test-suite type='TestFixture' id='0-1000' name='IEnumerableExtensionsTests' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8015095Z' end-time='2026-01-28T04:40:04.8112866Z' duration='0.009777' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<test-suite type='ParameterizedMethod' id='0-1013' name='Slice_IsCorrect' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' testcasecount='12' result='Passed' start-time='2026-01-28T04:40:04.8042830Z' end-time='2026-01-28T04:40:04.8105753Z' duration='0.006293' total='1' passed='1' failed='0' warnings='0' inconclusive='0' skipped='0' asserts='0'>
<test-case id='0-1008' name='Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])' methodname='Slice_IsCorrect' classname='UnitTests.CommonLib.IEnumerableExtensionsTests' runstate='Runnable' seed='1277673427' result='Passed' start-time='2026-01-28T04:40:04.8043715Z' end-time='2026-01-28T04:40:04.8080585Z' duration='0.003748' asserts='0' />
</test-suite>
</test-suite>
</test-suite>
</test-suite>
</test-suite>
</test-run>
</NUnitTestEvent>
</NUnitXml>
Reacted by Jordan Cran, Mark Reid, Jan Kurianski and Lexy
Activity
Braedon-Wooding-Displayr commentedon Jan 28, 2026
To extend further it's able to execute them (as you can see above) but it fails to discover them.
Braedon-Wooding-Displayr commentedon Jan 29, 2026
As a workaround you can filter on class + name (where name is the shortened not the fqn) since the fqn is effectively class.name
OsirisTerje commentedon Mar 23, 2026
This seems to be a problem in the framework. The adapter pass the filter "as is". So I will move it there.
@manfred-brands @stevenaw
If a
namefilter is used, it works. Like<Where>name == "Slice_IsCorrect([0, 1, 2, 3],3,3,[3])"</Where>if any kind of
test(aka fullname) filter is ised, it doesn't work. With "any kind", I mean trying escaping ([, chars, or adding/removing spaces.Also, in the response from the framework, the fullname property matches the test filter expression
fullname='UnitTests.CommonLib.IEnumerableExtensionsTests.Slice_IsCorrect([0, 1, 2, 3],3,3,[3])I've not tried to debug it into the framework.
OsirisTerje commentedon Mar 23, 2026
Hmm... it works with adapter 5.2.0 That means, it is not the framework, it can be the engine then..... I'll move this back..... sorry guys.
OsirisTerje commentedon Oct 26, 2026
The cause is in the NUnit engine, not in the adapter. Since NUnit.Engine 3.22.0 (which the adapter uses), the selection parser removes whitespace outside double quotes in a
test ==value. NUnit 4 writes array arguments with spaces,[0, 1, 2, 3], so the filter no longer matches the full name. Adapter 5.2.0 used an older engine, which is why it worked there.This is tracked in nunit/nunit-console#1927, which has an engine-only repro. The adapter will pick up the fix with the engine update.
Until then, either of these works:
test =~instead oftest ==.name ==filter, together withclass ==if the name is not unique.--where/SelectWhere: whitespace inside a quotedtest ==value is stripped in 3.22.0, so tests whose names contain a space are no longer selected nunit-console#1927