Building with Hololens / issue

Hello,

I have problems building my project for Hololens. I can see in the editor log one issue:

Assets\AstarPathfindingProject\Core\Serialization\TinyJson.cs(79,27): error CS1579: foreach statement cannot operate on variables of type '?' because '?' does not contain a public definition for 'GetEnumerator'

(Filename: Assets\AstarPathfindingProject\Core\Serialization\TinyJson.cs Line: 79)

Do you have any idea to correct that ?

Thx,
Cédric

Hi

Which version are you using?

Thank you very much for answering quickly.
I am using the latest version.
I have just downloaded the free version to test this plugin this morning. This should be version 4.0.10.

Do the lines around where that error come from include “#if NETFX_CORE”? It has happened previously that my build script has stripped out those lines in the free version.

Yes this is around “#if NETFX_CORE”. Difficult to check with Unity but I have commented the Serialize method to check and now it is compiling. I will check by uncommenting the method inside the build, VS should be able to tell me precisly where is the problem.

If you think there is no problem with the pro version, I can give it a try since I was able to make a what I want with the free version.

It’s just odd, because there were some problems with this script on Hololens earlier, but those issues were solved and I know that people have managed to get it to compile on Hololens.
(see Trying to use this with Hololens [solved]).
I haven’t changed that part of the script in almost a year (and not since people did manage to get it to work in the thread above).

Are there any other errors that you are getting?

I have bought the pro version on the assetstore (it is 4.0.6 not 4.0.10 like the free version on your website).
So tell me if I am wrong but the variable “tpInfo” was not declared for platform NETFX_CORE and in the legacy code, you were using another variable called “typeInfo”, it was:

if NETFX_CORE
	var optIn = tpInfo.CustomAttributes.Any(attr => attr.GetType() == typeof(JsonOptInAttribute));
else
	var optIn = typeInfo.GetCustomAttributes(typeof(JsonOptInAttribute), true).Length > 0;
endif

So I tried to change to “tpInfo” in “typeInfo”:

if NETFX_CORE
		var optIn = typeInfo.CustomAttributes.Any(attr => attr.GetType() == typeof(JsonOptInAttribute));
else
                var optIn = typeInfo.GetCustomAttributes(typeof(JsonOptInAttribute), true).Length > 0;
endif

There is the same modification to do on the next #if statement.

So now Unity 5.6.0f3 generates the project but I have 88 compilation errors in the console. Many errors linked to the same DLL:

Reference rewriter: Error: method System.Void System.Console::Write(System.String,System.Object) doesn’t exist in target framework. It is referenced from Pathfinding.Ionic.Zip.Reduced.dll at System.Void Pathfinding.Ionic.BZip2.BZip2OutputStream::TraceOutput(Pathfinding.Ionic.BZip2.BZip2OutputStream/TraceBits,System.String,System.Object[]).

Reference rewriter: Error: type System.Threading.ThreadPool doesn’t exist in target framework. It is referenced from Pathfinding.Ionic.Zip.Reduced.dll at System.Void Pathfinding.Ionic.BZip2.ParallelBZip2OutputStream::Write(System.Byte[],System.Int32,System.Int32).

Aah. I see.
It turns out I have been doing some refactoring on that code to improve the code style, but MonoDevelops method for renaming all usages of a field apparently does not catch the case when it is inside an #if statement.
Sorry about that.

Unity is not good at preserving the settings I set for the dll files it seems. I have tried to mark that dll as not being included for Windows Store apps, but for some reason the UnityPackage doesn’t seem to copy that change. I thought I had fixed it this time, but apparently not.

The solution is simple anyway. You just need to select that dll file in Unity and change the settings so that it is excluded from any Windows Store builds.

Yeah. It takes a few weeks to get updates approved on the Unity Asset Store, so I prefer to only release smaller updates on my website. You can download the latest pro version by just entering your invoice number here: https://www.arongranberg.com/astar/download

:smile: ok so now I have to give your 5 stars for your support in the assetstore !

Everything is compiling fine.
I have now a weird error in my code but I will probably open another topic for this one since it is not related to this topic !

Yay! :slight_smile:

Ok. I will look for it. It’s getting late here though, so I might not have time to answer today.

Yeah no problem ! Getting late in France too :smile: