This is a migrated thread and some comments may be shown as answers.

NullReferenceException in WPF ReportViewer

1 Answer 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 20 Sep 2012, 07:09 PM
After the most recent update to Reporting, a NullReferenceException is thrown when a ReportViewer is loaded without setting the ReportSource. When I load the the view that contains the viewer, I'm seeing this exception which I can't catch and suppress. My particular use case is in a Application that dynamically creates reports based on user input and then sets the source through data binding. This is a show stopper for a release I have to meet next week, so any quick help that can be provided would be much appreciated.My particular use case is in an MVVM Application where I dynamically create reports based on user input and then set the source through data binding.  

Here is the stack trace: 

Telerik.ReportViewer.Wpf.dll!Telerik.ReportViewer.Wpf.ReportViewerModel.CreateReportSourceSnapshot() + 0x26 bytes Telerik.ReportViewer.Wpf.dll!Telerik.ReportViewer.Wpf.ReportViewerModel.RefreshReportInternal(bool reloadParameters, Telerik.ReportViewer.Common.LogHistoryRecord logHistory, bool resetCachedResults) + 0xb5 bytes
Telerik.ReportViewer.Wpf.dll!Telerik.ReportViewer.Wpf.ReportViewer.RefreshReport() + 0x4c bytes
Telerik.ReportViewer.Wpf.dll!Telerik.ReportViewer.Wpf.ReportViewer.OnLoaded(object sender, System.Windows.RoutedEventArgs e) + 0x26 bytes
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) + 0x78 bytes
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) + 0xbe bytes
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) + 0x79 bytes
PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs e) + 0x17 bytes
PresentationFramework.dll!System.Windows.BroadcastEventHelper.BroadcastEvent(System.Windows.DependencyObject root, System.Windows.RoutedEvent routedEvent) + 0x149 bytes
PresentationFramework.dll!System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(object root) + 0xa9 bytes
PresentationCore.dll!MS.Internal.LoadedOrUnloadedOperation.DoWork() + 0x16 bytes

1 Answer, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 25 Sep 2012, 07:41 AM
Hi Andrew,

We are sorry for hitting this issue. It has already been fixed and the fix will be available in the next internal build or for the official release next month. As a workaround you can simply assign an empty report source (e.g. InstanceReportSource) to the viewer i.e.

reportViewer1.ReportSource = new InstanceReportSource();

Regards,
Steve
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Answers by
Steve
Telerik team
Share this question
or