Skip to content

Expose RelatedCurrencyManager.UseParentCurrentChanged to CargoWise + unit tests#32

Draft
Copilot wants to merge 3 commits into
feature/related-currency-manager-parent-changed-hookfrom
copilot/remove-reflection-based-hack
Draft

Expose RelatedCurrencyManager.UseParentCurrentChanged to CargoWise + unit tests#32
Copilot wants to merge 3 commits into
feature/related-currency-manager-parent-changed-hookfrom
copilot/remove-reflection-based-hack

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown

The BindingContext list-manager storage is now a Dictionary<HashKey, WeakReference> in .NET 10, making CargoWise's ZBindingContext reflection hack (which swapped RelatedCurrencyManager's parent event subscription from CurrentItemChangedCurrentChanged) non-viable. The base branch already added the opt-in static RelatedCurrencyManager.UseParentCurrentChanged; this PR wires it up for external consumption and validates it.

Changes

  • AssemblyInfo.cs — Adds a placeholder InternalsVisibleTo("WiseTech.CargoWise") entry so the CargoWise assembly can set RelatedCurrencyManager.UseParentCurrentChanged. Includes a // TODO: comment requiring the real assembly name and strong-name PublicKey= to be confirmed before merge.

  • RelatedCurrencyManager.cs — Expands the XML docs on UseParentCurrentChanged to clarify event semantics (CurrentItemChanged fires on both position changes and item-property edits; CurrentChanged fires only on position changes) and adds a concrete ZBindingContext usage example:

    public class ZBindingContext : BindingContext
    {
        public ZBindingContext()
        {
            // .NET 10 replacement for the old reflection hack
            RelatedCurrencyManager.UseParentCurrentChanged = true;
        }
    }
  • RelatedCurrencyManagerTests.cs (new) — Seven tests covering: default value is false; default mode refreshes child on CurrentItemChanged-only trigger (BindingList.ResetItem); opt-in mode suppresses that refresh; both modes refresh on position change; no double subscription from cache hits; rebind unwires cleanly with no stale subscription. All tests save/restore the process-wide static in try/finally.

Open item

The InternalsVisibleTo entry needs the real CargoWise assembly name and strong-name public key before this is production-ready. A key-less entry (any assembly named WiseTech.CargoWise can access internals) is acceptable only for a draft.

Copilot AI changed the title [WIP] Remove reflection-based hack for CurrencyManager refresh Expose RelatedCurrencyManager.UseParentCurrentChanged to CargoWise + unit tests Jun 19, 2026
Copilot AI requested a review from FahmiFuzi June 19, 2026 21:23
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.

2 participants