Unhandled Exception: System.Reflection.ReflectionTypeLoadException in Unity3d

10,725

Solution 1

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.

Solution 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.

Share:
10,725

Related videos on Youtube

Divya
Author by

Divya

https://www.programmingshots.com http://madoverbrand.com https://www.zapecom.com https://www.majorfact.com

Updated on June 04, 2022

Comments

  • Divya
    Divya almost 2 years

    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.

    • David
      David about 9 years
      Are you using Mono .net 3.5 or below? Check the .net version of your System.web.dll.
    • Tyler Day
      Tyler Day about 9 years
      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?
    • Divya
      Divya about 9 years
      @David i m using 4.5 .
    • Divya
      Divya about 9 years
      @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 !!
    • Guavaman
      Guavaman about 9 years
      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.
    • Divya
      Divya about 9 years
      @Guavaman i m following this tutorial on youtube youtube.com/watch?v=3cB3iARj3m4 and i got stuck with this issue.
    • Guavaman
      Guavaman about 9 years
      Zip your project and upload it to Dropbox or something and post a link. I'll take a look.
    • Divya
      Divya about 9 years
      @Guavaman here is the link : sendspace.com/file/bqnzkw
    • Guavaman
      Guavaman about 9 years
      I posted the answer below.
  • Divya
    Divya about 9 years
    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.
  • Can Baycay
    Can Baycay about 9 years
    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?
  • Divya
    Divya about 9 years
    i have 2 dll files 1 .Assembly-UnityScript.dll (in lib folder )and unity.packagemanager.dll (in assets folder)
  • Can Baycay
    Can Baycay about 9 years
    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).
  • Divya
    Divya about 9 years
    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,
  • Can Baycay
    Can Baycay about 9 years
    These errors are probably not related to Unity.PackageManager.dll and should be solved separately. Are you trying to import an old package or maybe trying to convert an old project to Unity 5? We could help better if you tell what you are trying to do in detail.
  • Divya
    Divya about 9 years
    i m following mybringback tutorial on youtube for unity3d and in the 2nd last tutorial i got stuck with this issue while compiling.
  • Can Baycay
    Can Baycay about 9 years
    The problems you are struggling with probably easy to solve when you get enough knowledge to work comfortably with Unity. So I would suggest to move on and start a new project for another tutorial if this one is not that important.
  • Divya
    Divya about 9 years
    yup i will do that...:) thanks buddy for your time :) you seems to be good at unity .also .if you dnt mind will you help me in unity to learn as i m just a beginner so want to do masters in it.my skype id : stacktrace8 thanks :) +1 for your effrorts
  • Divya
    Divya about 9 years
    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.
  • Guavaman
    Guavaman about 9 years
    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.