Home > Software engineering >  Program works in Windows 11 (22000.1098) but not in 22621.525
Program works in Windows 11 (22000.1098) but not in 22621.525

Time:10-20

I run the same binary and it works in the older version of Windows 11 (as well as earlier versions of Windows), but it crashes during start-up on 22621.525. I have looked at the code (C#) and what causes it is setting something to Double.NaN. Setting it to an actual value makes the code work.

The call stack looks very innocent. Main() -> MainForm() -> InitializeComponent() -> MyControl() so it doesn't appear to be any recursion going on.

What changed in the new version?

CodePudding user response:

That is something that happen if you run older code. The problem happens in the FPU and may be caused by older programs or libraries. Thy it appeared in Windows 11 (22621.525) but not in earlier versions may have to do with changes of how Windows works.

Anyway, you can get around the problem by forcing a reset of the PFU by adding

try
{
    throw new Exception("Please ignore, resetting FPU");
}
catch {}

before you call the function that causes the exception. If you need to do it from more than once place it may be a good idea to wrap it into a function.

  • Related