-
Notifications
You must be signed in to change notification settings - Fork 668
DYN-9680 Crash DynamoSettingsXML #16614
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DYN-9680 Crash DynamoSettingsXML #16614
Conversation
When running DynamoSandbox on C:\Dynamo was crashing due that the code was using the method Directory.GetParent() when the result was null (due that there was no two level parent), so I had to add code to make a difference between DynamoSandbox or Dynamo over a host. Then DynamoSettings.xml will be read optionally from C:\ProgramData\Dynamo when using Sandbox and from C:\ProgramData\Autodesk\RVT 2027 when using a host like Revit 2027.
There was a problem hiding this 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-9680
There was a problem hiding this 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 fixes a crash that occurred during Dynamo's first run when installed in C:\Dynamo. The crash was caused by calling Directory.GetParent() on a path that had no valid two-level parent directory. The fix adds conditional logic to distinguish between DynamoSandbox (standalone) and Dynamo running inside a host application (like Revit), ensuring the correct DynamoSettings.xml path is used for each scenario.
Key Changes:
- Added null-safe logic to detect whether Dynamo is running as standalone or within a host application
- Implemented separate path resolution strategies for each execution context
- Fixed the potential null reference exception by using
Environment.SpecialFolder.CommonApplicationDatafor standalone installations
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
reddyashish
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
|
Based in that for creating a unit test for this case we need to consider the next steps:
Then based in the complexity required we decided to not including a test for this case for now. |
|
Thanks @RobertGlobant20 Maybe address the last comment, then LGTM |
Added a try/catch in the code that was crashing so if there is a crash in the future we will log a message in the console with the StackTrace
reddyashish
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Co-authored-by: Aaron (Qilong) <aaron.tang@autodesk.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit fd583dc)
|
Successfully created backport PR for |
Purpose
Fixing crash happening when running Dynamo (located in C:\Dynamo) as First Run
When running DynamoSandbox on C:\Dynamo was crashing due that the code was using the method Directory.GetParent() when the result was null (due that there was no two level parent), so I had to add code to make a difference between DynamoSandbox or Dynamo over a host. Then DynamoSettings.xml will be read optionally from C:\ProgramData\Dynamo when using Sandbox and from C:\ProgramData\Autodesk\RVT 2027 when using a host like Revit 2027.
Declarations
Check these if you believe they are true
Release Notes
Fixing crash happening when running Dynamo (located in C:\Dynamo) as First Run
Reviewers
@QilongTang @zeusongit
FYIs
@jnealb