AsyncClipboardService 1.7.1

dotnet add package AsyncClipboardService --version 1.7.1
NuGet\Install-Package AsyncClipboardService -Version 1.7.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AsyncClipboardService" Version="1.7.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AsyncClipboardService --version 1.7.1
#r "nuget: AsyncClipboardService, 1.7.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AsyncClipboardService as a Cake Addin
#addin nuget:?package=AsyncClipboardService&version=1.7.1

// Install AsyncClipboardService as a Cake Tool
#tool nuget:?package=AsyncClipboardService&version=1.7.1

AsyncWindowsClipboard

AsyncWindowsClipboard is thread-safe, asynchronous windows clipboard service with retry strategy for .NET

What it is

  • It gives async/await syntax to communicate with Windows clipboard API's.
  • It is thread safe.
  • It gives lower (binary) level read & write access to strings in clipboard than .NET implementation.
  • Implements retry strategies to connect to the clipboard when it's locked.

How it works

AsyncClipboardService ensures that:

  • The Tasks for the communication always run in the same thread which makes the communication thread safe.
  • The thread is in Single Thread Apartment (STA) model. WPF & Windows Forms uses COM interop to communicate with clipboard in STA state. Running the thread in same apartment state ensures that the library functions well. Read more at MSDN 1, 2, 3.
  • Implements retry strategy to ensure clipboard operation ends successfully.

How to use

Simple usage

You can use a new instance of WindowsClipboardService to retrieve data. It's okay to use the instance from different threads.

    var clipboardService = new WindowsClipboardService();
    await clipboardService.SetTextAsync("Hello world"); // Sets the text
    var data = await clipboardService.GetTextAsync(); // Reads "Hello world"

However, it's recommended to use WindowsClipboardService with a timeout strategy, as it'll then wait (in a spinning state) for the thread that blocks the windows api instead of failing. You can activate the timeout strategy by setting it in the constructor:

    var clipboardService = new WindowsClipboardService(timeout:TimeSpan.FromMilliseconds(200)); 
    // or via its property
    var clipboardService = new ClipboardService { Timeout = TimeSpan.FromMilliseconds(200) };
Product 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AsyncClipboardService:

Package Downloads
BlishHUD

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on AsyncClipboardService:

Repository Stars
blish-hud/Blish-HUD
A Guild Wars 2 overlay with extreme extensibility through compiled modules.
Version Downloads Last updated
1.7.1 7,535 2/4/2020
1.7.0 1,597 1/1/2020
1.6.0 1,511 9/2/2018
1.5.0 2,073 10/6/2016
1.0.0.4 1,569 10/2/2016
1.0.0.3 1,635 9/30/2016
1.0.0.2 1,644 9/29/2016
1.0.0.1 1,910 9/28/2016
1.0.0 1,748 9/28/2016

- Exceptions are now properly serializable.
     - Fixed delay for retrying connection is being ignored.