applejag/Newtonsoft.Json-for-Unity

Question: Does it work on the XBox One Target? (Build Error)

diegoeche opened this issue ยท 5 comments

I'm sorry I can't be more specific. I'm a bit desperate :)

I'm developing a library for a 3rd party. I love how convenient this is, and so far, no issues whatsoever.

I sent my library to be tested in a variety of platforms. I got a bug-report back that adding this library is causing the build to fail. This happens without my code, but just by adding this library. The stack-trace is rather long, but it's complaining with an error message:

/Data/Managed\microsoft.xbox.services.winmd,Temp/StagingArea/Data/Managed\windows.winmd" "--alt=Microsoft.Win32.SafeHandles,mscorlib;System,mscorlib;System,System;System,System.ComponentModel.Composition;System,System.Core;System.CodeDom.Compiler,System;System.Collections,mscorlib;System.Collections.Concurrent,mscorlib;System.Collections.Concurrent,System;System.Collections.Generic,mscorlib;System.Collections.Generic,System;System.Collections.Generic,System.Core;System.Collections.ObjectModel,mscorlib;System.Collections.ObjectModel,System;System.Collections.Specialized,System;System.ComponentModel,System;System.ComponentModel.DataAnnotations,System.ComponentModel.DataAnnotations;System.ComponentModel.DataAnnotations.Schema,System.ComponentModel.DataAnnotations;System.Data,System.Data;System.Data.Common,System.Data;System.Diagnostics,mscorlib;System.Diagnostics,System;System.Diagnostics.CodeAnalysis,mscorlib;System.Diagnostics.Contracts,mscorlib;System.Diagnostics.Tracing,mscorlib;System.Dynamic,System.Core;System.Globalization,mscorlib;System.IO,mscorlib;System.IO,System;System.IO,System.Core;System.IO.Compression,System;System.IO.Compression,System.IO.Compression.FileSystem;System.IO.IsolatedStorage,mscorlib;System.Linq,System.Core;System.Linq.Expressions,System.Core;System.Net,System;System.Net.NetworkInformation,System;System.Net.Security,System;System.Net.Sockets,System;System.Numerics,System.Numerics;System.Reflection,mscorlib;System.Reflection.Emit,mscorlib;System.Resources,mscorlib;System.Runtime,mscorlib;System.Runtime.CompilerServices,mscorlib;System.Runtime.CompilerServices,System.Core;System.Runtime.ExceptionServices,mscorlib;System.Runtime.InteropServices,mscorlib;System.Runtime.InteropServices,System;System.Runtime.InteropServices,System.Core;System.Runtime.InteropServices.ComTypes,mscorlib;System.Runtime.InteropServices.ComTypes,System;System.Runtime.InteropServices.WindowsRuntime,mscorlib;System.Runtime.Serialization,mscorlib;System.Runtime.Serialization,System.Runtime.Serialization;System.Runtime.Serialization.Json,System.Runtime.Serialization;System.Runtime.Versioning,mscorlib;System.Runtime.Versioning,System;System.Security,mscorlib;System.Security.Authentication,System;System.Security.Authentication.ExtendedProtection,System;System.Security.Claims,mscorlib;System.Security.Principal,mscorlib;System.Text,mscorlib;System.Text.RegularExpressions,System;System.Threading,mscorlib;System.Threading,System;System.Threading,System.Core;System.Threading.Tasks,mscorlib;System.Threading.Tasks,System.Core;System.Windows.Input,System;System.Xml,System.Runtime.Serialization;System.Xml,System.Xml;System.Xml.Linq,System.Xml.Linq;System.Xml.Schema,System.Xml;System.Xml.Serialization,System.Xml;<winmd>,microsoft.kinect.face.winmd;<winmd>,microsoft.kinect.tools.winmd;<winmd>,microsoft.kinect.winmd;<winmd>,microsoft.xbox.input.arcadestick.winmd;<winmd>,microsoft.xbox.input.wheel.winmd;<winmd>,microsoft.xbox.services.winmd;<winmd>,windows.winmd" "--ignore=System.IConvertible,mscorlib"
Catastrophic failure while running rrw: System.UnauthorizedAccessException: Access to the path 'D:\wkspace\project-xbone\Unity\Project\Temp\StagingArea\Data\Managed\netstandard.dll' is denied.

I checked the library's manifest, and it seems netstandard.dll isn't something it depends on. Have you heard about any error during build that is like this?

I'm aware some platforms provide limited access to netstandard.dll like UWP. In my case I'm able to use this library in UWP without any issue.

Any help, even an "I don't know" would be greatly appreciated.

EDIT: Title and adding more info.

The error is super long. But maybe this bit is also important:

UnityException: Failed to run reference rewriter with command

Hi @diegoeche! Thanks for reporting this, this seems like an interesting one :)

I've yet had time to test the package for Xbox as I'm not keen yet to obtaining a dev license just for that. Maybe soonโ„ข๏ธ

The package comes with multiple builds targetting different .NET versions. For the editor the Newtonsoft.Json.dll depends on .NET Framework 4.6, but in most of the other builds it targets .NET Standard 2.0, something that according to the docs (https://docs.microsoft.com/en-us/dotnet/standard/net-standard#net-implementation-support) requires at least UWP v10.0.16299.

Though that does not correspond to the error message your platform tester receives. "Access to the path X is denied." Is this a permission issue? Really tricky issue to find info about online ๐Ÿ˜…

Here's everything related I could find:

What I can do from my end is recompile the package to target different .NET runtimes in the hopes that it will be compatible with your Xbox build and then deploy that in a new version with a "Newtonsoft.Json Xbox One"-specific .dll. But I will need more information before I can try assuming such a solution.


What I would like is more information on the issue, things like:

  • Package version (Newtonsoft.Json-for-Unity), specifically if not using the latest (12.0.301)
  • Of the machine doing the build:

This is a "I don't know" but I would really want to help you resolve this.

Thanks so much for the quick reply!

I'd need to get some of the info from the devs testing the code.

Here's some of the info you asked:

  • Full stacktrace: https://pastebin.com/9z71SJLv
  • Newtonsoft.JSON: I'm pretty sure it was the latest version of the package: 12.0.301. But will double check with the devs
  • Unity Version: custom build of 2019.3.5f1 ๐Ÿ™ˆ

Just a little update from my part

I'll get access to the XBox-one target this week. I'll try to make sure there isn't anything project specific that is causing the error. Will create a small project to see if I can isolate the issue.

tsira commented

Hi @diegoeche. Just wondering if you were able to get this to work? I've tested a very simple project with Unity Remote Config which uses Newtonsoft as a dependency successfully for xbox-one.

Hello @tsira. Sorry for the late reply.

I never got access to the XBox sdk. Since I'm a contractor, the company is having issues cutting through all the red-tape.

Because we were on a tight schedule, I replaced https://github.com/RicoSuter/NJsonSchema and Newtonsoft.Json for Unity's json serialization and my own DTO generator.