Invoke Exception in Mono

Nov 19, 2009 at 11:45 AM

 

Hello

in my QuantitySystem project

I have a strange exception when evaluating expression in Mono (which I really I don't know if it is related to the DLR or the mono implementation) :(

Exception:

 

MethodAccessException: Method `Qs.Runtime.QsFunction:get_FunctionDelegate_1 ()' is inaccessible from method `(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)'

this happens when I make a call to evaluated function

 

Qs> f(x) = x^2
Qs> f(8)


The corresponding expression from the debug view when evaluating f(8) is:

 

.Invoke (.Constant(f(x) = x^2).FunctionDelegate_1)(.Try {
        .Call Qs.Runtime.QsParameter.MakeParameter(
            .Constant(DimensionlessQuantity: 8 <1>),
            "8")
    } .Catch (System.Exception) {
        .Call Qs.Runtime.QsParameter.MakeParameter(
            null,
            "8")
    })

 

 

 


I am storing the function expression and delegate in a QsFunction object and specify the required delegate (which is called by property) by the parameter numbers (this corresponds to .FunctionDelegate_1, _2, ..., _12  )

 

however If I made a sequence call (which is another conceptual object)

 

Qs> S[x] ..> x^2
Qs> S[8]

 

no error occur and the expression debug of S[8] is 

 

Sequence Call:
.Call (.Call Qs.Runtime.QsSequence.GetSequence(
    .Constant(Microsoft.Scripting.Runtime.Scope),
    "",
    "f%1#0")).GetElementValue(8)

 

 

I figured out that the expression calls are different. 

but I don't know if this is related to Mono or DLR

 

Thank you

Ahmed Sadek

 

QsException: Unhandled

MethodAccessException: Method `Qs.Runtime.QsFunction:get_FunctionDelegate_1 ()' is inaccessible from method `(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)'QsException: Unhandled

 

MethodAccessException: Method `Qs.Runtime.QsFunction:get_FunctionDelegate_1 ()' is inaccessible from method `(wrapper dynamic-method) object:lambda_method (System.Runtime.CompilerServices.Closure)'

 

Nov 19, 2009 at 5:06 PM

What is the visibility of the property Qs.Runtime.QsFunction:FunctionDelegate? Is the getter public? Is QsFunction class public?

Nov 19, 2009 at 6:08 PM

The visibility of the class is public

 

the visibility of the FunctionDelegate Property is private    {But I tested it with public visibility and it was the same error} (in fact it is running under .net framework without errors but not in Mono )

here is a snippet of the code

 

    internal System.Delegate _FunctionDelegate;

        private Func<QsValue> FunctionDelegate_0
        {
            get
            {
                return (Func<QsValue>)_FunctionDelegate;
            }
        }

        private Func<QsParameter, QsValue> FunctionDelegate_1
        {
            get
            {
                return (Func<QsParameter, QsValue>)_FunctionDelegate;
            }
        }