Debug TMS WEB Core web apps from the Delphi IDE
Breakthrough!

Debug TMS WEB Core web apps from the Delphi IDE

After months and months of research & development at tmssoftware.com , we're eager to share with you the first beta of TMS WEB Core v2.3 that features debugging web apps from the Delphi IDE.

Since its inception, TMS WEB Core offered a debugging experience via the browser console. Thanks to a generated source map file, it is fortunately already possible to step through Object Pascal code and inspect Object Pascal variables from the browser, it is still a two step process to develop from the Delphi IDE and debug from the browser console.?

Technical background

Even though technically extremely challenging, our team of experts José Leon Serna & Roman Kassebaum set their goal on offering a debugging experience for TMS WEB Core web apps directly out of the Delphi IDE. Fortunately, the Chrome browser engine features the DevTools Protocol with which it is possible to take over debugging from an external application, in this case the Delphi IDE. Technically this works via a WebSocket server with which the browser communicates in this case to the TMS WEB Core Delphi IDE plugin. Keeping the "eat your own dogfood" mantra in mind, this WebSocket server was implemented using TMS FNC WebSocket. On the other side, we could fortunately also find sufficient IDE extension APIs as well as a few places where we needed to hook code, to add this custom debugging interface to the Delphi IDE.

Browsers

At this moment, the DevTools Protocol is available with Google Chrome browser and Microsoft Edge Chromium browser. So only if you instruct TMS WEB Core to run the app in either Google Chrome or Microsoft Edge Chromium, the debugging from the Delphi IDE will be working. The FireFox browser does noy fully implement the DevTools Protocol, so it remains under research if we will technically also be able to bring this debugging experience for FireFox. Of course, it still remains possible to debug using Object Pascal code from the browser console in all browsers TMS WEB Core can target.

Configuration and limitations

From the Delphi IDE, you can globally define whether you want debugging from the Delphi IDE or debugging from the browser console. This setting is under Tools, Options, TMS WEB, "Debugging IDE / Browser". But you can also define this at project level under Project Options, TMS WEB, "Debugging IDE / Browser".?

When debugging from the Delphi IDE is enabled, set your breakpoints in the Delphi code editor and the IDE will automatically stop the app at the breakpoint and you can use the shortcuts F7,F8,F4 to step in, step over, step to lines of code. When you hover over variables, the IDE will show the variable value in a hint and you can also inspect values via Debug, Evaluate/Modify. With this is a limitation though if you want to inspect objects, object properties, etc.. that the expression you specify is expected to be a JavaScript expression. Behind the scenes, this expression is sent to the browser over websocket communication and the browser only understands JavaScript. The only way we could technically overcome this is by transpiling on the fly such Object Pascal expression to JavaScript, but this is far from trivial and as such currently not yet possible. Fortunately, the JavaScript expression for variables matches with Object Pascal expressions and with some getting used to, you'll be able to inspect most of what you need this way.

Another subtle difference when you debug from the Delphi IDE is that the Delphi IDE starts a new browser instance for every session and also, when you terminate the debugging session from the IDE, the IDE will close this browser instance. This is because there is a unique websocket communication channel between the IDE and the browser instance used for debugging. Nothing prevents you to still open the browser console for the browser where the debugging session is running and inspect the DOM, code, networking tab etc...?

See it for yourself

Check our first video showing how you can debug a TMS WEB Core web app running in the browser from the Delphi IDE:

Get started with the beta

We have made the v2.3 beta available now for all active TMS ALL-ACCESS users. Login on our website under Account / My Products and download and install this beta. Our team is very interested to hear about your experiences and closely work together in case some glitches might be found in this beta or to listen for your further ideas to improve the experience with TMS WEB Core. As always, you can follow-up in the Support Center or via direct email.

Fabio Giovanetti

CIO | Digital Transformation | IT Manager | SAP S/4 | Digital Manufacturing | Digital Supply Chain

1 年

Fine

回复

要查看或添加评论,请登录

Bruno Fierens的更多文章

  • From VCL to WEB: Eat your own (dogfood) icecream

    From VCL to WEB: Eat your own (dogfood) icecream

    Regularly, we are contacted by Delphi developers asking for information how they can bring existing VCL desktop…

  • Extract route segments with TMS FNC Maps Summer Delphi project

    Extract route segments with TMS FNC Maps Summer Delphi project

    Germany has a wonderful network of bike routes throughout the whole country. Many of these bike routes are well thought…

  • Visualize your routes with TMS FNC Maps Summer Delphi project

    Visualize your routes with TMS FNC Maps Summer Delphi project

    It's summer time, the ideal time for outdoor activitities. One of my personal favorite outdoor activitities is biking.

  • Jumpstart your path to create web apps with Delphi

    Jumpstart your path to create web apps with Delphi

    Today, you can create web client applications reusing all your skills of Object Pascal RAD component based development…

    1 条评论
  • In memory of Matthias Eissing

    In memory of Matthias Eissing

    Matthias at Klosterpforte, Harsewinkel Germany for TMS Training Days in 2018 It is a great shock and it is with deep…

    4 条评论
  • RAD Studio 12 and TMS components

    RAD Studio 12 and TMS components

    Celebrating four decades since the debut of Turbo Pascal, we now embrace Delphi 12, a fresh addition to RAD Studio 12…

    3 条评论
  • TMS VCL UI Pack v13.0 released

    TMS VCL UI Pack v13.0 released

    In the past couple of months, our team at tmssoftware.com did again a significant amount of work to bring a major new…

  • Showing protected PDF files in a web app

    Showing protected PDF files in a web app

    Imagine the following use-case: Someone wants to offer protected account-based access to specific resources, for…

  • Congrats Delphi 11!

    Congrats Delphi 11!

    With Embarcadero Technologies mentioning an upcoming RAD Studio 12 at https://www.embarcadero.

    1 条评论
  • Use Tailwind and the Tailwind workflow with TMS WEB Core

    Use Tailwind and the Tailwind workflow with TMS WEB Core

    Tailwind is a rapidly growing and popular open-source CSS framework. Different from Bootstrap and many other CSS…

社区洞察

其他会员也浏览了