sabato, ottobre 08, 2016

Temporary Dynamo Panic

Picture this scene in your mind: you are at the customer office, you are about to give the best you have got for the very last day of a so far very successful workshop, you click on the Dynamo icon in Revit 2017 and that's what appear before you:


Computers uh? ok, let's try one more time... nothing, same message, let's try sandbox.. it doesn't even show up, let's reboot... nothing, let's uninstall clean and reinstall... nothing, let's uninstall all the Dynamo versions you could possibly find..., let's upgrade to the latest version... let's try a different version of Revit, 2016, 2015... nothing, nothing, nothing!!!

There must be something on Dynamo Forum that explains how to solve this, right? well guess what.. nothing there. Ok let's ask Google... same as above.

"The file exists", over and over the same message!

What file? What are you talking about? Why are you messing up with me? Why this window does have no title?!?!??

Can you feel that uncomfortable sensation growing inside? and when the workshop is over you think of all the other projects where you absolutely need Dynamo to work as you are running out of options,  plus it is the weekend so you can't really do much about it until Monday.
New laptop, new software, a trip to a holy place to clean of your sins? 

What worked for me was a little quiet time in an aircraft watching "the secret life of Walter Mitty" on the small screen in the empty seat next to mine because the remote in my seat wasn't responding (not a lucky day for devices around me).

I open Revit, I go back to my good old fashion macros and try to find some comfort there where I've never been let down before...and the SDA.exe threw an error! Perfect.
But at least I finally had something to debug, Visual Studio popped up and this is what I read:


So after 24 hours struggling to understand what went wrong with Dynamo it turns out that is this mscorlib.DLL (dirty little lier) that is causing me all the pain!

When I touched the ground again it was easy to lookup for a solution: my TEMP folder was full, way beyond the maximum number of files for which the GetTempFilePath() method in the mscorlib.dll raises the exception that prevented me from launching Dynamo or Visual Studio or the Revit macro environment.

As you might know numbers are infinite, even integer numbers, but in computer science there are many number "flavours" so to speak, and in particular not all the numbers can be represented using a specific flavor.
In other words in computer science I can have a maximum and a minimum value for a given number flavour.

For the TEMP folder the limit is 65535 files, which is the maximum value for a ushort integer (or unsigned 16-bit integer). So I cleaned my TEMP folder (if you don't know where it is just type %TEMP% in the address bar in your Explorer) and everything went back to normal.

I've already asked the good people in the Dynamo development team to introduce a preliminary test when launching the application so that the user can be informed if a cleanup of the TEMP folder is needed (you need the user input on this because you are deleting files at your own risk). Hopefully nobody will have to go through the same panic situation as I did.

You can find more information on Value Types here.