Feed Subscribe
Exception has been thrown by the target of an invocation.

"String cannot have zero length" when you try to install a .vsi file

by ondrejsv 21. December 2007 14:28

Today I decided to have a look at the recently released Visual Studio 2008 and .NET Framework 3.5 Training Kit which contains several presentations, labs and samples. I opened the first demo (about LINQ but it's not important right now), read the supplied instructions and run setup.bat. This small batch file does some nifty work, including running LINQ.vsi full of code snippets. But I ended here because a message box reading "String cannot have zero length" popped out at me. Fortunately I wasn't the first one having this issue and I found a forum topic on the asp.net site where Frank Tse (member of the ASP.NET team) explains that some missing Registry keys may be cause of this problem:


Although my Registry missed them too, unfortunately adding them didn't help me. As the .vsi file I tried to install contains just code snippets, I checked also the Code Snippet key in the same subtree and indeed, there were no ClassName and DisplayName values so I asked one of my colleagues to look for them in his computer. They are:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSEnvCommunityContent\ContentTypes\Code Snippet]

After inserting them I completed the installation successfully. :-)


My fight with Windows Live Writer Installer

by ondrejsv 19. December 2007 13:46

First time I tried Windows Live Writer a few months ago when I was experimenting with BlogEngine.NET. I found the tool to be quite useful for writing blog posts offline so when I finally created my own blog I immediately downloaded the installer in order to start writing on my notebook. Everything seemed to be fine until the progress bar captioned "checking your computer for Windows Live programs" changed to "Sorry, this is taking a little longer than expected". I was really patient but as I don't see a half an hour as little longer I killed the installer and began investigating.


During the installation I was looking what processes were active and so I found out that Windows Live Writer Installer actually uses Windows Update to download files and install them. Windows Update logs its activity to WindowsUpdate.log file which you can find in your Windows base directory. It may be fairly big in size so try to open it in something smarter than Notepad (like Ultraedit or Notepad++ in which it does not take forever). Surely, it was full of errors:

WARNING: WinHttp: ShouldFileBeDownloaded failed with 0x80072efd

WARNING: SyncServerUpdatesInternal failed: 0x8024402f

Obviously WinHttp component couldn't download any files. The error codes represent general errors like connection timeout and there was an error while downloading files and looking for them gave me at first only general advices as well (check you are connected to internet and so on). I tried to shut down the firewall and even my antivirus software and rerun the installation but no result. As I use a proxy server to connect to the outside world I suspected Windows Update service for a while that it does not use it. A little more searching and I found a blog post describing one useful utility -- proxycfg.exe -- used to manage WinHTTP proxy settings which, as I learnt, are completely independent from IE settings (UPDATE 2007-12-27: See also the update section below how to configure proxy without proxycfg in Windows Vista). Indeed (and fortunately) when I run it, it showed me that WinHTTP had no proxy information and was trying to connect to internet directly:


By running proxycfg -u the utility imported my proxy settings from Internet Explorer:


After restart I was happy to complete the Windows Live Writer Installer:


Note: If you are curious, I found the rules Windows Update service uses to decide which proxy server to use.

Note 2: I couldn't find proxycfg utility on my Vista notebook, so I copied it from a Windows Server 2003 machine (look for it in the windows\system32 directory).

Note 3: In the past whenever Microsoft used an online installer, it used to offer also a completely offline installation package as well. If it was true in this case, I could possibly save almost two hours of investigating and trying to install Windows Live Writer.

UPDATE (2007-12-27): I learnt today that proxycfg utility has been displaced in Windows Vista and we should use the netsh utility to configure any proxy settings. Here is how the above mentioned procedure would look when done in netsh:

Run cmd.exe under administrator privileges and type netsh and then winhttp to enter WinHTTP context:


By issuing show proxy command you would see your current proxy settings (direct connection, indeed) and by import proxy ie you import settings from IE:


You may find more information in this Windows Core Networking blog post.


My post zero — about me

by ondrejsv 17. December 2007 18:06

Hello and welcome to my blog. First let me introduce myself — my name is Ondrej Svačina and currently I live and work in Bratislava, the capital of Slovakia, a small country located in the heart of Europe, member of the EU. My official job title reads software architect and I work predominantly with .NET technologies at present.

Nowadays everybody around is constantly blogging about almost everything. As I perceive it "blog or die" or "who doesn't have a blog does not really exist", I finally managed to setup and create a blog of my own. December is a good month to do such things so I can say that I've had a blog since 2007 ;-) More importantly I sometimes have a feeling that I have something to tell the outside world which may be of interest to others. So stay tuned as I am and enjoy reading...