示例#1
0
        void IPlatformAppLauncher.SetupForDebugging(out LaunchOptions result)
        {
            if (_launchOptions == null)
            {
                Debug.Fail("Why is SetupForDebugging being called before ParseLaunchOptions?");
                throw new InvalidOperationException();
            }

            ManualResetEvent doneEvent  = new ManualResetEvent(false);
            var cancellationTokenSource = new CancellationTokenSource();
            ExceptionDispatchInfo exceptionDispatchInfo = null;
            LaunchOptions         localLaunchOptions    = null;

            _waitLoop = new MICore.WaitLoop(LauncherResources.WaitDialogText);

            // Do the work on a worker thread to avoid blocking the UI. Use ThreadPool.QueueUserWorkItem instead
            // of Task.Run to avoid needing to unwrap the AggregateException.
            ThreadPool.QueueUserWorkItem((object o) =>
            {
                string launchErrorTelemetryResult = null;

                try
                {
                    localLaunchOptions         = SetupForDebuggingWorker(cancellationTokenSource.Token);
                    launchErrorTelemetryResult = "None";
                }
                catch (Exception e)
                {
                    exceptionDispatchInfo = ExceptionDispatchInfo.Capture(e);
                    if (!(e is OperationCanceledException))
                    {
                        launchErrorTelemetryResult = Telemetry.GetLaunchErrorResultValue(e);
                    }
                }

                doneEvent.Set();

                if (launchErrorTelemetryResult != null)
                {
                    Telemetry.SendLaunchError(launchErrorTelemetryResult, _targetEngine.ToString());
                }
            }
                                         );

            _waitLoop.Wait(doneEvent, cancellationTokenSource);

            if (exceptionDispatchInfo != null)
            {
                exceptionDispatchInfo.Throw();
            }
            if (localLaunchOptions == null)
            {
                Debug.Fail("No result provided? Should be impossible.");
                throw new InvalidOperationException();
            }

            result = localLaunchOptions;
        }
示例#2
0
        void IPlatformAppLauncher.SetLaunchOptions(string exePath, string args, string dir, object launcherXmlOptions, TargetEngine targetEngine)
        {
            if (launcherXmlOptions == null)
                throw new ArgumentNullException("launcherXmlOptions");

            if (targetEngine != TargetEngine.Native)
                throw new LauncherException(String.Format(CultureInfo.CurrentCulture, LauncherResources.Error_BadTargetEngine, targetEngine.ToString()));

            var iosXmlOptions = (MICore.Xml.LaunchOptions.IOSLaunchOptions)launcherXmlOptions;

            if (_callback == null)
            {
                Debug.Fail("Why is ParseLaunchOptions called before Initialize?");
                throw new InvalidOperationException();
            }

            if (_launchOptions != null)
            {
                Debug.Fail("Why is ParseLaunchOptions being called more than once?");
                throw new InvalidOperationException();
            }

            _launchOptions = new IOSLaunchOptions(exePath, iosXmlOptions);
        }
示例#3
0
        void IPlatformAppLauncher.SetLaunchOptions(string exePath, string args, string dir, object launcherXmlOptions, TargetEngine targetEngine)
        {
            if (launcherXmlOptions == null)
            {
                throw new ArgumentNullException("launcherXmlOptions");
            }

            if (targetEngine != TargetEngine.Native)
            {
                throw new LauncherException(String.Format(CultureInfo.CurrentCulture, LauncherResources.Error_BadTargetEngine, targetEngine.ToString()));
            }

            var iosXmlOptions = (MICore.Xml.LaunchOptions.IOSLaunchOptions)launcherXmlOptions;

            if (_callback == null)
            {
                Debug.Fail("Why is ParseLaunchOptions called before Initialize?");
                throw new InvalidOperationException();
            }

            if (_launchOptions != null)
            {
                Debug.Fail("Why is ParseLaunchOptions being called more than once?");
                throw new InvalidOperationException();
            }

            _launchOptions = new IOSLaunchOptions(exePath, iosXmlOptions);
        }