Exceptions in App:Exec() in a project newly updated to 2.8

This forum is meant for questions and discussions about the X# language and tools
KarlW
Posts: 11
Joined: Tue Jul 21, 2020 9:42 am

Exceptions in App:Exec() in a project newly updated to 2.8

Post by KarlW »

Hello All

I think this could be my first post on the forum after lurking for some time so please be gentle with me.

I'm working with an application that was migrated from VO to X# 2.7 last year and behaved as expected, however after now moving to 2.8 we are encountering an issue.

Just a bit of background on the application and our environment. We use Visual Studio 2019 (the improvements to the integration are greatly appreciated, well done guys) and the application uses XS2Ado (thank you Robert for the new version) and also bBrowser. It's not a large project but is being used as a test bed for migrating a much larger project hopefully in the not so distant future.

So whats the problem?

Since moving to 2.8 we are having an issue with the App:Exec() throwing exceptions. App is sub-classed as XApp and everything appears to behave initially. We get our main shell window displayed, a login form which functions as expected but as soon as we call SELF:Exec in our XApp:Start we get an exception.

No exported method 'ACTIVE'

The stack trace we see in VS is

OOPHELPERS:DOSEND (Line: 0)
__INTERNALSEND (Line: 0)
APP:EXEC (Line: 0)
XAPP:START (Line: 120)
START (Line: 13)

Line 120 of our XApp:Start is just SELF:Exec()
I did try adding the EXECNORMAL at one point but we still get the same result.

I can't spot anything in our code that refers to 'ACTIVE' as a method but have noticed something a little strange in the project itself. Although the references to the various dll's go back to the XSharpAssemblies folder and the files are being copied to our build folders the Version of the files in the VS Reference Properties doesn't seem to be the same as the actual file details. For example XSharp.Core.dll is showing 2.6.0.0 in VS but 2.8.0.11 for the file itself. I don't know why or how this discrepancy could appear or if it's anything to do with the issue but thought I'd mention it.

I'm struggling to get past this at the moment and any help or ideas are greatly appreciated.

Thanks

Karl
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Exceptions in App:Exec() in a project newly updated to 2.8

Post by robert »

Karl,
Are you passing any objects to ApplicationExec() in your code ?
App:Exec() accepts a object as 2nd parameter and when you send in that object then it expects that the object has an Active() method.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Exceptions in App:Exec() in a project newly updated to 2.8

Post by Chris »

Hi Karl,

This call to method Active() is done from within the Exec() method itself, it is called on the object you pass it as the 2nd parameter. So how are you calling the App:Exec() exactly, what is the 2nd param you use on it?

About the X# rutnime references, this is normal, the runtime dlls have the proper file version that matches the current build number, but their product version is frozen to 2.6, in order to avoid requiring to rebuild all 3rd party products for use with newer X# versions. The product version of the runtime dlls wil be updated when it will become necessar to make some breaking change, which will require a 3rd part rebuild anyway.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
KarlW
Posts: 11
Joined: Tue Jul 21, 2020 9:42 am

Exceptions in App:Exec() in a project newly updated to 2.8

Post by KarlW »

Hi Robert

No we don't.

However just as an experiment I've just tried it with a null_object

SELF:Exec(EXECNORMAL, null_object)

At that seems to get us past this.

Thanks

Karl
KarlW
Posts: 11
Joined: Tue Jul 21, 2020 9:42 am

Exceptions in App:Exec() in a project newly updated to 2.8

Post by KarlW »

Thanks Chris

No we'd never passed any parameters in the Exec() method in VO or when we'd previously been on X# 2.7 with this application.

Will passing a null_object in (as I mentioned in my reply to Robert) cause any issues? Although the documentation shows the two parameters I couldn't tell what the second parameter was actually for.

Thanks for the information on the references

Karl
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Exceptions in App:Exec() in a project newly updated to 2.8

Post by Chris »

Hi Karl,

Can you please try again without the second parameter, does it still cause the error this way? Could it be that there was a typo in the original code, for example something like that

SELF:Exec(,EXECNORMAL)

or something similar? Those are the first few lines of the App:Exec() method:

Code: Select all

METHOD Exec(kExecType, oObject)
	LOCAL lObject AS LOGIC
	Default(@kExecType, EXECNORMAL)
	lObject := !IsNil(oObject)
	DO WHILE !lObject .OR. oObject:Active()
	....
This is the only place where this 2nd "oObject" parameter is used and this part of the code has not been changed in at least the last 12 months, so it is very surprising if it causes this error without using a 2nd argument at all.

About if using the NULL_OBJECT param would potentially cause any issues, no it can't, because the IsNil() in the code above will return FALSE and so Acive() will never be called. But it should not be needed to use this param either. There must be a simple explanation, but this currently looks very strange..
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Exceptions in App:Exec() in a project newly updated to 2.8

Post by robert »

Chris,
We should probably change the code to

lObject := IsObject(oObject) .and. IsMethod(oObject, #Active)

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
KarlW
Posts: 11
Joined: Tue Jul 21, 2020 9:42 am

Exceptions in App:Exec() in a project newly updated to 2.8

Post by KarlW »

Hi Chris

Having given a few things a try

The original code was

SELF:Exec()

this did and still causes the exception

I initially tried supplying the first parameter

SELF:Exec(EXECNORMAL)

Again this still causes the exception

The typo as per your suggestion does cause the exception, but I can definitely say the original code was as per above.

The only way that behaves is

SELF:Exec(EXECNORMAL, null_object)

Thanks

Karl
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Exceptions in App:Exec() in a project newly updated to 2.8

Post by Chris »

Robert, yeah I agree that would be best! Btw, I checked the SDK, only class that implements Active() is the DialogWindow class.

Karl, any chance you can send us the source of this project, or maybe at least a smaller sample reproducing the error? Really curious to find out what might be causing this...
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
KarlW
Posts: 11
Joined: Tue Jul 21, 2020 9:42 am

Exceptions in App:Exec() in a project newly updated to 2.8

Post by KarlW »

Hi Chris

I'll certainly try to get something for you. It might take me a few days as I'll have to fit this in between other jobs.

Is that OK for you?

Thanks

Karl
Post Reply