Skip to content
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

RPC_E_CHANGED_MODE (0x80010106) Error #13

Open
Robert-M-Muench opened this issue Oct 10, 2021 · 2 comments
Open

RPC_E_CHANGED_MODE (0x80010106) Error #13

Robert-M-Muench opened this issue Oct 10, 2021 · 2 comments
Labels
question Further information is requested

Comments

@Robert-M-Muench
Copy link

I'm experimenting with Wails and used some simple Go code that queries some hardware settings. When doing so, I get an RPC_E_CHANGED_MODE error. I think this is related to how the WebView2 COM instance is created.

Any idea how and where to best fix this?

  • In WebView2
  • in Wails and how it's using WebView2
  • In the hardware querying package
@jchv
Copy link
Owner

jchv commented Oct 12, 2021

This usually happens when you try to CoInitialize a second time, but try to create an STA when there is already a MTA.

I guess it would be necessary for us to have some way to allow you to initialize an STA. Honestly, I haven’t thought through entirely what the implications are of using multi-threaded apartments with Go code. You could modify the CoInitialize call in the other library to match the CoInitialize call in this one and then this issue should disappear, though I am not sure if that will cause any subtle problems or not. Need to think more.

@Robert-M-Muench
Copy link
Author

I resolved the issue by changing the library code to not return an error when the return code is RPC_E_CHANGED_MODE but continue because one ignore this case and just continue. The 1st initialization variant is used/wins.

I think the best solution for any library code is, to try the initialization (necessary for cases where you are the first) and ignore the RPC_E_CHANGED_MODE error code. Double initialization doesn't harm, and initialization with a different mode can be ignored.

@jchv jchv added the question Further information is requested label Sep 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants