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

Support for .Net Core #54

Closed
axunonb opened this issue Feb 6, 2017 · 10 comments
Closed

Support for .Net Core #54

axunonb opened this issue Feb 6, 2017 · 10 comments

Comments

@axunonb
Copy link
Collaborator

axunonb commented Feb 6, 2017

Have you ever considered adding support for .Net Core? With the current version of .Net Core XML serialization is quite bulky and having YAXLib at hand would be a relief. I already gave it a try and there would of course be some code adjustments necessary, mainly for conditional compilation in terms of reflection. But by making use of a modified version of the extension methods from https://github.com/StefH/ReflectionBridge it should be feasible. Interested?

@sinairv
Copy link
Collaborator

sinairv commented Feb 6, 2017

Quite interested. I just have time restrictions. There are lots of other enhancements apart from support for .NET Core in my mind that I simply don't have the time to do.

@axunonb
Copy link
Collaborator Author

axunonb commented Feb 9, 2017

Okay, Sina, I gave it a shot for a full day. So far I have achieved the following:

  1. .Net Framework code modified, all unit test still pass. Good.
  2. .Net Core code compiles, 122 unit tests pass, 78 still fail. Tests not supported under .Net Core excluded.

Looks like tests will become kind of a headache for 3 reasons:

  1. Test code contain types currently not supported in .Net Core (e.g. System.Drawing.Color, Dataset...), that's why support of these types is not a must for YAXLib for now, but they are required for the tests. So which tests could be skipped for .Net Core is a key question.
  2. A good part the test results come close to the asserted, so the number of failures is not that discouraging. But "close" is not equal. Example for AnotherArraySampleTest()´:
    Expected and working with .Net Framework 4:
<!-- This example shows usage of jagged multi-dimensional arrays -->
<AnotherArraySample xmlns:yaxlib=""http://www.sinairv.com/yaxlib/"">
  <Array1>
    <Array2OfInt32 yaxlib:dims=""2,3"">
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>2</Int32>
      <Int32>3</Int32>
    </Array2OfInt32>
    <Array2OfInt32 yaxlib:dims=""3,2"">
      <Int32>3</Int32>
      <Int32>3</Int32>
      <Int32>3</Int32>
      <Int32>4</Int32>
      <Int32>3</Int32>
      <Int32>5</Int32>
    </Array2OfInt32>
  </Array1>
</AnotherArraySample>

Got under .Net Core much more properties serialized (same with e.g. PathsExampleTest):

<!-- This example shows usage of jagged multi-dimensional arrays -->
<AnotherArraySample xmlns:yaxlib="http://www.sinairv.com/yaxlib/">
  <Array1>
    <Length>2</Length>
    <Rank>1</Rank>
    <SyncRoot yaxlib:realtype="System.Int32[,][]" />
    <IsReadOnly>False</IsReadOnly>
    <IsFixedSize>True</IsFixedSize>
    <IsSynchronized>False</IsSynchronized>
    <Array2OfInt32 yaxlib:dims="2,3">
      <Length>6</Length>
      <Rank>2</Rank>
      <SyncRoot yaxlib:realtype="System.Int32[,]" />
      <IsReadOnly>False</IsReadOnly>
      <IsFixedSize>True</IsFixedSize>
      <IsSynchronized>False</IsSynchronized>
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>1</Int32>
      <Int32>2</Int32>
      <Int32>3</Int32>
    </Array2OfInt32>
    <Array2OfInt32 yaxlib:dims="3,2">
      <Length>6</Length>
      <Rank>2</Rank>
      <SyncRoot yaxlib:realtype="System.Int32[,]" />
      <IsReadOnly>False</IsReadOnly>
      <IsFixedSize>True</IsFixedSize>
      <IsSynchronized>False</IsSynchronized>
      <Int32>3</Int32>
      <Int32>3</Int32>
      <Int32>3</Int32>
      <Int32>4</Int32>
      <Int32>3</Int32>
      <Int32>5</Int32>
    </Array2OfInt32>
  </Array1>
</AnotherArraySample>
  1. My insights into YAXLib come to a limit where I would have to invest a lot more time. Using the library is a different story than creating it (of course).

I uploaded the current (unbeautified) state of my YAXLib fork to https://github.com/axunonb/YAXLib
Maybe you could have a first look and give your opinion.

@axunonb
Copy link
Collaborator Author

axunonb commented Feb 11, 2017

Hi Sina, the first port to .Net Core is completed and uploaded to GitHub (https://github.com/axunonb/YAXLib). All 216 unit test for .Net Framework and the 200 unit test relevant for .Net Core run successfully,
Any code parts which should eventually be improved are marked with //TODO: FXCORE ....
If further test confirm that the port works, YAXLib will be the best XML Serialization Library for .Net Core as well.
Unless you have any comments I will send a pull request these days.

@304NotModified
Copy link
Collaborator

304NotModified commented Feb 11, 2017

👍 🥂 Impressive!

@304NotModified
Copy link
Collaborator

Do you got it running on appveyor?

Also isn't it better to move to one SLN and project file? Or maybe that is a good next step.

@axunonb
Copy link
Collaborator Author

axunonb commented Feb 11, 2017

Well, I had my ups and downs with this port :) but still: cheers.
appveyor is still one of my "white spots", so: no, sorry.
One SLN: Yes, isn't a be a big deal. I do that with other projects as well.

@304NotModified
Copy link
Collaborator

304NotModified commented Feb 11, 2017

@sinairv this is a major feature!

@axunonb
Copy link
Collaborator Author

axunonb commented Feb 11, 2017

I'll start to integrate it into a project now, as first proof of concept. Keep fingers crossed.

@sinairv
Copy link
Collaborator

sinairv commented Feb 12, 2017

I'm super excited. Lots of thanks @axunonb. This is great work. I will look into it in more details tomorrow. Thanks again.

@axunonb
Copy link
Collaborator Author

axunonb commented Feb 12, 2017

Thanks, Sina, you're welcome. I worked a bit more on remaining tests for .Net Core. Now Collections and Dictionaries are included, but I replaced Color with string. These 7 tests are not covered in .Net Core, everything else is fine:

DeserializationTest  DesColorExampleTest
DeserializationTest  DesDataSetAndDataTableDynamicKnownTypes
KnownTypeTests       DataSetAndDataTableSerializationTest
KnownTypeTests       TestColorNames
KnownTypeTests       TestExtensionMethod
KnownTypeTests       TestSingleKnownTypeSerialization
SerializationTest    ColorExampleTest

Eventually System.Drawing.Color could be replaced with another known type also available in .Net Core.

@axunonb axunonb closed this as completed Feb 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants