Error during Windows Store build process: pdb is missing in (VSSolution)/Assets/Plugins/Metro/Win81

Hi.

Here is the problem:

  • my windows store plugin (“Plugin.dll” assembly) depends of assembly Newtonsoft.Json.dll.

  • both assemblies (and my plugin’s .pdb) are located in: Assets/Plugins/Metro and Assets/Plugins/Metro/Win81 - so, three files: Newtonsoft.Json.dll, Plugin.dll, Plugin.pdb. There is no Newtonsoft.Json.pdb (I just don’t have it)

  • I make a VS solution for Windows Store Apps (Universal SDK 8.1, XAML C#)

  • When I open it, Windows Store project contains Newtonsoft.Json.pdb (are you creating it?)

  • When I build this project, your custom command is being executed

  • This command contains this: if exist “(ProjectDir)Newtonsoft.Json.pdb" del "(ProjectDir)Newtonsoft.Json.pdb”; if exist “(ProjectDir)\Plugins\Metro\Win81\Newtonsoft.Json.pdb" copy /Y "(ProjectDir)\Plugins\Metro\Win81\Newtonsoft.Json.pdb”

  • First, Newtonsoft.Json.pdb is deleted, then it tries to copy it from (ProjectDir)\Plugins\Metro\Win81\Newtonsoft.Json.pdb.** Unfortunately, this file does not exist. But what exists is **(ProjectDir)\Plugins\Metro\Newtonsoft.Json.pdb (WIn81 part is missing).

  • So, solution is broken due to the pdb file that was added to solution but does not exist anymore

  • It generates an error if I create package with “include public symbols” because it can’t find pdb. The error text is kind of dumb and it took time to realize where the problem is…

Is this an error of Unity building process which doesn’t generate .pdb file in Metro subfolders?

I have Metro/Win81 and Metro/WindowsPhone81 subfolders because my plugin behaves differently for these two platforms

Unity 4.6.5f1

If I copy .pdb from (VSSolution)/Plugins/Metro to (VSSolution)/Plugins/Metro/Win81 build fails on this:

System.InvalidOperationException: Invalid state of object
в Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
в Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
в Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParamete
rs parameters)
в Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters para
meters)
в Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters para
meters)
в Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters pa
rameters)
в Unity.LoadModulesStep.Execute()
в Unity.Step.Execute(OperationContext operationContext, IStepContext previous
StepContext)
в Unity.Operation.Execute()
в Unity.Program.Main(String[ ] args)

On this command:
(UnityWSAPlayerDir)\Tools\AssemblyConverter.exe" -platform=wsa81 "(ProjectDir)\Assembly-CSharp-firstpass.dll” “(ProjectDir)\Assembly-CSharp.dll" "(ProjectDir)\DOTween.dll” “(ProjectDir)\UnityEngine.dll" "(ProjectDir)\UnityEngine.UI.dll” “(ProjectDir)\WinRTLegacy.dll" "(ProjectDir)\Ionic.Zlib.CF.dll” “(ProjectDir)\Plugin.dll" "(ProjectDir)\Newtonsoft.Json.dll”

It works fine, though, if I remove “$(ProjectDir)\Newtonsoft.Json.dll” part from it.

it’s still here. Anybody from Unity?

There’s an easy workaround as I mentioned, but this thing doesn’t seem right to me.

So, are you saying Newtonsoft.Json.pdb never existed or it existed before, but then you deleted it ?

Note: Unity doesn’t overwrite VS solution if it’s already present, did you try building to empty folder?

It never existed. It gets created somehow when I build a VS solution from Unity, and it is being added to the solution
After that you delete it, because that’s what is written in your prebuild script in project settings:

if exist “(ProjectDir)Newtonsoft.Json.pdb" del "(ProjectDir)Newtonsoft.Json.pdb”

Then this script tries to copy it again:
if exist “(ProjectDir)\Plugins\Metro\Win81\Newtonsoft.Json.pdb" copy /Y "(ProjectDir)\Plugins\Metro\Win81\Newtonsoft.Json.pdb” “$(ProjectDir)Newtonsoft.Json.pdb”

but there is no such file in that folder, so the reference is broken

It happened on a clean build.

I see, well I guess as a temporary workaround you could remove that line from build events in Visual Studio.

Could you sumbit a bug report or switch to 5.1, this problem was probably fixed there.

Report’s number is 706372
I was also able to reproduce it on small new project

Unfortunately migrating to unity 5+ is kind of difficult, the project is not that small. I would love to see that fixed in 4.6 branch