Skip to content

Commit 7204ba4

Browse files
committed
Remove obsolete APIs and add public API snapshot testing
- Remove MusicIpId property (MusicIP service discontinued, use AcoustID) - Remove AiffFile.TryParse (superseded by TryRead) - Add PublicApiGenerator snapshot tests to catch breaking changes - Add Verify.MSTest for snapshot verification
1 parent 55a81e4 commit 7204ba4

File tree

10 files changed

+3321
-111
lines changed

10 files changed

+3321
-111
lines changed

Directory.Packages.props

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
<Project>
2-
3-
<PropertyGroup>
4-
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5-
</PropertyGroup>
6-
7-
<ItemGroup>
8-
<!-- Polyfills for older frameworks -->
9-
<PackageVersion Include="System.Memory" Version="4.6.3" />
10-
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
11-
<PackageVersion Include="IndexRange" Version="1.1.0" />
12-
<PackageVersion Include="Nullable" Version="1.3.1" />
13-
14-
<!-- Testing -->
15-
<PackageVersion Include="MSTest" Version="4.0.2" />
16-
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
17-
</ItemGroup>
18-
19-
</Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<!-- Polyfills for older frameworks -->
7+
<PackageVersion Include="PublicApiGenerator" Version="11.5.4" />
8+
<PackageVersion Include="System.Memory" Version="4.6.3" />
9+
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
10+
<PackageVersion Include="IndexRange" Version="1.1.0" />
11+
<PackageVersion Include="Nullable" Version="1.3.1" />
12+
<!-- Testing -->
13+
<PackageVersion Include="MSTest" Version="4.0.2" />
14+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
15+
<PackageVersion Include="Verify.MSTest" Version="31.9.3" />
16+
</ItemGroup>
17+
</Project>

src/TagLibSharp2/Aiff/AiffFile.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,6 @@ public static bool TryRead (ReadOnlySpan<byte> data, out AiffFile? file)
175175
public static bool TryRead (BinaryData data, out AiffFile? file) =>
176176
TryRead (data.Span, out file);
177177

178-
/// <summary>
179-
/// Attempts to parse an AIFF file from binary data.
180-
/// </summary>
181-
/// <param name="data">The file data.</param>
182-
/// <param name="file">The parsed file, or null if parsing failed.</param>
183-
/// <returns>True if parsing succeeded; otherwise, false.</returns>
184-
[Obsolete ("Use TryRead instead.")]
185-
public static bool TryParse (BinaryData data, out AiffFile? file) =>
186-
TryRead (data.Span, out file);
187-
188178
/// <summary>
189179
/// Reads an AIFF file from binary data with detailed error information.
190180
/// </summary>

src/TagLibSharp2/Core/Tag.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -915,17 +915,6 @@ public virtual string? MusicBrainzReleaseArtistId {
915915
/// </remarks>
916916
public virtual string? AmazonId { get => null; set { } }
917917

918-
/// <summary>
919-
/// Gets or sets the MusicIP PUID (Portable Unique Identifier).
920-
/// </summary>
921-
/// <remarks>
922-
/// <b>Obsolete:</b> MusicIP service was discontinued. Use AcoustID fingerprints instead.
923-
/// This property is maintained for compatibility with legacy tagged files.
924-
/// Not all tag formats support this field. Default implementation returns null.
925-
/// </remarks>
926-
[System.Obsolete ("MusicIP PUID is obsolete. MusicIP service was discontinued. Use AcoustID fingerprints instead.")]
927-
public virtual string? MusicIpId { get => null; set { } }
928-
929918
/// <summary>
930919
/// Gets or sets the roles of the performers.
931920
/// </summary>

src/TagLibSharp2/Id3/Id3v2/Id3v2Tag.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -867,13 +867,6 @@ public override string? AmazonId {
867867
set => SetUserText ("ASIN", value);
868868
}
869869

870-
/// <inheritdoc/>
871-
[System.Obsolete ("MusicIP PUID is obsolete. MusicIP service was discontinued. Use AcoustID fingerprints instead.")]
872-
public override string? MusicIpId {
873-
get => GetUserText ("MusicIP PUID");
874-
set => SetUserText ("MusicIP PUID", value);
875-
}
876-
877870
/// <inheritdoc/>
878871
public override string? AcoustIdId {
879872
get => GetUserText ("ACOUSTID_ID");

src/TagLibSharp2/Xiph/VorbisComment.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -629,13 +629,6 @@ public override string? AmazonId {
629629
set => SetValue ("ASIN", value);
630630
}
631631

632-
/// <inheritdoc/>
633-
[System.Obsolete ("MusicIP PUID is obsolete. MusicIP service was discontinued. Use AcoustID fingerprints instead.")]
634-
public override string? MusicIpId {
635-
get => GetValue ("MUSICIP_PUID");
636-
set => SetValue ("MUSICIP_PUID", value);
637-
}
638-
639632
/// <inheritdoc/>
640633
public override string? AcoustIdId {
641634
get => GetValue ("ACOUSTID_ID");

tests/TagLibSharp2.Tests/Id3/Id3v2/Id3v2TagExtendedMetadataTests.cs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -702,35 +702,6 @@ public void MusicBrainzRecordingId_RoundTrip_PreservesValue ()
702702
Assert.AreEqual ("deadbeef-1234-5678-90ab-cdef12345678", result.Tag!.MusicBrainzRecordingId);
703703
}
704704

705-
// ===========================================
706-
// MusicIpId (Obsolete)
707-
// ===========================================
708-
709-
#pragma warning disable CS0618 // Type or member is obsolete
710-
[TestMethod]
711-
public void MusicIpId_GetSet_Works ()
712-
{
713-
var tag = new Id3v2Tag (Id3v2Version.V24);
714-
715-
tag.MusicIpId = "f3b89eb0-c53d-4a0c-b4e8-1a0b9c3e2d4f";
716-
717-
Assert.AreEqual ("f3b89eb0-c53d-4a0c-b4e8-1a0b9c3e2d4f", tag.MusicIpId);
718-
Assert.AreEqual ("f3b89eb0-c53d-4a0c-b4e8-1a0b9c3e2d4f", tag.GetUserText ("MusicIP PUID"));
719-
}
720-
721-
[TestMethod]
722-
public void MusicIpId_RoundTrip_PreservesValue ()
723-
{
724-
var original = new Id3v2Tag (Id3v2Version.V24) { MusicIpId = "a1b2c3d4-e5f6-7890-abcd-ef1234567890" };
725-
726-
var rendered = original.Render ();
727-
var result = Id3v2Tag.Read (rendered.Span);
728-
729-
Assert.IsTrue (result.IsSuccess);
730-
Assert.AreEqual ("a1b2c3d4-e5f6-7890-abcd-ef1234567890", result.Tag!.MusicIpId);
731-
}
732-
#pragma warning restore CS0618
733-
734705
// ===========================================
735706
// PerformersRole (TMCL frame) Tests
736707
// ===========================================
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2025 Stephen Shaw and contributors
2+
3+
using PublicApiGenerator;
4+
5+
namespace TagLibSharp2.Tests.PublicApi;
6+
7+
[TestClass]
8+
[TestCategory ("Unit")]
9+
[TestCategory ("PublicApi")]
10+
public class PublicApiTests : VerifyBase
11+
{
12+
[TestMethod]
13+
public Task PublicApi_HasNotChanged ()
14+
{
15+
var assembly = typeof (TagLibSharp2.Core.BinaryData).Assembly;
16+
17+
var options = new ApiGeneratorOptions {
18+
ExcludeAttributes = [
19+
"System.Runtime.Versioning.TargetFrameworkAttribute",
20+
"System.Reflection.AssemblyMetadataAttribute",
21+
"System.Runtime.CompilerServices.InternalsVisibleToAttribute"
22+
]
23+
};
24+
25+
var publicApi = assembly.GeneratePublicApi (options);
26+
27+
var settings = new VerifySettings ();
28+
settings.UseDirectory ("Snapshots");
29+
settings.UseFileName ("TagLibSharp2.PublicApi");
30+
31+
return Verify (publicApi, settings);
32+
}
33+
}

0 commit comments

Comments
 (0)