Any idea what could cause the following build-step exception?
Error building Player: Exception: Failed to run Serialization weaver with cmdline "Temp/StagingArea\Data/Managed/Plugins/Metro\WindowsStorePlatformCode.dll" -pdb -verbose -unity-engine=Temp/StagingArea\Managed/UnityEngine.dll "Temp/StagingArea\TempSerializationWeaver".[Temp/StagingArea\Data/Managed/Plugins/Metro\WindowsStorePlatformCode.dll]
Symbols will be read from Temp/StagingArea\Managed/UnityEngine.pdb
Weaving assembly C:\Users\XXXX\Desktop\XXXX\XXXX\Temp\StagingArea\Data\Managed\Plugins\Metro\WindowsStorePlatformCode.dll
Symbols will be read from Temp/StagingArea\Data/Managed/Plugins/Metro\WindowsStorePlatformCode.pdb
System.NotSupportedException: Specified method is not supported.
at Mono.Cecil.PE.ImageReader.ReadArchitecture()
at Mono.Cecil.PE.ImageReader.ReadImage()
at Mono.Cecil.PE.ImageReader.ReadImageFrom(Stream stream)
at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
at usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
at usw.Weaver.Weave()
at usw.Program.RunProgram(ConversionOptions options)
at usw.Program.Main(String[] args)
I did a xamarin scan of my Metro\WindowsStorePlatformCode.dll and got 100%.
We seem to be getting the same error when we try to build for Windows Store (XAML C#, SDK 8.1 ) using prime31’s Metro Essentials plugin and including their demo scene. Here is the error log:
Error building Player: Exception: Failed to run Serialization weaver with cmdline "Temp/StagingArea\Data/Managed\Assembly-CSharp-firstpass.dll" -pdb -verbose -unity-engine=Temp/StagingArea\Managed/UnityEngine.dll "Temp/StagingArea\TempSerializationWeaver".[Temp/StagingArea\Data/Managed\Assembly-CSharp-firstpass.dll]
Symbols will be read from Temp/StagingArea\Managed/UnityEngine.pdb
Weaving assembly E:\Unity\XXXXXX\XXXXXX\TestMetro\Windows8Prime31MetroEssnl\Temp\StagingArea\Data\Managed\Assembly-CSharp-firstpass.dll
Symbols will be read from Temp/StagingArea\Data/Managed\Assembly-CSharp-firstpass.pdb
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null'
at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
at Unity.CecilTools.Extensions.ResolutionExtensions.Resolve[TReference,TDefinition](TReference reference, Func`2 resolve)
at Unity.Serialization.Weaver.MethodEmitterBase.WillUnitySerialize(FieldDefinition fieldDefinition)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Unity.Serialization.Weaver.MethodEmitterBase.EmitMethodBody()
at Unity.Serialization.Weaver.SerializationWeaver.AddSerializeMethod()
at Unity.Serialization.Weaver.SerializationWeaver.Weave()
at usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
at usw.Weaver.Weave()
at usw.Program.RunProgram(ConversionOptions options)
at usw.Program.Main(String[] args)
We had posted this to prime31 support. This is their reply for the above:
We have a submission closing in and would like to know what the issue is (whether it is Unity / prime31) and how it can be resolved or any workarounds for this.
Such code would cause a very similar error message. To workaround, use a class that is available in .NET 3.5 for field storage, for example System.Object:
@Tautvydas, to add a bit more information, I can’t seem to reproduce what @pjain168 is seeing on two different Windows PCs. @pjain168 is also the only one who has reported the issue. It seems that the SerializationWeaver failure happens in the Assembly-CSharp-firstpass.dll. Our plugins are all contained in their own DLLs. Is it only code that is compiled into Unity DLLs (such as Assembly-CSharp-firstpass.dll) that cause the issue?
@pjain168, you should probably use the Unity Bug Reporter to get a copy of your project over to the crew so they can give it a look.
I managed to fix a similar build stop error which I encountered on 4.5.3f3 building for Windows 8 Store. Complete error follows at the end of my post.
First, I tried building for WP8, and encountered an error due to a use of StreamReader with a string constructor, which is not supported for the platform. That gave me an idea…
I switched back to Windows Store player. My Player Settings → Publishing Settings → Compilation Settings were either “None” or “Use Net Core Partially”. I changed this due to issues I had with a plug-in earlier in testing. Setting this field to “Use Net Core” and building again revealed a bunch of errors with code using incompatible interfaces with Windows Store .NET Framework. These included the StreamRead issue above found in the WP8 build, and using 2 other interfaces incompatible with Windows Store: XmlDocument.SelectNodes() and System.Array.AsReadOnly().
So I updated to code to not use those incompatible interfaces - and the error is gone! With the removal from our code of the 3 unsupported Windows Phone and Windows 8 interfaces, the problem was completely eliminated. So I would recommend building with “Use Net Core” and double checking that you are only using compatible interfaces with the Windows Store/Windows Phone frameworks.
It would be nice if these errors could be displayed during editor Unity runs when the platform is selected, rather than just at player build time, but at least this cleared the error.
Error building Player: Exception: Failed to run Serialization weaver with cmdline "Temp/StagingArea\Data/Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine="Temp/StagingArea\Managed/UnityEngine.dll" "Temp/StagingArea\TempSerializationWeaver".[Temp/StagingArea\Data/Managed\Assembly-CSharp.dll]
Symbols will be read from Temp/StagingArea\Managed/UnityEngine.pdb
Weaving assembly C:\Development\Unity\Projects\Match3 Candy\Match3Candy\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll
Symbols will be read from Temp/StagingArea\Data/Managed\Assembly-CSharp.dll.mdb
+ CeilingHelper
+ CloudManager
+ FadeOutHelper
+ GUISizeHelper
+ GameManager/Zone
...
+ CameraController
+ UniRateEventHandler
+ UniRateGUIScript
+ UniRate
Will export symbols of pdb format
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
at Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodSymbols symbols)
at Mono.Cecil.Mdb.MdbReader.Read(MethodSymbols symbols)
at Mono.Cecil.Cil.CodeReader.PatchRawMethodBody(MethodDefinition method, CodeWriter writer, MethodSymbols& symbols)
at Mono.Cecil.Cil.CodeWriter.WriteUnresolvedMethodBody(MethodDefinition method)
at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddNestedTypes(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
at Mono.Cecil.MetadataBuilder.AddTypeDefs()
at Mono.Cecil.MetadataBuilder.BuildTypes()
at Mono.Cecil.MetadataBuilder.BuildModule()
at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
at usw.Weaver.Weave()
at usw.Program.RunProgram(ConversionOptions options)
at usw.Program.Main(String[] args)