Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Failed to load assemblies

Discussion in 'Windows' started by raynaldo, Jun 5, 2014.

  1. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    When i try to run the game, on 4.3 it run smoothly but on 4.5 i received this error:

    From debug output The exception occured before the last of my external plugins loaded.
    That last plugin just write some string to the file in the isolated storage.

    *The game was built successfully on 4.3 and 4.5.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    Hi,

    did you try building to an empty folder? I don't think building solution in 4.5 on top of one build in 4.3 will work.
     
  3. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    Thanks.
    Building the project to a new folder fixes the problem.

    Everytime i upgrade my project from unity 4.0 - 4.2 - 4.3, i always build to the same folder. And it always works.
    So i thought it will work too on 4.5.
    But i was wrong.

    My project is running some background agent. So building to a new folder means i need to reconfigure the build properties, references, assets, etc. And re-add the background agent code to the new project.
    Any ideas to avoid this?

    Thanks.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    Well, the only thing that changed with 4.5 is <ProjectName>.csproj file. Everything else should be the same. You should be able to preserve your configuration by removing this file only (and if you have made changed to it yourself, you'll have to redo them).
     
  5. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    Great,
    Thanks.
     
  6. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    sorry,
    Unfortunately the problem (post #1) still exists even when built to a new (build) folder.
    The error always occured when i add reference to the project that contains the background agent (subclass of 'Microsoft.Phone.Scheduler.ScheduledTaskAgent').
    I don't even do anything when the background agent is invoked.

    But the game just failed to run caused by 'System.TypeLoadException' followed by 'System.Reflection.TargetInvocationException' (debug & master).
    And finally (only in debug): Failed to load assemblies.

    *It works just fine in Unity 4.3.x

    Thank you.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    Could you check whether adding that reference doesn't mess with project post build events?
     
  8. antiping_Unity

    antiping_Unity

    Joined:
    May 31, 2011
    Posts:
    22
    I miss the same problem, I found that in refference two dll missing(UnityEngineDelegates, UnityEngineProxy)
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    Is this on Windows Phone or Windows Store apps?
     
  10. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    Sry for late reply.
    Mine is on WP8 Build.

    Ok here's my last experiment (?):

    I have an empty Unity Project, let's call it 'P'.
    In the 'Assets' folder i have Plugins folder which contains fake DLL 'X' and then in 'WP8' folder there is the real DLL of 'X'.
    Then i build the Unity project 'P' to a folder 'F'. I open the solution in the VS (2012) and then i add new reference to a new/existing project 'A' containing the background agent script.
    On that 'A' project, i add the same reference to the real DLL of 'X'.

    If I build the project now, it will throws the same exceptions.
    But if i remove the reference 'X' from project 'A', there's no such exceptions again.

    Now i don't know if i'm doing the right thing. The thing is... it works in 4.3, but not in 4.5.
    So for the moment it's either i remove 'X' from 'A' then recode 'X' directly on A (so i can use 4.5),
    or just use Unity 4.3.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    I believe here's the issue. At that point, DLL X exists at several places. It might be that you're referencing the wrong one and in result VS copies the wrong DLL to the phone. The right DLL to reference is the one in exported visual studio solution project folder next to <yourProject>.csproj file.
     
  12. raynaldo

    raynaldo

    Joined:
    Oct 7, 2013
    Posts:
    15
    Yep as you said. It is the issue.

    Strange though.
    In 4.3.x, 'A' isn't referencing to the same DLL on the exported visual studio solution (let's say directory 'V').
    It references to the DLL 'X' on its original bin directory 'O'.
    And it works. Maybe i'm wrong from the start, and Unity 4.3 fixes it for me.

    Anyway, thanks for your time to answer my problems.
    Really, thanks.
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,491
    The reason it works is that in 4.3, Unity does not depend on the DLL in the final directly being the same one that got postprocessed. It got changed for performance reasons - now Unity expects it to be the same DLL, and if you're gonna hotswap it, it will fail with the "Failed to load assemblies" error message as it cannot find the metadata it made up during postprocessing step. Just make it reference the same DLL and your problems should go away.
     
  14. antiping_Unity

    antiping_Unity

    Joined:
    May 31, 2011
    Posts:
    22
    on Windows Phone