Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 2689 - NET6 Creating a series without creating a chart causes program to crash
Summary: NET6 Creating a series without creating a chart causes program to crash
Status: RESOLVED FIXED
Alias: None
Product: .NET TeeChart
Classification: Unclassified
Component: Series (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-21 10:34 EDT by Edu
Modified: 2024-03-21 11:02 EDT (History)
0 users

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edu 2024-03-21 10:34:59 EDT
It only happens with NET6.

When creating a series without having created a chart previously, this crash happens:
(Series.cs)
public IChartBrush Brush { get; set; } = (IChartBrush)Activator.CreateInstance(ChartBrushType, null, Utils.EmptyColor, true);

-- Exception Unhandled, 'Value cannot be null'
because "ChartBrushType" is null.

The way our code works is (NET6 only!!)
When creating a Chart, the method private void InitTypes() is executed.
Via that method, multiple Types get their value. 

If a series were to be created without having created a TChart first, those types would be null and therefore cause an unhandled exception.
Comment 1 Edu 2024-03-21 10:37:21 EDT
There's a workaround to solve this issue which is creating a TChart before creating any series. 
However, to offer another option, we've decided to make the Chart method "private void InitTypes()" public and static instead.

This way, users can call the method like this:
Steema.TeeChart.TChart.InitTypes();
So they can work with series without the need to create a Chart.
Comment 2 Edu 2024-03-21 11:02:26 EDT
There's a workaround to solve this issue which is creating a TChart before creating any series. 
However, to offer another option, we've decided to make the Chart method "private void InitTypes()" public and static instead.

This way, users can call the method like this:
Steema.TeeChart.TChart.InitTypes();
So they can work with series without the need to create a Chart.



Commit: 1e13f4ace80b183c43e1565780b4f3f5a7f85595 [1e13f4a]