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.
Unfortunately, activation email could not send to your email. Please try again.

Handling an exception from SfRichTextBoxAdv

Thread ID:

Created:

Updated:

Platform:

Replies:

115544 Jan 21,2014 06:14 PM Jan 23,2014 05:50 AM WinRT 1
loading
Tags: General
Timothy J Eicher
Asked On January 21, 2014 06:14 PM

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);
try
{
    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.

Thanks!

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

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.

Regards,
Gunasekaran


CONFIRMATION

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.

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.

;