Removing extensions from RssItem.Extensions

Topics: Argotic.Extensions
Mar 9, 2009 at 9:35 PM
Edited Mar 9, 2009 at 9:37 PM
Hello,

I keep getting a Null reference exception when attempting to remove an extension from an item that I know happens to contain the extension to be removed.

 

if (item.HasExtensions)
{
    
var oldExtension = item.Extensions.OfType<ITunesSyndicationExtension>().FirstOrDefault();
        
if (oldExtension != null)
            {
                    item.RemoveExtension(oldExtension);
            }
}

The null reference exception is being thrown on the item.RemoveExtension line so the extension is being found (the VS debugger confirms this as well). Is this not the proper method for removing an extension?

Thank you,
Justin