Re: TargetInvocationException not verbose enough

"Charlie Poole" <[email protected]> Tue, 16 Sep 2008 09:37:34 -0700
Newsgroups gmane.comp.windows.dotnet.nunit.user
Message-ID <01a601c9181a$869ad480$6402a8c0@ferrari>
In most places, NUnit catches a TargetInvocationException
and throws the inner. It may be that it isn't doing so
in this particular place, which seems o be in the constructor
of your fixture object.

Could you file a bug on this, along with info about the
NUnit version and your environment?

Charlie

> -----Original Message-----
> From: [email protected] =

> [mailto:[email protected]] On Behalf =

> Of "Andr=E9s G. Aragoneses"
> Sent: Tuesday, September 16, 2008 4:44 AM
> To: [email protected]
> Subject: [Nunit-users] TargetInvocationException not verbose enough
> =

> When NUnit encounters a TargetInvocationException, I get no =

> clue about the innerException. It would be good that NUnit =

> printed this information.
> =

> A snippet of what I get:
> =

> 1) UiaAtkBridgeTest.BridgeTester.UIACheckBox : Exception has =

> been thrown by the target of an invocation.
>   at System.Reflection.MonoCMethod.Invoke (System.Object obj, =

> BindingFlags invokeAttr, System.Reflection.Binder binder, =

> System.Object[] parameters, System.Globalization.CultureInfo =

> culture) [0x00086] in
> /home/knocte/Documents/iDocs/Proyectos/a11ymono/mcs/class/corl
> ib/System.Reflection/MonoMethod.cs:432
> =

>   at System.Reflection.MonoCMethod.Invoke (BindingFlags =

> invokeAttr, System.Reflection.Binder binder, System.Object[] =

> parameters, System.Globalization.CultureInfo culture) [0x00000] in
> /home/knocte/Documents/iDocs/Proyectos/a11ymono/mcs/class/corl
> ib/System.Reflection/MonoMethod.cs:441
> =

>   at System.Reflection.ConstructorInfo.Invoke (System.Object[]
> parameters) [0x0000e] in
> /home/knocte/Documents/iDocs/Proyectos/a11ymono/mcs/class/corl
> ib/System.Reflection/ConstructorInfo.cs:77
> =

>   at NUnit.Core.Reflect.Construct (System.Type type) [0x00023] in
> /home/knocte/Documents/iDocs/Proyectos/a11ymono/mcs/nunit20/co
> re/Reflect.cs:364
> =

> =

> =

> NOTE: I cannot use this:
> =

> [Test]
> public void MyTest (){
>   try{
>     //..contents of my test..
>   }catch(TargetInvocationException ex){ throw ex.InnerException } }
> =

> This hasn't got any effect because it seems the TIE is thrown =

> even before reaching the contents of the test (maybe it =

> happens in a static constructor that gets executed before the tests?).
> =

> Regards,
> =

> 	Andr=E9s
> =

> -- =

> =

> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move =

> Developer's challenge Build the coolest Linux based =

> applications with Moblin SDK & win great prizes Grand prize =

> is a trip for two to an Open Source event anywhere in the =

> world http://moblin-contest.org/redirect.php?banner_id=3D100&url=3D/
> _______________________________________________
> Nunit-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/nunit-users
> =




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great priz=
es
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=3D100&url=3D/