• 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
7
Question by AlwaysSomething · Feb 11, 2014 at 04:01 AM · internal-compiler-error

ReflectionTypeLoadException

I have a project which has been working fine until now. When importing packages -- such as assets purchased from the asset store -- Unity displays an internal compiler error (Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded). The same occurs when simply copying said project files into the Assets folder, but not when creating a new project and importing packages. Thankfully I had a backup copy of my project (which I then copied again for safety); it also works fine on its own, but breaks immediately when certain packages are imported. Apart from AssetStore packages, it even breaks when importing some Unity packages:

Water (Basic): OK

Water (Pro): Internal compiler error

Attempting to narrow the cause further, I have found that the error only occurs (at least with Water(Pro)) when c# scripts are placed in the Assets/Editor folder. Deleting all scripts from there prevented the error, while creating a new c# script in the folder caused the error. Deleting every line of code in said c# script did not change the situation; I had to delete the .cs file itself to remove the error. Further, it seems that if any c# scripts are placed in any /Editor folder, located anywhere in the project (such as Assets/SomeImportedAsset/SomeFolders/Editor), will result in the same error. Javascript files placed in Assets/Editor (or elsewhere) do not cause the error.

Any assistance would be appreciated. I apologize for not providing more information, but that is all I have; the error message is very unclear, and the entire situation is very strange.

Comment
Add comment · Show 5
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
avatar image rutter · Feb 11, 2014 at 04:02 AM 0
Share

Yikes. I haven't seen that. You might check your editor log for any additional information. Are you absolutely sure you're running a Pro copy?

avatar image AlwaysSomething · Feb 11, 2014 at 04:19 AM 2
Share

Absolutely sure it's pro. Unfortunately the editor log has been of little help, but if someone has perhaps seen this output before, here it is: Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

   at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
 
   at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.RootNamespace.ComputeNamespace ($$anonymous$$ono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.GlobalRootNamespace.ComputeNamespaces ($$anonymous$$ono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
 
   at $$anonymous$$ono.CSharp.Driver.$$anonymous$$ain (System.String[] args) [0x00000] in <filename unknown>:0 
  
 (Filename:  Line: 0)

I'll continue looking through the (currently massive) file to see if I can find anything else that may have happened over time.

avatar image AlwaysSomething · Feb 11, 2014 at 08:08 PM 2
Share

This appears to be the only difference in logs between error and non-error builds:

 The class System.Runtime.InteropServices.GuidAttribute could not be loaded, used in mscorlib, Version=2.0.0.0, Culture=neutral, Public$$anonymous$$eyToken=b77a5c561934e089$$anonymous$$issing method .ctor in assembly C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\EditorExtensions\UnityEditor.Android.Extensions.dll, type System.Runtime.InteropServices.GuidAttributeCan't find custom attr constructor image: C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\AndroidPlayer\EditorExtensions\UnityEditor.Android.Extensions.dll mtoken: 0x0a000017The class Unity.Package$$anonymous$$anager.Database could not be loaded, used in Unity.Package$$anonymous$$anager, Version=4.3.0.0, Culture=neutral, Public$$anonymous$$eyToken=null

Note that only occurs when a c# script (even containing nothing but whitespace) is placed in any folder named "Editor".

avatar image Sleeper26 · Feb 12, 2014 at 12:51 AM 1
Share

I'm having the same problem. Did you figure out how to fix it?

avatar image AlwaysSomething · Feb 12, 2014 at 02:21 AM 1
Share

In my case, yes. Posting an answer now. Hopefully it works for you as well!

9 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by AlwaysSomething · Feb 12, 2014 at 02:24 AM

Answering my own question after many hours of testing.

Check .dll's in the Assets folder. In this case, System.Web was causing the error. None of the System.Web.dll files located on my computer -- regardless of version -- worked without generating this particular error; I downloaded a copy of System.Web.dll v2.0.50727 x86 off the internet.

As for why the error only occurred when c# scripts were placed in an /Editor folder, Assembly-CSharp-Editor is only created under that condition, and it appears that only that assembly generates the error. Removing the reference to System.Web.dll in the assembly changed nothing. It is unclear as to why this is the case. Perhaps a Unity dev would have more insight.

I must strongly recommend improved error messages/logs for this; if System.Web.dll had been clearly referenced, rather than UnityEditor.Android.Extensions.dll, the error could've been resolved within minutes rather than hours. I suspect the same would be true for many other users.

Comment
Add comment · Show 1 · 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
avatar image jarl-ostensen · Mar 13, 2014 at 03:04 PM 0
Share

Glad you found a fix, I'm dealing with a similar one with even less helpful information;

Internal compiler error. See the console log for more information. output was: Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.

at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)

at System.Reflection.Assembly.GetTypes () [0x00000] in :0

at $$anonymous$$ono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in :0

at $$anonymous$$ono.CSharp.RootNamespace.ComputeNamespace ($$anonymous$$ono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in :0

at $$anonymous$$ono.CSharp.GlobalRootNamespace.ComputeNamespaces ($$anonymous$$ono.CSharp.CompilerContext ctx) [0x00000] in :0

at $$anonymous$$ono.CSharp.Driver.LoadReferences () [0x00000] in :0

at $$anonymous$$ono.CSharp.Driver.Compile () [0x00000] in :0

at $$anonymous$$ono.CSharp.Driver.$$anonymous$$ain (System.String[] args) [0x00000] in :0

I'll update this thread if I find out what it is...

avatar image
8

Answer by Stn · Jul 24, 2014 at 03:31 AM

i had same problem too and i exectude Assets>Reimoprt All(maybe you need to backup your project before do this) then it fix i do not know the reason but it work for me

Comment
Add comment · Show 4 · 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
avatar image aleksey_173 · Jul 27, 2014 at 06:36 PM 0
Share

Assets>Reimoprt All worked for me!!! thanks!!!

avatar image andrew-lukasik · Aug 17, 2014 at 07:00 PM 0
Share

THAN$$anonymous$$ YOU :D I couldn't believe it but that actually worked!

ps: in my case i needed to repeat reimport few times.

avatar image adityasankar · Oct 08, 2014 at 12:26 AM 0
Share

This worked for me as well. Not enough rep to upvote, but kudos!

avatar image $$anonymous$$ · Jun 07, 2015 at 12:40 PM 0
Share

This did not work for me, but it did give me an extra error (which is good). Progress! Thanks!

avatar image
4

Answer by twburger · Mar 11, 2015 at 05:41 AM

I found the problem for my project when I got this error message was that I was using a DLL built using a .Net 4.5.1 framework. After replacing the offending DLL and then Assets > Reimport All it was fine. The problem is that Mono (the generic multiplatform .Net clone) will only work with .Net up to 3.5.

Comment
Add comment · Show 1 · 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
avatar image Wolfram · May 20, 2015 at 01:36 PM 0
Share

This solved it for me, thanks!

avatar image
1

Answer by jrhtcg · Feb 18, 2015 at 06:21 AM

I was having a similar problem with the same error message. Thanks to the answer above that noted the problem was with the editor folder I found a solution to my problem.

I stripped out all the editor scripts from my original DLL project and created a separate project for them. I then recompiled both projects and put the resulting DLLs into my game's Asset folder like so:

/Assets/MyDLL/MyDLL.dll /Assets/MyDLL/Editor/MyDLLEditor.dll

This was indeed a strange problem to track down, as I could run my game just fine from the editor. The error only showed up when I tried to build the game as a standalone player. Hopefully this will help someone else as it appears the error message given applies to more than one kind of problem.

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
avatar image
0

Answer by valentemesmo · Jun 02, 2015 at 02:36 PM

In my case, I had AndroidJavaObject on a DLL used in All Platforms... I moved all AndroidJavaObject to a Android only DLL... problem solved!

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
  • 1
  • 2
  • ›

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Internal Compiler Error 2 Answers

Added custom DLL. Internal Compiler Error 6 Answers

Internal compiler error help! 1 Answer

internal compiler error 1 Answer

Exception: ReflectionTypeLoadException on sewitch web 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