/// <summary>
        /// Collects the device memory profile.
        /// </summary>
        /// <param name="serializedDeviceInfo">The serialized <see cref="IDeviceInfo"/> data.</param>
        /// <param name="snapshotLabel">The label for the memory profile.</param>
        public static void CollectDeviceMemoryProfile(string serializedDeviceInfo, string snapshotLabel)
        {
            var retryAction = new Action(() =>
            {
                using (var proxy = SessionProxyBackendConnection.Create(GlobalDataStore.Manifest.Dispatcher, GlobalDataStore.Manifest.SessionId))
                {
                    proxy.Channel.CollectDeviceMemoryProfile(serializedDeviceInfo, snapshotLabel);
                }
            });

            Retry.WhileThrowing(retryAction, 2, TimeSpan.FromSeconds(1), new List <Type>()
            {
                typeof(Exception)
            });
        }
        /// <summary>
        /// Runs the specified <see cref="ISessionProxyBackend"/> action against the backend proxy service.
        /// </summary>
        /// <param name="action">The action.</param>
        private static void Run(Action <ISessionProxyBackend> action)
        {
            var retryAction = new Action(() =>
            {
                using (var proxy = SessionProxyBackendConnection.Create(GlobalDataStore.Manifest.Dispatcher, GlobalDataStore.Manifest.SessionId))
                {
                    action(proxy.Channel);
                }
            });

            try
            {
                Retry.WhileThrowing(retryAction, 2, TimeSpan.FromSeconds(1), new List <Type>()
                {
                    typeof(Exception)
                });
            }
            catch (Exception ex)
            {
                TraceFactory.Logger.Error("Unable to communicate with Session Proxy backend.", ex);
            }
        }
 public static void HandleAssetError(RuntimeError error)
 {
     SessionProxyBackendConnection.Run(c => c.HandleAssetError(error));
 }