Glitch8
 ( 11.82% )
- ago
We started our process internally of moving WL8 from .NET6 to .NET8.

It will take a bit of time, but hopefully the next release will target .NET8.

This should mean an overall performance boost for WL8 since the .NET7/8 frameworks had a significant focus on improving the JIT compilers which results in better performance all around.
7
1,102
24 Replies

Reply

Bookmark

Sort
- ago
#1
A nice-to-have would be a bump in support of the C# version from 7.3 to perhaps 12. But, I understand that may involve at least editor changes.

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version
0
Glitch8
 ( 11.82% )
- ago
#2
Let me add this to the .NET8 task list.
0
Glitch8
 ( 11.82% )
- ago
#3
So far so good, C#12 supported ...

2
- ago
#4
Nice to hear that you are keeping up to date.
0
- ago
#5
Please also consider to upgrade to ScottPlot 5.
1
Glitch8
 ( 11.82% )
- ago
#6
Oh yes, but that is a breaking change, our example strategies will need to be reworked and it will bite anyone using the current ScottPlot version installed with WL8.
0
- ago
#7
QUOTE:
that is a breaking change,


We could have ScottPlot4 and ScottPlot5 side-by-side. There are two different namespaces, two different DLLs...
0
Glitch8
 ( 11.82% )
- ago
#8
But the DLL name is the same.
0
- ago
#9
QUOTE:
But the DLL name is the same.

Perhaps you could have the WL installer ask which one, ScottPlot4 or 5, they want to install. Or the installer could just stay with whatever version is already installed at the moment. (I wouldn't change too many things at once.)

Is .NET 8 really ready for prime time? Can I still run other libraries (such as ExcelReader) under .NET 6 if WL is running under .NET 8?
0
Glitch8
 ( 11.82% )
- ago
#10
>>Is .NET 8 really ready for prime time?<<

Yes, it's in full release with long term support. So it makes sense to target this version.

>>Can I still run other libraries (such as ExcelReader) under .NET 6 if WL is running under .NET 8?<<

Yes

Regarding ScottPlot, we're going to leave it as-is and include the existing ScottPlot library in the installer. But you're free to swap it out if you want by replacing the DLL. We found ScottPlot 5 eliminated their GetBitmap call so it's not possible to get an in-memory image any more for our purposes. There might be a way, but we haven't discovered it yet and we don't have the bandwidth to investigate that when ScottPlot 4 serves the purpose.
1
- ago
#11
@Glitch - I understand and appreciate the effort involved in moving to ScottPlot 5 and the lack of GetBitmap(). That said, in the future should you decide to move to ScottPlot 5, here is an example of equivalent code for getting a bitmap with a few extra conversion methods thrown in. This is a WPF app using ScottPlot 5...

CODE:
using System.Drawing; using System.IO; using System.Windows; using System.Windows.Media.Imaging; using ScottPlot; using Image = System.Drawing.Image; using ImageFormat = System.Drawing.Imaging.ImageFormat; namespace BitmapExample { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); var plot = GetPlot(); var plotBytes = plot.GetImageBytes(400, 400); Bitmap bm; using (var mem = new MemoryStream(plotBytes)) { // We must use the copy because we want to get rid of the memory stream. // We don't want the memory stream baggage hanging around. // See the remarks here: <a href="https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.-ctor?view=dotnet-plat-ext-8.0#system-drawing-bitmap-ctor" target="_blank">https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.-ctor?view=dotnet-plat-ext-8.0#system-drawing-bitmap-ctor</a>(system-io-stream) bm = new Bitmap(new Bitmap(mem)); } ImageViewer1.Source = BitmapToBitmapImage(bm, ImageFormat.Bmp); } private static Plot GetPlot() { var thePlot = new Plot(); double[] dataX = { 1, 2, 3, 4, 5 }; double[] dataY = { 1, 4, 9, 16, 25 }; thePlot.Add.Scatter(dataX, dataY); return thePlot; } private static BitmapImage BitmapToBitmapImage(Image image, ImageFormat imageFormat) { using (var memoryStream = new MemoryStream()) { image.Save(memoryStream, imageFormat); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = memoryStream; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } public static BitmapImage BitmapBytesToBitmapImage(byte[] data) { using (var memoryStream = new MemoryStream(data)) { var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = memoryStream; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } } private static Bitmap BitmapImageToBitmap(BitmapSource bitmapImage) { using (var outStream = new MemoryStream()) { var encoder = new BmpBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); encoder.Save(outStream); var bitmap = new Bitmap(outStream); // We must use the copy because we want to get rid of the memory stream. // We don't want the memory stream baggage hanging around. // See the remarks here: <a href="https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.-ctor?view=dotnet-plat-ext-8.0#system-drawing-bitmap-ctor" target="_blank">https://learn.microsoft.com/en-us/dotnet/api/system.drawing.bitmap.-ctor?view=dotnet-plat-ext-8.0#system-drawing-bitmap-ctor</a>(system-io-stream) return new Bitmap(bitmap); } } } }


CODE:
<Window x:Class="BitmapExample.MainWindow" xmlns="<a href="http://schemas.microsoft.com/winfx/2006/xaml/presentation" target="_blank">http://schemas.microsoft.com/winfx/2006/xaml/presentation</a>" xmlns:x="<a href="http://schemas.microsoft.com/winfx/2006/xaml" target="_blank">http://schemas.microsoft.com/winfx/2006/xaml</a>" xmlns:d="<a href="http://schemas.microsoft.com/expression/blend/2008" target="_blank">http://schemas.microsoft.com/expression/blend/2008</a>" xmlns:mc="<a href="http://schemas.openxmlformats.org/markup-compatibility/2006" target="_blank">http://schemas.openxmlformats.org/markup-compatibility/2006</a>" xmlns:local="clr-namespace:BitmapExample" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <StackPanel> <Image Name="ImageViewer1" Height="400" Width="400" /> </StackPanel> </Grid> </Window>
1
Glitch8
 ( 11.82% )
- ago
#12
Thanks for that!
0
Glitch8
 ( 11.82% )
- ago
#13
Well, the hard part of the WL8 -> .NET8 effort is completed. We have Build 77 and all of our Extensions targeting .NET8 and the setups rebuilt. Overall a very smooth process, kudos to Microsoft!

In the process we updated all package libraries, including the Alternet Editor and the TeeChart components to their current versions.

Existing custom extensions (and compiled Strategies) that targeted WL8 pre-Build-77 should still work fine, we tested a few of the finantic Extensions.

We're going to go through some more thorough testing in-house and then release it probably in a few days.
3
- ago
#14
QUOTE:
We have Build 77 and all of our Extensions targeting .NET8 and the setups rebuilt.

Please update the developer instructions for using Visual Studio with Build 77 as well. And indicate which version of Visual Studio we need to upgrade to.

It would also be nice to update ScottPlot 4 to the latest build. I need to use some features that require ScottPlot 4.1.70 or better.
0
Cone8
 ( 21.52% )
- ago
#15
Visual Studio > Help > Check for Updates
The upgrade now will get you to 17.8.6, which will also install .NET 8.
1
- ago
#16
For those of us that don't use VS: Will we be required to update to .NET 8 manually (I checked my Win 11, its using v4.x .NET Framework) before updating to B77? Or will all that stuff be wrapped up in the B77 update itself??
0
Glitch8
 ( 11.82% )
- ago
#17
The installer will handle it, just like it does now for .NET6.
1
- ago
#18
@paul1986

Hi Paul,
Thank you for sharing the code in Post #11. Do you have any objections to including it in our code base as a helper method for ScottPlot 5 users?
0
Glitch8
 ( 11.82% )
- ago
#19
We are trying to decide whether to ship ScottPlot 4.7.1 or 5 with the next Build. The addition of a GetBitmap extension method might ease the migration pain for users currently using ScottPlot if we decide to ship with SP 5.
0
- ago
#20
@Eugene

I have no objection. I performed somewhat limited testing, so you might want to run a few tests. And, perhaps my comments should be modified :)

And, to save app memory there is the use of DecodePixelHeight or DecodePixelWidth, but not both. See comments in the C# example at the end of this page: https://learn.microsoft.com/en-us/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-bitmapimage?view=netframeworkdesktop-4.8&viewFallbackFrom=netdesktop-6.0 (Ignore the 4.x framework, as Microsoft keeps flipping back to that page regardless of what you select in their Version dropdown.)

Here is an update to BitmapToBitmapImage to include DecodePixelHeight:

CODE:
private static BitmapImage BitmapToBitmapImage(Image image, ImageFormat imageFormat) { using (var memoryStream = new MemoryStream()) { image.Save(memoryStream, imageFormat); var bitmapImage = new BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.DecodePixelHeight = image.Height; bitmapImage.StreamSource = memoryStream; bitmapImage.EndInit(); bitmapImage.Freeze(); return bitmapImage; } }
1
Glitch8
 ( 11.82% )
- ago
#21
BTW: We just published a web site update so our web site is now running under .NET8!
4
- ago
#22
QUOTE:
... decide whether to ship ScottPlot [4.1.71] or 5 with the next Build.

As long as the finantic.InteractiveGraphics is updated to work with ScottPlot 5 (if it needs updating) at the time of the release, I don't have a problem switching to ScottPlot 5.

You could release the next WL update with ScottPlot 4.1.71 for now, then switch to 5 a WL release or two later. That might be the safest (i.e. most conservative) bet. I'll need to rewrite all the ScottPlots when you do.

QUOTE:
The addition of a GetBitmap extension method ... if we decide to ship with SP 5.

That sounds like a plan. ScottPlot 5 is suppose to support other OSes besides Windows, so I'm "guessing" GetBitmap was too hard to support on non-Windows OSes. Perhaps that might change.
0
Glitch8
 ( 11.82% )
- ago
#23
You're are at least most vocal ScottPlot user, superticker, so let's do what you suggested and ship it with 4.7.1, and possibly update to 5 in a few builds to give finantic time to adjust!
3

Reply

Bookmark

Sort