Net4x.Windows.ThreadsExtensions
1.0.0.1
dotnet add package Net4x.Windows.ThreadsExtensions --version 1.0.0.1
NuGet\Install-Package Net4x.Windows.ThreadsExtensions -Version 1.0.0.1
<PackageReference Include="Net4x.Windows.ThreadsExtensions" Version="1.0.0.1" />
<PackageVersion Include="Net4x.Windows.ThreadsExtensions" Version="1.0.0.1" />
<PackageReference Include="Net4x.Windows.ThreadsExtensions" />
paket add Net4x.Windows.ThreadsExtensions --version 1.0.0.1
#r "nuget: Net4x.Windows.ThreadsExtensions, 1.0.0.1"
#:package Net4x.Windows.ThreadsExtensions@1.0.0.1
#addin nuget:?package=Net4x.Windows.ThreadsExtensions&version=1.0.0.1
#tool nuget:?package=Net4x.Windows.ThreadsExtensions&version=1.0.0.1
Net4x.Dispatcher
Net4x.Dispatcher provides dispatcher and UI-thread helpers designed to work across multiple .NET target frameworks. It offers a lightweight abstraction for marshaling work to a synchronization context or UI thread and includes timing helpers suitable for desktop UI scenarios.
Authors: Piero Viano
Purpose
This project offers compatibility utilities so libraries and applications can schedule and run work on UI/synchronization contexts consistently across older .NET Framework targets and newer .NET/.NET Core runtimes that target Windows UI thread scenarios.
Key features
- Dispatcher-like API for posting and invoking actions on a synchronization/UI thread
DispatcherTimerhelpers for periodic work on the UI thread- Integration points for WinForms/WPF test hosts and synchronization contexts
- Cross-targeted to support both legacy .NET Framework and modern .NET TFMs where appropriate
Supported targets
Common TFMs produced by the project include:
- netstandard2.0 (for broad compatibility)
- net5.0-windows, net6.0-windows, net7.0-windows, net8.0-windows, net9.0-windows (where Windows-specific UI APIs are required)
- net4x / .NET Framework variants used in the solution (see project file for exact TFMs)
Quick start
- Add a reference to the
Net4x.Dispatcherproject or assembly appropriate for your target framework. - Use the dispatcher to post work to the UI/synchronization context instead of calling
Control.Invoke/Dispatcher.Invokedirectly so code can be cross-targeted.
Example (conceptual):
// Post an action to the dispatcher
var dispatcher = Net4x.Windows.Threads.Dispatcher.Current;
dispatcher.Post(() => {
// UI-bound work
});
// Run synchronously on the dispatcher (if supported)
dispatcher.Invoke(() => {
// Synchronous UI-bound work
});
Example using a timer helper:
var timer = new Net4x.Windows.Threads.DispatcherTimer(TimeSpan.FromSeconds(1));
timer.Tick += (s, e) => { /* periodic UI work */ };
timer.Start();
Note: APIs and types provided by the project are exposed by the Net4x.Windows.Threads assembly. Check the project source for exact type and member names for your targeted TFM.
Building
- For SDK-style TFMs (netstandard / net5+):
dotnet buildin theNet4x.Windows.Threadsproject directory. - For .NET Framework builds: open the solution in Visual Studio and build the specific configuration.
Tests
Unit and integration tests that exercise dispatcher behavior are available under the tests/Dispatcher.Tests project. Run them with an appropriate test runner for the targeted framework (for SDK-style tests use dotnet test, for .NET Framework tests run them from Visual Studio).
Contributing
Please open issues or pull requests with reproducible test cases. When adding features or fixes:
- Add or update unit tests in
tests/Dispatcher.Tests. - Keep changes targeted and document any API additions or behavior changes.
License
See the repository LICENSE.txt for licensing details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net8.0-windows7.0 is compatible. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net10.0-windows7.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net40 is compatible. net403 was computed. net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
.NETFramework 4.5
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
.NETStandard 2.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
- System.Threading.Tasks.Extensions (>= 4.5.4)
-
net10.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
net10.0-windows7.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
net6.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
net6.0-windows7.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
net8.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
-
net8.0-windows7.0
- Net4x.AsyncBridge (>= 1.5.0.9)
- Net4x.AsyncBridgeExtensions (>= 1.0.0.1)
- Net4x.ValueTuple (>= 1.4.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.