docs icon indicating copy to clipboard operation
docs copied to clipboard

Scenario for RequiresThread Attribute on Assembly level?

Open ghost opened this issue 6 years ago • 1 comments

Hi all,

Referring to: https://github.com/nunit/docs/wiki/RequiresThread-Attribute

does anyone know a scenario for putting the RequiresThread attribute on Assembly level? Reason for this question is that we observed that anyway - even without the attribute - a separate thread is started for each assembly. This seems to be true for at least console runner and running tests with Resharper.

It would be very helpful for me to know in what cases it is useful to have this attribute on assembly level. Any help will be highly appreciated. Thanks in advance!

ghost avatar Mar 08 '18 07:03 ghost

It may have made sense in older versions of NUnit, but probably doesn't these days. Use it on a method that intentionally corrupts the thread context in order to avoid reusing the thread on other tests. Most people should never use it.

CharliePoole avatar Mar 08 '18 07:03 CharliePoole