views:

377

answers:

5

Hello,

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

A: 

I can confirm that too. Same Chrome version on Win7 x86.

norcis
this isn't an answer. put this in the comments under the original question
Miles
A: 

I had this problem and it drove me absolutly crazy!

First of all save the generated file - this is if you can. Sometimes it freezes up. Save and check the size of the report being generated. My issue resuletd in files in excess of 16MB being generated and slowing down the browser and network.

Do yourself a favour have a look at the html, by viewing source, that is being generated inside the web form. Check whether the styling has been written explicitly inline within the generated document instead of referenced from a file.

Try removing the styling from the report and see if that helps.

Jonathan
+1  A: 

There's a thread on the Google Chrome forums talking about this. I don't know if it's possible for you to run the report on the server instead of locally, which seems to fix the issue. Here's the thread: ReportViewer rendering maxes out thread CPU usage

TskTsk
Not an option as the data comes from many different places and needs to be processed and then bound as a object data source.
Phil
A: 

While Chrome is a nice browser and is evolving rather quickly, I am afraid there are for now no solution other than use another browser. I would think that Google will be working on this issue eventually but for now it is not fixed.

I'de think they would try to fix other issues. I did see other pages being rendered in a weird way with chrome and not with IE.

David Brunelle
+1  A: 

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);
        }
    }
}
Phil