3

I was using this code on Net Framework 4.x successfully:

        var unoPath = @"C:\Program Files\LibreOffice 5\program";
        Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + @";" + unoPath, EnvironmentVariableTarget.Process);
        var context = uno.util.Bootstrap.bootstrap();

I´m working now on a net core (v 3.1) project that needs to use LibreOffice as well, but i'm getting an exception:

System.InvalidOperationException: Handle is not initialized. at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value) at uno.util.to_cli(Reference* x) at uno.util.Bootstrap.bootstrap()

If i add UNO_PATH as suggested here

Environment.SetEnvironmentVariable("UNO_PATH", unoPath, EnvironmentVariableTarget.Process);

then i get another exception:

System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception. at cppu.bootstrap(Reference* ) at uno.util.Bootstrap.bootstrap()

Michael Stahl (LibreOffice) suggested a CLIuno bridge issue with net core.

I'm using LibreOffice 6.4.0.3 and same SDK version, .NET Core 3.1, Windows 10 64bits.

Has anyone successfully bootstrapped LibreOffice with Net Core?

Nomada
  • 343
  • 2
  • 10
  • Hey having the same issue, could you solve it? Checked out the code and it was some IntPtr beeing empty after com.sun.star.uno.Mapping.mapInterface call. – Michael P Jun 18 '22 at 21:45

0 Answers0