Skip to content
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

when loading python engines dynamically fail fast #14941

Merged
merged 8 commits into from
Feb 24, 2024

Conversation

mjkkirschner
Copy link
Member

@mjkkirschner mjkkirschner commented Feb 14, 2024

Purpose

When attempting to load python engines dynamically - attempt to load top level dependencies of the assembly containing the PythonEngine so we fail fast in a controlled way (inside a try catch)

I verified this avoids the crash in DynamoRevit in 2.19.x so if we do a release there we can back port this change.

In addition these crashes no longer occur with the new packages (in old Dynamo versions) because .NetFramework4.8 cannot load the assembly load context types - so it fails even earlier when the extension Ready call is made so in either case partially working Python engines are no longer added to the AvailableEngines collection

Also updates MLC and System.Collections.Immutable packages to net8 versions.

image

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • 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
  • All tests pass using the self-service CI.
  • 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

Release Notes

(FILL ME IN) Brief description of the fix / enhancement. Mandatory section

Reviewers

(FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR)

(FILL ME IN, optional) Any additional notes to reviewers or testers.

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

Copy link

github-actions bot commented Feb 14, 2024

UI Smoke Tests

Test: success. 2 passed, 0 failed.
TestComplete Test Result
Workflow Run: UI Smoke Tests
Check: UI Smoke Tests - net8.0

@@ -157,7 +157,7 @@
<PackageReference Include="SharpDX.Direct3D9" Version="4.2.0" />
<PackageReference Include="SharpDX.DXGI" Version="4.2.0" />
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="6.0.0" />
<PackageReference Include="System.Reflection.MetadataLoadContext" Version="8.0.0" />
Copy link
Contributor

Choose a reason for hiding this comment

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

why bump up the version ?
ANy issues compatibility issues with hosts ? Need to update licensing ?
Will it cause issues if we cherry pick this in 2.19.5 ?

Copy link
Member Author

@mjkkirschner mjkkirschner Feb 22, 2024

Choose a reason for hiding this comment

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

  1. why use an old version?
  2. I don't think so, I can look at Revit, but I think aligning on the .net8 version makes the most sense and avoids conflicts with other packages, like meta data load context net8 and system collections immutable.
  3. I don't think we should cherry pick this.

Copy link
Member Author

@mjkkirschner mjkkirschner Feb 22, 2024

Choose a reason for hiding this comment

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

@pinzart90 WRT to licensing were your steps for regenerating the license sheets documented somewhere in the release process wiki? - I can't find them atm.

Copy link
Member Author

Choose a reason for hiding this comment

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

WRT Revit - they have removed their use of MLC - only RTF is using it currently.

Copy link
Contributor

Choose a reason for hiding this comment

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

Regarding the license, I was thinking we shoul just update the about box stuff. The dependency reports can be postponed

Copy link
Contributor

@pinzart90 pinzart90 left a comment

Choose a reason for hiding this comment

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

Lgtm

@pinzart90
Copy link
Contributor

Should we specify this new requirement to the documentation somewhere ?

@mjkkirschner
Copy link
Member Author

Should we specify this new requirement to the documentation somewhere ?

Hmm - I think anyone writing a PythonEngine would likely look at the base class they have to inherit from - so I will add a comment to that base class summary.

@mjkkirschner mjkkirschner merged commit d01a151 into DynamoDS:master Feb 24, 2024
19 of 22 checks passed
@mjkkirschner mjkkirschner deleted the failearly branch February 24, 2024 01:13
mjkkirschner added a commit that referenced this pull request Feb 24, 2024
@mjkkirschner mjkkirschner restored the failearly branch February 24, 2024 01:18
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.

2 participants