I am getting the following exception when my view first loads. I have default parameters set for the report and am using IEnumerable ObjectsSource.
Object reference not set to an instance of an object.
at Infragistics.Controls.Reports.XamReportViewer.CheckForReportParameters(Boolean reset)
at Infragistics.Controls.Reports.ViewerStateMachine.Render(Boolean firstRender, IDictionary`2 selectedParameterValues)
at Infragistics.Controls.Reports.ViewerStateMachine.ApplyAutoRender()
at Infragistics.Controls.Reports.ViewerStateMachine.set_IsVisualReady(Boolean value)
at Infragistics.Controls.Reports.XamReportViewer.ReportViewerLoaded(Object sender, RoutedEventArgs e)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
at MS.Internal.LoadedOrUnloadedOperation.DoWork()
at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
The report renders when the submit button is clicked on the parameters tab. The parameters are not held when the user takes the focus off of the report viewer to another view. I cant find a way to bind the parameters to stop this from happening.
Thanks,
Eric Larson
Hi Eric,
It looks like a bug, but I don’t fully understand the scenario in order to reproduce it.
Can you give me more details? How do you setup the XamReportViewer? Do you set its properties directly in the xaml or programmatically? SL or WPF?
What do you mean by “I have default parameters set for the report”? You have parameters with default values, is that what you mean?
When you say “the user takes the focus off the report viewer” you mean that when the viewer just lost the keyboard focus you lost the parameter values you previously select? Or is that change of focus causing the XamReportViewer to be unloaded from the visual tree?
Leo
I set the reportviewer in xaml for WPF just like the following.
<Reports:XamReportViewer Name="xamReportViewer1" >
<Reports:XamReportViewer.RenderSettings>
<Reports:ClientRenderSettings
DefinitionUri="NameSpace.Report1.igr, Assembly"/>
</Reports:XamReportViewer.RenderSettings>
</Reports:XamReportViewer>
Yes by default parameters I meant parameters with default values.
I have the reportviewer hosted in a tabItemEx. When the tab is switched to another tab, that is not the tab hosting the report viewer, the report unloads. I have to re-populate the parameters and submit to regenerate the report when the hosted tab with the report viewer is brought back into view. The viewer is always still there but the report has to be regenerated with the parameter values previously entered.
Is there any update on this or fixes?
Sorry for the delay.
It is a bug. Currently the XamReportViewer reset its state when the control is unloaded, so each time you are switching tabs a reset occurs. This issue will be fixed for V1.
Currently the only workaround would be to prevent the XamReportViewer from being unloaded.
Could you explain how to prevent the XamReportViewer from unloading? I'm struggling with this exception too.
Hi,
AFAIK you can't avoid that the Tab Control unloads the viewer when you switch tabs. So you will have to use the viewer outside the control until the bug is fixed (V1).