Here’s a fun problem. When creating a blank Unity project with an empty scene, building it to Windows 8.1, and adding certain SDKs in the Visual Studio solution, the project crashes on deployment. It builds fine, but when it starts to run it gets a System.TypeLoadException in the App.xaml.cs constructor App(), at appCallbacks = new AppCallbacks(false);
The error is as follows:
"An exception of type ‘System.TypeLoadException’ occurred in Template.exe but was not handled in user code
Additional information: Requested Windows Runtime type ‘UnityPlayer.AppCallbacks’ is not registered."
The certain SDK in question is the Microsoft Advertising SDK for Windows 8.1. When I remove the reference, the project runs fine again. Add it again, the app crashes. I do not access any of the API of the SDK in any way, simply adding the reference to the project causes the problem.
I am running Unity 4.5.5p5 and the issue occurs whether you build to Windows 8.1 alone or build a Universal 8.1 project. No issues occur if you add the SDK to a blank Windows Store App in Visual Studio (with no relation to Unity). This problem also occurs when adding the AdDuplex Windows 8.1 SDK (installable through NuGet).
Well I do have VS2013 Update 4 installed because it’s essential to have that update in order to even use Universal 8.1. Where can I see this bug report?
Okay that makes sense. When I didn’t have the required SDKs to build in Universal 8.1 the Microsoft site told me to just upgrade to the latest version (which is Update 4) so I did that. I’ll downgrade to Update 3 and see if that resolves the issue.
I had to completely uninstall Visual Studio 2013 and install Update 3, because apparently you can’t downgrade. In the end, it worked and the project runs fine now even with those references. It seems like it’d be a major pain for anyone stuck in this kind of situation because Microsoft wants you to upgrade to Update 4, which a lot of people would do only to find out (in no obvious way) that they can’t develop properly for Windows 8.1 on Unity.
What Unity3D versions do you think will get a patch or update for this?
Unity4.5.x or Unity4.6.x? As long as Unity4.6.x gets an update I think people should be fine.
We’ll first need to investigate the issue in the first place - it might be that the VS version might not be actually the issue here. It was a shot in the dark, but it doesn’t mean it’s a correct one :).
I just ran into this too. I thought it was because I updated to Unity 4.6, but now I realize it was because I upgraded VS to Update 4. I guess I’ll have to go back to Update 3. Ugh.
Uninstalled VS with Update 4, and reinstalled with Update 3. It’s still broken, though. I’m not sure what to try at this point. I can no longer build and launch a Unity app on Win 8.1 if the app uses the advertising SDK.
Microsoft acknowledged there’s a bug in Visual Studio 2013 Update 4 and it will get fixed in the near future. In the meantime you can either downgrade to Update 3 or manually edit AppxManifest.xml after build (the problem is that UnityPlayer.dll extension is removed and it needs to be readded). If none of this works for you please leave me a private message and I’ll try to help you.