Page 1 of 1

Webview example crashes debugger

Posted: Fri Aug 02, 2024 12:30 am
by novablue
On Windows PB 6.11 x64 running the Webview example from the help file will crash the debugger when i click on one of the buttons.

"The debugger executable quit unexpectedly"

Compiling it without the debugger works without crashing. Is anyone else experiencing this?

Code: Select all

;
; ------------------------------------------------------------
;
;   PureBasic - WebView example file
;
;    (c) 2024 - Fantaisie Software
;
; ------------------------------------------------------------
;

Procedure IncrementCallback(JsonParameters$)
  Static Count
  
  Debug #PB_Compiler_Procedure +": " + JsonParameters$
  
  Count + 1
  ProcedureReturn UTF8(~"{ \"count\": "+Str(Count)+ "}")
EndProcedure

Procedure ComputeCallback(JsonParameters$)
  
  Debug #PB_Compiler_Procedure +": " + JsonParameters$
  
  Dim Parameters(0)
  
  ; Extract the parameters from the JSON
  ParseJSON(0, JsonParameters$)
  ExtractJSONArray(JSONValue(0), Parameters())
  
  Debug "Parameter 1: " + Parameters(0)
  Debug "Parameter 2: " + Parameters(1)
    
  ProcedureReturn UTF8(Str(Parameters(0) + Parameters(1)))
EndProcedure

OpenWindow(0, 100, 100, 400, 400, "Hello", #PB_Window_SystemMenu | #PB_Window_Invisible)

WebViewGadget(0, 0, 0, 400, 400)
SetGadgetText(0, "file://" + #PB_Compiler_Home + "examples/sources/Data/WebView/webview.html")
  
BindWebViewCallback(0, "increment", @IncrementCallback())
BindWebViewCallback(0, "compute", @ComputeCallback())

; Show the window once the webview has been fully loaded
HideWindow(0, #False)

Repeat 
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow

// Moved from "Bugs - Windows" to "Coding Questions" (Kiffi)

Re: Webview example crashes debugger

Posted: Fri Aug 02, 2024 2:14 am
by Quin
Doesn't happen for me on Windows 11 IoT LTSC 2024 with PB 6.11 (x64 and C backend).

Re: Webview example crashes debugger

Posted: Fri Aug 02, 2024 8:24 am
by Fred
Looks OK here, can anybody else confirm ?

Re: Webview example crashes debugger

Posted: Fri Aug 02, 2024 9:31 am
by Mindphazer
No problem here, works as expected (PB 6.11 x64, Win 10 22H2)

Re: Webview example crashes debugger

Posted: Sat Aug 03, 2024 9:08 am
by Marco2007
I just know "The debugger executable quit unexpectedly", when using a wrong folder for creating the compilation exe and/or a virus scanner (e. g. Defender) is blocking the debugger. 🤔

Re: Webview example crashes debugger

Posted: Wed Aug 14, 2024 3:05 pm
by Fred
What do you mean by 'using wrong folder' ?

Re: Webview example crashes debugger

Posted: Wed Aug 14, 2024 9:16 pm
by Marco2007
Sorry, I meant "forbidden for Defender". I don't know which folders are not allowed.
The %temp% folder definitely causes problems.

This example with "Create temporary exe in source directory" checkbox unchecked -> Debugger crash (due to Defender)

Code: Select all

For i=1 To 10
Debug "ok"
Delay(160)
If CreateFile(0, "c:\test1.exe")
  Debug "ok"
CloseFile(0)
EndIf 
Next 


I also noticed problems with other folders a few months ago, but I don't remember, which folders caused problems, when "Create Exe..." was disabled -> Since I'm using OneDrive and checked "Create ..." -> no crash.

Btw almost the same issues for the example in the first post. There's no chance for me to run the code from "\Examples\Sources\" ...
With or without checked "create exe" ... but I can run it from e.g documents without any problems.

Win 11 x64 ...

Re: Webview example crashes debugger

Posted: Thu Aug 15, 2024 1:40 am
by BarryG
Marco2007 wrote: Wed Aug 14, 2024 9:16 pmDebugger crash (due to Defender)
I think you know what to do. :wink:

Re: Webview example crashes debugger

Posted: Thu Aug 15, 2024 8:33 am
by Marc56us
Search where is the last PureBasic_Compilation*.exe
(use SearchEverything)
Save you code with a name

PS.

Code: Select all

CreateFile(0, "c:\test1.exe")
In Windows 10+, normal user (without admin rights) can't write
  • in root dir on Windows system disk (C:\)
  • in program files (%ProgramFiles% %ProgramFiles(x86)%)
  • in system dir (echo %windir%) (i.e C:\windows)
:wink: