We are thrilled to announce that our Windows Forms and WPF products now fully support the latest version of .NET. At the , Microsoft officially announced .NET 8. At the .NET Conf 2023, Microsoft made the official announcement of .NET 8. This new version is the LTS successor to .NET 6 and comes with 3 years of free support and patches.

.NET 8 release schedule

All update notes and especially the performance improvements can be found in a very detailed blog post by Stephen Toub.

Performance Improvements in .NET 8

TX Text Control .NET 32.0 SP2 (Windows Forms and WPF) supports .NET 8 applications and we have tested our libraries with early versions and the final release version.

Memory and Performance Improvements

To see how the memory footprint and performance improved, we created a simple Windows Forms App to test the new version.

Creating the Project

  1. Open Visual Studio 2022 and create a new project. Select C# or Visual Basic from the Languages drop-down list, Windows from the Platform list and Desktop as the Project Type. Find the project template Windows Forms App and confirm with Next.

    Windows Forms

  2. Specify a project name confirm with Next.

  3. Select your preferred Framework version such as .NET 8 (Long-term support) and confirm with Create.

Adding the Control

  1. Select the project in the Solution Explorer and click Project -> Manage NuGet Packages... from the main menu.

  2. Select Text Control Offline Packages as the Package source and click Browse.

  3. Select TXTextControl.TextControl.WinForms.SDK and click Install.

    Windows Forms

  4. In the Solution Explorer, open the form Form1 and find the TX Text Control 32.0 tab in the Toolbox.

    Windows Forms

  5. Select the icon TextControl and draw it onto the opened form.

.NET 8 Compatible Licensing

You will notice a new file created by the NuGet package called txtextcontrol.winforms.license. The licensing mechanism has been updated to be independent of .NET and existing licensing mechanisms. Version 32.0 SP2 no longer uses the .NET license compiler (lc.exe), so entries in the licenses.licx file are no longer required.

Windows Forms

Additional Functionality

  1. Select Form1.cs in the Solution Explorer and choose Designer from the View main menu.

  2. Find the Button in the toolbox and draw it onto the form.

    Windows Forms

  3. Double-click the button to create the Click event handler. Add the following code to the Click event handler:

    private void button1_Click(object sender, EventArgs e)
    {
    textControl1.Load("App_Data/invoice.tx", TXTextControl.StreamType.InternalUnicodeFormat);
    var jsonData = System.IO.File.ReadAllText("App_Data/data.json");
    using (var mailMerge = new MailMerge { TextComponent = textControl1 })
    {
    mailMerge.MergeJsonData(jsonData, true);
    }
    }
    view raw test.cs hosted with ❤ by GitHub
  4. Create a folder named App_Data in the root of your project. Copy the files contained in this ZIP file into this folder.

Executing the Application

When the button is clicked, the MailMerge class is used to merge the JSON data into a template, which is then returned to the editor. The Visual Studio Diagnostic Tools are used to monitor memory usage and document merge time. These values will be compared to the same application that is running with .NET 6.

Start the application by pressing F5 and click the inserted button. The document is loaded and the merge process is started. The following screenshots shows the memory usage and the merge time:

.NET 8

In .NET 8, the maximum amount of memory that the application will use is 41 MB or process memory. The ServerGarbageCollection option is set to false for this demo. More information on the differences is available here: Workstation and server garbage collection.

The time it takes to load the template, merge the JSON data, and export the document, resulting in a 25-page document, is approximately 2.5 seconds.

Memory usage and merge time

.NET 6

The same application running with .NET 6 uses 43 MB of process memory. The average time to create the document using the same template and data is approximately 3.1 seconds.

Memory usage and merge time

Conclusion

The memory saved is not significant, but the merge performance has been increased by 20%.

Full Toolbox and Designer Support

Thanks to the NuGet packages, the TX Text Control components such as the TextControl, StatusBar and Ribbon are automatically available in the toolbox after installing the NuGet package. The advantage of this mechanism is that only the toolbox items needed for the current project are available.

After creating a TextControl on a form, you have full access to the designer functionality to add more components such as the ribbon bar, ruler bars and to connect and arrange controls automatically.

Memory usage and merge time

Deployment

When deploying the application, TX Text Control 32.0 SP2 fully supports the Publish functionality of Visual Studio. For example, in the following screenshot the application is published to a folder.

Memory usage and merge time

After selecting the folder, you can choose the Target runtime and the Deployment mode:

Memory usage and merge time

When the application is published, all required files (including TX Text Control binary filters) are automatically copied to the correct location:

Memory usage and merge time

Conclusion

TX Text Control 32.0 SP2 fully supports the new deployment mechanism of .NET 8 and Visual Studio 2022. The NuGet packages provide support for the Visual Studio toolbox and designer. In addition, the new licensing mechanism fully supports .NET 8 applications.