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.

A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.DocIO.WinRT.DLL

Thread ID:

Created:

Updated:

Platform:

Replies:

116882 Jun 24,2014 05:17 PM Jul 24,2014 06:30 AM WinRT 5
loading
Tags: DocIO
Patrick Lynch
Asked On June 24, 2014 05:17 PM

(Using Syncfusion Version 11.4810.0.26 on Windows 8.1 Update 1, Visual Studio 2013 Update 2)

After previously loading rtf text into a WordDocument object and performing some manipulations on it (removing entities that are not of type TextRange), we then try to get the updated rtf text out of the WordDocument using the Save method as follows:

string rtfFinal = String.Empty;

using (MemoryStream outgoingRTFStream = new MemoryStream())
{
    document.Save(outgoingRTFStream, FormatType.Rtf);
    outgoingRTFStream.Seek(0, SeekOrigin.Begin);

    using (StreamReader rtfReader = new StreamReader(outgoingRTFStream))
    {
        rtfFinal = rtfReader.ReadToEnd();
    }
}

However, the line calling document.Save results in about 80 instances of the following exception showing up in the VS 2013 Output window:

A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.DocIO.WinRT.DLL

It seems that the DocIO component is swallowing the exceptions and so the rtf string is actually set correctly as we had hoped. But the issue is that this simple serialization operation takes over a second to complete even for very small documents (a few hundred words).

Do you have any ideas how we can avoid these exceptions from getting generated in the DocIO components?

Thanks,

Pat


Sathish K [Syncfusion]
Replied On June 27, 2014 07:39 AM

Hi Patrick,

 

Thank you for your update.

 

We are unable to reproduce the mentioned Null reference exception issue while saving the document with the given code snippet. Could you please update us your exact working scenario with the input document and the code snippets or sample project used your end to reproduce the issue? Thereby we will analyse further on your requirement and update you the appropriate solution.

 

Please let us know if you have any other questions.

 

Regards,

Sathish


Patrick Lynch
Replied On June 27, 2014 10:16 AM

Thanks for your response - here is some more info to help you reproduce this and give me advice.

I have attached a Windows Store project that shows this issue being reproduced 4 times for 4 different scenarios

Case 1: Default Rtf (no user content added) output from the MS WinRT RichEditBox control. This Rtf is loaded into a DocIO WordDocument (works fine) and then immediately exported back to a stream using WordDocument.Save(stream, FormatType.Rtf). This call to Save "work " in that rtf is exported, but when the call happens you can see about ~80 exceptions fly by in the in the VS output window.

Case 2: Same approach and result (including exceptions) as above, but the input Rtf has a little text and an embedded image. The source of the Rtf is still the MS WinRT RichEditBox control.

Case 3: Same approach and result (including exceptions) as above, but the input Rtf has a large text block (with some light formatting). The source of the Rtf is still the MS WinRT RichEditBox control.

For all three of the above cases, the rtf input can be found in the RtfConstants.cs file.

Case 4: Create a DocIO WordDocument and use the DocIo api to create some content in it. The code used to create the content was taken right from one of your website examples:). After the WordDocument is filled up, the code next immediately exports it back to a stream using WordDocument.Save(stream, FormatType.Rtf). As in all other cases, the export produces Rtf, but with many First Chance Exceptions being thrown and handled/swallowed in DocIO.

The exception of note in all four cases is:

A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.DocIO.WinRT.DLL

The reason I care about these exceptions is that they make the export operation take over a second; since this is on the UI thread is noticeable to users.

Notes about the attached Windows Store repro project :

DocIO Version used: Syncfusion Version 11.4810.0.26

VS version: Visual Studio 2013 Update 2

OS version : Windows 8.1 Update 1

There are a couple of extra files included that are not used in the version I am sending you. For the test methods (each represented by  button on MainPage.xaml) you will use, all the code is contained in MainPage.xaml.cs, and the input text comes from RtfConstants.cs.

Please let me know if you need any other info from me - Thanks,

Pat




Attachment: SFExceptionsOnExportToRTF_4495693d.zip

Sathish K [Syncfusion]
Replied On July 1, 2014 11:13 AM

Hi Patrick,

 

Thank you for your update.

 

We are able to reproduce the mentioned Null reference exception issue with the attached sample in the Essential Studio version 11.4.0.26 and glad to inform you that the mentioned issue has been resolved in our latest version 12.1.0.43. Could you please upgrade your version to the latest one 12.1.0.43 to resolve the mentioned issue? You can download our latest version from below link.

 

Latest version Link:

http://www.syncfusion.com/support/forums/announcements/116142

 

Please let us know if you have any other questions.

 

Regards,

Sathish


Patrick Lynch
Replied On July 23, 2014 02:43 PM

As recommended by Syncfusion, we upgraded to version 12.2.0.36 of the WinRT controls, and this fixed the problem. Saving rtf into a WordDocument object no longer causes exceptions.

Thanks,

Patrick


Sathish K [Syncfusion]
Replied On July 24, 2014 06:30 AM

Hi Patrick,

 

Thank you for your feedback.

 

Please let us know if you have any other questions. We will be happy to assist you as always.

 

Regards,

Sathish

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.

;