ActiveReports 15.2.3 - moving a report to a newer project

Posted by: wweicker on 8 June 2023, 1:06 pm EST

    • Post Options:
    • Link

    Posted 8 June 2023, 1:06 pm EST

    I had an old legacy system with an Active Report that was running v6.2.3164.0 originally with Visual Studio 2010. This old system doesn’t work anymore and I am trying to bring this report over into a newer solution.

    I have AR 15.2.3 installed and I was able to add references, recreate the report and it loads in the designer and looks right, and I got everything to compile, but I get an error when I try to run it: “Could not load file or assembly ‘System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51’ or one of its dependencies.

    This happens on the pdf.Export() line below:

    using (var pdf = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport())
    {
    	using (var rpt = new rptReleaseNotes())
    	{
    		rpt.DataSource = dtSource;
    		rpt.DataMember = "NOTES";
    		rpt.Document.Printer.PrinterName = "";
    		rpt.Run(false);
    
    		string strFile = ddlFixFor.SelectedItem.Text.Replace("Version ", "v") + " - ALL.pdf";
    		lstFiles.Add(strFile);
    
    		pdf.Export(rpt.Document, Context.Server.MapPath(Context.Request.ApplicationPath) + @"\ReleaseNotes\" + strFile); 
    		// ERROR happens on the line above:
    		// Could not load file or assembly 'System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    
    	}
    }

    My packages.config file has:

    <package id="System.Buffers" version="4.5.1" targetFramework="net472" />

    I tried putting this in my web.config file:

    <assemblyBinding>
      <dependentAssembly>
    	<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
    	<bindingRedirect oldVersion="0.0.0.0-4.5.1.0" newVersion="4.5.1.0" />
      </dependentAssembly>
    </assemblyBinding>

    …but then the page won’t even render at all, I get an immediate YSOD when I try to load it. I have attached my .csproj file - any idea what I’m doing wrong?

  • Posted 8 June 2023, 1:07 pm EST

  • Posted 9 June 2023, 6:36 am EST

    Hi Warren,

    Could you please try changing your ‘web.config’ values to

    <dependentAssembly>
      <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
    </dependentAssembly>
    

    And see if the issue persists.

    If the issue persists please try sharing a stripped-down sample of your application so we could test the behavior on our end and further investigate the issue.

    Regards,

    Anand

  • Posted 9 June 2023, 10:32 am EST

    That fixed it, thanks very much!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels