This is a migrated thread and some comments may be shown as answers.

Exception has been thrown by the target of an invocation

3 Answers 675 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
DavidT
Top achievements
Rank 1
DavidT asked on 10 Jul 2009, 03:49 PM
I'm trying to add a Report using the Properties popup dialogue of a ReportViewer.  After I have drilled down to my selected report, and try to select it, I get a Visual Studio error alert

"Exception has been thrown by the target of an invocation"

Funny thing is that it was all working fine yesterday night :S

Can anyone shed any light as to the possible reasons why this might be happening?

Thanks

David

3 Answers, 1 is accepted

Sort by
0
DavidT
Top achievements
Rank 1
answered on 10 Jul 2009, 03:56 PM
I also now have when trying to open a page where a previous ReportViewer attached a report was working

"Warning    1    Generation of designer file failed: Cannot create an object of type 'Telerik.Reporting.IReportDocument' from its string representation 'Test3.Report1, Test3, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' for the 'Report' property.etc.."

Any ideas?

Thanks again

David
0
Steve
Telerik team
answered on 13 Jul 2009, 06:53 AM
Hi DavidT,

This usually means that something is wrong with your report. You can try previewing the reports in the designer where they should show what the problem is, or you can wire the report to the viewer programmatically in code behind like this (e.g. in Page_Load):

ReportViewer1.Report = new MyReport();

That way a more descriptive error should be thrown to pinpoint what's wrong.

Greetings,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Jonathan Ulfeng
Top achievements
Rank 2
answered on 22 May 2010, 07:10 PM
When I hard code the connection string as below (see code) I get the exception. When I remove the "hard coded" connection string the preview works. I hope that helps someone.

        public General1()
        {
            /// <summary>
            /// Required for telerik Reporting designer support
            /// </summary>
            InitializeComponent();
            
            this.Snapshot.ConnectionString = ConfigurationManager.ConnectionStrings["ReportConnection"].ConnectionString;
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Tags
General Discussions
Asked by
DavidT
Top achievements
Rank 1
Answers by
DavidT
Top achievements
Rank 1
Steve
Telerik team
Jonathan Ulfeng
Top achievements
Rank 2
Share this question
or