1. Steve Wolf
  2. PowerBuilder
  3. Thursday, 28 March 2019

We just upgraded from 12.5.1 to 2017 R3 and started to encounter an issue with an application we are integrating with using OLE. The old version worked fine, but the new version randomly has given the following error trying to run a function on the OLEObject. No code change has been done between the 2 versions regarding this logic.

 

Incorrect number of parameters calling external object function

 

The function trying to be called works fine in previous calls within the same application session, but then gives this error and the only way to get around the error is to restart the application. I have verified that the parameters are valid via debugging. The OLEObject is created before each attempt (not an instance or global variable). To make it a little more complex the OLEObject function does take in another OLEObject as a parameter, but I have validated that the parameter OLEObject is valid and is set as expected.

This is the specific call being made:
ole_query.ExecuteQuery(lole_filters, ab_indexmode)

 

Has anyone else had an issue like this? What else can I do to troubleshoot as I cannot reproduce the issue myself and there is no pattern to what users are getting it and when.

 

This is an big issue as I cannot finish upgrading all of our apps to the new PowerBuilder version until this is resolved as it would be too inconvenient for users of some apps to have to restart their app potentially multiple times a day! 

Steve Wolf Accepted Answer Pending Moderation
0
Votes
Undo

Chris,

Thank you for the quick response!

I do have it wrapped in a try/catch. I have not tried on catch of this error destroying and re-creating/retrying as my assumption was this was already happening when the user retries upon getting the error. Given that when the user retries I already would have done an lole_query.disconnectobject() and destroy lole_query (along with doing that for any other ole_object created via the logic in question). And then the ole objects are recreated with their second attempt I figured me adding that in code wouldn't help. 

From what I am seeing it isn't until the PowerBuilder application that generates this error is restarted the issue persists so retrying in code most likely won't help.

My next thing to try, though, is trying to intercept the error and see if I can get any more information from it. 

To me it seems like some reference to the GAC/dll being connected to is being corrupted in the PowerBuilder app that is corrected with an app restart.

Comment
There are no comments made yet.
  1. Thursday, 28 March 2019
  2. PowerBuilder
  3. # 1
Chris Pollach Accepted Answer Pending Moderation
0
Votes
Undo

Hi Steve;

  My I suggest:

1) Wrap your OLE code in a TRY..CATCH. If an exception is thrown, close off and destroy the OLE object, issue a YIELD() and then retry the OLE conversation again. I wonder if it goes through on the 2nd or 3rd retry?

2) Use the ExternalException event on the OLE container class to intercept the error. You can then set an ACTION return code to retry the command (again, I would issue a Yield() before that.

  My theory is that this might be related to a threading issue in the external OLE ActiveX control.

HTH

Regards ... Chris

Comment
There are no comments made yet.
  1. Thursday, 28 March 2019
  2. PowerBuilder
  3. # 2
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.