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

DYN-6719 - show warning when installing, and log when loading a package from 2.x in Dynamo 3.x #15083

Merged
merged 8 commits into from
Apr 15, 2024

Conversation

mjkkirschner
Copy link
Member

@mjkkirschner mjkkirschner commented Apr 3, 2024

Purpose

Since packages that were published from Dynamo 1.x or 2.x likely target net framework instead of .NET8 - we'll raise a warning if versions of those packages are installed. At load time, we'll just log some information without alerting the user, this will be useful for devs when inspecting logs - it's possible that a package may load successfully but have strange behavior later.

- [ ] One improvement we could make here is to not raise these warnings for packages that do not contain any .Net binaries. (ie those that only contain dyf files) I was not sure about this, what do reviewers think?

Screenshot 2024-04-12 at 1 34 04 PM

This PR also fixes a really annoying bug where Dynamo's custom message box type had a tooltip show up with no content.

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

show warnings when installing packages into Dynamo 3.x that were published from Dynamo < 3.x

Reviewers

@mjkkirschner mjkkirschner requested review from sm6srw and pinzart90 April 3, 2024 14:54
@mjkkirschner mjkkirschner changed the title DYN-6719 - warnings and logs when installing and loading a package from 2.x in Dynamo 3.x DYN-6719 - show warning when installing, and log when loading a package from 2.x in Dynamo 3.x Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

UI Smoke Tests

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

@pinzart90
Copy link
Contributor

Is there a good way to check if a package or it’s deps have binaries ?

@johnpierson
Copy link
Member

I think this is a good warning to have. However, I would be curious how this would work with something that may be built for net 4.8, but still works. Extensions technically work this way. (This is how monocle and Rhythm load on the fly). And if that warning shows up in my case, that is kind of lousy because the actual DLLs that I write on runtime are built for the correct frameworks.

@mjkkirschner
Copy link
Member Author

Is there a good way to check if a package or it’s deps have binaries ?

kind of - the ContainsBinaries flag on packages is overloaded to mean contains binaries or python nodes. We can check the package once downloaded though.

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Apr 4, 2024

I think this is a good warning to have. However, I would be curious how this would work with something that may be built for net 4.8, but still works. Extensions technically work this way. (This is how monocle and Rhythm load on the fly). And if that warning shows up in my case, that is kind of lousy because the actual DLLs that I write on runtime are built for the correct frameworks.

Hey @johnpierson yep it's a good point, unfortunately AFAIK we can't truly know if a binary targeting .net48 will work correctly on the .net8.0 runtime without doing a lot of inspection for references and even then we might still get it wrong.

I have two suggestions though:

  1. you can use .netstd2.0 as a target instead of .net framework 4.8 for your extension binaries, these should be compatible everywhere and if we move to a smarter check where we look for the target framework version instead of just the dynamo engine publish version you'll pass that too.
  2. If you publish your package from 3.0 then users in 3.0 won't see these warnings - of course then 2.x users will.

@mjkkirschner
Copy link
Member Author

mjkkirschner commented Apr 10, 2024

Primer documentation page is up now but I am trying to find an efficient and safe way to add clickable urls to the message box. It seems we have various ways we're currently doing it throughout the repo for other controls.

turns out Roberto solved this a while ago for guided tour functionality and we can just reuse the custom rich text box control he added there.

@pinzart90
Copy link
Contributor

The only possible improvement I can think of would be for the wording “This package or one… use an older version of dynamo than the one you are using”.
The word “use” could be “was built for” or “targets”. Not sure what would be better

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.

One comment then Lgtm

@hwahlstrom
Copy link
Collaborator

Suggested rephrase of warning message:

Package may not work in this version of Dynamo

This package or one of its dependencies were created for a previous version of Dynamo. It may not work in this version. Do you want to continue?

Learn more

Comment on lines +33 to +36
MessageBoxResult IMessageBox.Show(Window owner, string msg, string title, bool showRichTextBox, MessageBoxButton button, MessageBoxImage img)
{
return DynamoMessageBox.Show(owner,msg, title, showRichTextBox, button, img);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

Copy link
Member Author

Choose a reason for hiding this comment

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

for both the owner and showRichTextBox param.
Since this type and interface are really internal we can probably just delete all these overloads and simplify whenever we want.

Copy link
Member Author

@mjkkirschner mjkkirschner Apr 12, 2024

Choose a reason for hiding this comment

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

ugh well, just to correct this a bit -
the interface is internal, but the MessageBoxService and these Show methods implementing that interface are public - though the whole thing is in DynamoCoreWPF.dll, so I think it requires just a bit more thinking before we refactor this.

@mjkkirschner mjkkirschner merged commit 5cab0ad into DynamoDS:master Apr 15, 2024
22 of 23 checks passed
@mjkkirschner mjkkirschner deleted the dyn-6719 branch April 15, 2024 18:19
mjkkirschner added a commit to mjkkirschner/Dynamo that referenced this pull request Apr 15, 2024
QilongTang pushed a commit that referenced this pull request Apr 16, 2024
* test

* DYN-6719 - show warning when installing, and log when loading a package from 2.x in Dynamo 3.x (#15083)

tests pass - merging.
https://master-15.jenkins.autodesk.com/view/DYN/job/DYN-DevCI_Self_Service/1423/
(filterFrozentest) is marked failure on 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.

6 participants