开发者

Crystal Reports works in debug mode fails outside debugger

I have a .net 2.0 application which uses Crystal Reports XI R2(11.5.3700.0) for reporting. It works fine under Windows XP but shows a strange behavior on Windows 7.

In Windows 7, when running in debug mode (F5) everything looks well and fine but if we launch the EXE directly (No debug; CTRL+F5)m it fails to show the report.

I can see the following information from the stack trace but I am completely clueless here.

at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.EnsureLoadReport()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)

Anybody ever faced this trouble and recovered? Kind help is always appreciated.

开发者_如何学运维

Edit: This application runs on a single UI thread. It is a Winforms application.


This issue is because of the Data Execution Prevention security feature in Windows 7. There are two ways to fix it.

  1. Add the following lines to your post build script and forget this issue
call "$(DevEnvDir)\..\..\VC\bin\vcvars32.bat" 
call "$(DevEnvDir)\..\..\VC\bin\editbin.exe" /NXCOMPAT:NO "$(TargetPath)"
  1. Disable DEP completely (Not recommended. Its gonna open security hole) and everything works fine.
  2. Install Crystal Reports XI R2 Service Pack 6 runtime. This runtime is compatible to Windows 7 (As per their release notes. I have not tested this).


I was facing the same issue if you are using the report folder for crystal reports then it's simple to copy your reports folder from the debug folder and also past it in the release folder that is in the bin folder and run your project in release mode. Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜