ComProxyVar issue: IDE shows comproxy but not internal

Discussion forum about all things Gupta, OpenText and the community.
Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3483
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

ComProxyVar issue: IDE shows comproxy but not internal

Post by Dave Rabelink » 13 Mar 2012, 09:30

I have stumbled upon a very nasty issue concerning instances of type COM Proxy Class.

During conversion of older sources to TD60, I re-generated all ActiveX/COM components using TD60 ActiveX explorer.
Everything is the same: the names of the generated classes and also the methods.

All other sources using the newly created COM apl classes do compile ok.

But on some cases, at runtime the COM instances do not work. Sometimes they do and sometimes the Create function fails (no runtime TD error messages).
They just return FALSE on the Create method.

When checking the source using the IDE, there seems nothing wrong. Even the ACA shows all methods on the ComProxy instances.
When comparing code which is working against the ones not working there is no visual difference between them.
The objects are all of the same class and the usage is 100% equal. But one works at runtime and the other does not.

So then I opened the faulty sourcecode using a text editor to look at the internal items at the place of the faulty and working code.

Here the working code:

Code: Select all

.head 4 +  Local variables
.head 5 -  ComProxyVar: LReportingComponent
.head 6 -  Class: ClsReportingComponent
.head 5 -  Boolean: bTemplateFound
.head 4 +  Actions
.head 5 +  If LReportingComponent.Create(  )
.head 6 -  Call LReportingComponent.IsWordTemplateFound( "c:\\test.dot", bTemplateFound )
.head 6 -  Call LReportingComponent.Release(  )
And here the faulty code:

Code: Select all

.head 4 +  Local variables
.head 5 -  FunctionalVar: LReportingComponent
.head 6 -  Class: ClsReportingComponent
.head 5 -  Boolean: bTemplateFound
.head 4 +  Actions
.head 5 +  If LReportingComponent.Create(  )
.head 6 -  Call LReportingComponent.IsWordTemplateFound( "c:\\test.dot", bTemplateFound )
.head 6 -  Call LReportingComponent.Release(  )
Well there is a difference. First line is ok, the next is faulty:

Code: Select all

.head 5 -  ComProxyVar: LReportingComponent
.head 5 -  FunctionalVar: LReportingComponent
And now the issue is clear.
Internally TD interprets the LReportingComponent variable as a FunctionalVar.
It should be a ComProxyVar.

So, when changing this in the text editor from FunctionalVar to ComProxyVar, the code works at runtime.
The Create succeeds and the methods work ok.

Another way to fix it in the IDE itself:

Go to the defined LReportingComponent variable, comment it and uncomment it. Then save.
By commenting and uncommenting, TD is forced to re-examine the type of the object. It sees it as a ComProxy type and sets this internally.
After saving, the variable has the correct internal type and the code works.

Issue with this is that you can not see in the IDE there is a problem. The variable IS of the correct type there.
But you can not see that TD has a wrong internal type. So you will not be tipped on the issue. Probably you will look into the COM component itself.
Recreating the COM apl does not help, as the instance of the COM Proxy class is incorrect. The COM proxy class itself is ok and works.

So when having many apl's and huge pile of sourcecode utilizing COM Proxy classes, you will not be sure if the code will work at runtime just by examining the code using the IDE.
You will have to look in the internal source using a text editor. This is for me a real issue, because there are hundreds of instances spread over hundreds of functions, class variables,
window variables etc etc. And to find them all, comment them and uncommenting them is a huge effort.

And to be frank, I think when I use the IDE and see that an object is of a specific type the object should really BE of that type.

I have extracted a testcase which can be used to reproduce the issue.
The form has a function with a local variable, an object of the COM Proxy type.
The IDE shows that. But using a text editor you will see it is not.
A fixed apt, there I just commented the variable and uncommented it and saved. The object is then the correct internal type.

I do not know what solution Unify can devise to prevent this. Code not touched will not be re-examined by the IDE.
Maybe during saving the source or at compilation, the types can be re-examined and set to the correct internal type.

Or maybe a new feature in the IDE to force TD to re-examine all code and reset the internals to the correct ones.

At least, I think many stumble upon this issue using COM in conversions. It would really help to fix internal issues when TD offers some kind of
way to reset the internals so you are sure no mismatches are present.
ComProxyInstance_Issue.zip
You do not have the required permissions to view the files attached to this post.
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Dave Rabelink
Founder/Site Admin
Founder/Site Admin
Netherlands
Posts: 3483
Joined: 24 Feb 2017, 09:12
Location: Gouda, The Netherlands

Re: ComProxyVar issue: IDE shows comproxy but not internal

Post by Dave Rabelink » 15 Mar 2012, 14:17

Well, to able able to quickly find any ComProxy instance issues on a huge load of sourcefiles I decided to create a CDK tool
which finds and reports them.
Actually, it has already saved me a lot of precious time doing it manually and indeed, there were issues reported so I could fix them.

I placed info on the issue and also the link to the source of the tool on the WIKI here:

https://wiki.tdcommunity.net/index.ph ... internally

If there are any issues with the tool, please report it to me.

(And Unify hopefully investigates a way to prevent this happening in the first place).
Regards,
Dave Rabelink

Image
Articles and information on Team Developer Tips & Tricks Wiki
Download samples, documents and resources from TD Sample Vault
Videos on TDWiki YouTube Channel

Georg Diczig
Germany
Posts: 175
Joined: 15 Mar 2017, 15:15
Location: Cologne Germany

Re: ComProxyVar issue: IDE shows comproxy but not internal

Post by Georg Diczig » 15 Mar 2012, 16:11

Hello Dave!

I have the same problem!
Thank you for the CDKTool! This save a lot of time!

Best regards!
Georg
Best Regards
Georg Diczig

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests