DBFCDX DBServer:SetOrder() fails

This forum is meant for questions and discussions about the X# language and tools
Jamal
Posts: 314
Joined: Mon Jul 03, 2017 7:02 pm

DBFCDX DBServer:SetOrder() fails

Post by Jamal »

Hi Dev Team!

The following works in VO 2.8 (2838) and fails in X# 2.5b.

The oServer:SetOrder("XNMEB01") returns True, but in X# returns False and thus the CDX file is not updated.
I even removed all index tags and created only one and it still fails. In VO works all the time with one or indexes.

What could be the issue or is it a bug?

I attached a zip file with an empty DBF and CDX.

Code: Select all

method SetOrderTest() as void
            LOCAL ok as logic
            local oServer AS DbServer
            
            oServer := DbServer{"C:TestXNMEA01.dbf", true, false, "DBFCDX"}
            
            if oServer:Used      // this is OK         
                
                ok := oServer:SetOrder("XNMEB01")  // return false in X#
                
                if ok                                       
                    oServer:Append()
                    oServer:FIELDPUT("UNIT_ID", "123456")
                    oServer:Commit()
                endif 
                oServer:Close() 
                
            endif

            return
Jamal
Attachments
XNMEA01.zip
(822 Bytes) Downloaded 23 times
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBFCDX DBServer:SetOrder() fails

Post by Chris »

Hi Jamal,

Looks to be working fine here. Which X# build are you using?
Also can you please create a small but full sample reproducing this? Maybe there's something else in the program that causes this as a side effect.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
Jamal
Posts: 314
Joined: Mon Jul 03, 2017 7:02 pm

DBFCDX DBServer:SetOrder() fails

Post by Jamal »

Hi Chris,

Thanks for the reply. For some reason now, I don't have an issue locally, however, since I am deploying the app on an Amazon EC2 instance with Windows Server 2019, it fails.

Will investigate further, may be it is a Windows permission issue.

Jamal
Jamal
Posts: 314
Joined: Mon Jul 03, 2017 7:02 pm

DBFCDX DBServer:SetOrder() fails

Post by Jamal »

Hi Chis,

I still have the same issue. I tried several DBF files, and regardless how small and simple they are the SetOrder() fails.
The same files as indicated in my other open fine in VO apps and other DBF utilities and can see I see orders and switch among them.The DLL version of all references I report 2.1.0.0 even though the I am using X# 2.5b.

The attached zip file includes a VO terminal app, X# Project, Screenshots and DBF files.

If works one time try again;

Thanks for looking into this issue.
Jamal
Attachments
DBFCDX_SetOrder_ConsoleApplication.zip
(329.25 KiB) Downloaded 20 times
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

DBFCDX DBServer:SetOrder() fails

Post by Chris »

Hi Jamal,

Thanks for the sample! I tried it a lot of times, but it always succeeds here...

Can you please enable trapping of all _handled_ exceptions and run again, do you get an error message about a handled exception before the set order fails?

Also, just in (the unlikely) case it makes a diffrence, can you also try targeting a .Net framework version smaller than 4.8, like 4.7 or 4.6?
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

DBFCDX DBServer:SetOrder() fails

Post by wriedmann »

Hi Jamal, hi Chris,
SetOrder() also fails if the macrocompiler cannot be loaded.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 314
Joined: Mon Jul 03, 2017 7:02 pm

DBFCDX DBServer:SetOrder() fails

Post by Jamal »

Hi Chris, Wolfgang,

There were no exceptions and changing the Framework version did not make a difference.
However, I changed another app's to use the VO dialect from Core, and the test app which uses the Core dialect started working!
So, that led Wolfgang note about the MacroCompiler and may it stayed in memory! I reinstalled X# and made sure the GAC option is clicked, and added a reference the XSharp.Macrocompiler.DLL from the XSharp Dist folder; and now it works fine on another machine!
Let's hop this is the reason.

Thanks!
Jamal
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

DBFCDX DBServer:SetOrder() fails

Post by wriedmann »

Hi Jamal,
maybe there could be another solution: when your main app is a Core dialect app, try to load the runtime manually.
Unfortunately I'm not able to find the correct code pieces, but maybe Chris can help.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Jamal
Posts: 314
Joined: Mon Jul 03, 2017 7:02 pm

DBFCDX DBServer:SetOrder() fails

Post by Jamal »

Hi Wolfgang,

I think you mean this:

Code: Select all

System.Reflection.Assembly.Load("XSharp.Macrocompiler.DLL");
Of course, the DLL must be in the EXE work directory.

Jamal
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

DBFCDX DBServer:SetOrder() fails

Post by wriedmann »

Hi Jamal,
no, I don't meant this.
Unfortunately I cannot find any reference of it. It is the X# mechanism like the VulcanLoader class in Vulcan..
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply