Sandbox not loading any custom packages, but Dynamo for Revit does

Operating in Dynamo 2.0. Dynamo for Revit packages are functioning fine. When point Dynamo Sandbox to the same location, it cannot load the same packages. If I attempt to load .dlls manually in Sandbox, it will display a dialog box saying the load failed.

Dynamo For Revit with Add-On visible and Console shown.

Dynamo Sandbox with no packages available.
Dynamo%205_21_2018%202_22_04%20PM

Thanks

I partially solved my own problem, though it created another issue. Here is console from Sandbox when some of the packages are not loading. Last 20 lines of code or so.

your package has a dependency on the RevitApi - that is not available in dynamoSandbox only in the Revit process.

This may be a random question. If you place multiple .dll’s in to one package, will Dynamo Sandbox understand that one .dll is RevitAPI dependent and the second can be utilized in the Sandbox? Or do you have to have different packages at that point?

How would one know that some of the packages that they download from the Package Manager are Revit dependent?

Sandbox will recognize custom nodes even if the Revit API is called (clockwork as an example), but zero touch nodes I’m not sure about.

custom nodes that use python an interpreted language - which is executed at runtime will load in sandbox and then those with reliance on the revit api will fail to run.

zero touch dlls that have a dep on the revit api will not load if it is not present, but I think a second zero touch dll in the same package with no dep on the revit api would.

I might try to split the package into two.

I was getting ready to split the package in two (technically three), but thought I would give a go of running a test to confirm everything.

I created a new solution with two projects. The first, ClassLibrary1 has only one .cs in it that returns nothing but a string. The second, ClassLibrary2, is shown in the first screenshot. It is calling and using the RevitAPI. I would have expected this one not to load or return to me in Sandbox a “Failed to load” dialog box. But, it loaded perfectly fine. In the second screenshot, of course it throws an error because there is no Revit Application available to operate with, but still populates the library in the Dynamo Sandbox application.

Is there something that I’m missing with References that are in use and Dependency? In the package, I do not have technically a dependency on another .dll, just references in the Solution Explorer, i.e. no dependency under Project > Project Dependencies …

two potential issues:

  1. you’re actually only calling methods in the dynamo revit dlls, not the revit api directly.
  2. what dlls are you bundling with the package (copy local true)

you might want to read up on .net assembly loading:
something like:

2 Likes

Michael-

I did get two libraries in the same package to load correctly in Dynamo Sandbox and Dynamo for Revit.

It did take awhile of tinkering to get it to work. The only way to get it to work was to rename the Dynamo Sandbox library inside of Visual Studio to be first alphabetically. So, for my package Lightning, it had to be renamed Lightning0WA and Lightning1Revit, therefore the Revit library is added second. Note here I used the 0 and 1 (and potentially two in the future) to automatically sort these. This is important because if the Sandbox library, in this case the Lightning0WA, is loaded second after the Revit library, then the both libraries will fail in Sandbox.

Structure in Windows Explorer:

Dynamo for Revit loads both libraries:

Dynamo Sandbox only loads the one library:

Thanks for the nudge in the right direction. Can/Should we add this to the DynamoWiki?

1 Like

Thanks for reporting it guys, it’s a long standing issue that I have run into myself and just recalled. I will file it if not already. Indeed it is annoying.

Are both of you trying to add multiple node libraries into the same package? Another idea could be to create two packages and add dependencies between the packages instead of 2 libraries with dependencies on each other inside the same package.

1 Like

I did contemplate that. The upsides to two libraries under one package that I can think of at the time was branding and not having to spin up the two libraries to then merge back together. i.e. multiple package names LightningWA, LightningRevit, Lightning or something like all of those to keep up with.

I’m not hung up on the issue of loading order myself. It was just I wanted it to be documented so those that follow, if they wanted to use the same process, could get up and running with an understanding of the process without doing all of the hacking that I did.

1 Like