- Home /
Unity/Mono doesn't support dll's with System.Collections.Generic.List? Using .NET 3.5
I'm trying to import a dll that uses System.Collections.Generic.List (Iserialization) however whenever that class is called, I get the following exception:
Exception: System.TypeLoadException: Could not load type 'System.Collections.Generic.List`1[[SD_Library.PLItem, SD Library, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]'.
at (wrapper managed-to-native) System.Type:internal_from_name (string,bool,bool)
at System.Type.GetType (System.String typeName, Boolean throwOnError) [0x00011] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/Type.cs:471
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadTypeMetadata (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo) [0x000bc] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:640
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectInstance (System.IO.BinaryReader reader, Boolean isRuntimeObject, Boolean hasTypeInfo, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x0000a] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:269
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x0008a] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:191
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObject (BinaryElement element, System.IO.BinaryReader reader, System.Int64& objectId, System.Object& value, System.Runtime.Serialization.SerializationInfo& info) [0x00105] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:223
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (BinaryElement element, System.IO.BinaryReader reader) [0x00020] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:130
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem, System.IO.BinaryReader reader, Boolean readHeaders, System.Object& result, System.Runtime.Remoting.Messaging.Header[]& headers) [0x00004] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs:104
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream, System.Runtime.Remoting.Messaging.HeaderHandler handler) [0x00078] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:179
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs:136
at GameManager.OpenStream (System.String saveLocation) [0x0003c] in C:\Users\Chris\Documents\Repositories\PL2D\Assets\Scripts\GameManager.cs:568
UnityEngine.Debug:LogError(Object)
GameManager:OpenStream(String) (at Assets/Scripts/GameManager.cs:572)
GameManager:LoadItemDatabase() (at Assets/Scripts/GameManager.cs:457)
GameManager:Start() (at Assets/Scripts/GameManager.cs:188)
GameManager:Awake() (at Assets/Scripts/GameManager.cs:440)
It is my understanding this has been a problem for well over a year and people had expected this to be resolved once Unity upgraded mono last year. With that said, I am using the latest version of Unity and I still see this problem. Has it been fixed? (clearly it hasnt) How can I get around this?
Thanks.
Unity hasn't upgraded $$anonymous$$ono in several years, but I'm not aware this was ever an issue. Certainly I have DLLs that use System.Collections.Generic.List and have done since Unity 3.4 at least.
This is what I was referring to with other people having the same problem: http://answers.unity3d.com/questions/560154/unable-to-populate-systemgenericcollectionslist.html
I've updated the question with more detailed error message.
Answer by Stone-Legion · Mar 30, 2014 at 01:55 PM
Problem solved.
Note to anyone in the future, while Visual Studio C# allows you to use spaces in assembly names, it is a recommended practice not to do this as it will def. cause issues like it did here. As soon as I changed the assembly name and removed the space, the problem was instantly fixed.
Your answer
Follow this Question
Related Questions
Edit asset DLL? 1 Answer
How to use Unity's mono to compile in MonoDevelop 2 Answers
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Findout Dll Dependency, System.dll and Mono.Security.dll 1 Answer
How to use an Image(PNG) and GUISkin inside a dll ? 1 Answer