Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-1149

QML debugging showstopper issues

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 2.10.1 (rev.02)
    • General
    • None
    • Windows

    Description

      Until recently I have never been able to get QML debugging even close to working. It would actually appear that there are various issues here which imply that there are bugs with the VS Tools integration particularly in the area of QML debugging support.
      The following applies to debugging Qt6 although I have previously tried with 5

      Issue 1:
      To enable QML debugging you have to "Enable QML Debugging" in Qt project settings. Now you would think that enabling it for the currently selected build Config & Platform would be sufficient. WRONG! No it seems you must enable for ALL Configs and All Platforms! Why on earth should that be necessary? The VS Add in should check which config/platform is active and not just blindly check the first it sees!!!! I suspect it of doing something stupid here!

      Observation:
      If you don't enable for all configs/platforms you see in the Qt VS Tools log:
      Debugging project 'XYZ'
      DISABLED: QML Debugging is not enable in Qt project settings

      or you might see

      DISABLED: Cannot identify project being debugged.

      I'm not completely sure but say your widgets application loads a DLL which then creates a QQuickWidget (with source you wish to debug) then I'm guessing that you need to enable QML debugging for this DLL project as well. So thats what I tried.

      Issue 2
      If you have a solution with multiple projects (I tried first with my 191 project monster). Now seriously I'm only going to enable QML debugging for the relevant projects e.g current startup project and relevant DLL's! It seems in this situation you're out of luck!!

      Observation
      You will likely see in Qt VS Tools log:
      Debugging project 'XYZ'
      DISABLED: Cannot identify project being debugged.

      Perhaps the VS Add in is not identifying the startup project, wait no, it must know its 'XYZ' because it said so! Whatever is going on here clearly isn't right.

      Issue 3 (minor but inconvenient)
      So you go to the trouble of separating out just the relevant EXE and as few DLL's as needed and put them in a separate solution. Note that this will probably force you to rebuild all of these projects - which is an inconvenient waste of time!!

      Observation:
      In Qt VS Tools log you might now at least see:
      Debugging project 'XYZ'
      Starting QML debug session

      Issue 4 (showstopper)
      So now you want to set a breakpoint in your QML file. So you do this and notice that the breakpoint indicates as not set. No worries as the QML file hasn't actually been loaded yet! Hmm the breakpoint NEVER hits. You try re-enabling it after the QML has loaded.
      Whats going on? This time there are no clues to be found. You wonder whether its because the QML source is being loaded via a file:// URL (this QML panel is a plugin to the main application - it might be one created by a user). Anyway you try in vain to change it to a Qt resource file just as a quick test. That doesn't work either. You cannot set breakpoints. A debugger where you can't set breakpoints is not much use!

      Observation:
      You can see that you have both QML and Native listed in the Processes window so the debugger must be loaded.

      BACKGROUND INFO
      A long time ago I used to use QtScript for non-visual application plugins and WebKit for visual ones. QtScript got deprecated so I started the long and laborious port to QQmlEngine/QJsEngine which in many respects was far far superior. As for WebKit that was history too (QWebEngineView far to heavyweight and inability to inject client side javascript meant total unsuitability) so I switched to using QML for visual plugins again in many respects much better. One thing I used to have for JS (non-visual plugins) was a standalone script debugger. That had to be dropped as there was no such support for the new JS engine architecture. This meant poor mans debugging via console.log etc which is fine in most cases. HOWEVER I have no debugger, I still have no debugger and VS debugger integration is also hosed or so it would seem. Surely it must be working for some!?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ali.demiralp Ali Can Demiralp
            bluespider David Hussey
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes