Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I have a winforms application which was working fine. Recently i formatted my system and reinstalled VS 2008. From that time the application has stopped running.
When i run it through VS it gives error
 
"exception has been thrown by the target of an invocation."
 
I went on to debug and found that in the this exception comes when from c# code using reflection the code tries to invoke a function from an assembly which is written in c++.
Posted 15-Mar-12 20:09pm
Edited 15-Mar-12 20:53pm
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Eventually I solved this myself. It was just a matter of getting to the root of the problem.
Actually the cuase of this exception was another exception which occured inside the method being invoked.
 
So i went to look out for solution by searching the exception ex.innerexception .
From there i searched the stack trace of that exception to finnaly get to the root of the problem.
 
So anyone getting this error do look for the innerexception cause the real problem lies there.
 

Thanks,
Mateen
  Permalink  
Comments
Nelek at 16-Mar-12 14:45pm
   
Thank you for posting your own solution. 5 for it
BasicsLearner at 16-Aug-13 7:01am
   
Thanks saved me !
thams at 24-May-12 0:59am
   
Thanks a ton. Saved me lot of time. Just went to the inner exception and found the problem. My problem is with threading. Thanks again.
MAYANK GEETE at 11-Sep-13 6:33am
   
I am New To WPF and i am working on it but it gives the same error "Exception has been thrown by the target of an invocation." it is a simple program to show data (that is stored in database) to datagrid in wpf. can u plz help?
thanks in advance
Member 10954869 at 20-Aug-14 3:32am
   
i got inner exception is null why and what the problem
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Disable the ajax for a moment (EnablePartialRendering="false" on the scriptmanager).
 

we Got Exception aftr that delete EnablePartialRendering property.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

thanks innerexception solved problem
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Great said by Mateen Khan, you need to understand what is you controls default value..
 

eg i'm using combobox in silverlight and i was trying to bind its selected index
 
as a default its selected index was -1
 
but it was get nothing from the respective property ...
 

I looked inside the inner exception and find out my solution
  Permalink  
Comments
ProgramFOX at 21-Dec-12 8:39am
   
Why do you answer to a question from May? The question is solved already, and the question has an accepted answer.
Elegantly Wasted at 17-Oct-13 6:54am
   
sharing my views..... thats it.... -_-
 
actually the solution helped me indeed... i just tried to tell what i came accross....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 200
1 PIEBALDconsult 150
2 BillWoodruff 148
3 Jochen Arndt 135
4 DamithSL 130
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web02 | 2.8.141216.1 | Last Updated 14 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100