Search code examples
c#crystal-reportsvisual-studio-2017.net-3.5

Crystal Report SetDataSource crash


My project was developed by Visual Studio 2013 which is using Crystal Report under SP21. Currently I migrated to use Visual Studio 2017 and installed Crystal Report SP24. The application is able to execute without any issue. However, once I print report by Crystal Report, w3wp.exe was crashed. It is happening in my localhost.

          rptGrn.Load(HttpContext.Current.Server.MapPath("~/Reports/GRNRecords.rpt"));
      rptGrn.SetDataSource(SSRecordHdrs); //error
      rptGrn.Subreports["GRNDetails"].SetDataSource(lsDtls); //error

I tried the solution by add setting in web.config but no luck on this and it didn't working.

<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v2.0.50727"/>    
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>

I have scratch my head one week for this issue. I'm appreciate any help or comment that giving clues to solve this issue.

Thank you very much.

Setup: - WebForm application - .NET 3.5 - Visual Studio 2017 - IIS 10 (Localhost)


Solution

  • After suffering for a week, I found the root cause is Crystal Report SP21 afterward is unable to using ADO.NET.

    Kindly refer points(5) for SP21: https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Solution I found is: Create a virtual machine by installing Crystal Report under SP21 and deploy the project over virtual machine.

    Take note: .NET framework over 3.5 will not having this issue.

    If anyone are developing by .NET 3.5 framework above and maybe able solve it by adding

        <startup useLegacyV2RuntimeActivationPolicy="true">
    

    to web/app config. I tried this method but no luck for me.

    Good luck for anyone having this issue.