i was trying to create a console application so i could take an export package using the API(http://tridioninternals.blogspot.co.uk/2014/01/export-data-from-tridion.html) I have this code:

   ExportInstruction instruction = new ExportInstruction { LogLevel = LogLevel.Normal };

            //  Start export process on the server
            string processId = client.StartExport(selection, instruction);
            //  Poll the server until the process is finished
            var processState = txtObject.WaitForProcessFinish(client, processId);

            //  If successfully finished, download package with exported content
            if (processState == ProcessState.Finished)
                Console.WriteLine("Process finished. About to download");
               txtObject.DownloadPackage(processId, @"C:\Packages\ChildPublication.zip");

For the method WaitForProcessFinish i have

   public ProcessState WaitForProcessFinish(ImportExportServiceClient client, string processId)


                    Console.WriteLine("Inside Wait for finish. Before sleep");
                    Console.WriteLine("Inside Wait for finish. After sleep");

                ProcessState? processState = client.GetProcessState(processId);

                if (processState == ProcessState.Finished || processState == ProcessState.Aborted || processState == ProcessState.AbortedByUser)


                return processState.Value;

            while (true);


I execute the code from command prompt as console application and the outcome can be seen below after more than 10 minutes.


The alpha-numeric character in process-id. The log file is getting generated properly. There are no errors.

  • 1
    You should use while before loop not after. This question has nothing to do with Tridion. This is just C# question Feb 23 '16 at 12:04
  • Yuri - to be pedantic... (and why not? :-) if you put the while statement first, the only effect it will have is that you won't see the output. The while has no body, and is completely separate from the block above it.
    – Dominic Cronin
    Mar 4 '16 at 19:00

It looks like the body of your while cycle is empty and you have infinite loop.

You should put do at the beginning like:

do { //code }

Also note that the exit criteria for your loop is process to be in states Finish, Aborted, AbortedByUser. But actually the process can be in a state WaitForInteraction which will require action to be performed with a process and you will again face with infinite loop. I suggest to also add some timeout to your Wait method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.