Unable to Cast Object of Type

<< Click to Display Table of Contents >>

Navigation:  Collect > Troubleshooting >

Unable to Cast Object of Type

This article provides instructions for fixing the "Unable to cast object of type" error when publishing Collect reports following the @facility_id parameter change implemented in the 7.21.3 release. The 7.21.3 release note text is shown below in italicized text:

 

Facility is automatically selected based on the currently selected facility when editing the report parameters using the EZView widget in Enterprise for the following Collect Reports:

 

Collect Field EDD

Collect Form Generator

Collect COC

Collect eCOC

Collect COC and eCOC

 

Note: If any of these reports were previously published to the database, they will need to be republished. To ensure correct republishing, store the report DLL files outside of the Professional folder during the republishing process.

 

Error Message:

 

An error has occurred in EQuIS, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7b3b91006de2d53d:

 

Unable to cast object of type 'EarthSoft.Common.Reports.TextParameter' to type 'EarthSoft.Common.Reports.ListParameter'.

  at EarthSoft.Common.Reports.ParameterCollection.Extend(ParameterCollection params, Connection cn)

  at EarthSoft.Common.Reports.ReportData.GetReport(ReportInfo reportInfo, Boolean publishing)

  at EarthSoft.Common.Reports.ReportData.GetReports(String ReportName)

  at EarthSoft.Reports.Forms.ReportPublisher.getDBReports(Connection cn, ListDictionary reports, Boolean KeepParams)

  at EarthSoft.Reports.Forms.ReportPublisher.SetupForm(ListDictionary reports, String filename)

  at EarthSoft.Reports.Forms.ReportPublisher.ImportDLL(String filename)

  at EarthSoft.Reports.Forms.ReportPublisher..ctor(Connection Connection, String filename, String fileType)

  at EarthSoft.Reports.OpenDialog.ImportClick()

  at System.Windows.Forms.Control.OnClick(EventArgs e)

  at System.Windows.Forms.Button.OnClick(EventArgs e)

  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

  at System.Windows.Forms.Control.WndProc(Message& m)

  at System.Windows.Forms.ButtonBase.WndProc(Message& m)

  at System.Windows.Forms.Button.WndProc(Message& m)

  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

System.InvalidCastException: Unable to cast object of type 'EarthSoft.Common.Reports.TextParameter' to type 'EarthSoft.Common.Reports.ListParameter'.

  at EarthSoft.Common.Reports.ParameterCollection.Extend(ParameterCollection params, Connection cn)

  at EarthSoft.Common.Reports.ReportData.GetReport(ReportInfo reportInfo, Boolean publishing)

  at EarthSoft.Common.Reports.ReportData.GetReports(String ReportName)

  at EarthSoft.Reports.Forms.ReportPublisher.getDBReports(Connection cn, ListDictionary reports, Boolean KeepParams)

  at EarthSoft.Reports.Forms.ReportPublisher.SetupForm(ListDictionary reports, String filename)

  at EarthSoft.Reports.Forms.ReportPublisher.ImportDLL(String filename)

  at EarthSoft.Reports.Forms.ReportPublisher..ctor(Connection Connection, String filename, String fileType)

  at EarthSoft.Reports.OpenDialog.ImportClick()

  at System.Windows.Forms.Control.OnClick(EventArgs e)

  at System.Windows.Forms.Button.OnClick(EventArgs e)

  at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)

  at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

  at System.Windows.Forms.Control.WndProc(Message& m)

  at System.Windows.Forms.ButtonBase.WndProc(Message& m)

  at System.Windows.Forms.Button.WndProc(Message& m)

  at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

Solution: To ensure correct republishing please do the following:

 

1.Remove any old Collect report DLLs from your Professional installation folder.

2.Store the report DLL file outside of the Professional installation folder.

a.For the Collect Form Generator report the associated DLLs, EarthSoft.API.Collect.dll, EarthSoft.API.Core.dll, and System.Web.Http.dll files are to still be stored in the Professional installation folder.