Current filter:
                                You should refresh the page.
                                • david castellanos 09.12.2019

                                  Questions:

                                  1. Does the error occur in devexpress version 18.1.6?
                                  2. Are there more methods in DocumentLayout that can be blocked if IsDocumentFormattingCompleted value is true?
                                • Yulia (DevExpress Support) 09.12.2019

                                  It is not possible to determine the cause of the problem based on this description only. Please send us a small sample that reproduces the issue.

                                  In the meantime, check if there are any user handled exceptions when the application hangs.
                                  To check this, turn on the following settings in Visual Studio:

                                  1. In the VS Tools | Options... dialog go to the Debugging node and uncheck the Enable Just My Code (Managed Only) check box.
                                  2. Select the Debug | Exceptions... menu item or press Ctrl+Alt+E. The Exceptions dialog will appear.
                                  3. Select the "Common Language Runtime Exceptions" item.

                                  Reproduce the problem and send us the exception's call stack from the Call Stack window (Debug | Windows | Call Stack) if there is any.

                                  See also: How to obtain the exception's call stack

                                • david castellanos 09.12.2019

                                  It is impossible to me to extract a full example, it is not my code, difficult to explain.

                                  1. we have a DevExpress.XtraRichEdit.RichEditControl
                                  2. we engage to richEditControl1.Views.PrintLayoutView.PageCountChanged event to call richEditControl1.DocumentLayout.GetPageCount();

                                  We have a button to translate digit numbers to string numbers. If I press that button then A method call several times to richEditControl1.Document.Replace. When finish PageOcuntChanged event is fired and the thread become blocked.

                                  If we put the condition if(!IsDocumentFormattingCompleted) before call GetPageCount, the thread do not block.

                                • david castellanos 09.12.2019

                                  There is no errors while executing, only the thread is blocked.

                                1 Solution

                                Creation Date Importance Sort by

                                Thank you for your clarification, David. When you call the Document.Replace method, a document changes. As a result, the document layout is recalculated. The document layout is calculated asynchronously. So, when you call the DocumentLayout.GetPageCount method, the document layout can be not ready or not up-to-date.

                                It is recommended to use the DocumentLayout.DocumentFormatted event to check layout-dependent information. Move the DocumentLayout.GetPageCount method call into that event handler.
                                Note that the DocumentFormatted event is running in a background thread. So, it is necessary to use the RichEditControl.BeginInvoke method to avoid concurrency issues.