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

port to .net core 3 & .net standard #57

Merged
merged 13 commits into from Mar 13, 2019
Merged

port to .net core 3 & .net standard #57

merged 13 commits into from Mar 13, 2019

Conversation

bigworld12
Copy link
Contributor

this doesn't change any files in the original project, it just adds 2 new projects ["CalcBinding.Core", WpfExample.Core"] that link items from the original project and build them against .net core 3

@bigworld12
Copy link
Contributor Author

Note that since no files are changed, the tests can remain the same

@bigworld12
Copy link
Contributor Author

i also suggest changing AppVeyor msbuild version to 15 to support PackageReference in project files

@bigworld12
Copy link
Contributor Author

I also updated DynamicExpresso.Core to v2.3.1

Copy link
Owner

@Alex141 Alex141 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for PR, I have put several comments in commits and have overall comments:

1.) Unit tests should test library with .netcore3.0, so Tests project should also be ported
2.) I don't use AppVeyor so don't look at its fails :) but maybe i will use it in the near future
3.) .net core 3.0 is in preview stage, so it is not recommended to use it in production projects. I think that we can integrate changes after review, but I doubt whether to publish a package with it?

CalcBinding.Core/CalcBinding.Core.csproj Outdated Show resolved Hide resolved
CalcBinding.Core/CalcBinding.Core.csproj Outdated Show resolved Hide resolved
CalcBinding.Core/CalcBinding.Core.csproj Outdated Show resolved Hide resolved
CalcBinding.Core/CalcBinding.Core.csproj Outdated Show resolved Hide resolved
CalcBinding.Core/CalcBinding.Core.csproj Outdated Show resolved Hide resolved
WpfExample.Core/WpfExample.Core.csproj Show resolved Hide resolved
@bigworld12
Copy link
Contributor Author

  1. i am not really sure how we are going to implement unit tests for .net core, since only xUnit supports .net core 3.0 at this moment, so we would need to edit the test files. but since we are just compiling against .net core 3 and not changing any files, i think unit tests should be ok, because if there is a fail it would be in .net core itself not in the project
  2. many open source projects already started porting their code to .net core 3 (e.g. https://github.com/Catel/Catel/ and https://github.com/MahApps/MahApps.Metro )
    so i don't think it's a problem to upgrade, since the package already compiles against net 4.5 and 4.6 too, so users who don't want .net core can just switch to .net framework

@Alex141
Copy link
Owner

Alex141 commented Mar 7, 2019

Ok, I propose following:

1.) Leave one project CalcBinding.csproj and WpfExample.csproj.
2.) Add to TargetFrameworks net40 for each project
3.) Switch between 1.3.0 version of DynamicExpresso (.net 4.0) and last version like this:

<ItemGroup>
    <PackageReference Include="DynamicExpresso.Core" Version="2.3.1" Condition = "'$(TargetFramework)' == 'netcoreapp3.0'" />
    <PackageReference Include="DynamicExpresso.Core" Version="1.3.0" Condition = "'$(TargetFramework)' != 'netcoreapp3.0'" />
  </ItemGroup>

4.) It will allow us to build projects for .net4.0, 4.5 and .netcore3.0 with different dependencies
5.) After PR will be completed I prepare multi-targeting nuget package, which will include all versions of CalcBinding for different frameworks and different dependencies. Single package can be used in net4.0-net4.8 applications and .net core 3.0 applications

6.) About mstest in .netcore3.0 - it can be used, just type:
dotnet new mstest
It will create new mstest project

@Alex141
Copy link
Owner

Alex141 commented Mar 7, 2019

but since we are just compiling against .net core 3 and not changing any files, i think unit tests should be ok, because if there is a fail it would be in .net core itself not in the project

That is why you need to have tests that check code on the latest preview version of net framework. If the behavior of the library will be different, then this should be taken into account. If a bug was found - notify.

….0 by switching PackageReference of DynamicExpresso
@bigworld12
Copy link
Contributor Author

ok so i managed to merge CalcBinding into 1 project, also you don't need to manually create nuget package, visual studio's pack command creates this package

image

i tested this by switching WpfExample project to .net 4.0 and it works well

as for merging WpfExample.Core into WpfExample i am not really sure about this, since visual studio hasn't provided a designer for WPF on .net core 3 yet, and you must use vs 2019 to use the .net core 3 project, so i suggest to leave them as 2 separate projects for the time being until it's more stable for .net core 3

@bigworld12
Copy link
Contributor Author

bigworld12 commented Mar 8, 2019

as for the tests, i created the project, but the build is failing because it can't find reference to wpf assemblies like System.Xaml, here is the result of running dotnet build and dotnet test on the zTests.Core project

version:

E:\Projects\CalcBinding\Tests.Core>dotnet --version
3.0.100-preview3-010431

build:

E:\Projects\CalcBinding\Tests.Core>dotnet build
Microsoft (R) Build Engine version 16.0.443+g5775d0d6bb for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Persisting no-op dg to E:\Projects\CalcBinding\CalcBinding\obj\CalcBinding.csproj.nuget.dgspec.json
  Persisting no-op dg to E:\Projects\CalcBinding\WpfExample.Core\obj\WpfExample.Core.csproj.nuget.dgspec.json
  Persisting no-op dg to E:\Projects\CalcBinding\Tests.Core\obj\zTests.Core.csproj.nuget.dgspec.json
  Restore completed in 25.97 ms for E:\Projects\CalcBinding\CalcBinding\CalcBinding.csproj.
  Restore completed in 25.96 ms for E:\Projects\CalcBinding\WpfExample.Core\WpfExample.Core.csproj.
  Restore completed in 37.24 ms for E:\Projects\CalcBinding\Tests.Core\zTests.Core.csproj.
C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [E:\Projects\CalcBinding\Tests.Core\zTests.Core.csproj]
  CalcBinding -> E:\Projects\CalcBinding\CalcBinding\bin\Debug\netcoreapp3.0\CalcBinding.dll
C:\Program Files\dotnet\sdk\3.0.100-preview3-010431\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(151,5): message NETSDK1057: You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview [E:\Projects\CalcBinding\WpfExample.Core\WpfExample.Core.csproj]
  WpfExample.Core -> E:\Projects\CalcBinding\WpfExample.Core\bin\Debug\netcoreapp3.0\WpfExample.dll
E:\Projects\CalcBinding\Tests\PropertyPathAnalyzerTests.cs(149,34): warning CS0168: The variable 'e' is declared but never used [E:\Projects\CalcBinding\Tests.Core\zTests.Core.csproj]
  zTests.Core -> E:\Projects\CalcBinding\Tests.Core\bin\Debug\netcoreapp3.0\zTests.Core.dll

Build succeeded.

E:\Projects\CalcBinding\Tests\PropertyPathAnalyzerTests.cs(149,34): warning CS0168: The variable 'e' is declared but never used [E:\Projects\CalcBinding\Tests.Core\zTests.Core.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.09

test:

E:\Projects\CalcBinding\Tests.Core>dotnet test
E:\Projects\CalcBinding\Tests\PropertyPathAnalyzerTests.cs(149,34): warning CS0168: The variable 'e' is declared but never used [E:\Projects\CalcBinding\Tests.Core\zTests.Core.csproj]
Test run for E:\Projects\CalcBinding\Tests.Core\bin\Debug\netcoreapp3.0\zTests.Core.dll(.NETCoreApp,Version=v3.0)
Microsoft (R) Test Execution Command Line Tool Version 16.0.0-preview-20190124-02
Copyright (c) Microsoft Corporation.  All rights reserved.

Starting test execution, please wait...
[MSTest][Discovery][E:\Projects\CalcBinding\Tests.Core\bin\Debug\netcoreapp3.0\zTests.Core.dll] Unable to load types from the test source 'E:\Projects\CalcBinding\Tests.Core\bin\Debug\netcoreapp3.0\zTests.Core.dll'. Some or all of the tests in this source may not be discovered.
Error: System.IO.FileNotFoundException: Could not load file or assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.

An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load file or assembly 'System.Xaml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
Failed   ConvertBoolToVisibilityTest
Error Message:
 Test method Tests.BoolToVisibilityConverterTests.ConvertBoolToVisibilityTest threw exception:
System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Stack Trace:
    at Tests.BoolToVisibilityConverterTests.ConvertBoolToVisibilityTest()

Failed   ConvertVisibilityToBoolTest
Error Message:
 Test method Tests.BoolToVisibilityConverterTests.ConvertVisibilityToBoolTest threw exception:
System.IO.FileNotFoundException: Could not load file or assembly 'PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Stack Trace:
    at Tests.BoolToVisibilityConverterTests.ConvertVisibilityToBoolTest()

Failed   ConvertsCastableToBoolWhenValueHasImplicitConversion
Error Message:
 Test method Tests.BoolToVisibilityConverterTests.ConvertsCastableToBoolWhenValueHasImplicitConversion threw exception: 
System.IO.FileNotFoundException: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Stack Trace:
    at Tests.BoolToVisibilityConverterTests.ConvertsCastableToBoolWhenValueHasImplicitConversion()

Failed   ConvertsCastableToBoolWhenValueHasExplicitConversion
Error Message:
 Test method Tests.BoolToVisibilityConverterTests.ConvertsCastableToBoolWhenValueHasExplicitConversion threw exception: 
System.IO.FileNotFoundException: Could not load file or assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Stack Trace:
    at Tests.BoolToVisibilityConverterTests.ConvertsCastableToBoolWhenValueHasExplicitConversion()


Total tests: 4. Passed: 0. Failed: 4. Skipped: 0.
Test Run Failed.
Test execution time: 0.9259 Seconds

@Alex141
Copy link
Owner

Alex141 commented Mar 8, 2019

Well done! I did not know that package can be created from visual studio :)

About tests: I think that problem is in using incorrect Sdk, I left comment, try to test with other Sdk.

@bigworld12 bigworld12 changed the title Added 2 new projects to port to .net core 3 port to .net core 3 & .net standard Mar 8, 2019
@bigworld12
Copy link
Contributor Author

bigworld12 commented Mar 12, 2019

running tests on .net core now gives the following behavior

Starting test execution, please wait...
Failed   MathTest
Error Message:
 Assert.AreEqual failed. Expected:<59.4>. Actual:<59.400000000000006>.
Stack Trace:
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](Binding calcBinding, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 189
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](String path, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 157
   at Tests.BaseSystemTests.StringBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Action sourcePropertySetter2, String targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 65
   at Tests.BaseSystemTests.StringAndObjectBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Object objTargetValue1, Action sourcePropertySetter2, String targetValue2, Object objTargetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 26
   at Tests.CalcBindingSystemTests.MathTest() in E:\Projects\CalcBinding\Tests\CalcBindingSystemTests.cs:line 54

Standard Output Messages:


Debug Trace:
PropertyPathAnalyzer.GetPathes: start read A
 PropertyPathAnalyzer: read A (Property) (0-0)
 timeSpan: 5
 timeSpan: 3
 PropertyPathAnalyzer.GetPathes: start read A
 PropertyPathAnalyzer: read A (Property) (0-0)
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A+B+C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A+B+C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A-B-C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A-B-C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A*(B-C)
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (3-3)
 PropertyPathAnalyzer: read C (Property) (5-5)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0


Failed   MathTest
Error Message:
 Assert.AreEqual failed. Expected:<59.4>. Actual:<59.400000000000006>.
Stack Trace:
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](Binding calcBinding, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 189
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](String path, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 157
   at Tests.BaseSystemTests.StringBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Action sourcePropertySetter2, String targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 65
   at Tests.BaseSystemTests.StringAndObjectBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Object objTargetValue1, Action sourcePropertySetter2, String targetValue2, Object objTargetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 26
   at Tests.CalcBindingSystemTests.MathTest() in E:\Projects\CalcBinding\Tests\CalcBindingSystemTests.cs:line 54

Standard Output Messages:


Debug Trace:
PropertyPathAnalyzer.GetPathes: start read A
 PropertyPathAnalyzer: read A (Property) (0-0)
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A
 PropertyPathAnalyzer: read A (Property) (0-0)
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A+B+C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A+B+C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A-B-C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A-B-C
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (2-2)
 PropertyPathAnalyzer: read C (Property) (4-4)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 PropertyPathAnalyzer.GetPathes: start read A*(B-C)
 PropertyPathAnalyzer: read A (Property) (0-0)
 PropertyPathAnalyzer: read B (Property) (3-3)
 PropertyPathAnalyzer: read C (Property) (5-5)
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0
 timeSpan: 0


Failed   MathWithStaticPropertyTest
Error Message:
 Assert.AreEqual failed. Expected:<0>. Actual:<-0>.
Stack Trace:
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](Binding calcBinding, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 182
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](String path, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 157
   at Tests.BaseSystemTests.StringBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Action sourcePropertySetter2, String targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 65
   at Tests.BaseSystemTests.StringAndObjectBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Object objTargetValue1, Action sourcePropertySetter2, String targetValue2, Object objTargetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 26
   at Tests.StaticPropertiesTests.MathWithStaticPropertyTest() in E:\Projects\CalcBinding\Tests\StaticPropertiesTests.cs:line 175

Standard Output Messages:


Debug Trace:
PropertyPathAnalyzer.GetPathes: start read Math.Round(Math.Sin(local:StaticExampleClass.StaticB *Math.PI / 2.0))
 PropertyPathAnalyzer: read Math.Round (Math) (0-9)
 PropertyPathAnalyzer: read Math.Sin (Math) (11-18)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (20-51)
 PropertyPathAnalyzer: read Math.PI (Math) (54-60)
 PropertyPathAnalyzer.GetPathes: start read Math.Round(Math.Sin(local:StaticExampleClass.StaticB *Math.PI / 2.0))
 PropertyPathAnalyzer: read Math.Round (Math) (0-9)
 PropertyPathAnalyzer: read Math.Sin (Math) (11-18)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (20-51)
 PropertyPathAnalyzer: read Math.PI (Math) (54-60)
 PropertyPathAnalyzer.GetPathes: start read Math.Round(Math.Cos(local:StaticExampleClass.StaticB *Math.PI / 2.0))
 PropertyPathAnalyzer: read Math.Round (Math) (0-9)
 PropertyPathAnalyzer: read Math.Cos (Math) (11-18)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (20-51)
 PropertyPathAnalyzer: read Math.PI (Math) (54-60)


Failed   MathTwoWayWithStaticPropertyTest
Error Message:
 Assert.AreEqual failed. Expected:<0.999999999999999>. Actual:<1>.
Stack Trace:
   at Tests.BaseSystemTests.BindingBackAssert[TTargetProperty](Binding calcBinding, INotifyPropertyChanged source, Func`1 sourcePropertyGetter, FrameworkElement targetObject, DependencyProperty targetProperty, Action`1 targetPropertySetter, TTargetProperty targetPropertyValue1, TTargetProperty targetPropertyValue2, Object sourcePropertyValue1, Object sourcePropertyValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 304
   at Tests.BaseSystemTests.BindingBackAssert[TTargetProperty](String path, INotifyPropertyChanged source, Func`1 sourcePropertyGetter, FrameworkElement targetObject, DependencyProperty targetProperty, Action`1 targetPropertySetter, TTargetProperty targetPropertyValue1, TTargetProperty targetPropertyValue2, Object sourcePropertyValue1, Object sourcePropertyValue2, BindingMode mode, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 277
   at Tests.BaseSystemTests.StringBindingBackAssert(String path, INotifyPropertyChanged source, Func`1 sourcePropertyGetter, String targetValue1, String targetValue2, Object sourcePropertyValue1, Object sourcePropertyValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 255
   at Tests.BaseSystemTests.StringAndObjectBindingBackAssert(String path, INotifyPropertyChanged source, Func`1 sourcePropertyGetter, String stringTargetValue1, String stringTargetValue2, Object objTargetValue1, Object objTargetValue2, Object sourcePropertyValue1, Object sourcePropertyValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 203
   at Tests.StaticPropertiesTests.MathTwoWayWithStaticPropertyTest() in E:\Projects\CalcBinding\Tests\StaticPropertiesTests.cs:line 204

Standard Output Messages:


Debug Trace:
PropertyPathAnalyzer.GetPathes: start read Math.Sin(local:StaticExampleClass.StaticB/100.0)
 PropertyPathAnalyzer: read Math.Sin (Math) (0-7)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (9-40)
 (((Int32)((Math.Asin(Path))*(100))))
 PropertyPathAnalyzer.GetPathes: start read Math.Sin(local:StaticExampleClass.StaticB/100.0)
 PropertyPathAnalyzer: read Math.Sin (Math) (0-7)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (9-40)
 (((Int32)((Math.Asin(Path))*(100))))
 PropertyPathAnalyzer.GetPathes: start read Math.Cos(local:StaticExampleClass.StaticB/100.0)
 PropertyPathAnalyzer: read Math.Cos (Math) (0-7)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (9-40)
 (((Int32)((Math.Acos(Path))*(100))))
 PropertyPathAnalyzer.GetPathes: start read Math.Cos(local:StaticExampleClass.StaticB/100.0)
 PropertyPathAnalyzer: read Math.Cos (Math) (0-7)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticB (StaticProperty) (9-40)
 (((Int32)((Math.Acos(Path))*(100))))
 PropertyPathAnalyzer.GetPathes: start read Math.Pow(Math.PI,local:StaticExampleClass.StaticA)
 PropertyPathAnalyzer: read Math.Pow (Math) (0-7)
 PropertyPathAnalyzer: read Math.PI (Math) (9-15)
 PropertyPathAnalyzer: read local:StaticExampleClass.StaticA (StaticProperty) (17-48)
 (Math.Log((Path), (Math.PI)))



Total tests: 115. Passed: 111. Failed: 4. Skipped: 0.
Test Run Failed.
Test execution time: 2.6344 Seconds

i think these are due to how .net core changed their formatting system, check: https://docs.microsoft.com/en-us/dotnet/core/whats-new/dotnet-core-3-0#ieee-floating-point-improvements
also :
https://devblogs.microsoft.com/dotnet/floating-point-parsing-and-formatting-improvements-in-net-core-3-0/

@bigworld12
Copy link
Contributor Author

managed to solve most issues, but what the hell is this ???

Failed   MathWithStaticPropertyTest
Error Message:
 Assert.AreEqual failed. Expected:<0>. Actual:<-0>.
Stack Trace:
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](Binding calcBinding, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 181
   at Tests.BaseSystemTests.BindingAssert[TTargetProperty](String path, INotifyPropertyChanged source, FrameworkElement targetObject, DependencyProperty targetProperty, Func`1 targetPropertyGetter, Action sourcePropertySetter1, TTargetProperty targetValue1, Action sourcePropertySetter2, TTargetProperty targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 156
   at Tests.BaseSystemTests.StringBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Action sourcePropertySetter2, String targetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 64
   at Tests.BaseSystemTests.StringAndObjectBindingAssert(String path, INotifyPropertyChanged source, Action sourcePropertySetter1, String targetValue1, Object objTargetValue1, Action sourcePropertySetter2, String targetValue2, Object objTargetValue2, Dictionary`2 resolvedTypes) in E:\Projects\CalcBinding\Tests\BaseSystemTests.cs:line 25
   at Tests.StaticPropertiesTests.MathWithStaticPropertyTest() in E:\Projects\CalcBinding\Tests\StaticPropertiesTests.cs:line 175

@bigworld12
Copy link
Contributor Author

@bigworld12
Copy link
Contributor Author

ok for now, all tests are passing, but i don't like the breaking changes in floating point arithmetic in .net core, this will confuse many people used to .net framework

@bigworld12
Copy link
Contributor Author

@Alex141 think this is ready for a merge now 👍

@Alex141
Copy link
Owner

Alex141 commented Mar 13, 2019

oh, I read your hot correspondence with corefx, I also don't know about these changes in .net core. Ok, well done, that corrected all the tests, I can merge PR. Later I will publish new nuget package, thank you!

@Alex141 Alex141 merged commit d33626d into Alex141:master Mar 13, 2019
AlexZinchenko pushed a commit that referenced this pull request Mar 13, 2019
@Alex141
Copy link
Owner

Alex141 commented Mar 13, 2019

I have commit some improvements to PR - ref and I was very surprised when MathTwoWayWithStaticPropertyTest() was failed in zTests.Core. It was expected 1d but real value was 0.999999999999999. Version of .net core is 3.0, I don't know, why it don't work on your machine and work in my. Maybe you know?

@bigworld12
Copy link
Contributor Author

let's keep discussion on the commit then. since this was merged, i will delete fork

@Alex141
Copy link
Owner

Alex141 commented Mar 15, 2019

ok, I have published package 2.5.1 with these changes. May be you delete package https://www.nuget.org/packages/CalcBinding.Core/ ?

@bigworld12
Copy link
Contributor Author

@Alex141 done 👍

@bigworld12 bigworld12 mentioned this pull request May 27, 2019
@maurosampietro
Copy link

Guys, what about .NET Standard?

@bigworld12
Copy link
Contributor Author

@maurosampietro binding doesn't exist in .net standard, only .net core 3

@maurosampietro
Copy link

Mmmmm.... I'm using Xamarin.Forms and the shared project compiles against .NET Standard.
Guess I should ask about Xamarin, then?

@bigworld12
Copy link
Contributor Author

you don't use binding in shared projects, you only use it for the UI (Xamarin, wpf, etc..)

@maurosampietro
Copy link

maurosampietro commented Feb 6, 2020 via email

@maurosampietro
Copy link

I had a look at the codebase.
It looks like for Xamarin.Forms, the work involved is not trivial.
Would be nice to add Xamarin.Forms support btw.

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

3 participants