You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/04/18 02:18:00 UTC

[jira] [Commented] (AVRO-2112) c# (.net) port to .NET Standard 2.0 and nuget (package) dependencies

    [ https://issues.apache.org/jira/browse/AVRO-2112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16441777#comment-16441777 ] 

ASF GitHub Bot commented on AVRO-2112:
--------------------------------------

blachniet opened a new pull request #307: AVRO-2112: Target .NET Standard/Core in C#
URL: https://github.com/apache/avro/pull/307
 
 
   - JIRA Issue: [AVRO-2112](https://issues.apache.org/jira/browse/AVRO-2112)
   - Replaces PR #300 
   - Replaces PR #261 
   
   ## 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:
   
   * Executable projects (including the unit test project) targets .NET Core 2.0
   * Library projects target .NET Standard 2.0
   * All projects target .NET Framework 3.5 & 4.0
   
   #### Project Target Framework Table
   
   Project       | Type         | .NET Standard 2.0  | .NET Core 2.0      | .NET Framework 3.5 | .NET Framework 4.0
   ------------  | ------------ |:------------------:|:------------------:|:------------------:|:------------------:
   Avro.codegen  | Exe          |                    | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark:
   Avro.ipc      | Library      |                    |                    | :heavy_check_mark: | :heavy_check_mark:
   Avro.ipc.test | Unit Tests   |                    |                    | :heavy_check_mark: | :heavy_check_mark:
   Avro.main     | Exe          | :heavy_check_mark: |                    | :heavy_check_mark: | :heavy_check_mark:
   Avro.msbuild  | Library      | :heavy_check_mark: |                    | :heavy_check_mark: | :heavy_check_mark:
   Avro.perf     | Exe          |                    | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark:
   Avro.test     | Unit Tests   |                    | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark:
   
   #### 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 the
   `Avro.ipc` test, only target .NET Framework 3.5 and 4.0.
   
   See commit https://github.com/apache/avro/commit/24a5d9ccdf313443c513035c308393a54c625296.
   
   #### 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][3]:
   
   > In addition, if your app targets version 2.0, 3.0, or 3.5, your users may be required to enable the .NET Framework 3.5 on a Windows 8 or Windows 8.1 computer before they can run your app. 
   
   By targeting both 3.5 and 4.0:
   * An app that targets 3.5 still works
   * An app that targets 4.0+ does not require that 3.5 is installed on the end user's machine
   
   ### NUnit 3
   
   This PR includes all changes from PR #299 ([AVRO-2161](https://issues.apache.org/jira/browse/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 https://github.com/apache/avro/commit/d21d754d9cd6226de3f32c320f26b7d8332a57bc
   
   ### 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. See
   [this comment](https://github.com/apache/avro/pull/261#issuecomment-373957329) for a description of why this is necessary. These
   tests are enabled when targeting the .NET Framework. See commit https://github.com/apache/avro/commit/0544c03aad230c4fd98dedadeca6d23f71a8918c
   
   The table below shows the number of passing unit tests before and after for each target framework.
   
   |        | .NET 3.5 | .NET 4.0 | .NET Core 2.0 |
   | -----  |:--------:|:--------:|:-------------:|
   | Before | 520      | N/A      | N/A           |
   | After  | 520      | 520      | 498*          |
   
   *.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.
   
   ```
    520
   -  3 System.CodeDom compilation tests not supported by .NET Core
   - 19 IPC tests - IPC not targeting .NET Standard/Core at this time
   ====
    498
   ```
   
   
   ### 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 of
   Newtonsoft.Json, `JToken.ToString()` returns a simple string representation of the value. For example:
   
   ```c#
   JToken token = "Hello World";
   Console.WriteLine(token.ToString()); 
   ```
   
   The code block above prints different values depending on the version of Newtonsoft.Json in use:
   - v3.5: `\"Hello World\"`
   - Later versions: `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 use `JsonConvert.Serialize()`. When we need the string value
   of a string `JToken`, we use `JToken.Value<string>()`.
   
   See commit https://github.com/apache/avro/commit/d2ce55caa8afe9cb1acd6a694f0276adf7084fa6
   
   *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
   
   * Unit Tests: One test project that targets .NET Core & .NET Framework. PR #300 had one test project per target with copied code files.
   * Target Frameworks: Continued support for .NET Framework 3.5. PR #300 had deprecated this.
   * Newtonsoft.Json: Continued support for Newtonsoft.Json 3.5. PR #300 referenced Newtonsoft.Json 9.0.1.
   
   ## Other Reference Material
   
   * [MSBuild integration of NuGet warnings and errors](https://blog.nuget.org/20170815/Whats-nu-in-NuGet-with-VS2017-15-3.html#msbuild-integration-of-nuget-warnings-and-errors)
   * [.NET Standard Versions](https://docs.microsoft.com/en-us/dotnet/standard/net-standard)
   * [Target frameworks](https://docs.microsoft.com/en-us/dotnet/standard/frameworks)
   * [.NET Framework Versions and Dependencies](https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies)
   
   [1]: https://github.com/dotnet/standard/blob/master/docs/versions/netstandard2.0.md#whats-new
   [2]: https://docs.microsoft.com/en-us/dotnet/standard/net-standard
   [3]: https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies#targeting-and-running-apps-for-older-versions

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> c# (.net) port to .NET Standard 2.0 and nuget (package) dependencies
> --------------------------------------------------------------------
>
>                 Key: AVRO-2112
>                 URL: https://issues.apache.org/jira/browse/AVRO-2112
>             Project: Avro
>          Issue Type: Improvement
>          Components: csharp
>         Environment: - Visual Studio For Mac
> - Visual Studio 2017
> - mono 5.4.1.7 MacOSX
> - dotnet 2.0 (MacOSX and Windows 10)
>            Reporter: Miljenko Cvjetko
>            Assignee: Miljenko Cvjetko
>            Priority: Minor
>   Original Estimate: 0h
>  Remaining Estimate: 0h
>
> Suugestion is to add .NET Standard/Core support.
> In order to support modern/new .NET (both standard netfx and dotnet core) it is necessary to convert projects to support .NET Standard Libraries. 
> - conversion to .NET Standard [DONE]
> - added dotnet core sample (Avro.perf) [DONE]
> - added netfx (standrd .NET) sample Avro.perf.netfx [DONE]
> - unit testing updated to use NUnit 3
> Url for the github forked repo with branch will be added.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)