0

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?

Dharman
  • 30,962
  • 25
  • 85
  • 135
liftarn
  • 429
  • 3
  • 21
  • If you have the code, can you run it with a debugger to find out what the specific error is? – Scott Hunter Oct 17 '22 at 12:42
  • If you think you found the problem try tracing this value back to where it is coming from. Problems like these are usually caused by differences in configuration (i.e. different/missing libraries, differences in registry, system settings or files etc.) It is extremely unlinkely that your problem is actually related to version of Windows. – jurez Oct 17 '22 at 12:44
  • @ScottHunter No, it works in debug mode. I have zoomed in on the line of code, but it appears to just set a value. – liftarn Oct 17 '22 at 12:47
  • @jurez It appeared after updating the Windows version with no other known changes. – liftarn Oct 17 '22 at 12:49
  • @liftarn What is this program supposed to do? And how does the error show? – jurez Oct 17 '22 at 12:51
  • @jurez It's the client part of a test equipment so it does a lot of things, but it's not really relevant. If I run it standalone it just starts-up, shows the splash windows and the vanishes. If I run it in debugger I get a StackOverFlowException. I have the code at https://stackoverflow.com/questions/74096202/double-nan-causing-system-stackoverflowexception-in-windows-11-22621-525 – liftarn Oct 17 '22 at 12:54
  • So shouldn't you address the StackOverFlowException? – Scott Hunter Oct 17 '22 at 12:57
  • @liftarn StackOverflowException is a common symptom of infinite recursion. Dump the stack and post it here, pay special attention to any part of the stack that repeats itself. – jurez Oct 17 '22 at 12:59
  • @jurez It looks very innocent. Main() -> MainForm() -> InitializeComponent() -> MyControl() – liftarn Oct 17 '22 at 13:01

1 Answers1

0

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.

liftarn
  • 429
  • 3
  • 21