Remote Procedure Call Failed (HRESULT: 0x800706BE)

Xie Steven 831 Reputation points
2024-11-20T06:48:49.1666667+00:00

The application uses diagnostic APIs to prevent it from starting repeatedly. However, it crashes on startup, and the following exception information is logged:

Remote procedure call failed.  (Exception from HRESULT: 0x800706BE)
   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Void*) + 0xbe
   at __Interop.ForwardComStubs.Stub_16[TThis](__ComObject, Int32) + 0x2e
   at Windows.System.Diagnostics.ProcessDiagnosticInfo.get_IsPackaged() + 0x18
   at cherApp.App.DetectDuplicateApp() + 0xdf
   at cherApp.App.<OnLaunched>d__19.MoveNext() + 0x2ce
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e
   at System.Action`1.Invoke(T) + 0x28
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33
Cannot use RPC server.
   at System.Runtime.InteropServices.McgMarshal.ThrowOnExternalCallFailed(Int32, RuntimeTypeHandle) + 0x21
   at __Interop.ComCallHelpers.Call(__ComObject, RuntimeTypeHandle, Int32, Void*) + 0xbe
   at __Interop.ForwardComStubs.Stub_3[TThis, TResult](__ComObject, Int32) + 0x37
   at cherApp.App.DetectDuplicateApp() + 0x7d
   at cherApp.App.<OnLaunched>d__19.MoveNext() + 0x2ce
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x21
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__7_0(Object) + 0x1e
   at System.Action`1.Invoke(T) + 0x28
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore() + 0x33

What issues could cause this problem?

The code sample:

private bool DetectDuplicateApp()
{
    List<string> processNameCollection = new List<string>();
    IReadOnlyList<ProcessDiagnosticInfo> processes = new ProcessDiagnosticInfo.GetForProcesses();
    foreach(ProcessDiagnosticInfo process in processed)
    {
        if(process.IsPackaged)
       {
           processNameCollection .Add(process.ExecutableFileName);
       }
    }
    var count = processNameCollection .Where(item => item == "cherApp.exe");
    if(count > 1)
    {
          return false;   
    }
    return true;
}
Developer technologies | Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Harry Vo (WICLOUD CORPORATION) 405 Reputation points Microsoft External Staff
    2025-07-16T04:49:43.43+00:00

    Hi @Xie Steven ,

    The error HRESULT: 0x800706BE indicates that the RPC communication has failed, meaning the call between your program and the RPC server could not be completed successfully.


    What issues could cause this problem?

    • UWP apps run in a sandboxed environment with limited access to system-level resources. Some processes may restrict access to their diagnostic metadata due to security permissions, causing RPC failures when queried.
    • Frequently starting and stopping processes may not exist at the time of query, leading to RPC errors because the process is no longer valid.
    • Temporary unavailability or overload of the RPC server may lead to communication failures.
    • Using ProcessDiagnosticInfo.GetForProcesses() queries all processes, including those that are restricted or inaccessible, which can trigger errors.

    This problem doesn't occur every time. I want to know what issues could cause this problem?

    These might be the reasons:

    • The error only affects certain processes that are restricted, transient, or inaccessible. If these processes are not included in the diagnostic query, the error may not occur.
    • Transient processes may appear and disappear quickly. If a process terminates or is being created/destroyed during the query, it can trigger the error.
    • The diagnostic APIs may internally retry or handle edge cases differently, resulting in inconsistent or intermittent failures.

    If you have any questions, feel free to ask! Thank you!


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.