Feature/screen lift controller updates - #1457
Open
cdenig wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
Selectorbut fall back to portKeywhen 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/InUseTrackermay 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; | ||
| } | ||
| } |
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 improves the robustness and flexibility of routing execution in the
RouteDescriptorclass. 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:
ExecuteRoutes()to use either theSelectororKeyfrom input/output ports, depending on availability, improving compatibility with devices that may not provide a selector.sink.ExecuteSwitchto fall back to using the port key if the selector is null or unsupported, preventing failures with certain devices.nullas an output selector when callingswitchingDevice.ExecuteSwitch.InUseTracker.AddUser) safer by making it null-safe, avoiding potential null reference exceptions.Release route improvements:
ReleaseRoutes()to use a null-conditional operator when accessing the output port selector, preventing exceptions if the output port is missing.