Esempio n. 1
0
        private static WorkStatus WorkUntilCanAttach(object arg, WorkItem workItem)
        {
            WorkStatus   result        = WorkStatus.NotDone;
            ProcessProxy processProxy  = (ProcessProxy)arg;
            Process      remoteProcess = processProxy.RemoteProcess;

            try
            {
                if (remoteProcess != null)
                {
                    remoteProcess.Refresh();
                    if (!remoteProcess.HasExited)
                    {
                        if (!MediaControl.CanAttach(new SelectProcessArgs(processProxy.RemoteProcess, processProxy.CLRVersion)))
                        {
                            Thread.Sleep(500);
                            return(result);
                        }
                        return(WorkStatus.Done);
                    }
                    return(WorkStatus.Error);
                }
                return(WorkStatus.Error);
            }
            catch (Exception)
            {
                return(WorkStatus.Error);
            }
        }