I'm using Visual Studio 2017 v15.3.3. My UWP project is targeting Windows Creators Update 15063, and my Nuget packages are as follows:
My solution builds without errors, and runs fine, however I am encountering errors at design-time in my UWP app project, due to the fact that my code-behind and/or ViewModel code is referencing NuGet packages. This is what I'm seeing:
This problem is not unique to System.Reactive. I encounter a different (but seemingly related) error with the Newtonsoft.Json v10.0.3 package:
Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The bound assembly has a version that is lower than that of the request. (Exception from HRESULT: 0x80132000)
Interestingly, downgrading System.Reactive to v3.0.0 doesn't fix the issue: the error claims that the system can't find the v3.0.0 assembly.
Similar issue with the latest AutoMapper package (v6.1.1)
To reproduce the problem:
UserControl
var s = new Subject<int>();
and add using System.Reactive.Subjects;
... or check out this sample here
The frustrating thing is that those big 3 packages (System.Reactive, Newtonsoft.Json, AutoMapper) all worked fine in my UWP project when it was in Visual Studio 2015 a few weeks ago before switching to VS 2017.
The only thing that has worked so far is downgrading Newtonsoft.Json from the latest v10.0.3 to v9.0.1 (downgrading to v10.0.2 or 10.0.1 did not work). Unfortunately I cannot downgrade System.Reactive as they have unlisted versions lower than 3.0
I have also tried performing a repair of my VS installation, as well as installing the mobile/xamarin components.
Any workarounds or insights would be much appreciated, since this is a blocking issue for me, thanks!
The problem is that the 3.0.0 version of System.Reactive
can not be very compatible with UWP. And I solve this via update to System.Reactive 4.0.0-preview
with the following command in Package Manager Console.
Install-Package System.Reactive -Version 4.0.0-preview00001
And you could also Disable project code in the xaml designer to solve this. For more, you could refer to Debugging or Disabling Project Code in XAML Designer.
In many cases, unhandled exceptions in the XAML designer can be caused by project code attempting to access properties or methods which return different values or work in different ways when your application is running in the designer. You can resolve these exceptions by debugging the project code in another instance of Visual Studio, or temporarily prevent them by disabling project code in the designer.
Update
For Newtonsoft.Json
, it seems that WinRT component failed to find the correct assembly of Newton.Json. Temporarily the workaround is to manually add the Newtonsoft.json.dll
file. You can achieve this by following steps:
Right click References-> Add Reference->Browse...-> Find C:\Users.nuget\packages\Newtonsoft.Json\10.0.3\lib\portable-net45+wp80+win8+wpa81\Newtonsoft.json.dll->Click Add button. Rebuild your project and run. This error should be gone.\
And you could also use the above way to solve the AutoMapper
issue .
User contributions licensed under CC BY-SA 3.0