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
Posts: 87
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

Also, I don't know why it's not catched by the global app exception handler:

Code: Select all

		oXApp := XApp{}
	CATCH oException AS Exception
I do have the exception reporting in Sentry though :?:

Any clues?

User avatar
Posts: 4352
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Re: XS0726 while cheking the detail of an exception

Post by robert »


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.

XSharp Development Team
The Netherlands
Post Reply