xsharp.eu • XS0726 while cheking the detail of an exception
Page 1 of 1

XS0726 while cheking the detail of an exception

Posted: Mon Nov 06, 2023 12:15 pm
by baramuse
Hi all,

I'm getting an exception - that I still don't fully understand - and when I want to open the details, I got an XS0726
Screenshot 2023-11-06 at 13.10.50.png
I don't know which Arithmetic operation resuslts in an overflow.
If I evaluate in the immediat window, it seems fine :

Code: Select all

nCode == -DTN_DATETIMECHANGE  .AND. ! SELF:ReadOnly
FALSE
Also, I don't know why it's not catched by the global app exception handler:

Code: Select all

	TRY
		Sentry.SentrySdk.Init(sentryOptions)
		oXApp := XApp{}
		oXApp:Start()
	CATCH oException AS Exception
		Sentry.SentrySdk.CaptureException(oException)
		ErrorDialog(oException)
	END TRY
I do have the exception reporting in Sentry though :?:

Any clues?

Regards.

Re: XS0726 while cheking the detail of an exception

Posted: Mon Nov 06, 2023 12:53 pm
by robert
Basile,

The numbers from these defines are "strange". They come from the windows SDK (the file commctrl.h).

DEFINE DTN_DATETIMECHANGE := (DTN_FIRST + 1) // the systemtime has changed
DEFINE DTN_FIRST := (0U-760U) // datetimepick

This gets compiled into (C# syntax)

public const uint DTN_FIRST = 4294966536u;
public const uint DTN_DATETIMECHANGE = 4294966537u;


In your code, you are comparing nCode (a DWORD) with - DTN_DATETIMECHANGE.
So you're comparing a DWORD with a negative DWORD. That will never be true, except when both values are 0.
To solve this the compiler probably converts both numbers to a LONG and the conversion of DTN_DATETIMECHANGE to LONG results in an overflow since its value exceeds Int32.MaxValue

Most likely this works in the immediate window because that windows uses different compiler options than your app with regard to overflow checking.

The XS0726 error is probably the result of an issue in the expression evaluator, where we are incorrectly interpreting a DebuggerDisplay attribute.

Finally: you can tell VS to stop on Exceptions when they are thrown, so even when there is an exception handler, then you will still see the error.
Most like that is what you told VS to do.

Robert