Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Extension ships with a newer Newtonsoft.Json than Visual Studio 2017 #1774

Closed
kzu opened this issue Jul 10, 2018 · 5 comments
Closed

Extension ships with a newer Newtonsoft.Json than Visual Studio 2017 #1774

kzu opened this issue Jul 10, 2018 · 5 comments
Milestone

Comments

@kzu
Copy link

kzu commented Jul 10, 2018

The currently published extension ships with Json.NET version 10.0.x whereas VS ships built-in with 9.0.x. It's strongly advised that you do not ship newer versions of built-in VS assemblies, since that can cause incompatibilities or breakages in other packages.

Might be related to https://developercommunity.visualstudio.com/content/problem/287648/xamarin-android-and-ios-projects-will-not-load-aft.html.

@grokys
Copy link
Contributor

grokys commented Jul 10, 2018

The reason we're now doing this is that one of our dependencies uses 10.0. I can check whether that dependency is happy with 9.0, but if not, what is the recommended way of fixing this?

@jcansdale
Copy link
Collaborator

@kzu 👋 should we treat Newtonsoft.Json as a Visual Studio assembly and not package it at all?

@kzu
Copy link
Author

kzu commented Jul 11, 2018

That's tricky. We had package load failures in some cases if we didn't distribute it, so we always make sure we distribute the same version as the VS we ship with :(

@kzu
Copy link
Author

kzu commented Jul 11, 2018

Also of interest: VS ships with binding redirects for this, currently:

			<dependentAssembly>
				<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
				<bindingRedirect oldVersion="1.0.0.0-9.0.0.0" newVersion="9.0.0.0"/>
			</dependentAssembly>

So you can build against any older version, but not newer.

@jcansdale
Copy link
Collaborator

@kzu,

It appears VS 2015 only knows about 4.5.0.0-6.0.0.0:

                <dependentAssembly>
                    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral"/>
                    <bindingRedirect oldVersion="4.5.0.0-6.0.0.0" newVersion="6.0.0.0"/>
                </dependentAssembly>

Do you know what is happening to cause the breakage? I can't immediately think of a scenario short of an extension calling Assembly.Load("Newtonsoft.Json") and assuming a particular version. I'd like to understand what's going on here.

I'm wondering if we should be using a [ProvideCodeBase] attribute for Newtonsoft.Json? We're now using ProvideBindingPath to make sure that our assemblies can be resolved (including from .imagemanifest, see #1236).

This will have the side effect of making our version of Newtonsoft.Json available via Assembly.Load("Newtonsoft.Json"). We could put it on a different path and explicitly specify its code base.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants