Skip to Content
0

Why won't the Report Viewer work when launched from a C# console application?

Mar 05 at 09:18 PM

76

avatar image
Former Member

I get the following error in Visual Studio 2015 when attempting to display a report in the Crystal Reports Viewer, from a C# console application:

ContextSwitchDeadlock occurred Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'E:\PS_SwDev\Lib.Net2.0\CrystalNETLib\CRNL_Console\bin\Debug\CRNL_Console.vshost.exe'. Additional information: The CLR has been unable to transition from COM context 0x28e0e00 to COM context 0x28e1308 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

My application, CRNL_Console.exe, reads the report parameters from the command line, then creates an instance of my class, CrystalNETJob, passing it the parameters. CrystalNETJob then uses my Crystal interface library, CrystalNETLib, to perform the operation (view the report). The viewer window (titled PreviewDlg) displays, and pops up a small, title-less window which reads, "Please wait while the document is processing."

The pertinent portion of the Visual Studio Output Window contains:

'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'E:\PS_SwDev\Lib.Net2.0\CrystalNETLib\CRNL_Console\bin\Debug\CrystalNETLib.dll'. Symbols loaded. CrystalNETJob.RunPrintPreview() CrystalNETJob.CreateLibInstance( ref ICNLApp ) => CrystalNETLib object created CrystalNETLib.CrystalLib.OpenReport( E:\PS_SwDev\Projects\FusionRetail\Version440\_DbgWrk\RunDbg_vs2015\Reports\invoice.rpt ) 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.3500.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Shared\13.0.3500.0__692fbea5521e1304\CrystalDecisions.Shared.dll'. Cannot find or open the PDB file. CrystalNETLib.CrystalReport( E:\PS_SwDev\Projects\FusionRetail\Version440\_DbgWrk\RunDbg_vs2015\Reports\invoice.rpt ) ctor 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.CommLayer\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.CommLayer.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ClientDoc.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.DataDefModel\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.DataDefModel.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.CubeDefModel\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.CubeDefModel.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ReportDefModel\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ReportDefModel.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.Controllers\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.Controllers.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.DataSetConversion\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.DataSetConversion.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_32\log4net\1.2.10.0__692fbea5521e1304\log4net.dll'. Module was built without symbols. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'. Symbols loaded. => CrystalNETLib Report object created CrystalNETLib.CrystalReport.SetDSN(...) => FRS, sa, MyPassword CrystalNETLib.CrystalReport.ApplyLogonToReport() 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\CustomMarshalers\v4.0_4.0.0.0__b03f5f7f11d50a3a\CustomMarshalers.dll'. Symbols loaded. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.XmlSerialize\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.XmlSerialize.dll'. Cannot find or open the PDB file. CrystalNETLib.CrystalReport.ApplyLogonToReportSections() CrystalNETLib.CrystalReport.ApplyLogonToReport() => Report logon successful CrystalNETLib.CrystalReport.SetRecordSelectionFormula(...) => {POSInvoiceHeader.RegisterID} = "DAL001" CrystalNETLib.CrystalReport.Preview() 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Windows.Forms\13.0.3500.0__692fbea5521e1304\CrystalDecisions.Windows.Forms.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.ReportSource\13.0.3500.0__692fbea5521e1304\CrystalDecisions.ReportSource.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll'. Symbols loaded. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.Web\13.0.3500.0__692fbea5521e1304\CrystalDecisions.Web.dll'. Cannot find or open the PDB file. 'CRNL_Console.vshost.exe' (CLR v4.0.30319: CRNL_Console.vshost.exe): Loaded 'C:\WINDOWS\assembly\GAC\FlashControlV71\1.0.3187.32366__692fbea5521e1304\FlashControlV71.dll'. Cannot find or open the PDB file. The program '[13524] CRNL_Console.vshost.exe' has exited with code -1 (0xffffffff).

Anyone have any ideas?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
Mar 05 at 09:43 PM
0

Hi Steven,

CR Windows form viewer need to be in WindowsForm to be used.

Don

Share
10 |10000 characters needed characters left characters exceeded