Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime

Discussion in 'Windows' started by GearKlik, Jun 28, 2017.

  1. GearKlik

    GearKlik

    Joined:
    Sep 21, 2015
    Posts:
    58
    Hi all, still trying to get Flow Canvas working in Win Store Builds. Now getting this:
    AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters)
    Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name)
    Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name)
    Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type)
    Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type)
    Mono.Cecil.TypeReference.Resolve ()
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:192)
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194)
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194)
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194)
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194)
    UnityEditor.AssemblyReferenceChecker.InheritsFromMonoBehaviour (Mono.Cecil.TypeReference type) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:194)
    UnityEditor.AssemblyReferenceChecker.MethodIsMouseEvent (Mono.Cecil.MethodDefinition method) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:177)
    UnityEditor.AssemblyReferenceChecker.CollectReferencedAndDefinedMethods (Mono.Cecil.TypeDefinition type, Boolean isSystem) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:156)
    UnityEditor.AssemblyReferenceChecker.CollectReferencedAndDefinedMethods (IEnumerable`1 assemblyDefinitions) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:120)
    UnityEditor.AssemblyReferenceChecker.CollectReferences (System.String path, Boolean collectMethods, Single progressValue, Boolean ignoreSystemDlls) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:111)
    UnityEditor.AssemblyReferenceChecker.GetScriptsHaveMouseEvents (System.String path) (at C:/buildslave/unity/build/Editor/Mono/Utils/AssemblyReferenceChecker.cs:276)
    UnityEditor.BuildPipeline:BuildPlayer(String[], String, BuildTarget, BuildOptions)
    BuildHelper:InternalCreateUwpProject(String, String[], BuildConfig, Boolean) (at Assets/Editor/BuildMenu.cs:91)
    BendRealityMenu:BuildToLocalPackage() (at Assets/Editor/BendRealityMenu.cs:56)

    Weirdly if I remove the extension code and build to win store it works, then if I re-add the extension and build it will still work. Where do I start to track down assembly reference errors? PS am targeting .Net back end.


    Thanks!

    G
     
    Last edited: Jun 28, 2017
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,628
  3. GearKlik

    GearKlik

    Joined:
    Sep 21, 2015
    Posts:
    58
    Kind of, even though that was the same error it was resolved by taking out the two Flow Canvas script files. I was using vanilla Unity 5.6.0f3 so thought it was useful to leave it resolved since for most people that's the definitive answer. But feel free to merge this over if you like.

    I'm now using 5.6.0f3 but with some custom build tools and want to know how to go about debugging the SerializationWeaver pipeline. And as I stated the weird thing is this secondary appearance of the error only occurs if I haven't already built to Win Store. The only way to repo is to get a completely fresh version of a git branch and remove all non-tracked files. I've tried deleting the build, temp library, UWP folders and VS projects but I still can't get it to trigger the buggy behavior.

    Can I get more verbose output from SerializationWeaver? Is there a build log?
    How does Unity decide it's dependent on a certain version of a .Net assembly?
    I see Unity's Win Store build tool getting Nuget packages, can we customize those dependencies?

    I should have been more clear in my original post :)
     
    Last edited: Jun 28, 2017
  4. GearKlik

    GearKlik

    Joined:
    Sep 21, 2015
    Posts:
    58
    Actually let me do some tests, this problem may still be happening in a vanilla 5.6.0f3 Win Store build, but since it only happens in a fresh Unity project with absolutely no temp files its harder to repo. If so then we should move back to the original thread and delete this one. But above questions about Serialization Weaver are still valid.
     
  5. GearKlik

    GearKlik

    Joined:
    Sep 21, 2015
    Posts:
    58
    OK after some testing I believe this is what's happening, but don't have enough time to prove it:
    Fail case:
    1. I pull our project down from git
    2. Open in Unity, Unity compiles and caches all the assets
    3. Pull down Flow Canvas from the asset store WITH ALL files
    ?? Unity then compiles the Flow Canvas assets and writes bad assembly references somewhere ??
    4. Delete MouseAgent2DEvents.cs and MouseAgentEvents.cs. I was doing this outside Unity so not sure if that matters.
    ?? Unity does not remove "broken" references it previously add ??
    5. Build to Win Store using our custom build script. Its just setting UWP params but explicitly does not generate VS projects. Build will fail with above error.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,628
    That error has nothing to do with serialization weaver - why do you think it is? This was just a bug in Unity that we fixed. It's not something wrong with your scripts or projects.
     
  7. rosedge

    rosedge

    Joined:
    Apr 19, 2018
    Posts:
    1
    AssemblyResolutionException: Failed to resolve assembly: 'UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'

    I am also see this problem, I can't build Xcode project in unity
     
  8. arunvutnoori

    arunvutnoori

    Joined:
    Mar 27, 2018
    Posts:
    5

    Even i am having the same issue ... Did u find the solution
     
  9. astechnolabs

    astechnolabs

    Joined:
    Jul 11, 2021
    Posts:
    20
    Same here, I had problem in webGL

    I am damm sure by which flow I got this,
    First I uninstall Firebase,
    after that my project shows 700+ Errors.
    Forcefully need to remove those plugins which shows in 700 Error, after that I got this error in webGL Build