- Home /
[WP81] Serialization Weaver issue with Assembly-CSharp.dll
I was isolating a runtime data serialization error in a new smaller project while I ran on an issue of the Serialization Weaver.
Error building Player: UnityException: Failed to run serialization weaver with command "Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine=Temp\StagingArea\Data\Managed\UnityEngine.dll "Temp\StagingArea\TempSerializationWeaver".
Symbols will be read from Temp\StagingArea\Data\Managed\UnityEngine.pdb
Weaving assembly C:\dev\UnityProjects\TestProject\TestProject\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll
Symbols will be read from Temp\StagingArea\Data\Managed\Assembly-CSharp.pdb
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'ExternalLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
� Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
� Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)
� Mono.Cecil.MetadataResolver.Resolve(TypeReference type)
� Unity.CecilTools.Extensions.ResolutionExtensions.Resolve[TReference,TDefinition](TReference reference, Func`2 resolve)
� Unity.CecilTools.Extensions.TypeDefinitionExtensions.IsSubclassOf(TypeDefinition type, String baseTypeName)
� Unity.Serialization.Weaver.MethodEmitterBase.WillUnitySerialize(FieldDefinition fieldDefinition)
� Unity.Serialization.Weaver.SerializeMethodEmitter.ShouldProcess(FieldDefinition fieldDefinition)
� System.Linq.Enumerable.<>c__DisplayClassf`1.<CombinePredicates>b__e(TSource x)
� System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
� Unity.Serialization.Weaver.MethodEmitterBase.EmitMethodBody()
� Unity.Serialization.Weaver.SerializationWeaver.AddSerializeMethod()
� Unity.Serialization.Weaver.SerializationWeaver.Weave()
� usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
� usw.Weaver.Weave()
� usw.Program.RunProgram(ConversionOptions options)
� usw.Program.Main(String[] args)
Importing both WP81 and standalone windows DLLs of my class library was successful
It's only when building to Windows Store/Phone8.1 SDK that the error occurs.
My class library contains one class MyGenericClass:
using System;
namespace ExternalLib
{
[Serializable]
public abstract class MyGenericClass<T>
{
public T m_Value;
}
}
My project class using the generic one looks like:
using System;
using ExternalLib;
[Serializable]
public class MyClass : MyGenericClass<int>
{
public int GetValue()
{
return m_Value;
}
}
Removing inheritance of MyGenericClass from MyClass prevents this issue from happening, but I still want to make it work... I was also suspecting Generic type classes could have anything to do with this but still, I'm already using this kind of generic classes and I know it's working.
What am I not doing correctly?
[1]: /storage/temp/49209-testproject.zip
[2]: /storage/temp/49211-plugins-importsettings.png
Answer by pace15 · Jul 24, 2015 at 03:30 PM
The answer from Unity: https://fogbugz.unity3d.com/default.asp?709358_jp9bhq80i4ob5h8f
I should not be using Serializable class in platform-specific plugins... Just avoid, at all cost, the use of [Serializable] tagged classes in plugins meant to be WP8.1 specific and simply move them to one that can be "Any" platform.