I'm using Visual Studio 2019 and have the following simple OpenGL program as a minimal example (using GLFW and GLAD):
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
void error_callback(int error, const char* description) {
std::cout << "GLFW error: " << description << " (" << error << ")\n";
}
int main() {
if (!glfwInit()) exit(-1);
glfwSetErrorCallback(error_callback);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(640, 480, "GLFW Test Application", nullptr, nullptr);
if (!window) exit(-1);
glfwMakeContextCurrent(window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) exit(-1);
glViewport(0, 0, 640, 480);
glClearColor(0.6f, 0.6f, 0.1f, 1.f);
while (!glfwWindowShouldClose(window)) {
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
}
The program works fine but while it's running I get lines like those who follow in the debug output window in intervals of few to around 20 or even more seconds:
Exception thrown at 0x00007FFE61EEA799 (KernelBase.dll) in vcpkg_test.exe: 0x0EEDFADE (parameters: 0x0000000001D0A34E, 0x000001C13E322BA0, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000).
Exception thrown at 0x00007FFE61EEA799 (KernelBase.dll) in vcpkg_test.exe: 0x0EEDFADE (parameters: 0x0000000001D0A34E, 0x000001C13DC7CE40, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000).
Exception thrown at 0x00007FFE61EEA799 (KernelBase.dll) in vcpkg_test.exe: 0x0EEDFADE (parameters: 0x0000000001D0A34E, 0x000001C13DC7CDE0, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000).
The program keeps running though, works fine and also exits with exit code 0. It also works fine when I execute the EXE file outside of Visual Studio. When I set VS to break on all exceptions, then I see that the exception occurs in this call (win32_init.c, "createHelperWindow" method):
_glfw.win32.helperWindowHandle =
CreateWindowExW(WS_EX_OVERLAPPEDWINDOW,
_GLFW_WNDCLASSNAME,
L"GLFW message window",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
0, 0, 1, 1,
NULL, NULL,
GetModuleHandleW(NULL),
NULL);
I already spent hours on Google trying to find a solution to this. The only "hint" I got is that the exceptions do not occur when I run VS19 as administator. Does someone have an idea what's causing this? Or should I just ignore it since it runs fine? That'd feel wrong though....
Update/Solution
I followed the tips in Ben's answer (see accepted answer). After enabling breaking on first-chance exceptions, I got the following stack trace:
The DLL "ammemb64.dll" also appeared in the modules window. It belongs to the software "Actual Multiple Monitors" and after closing that application, the exception was gone.