Clone() for playlist item doesn't work

May 19, 2011 at 7:01 PM

Hello,


I have recently found that CurrentPlaylistItem.Clone() throws an exception: "Delegate to an instance method cannot have null 'this'."

After debugging the source a little bit, found that in PlaylistItem.cs you might have forgot to instantiate CustomMetadata before calling the following code:


playlistItem.CustomMetadata
    .Select(i => i.Clone())
    .ForEach(CustomMetadata.Add);


in  "private PlaylistItem(PlaylistItem playlistItem) { ... }" method.


So, what I did to fix the problem is added one line before the code:

CustomMetadata = new MetadataCollection();

and the whole code is:

CustomMetadata = new MetadataCollection();
playlistItem.CustomMetadata
    .Select(i => i.Clone())
    .ForEach(CustomMetadata.Add);

Coordinator
May 19, 2011 at 7:17 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
May 19, 2011 at 7:19 PM

Thanks for bringing this to my attention. I've applied this fix to the source. It will be included in the next update.

Tim

May 19, 2011 at 7:25 PM

You are welcome :)