Google Analytics

Tuesday, August 27, 2013

Fusion Log Viewer

Back to basics, indeed. The Fusion log viewer is an arrow that should be in the quiver of every Windows application developer. It wasn't in mine, however, until this morning. In our morning Scrum I complained that I was having trouble tracking down an issue with Infragistics Reporting. The report viewer was trying to load some libraries at runtime and was giving me the classic non-descript error: 

"System.NullReferenceException: Object reference not set to an instance of an object." 

The full error is:

Infragistics.Controls.Reports.ReportViewerException: An unknown error occurred while processing the report. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Infragistics.Reports.Engine.ServiceModelMefDiscoverer.Initialize(IServiceModelManager serviceModel)
   at Infragistics.Reports.Engine.ServiceModelBuilder.Setup(IServiceModelConfiguration configuration)
   at Infragistics.Controls.Reports.ReportProcessorLocalAdapter..ctor(ReportSource reportSource, Assembly reportAssembly, IEnumerable`1 externalDataSources)
   at Infragistics.Controls.Reports.RenderingEngineFactory.CreateLocalEngine(ReportSource reportSource, Assembly reportAssembly, IEnumerable`1 externalDataSources)
   at Infragistics.Controls.Reports.ProcessingSessionStateMachine.CreateProcessor(IRenderingEngineFactory renderingEngineFactory, IEnumerable`1 externalDataSources, Report reportDefinition, Assembly reportAssembly)
   --- End of inner exception stack trace ---
   at Infragistics.Controls.Reports.ProcessingSessionStateMachine.CreateProcessor(IRenderingEngineFactory renderingEngineFactory, IEnumerable`1 externalDataSources, Report reportDefinition, Assembly reportAssembly)

   at Infragistics.Controls.Reports.ViewerStateMachine.RenderHelper(RenderParameters renderParameters, Report reportDefinition, Assembly reportAssembly)

We narrowed it down to an issue loading libraries, since the viewer was working on my machine where I had the Infragistics tools installed.

My colleague said, "No problem. We'll just look at it in the Fusion log and see what the issue is." I gave him a blank stare. "Find me in a bit, and I'll show you." Not to throw said colleague under a bus, but then he spent the next 90 minutes on the phone. Important stuff, but I have these nice reports that I want to show off to the team.

Then I found this blog from Scott Hanselman (who has saved me on a number of such occasions): http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx. It is very simple to fire up and use, and I am kicking myself for the times that I had similar issues that took me hours if not days to track down.

After firing up the Fusion Log Viewer on a machine where I did not have Infragistics installed, clearing the logs, and then running the troubled application, I found that the app was trying to load up two libraries (InfragisticsWPF4.Reports.Controls.Charts.XamDataChart.v13.1.dll and InfragisticsWPF4.Reports.Controls.DataVisualization.v13.1.dll for those of you who may run into the same issue) that I had added the references to but had forgotten to include in the Wix installer. With the libraries added I can finally show off what has been almost 3 weeks of work on the reporting functionality of this application.