Url format exception

Sep 12, 2012 at 8:06 PM

I get Url exception at ShoutcastStreamInformation.cs line 158.

            if (headers.TryGetValue(ShoutcastStreamInformation.IcyUrl, out value))            {

this.Url = new Uri(value); // here value comes from the stream:


shoutcast stream :; stream.mp3

Jan 17, 2014 at 10:40 AM
I had the same problem. It happens because the Stream URL: field is there but has an empty value. So no exception is thrown as the TryGetValue still finds the key, however as the value is null an exception is thrown when the URL gets created.

The fix is simple:-

if (headers.TryGetValue(ShoutcastStreamInformation.IcyUrl, out value))
            if (!string.IsNullOrEmpty(value))
                this.Url = new Uri(value);