Skip to content

Conversation

@RobertGlobant20
Copy link
Contributor

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

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.
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-9680

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 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.CommonApplicationData for standalone installations

QilongTang and others added 3 commits October 20, 2025 23:23
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>
Copy link
Contributor

@reddyashish reddyashish left a 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

@RobertGlobant20
Copy link
Contributor Author

Based in that for creating a unit test for this case we need to consider the next steps:

  • Setup Dynamo as FirstRun (so no DynamoSettings.xml need to exists)
  • Put Dynamo in a folder in the same level than C:\ drive something like C:\Dynamo
  • Modify the PathManager.CommonDataDirectory (this is a read-only property that is set by the main TestClase like DynamoTestUIBase before creating DynamoModel) also PathManager is a lazy-loading Singleton so once created we cannot edit its properties.
  • The fixed code is in SplashScreen so we need to create a SplashScreen instance.

Then based in the complexity required we decided to not including a test for this case for now.

@QilongTang
Copy link
Contributor

Thanks @RobertGlobant20 Maybe address the last comment, then LGTM

RobertGlobant20 and others added 2 commits October 22, 2025 15:55
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
Copy link
Contributor

@reddyashish reddyashish left a comment

Choose a reason for hiding this comment

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

Looks good

@reddyashish reddyashish added this to the 4.0 milestone Oct 23, 2025
@reddyashish
Copy link
Contributor

@reddyashish reddyashish merged commit fd583dc into DynamoDS:master Oct 23, 2025
25 of 27 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 23, 2025
Co-authored-by: Aaron (Qilong) <aaron.tang@autodesk.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit fd583dc)
@github-actions
Copy link

Successfully created backport PR for RC4.0.0_master:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants