https://bugs.documentfoundation.org/show_bug.cgi?id=166857

            Bug ID: 166857
           Summary: Mapping exception in new .NET bridge
           Product: LibreOffice
           Version: 25.8.0.0 alpha0+
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: sdk
          Assignee: [email protected]
          Reporter: [email protected]

Using new dotnet binding throws following exception when getting XDesktop2
after connecting to LibreOffice:
com.sun.star.uno.RuntimeException: could not map given type name
com.sun.star.frame.XDesktop2 at
/home/username/libregit/core/bridges/source/net_uno/net_base.cxx:230: 
   at com.sun.star.uno.native.NetEnvironment.ThrowError(String pWhere, String
pMessage)


Steps to Reproduce:
1. Create a new .net 8 application
2. Add the LibreOffice.Bindings package from the LibreOffice SDK
3. Place the following code in the Main function:

        var unoUrl =
"uno:socket,host=localhost,port=2083;urp;StarOffice.ServiceManager";

        var localComponentContext =
NativeBootstrap.defaultBootstrap_InitialComponentContext();
        var urlResolver = UnoUrlResolver.create(localComponentContext);

        var resolvedObject = urlResolver.resolve(unoUrl)
            ?? throw new UnoWrapperException("Provided initial object name
unknown at server side");

        var defaultServerContext = resolvedObject.query<XPropertySet>()
            .getPropertyValue("DefaultContext")
            .cast<XComponentContext>();

        var desktop = Desktop.create(defaultServerContext);
        var componentLoader = desktop.query<XComponentLoader>();

4. Launch LibreOffice with: soffice
"--accept=socket,host=localhost,port=2083;urp;"
5. Launch dotnet application
6. When calling "Desktop.create()" execution will fail with an error


Actual Results:
Desktop.create() throws an exception:
com.sun.star.uno.RuntimeException: could not map given type name
com.sun.star.frame.XDesktop2 at
/home/username/libregit/core/bridges/source/net_uno/net_base.cxx:230: 
   at com.sun.star.uno.native.NetEnvironment.ThrowError(String pWhere, String
pMessage)


Expected Results:
Desktop.create() should return an XDesktop2 object without throwing an
exception


Reproducible: Always


Additional Info:
1. The bug was filed after posting a question on Ask:
https://ask.libreoffice.org/t/problem-with-dotnet-mapping-after-connect-to-libreoffice/122685
2. LibreOffice was built from source
        Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
        Build ID: d572a56bea0a5ad01f485b365b2135c682c9f65f
        CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: gtk3
        Locale: en-US (en_US.UTF-8); UI: en-US
        Calc: threaded
3. OS: Ubuntu 22.04
4. Using the NativeBootstrap.bootstrap() function, which creates the
LibreOffice process itself, works fine with the following code:

        var context = NativeBootstrap.bootstrap();
        var desktop = Desktop.create(context);
        var componentLoader = desktop.query<XComponentLoader>();

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to