Comments (29)
It seems to be a problem of the bServer/bBrowser , I close the issue.
from xsharppublic.
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.
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.
Christian thanks, but can you also provide the dbf so we can reproduce the problem here?
from xsharppublic.
Chris, her are the dbf file. Daten.zip
from xsharppublic.
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.
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.
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.
Christian, what value does VO return in this case?
from xsharppublic.
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.
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.
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.
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.
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.
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.
from xsharppublic.
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.
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.
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.
Christian, OK, please give Robert a few days to look into this
from xsharppublic.
I have committed a change for this. Chris can you build the DLL and send it to Christian?
from xsharppublic.
Yes of course, Christian please try again with this one:
from xsharppublic.
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.
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.
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.
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.
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)
- Transform() runtime error with PTR argument HOT 2
- String functions with PSZ argument throw runtime error HOT 7
- error MSB4181 when building with "Enable named arguments" HOT 10
- VS : Project setting "enable named arguments" checkbox does not reflect xsproj HOT 2
- INSTANCE field inconsistency with and without SELF HOT 1
- VOXPorter problem with unterminated block comment in textblock
- Problem with OrdKeyVal() and ADS/ADT HOT 1
- Harbour dialect missing commands HOT 2
- Harbour dialect FIELD statement not supported HOT 5
- Duplicate DEFINEs and functions in the runtime, SDK and RP2
- VO incompatibility with longer order names HOT 5
- Out of process Winforms designer in VS2022 17.9.2 is not working HOT 1
- SetColor() function does not allow omitting argument
- Output in Debugger of Action "CALLSTACK" does not show line numbers HOT 5
- Code generator for types in external assemblies does not generate parameters for Indexed properties HOT 1
- Use of reserved word in x#/core HOT 4
- Macro compiler problem passing more than 2 arguments by reference HOT 2
- Compatibility problem (?) creating dbf with DBFNTX driver HOT 2
- RP3 Invalid operation exception when printing from the preview window HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xsharppublic.