Home Dashboard Directory Help
Search

Error when adding two ReportViewer 2012 Web control on page by Edward Zhu


Status: 

Closed
 as Not Reproducible Help for as Not Reproducible


5
0
Sign in
to vote
Type: Bug
ID: 751256
Opened: 6/28/2012 1:48:26 AM
Access Restriction: Public
2
Workaround(s)
view
2
User(s) can reproduce this bug

Description

When we add two ReportViewer 2012 controls (Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91) on the page, then the first ReportViewer can be shown properly, but the second one has the error, "Object reference not set to an instance of an object".

For more information, please refer to the TechNet thread: http://social.technet.microsoft.com/Forums/en-US/sqlreportingservices/thread/95ce5b7b-8eec-4f20-a43a-adb276b24361
Details
Sign in to post a comment.
Posted by sandygettings on 3/22/2013 at 9:23 AM
Okay, this thread seems to be dead. I've submitted a new issue along with a sample project that reporduces the problem.

https://connect.microsoft.com/VisualStudio/feedback/details/781937/error-adding-two-reportviewer-2012-controls
Posted by sandygettings on 3/17/2013 at 1:33 PM
Ok, I must be blind -- where go to I upload the file?
Posted by sandygettings on 3/17/2013 at 1:24 PM
Sorry it took so long to see your request, Matt -- I forgot to add this to my watch list. I'll upload a simple test case now.
Posted by Microsoft on 3/5/2013 at 7:57 AM
Thanks Sandy for validating the issue and providing a workaround. I'm still unable to repro the issue. Could you attach a zipped up solution that reproduces the issue?

Thanks,
Matt Jones
SSRS Tiger Dev
Posted by sandygettings on 2/27/2013 at 6:39 PM
I have the same problem and I developed a very simple test case to demonstrate it. It definitely looks like a Microsoft bug -- let me know if you want a copy of my example.

I also found a workaround that I've successfully tested in a few cases. Add a Refresh() for the second ReportViewer during the OnLoadComplete handler.

        protected override void OnLoadComplete(EventArgs e)
        {
            base.OnLoadComplete(e);
            ReportViewer2.LocalReport.Refresh();
        }
Posted by Microsoft on 1/28/2013 at 4:42 PM
Thanks for providing this information. Unfortunately, I'm unable to reproduce this issue. I created 2 simple reports, 1 with a parameter, the other with no parameters. Created a new web page with VS2012, added a ScriptManager and 2 ReportViewer controls. I pointed each RV control to one of the newly created reports. I'm able to run this in VS2012 debugger without any issues. Do your reports have images or background images? If so, try removing them from the report and check if that resolves the issue.
Posted by Renato Cazangi on 11/15/2012 at 4:08 PM
I have the exact same issue. You can have as many instances on page as you want: only the first one works properly on the first page load. Now if you click refresh on those that didn't work, they reload fine.

Differently than what was said though I used to have the same problem on ReportViewer 2010. However that one would show no error message at all.

If change AsynRendering to false, then all works fine.

I attached a event handler to OnReportError and got the following on stack trace:
        Source:    "Microsoft.ReportViewer.Common"    
Stack trace:
at Microsoft.Reporting.LocalService.Render(String format, String deviceInfo, String paginationMode, Boolean allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback)
at Microsoft.Reporting.WebForms.LocalReport.CreateSnapshot()
at Microsoft.Reporting.WebForms.ReportViewer.OnPreRender(EventArgs e)

+        TargetSite    {Microsoft.ReportingServices.ReportProcessing.ProcessingMessageList Render(System.String, System.String, System.String, Boolean, System.Collections.IEnumerable, Microsoft.ReportingServices.Interfaces.CreateAndRegisterStream)}    System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}
Sign in to post a workaround.
Posted by sandygettings on 2/27/2013 at 6:40 PM
Add a Refresh() for the second ReportViewer during the OnLoadComplete handler.

        protected override void OnLoadComplete(EventArgs e)
        {
            base.OnLoadComplete(e);
            ReportViewer2.LocalReport.Refresh();
        }
Posted by Renato Cazangi on 11/15/2012 at 4:08 PM
If you change AsynRendering to false, then all works fine. However you obviously lose the asynchronous rendering and all its benefits.