Webview example crashes debugger

Just starting out? Need help? Post your questions and find answers here.
novablue
Enthusiast
Enthusiast
Posts: 177
Joined: Sun Nov 27, 2016 6:38 am

Webview example crashes debugger

Post 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)
Quin
Addict
Addict
Posts: 1122
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: Webview example crashes debugger

Post by Quin »

Doesn't happen for me on Windows 11 IoT LTSC 2024 with PB 6.11 (x64 and C backend).
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Webview example crashes debugger

Post by Fred »

Looks OK here, can anybody else confirm ?
User avatar
Mindphazer
Enthusiast
Enthusiast
Posts: 456
Joined: Mon Sep 10, 2012 10:41 am
Location: Savoie

Re: Webview example crashes debugger

Post by Mindphazer »

No problem here, works as expected (PB 6.11 x64, Win 10 22H2)
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: Webview example crashes debugger

Post 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. 🤔
PureBasic for Windows
Fred
Administrator
Administrator
Posts: 18153
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Webview example crashes debugger

Post by Fred »

What do you mean by 'using wrong folder' ?
Marco2007
Enthusiast
Enthusiast
Posts: 648
Joined: Tue Jun 12, 2007 10:30 am
Location: not there...

Re: Webview example crashes debugger

Post 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 ...
Last edited by Marco2007 on Thu Aug 15, 2024 8:00 am, edited 1 time in total.
PureBasic for Windows
BarryG
Addict
Addict
Posts: 4121
Joined: Thu Apr 18, 2019 8:17 am

Re: Webview example crashes debugger

Post by BarryG »

Marco2007 wrote: Wed Aug 14, 2024 9:16 pmDebugger crash (due to Defender)
I think you know what to do. :wink:
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Webview example crashes debugger

Post 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:
Post Reply