-
Notifications
You must be signed in to change notification settings - Fork 84
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
'Runtime is active on another thread' error with Chakra and WebView control combination #46
Comments
Just to add, there's nothing special about navigating to the Monaco editor. If I navigate to www.google.com the same thing happens. I'm going to take the example UWP project posted here, and try the above just to exclude anything particular to my project setup. |
Yep I can replicate this with the UWP example. Steps:
This looks like a significant problem unless I'm missing something? Thanks. |
Error is normal since WebView also creates the Runtime. |
OK so two runtimes. But they don't operate in isolation? |
One runtime, multiple context ? |
OK, to rephrase, how do I use the WebView and Chakra Engine together without raising ''Runtime is active on another thread' errors. :) If I'm working with the Chakra engine yes I can create multiple contexts. The problem is creating contexts in the first place if I have a WebView active which seems to be hogging the runtime. |
Didn't use WebView. If you are on the same thread with WebView (which is IIRC to be main thread??) You may get the active context by calling Just a suggestion. Didn't try it. |
This assumes a shared runtime though. I thought the whole point was to be able to create separate isolated runtimes. Surely if I explicitly create a new runtime this should not interact with the runtime created by the WebView. Anyway I'll investigate a bit more, thanks. |
Great. Please share your experiences back. It may help others :) Keeping this open for a while then. |
Please keep this open. I haven't yet found a way to use the WebView control and Chakra engine together in a UWP app. This seems like a significant issue. Hopefully someone will be able to shed some light. Thanks |
/cc @munyirik ? |
OK I think I've found the problem. In the example above I'm creating a runtime on the UI thread (the same thread as the WebView). If I do one of the following I can successfully create a new context on a new runtime. Either
Phew. Happy to close :) |
Perfect! |
I have a UWP app and a page with a WebView control.
The WebView points to a version of the Monaco Editor (https://github.com/Microsoft/monaco-editor) embedded in my app:
WebViewEditor.Navigate(new Uri("ms-appx-web:///Monaco/index.html"));
All works well.
However if I then try to use the Chakra engine, I immediately get 'wrong thread' exceptions.
The following will fail on the second line attempting to create a new context:
var runtime = JavaScriptRuntime.Create();
var context = runtime.CreateContext();
If I remove the WebView navigation above, the chakra engine functions fine.
I wouldn't have expected there to be any interaction? I would have expected a new chakra runtime to operate in isolation and have no threading issues when used in combination with a WebView control. Very odd. Any ideas?
Thanks,
Stuart
The text was updated successfully, but these errors were encountered: