Skip to content

Fix unresolved-any converter re-entry during style computation - #244

Merged
FlorianRappl merged 1 commit into
AngleSharp:develfrom
sebastienros:sebros/composite-converter-recursion
Sep 7, 2026
Merged

Fix unresolved-any converter re-entry during style computation#244
FlorianRappl merged 1 commit into
AngleSharp:develfrom
sebastienros:sebros/composite-converter-recursion

Conversation

@sebastienros

Copy link
Copy Markdown
Contributor

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Description

ComputeCurrentStyle() stack-overflows on a plain <div style='translate: 1px'></div>. The same issue affects rotate and scale: their composite converters accept opaque tokens through an Any arm, then CssAnyValue.Compute recursively recomputes the returned CssAnyValue through the same converter. No JavaScript or custom-property cycle is needed; the re-entry predates #242.

After checking that conversion consumed the complete input, return an accepted CssAnyValue directly. Concrete results still compute normally, and direct Any / missing-converter IsResolved behavior remains unchanged. This is a computation-boundary fix, not a property-specific workaround; #242's custom-property resolution and cycle handling are untouched.

Fixes: #243

Regression coverage includes translate 1/2/3-component forms, percentages and zero, rotate/scale and none, nested composite converters, concrete unit/calc conversion, invalid/trailing input, exception propagation, render-tree and specified-style compatibility, substitution, inheritance, and missing/cyclic variable fallback behavior.

Validation

  • Exact native repro with AngleSharp 1.8.0 and published AngleSharp.Css 1.1.0, plus unmodified devel source: process stack overflow before the fix. Fixed source and a uniquely versioned local diagnostic package both print 1px on .NET 8 and .NET 10.
  • Focused suites: 140 passed on each runtime.
  • Full suites: 2,269 passed on each runtime, both with the default AngleSharp dependency and with AngleSharp 1.8.0.
  • Release library builds for netstandard2.0, net8.0, and net10.0 passed without warnings or errors. Final validation used SDK 10.0.400; .NET 10 tests used -p:TargetFrameworks=net10.0 -p:RestoreEnablePackagePruning=false without changing project manifests.

Scope

Existing individual-transform Any grammars remain permissive and retain token serialization; this does not add grammar validation, browser-style unit normalization, or transform layout. Windows-only net462/net472 targets were not exercised on macOS. No public API, dependency, or package-version changes are included.

Return an accepted opaque value instead of recursively computing it through the same composite converter. Preserve complete-input validation, concrete computation, and direct Any resolution semantics.

Cover individual transforms, nested composite converters, variable substitution, inheritance, invalid values, and custom-property cycles.

Fixes AngleSharp#243

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@FlorianRappl FlorianRappl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@FlorianRappl
FlorianRappl merged commit d4e41f2 into AngleSharp:devel Sep 7, 2026
5 checks passed
@FlorianRappl FlorianRappl added this to the v1.1.1 milestone Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComputeCurrentStyle stack-overflows for translate values through CssAnyValue converter re-entry

2 participants