Repository navigation
Closed
Labels
bugSomething isn't working
Description
What's wrong
Since #334 / PR #407, an ISBN-13 has to start with 978 or 979:
Semantics/Semantics.Strings.Identifiers/IsIsbnAttribute.cs
Lines 64 to 80 in 3c0cea7
| private static bool IsValidIsbn13(string s) | |
| { | |
| // An ISBN-13 is an EAN-13 in the Bookland range; any other prefix is a non-book barcode. | |
| if (!s.StartsWith("978", StringComparison.Ordinal) && !s.StartsWith("979", StringComparison.Ordinal)) | |
| { | |
| return false; | |
| } | |
| int sum = 0; | |
| for (int i = 0; i < 13; i++) | |
| { | |
| char c = s[i]; | |
| if (c is < '0' or > '9') | |
| { | |
| return false; | |
| } | |
But 979-0 is not an ISBN range. It is the prefix of the International Standard Music Number (ISMN), which identifies printed music: since 2008 every ISMN is a 13-digit EAN beginning 9790. ISBNs are allocated under 979 only from 979-8 and 979-1x. An ISMN carries a valid EAN-13 check digit, so it passes as an Isbn. This is the same kind of bug #334 fixed, a non-book code accepted on its prefix alone.
Reproduction (net10.0, HEAD 3c0cea7)
Isbn.TryCreate("979-0-2600-0043-8", out _); // true -> "9790260000438" (an ISMN for a printed score)
Isbn.TryCreate("9790060115615", out _); // true (an ISMN)Suggested fix / acceptance criteria
- In
IsValidIsbn13, reject values starting with9790, while keeping978and the other979prefixes. - Update the XML docs on
IsbnandIsIsbnAttribute, and the rules table in the package README. - Tests in
IsbnTests: the two ISMNs above failCreate/TryCreate, and979-10-90636-07-1still validates.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
matt-edmondson commentedon Oct 18, 2026
Triage
Isbnaccepts a real class of non-book EAN-13 codes (ISMNs,9790…). Nothing crashes, but values that should be rejected get through. The fix is a single prefix check plus docs and tests.IsIsbnAttribute.IsValidIsbn13). Tests go inIsbnTests. Also update the package README's rules table.Isbnaccepts any EAN-13 barcode:Isbn.Create("4006381333931")(a non-book product code) validates because the 978/979 prefix is never checked #334 (closed), which added the 978/979 prefix check but left the979-0ISMN range open.Generated by Claude Code