Skip to content

Conversation

@github-actions
Copy link

Cherry-pick of #16651 to RC4.0.0_master

Purpose

🐛 Bug Fix: Resolves an Assembly.LoadFrom exception when loading DynamoInstallDetective.dll in DynamoRevit scenarios.

Problem: When DynamoUnits attempts to dynamically load DynamoInstallDetective.dll to discover ASC (Autodesk Single Sign-On Client) unit schema paths, it fails in DynamoRevit with the error:

Could not load file or assembly 'DynamoInstallDetective, Version=4.0.0.2941, Culture=neutral, PublicKeyToken=null'.
Assembly with same name is already loaded

Root Cause: DynamoRevit loads DynamoInstallDetective.dll at startup, but DynamoUnits was attempting to load it again using Assembly.LoadFrom(). When .NET detects an assembly with the same name already loaded but with a different version or location, it throws an exception.

Solution: Check if DynamoInstallDetective is already loaded in the current AppDomain before attempting to load it. This allows the code to:

  • ✅ Use the already-loaded assembly in DynamoRevit scenarios
  • ✅ Load from disk in standalone DynamoSandbox scenarios
  • ✅ Gracefully handle both deployment contexts

Declarations

Check these if you believe they are true

Release Notes

Fixed assembly loading exception in DynamoRevit when DynamoUnits attempts to discover ASC unit schema paths. The fix checks if DynamoInstallDetective.dll is already loaded in the AppDomain before attempting to load it, preventing version conflicts between host applications and the DynamoUnits library.

Screenshots

✅ DynamoSandbox - Working

DynamoSandbox successfully loads DynamoInstallDetective.dll from disk and discovers ASC unit schemas

asc-dynamo-sandbox

✅ DynamoRevit - Working

DynamoRevit successfully uses the already-loaded DynamoInstallDetective assembly without conflicts

asc-dynamo-revit

Testing

  • ✅ Verified in standalone DynamoSandbox.exe
  • ✅ Verified in Dynamo for Revit Preview Release
  • ✅ Confirmed no exceptions thrown in either scenario
  • ✅ ASC unit schema discovery works correctly in both contexts

Reviewers

(FILL ME IN) Reviewer 1

Note to Reviewers: This is a defensive fix that improves robustness when DynamoUnits is used in different host application contexts. The change is backward compatible and doesn't affect the public API.

FYIs

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

@QilongTang QilongTang merged commit e24373f into RC4.0.0_master Oct 27, 2025
9 checks passed
@QilongTang QilongTang deleted the cherrypick-16651 branch October 27, 2025 20:12
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.

3 participants