Skip to content

fix: resolve IronPython version showing Unknown in output window#3262

Merged
tay0thman merged 1 commit intodevelopfrom
tay0thman-fix-ipy-version-unknown
Apr 5, 2026
Merged

fix: resolve IronPython version showing Unknown in output window#3262
tay0thman merged 1 commit intodevelopfrom
tay0thman-fix-ipy-version-unknown

Conversation

@tay0thman
Copy link
Copy Markdown
Contributor

ReadIPYVersion() searched wrong paths (bin/IPY342/) instead of the actual layout (bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/), and only checked for "IronPython.dll" — missing the IPY2712PR variant named "pyRevitLabs.IronPython.dll".

Fix: use correct directory structure with netcore/netfx and engines segments, and check both DLL name variants in each candidate directory.

ReadIPYVersion() had three bugs:

  1. Searched wrong paths (bin/IPY342/) instead of the actual layout
    (bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/)
  2. Only checked for "IronPython.dll" — missing the IPY2712PR variant
    named "pyRevitLabs.IronPython.dll"
  3. Checked the executing assembly directory last instead of first,
    reporting the wrong engine version when multiple engines are present

Fix: check the active engine directory first (Assembly.GetExecutingAssembly
sits alongside the active IronPython DLL), use correct bin/ layout for
fallback paths, and check both DLL name variants.
"@

@tay0thman tay0thman force-pushed the tay0thman-fix-ipy-version-unknown branch from 3d0ffb0 to a0f3f29 Compare April 4, 2026 09:50
@tay0thman
Copy link
Copy Markdown
Contributor Author

@devloai Go ahead and conduct your review.

Copy link
Copy Markdown
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

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

PR Summary:

Fixes ReadIPYVersion() in EnvDictionarySeeder.cs which was reporting "Unknown" for IronPython version in the output window. The old code searched incorrect paths (bin/IPY342/ instead of bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/) and only checked IronPython.dll, missing the IPY2712PR variant pyRevitLabs.IronPython.dll.

Review Summary:

The path structure fix is correct and well-supported by Directory.Build.targets$(PyRevitEnginesDir) resolves to bin/{netcore|netfx}/engines/, confirming the new candidate paths are accurate. Adding both DLL name variants is also the right call.

However, one stated fix didn't land: the PR description claims bug #3 ("executing assembly checked last") was corrected, but selfDir is still appended after all 4 repo candidate dirs in the implementation. This means a different engine's DLL found in the repo layout will still win over the active engine — the exact regression the PR aimed to address. The review checklist also flags silent catch blocks in startup lookup paths as problematic for diagnosability.

Suggestions

  • Move selfDir to the front of candidateDirs so the active engine's version is always reported first. Apply
  • Add unit tests for ReadIPYVersion() covering selfDir-first resolution and both DLL name variants. Apply

@devloai
Copy link
Copy Markdown
Contributor

devloai bot commented Apr 4, 2026

Review already submitted above (posted simultaneously with your request) — see the review comment for the full breakdown. TL;DR:

  • ✅ Path structure fix is correct (bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/)
  • ✅ Checking both DLL name variants is the right call
  • 🔴 Bug: selfDir is still appended last despite the PR claiming bug allow customization of assembly dll folder to any name under any folder #3 ("exec assembly checked last") was fixed — it needs to move to the front of candidateDirs
  • Code smell: Empty catch in a startup lookup path makes future "Unknown" regressions undiagnosable

ReadIPYVersion() had three bugs:
1. Searched wrong paths (bin/IPY342/) instead of the actual layout
   (bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/)
2. Only checked for "IronPython.dll" — missing the IPY2712PR variant
   named "pyRevitLabs.IronPython.dll"
3. Checked the executing assembly directory last instead of first,
   reporting the wrong engine version when multiple engines are present

Fix: check the active engine directory first (Assembly.GetExecutingAssembly
sits alongside the active IronPython DLL), use correct bin/ layout for
fallback paths, check both DLL name variants, and add Trace.WriteLine
to the catch block for diagnosability.
@tay0thman tay0thman force-pushed the tay0thman-fix-ipy-version-unknown branch from a0f3f29 to a07d029 Compare April 4, 2026 09:57
@tay0thman
Copy link
Copy Markdown
Contributor Author

@devloai pushed a new commit, please review according to the above.

Copy link
Copy Markdown
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

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

Re-review after latest commit

All three bugs and the code smell flagged in the previous review are now addressed:

  • Bug #1 fixed: Path structure corrected to bin/{netcore|netfx}/engines/{IPY342|IPY2712PR}/
  • Bug #2 fixed: Both IronPython.dll and pyRevitLabs.IronPython.dll are now checked
  • Bug #3 fixed: selfDir (active engine directory) is now added first to candidateDirs — active engine version wins
  • Code smell fixed: catch block now logs via Trace.WriteLine instead of silently swallowing exceptions

No further issues found. LGTM 🚀

@romangolev
Copy link
Copy Markdown
Member

Hi @tay0thman I don't like this sort of relative imports that we use now, but I believe that with the architecture we use there is not so much of a choice! Anyways, thanks for patching it out. Letting it through

@tay0thman tay0thman merged commit 6525914 into develop Apr 5, 2026
@tay0thman tay0thman deleted the tay0thman-fix-ipy-version-unknown branch April 5, 2026 06:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

📦 New work-in-progress (wip) builds are available for 6.3.0.26095+0645-wip

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

📦 New public release are available for 6.3.0.26095+0830

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