Page 1 of 1

C# XmlSerializer BindingFailure

Posted: Mon May 14, 2018 9:32 pm
by 15683141
Hello,

Attached please find a zip file that has a simple TChart .NET project. After unzipping the file load the project in VS 2017. Please select Debug -> Windows -> Exceptions settings and enable the check box next to the 'Managed Debugging Assistant'.
If you run the program you should see the exception dialog box that says 'Managed Debugging Assistant BindingFailure: ' and a long message which is saying failure to load XMlserializer.

I am trying to get rid of this exception. This happens only first time and program works. However it increases the load time of the form for the first time.

Please let me know how to resolve this.

Thanks

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 3:07 pm
by Christopher
Hello,

Which version of TeeChart.dll are you using? I don't get anything using either of the last two publicly released versions.

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 3:21 pm
by 15683141
We are using 4.1.2017.10194 version - .Net 4.5.1. Please enable the exception settings for 'Managed Debugging Assistant' .

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 7:43 pm
by Christopher
Hello -
sanjay wrote:We are using 4.1.2017.10194 version - .Net 4.5.1. Please enable the exception settings for 'Managed Debugging Assistant' .
I think you might be getting this error (from here):
firefox_2018-05-15_21-41-19.png
firefox_2018-05-15_21-41-19.png (27.71 KiB) Viewed 16024 times

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 7:58 pm
by 15683141
The exception will also happen at tun time and will slow down the startup time for the windows forms application.

Please look at the second answer to the above post from stack overflow (copied below)
------------------------------------------------------------
Use the following method to construct your xmlSerializer instance will fix the problem:

XmlSerializer s = XmlSerializer.FromTypes(new[] { typeof(CustomXMLSerializeObject) })[0];
then, you don't need to turn off the exception handlings.
---------------------------------------------------------

TChart constructor needs to put above code so that exception does not happen.

The exception slows down the startup of my forms and the above posts mentions that you can generate a XML serializer assembly for TChart DLL that can be distributed. That can also prevent exception.

Please show the post from stack overflow to your developer and see if you can fix the exception and/or generate the serializer assembly.

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 8:03 pm
by Christopher
Hello,

setting false in the TChart constructor, e.g.

new TChart(false);

and commenting out the call to:

//this.tChart1.CurrentTheme = Steema.TeeChart.ThemeType.Report;

will stop this issue from occuring.

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 8:21 pm
by 15683141
Thank you. That fixed it. I really appreciate your help. Thanks again.

Re: C# XmlSerializer BindingFailure

Posted: Tue May 15, 2018 8:25 pm
by Christopher
sanjay wrote:Thank you. That fixed it. I really appreciate your help. Thanks again.
You're very welcome, and your thanks are appreciated.