xsharp.eu • WCError details
Page 1 of 1

WCError details

Posted: Wed Nov 29, 2023 3:43 pm
by baramuse
Hi all,

we're in the debugging phase of our ported VO application so we're hitting a few sneaky bugs.
So I'm trying to understand how to get a maximum of information when a crash occurs.
for example our last culprit :

Code: Select all

oDCFTRecherche := FixedText{SELF,ResourceID{RECHERCHE_DIALOG_FTRECHERCHE,_GetInst()}}
crashes with an Exception of type 'VO.WCError' was thrown.
But that's it.
I do have the stacktrace

Code: Select all

Description :	Invalid argument type.
Subsystem :	GUI Classes
GenCode :	EG_UNKNOWN Unknown GenCode
FuncSym :	CONTROL:INIT
Severity :	ES_ERROR
Can Default :	True
Can Retry :	False
Can Substitute :	False
Tries :	1
Stack Trace :	
 CONTROL:.CTOR (Line: 0)
 TEXTCONTROL:.CTOR (Line: 0)
 FIXEDTEXT:.CTOR (Line: 0)
 RECHERCHE_DIALOG:.CTOR (Line: 225)
 RECHERCHEART:.CTOR (Line: 638)
 LOCFORMDET:RECHERCHEARTICLE (Line: 14605)
 LOCFORM:RECHERCHEARTICLE (Line: 6293)
 RUNTIMEMETHODHANDLE:INVOKEMETHOD (Line: 0)
 RUNTIMEMETHODINFO:UNSAFEINVOKEINTERNAL (Line: 0)
 RUNTIMEMETHODINFO:INVOKE (Line: 0)
 OOPHELPERS:SENDHELPER (Line: 0)
 OOPHELPERS:SENDHELPER (Line: 0)
 OOPHELPERS:DOSEND (Line: 0)
 SEND (Line: 0)
 WINDOW:__COMMANDFROMEVENT (Line: 0)
 WINDOW:__PREMENUCOMMAND (Line: 0)
 WINDOW:DISPATCH (Line: 0)
 APPWINDOW:DISPATCH (Line: 0)
 DATAWINDOW:DISPATCH (Line: 0)
 PDATAWINDOW:DISPATCH (Line: 1081)
 LOCFACFORM:DISPATCH (Line: 635)
 LOCFORM:DISPATCH (Line: 2757)
 __DOCAPP:DISPATCH (Line: 0)
 __WCDOCAPPWNDPROC (Line: 0)
 CALLWINDOWPROC (Line: 0)
 __WCCONTROLPROC (Line: 0)
 DISPATCHMESSAGE (Line: 0)
 APP:EXEC (Line: 0)
 XAPP:START (Line: 389)
 START (Line: 64)
So it's in the constructor but I don't really know where.
Is there a way to get more information as the sources are public, the pdb and debug dll are available ?

So I dug a bit more and as its an argument type error it should be around there :

Code: Select all

IF IsObject(oOwner)
		oParent := oOwner
	ELSEIF IsPtr(oOwner)
		oParent := __ForeignWindow{oOwner}
	ELSE
		WCError{#Init,#Control,__WCSTypeError,oOwner,1}:Throw()
	ENDIF

	(...)

	IF IsLong(xID)
		IF IsString(oPoint) .AND. IsNil(oDimension)
			xID := ResourceID{ xID }
		ENDIF
	ELSE
		if !(xID is ResourceID)
			WCError{#Init,#Control,__WCSTypeError,xID,2}:Throw()
		ENDIF
	ENDIF
I can see the WCError contains the name of the argument and the position.
Why don't I have this information in the Exception then ?

Best regards.

Re: WCError details

Posted: Wed Nov 29, 2023 4:38 pm
by robert
Basile,
The Debug sub folder in the XSharp folder contains the runtime DLLs compiler with line number info.
If you copy these to the app folder and remove the files from the GAC (for example by changing the extension) then your app will run with these DLLs and will give you line numbers for the errors.
The Arg and Argnum properties of the error object should contain the value and position of the argument that is incorrect.

Robert

Re: WCError details

Posted: Wed Nov 29, 2023 6:08 pm
by Chris
Basile,

Is this the first control that is initialized in the constructor? If yes, I suspect it's nothing specific to it, and if you comment that line, then the error will happen on the next control. If that's the case, then most probably something has gone wrong with the resource for the window. Please try doing a dummy change to it in the window editor and run again, maybe that fixes the problem?

Re: WCError details

Posted: Thu Nov 30, 2023 10:05 am
by baramuse
robert wrote: Wed Nov 29, 2023 4:38 pm Basile,
The Debug sub folder in the XSharp folder contains the runtime DLLs compiler with line number info.
If you copy these to the app folder and remove the files from the GAC (for example by changing the extension) then your app will run with these DLLs and will give you line numbers for the errors.
The Arg and Argnum properties of the error object should contain the value and position of the argument that is incorrect.

Robert
Hi Robert,
So I did replace all the dll with the debug+symbols ones:

Code: Select all

(...)
(CLR v4.0.30319: ): Loaded '-\bin\Debug\XSharp.Core.dll'. Symbols loaded.
(CLR v4.0.30319: ): Loaded '-\bin\Debug\VOGUIClasses.dll'. Symbols loaded.
(...)
I do have the line numbers now:

Code: Select all

Description :	Invalid argument type.
Subsystem :	GUI Classes
GenCode :	EG_UNKNOWN Unknown GenCode
FuncSym :	CONTROL:INIT
Severity :	ES_ERROR
Can Default :	True
Can Retry :	False
Can Substitute :	False
Tries :	1
Stack Trace :	
 WCERROR:.CTOR (Line: 9)
 CONTROL:.CTOR (Line: 1319)
 TEXTCONTROL:.CTOR (Line: 438)
 FIXEDTEXT:.CTOR (Line: 184)
 RECHERCHE_DIALOG:.CTOR (Line: 225)
 RECHERCHEART:.CTOR (Line: 638)
 LOCFORMDET:RECHERCHEARTICLE (Line: 14605)
which actually helps because now I know where in the constructor it actually throws :

Code: Select all

Line 1329:		WCError{#Init,#Control,__WCSTypeError}:Throw()
So that's normal that I don't have Arg and Argnum parameters in the exception !

Now I have to figure out why it goes there ! :)


As the source is available as well, is there a way fo VS to break all the way down to the source code ?
If not, can I, at least, set the exception manager to break on Xsharp exceptions ? (like VO.WCError, or say, XSharp.RDD.CDX.CdxLockException - this on I have a lot in the output window..)

Regards !

Re: WCError details

Posted: Thu Nov 30, 2023 10:12 am
by baramuse
Chris wrote: Wed Nov 29, 2023 6:08 pm Basile,

Is this the first control that is initialized in the constructor? If yes, I suspect it's nothing specific to it, and if you comment that line, then the error will happen on the next control. If that's the case, then most probably something has gone wrong with the resource for the window. Please try doing a dummy change to it in the window editor and run again, maybe that fixes the problem?
Hi Chris !

it's the first control indeed, I commented it out and it did crash on the next one.
So I made a dummy change, and after saving, I could see my constructor updated/regenerated, but still same crash.
Now I know where it crashes in the control constructor (se my answer to Robert) I'll investigate what we're doing wrong :)

Regards !

Re: WCError details

Posted: Thu Nov 30, 2023 4:51 pm
by Chris
Hi Basile,

Is this the only window that has this problem, while others open fine? Maybe there's something very specific about it? Please open the relevant .rc file (under the same .prg node), is there anything in it that doesn't look right?