Skip to content

When using pipe and testing for exception "raises" finds reflection exception instead #63

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

                 member this.RaiseException(message:string)=
                        raise (NotSupportedException(message))

        [<Test>] member this.``Bad Unquote Returning it's own reflection exception`` ()=
                        raises<NotSupportedException> <@ "Should be a NotSupportedException" |> this.RaiseException  @>


What is the expected output? 
the Test passing.

What do you see instead?

Expected NotSupportedException but got TargetInvocationException

"Should be a NotSupportedException" |> UnitTest.FSharp.Tests.Module1+Basic 
Dynamic Operator Tests.RaiseException
System.Reflection.TargetInvocationException: Exception has been thrown by the 
target of an invocation. ---> System.NotSupportedException: Should be a 
NotSupportedException
   at UnitTest.FSharp.Tests.Module1.TestCase Dynamic Operator Tests.RaiseException[a](String message) in C:\Documents and Settings\username\My Documents\Visual Studio 2010\Projects\testproject\UnitTest.FSharp\TestCase.fs:line 30
   --- End of inner exception stack trace ---

Server stack trace: 
   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at <StartupCode$FSharp-Core>.$Reflect.Invoke@617-4.Invoke(T1 inp)

Exception rethrown at [0]: 
   at Swensen.Unquote.Evaluation.eval(FSharpMap`2 env, FSharpExpr expr)
   at Swensen.Unquote.Reduction.reduce(FSharpMap`2 env, FSharpExpr expr)
   at Swensen.Unquote.Reduction.loop@119(FSharpMap`2 env, FSharpExpr expr, FSharpList`1 acc)

What version of the product are you using? On what operating system?

Unquote.2.0.2

Please provide any additional information below.


Original issue reported on code.google.com by tech.ekon.us on 3 Aug 2011 at 2:23

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions