Bootstrap LibreOffice with .NET Core throws Exception


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 and same SDK version, .NET Core 3.1, Windows 10 64bits.

Has anyone successfully bootstrapped LibreOffice with Net Core?

asked on Stack Overflow Feb 10, 2020 by Nomada • edited Feb 10, 2020 by Nomada

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0