-
Notifications
You must be signed in to change notification settings - Fork 495
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
[Dependencies]: Removes direct reference for Newtonfoft package and add a target build. #4839
[Dependencies]: Removes direct reference for Newtonfoft package and add a target build. #4839
Conversation
… for consumer apps.
Really appreciate the time you took to write the overview (and the fact that it's also very well written!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slight nit in the overview - you should probably check "Breaking Change" instead of non-breaking bug fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
… package.config and package reference.
What would be the guidance here for a layer on top of the Cosmos SDK, e.g. the EF provider for Cosmos? Following the logic in this issue, the EF provider shouldn't reference a specific version of Newtonsoft.JSON for the exact same reason as Microsoft.Azure.Cosmos shouldn't. But if I understand correctly, only the project directly referencing Microsoft.Azure.Cosmos gets the build error about the lack of Newtonsoft.JSON, so that wouldn't work... In other words, it seems like the technique here doesn't work well for transitive scenarios where Microsoft.Azure.Cosmos isn't referenced directly by the user's end application, but rather via another layer. (This isn't an immediate concern for EF since the EF provider uses Newtonsoft.JSON directly for some things, and so must reference that in any case at the moment; but that may change. See dotnet/efcore#35171.) |
The .NET Aspire CosmosDB integration fits into this. My plan for it is to set
This isn't correct. Since the MSBuild logic is going into the With this plan, .NET Aspire's CosmosDB integration doesn't need to set a Newtonsoft.Json dependency, but anyone referencing it will. |
I see, thanks - I missed that part. So the EF provider will be able to do the same then. |
I'm having my own internal library using Microsoft.Azure.Cosmos and a different project relying on my internal library. Update: |
No, this is not correct. Someone, somewhere still needs to include a reference to Newtonsoft.Json, and it needs to be deployed with your applications. Microsoft.Azure.Cosmos still depends on it internally, but we want to get out of the business of being the package that dictates the version. So, you have two choices:
|
…eck property name. (#4918) # Pull Request Template ## Description Fixed property name in changelog from DisableNewtonsoftJsonCheck to AzureCosmosDisableNewtonsoftJsonCheck property name. This change provides the correct property name for disabling newtonsoft dependency build check. Reference PR: #4839 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) ## Closing issues To automatically close an issue: closes #4912
Pull Request Template
Description
The intent of this change is to ensure that the
Newtonsoft.Json
dependency, which is currently used within the SDK, does not propagate to downstream consumers as Package dependency. The SDK referencesNewtonsoft.Json
for its internal functionality, but this package should not be exposed to users of the SDK. This measure also avoids the risk of consumers relying on a specific version ofNewtonsoft.Json
that might have vulnerabilities or other limitations.Type of change
Newtonsoft.Json
package reference as private asset.Microsoft.Azure.Cosmos.targets
to ensure the Newtonsoft.Json dependency is not passed to consumer apps and there is a build failure when the consumer app do not have Newtonsoft package installed.Testing the change on a consumer console app with updated dotnet SDK package without installing newtonsoft package in consumer app:
Once the Newtonsoft nuget package is included the build succeeds:
Testing the change on a consumer console app with updated dotnet SDK package when consumer app installs any other version of newtonsoft package on their end:
Testing the change on a consumer console app with updated dotnet SDK package when consumer app uses packages.config:
Testing the change on a consumer console app with updated dotnet SDK package and Newtonsoft available as transitive dependency:
Testing the change on a consumer console app with updated dotnet SDK package and build failure and allowing consumer app the option to opt out this build failure due to missing newtonsoft:
Testing the change on a consumer console app by installing updated Microsoft.Azure.Cosmos.Encryption which has dependency on updated Microsoft.Azure.Cosmos package. The build failure happens if Newtonsoft is missing:
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #4674