Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Feilem · Dec 02, 2015 at 12:12 PM · loaddllclassesassemblymodules

Cannot load classes from the module: solved

[I include a tl;dr version in the end]

Hello everyone,

I was pulling my hair out because of the problem System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

Unhandled Exception: System.Reflection.ReflectinoTypeLoadException: The classes in the module cannot be loaded.

and some more, related to the two mentioned above I assume.

I am posting this to try and help anyone who encounters such issues when trying to create -> import a .dll file into their project. After many hours of digging into this problem (I learnt a lot more than I needed to, btw) I reached the following conclussion: there was a misunderstanding between the assemblys version of both the .dll trying to be imported and the assembly version Unity beholds (3.5 as of today).

IMPORTANT NOTE: I use mono-develop(built in) as the external tool editor, which will turn out to be quite a powerful tool for those of you who don't use it yet.

My project solution, which was in charge of creating the .dll file I would later try to import into a diferent Unity project, was pointed to be built with a target framework ".NET framework 4.6" while Unity can only withstand ".NET 3.5" at max. Tip: you can check these parameters in the Project tab ->" Options" (where '' is the name of your assembly package. The option just below "Solution Options", in short) -> Build -> General -> Target Framework; for the target framework of the future .dll you'll be assemblying. As for the current version of the framework your Unity instalation can withstand, I'd recommend using the last Unity release so you know it is 3.5 (as of today), but if that is not a possibility you can try printing the System.Environment.Version information via Console.Writeline in a simple script, altough the version printed MAY NOT be the correct one. e.g.: I know I can run up to version 3.5 but when I print this System.Environment.Version it says that the major build number is 2. I may be missing something important here but that's all I managed to get through with the little motivation I had left. You can try and check it manually too by browsing through the different packages imported to your project in the folder "References" in the solution layer of the editor. Double left-click on some of them and the first line of information shown in the recently open tab contains the assembly version it requires [assembly: AssemblyVersion ("3.5.0.0")] Some may be 2.0.0.0, some may be 3.5.0.0 and some may be above this version number if you are trying to import an invalid .dll for Unity (my problem was originated by a library compiled with a target framework 4.6 trying to be succesfully imported into a Unity project). If there is any with an assemblyVersion parameter above 3.5.0.0 you should check if it has been succesfully loaded: open it in the browser half of the tab and check the "References" folder, if there's a red warning, probably implying not being able to load UnityEngine.dll, it means its assembly version is unsupported.

//////////////////###########

TL;DR version

you got problems like System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. Unhandled Exception: System.Reflection.ReflectinoTypeLoadException: The classes in the module cannot be loaded. and some more.

The assembly version of the .dll you have recently imported into your package is too high for Unity. I assume that such .dll was not downloaded with warranties of working when imported to a Unity project or either was developed by yourself or someone you know. 2nd scenario: Open mono-develop with the solution-library which contains the source code of the .dll. Go to Project tab -> last option -> Build -> General -> Target Framework -> Mono / .NET 3.5 and you're done. Rebuild and import the new .dll 1st scenario: complain to the uploader.

//////////////////##########

Hope this helps~

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Xelnath · Jun 14, 2018 at 08:12 PM

Wait, I thought Unity supported up to .NET 4.6 now

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Keep assemblies in separated dll instead of GameAssembly.dll 0 Answers

How to add a custom module to Unity? 0 Answers

How do I get rid of "Assembly-CSharp-firstpass" and "Assembly-CSharp-firstpass.dll" from my Assets? 1 Answer

IL2CPP mod support 1 Answer

Can't create scripts in unity and visual studio? DLL issues 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges