I went through new errors on RichEditControl.
In attachment you'll find a sample application that exposes two kind of errors: a GDI and an Out Of Memory error.
Just two words on the operations' flow:
- clicking the "GDI Error" Button, a Document is loaded into the editor, variables are calculated and substitutions made. Then, clicking "OK" on
subsequent message box, the application tries to save the Document using the SaveDocument method by stream. Then the exception is raised.
- clicking che "OOM Error", the Document is loaded and variables calculated. Clicking "OK" on the Message Box, the document is saved using the
same method. When I try to reload the document I get the error. In my original project I need to reload the document after saving.
Hoping it's clear enough.
The GDI+ error is caused by the fact that you are disposing of image and document streams when they are being loaded (note that they are loaded asynchronously). I have removed the "Using" statement from your code and that fixed the issue. As for the OutOfMemoryException, it is caused by the logo image insertion:
If LogoImg IsNot Nothing Then Dim rangePos = txtTesto.Document.FindAll("<@LogoCliente@>", API.Native.SearchOptions.None) If rangePos.Length > 0 Then Dim img = txtTesto.Document.InsertImage((rangePos(0).Start), LogoImg) img.ScaleX = 0.5 img.ScaleY = 0.5 End If End If txtTesto.Document.ReplaceAll("<@LogoCliente@>", "", API.Native.SearchOptions.None)
I will contact our developers regarding this issue and let you know once we have any results.
as you sgggests, I got rid of all the "using" in my code, in order to avoid disposing objects still needed.
Now, with this change, I get only one type of error: the Out Of Memory one.
In attachment, I put the new code.
Hoping this could be solved soon.
I am glad to inform you that our developers have managed to fix this issue. The fix will be available with the next XtraRichEdit Suite update (v2011 vol 2.9). Your application will operate without an OutOfMemoryException with this update. You can request a public fix immediately (prior to the official release) if this is a matter of urgency for you. For more details about this service, please read Julian's blog at Getting your fix: the DevExpress way .
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.