Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Failed to run assembly preprocessor with cmdline error

Discussion in 'Windows' started by atmuc, Sep 9, 2013.

  1. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    i get this error. what cause this? must all asset owners change their precompiled libraries to make them compatible with phone 8 and windows store apps?

    Error building Player: Exception: Failed to run assembly preprocessor with cmdline "Temp/StagingArea\Data/Managed\EasyRoads3D.dll" -injectCtor -assemblyPath "Temp/StagingArea\Managed" -pdb.[Temp/StagingArea\Data/Managed\EasyRoads3D.dll]
    No symbols for Temp/StagingArea\Data/Managed\EasyRoads3D.dll
    Injecting ctor
    Error while in assembly preprocessor Temp/StagingArea\Data/Managed\EasyRoads3D.dll
    The given key was not present in the dictionary.
    at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
    at AssemblyPreprocessor.ConstructorInjector.GetBaseConstructorMethodFor(MethodDefinition constructor, Dictionary`2 map)
    at AssemblyPreprocessor.ConstructorInjector.CreateBodyInvokingBaseConstructor(TypeDefinition parentType, MethodDefinition constructor, Dictionary`2 map)
    at AssemblyPreprocessor.ConstructorInjector.InjectConstructorsForTypesIn(ModuleDefinition moduleDefinition)
    at AssemblyPreprocessor.Program.Main(String[] args)
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    Where did you put that DLL? What is that DLL (native or .Net and if .Net what version)?
     
  3. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    it is a part of EasyRoads3D that is sold on Asset Store. it should be a mono built dll that hides source code of this asset.

    it's path is; \Assets\EasyRoads3D\lib\EasyRoads3D.dll
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    That sounds like a bug. Can you report it?
     
  5. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    i did. 562600
     
  6. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    @Tautvydas what is the criteria to be compatible with phone 8 and windows app build?

    i tried this;

    i added an character with animation. i build this project for both window store and phone 8. i tested both, they work fine on devices.

    i added playmaker to the project. it has also dll files. i did not used any object from this package.. it worked on both platforms.

    i deleted playmaker and added easyroads3d pro to my project. i did not used any object from this package. it generates error that i post.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    The requirement is that all DLLs in the project are compatible with Windows Phone API. Thanks for reporting a bug, we'll look into it.
     
  8. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    what are the compatibility rules? :) no hashmap?
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
  10. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    package owner said he build this dll with visual studio. can it be the reason of this error? he will also build this dll with monodevelop and i will test it.
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    Visual Studio should work fine.
     
  12. sam_augview

    sam_augview

    Joined:
    Aug 22, 2013
    Posts:
    9
    Hey guys, I'm getting a similar error when I try to build for Windows Store. Any ideas as to what might be causing it? Thanks!

    Error building Player: Exception: Failed to run assembly preprocessor with cmdline "Temp/StagingArea\Data/Managed\Assembly-CSharp.dll" -injectCtor -assemblyPath "Temp/StagingArea\Managed" -pdb.[Temp/StagingArea\Data/Managed\Assembly-CSharp.dll]
    Symbols will be read from Temp/StagingArea\Data/Managed\Assembly-CSharp.pdb
    Injecting ctor
    Injecting fast invokes
    Error while in assembly preprocessor Temp/StagingArea\Data/Managed\Assembly-CSharp.dll
    Object reference not set to an instance of an object.
    at AssemblyPreprocessor.FastInvokeInjector.InjectUnityFastInvoke(String targetName, MethodDefinition method, TypeDefinition typeDefinition)
    at AssemblyPreprocessor.FastInvokeInjector.InjectFastInvokeFunctions(TypeDefinition typeDefinition)
    at AssemblyPreprocessor.FastInvokeInjector.InjectFastDelegateStubsForTypesIn(ModuleDefinition moduleDefinition)
    at AssemblyPreprocessor.Program.Main(String[] args)
     
  13. bobbrum

    bobbrum

    Joined:
    Jan 8, 2013
    Posts:
    3
    Any update on this? I'm getting the same error building for Windows Store.
     
  14. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,875
    We'll need a bug a report.

    Thank you
     
  15. raoul

    raoul

    Joined:
    Jul 14, 2007
    Posts:
    6,722
    I could be wrong but I belief this is resolved in the 4.3 beta. At least, the problems Atmuc described do not occur in the 4.3 beta
     
  16. atmuc

    atmuc

    Joined:
    Feb 28, 2011
    Posts:
    1,151
    it is ok with new beta version of 4.3. if i do not confuse it worked on 4.2 with new easyroads package.
     
  17. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    I just started getting this error in 4.3.3 after I successfully built about 20 times yesterday. No differences between yesterday and today except I made a few changes to my .NET 4.5.1 DLL located in Plugins/Metro/ (all changes were private, none of the public functions changed). There are no 3rd party DLLs, only my mock .NET 3.5 DLL in Plugins/ and my true DLL in Plugins/Metro, plus one more DLL in Plugins/ which is just a class that's shared between Unity's scripts and the .NET 4.5.1 DLL. I'm going to try wiping the Windows 8 build folder and start again.

    Edit: Wiping the Win 8 build folder didn't help. Neither did rebuilding both the mock and the Metro DLL... I guess maybe I'll try rebooting next. :p

    The full error:
    Code (csharp):
    1. Error building Player: Exception: Failed to run assembly preprocessor with cmdline "Temp/StagingArea\Data/Managed/Plugins/Metro\Win8StoreLib.dll" -injectCtor -assemblyPath "Temp/StagingArea\Managed" -pdb -out Temp/StagingArea\TempAssemblyPreprocessor\Win8StoreLib.dll.[Temp/StagingArea\Data/Managed/Plugins/Metro\Win8StoreLib.dll]
    2. No symbols for Temp/StagingArea\Data/Managed/Plugins/Metro\Win8StoreLib.dll
    3. Injecting ctor
    4. Injecting fast invokes
    5. Will write pdb
    6. Error while in assembly preprocessor Temp/StagingArea\Data/Managed/Plugins/Metro\Win8StoreLib.dll
    7. Failed to resolve assembly: 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'
    8.    at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
    9.    at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
    10.    at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
    11.    at Mono.Cecil.TypeReference.Resolve()
    12.    at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
    13.    at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
    14.    at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
    15.    at Mono.Cecil.MetadataBuilder.AddField(FieldDefinition field)
    16.    at Mono.Cecil.MetadataBuilder.AddFields(TypeDefinition type)
    17.    at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
    18.    at Mono.Cecil.MetadataBuilder.AddTypeDefs()
    19.    at Mono.Cecil.MetadataBuilder.BuildTypes()
    20.    at Mono.Cecil.MetadataBuilder.BuildModule()
    21.    at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
    22.    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
    23.    at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)
    24.    at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
    25.    at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)
    26.    at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
    27.    at AssemblyPreprocessor.Program.Main(String[] args)
     
    Last edited: Jan 27, 2014
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    I discovered the source of my problem, though I can't understand why it didn't work. This code in my Plugins/Metro/Win8StoreLib.dll killed it:

    Code (csharp):
    1. public static class SaveFile {
    2.     private const UnicodeEncoding stringEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
    3.     private const ByteOrder byteOrder = Windows.Storage.Streams.ByteOrder.LittleEndian;
    4.     // ... the rest of the class
    5. }
    Changing it to this no longer causes Unity to throw the error:

    Code (csharp):
    1. public static class SaveFile {
    2.     private static readonly UnicodeEncoding stringEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
    3.     private static readonly ByteOrder byteOrder = Windows.Storage.Streams.ByteOrder.LittleEndian;
    4.     // ... the rest of the class
    5. }
    So it seems even though those consts were private, it couldn't handle it. Odd.

    This however does not kill it:

    Code (csharp):
    1. public static class SaveFile {
    2.     private const byte arraySizeLength = 4;
    3.     // ... the rest of the class
    4. }
     
  19. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

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

    that definitely looks like a bug. Could you fill a report with a simple reproduction project attached?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Okay, I submitted the bug report with repro (case 590116). Thanks!
     
  21. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,644
    Thanks, we'll look into it.