Win10 apps in .NET- common library issues

This is Part 2 of my "VB Win10 Apps" series.


General VS2015 RC known issues

In general, the "known issues" are all detailed in this forum:

But that forum didn't cover the library cases that I've run into. So here they are:



In VS2015 RC, at runtime, when you invoke JsonConvert.SerializeObject or JsonConvert.DeserializeObject, then you might get a FileNotFoundException saying that it can't load the file "System.Runtime.Serialization".

Fix1: use the "latest stable 6.0.8" version of Newtonsoft.Json, not the preview 7.* version.

Explanation: the 7.* versions of Newtonsoft.Json are using a new way of structuring their NuGet package. It's a fine way, and will work in VS2015 RTM, but just doesn't work yet in RC. The exact text of the error message is

An exception of type 'System.IO.FileNotFoundException' occurred in Newtonsoft.Json.dll but was not handled in user code. Additional information: Could not load file or assembly 'System.Runtime.Serialization, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its components


Fix2: if you're trying to serialize/deserialize a type that's defined in a PCL, then change the PCL targets to exclude Silverlight5, and to only use .NET >= 4.5.1

Explanation: If your PCL targets .NET4.0.3 or older, or it targets Silverlight5, then it is a so-called "old style PCL". These will work fine in UWP apps when we get to VS2015 RTM, but they're not quite fully working in RC. You'll find this for instance if you try to reflect upon or serialize a class that's defined in such an old style PCL and has <DataContract> on it. The exact text of the error message is similar to the above, but comes from a different assembly:

An exception of type 'System.IO.FileNotFoundException' occurred in but was not handled in user code. Additional information: Could not load file or assembly 'System.Runtime.Serialization, Version=, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its components




SignalR Client is currently an "old-style PCL" and suffers from the same problem as above. The fix [2] above is to rebuild SIgnalR and remove the Silverlight target. This is a difficult task :( but MVP Joost van Schaik has helpfully provided detailed instructions:




SharpDX is a set of managed wrappers to use DirectX from within VB and C# apps. It's what underpins other high-level games libraries like MonoGame.

SharpDX works fine in UWP apps in VS2015 RC. It's a NuGet package: you add a reference to it via Project References > Manage NuGetReferences.

  • SharpDX.Toolkit doesn't install on VS2015 RC for UWP apps. I'm not sure if it's going to be able to install in VS2015 RTM. Note that the SharpDX toolkit is deprecated and no longer exists in SharpDX preview-3.0 going forwards.




SQLite is the best way to have a local database in your UWP app. It works fine in VS2015 RC.

  1. Install the "pre-release Sqlite for UAP apps" from the Sqlite download page This is only needed once per developer machine.
  2. Within your project, right click on References > AddReference > WindowsUniversal > Extensions > SQLite for Universal App Platform

That installs the low-level Sqlite native library. (Don't worry about the current build-time warning "No SDKs found"). On top of that you need a VB-accessible wrapper from it. There are a few common wrappers:


Sqlite-net.  This NuGet wrapper is currently delivered as C#-source-code only. So you'll need to create a trivial C# PCL to call it from VB...

  1. Right click on Solution > Add > NewProject > C# > Windows > Windows8 > Class Library (Portable for 8.1 Universal).
  2. Within that C# PCL, right click on References > Manage Nuget References > sqlite-net
  3. Within that C# PCL, go to Project > Properties > Build. Change the dropdown at the top to "Configuration: all configurations. And inside "Conditional compilation symbols type NETFX_CORE
  4. Within your app, right click on References > AddReference > Projects > Solution, and add a reference to the PCL you just created.

Here's some example sqlite-net code. I've shown two techniques to query the database, using "db.QueryAsync" and "db.Table.Where". The second db.Table.Where form currently has a limitation in sqlite-net, which doesn't understand string equality tests from VB (until they accept a pull-request I sent them!)

Async Function TestSqlAsync() As Task
    Dim db As New SQLiteAsyncConnection("db_name_1")
    Await db.CreateTableAsync(Of Customer)
    Await db.InsertAsync(New Customer With {.Name = "Fred", .Age = 41})
    Dim results1 = Await db.QueryAsync(Of Customer)("select * from Customer")
    Dim results2 = Await db.Table(Of Customer).Where(Function(c) c.Age > 20).ToListAsync()
End Function

Public Class Customer
    <PrimaryKey, AutoIncrement> Public Property Id As Integer
    Public Property Name As String
    Public Property Age As Integer
End Class


Sqlite.WinRT.UAP - I've not personally used this NuGet package and don't know what it's like



The LiveSDK hasn't yet been updated for UWP. Also in VS2015 RC you can't yet right-click on your project > Store > Associate App With Store. So there's not much you could do anyway.




There's an error message that a few people have encountered:

The type 'IAsyncOperation<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows,Version=, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'.

This error should never occur! It's usually a sign that you tried to upgrade from an earlier version of VS! If you get this error on a clean install of VS2015 RC, please let me know urgently. Thanks.