"CoInitialize has not been called" message on XInputGetCapabilities call

Hello,
I’ve recently noticed this string in my project’s output:
onecore\com\combase\objact\objact.cxx(834)\combase.dll!00007FF824B17213: (caller: 00007FF824B164D6) ReturnHr(1) tid(1bd8) 800401F0 CoInitialize has not been called.

After some quick debugging, I’ve tracked down the line causing said string to be printed:

if (XInputGetCapabilities(index, 0, &xic) != ERROR_SUCCESS)
continue;

line 553 in win32_joystick.c from glfw3.3

Here’s the callstack:
| |Engine.dll!_glfwDetectJoystickConnectionWin32() Line 554|C|
| |Engine.dll!_glfwInitJoysticksWin32() Line 510|C|
| |Engine.dll!_glfwPlatformInit() Line 583|C|
| |Engine.dll!glfwInit() Line 230|C|

Everything seems to be working fine, but I’d still like to make sure there aren’t any problems. Furthermore, is there a way to fix this? I’d rather keep my output as clean as possible.

Thanks.

Hi @Geoffrey91, welcome to the GLFW forum!

CoInitialize is used to initialize COM, but the documentation on XInput makes no mention of needing to initialize COM. So I’m not sure what’s going on here.

When you say my project’s output do you mean the Visual Studio debug output window? I’ve never seen output like this when using GLFW, so perhaps you are doing something extra which most people aren’t which causes this?

Is your project doing anything unusual, or for example using COM itself etc.?

Hi @dougbinks ,
Thanks for the quick reply.

Yes, I was referring to the Visual Studio debug output window.
I don’t think I’m doing anything extra that’s out of the ordinary. Nor I am using COM itself. Though, I should mention I’m making use of XAudio2 for audio; that’s the only thing I can think of that’s COM related in my project.

I should also mention that I think this is a relatively new problem I’m having. I’ve been using GLFW for my project windows for a few months now and I’ve not seen that error message in the past. I fear it may be related to updating to Windows 10 1903 or moving to a new version of the Windows SDK (10.0.17763.0). That’s all I can think of.

I just tried with SDK version 10.0.17763.0 and haven’t seen any extra debug log output in Visual Studio (on VS 2019).

I’m still on Windows 10 1809, when I get time to update or check things out on an updated system I’ll take a look.

Just a quick check - have you seen this output on any of the example programs?

I just updated to Windows 10 1903 on my dev system and have ran a few tests without seeing any output regarding CoInitialize.

Were you able to check if the example projects also had this issue?