Search Unity

Windows 8 Phone: Failed to run serialization weaver

Discussion in 'Windows' started by IVxIV, Mar 26, 2014.

  1. IVxIV

    IVxIV

    Joined:
    Nov 13, 2013
    Posts:
    16
    Hello,

    Trying to port one of our projects over to Windows8 Phone today, and sadly hitting an issue with the "serialization weaver". I'm running Unity 4.3.4 on Windows 8.1. All my C# scripts compile clean, but I am getting the following build error. Nothing I've tried has improved results (including a re-install of Unity).

    Any ideas on this one?

    Here's what I find in the Editor.log file:

    Code (csharp):
    1.     Error building Player: Exception: Failed to run serialization weaver with command line "Temp/StagingArea/Data/Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine=Temp/StagingArea/Data/Managed/UnityEngine.dll "Temp/StagingArea/TempSerializationWeaver".[Temp/StagingArea/Data/Managed\Assembly-CSharp.dll]
    2.     Symbols will be read from Temp/StagingArea/Data/Managed/UnityEngine.pdb
    3.    
    4.     ...
    5.    
    6.     System.InvalidOperationException: Operation is not valid due to the current state of the object.
    7.        at Mono.Cecil.MetadataImporter.ImportTypeSpecification(TypeReference type, IGenericContext context)
    8.        at Mono.Cecil.MetadataImporter.ImportTypeSpecification(TypeReference type, IGenericContext context)
    9.        at Unity.Serialization.Weaver.MethodEmitterBase.ResolveGenericFieldReference(FieldReference fieldRef)
    10.        at Unity.Serialization.Weaver.MethodEmitterBase.EmitMethodBody()
    11.        at Unity.Serialization.Weaver.SerializationWeaver.AddSerializeMethod()
    12.        at Unity.Serialization.Weaver.SerializationWeaver.Weave()
    13.        at usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
    14.        at usw.Weaver.Weave()
    15.        at usw.Program.RunProgram(ConversionOptions options)
    16.        at usw.Program.Main(String[] args)
    17.  
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

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

    this looks like a bug in Serialization Weaver. Could you report it with a project attached that demonstrates this behaviour? If you do it, we could check asap and look for a work around.
     
  3. IVxIV

    IVxIV

    Joined:
    Nov 13, 2013
    Posts:
    16
    Thanks - the project in question is fairly large. I'll see if I can get a pared-down version which reproduces the issue.
     
  4. mcdon00

    mcdon00

    Joined:
    Apr 29, 2013
    Posts:
    2
    I'm seeing the exact same issue:

    Error building Player: Exception: Failed to run serialization weaver with command line "Temp/StagingArea/Data/Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine=Temp/StagingArea/Data/Managed/UnityEngine.dll "Temp/StagingArea/TempSerializationWeaver".[Temp/StagingArea/Data/Managed\Assembly-CSharp.dll]
    Symbols will be read from Temp/StagingArea/Data/Managed/UnityEngine.pdb
    Weaving assembly C:\Users\nmcdonald\Desktop\hauntedmansion\trunk\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll
    Symbols will be read from Temp/StagingArea/Data/Managed\Assembly-CSharp.pdb
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,917
    you've stripped the error.
     
  6. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    Here is the same error on 4.5.1p1, everything works fine on 4.3.7p2

    Code (CSharp):
    1.  
    2. Error building Player: Exception: Failed to run serialization weaver with command line "Temp\StagingArea\Data\Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine=Temp\StagingArea\Data\Managed\UnityEngine.dll "Temp\StagingArea\TempSerializationWeaver".[Temp\StagingArea\Data\Managed\Assembly-CSharp.dll]
    3. Symbols will be read from Temp\StagingArea\Data\Managed\UnityEngine.pdb
    4. Weaving assembly C:\Projects\_game\tinyheroes_unity_wp8\Temp\StagingArea\Data\Managed\Assembly-CSharp.dll
    5. Symbols will be read from Temp\StagingArea\Data\Managed\Assembly-CSharp.dll.mdb
    6.  + ArenaBattleScript
    7.  + ArenaFinishScreen
    8.  + ArenaRecordLine
    9.  + ArenaScreen
    10.  + ArenaShop
    11.  + ArenaShopItemSlot
    12.  + ActionButton
    13.  + Activatable
    14.  + BattleEndPopup
    15.  + BattleEndPopupSlot
    16.  + BattleFieldCameraConfiguration
    17.  + BattleReward
    18.  + BattleScene
    19.  + BattleSceneBuilder
    20.  + BattleSceneDebugPanel
    21.  + BattleSceneDebugScript
    22.  + BattleSceneScript
    23.  + BattleTutorial1
    24.  + BattleTutorial2
    25.  + BattleTutorial3
    26.  + BattleTutorial4
    27.  + BattleTutorialLogic
    28.  + BattleTutorialMessage
    29.  + BattleTutorialMessageArrow
    30.  + Chest
    31.  + CreatureCountAnimation
    32.  + CreatureHealthBar
    33.  + CreatureHitAnimation
    34.  + CreatureStack
    35.  + CreatureStackArenaEnemySlot
    36.  + CreatureStackBuilder
    37.  + CreatureStackBuilderBase
    38.  + CreatureStackIndication
    39.  + CreatureStackPlayerSlot
    40.  + Field
    41.  + FieldObject
    42.  + FieldTile
    43.  + FieldTileIndicator
    44.  + HelpButton
    45.  + Loot
    46.  + Obstacle
    47.  + Placeable
    48.  + PlaceableTileOffset
    49.  + Player
    50.  + RageButton
    51.  + RagePopup
    52.  + RagePopupSpell
    53.  + Script
    54.  + SingleStackBuilder
    55.  + ComicsScreen
    56.  + ComicsScreen1
    57.  + ComicsScreen2
    58.  + ActionArea
    59.  + ActionAreaOffset
    60.  + ActionBase
    61.  + ActionBuff
    62.  + ActionBuffAll
    63.  + ActionBuffMass
    64.  + ActionBuffRandom
    65.  + ActionCharge
    66.  + ActionChest
    67.  + ActionHeal
    68.  + ActionMelee
    69.  + ActionRanged
    70.  + ActionRangedChargeAnimated
    71.  + ActionRangedCharged
    72.  + ActionRangedMiss
    73.  + ActionRouter
    74.  + ActionSpawn
    75.  + ActionWave
    76.  + ActionWaveSplash
    77.  + AnimatedActionBase
    78.  + ActionDamage
    79.  + ActionEffect
    80.  + CreatureAction
    81.  + Spell
    82.  + AllTargetSpell
    83.  + BuffSpell
    84.  + FireArrowSpell
    85.  + FireRainSpell
    86.  + InspirationSpell
    87.  + MultiTargetSpell
    88.  + RandomTargetSpell
    89.  + AnimatedFader
    90.  + AnimationBase
    91.  + AnimationChain
    92.  + AnimationChainEvent
    93.  + AnimationChainEventOutput
    94.  + AnimationChainTimeEvent
    95.  + ColorPulseAnimation
    96.  + CreatureAnimation
    97.  + CreatureAnimationSoundEvent
    98.  + CreatureStackAnimation
    99.  + DelayAccumulatorAnimation
    100.  + DelayAnimation
    101.  + DestroyObjectAnimation
    102.  + FlyOutAnimation
    103.  + OpacityAnimation
    104.  + ParticleAnimation
    105.  + ParticleEmissionAnimation
    106.  + ParticleStopAnimation
    107.  + ProjectileAnimation
    108.  + ProjectileBase
    109.  + ProjectileOutOfScreenAnimation
    110.  + ProjectileParabolaAnimation
    111.  + ProjectileParabolaAnimation2
    112.  + ProjectileUpDownAnimation
    113.  + RageConfigureAnimation
    114.  + RageCounterAnimation
    115.  + ScalePulseAnimation
    116.  + ShakeAnimation
    117.  + SignalAnimation
    118.  + SimpleSpriteAnimation
    119.  + SoundAnimation
    120.  + SpriteProjectile
    121.  + TargetParticleAnimation
    122.  + UnityBuiltinAnimation
    123.  + UnityBuiltinAnimationHelper
    124.  + CreatureAttributes
    125.  + CreatureCustomAnimation
    126.  + Creature
    127.  + CreatureMetadata
    128.  + AttackEffect
    129.  + BurnEffect
    130.  + BurstEffect
    131.  + CreatureStackEffectBuilder
    132.  + CreatureStackEffectVisual
    133.  + DefenseEffect
    134.  + EffectVisualFactory
    135.  + EffectVisualObject
    136.  + FearEffect
    137.  + CreatureFeature
    138.  + ImmovableFeature
    139.  + NoEnemyRetaliationFeature
    140.  + FreezeEffect
    141.  + GolemDefenseEffect
    142.  + InspirationEffect
    143.  + BeltBanditEffect
    144.  + BeltMonkEffect
    145.  + HelmStrawHatEffect
    146.  + ItemEffect
    147.  + WeaponBowEffect
    148.  + WeaponDaggerEffect
    149.  + WeaponSandSwordEffect
    150.  + ParticleEffectVisualObject
    151.  + SimpleEffectVisualObject
    152.  + SpeedEffect
    153.  + SpriteEffectVisualObject
    154.  + StunEffect
    155.  + ActionOnCreatureDeath
    156.  + CreatureScript
    157.  + EnableCreatureSpecialAction
    158.  + RemoveBodyOnCreatureDeath
    159.  + SetCreatureFlag
    160.  + UnlockCreatureSpecialAction
    161.  + DemoEndScreen
    162.  + GameData.SaveManager
    163.  + Loader
    164.  + LoaderAlawarScreen
    165.  + LoaderMain
    166.  + LoaderScreen
    167.  + LoaderScreenAndroid
    168.  + MainMenuDifficulties
    169.  + MainMenuLanguages
    170.  + MainMenuPanel
    171.  + MainMenuScreen
    172.  + MainMenuSlot
    173.  + MainMenuSlots
    174.  + MainMenuSoundScreen
    175.  + ChatTest
    176.  + Mission3_9Script
    177.  + Mission5DemoScript
    178.  + AlertPopup
    179.  + Chat
    180.  + ChatBase
    181.  + ChatComics
    182.  + ChatMessage
    183.  + ChatMessageBase
    184.  + ChatMessageEmpty
    185.  + CreditsPopup
    186.  + CrossPromoBannerDisplay
    187.  + CrossPromoPopup
    188.  + InfoPopup
    189.  + ItemInfoPopup
    190.  + Popup
    191.  + PromptPopup
    192.  + SettingsDifficultyPopup
    193.  + SettingsPopup
    194.  + SettingsVolumeControl
    195.  + SettingsVolumePopup
    196.  + Tooltip
    197.  + UnitInfoFullPopup
    198.  + UnitInfoShortPopup
    199.  + AchievementArmorSpell
    200.  + AchievementSpeedSpell
    201.  + AdManager
    202.  + BackgroundUVScroll
    203.  + BundleVersion
    204.  + CrossPromoManager
    205.  + DestroyParticles
    206.  + Disabler
    207.  + FlyOut
    208.  + HSBColor
    209.  + HUDFPS
    210.  + MoveBounce
    211.  + MoveElliptic
    212.  + MoveForward
    213.  + MoveGravity
    214.  + MoveHypotrochoid
    215.  + MoveSpiral
    216.  + MoveWave
    217.  + Mover
    218.  + OnlyTutorial
    219.  + OpacityPulse
    220.  + PanelSlider
    221.  + PhoneOffset
    222.  + PositionPulse
    223.  + Rotation
    224.  + ScalePulse
    225.  + StatisticsManager
    226.  + TestFlightManager
    227.  + ArmyPopup
    228.  + ArmyPopupUnitBig
    229.  + ArmyPopupUnitSmall
    230.  + BuyGamePopup
    231.  + BattleEvent
    232.  + CustomEvent
    233.  + MessageEvent
    234.  + ShopEvent
    235.  + HeroIcon
    236.  + HeroItemsPopup
    237.  + HeroItemsPopupAttribute
    238.  + HeroItemsPopupItem
    239.  + HeroPopup
    240.  + HeroPopupAttribute
    241.  + HeroPopupSlot
    242.  + Item
    243.  + ItemAttributeBonus
    244.  + LevelUpPopup
    245.  + LevelUpPopupAttribute
    246.  + Node
    247.  + NodeEvent
    248.  + NodeScript
    249.  + RewardPopup
    250.  + Road
    251.  + RoadBezierMidpoint
    252.  + TutorialVisualScript
    253.  + CreatureAbilityShopItem
    254.  + CreatureShopItem
    255.  + PlayerItemShopItem
    256.  + SpellShopItem
    257.  + ShopItem
    258.  + ShopPopup
    259.  + ShopPopupItemSlot
    260.  + UnitPanel
    261.  + WorldMap
    262.  + WorldMapCameraConfiguration
    263.  + WorldMapDebugPanel
    264.  + WorldMapGoldBar
    265.  + WorldMapHero
    266.  + WorldMapOpacityController
    267.  + WorldMapOverlay
    268.  + WorldMapSceneBuilder
    269.  + WorldMapScript
    270.  + WorldMapUnitRare
    271.  + WorldMapView
    272.  + WorldMapXPBar
    273.  + MouseTest
    274.  + PngLoadTest
    275.  + PrefabActiveTest
    276.  + PrefabActiveTest2
    277.  + StartScreen
    278.  + TestDisplays
    279.  + TestTextureLoading
    280. Will export symbols of pdb format
    281. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    282.    at Mono.Cecil.Mdb.MdbReader.ReadLocalVariables(MethodEntry entry, MethodSymbols symbols)
    283.    at Mono.Cecil.Mdb.MdbReader.Read(MethodSymbols symbols)
    284.    at Mono.Cecil.Cil.CodeReader.PatchRawMethodBody(MethodDefinition method, CodeWriter writer, MethodSymbols& symbols)
    285.    at Mono.Cecil.Cil.CodeWriter.WriteUnresolvedMethodBody(MethodDefinition method)
    286.    at Mono.Cecil.Cil.CodeWriter.WriteMethodBody(MethodDefinition method)
    287.    at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)
    288.    at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)
    289.    at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
    290.    at Mono.Cecil.MetadataBuilder.AddNestedTypes(TypeDefinition type)
    291.    at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
    292.    at Mono.Cecil.MetadataBuilder.AddTypeDefs()
    293.    at Mono.Cecil.MetadataBuilder.BuildTypes()
    294.    at Mono.Cecil.MetadataBuilder.BuildModule()
    295.    at Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
    296.    at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
    297.    at Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
    298.    at Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
    299.    at usw.Weaver.Weave()
    300.    at usw.Program.RunProgram(ConversionOptions options)
    301.    at usw.Program.Main(String[] args)
    302.  
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

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

    looks like .mdb file somehow ends up in the temp folder. Could you try exiting unity, delete temp folder in project directory, start Unity again and try to build?

    Also, could you report a bug so this doesn't get lost and so we could actually fix it?
     
  8. Dmitry-Pyalov

    Dmitry-Pyalov

    Joined:
    Dec 13, 2011
    Posts:
    125
    This doesn't help. Unity automatically deletes Temp folder on exit and restart doesn't help.

    I've submitted a bug report 615659 with the project to reproduce the case attached.
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks, I'll take a look at it tomorrow.
     
  10. DMTSource

    DMTSource

    Joined:
    Jul 11, 2013
    Posts:
    36
    I am trying to port my games to WP8 and am having the same issue when I build. I posted a report in case they need more examples of the bug:

    Case 616209
     
  11. WilloWisp

    WilloWisp

    Joined:
    Apr 13, 2014
    Posts:
    8
    Same issue here in Unity 4.5.1, please fix!!!
     
  12. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    Is that the whole error you get?
    You get SerializationWeaver error on Assembly-CSharp.dll, which means there is something related to your C# scripts. I would help if you could narow down to a most simple possible project.
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    The crash "System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values." is fixed in the very next patch release, which should come out on Thursday.

    @laurie: you're not posting the whole error message, so I don't know whether that's the same issue.
     
  14. AwesomePaul

    AwesomePaul

    Joined:
    Jan 16, 2014
    Posts:
    2
    Hi, Ive been having this same issue and ive just downlaoded and installed 4.5.2 and the issue persists, is there any workaround for this?
     
  15. Temujiing

    Temujiing

    Joined:
    Jul 14, 2014
    Posts:
    19
    Hello, I had the same problem. I created a new visual studio project and ran the weaver with the argument as debugging command line. When it break for the exception, you should be able to find out what function is failing. In my case it was a debug function so I just #if !UNITY_WINRT it.

    Best Regards,
     
  16. AwesomePaul

    AwesomePaul

    Joined:
    Jan 16, 2014
    Posts:
    2
    Thanks for the reply but the exception occurss duing the build so I couldn't add breakpoints.

    I finally tracked down the cause though. Apparently if you have unreachable code below a yield break it causes the exception.

    The following will cause the exception

    Code (CSharp):
    1. public IEnumerable test()
    2.     {
    3.         #if UNITY_WINRT
    4.             yield break;
    5.         #endif
    6.  
    7.         int i = 0;      
    8.     }
     
    TooManySugar likes this.
  17. Harry-Nguyen-OGAY

    Harry-Nguyen-OGAY

    Joined:
    Jul 22, 2014
    Posts:
    1
    I same error , plese help me if You fixed it !!!
    Thanks
     
  18. rchapman

    rchapman

    Joined:
    Feb 13, 2014
    Posts:
    105
    Can someone please chime in with *what* in the world a "Serialization Weaver" is? The forums have solutions, but nobody seems to be bothering to explain what this thing is supposed to do. That would definitely help me understand the problem.
     
  19. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,917
    Serialization Weaver is Unity's patching tool, it takes your compiled assembly and adds additional code inside for the data serialization purposes. That said adding additional code at IL level is not always easy :)
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That is a very good question :).

    Unity uses serialization in many places throughout the engine: anything from scene loading to object instantiation is achieved with the help of serialization. On Mono platforms, we achieve serialization by writing data directly to managed object fields with native Mono APIs (we just get a pointer to the object and write it as if it was native memory).

    However, we cannot do the same on .NET due to couple of reasons:

    * We cannot get a native pointer to managed objects. There's simply no native APIs to interact with the CLR from native code available to WinRT platforms;
    * Even if we could get a pointer, .NET implements a GC that moves memory around, so it wouldn't be safe to do it.

    So, we have couple of options. The first one (and obvious one), is to use reflection to write out the fields. We did that in Unity 4.2, however, that was so terribly slow that larger scenes took forever to load on phones. So, with 4.3, we started using Serialization Weaver for doing this job.

    The main purpose of Serialization Weaver is to generate serialization code for your classes at game build time. Suppose you have such class:

    Code (csharp):
    1.  
    2. internal class Foo : MonoBehaviour
    3. {
    4.     public int myInt;
    5.     public GameObject targetObject;
    6.     private RigidBody m_RigidBody;
    7.  
    8.     private void Start()
    9.     {
    10.         m_RigidBody = GetComponent<RigidBody>();
    11.         m_RigidBody.position = targetObject.GetComponent<Transform>().position + new Vector3(myInt, myInt, myInt);
    12.     }
    13.  
    14.     private void Update()
    15.     {
    16.         m_RigidBody.MovePosition(m_RigidBody.position + new Vector3(0.5f, 0.5f, 0.5f));
    17.     }
    18. }
    19.  
    When you build your game, serialization weaver will analyze your built scripts, will look at this class and will implement IUnitySerializable interface in it:

    Code (csharp):
    1.  
    2. internal class Foo : MonoBehaviour, IUnitySerializable
    3. {
    4.     public void Unity_Serialize()
    5.     {
    6.         UnityEngine.Serialization.SerializedStateWriter.Instance.WriteInt32(myInt);
    7.         UnityEngine.Serialization.SerializedStateWriter.Instance.WriteUnityEngineObject(targetObject);
    8.     }
    9.  
    10.     public void Unity_Deserialize()
    11.     {
    12.         myInt = UnityEngine.Serialization.SerializedStateReader.Instance.ReadInt32();
    13.         targetObject = UnityEngine.Serialization.SerializedStateReader.Instance.ReadUnityEngineObject() as GameObject;
    14.     }
    15.  
    16.     public void Unity_RemapPPtrs()
    17.     {
    18.         if (targetObject != null)
    19.         {
    20.             targetObject = UnityEngine.Serialization.PPtrRemapper.Instance.GetNewInstanceToReplaceOldInstance(this.targetObject) as GameObject;
    21.         }
    22.     }
    23. }
    24.  
    Serialization Weaver will generate specialized serialization code for each class that Unity might serialize - that is anything that is derived from UnityEngine.Object or marked with the System.SerializableAttribute. In result, this makes the serialization process very fast at runtime.

    Now you know how serialization works on WinRT platforms today :).

    By the way - the SerializationWeaver crash in question wasn't due to SerializationWeaver bug - there was a bug in Mono compiler. We fixed it in one of the patch releases.
     
    Last edited: Aug 28, 2014
  21. jonestictoc

    jonestictoc

    Joined:
    Jun 24, 2013
    Posts:
    7
    I am getting the same error and I found out it has to do with serialized generics. (It makes sense now after reading the above post). Below is the troubled code, you cannot do this. Removing the generic and replacing with GameObject worked.

    public class MOObjectPool<T> : MonoBehaviour, ObjectPool<T>
    where T : Component, Poolable
    {
    public T m_prefab; <- What is the Weaver going to do with this ?
    ...
    }
     
  22. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,917
    Please submit a bug with simple repro attached, so we can fix this in the future. Thank you
     
  23. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I'm ***pretty*** sure that we don't serialize generic fields.
     
  24. K1kk0z90_Unity

    K1kk0z90_Unity

    Joined:
    Jun 2, 2013
    Posts:
    90
    Hello,
    I'm getting this error when I try to build my game for Windows Phone 8. I'm using Unity 4.6.3f1.
    Instead I can build the game for Windows Store and it works correctly. I get this error only when trying to compile for Windows Phone.

    What can I do? Thank you in advance. :)
     
  25. thxu2

    thxu2

    Joined:
    Jan 12, 2016
    Posts:
    33
    Hi, i have this error when Build Windows 8.1 universal application.

    Code (CSharp):
    1. Error building Player: UnityException: Failed to run serialization weaver with command "Temp\StagingArea\Papermates.Windows\Data\Managed\Newtonsoft.dll" -pdb -verbose -unity-engine="Temp\StagingArea\Papermates.Windows\Data\Managed\UnityEngine.dll" "Temp\StagingArea\Papermates.Windows\TempSerializationWeaver" -additionalAssemblyPath="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5.1".
    2. Symbols will be read from Temp\StagingArea\Papermates.Windows\Data\Managed\UnityEngine.pdb
    3. Weaving assembly D:\crafties_unity\Temp\StagingArea\Papermates.Windows\Data\Managed\Newtonsoft.dll
    4. Symbols will be read from Temp\StagingArea\Papermates.Windows\Data\Managed\Newtonsoft.pdb
    5. + Newtonsoft.Json.JsonReaderException
    6. + Newtonsoft.Json.JsonSerializationException
    7. + Newtonsoft.Json.JsonWriterException
    8. + Newtonsoft.Json.Schema.JsonSchemaException
    9. Will export symbols of pdb format
    10. Mono.Cecil.ResolutionException: Failed to resolve System.Runtime.Serialization.Formatters.FormatterAssemblyStyle
    11.    � Mono.Cecil.Mixin.CheckedResolve(TypeReference self)
    12.    � Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)
    13.    � Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)
    14.    � Mono.Cecil.MetadataBuilder.AddField(FieldDefinition field)
    15.    � Mono.Cecil.MetadataBuilder.AddFields(TypeDefinition type)
    16.    � Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)
    17.    � Mono.Cecil.MetadataBuilder.AddTypeDefs()
    18.    � Mono.Cecil.MetadataBuilder.BuildTypes()
    19.    � Mono.Cecil.MetadataBuilder.BuildModule()
    20.    � Mono.Cecil.ModuleWriter.<BuildMetadata>b__0(MetadataBuilder builder, MetadataReader _)
    21.    � Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func`3 read)
    22.    � Mono.Cecil.ModuleWriter.WriteModuleTo(ModuleDefinition module, Stream stream, WriterParameters parameters)
    23.    � Mono.Cecil.ModuleDefinition.Write(String fileName, WriterParameters parameters)
    24.    � usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
    25.    � usw.Weaver.Weave()
    26.    � usw.Program.RunProgram(ConversionOptions options)
    27.    � usw.Program.Main(String[] args)
    28.  

    I have plugin with json.net dll.
     
  26. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,735
    It looks like FormatterAssemblyStyle is not supported on WSA, try to get rid of it.
     
  27. wayneh654

    wayneh654

    Joined:
    Nov 25, 2012
    Posts:
    15
    Hi all. I had the same problem with a Windows 10 build. It turn out to be my Bitdefender antivirus. More to the point the Ransomware Protection. If one is to turn this part of the Bitdefender off before a Unity3D build to Visual Studio you will find it works with no errors. Hope this helps.
     
  28. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    This is what I'm getting. At the very last stage of build process, like 95%+

    very similar to ones posted avobe. My Windows realtime protection is dissabled. Unity 4.7.2




    Code (CSharp):
    1.  
    2. Error building Player: Exception: Failed to run Serialization weaver with cmdline "Temp/StagingArea\TokyoWarfare.Windows\Data/Managed\Assembly-CSharp.dll" -pdb -verbose -unity-engine="Temp/StagingArea\TokyoWarfare.Windows\Managed/UnityEngine.dll" "Temp/StagingArea\TokyoWarfare.Windows\TempSerializationWeaver".[Temp/StagingArea\TokyoWarfare.Windows\Data/Managed\Assembly-CSharp.dll]
    3. Symbols will be read from Temp/StagingArea\TokyoWarfare.Windows\Managed/UnityEngine.pdb
    4. Weaving assembly G:\TWP\TokyoWarfare\Temp\StagingArea\TokyoWarfare.Windows\Data\Managed\Assembly-CSharp.dll
    5. Symbols will be read from Temp/StagingArea\TokyoWarfare.Windows\Data/Managed\Assembly-CSharp.pdb
    6. + Bird
    7. + Swarm
    8. + SwarmCenter
    9. + Rotateobject
    10. + TerrainRand
    11. + ElectronicRoadSign.DemoSceneGUI
    12. + ElectronicRoadSign.ElectronicArrowSignScript
    13. + ElectronicRoadSign.ElectronicRoadSignScript
    14. + HideMouse
    15. + UltraReal.AnimationCurveProperty
    16. + UltraReal.flicker
    17. + Photon.MonoBehaviour
    18. + AudioCrew
    19. + AudioGame
    20. + FPSDemoGUI
    21. + FPSDemoReactivator
    22. + FPSFireManager/ImpactInfo
    23. + FPSFireManager
    24. + MouseLock
    25. + FPSLightCurves
    26. + FPSParticleSystemScaler
    27. + FPSRandomRotateAngle
    28. + FPSShaderColorGradient
    29. + FPSShaderFloatCurves
    30. + MaterialType
    31. + FTEM_AnimationScrollTexture
    32. + FTEM_AnimationSpriteSheet
    33. + FTEM_DeadTime
    34. + FTEM_SampleSceneGUI
    35. + FTEM_StopCam
    36. + FTEM_VisibleBG
    37. + demoGUI
    38. + HTExplosion
    39. + CRT
    40. + AnimateTiledTexture
    41. + AnimateTiledTextureSinFade
    42. + CannonFire_Components
    43. + Menu_global_Audio
    44. + MusicPlayerCustom
    45. + RandAmbientPlay
    46. + RandBulletSFX
    47. + RandClipPlayer
    48. + music
    49. + CameraFacing
    50. + CameraMode
    51. + CameraShake
    52. + CriticalComponents
    53. + MangaComponents
    54. + DOF_Controller
    55. + DragMouseOrbit
    56. + FOC_modify
    57. + Fading
    58. + FlyCam
    59. + FlyCamera
    60. + HUDFPS
    61. + Layer_Cull_Dist
    62. + RotateAround
    63. + SlideShow
    64. + SmoothFollow
    65. + SmoothLookAt
    66. + SmoothLookFrame
    67. + move_Camera_Refs
    68. + CarSmoothFollow
    69. + zoom
    70. + CameraCycle
    71. + CameraCycleSingleCam
    72. + CloseGame
    73. + Aim_Cursor
    74. + ui_cursor_enabler
    75. + DeadOnEnter
    76. + DestroyPrefabTime
    77. + Destroyable_object
    78. + EnableRBodies
    79. + FxCarImpact
    80. + FxOnImpact
    81. + Impact_traffic
    82. + Impactable_object
    83. + CharacterMotorC/CharacterMotorMovingPlatform
    84. + CharacterMotorC/CharacterMotorMovement
    85. + CharacterMotorC/CharacterMotorJumping
    86. + CharacterMotorC/CharacterMotorSliding
    87. + CharacterMotorC
    88. + FPSInputControllerC
    89. + Headbobber
    90. + MouseLook
    91. + AA_DissableTurretParts
    92. + AssignTarget
    93. + Autoflip
    94. + BaggerTrapper
    95. + HoverStabilizer
    96. + ImpactComponents
    97. + MainGunTargetRay
    98. + QuakeManager
    99. + ShaderSwapper
    100. + SkinManager
    101. + SkinManagerManual
    102. + SpawnControl_CS
    103. + SpawnSpotProp
    104. + Stats
    105. + TrailEnabler
    106. + getMarkerPrefs
    107. + getTankIdPrefs
    108. + hatManager
    109. + HidingSmoke
    110. + LatestNews
    111. + CheatCode
    112. + Easer
    113. + ExitGame
    114. + Fader
    115. + Intro
    116. + MainMenu
    117. + MenuBackgroundManager
    118. + MenuShowPlayerRank
    119. + Menu_AI_Count_Flag_Manager
    120. + Menu_AI_Tank_Manager
    121. + Menu_ApplyAiTankProperties
    122. + Menu_Audio_Slider
    123. + Menu_Backwards
    124. + Menu_BlinkTxt
    125. + Menu_DatabaseReset
    126. + Menu_Flag_properties
    127. + Menu_LoadingScreen
    128. + Menu_Lobby_flags
    129. + Menu_MapManager
    130. + Menu_Multip_Ai_But_Enable
    131. + Menu_MusicVolume
    132. + Menu_Online_Player_Counter
    133. + Menu_PlayerWa
    134. + Menu_Recommend
    135. + Menu_ResetMapPrefs
    136. + Menu_Scene_Settings
    137. + Menu_Tank_Base_Properties
    138. + Menu_Tank_Era
    139. + Menu_Tank_Manager
    140. + Menu_Tank_Selection
    141. + Menu_Tank_Skins
    142. + Menu_ToggleManager
    143. + Menu_TutorialFirstLaunch
    144. + Menu_Unlocker
    145. + Menu_Waifu_Manager
    146. + MouseOrbitInfiniteRotateZoom
    147. + PlayerPrefsMenu
    148. + SceneLoader
    149. + TankProperties
    150. + TesterCallScript
    151. + TutorialVideoScripts
    152. + _DEV_CLEAR_PlayerPrefs
    153. + _DEV_CLEAR_PlayerPrefs_PressC
    154. + prueva
    155. + LobbyRegionSelect
    156. + LobbyRoomBrowser
    157. + LobbyRoomConnector
    158. + MultiplayerConnector
    159. + MultiplayerPlayerSetup
    160. + PlayerProperties
    161. + ResetBarrel
    162. + SpawnSpot
    163. + Sync_Pos
    164. + Sync_rot_and_pos
    165. + TeamColorizer
    166. + Teleport
    167. + multiplayer_disconect
    168. + On_Off
    169. + ParticleThermalControl
    170. + TankTrailControl
    171. + Player_Transporter
    172. System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
    173.    en Mono.Cecil.ImportGenericContext.TypeParameter(String type, Int32 position)
    174.    en Mono.Cecil.MetadataImporter.ImportTypeSpecification(TypeReference type, ImportGenericContext context)
    175.    en Mono.Cecil.MetadataImporter.ImportType(TypeReference type, ImportGenericContext context)
    176.    en Mono.Cecil.MetadataImporter.ImportTypeSpecification(TypeReference type, ImportGenericContext context)
    177.    en Mono.Cecil.MetadataImporter.ImportType(TypeReference type, ImportGenericContext context)
    178.    en Mono.Cecil.ModuleDefinition.Import(TypeReference type)
    179.    en Unity.Serialization.Weaver.MethodEmitterBase.ResolveGenericFieldReference(FieldReference fieldRef)
    180.    en Unity.Serialization.Weaver.MethodEmitterBase.EmitMethodBody()
    181.    en Unity.Serialization.Weaver.MethodEmitterBase.CreateMethodDef(String methodName)
    182.    en Unity.Serialization.Weaver.SerializationWeaver.AddSerializeMethod()
    183.    en Unity.Serialization.Weaver.SerializationWeaver.Weave()
    184.    en usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition)
    185.    en usw.Weaver.Weave()
    186.    en usw.Program.RunProgram(ConversionOptions options)
    187.    en usw.Program.Main(String[] args)
    188.  
     
  29. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    removing [Serializable] wherever it was seems it solvs the issue.