internal static bool ReportUnhandledError(Exception e)
        {
            if (!AppDomain.IsAppXModel() || !WindowsRuntimeMarshal.s_haveBlueErrorApis || e == null)
            {
                return(false);
            }
            IntPtr pUnk = IntPtr.Zero;
            IntPtr ppv  = IntPtr.Zero;

            try
            {
                pUnk = Marshal.GetIUnknownForObject((object)e);
                if (pUnk != IntPtr.Zero)
                {
                    Marshal.QueryInterface(pUnk, ref WindowsRuntimeMarshal.s_iidIErrorInfo, out ppv);
                    if (ppv != IntPtr.Zero)
                    {
                        if (WindowsRuntimeMarshal.RoOriginateLanguageException(Marshal.GetHRForException_WinRT(e), e.Message, ppv))
                        {
                            IRestrictedErrorInfo restrictedErrorInfo = UnsafeNativeMethods.GetRestrictedErrorInfo();
                            if (restrictedErrorInfo != null)
                            {
                                WindowsRuntimeMarshal.RoReportUnhandledError(restrictedErrorInfo);
                                return(true);
                            }
                        }
                    }
                }
            }
            finally
            {
                if (ppv != IntPtr.Zero)
                {
                    Marshal.Release(ppv);
                }
                if (pUnk != IntPtr.Zero)
                {
                    Marshal.Release(pUnk);
                }
            }
            return(false);
        }