Bug in 2014r2 with ActiveX

I have raised this issue before and didnt get much response but I was wondering if anyone else is seeing issues with R2 and ActiveX controls. The problem is that I keep getting an exception being thrown when I call an activex method. I have tested this with a number of activex controls and they all do the same thing and produce an error on the same line of code. The line of code that causes the error is not mine but appears to be the wrapper that Xojo is generating to call the ActiveX method. The line is as follows:

If mThis = Nil Then Raise New NilObjectException

If you comment out the line of code then Xojo hard crashes. Exactly the same program works perfectly in r1.0 and r1.1. It can be reproduced using the Clickatell Com API and the Chilkat_v9_5_0 suite.

Does anyone have any ideas how I can resolve this as it is stopping me using r2 with some of my apps.

Also if you have apps created prior to r2 and you try to delete an activex that it in the IDE then Xojo hangs with 100% CPU. If you go back to r1.0 and r1.1 you can delete the activex no problem.

Recently I found a big bug with parameter passing. Maybe that is also your problem?

see feedback case 34221.

when you add an ActiveX control and functions there take variant byval, it will still generate code for byref passing and that causes crashes.

Yes that looks very much like what I am seeing.

Does it work if you manually change the byref to byval or does Xojo overwrite the changes?

Actually having looked at it again it is not the same bug. The auto generated methods have parameters of type string and return a string. I have also checked the code line by line between r1.1 and r2 and the code is exactly the same. It would appear that in r2 the mThis = Nil therefore throwing the exception whereas in r1.1 it cant be Nil because the exception does not get thrown. This must be a bug but I am a bit stuck trying to create a standalone project because I would have to include a third party activex with codes in etc.

Does anyone have any ideas how I can force mThis to contain what it should contain rather than Nil? I cant even find any documentation on what mThis is.

well, maybe the object is not initialized?

Ok I have tracked down the bug. If you put a break in before the check for mThis and you look at the self.mThis for the ActiveX object, in r1.1 it has a valid hex number where in r2 it has a value of &h00000 thus causing the app to raise the exception. I have pasted below two sceenshots where you can see that the mThis and other things are not set in r2 but are in r1.1.

Ok dont know why the images didnt display so here are the links to the images instead.

R1.1 Screenshot

R2 Screenshot

I have logged this into Feedback as something is wrong and for me this is a total show stopper and causing me a problem because I need to use some of the fixes in r2 but also need the activex to work.


I have the exact same problem with Xojo 2016 Release 2
Did this ever got solved?