Com.MarcusTS.ResponsiveTasks
2.0.5
dotnet add package Com.MarcusTS.ResponsiveTasks --version 2.0.5
NuGet\Install-Package Com.MarcusTS.ResponsiveTasks -Version 2.0.5
<PackageReference Include="Com.MarcusTS.ResponsiveTasks" Version="2.0.5" />
paket add Com.MarcusTS.ResponsiveTasks --version 2.0.5
#r "nuget: Com.MarcusTS.ResponsiveTasks, 2.0.5"
// Install Com.MarcusTS.ResponsiveTasks as a Cake Addin #addin nuget:?package=Com.MarcusTS.ResponsiveTasks&version=2.0.5 // Install Com.MarcusTS.ResponsiveTasks as a Cake Tool #tool nuget:?package=Com.MarcusTS.ResponsiveTasks&version=2.0.5
NOW MAUI READY !!!
Fixing TPL Using Responsive Tasks:
TPL: The Promise
When Microsoft announced the Task Parallel Library, C# programmers everywhere rejoiced. Simplified threads? Error handling within the library itself? What could possibly go wrong?
Just about everything, as it turns out.
A task requires a root in order to be properly awaited. For instance:
// An awaitable task
public Task YouCanAwaitMe() { }
// A root where you an await a task
public async Task IWillAwait()
{
await YouCanAwaitMe().WithoutChangingContext();
}
TPL: The Reality
Unfortunately, a Xamarin app doesn't have any valid roots. For instance, not at:
- Constructors
- Content changed
- Binding context changed
- Event handlers
- Global messages
- Overrides
- Property Setters
Any location that fails to provide a Task signature is a false root. This causes unsafe results:
public class FalselyRootedView : ContentView
{
protected override async void OnBindingContextChanged()
{
base.OnBindingContextChanged();
// Mega hack -- called from a void method (illegal!)
await StartUpViewModel().WithoutChangingContext();
}
public virtual Task StartUpViewModel()
{
return Task.CompletedTask;
}
}
// Derive and consume the falsely rooted view as if it were valid
public class FalseConsumer : FalselyRootedView
{
pubic override async Task StartUpViewModel()
{
// Everything seems OK from this perspective, but this task can proceed at any time and
// without our control; it was never properly awaited. Anything relying on it will
// accelerate into a race condition; variables will not be set on time; nothing can
// be relied upon in a predictable order.
await SomeOtherTask().WithoutChangingContext();
}
}
Until Microsoft converts all current code signatures to Tasks, programmers are stuck using these sorts of risky mechanisms.
Responsive Tasks is tested and proven
See the unit tests.
Index
Each page describes a problem and its Responsive solution:
Part 1 of N: Pages, Views & View Models
Part 2 of N: Events & Messaging
Part 3 of N: Technical Guide
Part 4 of N: Button Pressed: Closing the Final TPL Gaps
Part 5 of N: Proofs
ResponsiveTasks Is Open Source; Enjoy Our Entire Public Suite
Shared Utils (MAUI Ready!)
The Smart DI Container (MAUI Ready!)
Responsive Tasks (MAUI Ready!)
PlatformIndependentShared (MAUI Ready!)
UI.XamForms
The Modern App Demo
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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. 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 was computed. 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. |
.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 | 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. |
-
.NETStandard 2.0
- Com.MarcusTS.SharedUtils (>= 2.0.5)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Com.MarcusTS.ResponsiveTasks:
Package | Downloads |
---|---|
Com.MarcusTS.PlatformIndependentShared
Platform independent utilities for C# development. |
|
Com.MarcusTS.UI.XamForms
Xamarin.Forms abstract classes and utilities to support creating flowable animated apps. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.5 | 981 | 7/30/2022 |
2.0.4 | 413 | 7/29/2022 |
2.0.3 | 1,836 | 10/29/2021 |
2.0.2 | 368 | 10/29/2021 |
2.0.1 | 618 | 10/28/2021 |
1.0.22 | 380 | 10/28/2021 |
1.0.21 | 335 | 8/27/2021 |
1.0.20 | 333 | 8/24/2021 |
1.0.19 | 353 | 8/24/2021 |
1.0.18 | 344 | 8/17/2021 |
1.0.17 | 381 | 8/17/2021 |
1.0.16 | 477 | 8/15/2021 |
1.0.15 | 408 | 8/10/2021 |
1.0.14 | 369 | 8/10/2021 |
1.0.13 | 375 | 8/10/2021 |
1.0.12 | 408 | 7/6/2021 |
1.0.11 | 389 | 7/1/2021 |
1.0.10 | 522 | 6/24/2021 |
1.0.9 | 465 | 6/2/2021 |
1.0.8 | 409 | 5/18/2021 |
1.0.7 | 328 | 5/14/2021 |
1.0.6 | 463 | 5/12/2021 |
1.0.5 | 356 | 5/12/2021 |
1.0.4 | 386 | 4/9/2021 |
1.0.3 | 374 | 4/9/2021 |
1.0.2 | 418 | 4/1/2021 |
1.0.1 | 335 | 4/1/2021 |
1.0.0 | 380 | 2/3/2021 |