-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
AVRO-2112: Target .NET Standard/Core in C# #307
Conversation
hey @blachniet - changes look fantastic. But when running I'm not sure if this is a limitation of current tools in .net and I don't have any definitive best path. What do you think of having Details: New windows machines lacking .net35
Linux, running
|
Hey @SidShetye, I got the same results on my machines (both Windows and Linux) when working on this. The When using For more details on this error message, see this issue in the MSBuild project. In short, it seems that there is no plans to add support for targeting earlier versions of the .NET Framework (3.5, 4.0) from the Side NoteIn this pull request I aimed for additive changes only. That's why I did not deprecate support for .NET Framework 3.5. That being said, I'm happy to deprecate support for earlier versions of the .NET Framework in this project if the rest of the community is happy with that. I'm perfectly happy to target .NET Standard 2.0 (.NET Framework 4.6.1+ according to the chart here). I'm not sure who makes that kind of decision on this project. |
@blachniet Thanks, Frankly, I don't really see a big use case where someone will be doing a new project with code from this PR but then targets .NET35. @busbey Can you please take a look at this PR and fold it in? Also who is responsible for publishing the nuget packages? |
We are looking forward to get .netstandard compatible avro as we looking forward to writing consumer using AWS Lambda and C# Do you guys have a timeframe when this will be published or how we can build locally? |
I'm not sure when these changes will be available in an official release. There's a lot of changes here, so I imagine it will take some time for the maintainers to review it. My team is going to need these features soon, as well. I've been releasing some of the features I've been adding recently in the blachniet.Avro NuGet package. I have not released the .NET Standard support in this package yet, but will soon (especially if others need it). You can see some of my additions in the release notes here. |
@HaroonSaid, I pushed a new release of my NuGet package here:
That release contains the changes included in this PR (plus some others). That release has support for targeting .NET Standard 2.0, in addition to .NET Framework 4.5 and 4.6 (see the Target Frameworks table here. |
@blachniet Can you rebase onto latest master? |
Done, but the build is failing due to some "Files with unapproved licenses". These failures are in the README and generated test files. |
@blachniet Do you think to either add an exception in |
Thanks for picking this up again @blachniet There are still some issues with the build:
|
Hi @Fokko, Yes, I'm still trying to work thru the build for this guy. When I install Mono in a local container, |
In Newtonsoft.Json v3.5, JToken.ToString() returned the raw JSON representation of the token. In later versions of Newtonsoft.Json, JToken.ToString() returns a simple string representation of the value. See the examples below: - v3.5: "\"Hello World\"" - Later versions: "Hello World" In this commit, I've updated the project to work with later versions of Newtonsoft.Json as well as v3.5. I've replaced some usages of JToken.ToString(). When we need the raw JSON representation, we use JsonConvert.Serialize(). When we need the string value of a string JToken, we use JToken.Value<string>().
This is what we were doing on master. I was trying to run the IPC tests, but that has not seemed to work well in our automated builds.
Thanks for picking this up @blachniet I also noticed that some tests take a LONG time to run. Can you create a ticket for this to optimize and re-enable the tests again? Thanks! |
https://issues.apache.org/jira/browse/AVRO-1769 The implementation of Jansson has been removed. apache#307 The implementation of nunit.framework.dll,Newtonsoft.Json.dll and Castle.Core.dll has been removed. apache#2756 The implementation of m4 macros has been removed. apache@8a42cd0 Boost.hhThe implementation of Boost.hh has been removed.
Differences from
apache/avro master
Target Frameworks
All projects targeted .NET Framework 3.5 both before and after these changes. Some projects target additional frameworks after these changes:
Project Target Framework Table
IPC
I kept running into various issues with unit tests for the IPC project. Instead of holding up the transition to .NET Standard for the
for the other projects. I decided, to move the IPC tests into their own project,
Avro.ipc.test
. This new project, as well as theAvro.ipc
test, only target .NET Framework 3.5 and 4.0.See commit 24a5d9c.
Targeting .NET Framework 4.0
We are targeting .NET Framework 4.0 in addition to 3.5 so that end users are not required to install .NET Framework 3.5 just for the
Avro library. From Targeting and running apps for older versions:
By targeting both 3.5 and 4.0:
NUnit 3
This PR includes all changes from PR #299 (AVRO-2161). At the time of this writing, PR #299 has not been merged into the
apache/avro master branch (PR is still open).
See commit d21d754
NuGet Dependencies
Removed DLLs that we depend on from the
lib/
folder and instead refernce their NuGet package equivalents.Unit Tests
Disabled unit tests that rely on
System.CodeDom
compilation when targeting .NET Core. Seethis comment for a description of why this is necessary. These
tests are enabled when targeting the .NET Framework. See commit 0544c03
The table below shows the number of passing unit tests before and after for each target framework.
*.NET Core 2.0 has fewer tests because IPC is not currently targeting .NET Standard/Core, and a few tests relied on
System.CodeDom
compilation.
Support for Later Versions of Newtonsoft.Json
In Newtonsoft.Json v3.5,
JToken.ToString()
returned the raw JSON representation of the token. In later versions ofNewtonsoft.Json,
JToken.ToString()
returns a simple string representation of the value. For example:The code block above prints different values depending on the version of Newtonsoft.Json in use:
\"Hello World\"
Hello World
I've updated the project to work with later versions of Newtonsoft.Json as well as v3.5. I've replaced some usages
of
JToken.ToString()
. When we need the raw JSON representation, we useJsonConvert.Serialize()
. When we need the string valueof a string
JToken
, we useJToken.Value<string>()
.See commit d2ce55c
Note that the project still references Newtonsoft.Json v3.5. The changes I describe above enable clients to use later versions of
Newtonsoft.Json without breaking compatibility with Newtonsoft.Json v3.5.
This change fixes the two
TestAliases
unit tests that were failing in PR #300.Differences from PR #300
Other Reference Material