Comments (8)
What OS and .NET runtime are you running your test on?
from xunit.stafact.
from xunit.stafact.
It should work in that environment. Can you share a minimal repro zip file?
from xunit.stafact.
Here is a small project that shows the problem.
StaFactTestProject.zip
from xunit.stafact.
Wow. That seems ... totally broken. I'll see what I can do to fix it.
from xunit.stafact.
Ok, the reason is your test project targets something less than net472. xunit.stafact now targets net472 so although VS test discovery will find your test, xunit cannot run it since xunit.stafact.dll targets a newer framework than your test. Bump your test to net472 to resolve.
from xunit.stafact.
Thanks! It's working with 4.7.2. Is it correct that, if running your sample then this
Assert.Equal(originalThread, Environment.CurrentManagedThreadId);
will fail for StaFact but not for [UIFact], [WinFormsFact] or [WpfFact]?
Should you not get the same ThreadId also for StaFact?
from xunit.stafact.
If you're talking about that Assert appearing after an await, yes it would be expected to fail.
Awaits rely on a SynchronizationContext.Current
or TaskScheduler.Current
to get you back to the original "context" to execute the rest of an async method on. They can't just magically get you on a given thread. STA threads are no different: the only thing that can get an await to resume on that same thread is if a SynchronizationContext
is applied. But STAFact
is just a plain vanilla STA thread. If your purpose is to get UI-thread like semantics where a SynchronizationContext
is applied to the thread so await brings you back to the original thread, then you should use those other attributes you named.
from xunit.stafact.
Related Issues (20)
- Suggestion: Skip support (SkippableFact) HOT 4
- [StaFact] tests not found when used with netcoreapp2.2 HOT 13
- StaTheory is not supported in Visual Studio Runner HOT 13
- Support for OleInitialize HOT 2
- WPF support on .NET Core 3.0 breaks .NET Core 3.0 consumers on Linux/Mac
- Can't run tests HOT 2
- Generate test arguments on test thread
- CPU usage in polling message loop HOT 4
- Hanging UITheoryTestCase
- Clarify attribute names, or rename package ID HOT 8
- CollectionAttribute seems to be not respected HOT 7
- .net 4.5.2 compatibility HOT 3
- netstandard support HOT 1
- STA for Fixture Collections HOT 5
- StaFact facts breaks the concurrency limitations of Xunit HOT 11
- Running all tests within a class on the same thread? HOT 12
- [MainThreadFact] to execute tests on main thread on macos HOT 6
- Custom Thread HOT 1
- WinUI Unit testing with UIFact doesn't appear to work. HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xunit.stafact.