Skip to content

Conversation

@BogdanZavu
Copy link
Contributor

@BogdanZavu BogdanZavu commented Nov 17, 2025

Purpose

Handle invalid input. The context here is that the Assistant can push invalid values sometimes ( e.g. when trying to set a Revit category ).

Declarations

Check these if you believe they are true

Release Notes

N/A

Reviewers

@DynamoDS/synapse

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9845

@johnpierson johnpierson requested a review from Copilot November 21, 2025 18:20
Copy link
Contributor

Copilot AI left a comment

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 adds input validation to prevent exceptions when parsing invalid index values in dropdown nodes. The change addresses an issue where the Dynamo Assistant can occasionally push invalid values (such as when setting Revit categories), which previously caused Convert.ToInt32 to throw an exception.

Key Changes:

  • Replaced Convert.ToInt32 with int.TryParse to safely handle invalid string inputs without throwing exceptions

{
var tempIndex = Convert.ToInt32(index);
if (!int.TryParse(index, out int tempIndex))
{
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The early return when parsing fails should be documented with a comment explaining why the current selectedIndex is preserved for invalid inputs. This helps clarify the intended behavior when the Assistant pushes invalid values.

Suggested change
{
{
// If parsing fails, return the current selectedIndex (-1 by default).
// This preserves the current selection for invalid inputs, such as when the Assistant pushes invalid values.

Copilot uses AI. Check for mistakes.
Copy link
Member

@johnpierson johnpierson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good to me. with a rebase it should be good.

@BogdanZavu BogdanZavu merged commit acd8948 into DynamoDS:master Nov 24, 2025
26 of 27 checks passed
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