XS0726 while cheking the detail of an exception

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
baramuse
Posts: 98
Joined: Tue Nov 29, 2022 8:31 am
Location: France

XS0726 while cheking the detail of an exception

Post 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.
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: XS0726 while cheking the detail of an exception

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply