# Yet another dynamic problem

**URL:** https://talk.remobjects.com/t/yet-another-dynamic-problem/6878
**Category:** Oxygene
**Created:** [September 17, 2015, 1:10pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878 "2015-09-17T13:10:46Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [September 17, 2015, 1:10pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/1 "2015-09-17T13:10:46Z")

</div>

We have another problem with our Property Wrapper (see [Internal Error of the Oxygene Compiler](http://talk.remobjects.com/t/internal-error-of-the-oxygene-compiler/6748))

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

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [September 17, 2015, 9:20pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/2 "2015-09-17T21:20:36Z")

</div>

Hrmm. Sounds like our [dynamic code](https://github.com/remobjects/RemObjects.Elements.Dynamic) 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.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [September 17, 2015, 9:20pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/3 "2015-09-17T21:20:41Z")

</div>

Thanks, logged as bugs://73087

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [September 18, 2015, 7:40am UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/4 "2015-09-18T07:40:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [September 21, 2015, 7:08am UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/5 "2015-09-21T07:08:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [September 21, 2015, 9:33am UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/6 "2015-09-21T09:33:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [September 21, 2015, 12:30pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/7 "2015-09-21T12:30:03Z")

</div>

Cool. Glad it’s solved for you.

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [November 10, 2015, 8:15am UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/8 "2015-11-10T08:15:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [November 30, 2015, 2:35pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/9 "2015-11-30T14:35:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ck](https://talk.remobjects.com/user_avatar/talk.remobjects.com/ck/32/8740_2.png) [@ck](https://talk.remobjects.com/u/ck)
#### Post date: [November 30, 2015, 2:48pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/10 "2015-11-30T14:48:52Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [November 30, 2015, 2:59pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/11 "2015-11-30T14:59:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![FredyFerrari](https://talk.remobjects.com/user_avatar/talk.remobjects.com/fredyferrari/32/2038_2.png) [@FredyFerrari](https://talk.remobjects.com/u/FredyFerrari)
#### Post date: [November 30, 2015, 4:47pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/12 "2015-11-30T16:47:12Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![RemObjectsSoftware](https://talk.remobjects.com/user_avatar/talk.remobjects.com/remobjectssoftware/32/15947_2.png) [@RemObjectsSoftware](https://talk.remobjects.com/u/RemObjectsSoftware)
#### Post date: [December 2, 2015, 1:29pm UTC](https://talk.remobjects.com/t/yet-another-dynamic-problem/6878/13 "2015-12-02T13:29:38Z")

</div>

bugs://73087 got closed with status fixed.
