Yet another dynamic problem

We have another problem with our Property Wrapper (see Internal Error of the Oxygene Compiler)

We have a Varying Class which wraps a String and adds most of the VMS Pascal Varying string functionality. This class also contains the following implicit casts:

    public static implicit operator Varying(string str)
    {
        return new Varying(str ?? string.Empty);
    }

    public static implicit operator Varying(char str)
    {
        return new Varying(str);
    }

Then we have the following Wrapper method:

PROCEDURE FKT_Selektion( Sel: Tuple<System.Reflection.PropertyInfo, ToolboxCS.Base.SpezplaStructure>;
Col: Varying;
Val: Varying;
Opc: String := ‘LIKE’ );
begin
var str: Varying := Varying(Sel.Item1.GetValue(Sel.Item2, nil));
FKT_Selektion(var str, Col, Val, Opc);
Sel.Item1.SetValue(Sel.Item2, str, nil);
end;

In the business code there are cases like the following:

DIALOG.DIA_FUNKTIONEN.FKT_Selektion( Op.Var.Selekti, 'ZSTAUS', 
                  'TO_DATE('''+Unendlich+''',''YYYYMMDDhh24miss'')', '=');

But this throws at runtime.

I wrote a little testcase, in C# and Oxygene. It works in C#. But in Oxygene it throws
with the following exception:

Test method ToolboxUnitTestPas.WrapperTest.LTTestTypeDynamicPropertyWrapperTest1 threw exception:

RemObjects.Oxygene.Dynamic.OxygeneBinderException: No overload with these parameters
at CallSite.Target(Closure, CallSite, Type, Object, String, String, Char)
at System.Dynamic.UpdateDelegates.UpdateAndExecute5(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)

Unfortunately, the test cases use quite some of our base classes.
I can try to isolate the problem if you need some test code.

~Ff

Hrmm. Sounds like our dynamic code doesn’t find the overload properly, I’ll log a bug an will take a look. With some luck it only requires changes in the lib referenced above.

Thanks, logged as bugs://73087

Hi ck,

thanx for logging the bug and also for the link of the dynamic code binder! I did not know the binder is under GitHub! I’ll also take a look of the binder code and see if I can come up with a solution.

~Ff

Ok, I did take a look of the lib code and found the problems. But it’s quite a lot of work to make the lib code solve all the situations the Microsoft standard dynamic binder can handle.

I made a local change to the lib code and could fix the problem for our situation. So, the problem is only in the lib code and does not need any further change in the compiler itself.

My change is not a general fix. If I find some time, I’ll make it more general and provide a fix.

Cool. Glad it’s solved for you.

@FredyFerrari did you ever find a change to your liking here?

Sorry Carlo, this is my mistake.
I forgot the issue as I had a local fix which I made to the lib code, but it’s too specific and only fixes one special case. And as I have plenty of work, I forgot it completely.
I don’t know yet how to proceed, as it can’t be the solution to always have an own dynamic lib but for the generic fix I currently have no time.
I’ll discuss it locally first.

Sure. If you can think up a testcase I can try for this I can try to fix the bug in dynamic logic, but just the statements above don’t seem to show the issue for me.

That’s a deal :wink: It should be relatively easy to come up with a test case.

Ok, I “enhanced” the old test case with an example of the problem where the overlay is not found.
I’ll send it in an extra message.

bugs://73087 got closed with status fixed.