-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Crash when CGO_ENABLED=1 while using WebviewBrowserPath option. #1569
Comments
Thanks for opening this. Please provide minimal steps to reproduce. Thanks 🙏 |
STEPS:
|
Would it be possible for you to also post the stacktrace of the panic? You need to compile the binary with 'wails build --debug' to get the stacktrace shown in the console. That would be awesome 🙏 |
This is an issue in manual mapping of WebView2Loader.dll, probably something going wrong with TLS, as it is used inside |
I'm thinking we might need more docs around this feature in the guide section? Thoughts? |
I wonder if it is related to the wrong handling of unsafe.Pointer to uint64 of the webview2loader when loading from the embedded version, e.g here
Normally native calls use uintptr with the uintptrescape compiler directive and not uint64 and maybe activating cgo has some side effects which trigger a stackgrow or something else. @NanoNik do you have a stack trace of the panic? I might find some time to investigate it over the weekend. |
@stffabi No panics, function just returns ERROR_SUCCESS. Actually, I met this issue without using CGO, but it was on Windows 7. |
Sorry, the information I provided was incorrect and is corrected as follows: A cgo.go file needs to be created in the root of the project with the following contents: /* int printint(int v) { func ctest() { Then the bug can be triggered, the output after adding the --debug compile option is as follows: ---- WARNING ---- the program terminated with no panic. |
The error code implies that something is not supported. There's one issue on the webview2feedback repo which also mentions this error code when using a fixed version deployment and a relative path to the runtime MicrosoftEdge/WebView2Feedback#2025 Are you using a relative path? Just to make sure I understand you correctly, the very same code with 'CGO_ENABLED=0' work just fine? |
I've asked Champnic for an update on the linked bug in Webview2 👍 |
This problem has nothing to do with whether relative paths are used or not. As long as the C code is not called, there is no problem. I have done the following test:
|
@fire988 Thanks for clarifying 🙏. I'll take a deeper look into it over the weekend. |
Yeah, I'm not sure why Windows returns |
I was able to reproduce it and it really appears as soon as cgo is used. So it's some side effect of cgo in combination with the memory loader https://github.com/jchv/go-winloader Maybe @jchv has an idea what is going on. |
…xed runtime This fixes a problem with the go-winloader and using GetAvailableCoreWebView2BrowserVersionString Fixes wailsapp#1569
…xed runtime (#1790) * [webview2loader] Start porting of OpenWebView2Loader to go * [webviewloader] Use go implementation to retrieve the version of a fixed runtime This fixes a problem with the go-winloader and using GetAvailableCoreWebView2BrowserVersionString Fixes #1569 Co-authored-by: Lea Anthony <[email protected]>
@fire988 Master now has the fixes for this. Please test using this guide. If it doesn't work as expected, please reopen 👍 |
I've done a full test and the problem has been solved, great! |
Awesome thanks for taking your time and testing it 🙏 |
Description
when CGO_ENABLED set to 1, and load webview in custom location using WebviewBrowserPath, the output binary executable file is buggy, It will crash at GetAvailableCoreWebView2BrowserVersionString function.
To Reproduce
none
Expected behaviour
when CGO_ENABLED set to 1, and load webview in custom location using WebviewBrowserPath, the output binary executable file is buggy, It will crash at GetAvailableCoreWebView2BrowserVersionString function.
Screenshots
none
Attempted Fixes
No response
System Details
Additional context
No response
The text was updated successfully, but these errors were encountered: