UNO API LibreOffice Process hang/freeze C#

asked 2015-09-08 11:01:30 +0100

Tahir Nazir gravatar image

I have an appication in which I fill the LibreOffice text document using bookmarks and then save them as PDF (C#, .NET 4.0, VS 2010). I am facing the problem that when I fill the document first time then everything works fine but when I close the document using API and open new document and try to fill ( Automatically using Uno API) then Uno API process won't get response from LibreOffice.

Mean second time LibreOffice process won't response on writng bookmarks and my application process wait for the response of LibreOffice. This results in hang in my application, as my process wait indefinitely response from Uno API (and may be Uno API wait for response from running LibreOffice process).

Can someone tell what could be the reason or how to resolve this problem.

edit retag flag offensive close merge delete

Comments

can you provide the specific commands you issue to close the document. It might be worthwhile to exit the LibreOffice process entirely, using the equivalent of StarDekstop.terminate. See API here.

doug gravatar imagedoug ( 2015-09-08 15:26:37 +0100 )edit

.terminate() exit the LibreOffice process from memory completly. I am closing the Writer document using .close(true) and then load the new document using loadComponentFromURL(). But on second time it load the document but when I try to read bookmarks or try to get Range of bookmarks then process hang.

Tahir Nazir gravatar imageTahir Nazir ( 2015-09-09 08:24:27 +0100 )edit

your experience is similar to mine on Base. I assume you are on headless, so I'm not sure of cross-applicability of troubleshooting steps: 1) upgrade to current LO Fresh 2) see if there are intermediate objects to close-- for me Form objects, for you maybe a DrawPage? not sure 3) write Wait 100 equivalents at various points in your code to troubleshoot race conditions 4) make sure LO objects really are initializing correctly on second open-- LO 5.0 Win I need a strategic Wait 1

doug gravatar imagedoug ( 2015-09-10 02:54:11 +0100 )edit

Second time LibreOffice started correctly but when I try to access the position of bookmarks or try to write some content based on position of bookmark then the Uno API hang. But this only happened second time. I thought it might be some problem in my program and therefore I changed the LibreOffice with OpenOffice and there was no such problem. It mean that it is some bug in LibreOffice.

Tahir Nazir gravatar imageTahir Nazir ( 2015-09-10 13:52:57 +0100 )edit

Well, it means that some recent enhancement in LO has resulted in unexpected functionality in your case. OO is not under real active development as I understand it, so using OO is like using an antique version of LO.

doug gravatar imagedoug ( 2015-09-16 18:02:31 +0100 )edit