Alex141 / CalcBinding

Advanced WPF Binding which supports expressions in Path property and other features
Apache License 2.0
638 stars 79 forks source link

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

Closed bigworld12 closed 5 years ago

bigworld12 commented 5 years ago

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 commented 5 years ago

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

bigworld12 commented 5 years ago

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

bigworld12 commented 5 years ago

I also updated DynamicExpresso.Core to v2.3.1

bigworld12 commented 5 years ago

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 3) 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 commented 5 years ago

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 commented 5 years ago

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.

bigworld12 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Ref: https://github.com/dotnet/corefx/issues/35974

bigworld12 commented 5 years ago

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 commented 5 years ago

@Alex141 think this is ready for a merge now šŸ‘

Alex141 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

Alex141 commented 5 years ago

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

bigworld12 commented 5 years ago

@Alex141 done šŸ‘

maurosampietro commented 4 years ago

Guys, what about .NET Standard?

bigworld12 commented 4 years ago

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

maurosampietro commented 4 years ago

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

bigworld12 commented 4 years ago

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

maurosampietro commented 4 years ago

Iā€™m talking about Xamarin.Forms. Trust me

Mauro Sampietro

On 6 Feb 2020, at 17:41, bigworld12 notifications@github.com wrote:

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

ā€” You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

maurosampietro commented 4 years ago

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.