Skip to content

Conversation

@reddyashish
Copy link
Contributor

Purpose

When Dynamo is closed and reopened in D4R, the AvailableEngines collection under PythonEngineManager is not changed so the PythonEngineAdded is never triggered when Dynamo is reopened. This has caused this bug https://jira.autodesk.com/browse/DYN-9082.

So now, when Dynamo is closed, we clear the AvailableEngines collection and add the default python engine back when it s started back. The rest of the python engines, if any, will be loaded from the packages extension.

Declarations

Check these if you believe they are true

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB
  • This PR introduces new feature code involve network connecting and is tested with no-network mode.

Release Notes

[DYN-9082] All Python Engines should be loaded correctly in D4R

Reviewers

@DynamoDS/eidos

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-9082

{
PythonServices.PythonEngineManager.Instance.LoadDefaultPythonEngine(AppDomain.CurrentDomain.GetAssemblies().
FirstOrDefault(a => a != null && a.GetName().Name == PythonServices.PythonEngineManager.CPythonAssemblyName));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

why was this needed?
Aren't we adding the engine from another location?

Copy link
Contributor Author

@reddyashish reddyashish Jul 16, 2025

Choose a reason for hiding this comment

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

The default engine is added only when initializing the PythonEngineManager instance(inside the constructor) and when we cleared AvailableEngines collection, it was not added back. So loading it only when the available engines is still empty after initializing the PythonEngineManager.

Copy link
Contributor

Choose a reason for hiding this comment

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

when we cleared AvailableEngines collection

Where was AvailableEngines being cleared before this change?

loading it only when the available engines is still empty after initializing the PythonEngineManager

I don't understand how the available engines collection can still be empty after initializing the PythonEngineManager on Dynamo startup?

Copy link
Contributor Author

@reddyashish reddyashish Jul 16, 2025

Choose a reason for hiding this comment

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

It was never being cleared before, so when dynamo was reopened in Revit, the AvailableEngines collection is not changed and PythonEngineAdded is not triggered.
When Dynamo is reopened, it still has access to the same PythonEngineManager instance(maybe since it is a static variable and uses lazy loading instance) from before and AvailableEngines are empty.

@zeusongit zeusongit added this to the 3.6 milestone Jul 16, 2025
@zeusongit zeusongit merged commit 4ad6b39 into DynamoDS:master Jul 16, 2025
27 of 29 checks passed
github-actions bot pushed a commit that referenced this pull request Jul 16, 2025
@github-actions
Copy link

Successfully created backport PR for RC3.6.0_master:

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