We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Handling an exception from SfRichTextBoxAdv

Thread ID:





115544 Jan 21,2014 11:14 PM UTC Jan 23,2014 10:50 AM UTC WinRT 1
Tags: General
Timothy J Eicher
Asked On January 21, 2014 11:14 PM UTC

I've found a problem where the SfRichTextBoxAdv control will throw an exception in a way that can't be handled when trying to load a corrupted .docx file.

I'm using this code in code-behind to load a document that I know is not formatted correctly.
// data contains random bytes
Stream stream = new MemoryStream(data);
    RichTextViewer.Load(stream, FormatType.Rtf);
catch (Exception e)
    // This code never seems to actually get hit.
    // The RichTextBoxAdv control will instead throw an exception later that we have no way of handling.
    logger.LogError("The document could not be opened because an exception occurred.", e);

As you can tell by the comments, the catch statement is never entered, and the call to Load completes successfully. However, after my code has completed, an unhandled exception occurs. I can catch it in the Application.UnhandledException event; however at this point it is too late and the app shuts down.

This is the exception that occurs:
System.IO.InvalidDataException: End of Central Directory record could not be found.
   at System.IO.Compression.ZipArchive.ReadEndOfCentralDirectory()
   at System.IO.Compression.ZipArchive.Init(Stream stream, ZipArchiveMode mode, Boolean leaveOpen)
   at System.IO.Compression.ZipArchive..ctor(Stream stream, ZipArchiveMode mode, Boolean leaveOpen, Encoding entryNameEncoding)
   at System.IO.Compression.ZipArchive..ctor(Stream stream)
   at Syncfusion.Compression.Zip.ZipArchive.<Open>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__4(Object state)
   at System.Threading.WinRTSynchronizationContext.Invoker.InvokeCore()

Just to reiterate - I'm expecting an exception because the document is corrupted, but I need it to occur in a way that it can be handled.


Gunasekaran T [Syncfusion]
Replied On January 23, 2014 10:50 AM UTC

Hi Timothy,

Thank you for your interest in Syncfusion products.

We are able to reproduce the mentioned issue with exception not trigger on loading corrupted Word document (.docx) in SfRichTextBoxAdv. We will fix this issue and this fix will be included in our upcoming refresh release or main release 2014 Volume 1. We will let you know once our refresh release or main release 2014 Volume 1 has been released. You may also check our website periodically for latest information related to our release.

Please let us know if you have any other questions.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon