Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microsoft.Extensions.DependencyModel dependencies for .NET Framework #35006

Closed
jkotas opened this issue Apr 15, 2020 · 10 comments · Fixed by #35024
Closed

Microsoft.Extensions.DependencyModel dependencies for .NET Framework #35006

jkotas opened this issue Apr 15, 2020 · 10 comments · Fixed by #35024
Assignees
Labels
area-DependencyModel blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner

Comments

@jkotas
Copy link
Member

jkotas commented Apr 15, 2020

#34296 bumped the versions of its dependencies as side-effect. It breaks ingestions of Microsoft.Extensions.DependencyModel into SDK: dotnet/sdk#11246 (comment)

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-DependencyModel untriaged New issue has not been triaged by the area owner labels Apr 15, 2020
@ghost
Copy link

ghost commented Apr 15, 2020

Tagging subscribers to this area: @eerhardt
Notify danmosemsft if you want to be subscribed.

@jkotas jkotas added the blocking Marks issues that we want to fast track in order to unblock other important work label Apr 15, 2020
@eerhardt eerhardt self-assigned this Apr 15, 2020
@eerhardt
Copy link
Member

eerhardt commented Apr 15, 2020

Doing an initial investigation, it appears the reason System.Runtime.CompilerServices.Unsafe, 5.0.0.0 is being brought in on .NET Framework is because Microsoft.Extensions.DependencyModel is now referencing System.Text.Json on net461 (which references System.Runtime.CompilerServices.Unsafe, 5.0.0.0). Previously, DependencyModel was using Newtonsoft.Json, which doesn't bring in a newer System.Runtime.CompilerServices.Unsafe.

I believe what Microsoft.Extensions.DependencyModel is doing now is the correct thing to do going foward. So to resolve this issue, I think we either need to bump Microsoft.NET.HostModel to a newer System.Text.Json version, or we need to add a binding redirect.

@eerhardt
Copy link
Member

@swaroop-sridhar - is there a reason that Microsoft.NET.HostModel is using an older version of System.Text.Json?

<PackageReference Include="System.Text.Json" Version="4.7.0" />

Why isn't this compiling against the System.Text.Json that is in src\libraries?

@elinor-fung
Copy link
Member

cc @jkoritzinsky - version of System.Text.Json was explicitly set in #2115

@jkoritzinsky
Copy link
Member

The version was explicitly set because the version of System.Runtime.CompilerServices.Unsafe in the 5.0 package was broken at the time and that was blocking dotnet/runtime uptake to dotnet/sdk.

@eerhardt
Copy link
Member

the version of System.Runtime.CompilerServices.Unsafe in the 5.0 package was broken at the time

But that was fixed with #1918, right? Do we know of a reason why Microsoft.NET.HostModel shouldn't reference the 5.0.0 version of System.Text.Json now?

@jkoritzinsky
Copy link
Member

I didn't want to risk breaking anything by moving things, so I never went to go back to fix it.

eerhardt added a commit to eerhardt/runtime that referenced this issue Apr 15, 2020
Microsoft.Extensions.DependencyModel and Microsoft.NET.HostModel are both used on .NET Framework's MSBuild by dotnet/sdk's Microsoft.NET.Build.Tasks assembly. However, they are referencing differnet versions of System.Text.Json, which is causing file load errors on .NET Framework.

Fixing this by updating Microsoft.NET.HostModel to use a 5.0 version.

Fix dotnet#35006
eerhardt added a commit that referenced this issue Apr 17, 2020
)

Microsoft.Extensions.DependencyModel and Microsoft.NET.HostModel are both used on .NET Framework's MSBuild by dotnet/sdk's Microsoft.NET.Build.Tasks assembly. However, they are referencing differnet versions of System.Text.Json, which is causing file load errors on .NET Framework.

Fixing this by updating Microsoft.NET.HostModel to use a 5.0 version.

Fix #35006
eerhardt added a commit to dotnet/sdk that referenced this issue Apr 17, 2020
dotnet-maestro bot added a commit to dotnet/sdk that referenced this issue Apr 17, 2020
* Update dependencies from https://github.com/dotnet/runtime build 20200414.3

- System.CodeDom: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- Microsoft.NET.HostModel: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.4.20202.18 -> 5.0.0-preview.4.20214.3
- Microsoft.NETCore.DotNetHostResolver: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- Microsoft.NETCore.App.Ref: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- System.Security.Cryptography.ProtectedData: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- System.Text.Encoding.CodePages: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- System.Resources.Extensions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3
- Microsoft.DotNet.PlatformAbstractions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20214.3

* Update dependencies from https://github.com/dotnet/runtime build 20200415.10

- System.CodeDom: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- Microsoft.NET.HostModel: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.4.20202.18 -> 5.0.0-preview.4.20215.10
- Microsoft.NETCore.DotNetHostResolver: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- Microsoft.NETCore.App.Ref: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- System.Security.Cryptography.ProtectedData: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- System.Text.Encoding.CodePages: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- System.Resources.Extensions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10
- Microsoft.DotNet.PlatformAbstractions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20215.10

* Update dependencies from https://github.com/dotnet/runtime build 20200416.18

- System.CodeDom: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- Microsoft.NET.HostModel: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- Microsoft.Extensions.DependencyModel: 5.0.0-preview.4.20202.18 -> 5.0.0-preview.4.20216.18
- Microsoft.NETCore.DotNetHostResolver: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- Microsoft.NETCore.App.Ref: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- Microsoft.NETCore.App.Runtime.win-x64: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- System.Security.Cryptography.ProtectedData: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- System.Text.Encoding.CodePages: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- System.Resources.Extensions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18
- Microsoft.DotNet.PlatformAbstractions: 5.0.0-preview.4.20213.12 -> 5.0.0-preview.4.20216.18

* Revert update to DependencyModel to unblock.

See dotnet/runtime#35006

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
@eerhardt
Copy link
Member

This was verified with dotnet/sdk#11329. New versions of Microsoft.Extensions.DependencyModel are now consumed in dotnet/sdk.

@ericstj
Copy link
Member

ericstj commented Aug 20, 2020

@eerhardt did you intend to keep this consuming System.Text.Json via package? It looks like that's still the case (and the version has remained at Preview4) and additionally it is using an API which is now marked obsolete: IgnoreNullValues

writer.Write(JsonSerializer.Serialize(clsidMap, new JsonSerializerOptions { IgnoreNullValues = true }));

c2291eb /cc @layomia

@eerhardt
Copy link
Member

@eerhardt did you intend to keep this consuming System.Text.Json via package?

My intention with this change was to unblock the ingestion of the new DependencyModel library.

The uber issue tracking HostModel's dependency on System.Text.Json is #1823.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-DependencyModel blocking Marks issues that we want to fast track in order to unblock other important work untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants