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

DYN-6015 LiveCharts2 migration for net6 #14209

Merged
merged 23 commits into from
Aug 14, 2023
Merged

Conversation

zeusongit
Copy link
Contributor

Purpose

https://jira.autodesk.com/browse/DYN-6015

Updated dependency for chart nodes to LiveCharts2 from version 1 that was not net6 compatible.
This change will introduce new SkiaSharp graphic library

Old Charts:

AllCharts_LV1

New Charts:

AllCharts

All charts Export Output Image:
BarChart
BasicLine
Heat
Pie
Scatter
XYLine

Declarations

Check these if you believe they are true

  • The codebase is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB

Release Notes

  • Updated Chart Nodes for Net6

Reviewers

@DynamoDS/dynamo

FYIs

@dnenov

@QilongTang
Copy link
Contributor

hi @zeusongit Even after I retried the build action, it failed again.. Also I assume this is safe to bring to 2.19 release?

/// <summary>
/// Helper class providing chart style parameters
/// </summary>
public static class ChartStyle
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 👍🏻

@@ -110,6 +110,8 @@ private void View_Closing(object sender, System.ComponentModel.CancelEventArgs e

async void SuspendCoreWebviewAsync()
{
if (notificationUIPopup == null) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you foresee a bug somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was throwing an exception during Debug

<PackageReference Include="DotNetProjects.Extended.Wpf.Toolkit" Version="5.0.103" />
<PackageReference Include="LiveChartsCore" Version="2.0.0-beta.855" />
Copy link
Contributor

Choose a reason for hiding this comment

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

Any binary diff?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since the VS2022 build is failing, the bindiff job is failing as well, the PR does bring in some Livecharts2 and skiasharp binaries.

Copy link
Contributor

@QilongTang QilongTang left a comment

Choose a reason for hiding this comment

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

Looks solid with some comments, just curious have you tested in D4R yet?

@zeusongit
Copy link
Contributor Author

hi @zeusongit Even after I retried the build action, it failed again.. Also I assume this is safe to bring to 2.19 release?

I did not downgrade the Newtonsoft to 13.0.1, it is unchanged in the PR, did some other PR downgrade it before this PR?

@QilongTang
Copy link
Contributor

hi @zeusongit Even after I retried the build action, it failed again.. Also I assume this is safe to bring to 2.19 release?

I did not downgrade the Newtonsoft to 13.0.1, it is unchanged in the PR, did some other PR downgrade it before this PR?

I thought we have been using Newtonsoft 13.0.1 for a while, any reason that made you mention downgrade?

src/DynamoCoreWpf/DynamoCoreWpf.csproj Outdated Show resolved Hide resolved
src/DynamoCoreWpf/UI/Themes/Modern/LiveChartsStyle.xaml Outdated Show resolved Hide resolved
@@ -60,7 +56,7 @@ public class BarChartNodeModel : NodeModel
/// <summary>
/// Bar chart color values.
/// </summary>
public List<SolidColorBrush> Colors { get; set; }
public List<Color> Colors { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

Since this is public - ideally we would obsolete the old property, and redirect it to to use and update the new one.

Copy link
Contributor

Choose a reason for hiding this comment

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

Make sense since this was officially added in 2.18

Copy link
Member

Choose a reason for hiding this comment

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

in addition @zeusongit @QilongTang - if this is going into 2.19 then we'll need to keep the old live charts binaries in the legacy_remove_me folder so they get copied.

If this is only going into a 3.0 release then we can forget the API break, and not include the binaries. I'm not sure that is an option though...? @jasonstratton @pinzart90 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can RC branch 2.19 early and make this a Dynamo 3.0 change, the downside is that chart nodes will not be tested in test fest early because that event is targeting 2.19 NET6 build.

Copy link
Member

Choose a reason for hiding this comment

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

can always merge and then revert - it's not clear to me this will be done by than anyway...?

@reddyashish reddyashish added this to the 3.0 milestone Aug 1, 2023
@zeusongit
Copy link
Contributor Author

hi @zeusongit Even after I retried the build action, it failed again.. Also I assume this is safe to bring to 2.19 release?

I did not downgrade the Newtonsoft to 13.0.1, it is unchanged in the PR, did some other PR downgrade it before this PR?

That is what I saw in the error log:

NU1605: Warning As Error: Detected package downgrade: Newtonsoft.Json from 13.0.2 to 13.0.1. Reference the package directly from the project to select a different version.
     DSCoreNodesTests -> DynamoCoreWpf -> LiveChartsCore.SkiaSharpView.WPF 2.0.0-beta.855 -> LiveChartsCore.SkiaSharpView 2.0.0-beta.855 -> LiveChartsCore 2.0.0-beta.855 -> Newtonsoft.Json (>= 13.0.2)

@github-actions
Copy link

github-actions bot commented Aug 1, 2023

⚠️ [run-bin-diff-net60-windows] - Files Added/Deleted::10 new file(s) have been added and 2 file(s) have been deleted!
(Updated: 2023-08-11-14:39:21)

@pinzart90
Copy link
Contributor

⚠️ [run-bin-diff] - Files Added/Deleted::28 new file(s) have been added and 2 file(s) have been deleted!
⚠️ [run-bin-diff-net60-windows] - Files Added/Deleted::10 new file(s) have been added and 2 file(s) have been deleted!

28 files added? That is a lot

@zeusongit
Copy link
Contributor Author

zeusongit commented Aug 1, 2023

⚠️ [run-bin-diff] - Files Added/Deleted::28 new file(s) have been added and 2 file(s) have been deleted!
⚠️ [run-bin-diff-net60-windows] - Files Added/Deleted::10 new file(s) have been added and 2 file(s) have been deleted!

28 files added? That is a lot

Yep
For net48:

RelativePath Status
.\arm64\libSkiaSharp.dll Added
.\LiveChartsCore.dll Added
.\libSkiaSharp.dylib Added
.\HarfBuzzSharp.dll Added
.\libHarfBuzzSharp.dylib Added
.\nodes\arm64\libHarfBuzzSharp.dll Added
.\nodes\arm64\libSkiaSharp.dll Added
.\nodes\libSkiaSharp.dylib Added
.\nodes\libHarfBuzzSharp.dylib Added
.\System.Numerics.Vectors.dll Added
.\System.Memory.dll Added
.\System.Drawing.Common.dll Added
.\System.Buffers.dll Added
.\SkiaSharp.Views.WPF.dll Added
.\SkiaSharp.Views.Desktop.Common.dll Added
.\SkiaSharp.HarfBuzz.dll Added
.\SkiaSharp.dll Added
.\nodes\x64\libHarfBuzzSharp.dll Added
.\nodes\x64\libSkiaSharp.dll Added
.\nodes\x86\libHarfBuzzSharp.dll Added
.\nodes\x86\libSkiaSharp.dll Added
.\arm64\libHarfBuzzSharp.dll Added
.\x64\libHarfBuzzSharp.dll Added
.\x64\libSkiaSharp.dll Added
.\x86\libHarfBuzzSharp.dll Added
.\x86\libSkiaSharp.dll Added
.\LiveChartsCore.SkiaSharpView.dll Added
.\LiveChartsCore.SkiaSharpView.WPF.dll Added
.\LiveCharts.Wpf.dll Deleted
.\LiveCharts.dll Deleted

For net6:

RelativePath Status
.\LiveChartsCore.SkiaSharpView.dll Added
.\HarfBuzzSharp.dll Added
.\libHarfBuzzSharp.dll Added
.\libSkiaSharp.dll Added
.\SkiaSharp.Views.WPF.dll Added
.\SkiaSharp.Views.Desktop.Common.dll Added
.\LiveChartsCore.dll Added
.\LiveChartsCore.SkiaSharpView.WPF.dll Added
.\SkiaSharp.HarfBuzz.dll Added
.\SkiaSharp.dll Added
.\LiveCharts.Wpf.dll Deleted
.\LiveCharts.dll Deleted

@avidit avidit changed the title LiveCharts2 migration for net6 DYN-6015 LiveCharts2 migration for net6 Aug 2, 2023
@@ -140,10 +140,6 @@
<PackageReference Include="SharpDX.Mathematics" Version="4.2.0" />
<Reference Include="Dynamo.Microsoft.Xaml.Behaviors">
<HintPath>..\..\extern\Microsoft.Xaml.Behaviors\$(TargetFramework)\Dynamo.Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<PackageReference Include="Prism.Core" Version="8.1.97" Condition=" '$(TargetFramework)' != 'net48' " />
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you should have left in there
Maybe just remove the condition attribute (ex )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pinzart90
Copy link
Contributor

pinzart90 commented Aug 8, 2023

@zeusongit @mjkkirschner @QilongTang a lot of public APIs have been changed (all in the UI layer)
Do you think this is ok for 3.0 ?
Maybe not cherry-packable in 2.19 as is. Not sure why we would want to...

Copy link
Contributor

@pinzart90 pinzart90 left a comment

Choose a reason for hiding this comment

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

If we consider the breaking the API for 3.0 is ok, then LGTM

@mjkkirschner
Copy link
Member

mjkkirschner commented Aug 8, 2023

@zeusongit @mjkkirschner @QilongTang a lot of public APIs have been changed (all in the UI layer) Do you think this is ok for 3.0 ? Maybe not cherry-packable in 2.19 as is. Not sure why we would want to...

  1. I don't think we have any intention of moving this to 2.19
  2. (all in the UI layer) this is exactly why we have to formalize "API" boundary immediately post 3.0 release. I believe we have communicated or internally agreed that the view/UI was not semantically versioned - of course we decided this AFTER we were forced to because of the visual refresh.

@QilongTang
Copy link
Contributor

Please check the milestone field of the PR for the release target. @mjkkirschner @pinzart90 not targeting 2.19

@mjkkirschner
Copy link
Member

@zeusongit were you able to resolve the newtonsoft issue?

@zeusongit
Copy link
Contributor Author

@zeusongit were you able to resolve the newtonsoft issue?

Yes, by including version 13.0.2

@mjkkirschner
Copy link
Member

@zeusongit were you able to resolve the newtonsoft issue?

Yes, by including version 13.0.2

so... now we reference both versions? This project references 13.0.2 and every other project references 13.0.1? What does Revit reference?

@zeusongit
Copy link
Contributor Author

@zeusongit were you able to resolve the newtonsoft issue?

Yes, by including version 13.0.2

so... now we reference both versions? This project references 13.0.2 and every other project references 13.0.1? What does Revit reference?

Everything else uses 13.0.1

@mjkkirschner
Copy link
Member

@zeusongit were you able to resolve the newtonsoft issue?

Yes, by including version 13.0.2

so... now we reference both versions? This project references 13.0.2 and every other project references 13.0.1? What does Revit reference?

Everything else uses 13.0.1

@zeusongit I don't think that is good. It could work out okay, but it would be best if we can unify on 13.0.1.
I am hopeful we can do something better than just adding 13.0.2 and not shipping it.

Can you look into it a bit and we can meet up later this week to discuss options?
@pinzart90 advice here?

@pinzart90
Copy link
Contributor

@zeusongit were you able to resolve the newtonsoft issue?

Yes, by including version 13.0.2

so... now we reference both versions? This project references 13.0.2 and every other project references 13.0.1? What does Revit reference?

Everything else uses 13.0.1

@zeusongit I don't think that is good. It could work out okay, but it would be best if we can unify on 13.0.1. I am hopeful we can do something better than just adding 13.0.2 and not shipping it.

Can you look into it a bit and we can meet up later this week to discuss options? @pinzart90 advice here?

Just use version 2.0.0-beta.603 of LiveChartsCore and LiveChartsCore.SkiaSharpView.WPF. These have a dep on NewtonSoft 13.0.1. Hopefully no drastic changes in between these versions of livecharts.

@pinzart90

This comment was marked as outdated.

@zeusongit
Copy link
Contributor Author

I changed LiveCharts version from the latest beta 2.0.0-beta.8xx to 2.0.0-beta.6xx of LiveChartsCore and LiveChartsCore.SkiaSharpView.WPF. These have a dep on NewtonSoft 13.0.1

I see that you reverted this, did it not work?

// Save document
string filename = dialog.FileName;
image.Save(filename, ImageFormat.Png);
Console.WriteLine("Chart Image Export Error:" + ex.Message);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this try-catch or was this also for your debugging?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is Console.WriteLine visible in the Dynamo console UI ? or at least in the console logs ?
Do we have access to the Dynamo Logger here ?
I say we should let the exception bubble up, unless it is something very specific you are trying to catch here @zeusongit .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was for test as well, LC2 has summed up all charts into 2 types, SKCartesian and Pie, but there is one more Geo charts which are not yet implemented, so was testing if any of the existing charts throw an exception while exporting image.

@zeusongit zeusongit merged commit 4df50cc into DynamoDS:master Aug 14, 2023
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.

7 participants