Skip to content

Unable to Add an ID3.v2 Tag to an MP3 #65

Description

@BourgeoisDirk

Hey, so far this is one of the most convenient ID3 Tag Editors I've come across.
Only thing is, I can't actually Add an ID3 tag to a freshly created MP3.

    _private void ApplyID3Tags(string filepath)
    {
        using (var file = new Mp3(filepath, Mp3Permissions.ReadWrite))
        {
            var tag = file.GetTag(Id3TagFamily.Version2X);
            if (tag == null)
                tag = new Id3Tag();
            
            tag.Title = Title;
            
            if (!file.WriteTag(tag, WriteConflictAction.Replace))
                throw new Exception("Applying ID3 Tags Failed");
        }
    }_

This seems simple enough, but I get this error on the "file.WriteTag()" function at the end: "Sequence contains no matching element"

System.InvalidOperationException
HResult=0x80131509
Message=Sequence contains no matching element
Source=System.Linq
StackTrace:
at System.Linq.ThrowHelper.ThrowNoMatchException()
at Id3.Id3Handler.GetHandler(Id3Version version)
at Id3.Mp3.WriteTag(Id3Tag tag, WriteConflictAction conflictAction)

Any clue as to why I can't add an ID3 tag ?
PS: GetTag() resulted in null, so i added "new Id3Tag()"
Also, "file.AvailableTagVersions" count = 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions