Google-chrome – ASP.NET ReportViewer Google Chrome CPU usage

asp.netgoogle-chromereporting-servicesreportviewer

We have found an interesting issue between ASP.NET 3.5 and ReportViewer with Google Chrome. Our set of pages work fine until a ReportViewer control displays a report.

Google Chrome then eats up 50% of the CPU doing nothing it seems.

I've extracted the ReportViewer control to a blank Web Forms project to confirm its that control and not a rogue bit of my code.

I'm using ReportViewer in local mode (RDLC file) so I presume its the 2005 version?

Anyone seen this before and have a solution?

Phil

Edit: Google Chrome 3.0.195.33 on Vista Business x64

Edit 2: Added bounty for help fixing this

Best Answer

The solution is actually some of the ReportViewer JavaScript causes an infinite loop in Chrome, I am posting the source code on how to solve this issue by making a custom version of the ReportViewer control and fixing the broken JavaScript (I've lost the link to the solution, but I didn't write this, just used it :))

I can confirm that now we have upgraded to the newest ReportViewer in Visual Studio 2010, the Chrome CPU issue no longer exists and this work around isn't required.

public class MyReportViewer : Microsoft.Reporting.WebForms.ReportViewer
{
    protected override void Render(HtmlTextWriter writer)
    {
        using (StringWriter sw = new StringWriter())
        {
            HtmlTextWriter tmpWriter = new HtmlTextWriter(sw);
            base.Render(tmpWriter);
            string val = sw.ToString();
            val = val.Replace(@"!= 'javascript:\'\''", @"!= 'javascript:\'\'' && false");
            writer.Write(val);
        }
    }
}