I have two application
Environment
When I am running the application on my dev machine which is Windows 10, it works fine without any issue but when I run it on Server which is Windows Server 2012 R2 then application crashes. Below is the crash screenshot.
This is crashing when application is setting datasource. Below is the code :
foreach (CrystalDecisions.CrystalReports.Engine.Table _t in rpt.Database.Tables)
{
try
{
if (ds.Tables[_t.Name] != null)
{
_t.SetDataSource(ds.Tables[_t.Name]);
}
}
catch (Exception e)
{
LogMessage(string.Format("Unable to SetDataSource for table {0} {1}", _t.Name, e.ToString()));
return false;
}
}
Application is crashing at _t.SetDataSource(ds.Tables[_t.Name]); this line. On the same server, web application is working fine. But getting issues while running it through separate process. Both the library and windows app is set to Any CPU. I also tried it with 64 bit also but failed.
I was using .Net frameowrk 4.7 and on server it was 4.0 and crystal report version I was using was targeted to 4.0
Changed the target framework of the csproj files to 4.0 and it started working .