New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GameWindow throws StackOverflowException #1494
Comments
Can you post your code? "Near identical" is not identical and the difference is likely causing this error |
Did you notice "I kept removing new code until there wasn't anything left running in my inherited class"? The exception persisted even when no additional code was being run. No shaders, no textures, no overrides, no new classes what so ever. Did you also notice "I tried running the basic GameWindow itself without inheriting it and it throws the exception even faster than my inherited class did"? My additional code was only delaying the exception from being thrown. The only differences in my code are that shader takes the scripts as strings directly instead of loading text files, and texture was using a zero filled array instead of loading an image file. |
The issue here is we don't exactly know your codebase to be able to reproduce the issue. What you may think is normal usage may not be normal usage, and really without a single line of code this bug report is hard to verify, reproduce and fix. No such issue came up in #support in the discord either from anyone except you since the release of 4.7.4. What is running a What I did do is write what I think would be the minimum viable thing you are trying to describe. The following: using System;
using OpenTK;
using OpenTK.Windowing.Common;
using OpenTK.Windowing.Desktop;
namespace TKtest
{
public class Program
{
public static void Main()
{
GameWindow window = new GameWindow(GameWindowSettings.Default, NativeWindowSettings.Default);
window.Run();
}
}
} This code did not stack overflow. Is there a time frame for the stack overflow? Minutes? Seconds? |
I have that code almost exactly except native window settings is being constructed like in the tutorial examples, the exception throws within seconds. I tried making a separate project entirely and copied/pasted the textures scripts from the tutorial exactly sorry I don't know how box the code like you did I don't use github much using System; namespace TestBed |
Is the above code all the code that you have in your project? |
I saw that. I was saying that if there was any way to get a useful stack trace by maybe pausing the debugger just before the exception occurs or something like that it would help a lot in figuring out what is going on. |
I think I've found the problem, the platform target in my project settings was x86. The exception doesn't seem to throw anymore if it's set to different. I'm not totally sure when it got changed to that though. |
I'm really not sure why that made a difference since it never does in any other project, but I guess I'll just close this issue then. |
I don't think we should close the issue when we haven't figured out what was happening. Especially as we just got an essential clue, the bug is dependent on whether the application is run in 32bit or 64bit mode. Now it might be reproducible. |
I'm not able to reproduce the issue running the code posted above in using System;
using OpenTK.Windowing.Desktop;
using OpenTK.Windowing.Common;
namespace TestBed
{
static class Program
{
static void Main()
{
GameWindow window = new GameWindow(GameWindowSettings.Default,
new NativeWindowSettings()
{
Size = new OpenTK.Mathematics.Vector2i(400, 225),
Title = "OpenTK Test",
Flags = ContextFlags.ForwardCompatible
});
window.Run();
}
}
} |
@codefoxup does the above code cause the exception for you when running |
If I might help, I tried this on my pc, I received the stack overflow exception with the following trace:
(Additional information: Compiled in wsl for win x86, run on .Net6 with Win11) |
How are you compiling the project? |
The same code still throws the exception even in a totally new project. It does not throw when the platform target is anycpu or x64, only x86. I'm still not sure if there's a way for me to get a better stack trace. |
The command to build the executable was
|
This is starting to look like some kind of glfw bug or something with the way we call into glfw when running as a 32 bit process that doesn't work well. |
This issue was not occurring for me on master, built for x86 on .NET 5, in VS. I waited about a minute and no exception was thrown. I noticed we recently updated to GLFW 3.3.8. I didn't see anything related to I would suggest to @codefoxup that you develop for 64-bit systems as we're now in 2022 😜. But in all honesty, this is likely the best course of action as it seems like this is a GLFW issue. @NogginBops, I took a quick look over how we're loading the library and I can't seem to find anything. While this is open I'll try replicating this issue on a different machine as I'm hoping I can diagnose who's to blame. |
My GameWindow class kept throwing the exception and I was trying to figure out what specifically was causing it. I kept removing new code until there wasn't anything left running in my inherited class, so I tried running the basic GameWindow itself without inheriting it and it throws the exception even faster than my inherited class did. For clarity my code was near identical to the textures tutorial in the learnOpenTK repo. I did try doing simple searches about this issue but searching 'StackOverflow' I just get results for the website and not any known instances of this exception with opentk.
This is all visual studio would give me for the stack trace, not very useful
System.StackOverflowException
HResult=0x800703E9
Source=
StackTrace:
The text was updated successfully, but these errors were encountered: