Page 1 of 1

TargetInvocation Problem

PostPosted: Sun May 29, 2011 10:43 am
by RIGHT_THEN
hey Charles,

-ref:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Windows.Forms.dll" #<- would produce targetInvocation error
-ref:"C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll" #<- would work okay

this exception is thrown when trying to use some function through Reflection on these assemblies
Cobra compiler is using reflection to know these assemblies but in one case it works and in other it does not
why?
On the other hand
-ref:"C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll" #<- would work again

seems if assemblies of .net 4.0 are referenced from \Reference Assemblies\.. then it works okay otherwise not
do you know about this behaviour and reason for it?

Thanking_You
RIGHT_THEN

Re: TargetInvocation Problem

PostPosted: Sun May 29, 2011 1:40 pm
by Charles
This is new to me. Did you compare the files for size and date? How do they differ? If they differ, why do they differ?

Re: TargetInvocation Problem

PostPosted: Mon May 30, 2011 11:34 pm
by Charles
Were you able to research this any more? Like why the 2 DLL versions exist and what is different about them? Also, if you want more help on my part, please paste some code and the full exception output.

Re: TargetInvocation Problem

PostPosted: Tue May 31, 2011 6:51 am
by RIGHT_THEN
hey charles

i am sorry i couldnt do any research on this aspect
i am busy in certain things at the moment.
but this much i checked that C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 File is 1.5 mb actually less in size
than in the C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder which is 4.75 Mb this is strange why smaller size is working

Thanking_You
RIGHT_THEN

Re: TargetInvocation Problem

PostPosted: Tue May 31, 2011 9:21 am
by Charles
What type and method are you reflecting on?

Re: TargetInvocation Problem

PostPosted: Tue May 31, 2011 9:56 am
by RIGHT_THEN
hey charles

No it was not me that was reflecting on anything. it was cobra internally
the error was form the side of cobra something like COBRA INTERNAL error
Target invocation i checked what might be targetinvocation error . it turned out it
usually happens when we try to access some function etc.. of a assembly through
reflection and either permission is not their or method does not exist.
all i could think of was that Cobra complier might be trying to access things and
then getting into trouble.it was a simple winform app from HowTos.

it is not that i am making something i was just testing and improving upon the
SD addin which i might putup soon.
while testing this thing came into light. but anyhow i have removed this problem from
addin when ever user would reference .net 4.0 assemblies they will be referenced from
\Reference Assemblies\ only and not from \FrameWork\ folder so problem by itself is
not there anymore but it is more of an academic\curious question that why it should
happen.


Thanking_You
RIGHT_THEN

Re: TargetInvocation Problem

PostPosted: Tue May 31, 2011 12:34 pm
by Charles
Okay, thanks for the clarification. I'll assume this is a non-issue unless someone brings it up again.