Skip to content

Conversation

@github-actions
Copy link

Cherry-pick of #16621 to RC4.0.0_master

Purpose

Fixes DYN-9604: Unit conversion node quantity dropdown appears blank when opening v1 schema graphs in environments with ASC 2026+ installed.

Background:

When Dynamo graphs are saved without ASC available (using ForgeUnits.Schemas v1.0.4), unit conversion nodes serialize with v1 schema identifiers like autodesk.unit.quantity:length-1.0.5. When these graphs are opened in environments where ASC 2026+ is installed, Dynamo automatically loads v2 schemas from ASC instead of the bundled v1 schemas.

During deserialization, the JSON constructor first populates QuantityConversionSource by calling GetAllQuantities(), which returns only the latest v2 schemas from ASC. Then, when SelectedQuantityConversion is deserialized, Quantity.ByTypeID() is called with the v1 TypeId from the DYN file (e.g., "autodesk.unit.quantity:length-1.0.5"), creating a new Quantity object instance. Since WPF ComboBox SelectedItem binding uses reference equality by default, the deserialized Quantity cannot find a matching instance in the ItemsSource, causing the dropdown to appear blank.

For example, after loading a v1 DYN file:

  • QuantityConversionSource (the ComboBox ItemsSource): [Quantity@0x1234 {TypeId="length-2.0.0"}, ...] - v2 schemas from GetAllQuantities() in the constructor
  • SelectedQuantityConversion (the ComboBox SelectedItem): Quantity@0x5678 {TypeId="length-1.0.5"} - a different instance created by ByTypeID() during JSON deserialization

The ComboBox cannot find a match because the deserialized Quantity has TypeId "length-1.0.5" (v1), but the collection only contains v2 schemas like "length-2.0.0". Even though they represent the same quantity type (Length), the TypeIds don't match.

The same issue affects the from/to unit dropdowns, though they were less visible because the unit sources are populated from the deserialized Quantity's .Units property, which may return units from multiple schema versions.

Solution:

Introduced a reconciliation mechanism that matches deserialized items to their corresponding collection entries by comparing typeName (TypeId without version suffix). This ensures reference equality for WPF binding while maintaining backward compatibility with v1 schemas.

unit-conversion-v1-to-v2

Declarations

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document (N/A - internal changes only)

Release Notes

Fixed an issue where the quantity dropdown in "Convert By Units" nodes would appear blank when opening graphs saved with v1 schemas in environments with ASC 2026+ installed. The node now correctly displays and functions with schema version upgrades.

Reviewers

(Assign appropriate reviewer)

Testing Notes:

  • Tested with graphs saved in non-ASC environments (v1 schemas) opened in ASC 2026+ environments (v2 schemas)
  • Added comprehensive unit tests for the reconciliation logic covering edge cases and null handling
  • Existing unit conversion tests continue to pass

FYIs

(Optional)

@zeusongit zeusongit merged commit ffc468c into RC4.0.0_master Oct 22, 2025
11 of 12 checks passed
@zeusongit zeusongit deleted the cherrypick-16621 branch October 22, 2025 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants