Add netstandard2.0 support for Roslyn analyzer hosting and tests - #29
Merged
Conversation
Add a netstandard2.0 target to the model, contracts, layout, and SVG packages so they can be referenced from a Roslyn analyzer or source generator, which the compiler loads into a netstandard2.0 context. The raster package is excluded because it depends on SkiaSharp's native assets. Rather than adding compatibility shims or conditional compilation, the few call sites that used .NET Core-only APIs are rewritten so the same code compiles and behaves identically on every target framework: - SvgRenderer drops the redundant CultureInfo argument from its StringBuilder interpolation calls. Every hole was already an invariant-formatted string, except sweep, which is now a string. It also drops StringComparison.Ordinal from Replace calls, which is the default for the two-argument overload. - OrthogonalEdgeRouter uses a new engine-owned MinHeap in place of PriorityQueue. MinHeap mirrors the framework four-ary heap exactly, so tied states are expanded in the same order on every target. - HashCode.Combine and Array.Fill are replaced with inline equivalents. Three unstable List<T>.Sort calls are replaced with stable ordering so tie order no longer depends on the host runtime. The four test projects gain a Windows-only net481 target, which binds the suite to the netstandard2.0 assets and provides the evidence for Rendering-Platform-NetStandard20. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces support for the
netstandard2.0target to the rendering model, abstractions, layout engine, and SVG renderer packages, enabling them to be used within Roslyn analyzers and source generators. It also ensures deterministic behavior across all supported frameworks by replacing unstable sorts with stable ordering in key algorithms, and documents these changes and their motivations throughout the codebase and documentation. Additionally, it introduces a customMinHeapimplementation for consistent routing and updates platform requirements and verification documentation accordingly.Platform and Targeting Support
netstandard2.0as a target framework in the project files forDemaConsulting.Rendering.AbstractionsandDemaConsulting.Rendering.Layout, enabling use in Roslyn analyzers and source generators. [1] [2]README.mdto clarify which packages supportnetstandard2.0, the rationale for this, and that the raster renderer is excluded due to native dependencies. [1] [2] [3] [4] [5] [6]Determinism and Stable Ordering
Sortwith stableOrderByin algorithms (e.g., connector label placement, crossing minimization, long edge joining) to ensure identical results across .NET Core and .NET Framework. [1] [2] [3]Array.Fillto explicit loops for compatibility withnetstandard2.0. [1] [2]Engine and Implementation Details
MinHeapimplementation for the orthogonal edge router, ensuring a single, deterministic priority queue across all frameworks.MinHeapfile for review tracking. (.reviewmark.yaml)Verification and Requirements
netstandard2.0support in rendering components to the requirements YAML and verification documentation. [1] [2] [3]These changes collectively ensure that the rendering libraries are compatible with Roslyn analyzers, behave deterministically across all supported .NET targets, and have clear documentation and verification for these guarantees.