C# Crystal Reports Asks Connection Parameter or Crashes Randomly

22 Views Asked by At

I have a C# WinForm application which opens a Report based on Crystal Reports.

It has a DataSet connection, filled by the application.

DataSetRicerca_produzione ds = new DataSetRicerca_produzione();
Ricerca_produzioneTableAdapters.Ricerca_ProduzioneTableAdapter ta = new Ricerca_produzioneTableAdapters.Ricerca_ProduzioneTableAdapter();
ta.Connection.ConnectionString = CnnStrBld.ConnectionString;
ta.Fill(ds.Ricerca_Produzione, Inizio, Fine, OrdAcc, Cicli, var1, var2, var3, var4, var5, var6, var7, var8, var9, var10, IdLav.ToString(), Idris.ToString(), IdRep.ToString(), IdOp.ToString(), IdArt.ToString(), IdMst.ToString(), IdCliente.ToString(), IdCodRagg.ToString(), IdLotto.ToString(), IdCausale.ToString(), EffMin, EffMax, Sgn, Cnf);

...

ReportDocument rd = new ReportDocument();

rd.Load(RPT PATH FILE);
rd.SetDataSource(ds);
foreach (CrystalDecisions.Shared.IConnectionInfo c in rd.DataSourceConnections)
{
     c.SetLogon(pCnnStrBld.UserID, pCnnStrBld.Password);
     c.SetConnection(pCnnStrBld.DataSource, pCnnStrBld.InitialCatalog, pCnnStrBld.IntegratedSecurity);
}

...

//crViewer is a CrystalDecisions.Windows.Forms.CrystalReportViewer
crViewer.ReportSource = rd;

It works properly until, it seems, the application reaches at least 2 GB of ram or the process has more than 2000 USER Objects.

The more those 2 values (Ram and USER Objects) increase, the more often this behavior can happen and, when it starts doing this, lowering the Ram occupation or the USER Objects of the application doesn't solve the issue.

The application, build in Release|x64, has no problem but, if you try to open the report in the conditions above (Ram & USER Object), it starts to have a strange behavior.

It can randomly do one of those things:

  • Open the report
  • Ask for SQL connection parameters

CrysalReports asks login

  • Crash without any specific error (this are the only 2 found in Event Viewer)

EventViewer Error1

EventViewer Error2

I also noticed that in %Temp% Folder it can happen:

  • When the report works: Are created 4 files CRTemp Files
  • When the reports dowsn't work (parameter requested or crashed): Are created 3 files instead of 4 (the ~cpe is missing)

I expect the Report to work every time. I tried installing on the PC even the CRRuntime (x64 bit) or the CR for VS with no different result.

Has someone faced this problem? How can I solve this? Ask me more details if needed

Thanks in advance

0

There are 0 best solutions below