4

I'm getting this error: compile time error when running i have searched on unity forum they are saying its for the System.Web.dll file issue, i have cleared that, also reimported assets but its still not working.

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 Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0 

the answers i got from unity are :

and none of them helped me.

9
  • Are you using Mono .net 3.5 or below? Check the .net version of your System.web.dll.
    – David
    Mar 29, 2015 at 15:21
  • Possibly you are missing another dll that System.Web is looking for. I guess the real question is, what are you trying to do with System.Web?
    – Tyler Day
    Mar 29, 2015 at 16:13
  • @David i m using 4.5 .
    – Divya
    Mar 29, 2015 at 16:44
  • @TylerDay i seached for this issue on official unity sitte but the answer that i got are not helping me .they say about the issue is with system.web and i m unable to locate wt it is !!
    – Divya
    Mar 29, 2015 at 17:03
  • There's not enough information here. You don't tell us anything about what's in your project or what you're trying to do. Is this running a game build or in the editor? Have you tried building an empty project? It's possible you have something in your project that is choking Unity. An incompatible DLL perhaps.
    – Guavaman
    Mar 30, 2015 at 18:17

5 Answers 5

4

The problem is caused by the Unity.PackageManager.dll in your project. Delete that and it will be gone.

You've also got a folder under Editor that contains a bunch of editor scripts for Standard Assets, but you don't have Standard Assets Installed, so you're going to get a bunch of compiler errors from that. Delete the Editor folder or install Standard Assets and it will work.

I'm not sure where you got the tutorial files, but nothing in this project seems to work correctly. All the scenes are empty. I would advise you go find a different tutorial.

2
  • i have already done that thing.to delete that dll as Can asked me to do .but it gives 39 errors after that.also i have standard assets installed.i have deleted those files and it runs now :) but that dll has nothing to deal with that.
    – Divya
    Apr 1, 2015 at 17:59
  • The DLL is what was causing the System.Reflection.ReflectionTypeLoadException. Deleting that DLL reveals the other 39 compile errors because it can't even get to the point of checking the CS or JS files in your project until that TypeLoadException is resolved.
    – Guavaman
    Apr 1, 2015 at 21:04
2

Problems like this could be related to "Target Framework" setting in the DLL's compilation options. Which should be considered for already compiled system DLL's too.

So in your case, I think you might be using the wrong DLL version. If you need to import extra system DLL's, make sure you get them from Unity installation folder:

C:\Program Files\Unity\Editor\Data\Mono\lib\mono\2.0

Beware that there might be multiple DLL's with the same name in other subfolders like MonoBleedingEdge. Make sure you use the folder above.

In case you build a DLL on your own, "Target Framework" setting should be set to a proper one. You may figure out the correct setting by trying.

9
  • which DLL i should import in this case ?? i m unable to get which one is creating problem .as unity forum says its for system.web.dll ,i tried to change the .Net version but its still the same issue.
    – Divya
    Mar 30, 2015 at 8:26
  • I need to know what DLLs you are trying to import. Can you search for *.dll in your project's Assets folder and write down all results here?
    – Can Baycay
    Mar 30, 2015 at 9:20
  • i have 2 dll files 1 .Assembly-UnityScript.dll (in lib folder )and unity.packagemanager.dll (in assets folder)
    – Divya
    Mar 30, 2015 at 9:29
  • Alright. It's not wise to touch lib folder since Unity uses this folder for temporary purposes. And it's unlikely for lib folder to cause anything bad. So we are left with Unity.PackageManager.dll. I'm not sure if this DLL was intentionally dropped to the Assets folder or if it's by accident. This is one of Unity's internal DLLs I think. So let's try to remove it from Assets and see if everything works as expected (keep a backup).
    – Can Baycay
    Mar 30, 2015 at 11:26
  • i did that..but it gave 39 errors.also one of its "the type or namespace name "antialiasing could not be found Are you missing a using directive or an assembly reference? " i m using unity 5 downloaded past 5 days back,
    – Divya
    Mar 30, 2015 at 11:57
0

I was getting this error when referencing a dll I had compiled with platform target set to Any CPU. Fixed by changing it to x86.

0

I fixed this error, when change Target framework to .Net Framework 3.5, and set the Copy Local to false of UnityEngine's references.

And after dragging the dll, the error is gone.

Hope this will help.

0

Wow I got a version of this Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded. nonsense ... after couple hours of crying/raging, reimporting assets, deleting Library/Temp folders, changing platforms, reimporting plugins i finally got past it. Honestly I don't know exactly what fixed it .. ugh that was annoying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.