Fixing problems with tests running with XUnit StaFact #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into a problem where my tests were failing when updating to version 4.30.0 or later. I got an exception in
DockingManager.OnContextMenuPropertyChanged()
. It was introduced as part of#170 to solve a problem with the context menu.
Here is a link to the specific change (you will have to expand the diff of DockingManager to see the row).
My problem is that I'm running tests with the DockingManager in XUnit with StaFact. StaFact makes sure that the tests run on on STA thread. But it doesn't guarantee that all tests within a class runs on the same STA thread. Hence
d
will have the test thread's dispatcher, but for some reason thecontextMenu
will have a dispatcher from a thread from a previous test (from within the same test class).This is a hack (and I'm not sure if it should be merged) but the only way I can think of resolving this right now. @LyonJack (or someone else) do you have any ideas why the context menu end up on another thread? Is it somehow reused for multiple docking managers? Dependency properties are static so I can see how that could happen.