Clipboard.SetContent() The remote procedure call failed

Rahul K 51 Reputation points
2020-11-05T11:39:42.13+00:00

In my UWP Application When I am trying to set the content in the Clipboard I am getting the below exception.

System.Exception: The remote procedure call failed. (Exception from HRESULT: 0x800706BE) at Windows.ApplicationModel.DataTransfer.Clipboard.SetContent(DataPackage content)

public static void CopyTextToClipboard(string textToCopy)
{          
    if (!string.IsNullOrEmpty(textToCopy))
    {
       var dataPackage = new DataPackage();
       dataPackage.RequestedOperation = DataPackageOperation.Copy;
       dataPackage.SetText(textToCopy.Trim().Replace(" ", string.Empty));
       Clipboard.SetContent(dataPackage);
    }
}

This exception will appear only some times and that too only in very few machines. The system in which we noticed this issue is Targeted SDK version: Windows 10 SDK, version 1903. In other systems with 1903 we didn't notice this issue. Only in a particular system we are noticing this.

In this USB video driver is conflicting with WinRT something in the driver was conflicting with WinRT causing the exception thus preventing the call to return.

I am not knowing the exact reason for this issue

clipboard-setcontent-the-remote-procedure-call-failed

Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.