Solving I/O Error 103 in LoadXMLDocument

In a Delphi console application that reads its configuration from an XML file, I unexpectedly ran into “I/O error 103”. I/O error 103 will look familiar to most of you Delphi developers, it means “File not open”. I traced it to this source line:

xmlcfg := LoadXMLDocument(FConfigFilePath);

LoadXMLDocument comes from the Delphi unit XMLDoc.pas, so the problem was not in my code. Ouch, this could mean trouble. But, the exact same unit was used in another (Forms) application where it worked perfectly fine. What was going on here?

The solution was fortunately deceivingly simple: the XMLDoc unit uses interfaces, so you need a CoInitialize() call before doing anything. As it turned out, my CoInitialize() call was too late. It was further down, right before initializing some ADO components, but after the attempt to read the configuration file. So the solution was to put

CoInitialize(nil);

At the very top of my initialization code, before calling the configuration reader. Now it worked fine, no more “File not open” messages.

This proved once more that sometimes, the error message you get has little to do with the real issue at hand.

For reference: CoInitialize resides in the ActiveX unit.

Advertenties

Update to SQL server tooling for Visual Studio

MS recently released the “March 2014” update to the SQL Server tooling for Visual Studio 2013, which was named SQL Server Data Tools for previous Visual Studio versions. Among the most notable new features are support for SQL Server 2014 and several productivity updates that simplify development and testing, also on SQL Azure. Read more about it on the SQL Server Data Tools team blog here.

Worth noting for some of us, is that Visual Studio 2010 is no longer supported with new features and updates for SSDT, although the dacpac’s and other projects remain fully compatible throughout 2010/2012/2013. The update to SSDT that was released at the time VS2013 came out, was the last one. Personally, I am only keeping my VS2010 around for its Installer support, so I am ok with that.

(Add. 10-04)

Today I noticed that the order of installation of updates is important. On another machine, I upgraded SSDT first, but was then unable to install the 1.3 update to the Microsoft Office Developer Tools (12.0.30225.00, to be precise). The latter’s Web Installer the complains about missing requirements and refuses to continue:

ssdt_required

SQL Server Data Tools not installed?

SQL Server Data Tools is installed, obviously, but not recognized, probably because of newer version numbers. I don’t really mind much since I don’t actively develop using the Office Developer Tools, so I’ll just wait for the next update. But if you do use both, I recommend you should install the ODT update first, and then SSDT!