Importing Generic List breaks Dynamo & Revit

In a python node for Dynamo 3.2 in Revit 2025 if I try adding the following reference, I get a warning related to System.Windows.Forms.Context menu not being loaded. Just to note, I have been using this import in my py template for several years and never had an issue before.

clr.AddReference('System')
from System.Collections.Generic import List

image

After that then Revit locks up and Crashes.

Here is the python node:
image

This may not be related but something i noticed. It is wise that you make this imported list name different as i show below. This stops the chance of this import causing a conflict with the python List.

#Imports Ilists module into python
clr.AddReference("System")
from System.Collections.Generic import List as cList
2 Likes

Thanks for the reply @Brendan_Cassidy, but doesn’t appear this has solved my issue.

Hello
do you try

import System
from System.Collections.Generic import List as cList

cordially
christian.stan

2 Likes

Import from mscorlib. System has the same namespace but theres no list type there.

Well as I usually tell folks, look at the Message and actually READ it. What is it telling you? Still don’t know why it is a dependency, but I’ll save that for another day.

So, what it was telling me is that once again I think CTC is mucking stuff up for us.

Using Revit Lookup (greatest single Revit plugin ever!) it looks like they are loading an older version of System.Windows.Forms. So, if I disable their plugin, boom, works just like it should.

2 Likes

Just saw you’re in R2025 / .NET 8 not 4.8! I was able to import list no problem however?

1 Like

Thanks @Thomas_Mahon, I think I found it’s a conflict with another software. They actually just released an update recently that I am going to try and see if it resolves for me.

1 Like

Before you update: enable the CTC stuff, then start Revit and open a Dynamograph and finally force quit Revit.

Grab that journal and flag any and all API_ERROR lines. After the CTC update do the same and confirm that the number goes down; if not you may still have more to clean up.

1 Like

Well, too late on the upgrade, but still doesn’t work so I submitted a ticket with them.

Got the journal from the active CTC add-in? Might be some clues you can provide them by checking there.

1 Like

Thanks @jacob.small, but unfortunately the journal didn’t have any information in it related to that add-in or any other to be honest, however working with support they have recreated the issue including it not happening when it is disabled.

2 Likes