Bug 64070 - Handle is not initialized exception
Summary: Handle is not initialized exception
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
4.0.2.2 release
Hardware: Other All
: high critical
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 64071 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-30 05:35 UTC by Kaviyarasan.K
Modified: 2022-04-29 16:28 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kaviyarasan.K 2013-04-30 05:35:19 UTC
While using LibreOffice SDK I am facing this error, But this error after upgraded to V4.0.2, Working fine in V3.5
Comment 1 Julien Nabet 2013-05-31 20:45:24 UTC
*** Bug 64071 has been marked as a duplicate of this bug. ***
Comment 2 Julien Nabet 2013-05-31 20:46:58 UTC
Kaviyarasan: I don't think I may help but could you give more details?
Which env?
Step by step process to reproduce the problem?
Comment 3 Kaviyarasan.K 2013-06-03 06:21:40 UTC
Hi,
   I am trying to capture the ppt slide by using your dll, It is working fine while I am having LibreOffice 3.5, But it is throwing an error after upgraded to LibreOffice 4.0..Is there any workaround for this issue..

Regards,
Kavi


From: bugzilla-daemon@freedesktop.org 
Sent: Saturday, June 01, 2013 2:16 AM
To: kaviyarasan.k@dsrc.co.in 
Subject: [Bug 64070] Handle is not initialized exception



Comment # 2 on bug 64070 from Julien Nabet 
Kaviyarasan: I don't think I may help but could you give more details?
Which env?
Step by step process to reproduce the problem?

--------------------------------------------------------------------------------
You are receiving this mail because: 
  a.. You are on the CC list for the bug. 
  b.. You reported the bug. 
Regards,
Kavi
Comment 4 QA Administrators 2015-03-17 00:14:18 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

    Test to see if the bug is still present on a currently supported version of LibreOffice (4.4.1 or later)
    https://www.libreoffice.org/download/

    If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior
  
  If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System

Please DO NOT

    Update the version field
    Reply via email (please reply directly on the bug tracker)
    Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3)

http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to "inherited from OOo";
4b. If the bug was not present in 3.3 - add "regression" to keyword


Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa

Thank you for your help!

-- The LibreOffice QA Team This NEW Message was generated on: 2015-03-16
Comment 5 Jean-Baptiste Faure 2015-03-28 18:31:35 UTC
No answer since 2 years to the step by step process to reproduce the problem (comment #2)
This bug report has never been confirmed independently.

Closing as INVALID. Please feel free to reopen if you are willing to provide step by step process to reproduce the problem you encounter. Please add a test file.

Best regards. JBF
Comment 6 Michele Locati 2022-04-28 14:18:55 UTC
This is still valid as of LibreOffice 7.3.

This exact same code works with .Net Framework 4.8, but not with .Net 6.


static int Main()
{
    string programPath = GetProgramPath();

    System.Environment.SetEnvironmentVariable(
        "UNO_PATH",
        programPath,
        System.EnvironmentVariableTarget.Process
    );
    System.Environment.SetEnvironmentVariable(
        "URE_BOOTSTRAP",
        $"vnd.sun.star.pathname:{System.IO.Path.Combine(programPath, "fundamental.ini")}",
        System.EnvironmentVariableTarget.Process
    );
    System.Environment.SetEnvironmentVariable(
        "PATH",
        $"{programPath}{System.IO.Path.PathSeparator}{System.Environment.GetEnvironmentVariable("PATH")}",
        System.EnvironmentVariableTarget.Process
    );
    try
    {
        uno.util.Bootstrap.defaultBootstrap_InitialComponentContext();
        System.Console.Out.WriteLine("OK!");
        return 0;
    }
    catch (System.Exception x)
    {
        System.Console.Error.WriteLine(x.GetType().FullName);
        System.Console.Error.WriteLine(x.Message);
        System.Console.Error.WriteLine(x.StackTrace);
        return 1;
    }
}

private static string GetProgramPath()
{
    var programPath = Microsoft.Win32.Registry.GetValue(
        Microsoft.Win32.Registry.LocalMachine.Name + @"\SOFTWARE\LibreOffice\UNO\InstallPath",
        "",
        null
    ) as string;
    if (string.IsNullOrEmpty(programPath))
    {
        throw new System.Exception("Failed to detect the program path");
    }
    return programPath;
}



When executed with .Net Framework 4.8 everithing works just fine.

When executed with .Net 6 we have:

System.InvalidOperationException
Handle is not initialized.
   at System.Runtime.InteropServices.GCHandle.FromIntPtr(IntPtr value)
   at uno.util.to_cli<class com::sun::star::uno::XComponentContext>(Reference<com::sun::star::uno::XComponentContext>* x)
   at uno.util.Bootstrap.defaultBootstrap_InitialComponentContext(String ini_file, IDictionaryEnumerator bootstrap_parameters)
   at uno.util.Bootstrap.defaultBootstrap_InitialComponentContext()
   at ConsoleDotNetFramework.Program.Main() in Program.cs:line 26
```

PS: I published a simple Visual Studio solution to showcase this: see https://github.com/mlocati/libreoffice-uno-dotnet
Comment 7 Jean-Baptiste Faure 2022-04-29 15:51:33 UTC
Hi Michele,

There is no clear link between your comment and the original bug report, which is very, very old.
Please open a new bug report with all needed information: step by step procedure to reproduce the problem, expected behavior and current behavior, LibreOffice version, etc.

Best regards. JBF
Comment 8 Michele Locati 2022-04-29 16:28:28 UTC
Thanks for the quick reply, Jean-Baptiste!

I've just submitted https://bugs.documentfoundation.org/show_bug.cgi?id=148857