Conversation
…asses Instead of the misleading 'Invalid css selector syntax' error, throw NotSupportedException with a descriptive message when an unrecognized CSS pseudo-class or pseudo-element (e.g. :nth-child, :first-child) is encountered. This makes it clear the syntax is valid CSS but not yet implemented in FSharp.Data's CSS selector engine. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
✅ Pull request created: #1613 |
|
🤖 This is an automated comment from Repo Assist. CI Status UpdateLinux ✅ passed — all tests pass on Ubuntu. Windows ❌ failed — this failure is not caused by the changes in this PR. The failing test is:
The test is failing because the local ASP.NET Core Kestrel test server can't bind to The fix in this PR (throwing
Warning
|
Add entries for: - #1613: CSS pseudo-class NotSupportedException fix (#1383) - #1617: ConvertDateTimeOffset xs:dateTime fallback fix (#1437) - #1618: Microsoft.Build security bump - #1619: XmlProvider EmbeddedResource GetSchema fix (#1310) - #1621: StrictBooleans parameter for CsvProvider - #1625: CsvProvider.InferRows multiline quoted field fix (#1439) - #1626: XSD group reference cycle guard (#1419) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 This is an automated PR from Repo Assist, an AI assistant.
Closes #1383
Root Cause
When
HtmlDocument.CssSelectencounters a CSS pseudo-class or pseudo-element that is not implemented (e.g.:nth-child(1),:first-child,:not()), the tokenizer falls through to the generic catch-all case and throws a genericSystem.Exceptionwith message"Invalid css selector syntax (char ':' at offset 0)". This message is misleading — the syntax is valid CSS, it's just not yet supported by FSharp.Data's CSS selector engine.Fix
Added a specific case for the
:character in the tokenizer (after all the recognised pseudo-class patterns) that reads the pseudo-class name and throwsNotSupportedExceptionwith a clear, actionable message pointing to the documentation.Before:
Trade-offs
NotSupportedExceptionis a more appropriate exception type thanExceptionfor a known limitation.Test Status
dotnet buildsucceeded (0 warnings relating to this change, 0 errors)dotnet fantomas --check)