I am following the instructions here: https://help.syncfusion.com/windowsforms/syntax-editor/syntax-highlighting#apply-custom-configuration-in-editcontrol
Here's my code:
private string editControlConfig = Path.GetDirectoryName(Application.ExecutablePath) + @"\..\..\config.xml";
When I run my application, I get the following error:
Exception thrown: 'System.InvalidCastException' in System.Private.CoreLib.dll
An exception of type 'System.InvalidCastException' occurred in System.Private.CoreLib.dll but was not handled in user code
Unable to cast object of type 'Syncfusion.Windows.Forms.Edit.Implementation.Config.ConfigLanguage' to type 'Syncfusion.Windows.Forms.Edit.Implementation.Config.ConfigLanguage'.
Here's a screenshot:
What am I doing wrong here? This is a C# solution targeting .NET 7.0, using Visual Studio 2022 with all the required Syncfusion assemblies installed.
We were unable to reproduce the reported issue. We have attached the tested sample for your reference, in which it works fine without any exception. Could you please provide more details such as a complete code snippet or revert us with modify the attached sample in the reproduced state that will be helpful us to provide the solution as soon as possible.
Your solution works properly on my end. I don't know why mine doesn't.
I've uploaded my solution to this post. Maybe that will help you narrow down what's going wrong.
Excuse the awful syntax, I am still learning C#.
After analyzing your sample, we find out the issue in Config.xml file. To resolve this issue, you should add the ConfigLanguage tag inside the ArrayOfConfiguration tag in the config.xml file as per the below code snippet.
<format name="Text" Font="Input, 13pt"/>
We have also attached the modified sample for your requirement. Please download the sample in the attachment and let us know if you have any other queries.