Jim Rogers

Lives in Baton Rouge, LA, with two dogs, one cat, and one lovely wife. I'm a lead developer for GCR Incorporated.

Katrin and Jim

Month List

WCF SocketException

by Jim May 14, 2008 12:38 PM

I'm hosting a WCF service in IIS, on the same development machine as the client application. I was getting a delay of several seconds in my service calls, and a little message in my output window:

A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

The framework was just swallowing this exception, and my data come through just fine - except for the delay, that is.

I had to run on the option to break when an exception is thrown (Debug->Exceptions in Visual Studio) in order to get some more details:

System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)

The error code is 10060. But I didn't see anything that helped me understand what was going on, even after digging around in the framework. If it wasn't for the delay, I could "fix" it by just ignoring it, which seems to be Microsoft's solution to these swallowed exceptions.

It turned out that the solution was just to turn off the windows firewall, though I never did figure out exactly what was running into the firewall, or why this didn't prevent the call from succeeding.

Also, if I check the "Enable Just My Code" option in Tools->Options->Debugging, then I get no message whatsoever! An exception is thrown and swallowed by the framework, causing several seconds of delay, but with Visual Studio's default configuration, there is no indication during debugging that anything happened.

Pack URIs in Libraries

by Jim May 13, 2008 5:00 PM

Based on the MSDN documentation on pack URIs, I would expect that code in my library which references a local resource would use the "local assembly" version of the pack URI:

pack://application:,,,/ResourceImage.png

But that's not the case; code that is in the library has to use the "referenced assembly" version of the pack URI, just like code in the main application which uses the library:

pack://application:,,,/ReferencedAssembly;component/ResourceImage.png

So a relative pack URI is supposed to be relative to the code, but an absolute URI is based not on the code's location, but that of the main assembly in which it runs.

I was using a relative URI when my resources and base class were in the application, but when I moved them to the library this no longer worked. This doesn't seem right, since the image and code that referenced it were were still in the same assembly, and MSDN says the following:

By default, a relative pack URI is considered relative to the location of the markup or code that contains the reference.

Tags:

Code

Checking for Unicode Tags

by Jim Mar 08, 2008 9:29 AM

After discovering that unicode MP3 tags confuse my Alltel Hue cell phone's music player, I of course needed to fix the broken files. But I didn't want to figure out which they were by trial and error - we have a big music collection!

I cobbled together some code that I had sitting around, and created a little command-line utility that checks mp3 files to see if the tags are unicode.

If you found this post because you're looking for a solution to the same problem, you might find this useful. It requires .NET 2.0. Use the command-line argument -h for instuctions.

Download MP3Checker.zip

Tags:

Code

Hue Music Player

by Jim Mar 05, 2008 11:12 AM

DSC_0028

One of the cool features of the Alltel Hue phone that Katrin and I have is the built-in music player. I recently started using this and found that some of my mp3 files show gibberish for the album and song information.

After a little research I figured out the source of the problem; the problem files have their tags stored in unicode. The phone can't understand this and shows the wrong  characters.

There are a lot of tools out there for manipulating mp3 tags, but the one I've found that can fix this issue is Mp3tag. I don't have to reload the tag information; just set the appropriate options in the software, open a folder full of music files, and choose the save option from the file menu. The 16-bit tags are overwritten with 8-bit information and the phone can now understand them.

Options

Update: I wrote a little console application to check which files have unicode tags.

Tags:

Code

Project Server Woes

by Jim Feb 18, 2008 7:07 PM

We've got three people working together on a specification, and a master document in Word seemed like the way to go. Once I figured out how to do it in Word 2007's newfangled menus it was easy enough to set that up. (Go to View/Outline, and check out the Master Document section on the Outlining Menu.)

But when the files are uploaded to Project Server, I can't open the master document. Bummer. Looks like this wasn't supported in the past, but I can't find any specifics on the current versions.

Tags:

Code