Giter VIP home page Giter VIP logo

Comments (29)

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

It seems to be a problem of the bServer/bBrowser , I close the issue.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, can you reproduce the problem with a bServer alone (without GUI/bBrowser)? If yes, please send a repro sample, could very well be an rdd problem.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, after a longer debugging session from bbrower, bserver and x# RT I can reproduce the problem in a small consol app.

I was able to reduce the problem to the DBServer.

#########################
USING System.IO
USING System.Collections.Generic
USING VO
USING System.Timers
USING System.Diagnostics
USING XSharp.RDD
USING VOSystemClasses

FUNCTION Start() AS VOID STRICT
? "Hello Error 5041 Demo! Today is ",Today()
LOCAL oFSDemo AS FileSpec
LOCAL odbDemo AS DbServer
//you can use any table
oFSDemo := FileSpec{"\myserver\data\waehrung.DBF"}
odbDemo := DbServer{oFSDemo, DBSHARED, DBREADWRITE, "AXDBFCDX"}
//without this codeline an there is no exception
odbDemo:SetFilter(,"KENNZ = ""I""")
//appent row to the filtered server
odbDemo:Append(FALSE)
VAR nRecNo := odbDemo:RecNo
//this line of code thrown the exception
VAR nOrderKeyNo := odbDemo:OrderKeyNo()

?nRecNo
?nOrderKeyNo

odbDemo:Close()
wait
RETURN

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian thanks, but can you also provide the dbf so we can reproduce the problem here?

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, her are the dbf file. Daten.zip

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Thanks Christian, I did some further investigation, and the problem is related to the ADS driver only and depends on the (non) existence of specific records.

Robert, here's a small self-contained sample reproducing the problem. DbOrderInfo( DBOI_POSITION ) returns NIL, and there's a handled exception in it, see below:

FUNCTION Start() AS VOID STRICT
LOCAL cDbf AS STRING

cDbf := "c:\Test\ordkeyno"

RddSetDefault("AXDBFCDX")
AdsSetServerType(1)

FErase(cDbf + ".cdx")
DbCreate(cDbf, {{"KENNZ","C",3,0}})
DbUseArea(,,cDbf)
FOR LOCAL n := 1 AS INT UPTO 5
	DbAppend()
//	FieldPut(1,AsString((n * 7) % 900 + 100))
	FieldPut(1,AsString(n))
NEXT
DbCreateIndex(cDbf, "KENNZ")
DbCloseArea()


DbUseArea(TRUE,,cDbf)
//without this codeline an there is no exception
? DbSetFilter(,"KENNZ = '1'")
DbGoTop()
DbAppend()
FieldPut(1,"234")

? DbOrderInfo( DBOI_POSITION ) // NIL, handled exception

DbCloseArea()

Handled exception inside DbOrderInfo()

XSharp.ADS.AdsError
Error 5041:  The requested object was not found.  Key not found.

Callstack : 
Boolean XSharp.ADS.ADSIndex._CheckError(System.UInt32 nResult, System.UInt32 gencode)() 
Object XSharp.ADS.ADSIndex.OrderInfo(System.UInt32 nOrdinal, XSharp.RDD.Support.DbOrderInfo info)() 
Object XSharp.RDD.Workarea.OrderInfo(System.UInt32 nOrdinal, XSharp.RDD.Support.DbOrderInfo info)() 
XSharp.CoreDb+<>c__DisplayClass71_0.Boolean XSharp.CoreDb+<>c__DisplayClass71_0.<OrderInfo>b__0()() 
static Object XSharp.CoreDb.Do(System.Func`1[System.Object] action)() 
static Boolean XSharp.CoreDb.OrderInfo(System.UInt32 nOrdinal, System.String cBagName, System.Object oOrder, System.Object oValue)() 
static Boolean XSharp.VoDb.OrderInfo(System.UInt32 nOrdinal, System.String cBagName, System.Object uOrder, XSharp.__Usual oValue)() 
static __Usual XSharp.RT.Functions.DbOrderInfo(XSharp.__Usual[] Xs$Args)() 
static System.Void xRuntime.Exe.Functions.Start()()   :  C:\VIDE\Projects\Project3\Applications\xRuntime\Prg\xRntime.prg  :  28

from xsharppublic.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

The error only occurs when the setting Ax_SetExactKeyPos() is TRUE. This happens because the current record does not match the filter criterium.
If you issue Ax_SetExactKeyPos(FALSE) before calling DbOrderInfo( DBOI_POSITION ) then there is no error.
I can change the RDD code to do this automatically (silently) when the function AdsGetKeyNum() returns the error code 5041. Is that a good idea?
The ADS RDD for Vulcan generates the same error.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Robert, it is probably better to switch silently than to trigger an error because VO does not trigger an error at this point and probably some programs rely on the fact that there is no error.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, what value does VO return in this case?

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, unfortunately I can't answer your question because in our application the error only occurs indirectly through the bBrowser when it executes a refresh and OrderKeyNo() is called in the course of this. Unfortunately, I can't debug this enough in VO to be able to say exactly what happens there.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, can you please try with your small test sample? (in VO I mean) Just to make sure we are 100% compatible now.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Hi Chris, with filter DbOrderInfo returns NIL.

VO example:
FUNCTION Start(p)
LOCAL oCon as Console
local r as usual
LOCAL cDbf as STRING

cDbf := "\\server\data\ordkeyno"
oCon := Console{}

RddSetDefault ("AXDBFCDX")
AdsSetServerType(1)

FErase(cDbf + ".cdx")
DBCREATE(cDbf, {{"KENNZ","C",3,0}})
DBUSEAREA(,,cDbf)

DBAPPEND()
FIELDPUT(1,"1")
DBAPPEND()
FIELDPUT(1,"2")
DBAPPEND()
FIELDPUT(1,"3")
DBAPPEND()
FIELDPUT(1,"4")
DBAPPEND()
FIELDPUT(1,"5")	
DBAPPEND()
FIELDPUT(1,"6")	

DBCREATEINDEX(cDbf, "KENNZ")
DBCLOSEAREA()


DBUSEAREA(true,,cDbf)
DbSetFilter(,"KENNZ = '1'")
DbGotop()
DBAPPEND()
FIELDPUT(1,"777")

//with filter DbOrderInfo returns NIL, without filter DbOrderInfo returns 7
r:= DbOrderInfo( DBOI_POSITION )

DBCLOSEAREA()

RETURN nil

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Thanks Christian, now with Robert's fix, with either the filter set or not, order info in X# returns always 7. Not sure if this should be consisdered a problem (VO incompatibility) or not, considering that VO returns NIL with the filter.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, the 7 would be the right value in any case, yes the new behavior can lead to compatibility problems, if you have a fix for me I could test that at least for our context.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, please try this new dll, you need to put it in the GAC at C:\Windows\Microsoft.NET\assembly\GAC_MSIL\XSharp.Rdd\v4.0_2.6.0.0__ed555a0467764586. I think there are no dependencies on any other changes we made since the last X# release, but in case something doesn't work ok, I will send you a complete new set of runtime dlls.

XSharp.Rdd.zip

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, unfortunately it behaves differently to the old Vo application, could you create an XSharp.Rdd.dll for me that returns NIL like VO and not the actual correct value. I would also like to run a test with it.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, are you sure the problem comes from this return value, does your code indeed depends on the return value of NIL, or could it be some other issue?
Will need to wait a little for Robert (who is offline this week) to adjust the RDD to return NIL in such cases, as I am not familiar with that code.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, I'm not sure because we are using the bBrowser and bServer here and the exception is passed through from there, a DLL with the return NIL would be the easiest way for me to test this.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Christian, OK, please give Robert a few days to look into this

from xsharppublic.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

I have committed a change for this. Chris can you build the DLL and send it to Christian?

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Yes of course, Christian please try again with this one:

XSharp.Rdd.zip

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Chris, the new version of the DLL behaves like the version that returns the correct value. I would prefer the correct value to the NIL returned for compatibility reasons.

from xsharppublic.

RobertvanderHulst avatar RobertvanderHulst commented on July 21, 2024

Christian,
To be compatible with VO we should return NIL. I am not sure why you say:

I would prefer the correct value to the NIL returned for compatibility reasons.

from xsharppublic.

christianschmid200272 avatar christianschmid200272 commented on July 21, 2024

Robert,
I just wanted to say that our application behaves the same with both variants, which is why NIL is absolutely ok as a return value.
Compatibility is of course very important and the decision is up to you, my experience with VO and X# is certainly not sufficient here.

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Robert, my mistake, I uploaded the new dll without testing it first, but now that I did, I see that the return value is 0, not NIL, maybe this is why it hasn't fixed the root problem (I understood that right Christian, is that correct?)

from xsharppublic.

cpyrgas avatar cpyrgas commented on July 21, 2024

Ah, no, it does return NIL now, but not in this case below, where it returns 0 when at Eof (no record matching the filter). Christian, does this also return NIL in VO? And did I understand correctly that the problem in your app still remains?

FUNCTION Start() AS VOID STRICT
LOCAL cDbf AS STRING

cDbf := "c:\Test\ordkeyno"

RddSetDefault("AXDBFCDX")
AdsSetServerType(1)

FErase(cDbf + ".cdx")
DbCreate(cDbf, {{"KENNZ","C",3,0}})
DbUseArea(,,cDbf)
DbCreateIndex(cDbf, "KENNZ")
DbCloseArea()

DbUseArea(TRUE,,cDbf)
? DbSetFilter(,"KENNZ = '1'")
DbGoTop()
? DbAppend()
FieldPut(1,"234")
DbGoTop()
? Eof() // true

? DbOrderInfo( DBOI_RECNO  ) // 0, should be NIL?

DbCloseArea()

from xsharppublic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.