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

Upgrade to NetStandard 2 #28

Merged
merged 1 commit into from
Apr 10, 2019

Conversation

cd21h
Copy link
Contributor

@cd21h cd21h commented Sep 15, 2018

Breaking

  • dotnet tool is required to build;

Not tested / not working

  • Build process;
  • AppVeyor integration

@bodewig
Copy link
Member

bodewig commented Mar 30, 2019

Sorry for the delay in reviewing and many many thanks @Shatl

I would prefer to keep the .NET 3.5 build as an option so this does not become a .NET Core only project. For this I'd create a separate .NET Core solution and separate project files for .NET Core (or for 3.5, don't really care) and let them sit next to the other build. Don't worry about the complexity of building a release, it will be me who'll have to suffer. :-)

I hope to find some time to build upon your change over the next few days, it shouldn't be too hard after you have done the bigger part of the work. Thanks again.

@bodewig
Copy link
Member

bodewig commented Apr 3, 2019

@Shatl I've started to integrate your work in a new branch netstandard.2.0. My main development platform has always been Linux, so for the 3.5 framework stuff I've used xbuild and Mono and for the new NetStandard build I intend to use the dotnet CLI. For now I am willing to maintain two parallel build environments.

The state right now is not finished, but this is where I am

  • dotnet build XMLUnit.slnworks
  • xbuild XMLUnit.NetFramework.sln works
  • dotnet test XMLUnit.sln compiles but quite a few tests fail - do tests pass for you?

I haven't even started to look into building nuget packages with separate assemblies for NetStandard, adapting the shell scripts I use for release tarballs or either AppVeyor or Travis CI.

I have made a few changes to your PR:

  • I downgraded to NUnit 3.6.1 which is the lowest version that supports NetStandard. I also did so as it still contains Is.StringContaining so that I could revert the changes you made to the tests and stick with NUnit 3.0.1 for the .NET Framework 3.5 build.
  • I reverted the changes to DiffBuilderTest and TestResources as they seemed unrelated. I wonder why you dropped the readonly from TestResources's fields.
  • I removed the NUnit 2.x constraints from the NetStandard build

@bodewig
Copy link
Member

bodewig commented Apr 3, 2019

One reason many tests failed was they couldn't find the test resources.

The current working directory when running the tests via msbuild/xbuild is the directory containing the project file. For the dotnet CLI build it is the directory containing the assembly under test. Unfortunately the project files are three levels away from the solution file, the assemblies are four levels away. I have moved to .NET Framework project files so both are now four levels away.

The next problem now stems from the placeholder tests where all tests fail with a stack trace like

Failed   IgnoreWithDefaultDelimiter
Error Message:
 System.TypeInitializationException : The type initializer for 'Org.XmlUnit.Placeholder.PlaceholderDifferenceEvaluator' threw an exception.
  ----> System.Reflection.ReflectionTypeLoadException : Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Stack Trace:
   at Org.XmlUnit.Placeholder.PlaceholderDifferenceEvaluator..ctor(String placeholderOpeningDelimiterRegex, String placeholderClosingDelimiterRegex) in /home/stefan/devel/xmlunit/xmlunit.net/src/main/net-placeholders/PlaceholderDifferenceEvaluator.cs:line 107
   at Org.XmlUnit.Placeholder.PlaceholderSupport.WithPlaceholderSupportUsingDelimiters[D](D configurer, String placeholderOpeningDelimiterRegex, String placeholderClosingDelimiterRegex) in /home/stefan/devel/xmlunit/xmlunit.net/src/main/net-placeholders/PlaceholderSupport.cs:line 61
   at Org.XmlUnit.Placeholder.PlaceholderSupport.WithPlaceholderSupport[D](D configurer) in /home/stefan/devel/xmlunit/xmlunit.net/src/main/net-placeholders/PlaceholderSupport.cs:line 40
   at Org.XmlUnit.Placeholder.PlaceholderSupportTest.IgnoreWithDefaultDelimiter() in /home/stefan/devel/xmlunit/xmlunit.net/src/tests/net-placeholders/PlaceholderSupportTest.cs:line 28
--ReflectionTypeLoadException
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at Org.XmlUnit.Placeholder.PlaceholderDifferenceEvaluator.<>c.<Load>b__5_0(Assembly s) in /home/stefan/devel/xmlunit/xmlunit.net/src/main/net-placeholders/PlaceholderDifferenceEvaluator.cs:line 74
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.<CastIterator>d__34`1.MoveNext()
   at Org.XmlUnit.Placeholder.PlaceholderDifferenceEvaluator..cctor() in /home/stefan/devel/xmlunit/xmlunit.net/src/main/net-placeholders/PlaceholderDifferenceEvaluator.cs:line 66

I'll likely need some extra time to figure this out,

@bodewig
Copy link
Member

bodewig commented Apr 3, 2019

Ah, Jon Skeet has solved that for me :-) - now all tests pass. https://stackoverflow.com/questions/7889228/how-to-prevent-reflectiontypeloadexception-when-calling-assembly-gettypes

@Shatl , It would be good if you could confirm the dotnet build of the netstandard-2.0 still works for you and I'll look into getting CI working next.

@bodewig bodewig added this to the 2.7.0 milestone Apr 4, 2019
@bodewig
Copy link
Member

bodewig commented Apr 4, 2019

AppVeyor ☑️

@bodewig
Copy link
Member

bodewig commented Apr 4, 2019

Travis ☑️

Next up getting Nuget packaging do what I want. Once that is done I'm willing to merge the branch to master and cut a beta. Anybody who could confirm things are working well prior to that would be more than welcome.

@cd21h
Copy link
Contributor Author

cd21h commented Apr 5, 2019

Just got back from vacation, will check on weekend.

@bodewig
Copy link
Member

bodewig commented Apr 6, 2019

Thanks

I've modified the nuspec files and the packages I get by running something like nuget.exe pack src/main/net-constraints-nunit3/XMLUnit.NUnit3.Constraints.nuspec -Properties version=2.7.0-beta1 look good to me. I'll work on my release scripts and if you can confirm things look good I'll merge the branch and release a first beta version so we get a chance for more feedback.

@bodewig bodewig merged commit 88188d4 into xmlunit:master Apr 10, 2019
@bodewig
Copy link
Member

bodewig commented Apr 10, 2019

I've merged the netstandard-2.0 branch to master and will publish a beta soon.

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

Successfully merging this pull request may close these issues.

None yet

2 participants