Miguel Costa

Qt Visual Studio Tools 2.3.1 Released

Published Monday January 21st, 2019
39 Comments on Qt Visual Studio Tools 2.3.1 Released
Posted in Dev Loop, Qt, Releases, Visual Studio, Windows

The Qt VS Tools version 2.3.1 has now been released to the Visual Studio Marketplace.
Important changes include:

For details of what is included in this version, please refer to the change log.

The installation package can be installed directly from within Visual Studio (through the ‘Tools > Extensions and Updates…’ menu). Alternatively, it can be downloaded from this page.

QML Debugging

Contrary to what was mentioned in a previous post, the new QML debugging feature will not be enabled by default. It must be explicitly enabled by opening the Qt project settings and setting the “QML Debug” option to “Enabled”.

Do you like this? Share it
Share on LinkedInGoogle+Share on FacebookTweet about this on Twitter

Posted in Dev Loop, Qt, Releases, Visual Studio, Windows

39 comments

Jakub Narolewski says:

Looks great ;] Can we use those features in CMake based projects?

Miguel Costa Miguel Costa says:

The current version is designed to work with MSBuild-based C++ projects (.vcxproj) and solutions. CMake projects in Visual Studio, using the non-MSBuild “open folder” approach, will be supported in a future release.

Jakub Narolewski says:

Awesome :]

Andy Fillebrown says:

Thank you for this. Is there a way to enable QML debugging for Visual Studio solutions generated by CMake?

Miguel Costa Miguel Costa says:

We currently only support working with MSBuild-based projects, and will be working to add support for non-MSBuild projects in a future release. In the meantime, it might be possible to manually change a .vcxproj generated by CMake to trick the QML debug engine into recognizing it as a Qt VS Tools project. This should allow a QML debug session to be started, but I haven’t tried it yet.

Miguel Costa Miguel Costa says:

I was able to use the QML debug engine with a VS project generated by CMake.

Added the following to CMakeLists.txt:

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qml.qrc ${CMAKE_CURRENT_SOURCE_DIR}/qml_debug.qrc COPYONLY)
 
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT}.vcxproj.user"
"<?xml version=\"1.0\" encoding=\"utf-8\"?>
<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">
  <PropertyGroup>
    <QTDIR>C:\\Qt\\5.12.0\\msvc2017_64</QTDIR>
    <LocalDebuggerCommandArguments>-qmljsdebugger=file:$(ProjectGuid),block</LocalDebuggerCommandArguments>
    <LocalDebuggerEnvironment>PATH=$(PATH);$(QTDIR)\\bin</LocalDebuggerEnvironment>
  </PropertyGroup>
  <ImportGroup>
    <Import Project=\"$(QtMsBuild)\\qt.props\" />
    <Import Project=\"$(QtMsBuild)\\qt.targets\" />
  </ImportGroup>
  <ItemGroup>
    <!-- Required: add QRC files to generated project -->
    <QtRcc Include=\"${CMAKE_CURRENT_SOURCE_DIR}\\qml_debug.qrc\">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </QtRcc>
    <!-- other QRC files here -->
 
    <!-- Optional: add QML files to generated project -->
    <None Include=\"${CMAKE_CURRENT_SOURCE_DIR}\\main.qml\"/>
    <!-- other QML files here -->
  </ItemGroup>
</Project>")

Change “qml.qrc” and “main.qml” to actual filenames in your project, and set the value of <QTDIR> to the installation path of Qt.
After generating and building the VS project, open the generated solution and start debugging. The QML debug engine should start (you should be able to see a QML process listed alongside the native one in the list of processes being debugged); it should now be possible to set breakpoints in QML files.

Andy Fillebrown says:

Excellent! Thanks again.

Andy Fillebrown says:

Thank you! This works for me when using .qrc files. Is there a way to make it work when not using .qrc files?

Miguel Costa Miguel Costa says:

In the current implementation of the QML debug engine, breakpoints will only be available for .qml (and .js) files listed in a QRC — though it might be possible to step in/out to code in other files.

Werner says:

I tried the vcxproj.user trick.
QML debugger starts and is displayed in the processes window. Then it stops. Debug output:

Qt VS Tools: Debugging project ‘App’
Qt VS Tools: QML debugging enabled
Qt VS Tools: Starting QML debug engine…

‘App.exe’ (QML): Connecting to the QML runtime…
The thread 0x3c68 has exited with code 0 (0x0).
‘App.exe’ (Win32): Loaded ‘C:\Qt\5.11.1\msvc2017_64\plugins\platforms\qwindows.dll’. Symbols loaded.

The thread ‘QML Debugger’ (0x341c) has exited with code 0 (0x0).
The program ‘App.exe: QML Debugger’ has exited with code 0 (0x0).

Miguel Costa Miguel Costa says:

You need to enable the QML debugging infrastructure in the native process:


[…]pass the following defines to the compiler:

  • Qt Quick 1: QT_DECLARATIVE_DEBUG
  • Qt Quick 2: QT_QML_DEBUG
  • […]When the infrastructure is enabled, the application displays the following warning:
    QML debugging is enabled. Only use this in a safe environment.

    Do you see this warning in the output window?

    Werner says:

    I found the problem. I did not forward the command line arguments to QGuiApplication contructor. Works now , thanks!

    R Kh says:

    I upgraded from 2.3.0 to 2.3.1 in VS 2015 and 2017, then opened the IDE and attempted opening Qt Options — each IDE hanged (became unresponsive, I waited for several minutes). Downgrading.
    I wonder what scenarios are tested before release (if any).

    Miguel Costa Miguel Costa says:

    Thanks for the feedback. I’m currently unable to reproduce the problem that you described. Could you please open an issue in https://bugreports.qt.io/browse/QTVSADDINBUG and describe the situation in detail? Thank you.

    Mao says:

    me too.

    Henning says:

    After auto-update of the extention it does not load. Extention error log from the studio shows the following error:

    SetSite failed for package [Vsix]Source: ‘QtVsTools’ Description: Could not load file or assembly ‘Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. File name: ‘Microsoft.VisualStudio.Threading, Version=15.8.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ at QtVsTools.Vsix.InitializeAsync(CancellationToken cancellationToken, IProgress`1 progress) at Microsoft.VisualStudio.Shell.AsyncPackage.c__DisplayClass17_0.<b__1>d.MoveNext() — End of stack trace from previous location where exception was thrown — at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck) at Microsoft.VisualStudio.Services.VsTask.GetResult() WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

    Any idea (except turning out-update off and install the old version) ?

    Thanks for any hints,
    Henning

    Miguel Costa Miguel Costa says:

    What version of Visual Studio 2017 are you using? If you haven’t done so already, try updating Visual Studio 2017 to the latest version (15.9.5) and see if the extension is then able to load.

    Oleh says:

    We have the same issue in our company with Visual Studio 15.6.7
    Updating to the latest one is not easy, since it has to be approved for use, which takes some time.
    Downgrading to Qt addin 2.2.0

    Oleh says:

    (continue previous message) “fixes” the issue, so Qt add-in works again ( but not the latest version )

    Miguel Costa Miguel Costa says:

    Version 2.2.2 is also available.

    Rob says:

    The corresponding QML debug process does not start. I got the following message:
    QML Debugger: Connecting to socket {B12702AD-ABFB-343A-A199-8E24837244A3}…
    and nothing happens.
    Do I need to install or active anything else beside QML Debug enabled in the project settings? There is also no possibility to change the port. Where can I find some documentation how to use it?
    (VS 2017 15.9.5 with addon 2.3.1)

    Miguel Costa Miguel Costa says:

    Could you try starting the debugging again? Some reports that we’re currently looking into describe the connection to the QML runtime not being established at first, but a second connection attempt is then successful.
    The port selection is no longer relevant as we have switched from TCP to named pipes. So the “socket” is actually just the pipe’s name — to try to avoid collision of multiple debug sessions, the name used is the GUID of the project.

    Rob says:

    Negative. The program always stops with the line
    QML Debugger: Connecting to socket {B12702AD-ABFB-343A-A199-8E24837244A3}…

    Project(“{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}”) = “xtest”, “xtest\xtest.vcxproj”, “{B12702AD-ABFB-343A-A199-8E24837244A3}”

    The GUID is indeed the one of the project.

    ANDERS FOLKESSON says:

    I have the same issue. Will monitor this closely.

    Miguel Costa Miguel Costa says:

    This issue has been fixed (https://bugreports.qt.io/browse/QTVSADDINBUG-610), the fix will be available in the next release of the Qt VS Tools.

    Miguel Costa Miguel Costa says:

    To track this problem, I created the following issue in our bug report tool: https://bugreports.qt.io/browse/QTVSADDINBUG-610
    Please feel free to add any details, including error messages, if any, that are displayed in the console and/or output window.

    ANDERS FOLKESSON says:

    I dont think i am able to comment on the tracker page but i read the information there but it didnt solve my problem. /Also, no space in executable file or path).
    But i found this in my output:
    Qt VS Tools: QML debugging disabled

    I dont know why.
    Another question is: in waht way does a qml file need to be included in the project? Is a reference from a .qrc file enough?

    Miguel Costa Miguel Costa says:

    You’ll need to login to, or create a Qt account to comment on issues. If you have checked the two known scenarios that lead to the problem of the QML debug blocking — (1) project not yet converted to Qt/MSBuild; (2) space characters in target exec name or path — there could be another, as yet unknown cause for this problem. In that case, please do comment on the issue (or create a new one) and let us know in detail the problem that you are experiencing; if possible, also attach a sample project that can reproduce the problem. Thank you.

    As for the other question, the current implementation of the QML debug engine requires that .qml (and .js) files be listed in a QRC; this will allow breakpoints to be set on those files.

    Jo says:

    Is it possible to debug js files also? The breakpoint circle is not fully red. QML files are working great.

    Miguel Costa Miguel Costa says:

    Yes, it should be possible to debug code in .js files, as long as they are also listed in the QRC, alongside the .qml files. If the problem persists, please open an issue at https://bugreports.qt.io/browse/QTVSADDINBUG describing the situation in detail, thanks.

    modeck says:

    I can’t use all my project on visual studio 2019 preview 16.0.0 Preview 2.0 vs tools v. 2.3.1. (I use the Russian version of VMS, so it’s a translate ) Object reference not set to an instance of an object. What can I do?

    Miguel Costa Miguel Costa says:

    I’m currently not able to reproduce this problem. Please open an issue at https://bugreports.qt.io/browse/QTVSADDINBUG and describe the situation in detail. Thank you.

    Feng says:

    My Qt Visual studio tool was automatically updated to v2.3.1 on 1/21/19 from v2.2.2. Then it stopped working. It complains as: ‘Vsix’ package did not load correctly. Specifically the system cannot find some files such as Microsoft.VisualStudio.Threading. I uninstall/install the tool a few times, but cannot resolve the problem.

    By the way, how can I re-install version 2.2.2 after downloading the .zip file? I cannot find the installer.vsix file in the package. Using tools->Extensions and updating can only load the latest version 2.3.1.

    Miguel Costa Miguel Costa says:

    If you have not yet done so, could you try updating VS 2017 to the latest version and then see if the extension loads correctly?
    For v2.2.2, you can download the .vsix from this location.

    Simon says:

    After auto update by VS (2015 update 3) my build failed with a lot of C1041 errors (multiple CL.EXE write to the same .PDB file)

    I had to unistall the addon, manually remove que QtMSBuild directory in appdata\local and reinstall the 2.2.2 version.

    Miguel Costa Miguel Costa says:

    Could you please open an issue in https://bugreports.qt.io/browse/QTVSADDINBUG and describe the problem in detail, maybe attach a sample project that reproduces it? Thank you.

    Werner Palfinger says:

    Is it possible to debug resources from a dll? It seams that the debugger only supports resources in the debugged application.

    Miguel Costa Miguel Costa says:

    The current implementation of the QML debug engine for VS supports setting breakpoints only in .qml and .js files listed in a QRC that is included in the project being debugged.

    Commenting closed.

    Get started today with Qt Download now