Workflow Analyzer Unhandled Exception: "The system cannot find the file specified"

 

Recently I borrowed a lab instance of Operations Manager 2012 R2 from a friend. I was attempting to troubleshoot a discovery in a management pack that I've been working on when I encountered some trouble with the Workflow Analyzer (wfanalyzer.exe). The WFA is a tracing tool originally released with the SCOM 2007 R2 Authoring Console and is vital for troubleshooting workflows.

First I had to copy the newest version of the "Microsoft.Mom.Common.dll" file into the WFA folder, shown below in the screenshot. If you don't have this file, you will get an error immediately upon launching the WFA.

 

 

The error looked like this:

 

**************Exception Text **************

System.ComponentModel.Win32Exception:
The system cannot find the file specified

  
at Microsoft.EnterpriseManagement.WorkflowDebugger.CabExtractor.ExtractCab(String
cabPath, String extractPath)
at Microsoft.EnterpriseManagement.WorkflowDebugger.OpsMgrTraceHelper.ExtractTmfFile()
at Microsoft.EnterpriseManagement.WorkflowDebugger.OpsMgrTraceHelper.StartTrace(Guid
sessionId, String logFilePath, NewTraceDataDelegate newTraceDelegate)
at Microsoft.EnterpriseManagement.WorkflowDebugger.TraceWorkflow.StartTracing()
at Microsoft.EnterpriseManagement.WorkflowDebugger.WorkflowSelectionForm.TraceWorkflow(Workflow
debugWorkflow)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button,
Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)  
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)

**************Exception Text **************

 

So I installed a fresh instance of SCOM 2012 R2 in my own lab. When I attempted to run the WFA on any workflows, I got the same error. After some digging and probing and combing through ProcMon traces and some more testing I finally figured out how to solve this problem.

The soltion summary is:

1) Start tracing.
2) Stop tracing.
3) Format tracing
4) Launch WFA

 

1) Launch the StartTracing.cmd batch file. Let it run. Ignore any errors you might see pertaining to files that may already exist. In my example below I used the Verbose switch, which is optional.

PS C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Tools> .\StartTracing.cmd VER

 

2) Launch the StopTracing.cmd batch file.

PS C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Tools> .\StopTracing.cmd

 

3) Format with FormatTracing.cmd batch file:
PS C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Tools> .\FormatTracing.cmd VER

 During steps 1-3 there are some .tmf files that get created in the "TMF" folder here: C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Tools\TMF

and also "all.tmf" that gets created here: C:\Program Files\Microsoft System Center 2012 R2\Operations Manager\Server\Tools

These .tmf files appear to be necessary for the WFA to cooperate. I've used the WFA on many 2012 instances and never had to perform these steps first. Perhaps this is something unique to 2012 R2. I don't claim to be a seasoned expert on tracing and I don't have the time to investigate the differences at this point but hopefully others find this useful.

Let me know if I missed anything or if you have any suggestions or comments.