nunit: RequiresThreadAttribute allows ApartmentState.Unknown, unlike ApartmentAttribute
Does it make sense to allow [RequiresThread(ApartmentState.Unknown)]?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Add tests for use of ApartmentState.Unknown (#3042) — committed to nunit/nunit by ChrisMaddock 6 years ago
It seems clearer to me if the two uses of ApartmentState work the same way. Either ApartmentState.Unknown is allowed or not. Even though the two attributes do two different things, the argument does the same thing in both cases. It specifies what ApartmentState should be used on any thread that is created.
The way to decide this sort of thing IMO is to imagine writing the documentation or answering user questions in either case. Pick the one that requires less explanation.
I see your point. However,
ApartmentState.Unknownin .NET means the state has not been initialized yet. We were using it to mean “don’t care”, which seems a bit confusing.The default constructor should still work - if it doesn’t that’s a bug - and users with ApartmentState.Unknown should be told to use that constructor instead.
Closed by #3058