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.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9680
There was a problem hiding this comment.
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 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
|
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
Co-authored-by: Aaron (Qilong) <[email protected]> Co-authored-by: Copilot <[email protected]> (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