Skip to content

Feature/screen lift controller updates - #1457

Open
cdenig wants to merge 2 commits into
mainfrom
feature/screenLiftController-updates
Open

Feature/screen lift controller updates#1457
cdenig wants to merge 2 commits into
mainfrom
feature/screenLiftController-updates

Conversation

@cdenig

@cdenig cdenig commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This pull request improves the robustness and flexibility of routing execution in the RouteDescriptor class. The main changes introduce better handling of input and output selectors, add error handling for device-specific quirks, and ensure safer usage tracking. These updates help prevent exceptions and support devices with incomplete or non-standard selector information.

Routing execution improvements:

  • Updated ExecuteRoutes() to use either the Selector or Key from input/output ports, depending on availability, improving compatibility with devices that may not provide a selector.
  • Added error handling around sink.ExecuteSwitch to fall back to using the port key if the selector is null or unsupported, preventing failures with certain devices.
  • Enhanced handling for routes without an explicit output port by allowing null as an output selector when calling switchingDevice.ExecuteSwitch.
  • Made usage tracking (InUseTracker.AddUser) safer by making it null-safe, avoiding potential null reference exceptions.

Release route improvements:

  • Updated ReleaseRoutes() to use a null-conditional operator when accessing the output port selector, preventing exceptions if the output port is missing.

Copilot AI 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.

Pull request overview

This PR updates RouteDescriptor routing execution/release logic to be more resilient when routing devices expose missing or non-standard port selectors, and to reduce routing-related null reference failures during usage tracking and route release.

Changes:

  • Prefer port Selector but fall back to port Key when selectors are missing for input/output switching.
  • Add a retry path for sink-style switching to fall back to port key when selector-based switching throws.
  • Make usage tracking and release routing safer when OutputPort/InUseTracker may be null.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try
{
switchingDevice.ExecuteSwitch(null, route.OutputPort.Selector, SignalType);
switchingDevice.ExecuteSwitch(null, route.OutputPort?.Selector, SignalType);
Comment on lines +103 to +114
catch (Exception)
{
// Some devices expose null/unsupported selectors but can switch by port key.
if (route.InputPort?.Key != null && !Equals(inputSelector, route.InputPort.Key))
{
sink.ExecuteSwitch(route.InputPort.Key);
}
else
{
throw;
}
}
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.

3 participants