Error message: System.IO.FileNotFoundException: Could not load file or assembly "System.Collections"

Error message: System.IO.FileNotFoundException: Could not load file or assembly "System.Collections"

s193801T3FQ5
Participant Participant
1,203 Views
3 Replies
Message 1 of 4

Error message: System.IO.FileNotFoundException: Could not load file or assembly "System.Collections"

s193801T3FQ5
Participant
Participant

Hello,

 

I am in the middle of creating a Revit plugin. I am trying to add a dictionary (a member of the System.Collections assembly) which causes the plugin to crash. I am met with the following error message:

 

s193801T3FQ5_1-1666259993765.png

 

Does anyone know how I can fix this issue? Thanks!

 

0 Likes
1,204 Views
3 Replies
Replies (3)
Message 2 of 4

RPTHOMAS108
Mentor
Mentor

Check fuslog 

 

You'll have to turn on binding log as noted in the message. The log above lists how the assembly is being probed for.

 

It often come down to looking for the assembly in the same folder as Revit.exe (obviously you don't want to put it there).

 

I don't recall all the various ways of fixing this but one way is via:

AppDomain.AssemblyResolve Event (System) | Microsoft Learn

 

0 Likes
Message 3 of 4

s193801T3FQ5
Participant
Participant

Hello, thanks for the reply.

 

I found this resource about turning on the binding log: https://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net

 

However, it didn't work. I got the following error message:

 

s193801T3FQ5_0-1666268745404.png

 

I'm not quite sure how to understand the link you sent. Am I supposed to add those code snippets to my C# project?

 

0 Likes
Message 4 of 4

mhannonQ65N2
Collaborator
Collaborator

It looks like you might be trying to load the wrong version of the assembly. Most of the System.* assemblies Revit uses are version 4.7 something or 4.8 something, likely since Revit uses .NET framework. Is your project directly referencing the 6.0.0 version of either of those two assemblies?

0 Likes