1525822 - Exception "Object reference not set to an instance of an object." thrown when clicking on Parameter Panel button in Crystal Report .NET Windows Form Viewer

SAP Knowledge Base Article - Public

1525822 - Exception "Object reference not set to an instance of an object." thrown when clicking on Parameter Panel button in Crystal Report .NET Windows Form Viewer

Symptom

  • View a Server File Report in the Crystal Reports .NET Windows Form Viewer.
  • Click the Toggle Parameter Panel button to edit the current parameters in the panel.
  • An exception is thrown "Object reference not set to an instance of an object."

parameter panel icon.png

null exception.png

Full Stack Trace
System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="CrystalDecisions.Windows.Forms"
  StackTrace:
       at CrystalDecisions.Windows.Forms.ParameterFieldInfo.get_isDCP()
       at CrystalDecisions.Windows.Forms.ParameterValueEditControl.Start()
       at CrystalDecisions.Windows.Forms.ParameterUnit.AddEditControl(ParameterValue pv)
       at CrystalDecisions.Windows.Forms.ParameterUnit.UpdateControls()
       at CrystalDecisions.Windows.Forms.ParameterUnit.set_ParameterFieldInfo(ParameterFieldInfo value)
       at CrystalDecisions.Windows.Forms.InteractiveParameterPanel.ShowParameters()
       at CrystalDecisions.Windows.Forms.CrystalReportViewer.ShowInteractiveParameters()
       at CrystalDecisions.Windows.Forms.CrystalReportViewer.set_IsInteractiveParametersVisible(Boolean value)
       at CrystalDecisions.Windows.Forms.CrystalReportViewer.set_ToolPanelView(ToolPanelViewType value)
       at CrystalDecisions.Windows.Forms.PageView.toolPanelButton_Clicked(Object sender, EventArgs e)
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.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.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at cr12_ServerFileReports.Program.Main() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\cr12_ServerFileReports\cr12_ServerFileReports\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Environment

  • Visual Studio 2008
  • .NET Windows Form application
  • Crystal Reports 2008 SP3
  • Server File Reports, web services
  • Crystal Reports for Visual Studio 2010
  • VS 2010

Reproducing the Issue

private void ConfigureCrystalServerFileReport()
{
CrystalDecisions.Shared.ServerFileReport boServerFileReport = new CrystalDecisions.Shared.ServerFileReport();
boServerFileReport.ObjectType = CrystalDecisions.Shared.EnumServerFileType.REPORT;
boServerFileReport.ReportPath = "test.rpt";
boServerFileReport.WebServiceUrl = "http://localhost/CRWebServices/ServerFileReportService.asmx";
crystalReportViewer1.ReportSource = boServerFileReport;

}

Cause

The issue has been identified and logged under Problem Report ID ADAPT01498492.

Resolution

  • This issue has been addressed in Crystal Reports 2008 FixPack 3.5.
    • The exception thrown in this situation has been addressed by displaying a new friendly error message: The report parameters cannot be updated by the server hosting your report files.
    • Due to technical limitations the Parameter Panel will not work with Server File Reports provided through web services.
  • Alternative solutions to this issue are:
    • Use the ReportDocument object as the ReportSource for the Windows form viewer. 
    • Use a web application instead of a Windows form application. The CrystalDecisions.Web.CrystalReportViewer doesn't have the same problem with the parameter panel when using a ServerFileReport as the ReportSource.
  • This issue is resolved in Service Pack 2 for Crystal Reports for Visual Studio 2010 (ADAPT01498492)

Keywords

ADAPT01498492, 01498492, 1498492 CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Bug Filed

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio