![]() ![]() One of the new options added into Task Manager in recent versions was the “Analyze Wait Chain” option when you right-click on a task in the Details view. The WCT API is the one behind the "Analyze Wait Chain" functionality in Task Manager and Resource Monitor. WaitingOn.exe leverages the Wait Chain Traversal (WCT) API introduced in Windows 2008/Vista. It can also display all blocked threads for all processes in the system. WaitingOn.exe displays all the blocked threads from a process and what they are Waiting On. If you install it on a customer’s machine, please remove it at the end of the troubleshooting session. WaitingOn.exe is available at, and besides functional, it’s still experimental. WaitingOn.exe a simple tool that helps troubleshoot hung applications and services. and a Blog which talks about the “analyze wait chain” feature: Additional Information on how to prevent hangs in windows applications:.What this means is that if you have an application hanging for some reason, you can analyze the wait chain to see whether it is waiting on something that is in use.This allows you to see what processes are waiting for a resource that is being used by another process. Task Manager & Resource Monitor – Analyze Wait Chain: Beginning with Windows 8, in 2014 we added new options into Task Manager as well as Resource Monitor was the “Analyze Wait Chain” option when you right-click on a task in the Details view. Getting an application dump will not always be a smoking gun and should be used as a last resort for various reasons as missing symbols for 3 rd party applications or waiting on other processes. Troubleshooting application hangs is key to resolution. ![]() A special shout out to Leo Fagundes for writing the WaitingOn application. My name is Susan Buchanan and today I’d like to discuss some basic troubleshooting for applications hangs using Task Manager, Resource Monitor, and WaitingOn outside of getting an application dump. ((_Application)wordAppPrivate).Quit(ref saveOption, ref originalFormat, ref routeDocument) WordDocument.ExportAsFixedFormat(pdfFilename, WdExportFormat.wdExportFormatPDF) Document wordDocument = (wordFilename, false) Application wordAppPrivate = new .Application() Update Progress bar to see start of threads So now it is local to the function here is the complete code for the function called with the thread i create void GeneratePDFWithProgressWithCreate(string wordFilename, string pdfFilename) I changed it to .Application wordAppPrivate = new .Application() I solved it by declaring the variable localįrom the original code wordApp = new .Application() Thread.SetApartmentState(ApartmentState.MTA) Thread thread = new Thread(() => GeneratePDFWithProgressWithCreate(sourceFile, destFile)) ![]() GeneratePDFWithProgressWithCreate(sourceFile, destFile) Īnd below is the for loop which generates thread which i tried to call the code above: for (int i = 1 i GeneratePDFWithProgress(sourceFile, destFile + ".pdf")) String destFile = System.IO.Path.Combine(targetPath, fileName2) String sourceFile = System.IO.Path.Combine(sourcePath, fileName) ((_Application)wordApp).Quit(ref saveOption, ref originalFormat, ref routeDocument) īelow is the Parallel.For code which i tried to call the code above: Parallel.For(1, Int32.Parse(iNrOfThreads.Text), new ParallelOptions, i =>įileName = fileNameLarge + i.ToString() + ".doc" įileName2 = fileNameLarge + i.ToString() + ".pdf" ((_Document)wordDocument).Close(ref saveOption, ref originalFormat, ref routeDocument) Object originalFormat = .WdOriginalFormat.wdOriginalDocumentFormat Object saveOption = .WdSaveOptions.wdDoNotSaveChanges WordDocument.ExportAsFixedFormat(destFile, WdExportFormat.wdExportFormatPDF) Document wordDocument = (sourceFile, false) This is the code when used in a function works fine. The code below normally works and word is opened and closed after saving a docx/doc to pdf however when using the following code in a thread or Parallel for loop it does not, any have any ideas? I have provided all the code below. ![]()
0 Comments
Leave a Reply. |