Description: Microsoft cross-platform framework NetCore, I use the version of Net8, and according to the online tutorial using cli_basetypes.dll,cli_cppuhelper.dll and other 5 DLLS, The error is that the Handle is not initialized. This works fine in the Net FrameWork. I don't know if this is my fault or not supporting the NetCore platform. This is machine translation, there may be errors,all of the following are machine translations,, if there is any problem, please let me know Steps to Reproduce: 1. To execute code unoidl.com.sun.star.uno.XComponentContext xLocalContext = the Bootstrap. The Bootstrap (); // Bootstrap.bootstrap(); 2. 3. Actual Results: System.InvalidOperationException:“Handle is not initialized.” Expected Results: It should not report errors like the NetFrameWork. Normal execution Reproducible: Always User Profile Reset: No Additional Info: Load context
Created attachment 196577 [details] Testcode
Created attachment 196578 [details] TESTCode
Created attachment 196579 [details] dll
You are using the incorrect version of .NET binding, which is for older versions of .NET framework. The old binding does not work with cross platform .NET. But I have some good news: the new .NET binding for cross platform .NET has just landed in master, and in order to use it, you need to compile LibreOffice from sources, or use daily builds: https://dev-builds.libreoffice.org/daily/master/current.html To get started, look into SDK examples: https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/DevelopersGuide/FirstSteps/FirstUnoContact/csharp/ https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/ https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/ https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/dotnet/WriterDemo Please take a look at this minimal code from FirstUnoContact example: using System; using com.sun.star.lang; using com.sun.star.uno; try { XComponentContext xContext = NativeBootstrap.bootstrap(); Console.WriteLine("Connected to a running office..."); XMultiComponentFactory xMCF = xContext.getServiceManager(); Console.WriteLine("Remote service manager is {0}", xMCF is null ? "not available" : "available"); return 0; } catch (UnoException e) { Console.Error.WriteLine(e.Message); return 1; } It uses NativeBootstrap.bootstrap().
*** This bug has been marked as a duplicate of bug 148857 ***
(In reply to Hossein from comment #4) > You are using the incorrect version of .NET binding, which is for older > versions of .NET framework. The old binding does not work with cross > platform .NET. > > But I have some good news: the new .NET binding for cross platform .NET has > just landed in master, and in order to use it, you need to compile > LibreOffice from sources, or use daily builds: > > https://dev-builds.libreoffice.org/daily/master/current.html > > To get started, look into SDK examples: > > https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/ > DevelopersGuide/FirstSteps/FirstUnoContact/csharp/ > > https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/ > DevelopersGuide/FirstSteps/FirstLoadComponent/csharp/ > > https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/ > DevelopersGuide/FirstSteps/HelloTextTableShape/csharp/ > > https://git.libreoffice.org/core/+/refs/heads/master/odk/examples/dotnet/ > WriterDemo > > Please take a look at this minimal code from FirstUnoContact example: > > using System; > using com.sun.star.lang; > using com.sun.star.uno; > try > { > XComponentContext xContext = NativeBootstrap.bootstrap(); > Console.WriteLine("Connected to a running office..."); > XMultiComponentFactory xMCF = xContext.getServiceManager(); > Console.WriteLine("Remote service manager is {0}", xMCF is null ? "not > available" : "available"); > return 0; > } > catch (UnoException e) > { > Console.Error.WriteLine(e.Message); > return 1; > } > > It uses NativeBootstrap.bootstrap(). Hi, I downloaded the daily build LibreOfficeDev_25.2.0.0.alpha0_Win_x86-64 and added the dll but I did not find the NativeBootstrap class. Do I need to add new DLLS other than cli_cppuhlper.dll and cli_ure, or do I need to wait for the next official version? This is machine translation, there may be errors
(In reply to liujian from comment #6) > Hi, I downloaded the daily build LibreOfficeDev_25.2.0.0.alpha0_Win_x86-64 > and added the dll but I did not find the NativeBootstrap class. Do I need to > add new DLLS other than cli_cppuhlper.dll and cli_ure, or do I need to wait > for the next official version? This is machine translation, there may be > errors Hello. The dev builds don't seem to contain the nuget package for some reason, will have a look into that. Apart from this, you could either wait for the next official version or build LO from source, depending on your requirements. (A version of LO built with the --with-dotnet option will be needed for the bindings to work) The docs haven't been updated just yet to show the necessary steps to consume the new bindings, but the rough steps are: 1. Build LO locally with the --with-dotnet option, or get a daily or official release with the new bindings 2. Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in <LO path>/sdk/ 3. Create a .NET 8 project, and add these lines to your .csproj file: <PropertyGroup> <RestoreAdditionalProjectSources>[LO path]/sdk/dotnet</RestoreAdditionalProjectSources> </PropertyGroup> <ItemGroup> <PackageReference Include="LibreOffice.Bindings" Version="0.1.0" /> </ItemGroup>
Thanks for your answer, I will try to compile libreoffice
(In reply to Ritobroto Mukherjee from comment #7) > (In reply to liujian from comment #6) > > Hi, I downloaded the daily build LibreOfficeDev_25.2.0.0.alpha0_Win_x86-64 > > and added the dll but I did not find the NativeBootstrap class. Do I need to > > add new DLLS other than cli_cppuhlper.dll and cli_ure, or do I need to wait > > for the next official version? This is machine translation, there may be > > errors > > Hello. The dev builds don't seem to contain the nuget package for some > reason, will have a look into that. Apart from this, you could either wait > for the next official version or build LO from source, depending on your > requirements. (A version of LO built with the --with-dotnet option will be > needed for the bindings to work) > > The docs haven't been updated just yet to show the necessary steps to > consume the new bindings, but the rough steps are: > 1. Build LO locally with the --with-dotnet option, or get a daily or > official release with the new bindings > 2. Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in > <LO path>/sdk/ > 3. Create a .NET 8 project, and add these lines to your .csproj file: > > <PropertyGroup> > <RestoreAdditionalProjectSources>[LO > path]/sdk/dotnet</RestoreAdditionalProjectSources> > </PropertyGroup> > <ItemGroup> > <PackageReference Include="LibreOffice.Bindings" Version="0.1.0" /> > </ItemGroup> Hello friend, I compiled version 25.0.0.2, here is my configuration file, --enable-debug --with-visual-studio=2022 --with-jdk-home=E:\java --with-external-tar=F:/Source/Libre/lo-externalsrc -- with - junit = F/Source/Libre/junit - 4.10. The jar - with - ant - home = F: / Source/Libre/apache ant -- 1.9.5 --enable-pch --disable-ccache --enable-dbgutil --with-strawberry-perl-portable=c:/strawberry --host=x86_64-pc-cygwin --without-doxygen --enable-python=fully-internal --without-lxml --with-dotnet After finishing in F:\Source\Libre\lode\lode\dev\core\instdir\sdk\dotnet, I did not find dotnet directory, only bin and lib directories, what do I do now, this is machine translation, there may be an error
(In reply to liujian from comment #9) > (In reply to Ritobroto Mukherjee from comment #7) > > (In reply to liujian from comment #6) > > > Hi, I downloaded the daily build LibreOfficeDev_25.2.0.0.alpha0_Win_x86-64 > > > and added the dll but I did not find the NativeBootstrap class. Do I need to > > > add new DLLS other than cli_cppuhlper.dll and cli_ure, or do I need to wait > > > for the next official version? This is machine translation, there may be > > > errors > > > > Hello. The dev builds don't seem to contain the nuget package for some > > reason, will have a look into that. Apart from this, you could either wait > > for the next official version or build LO from source, depending on your > > requirements. (A version of LO built with the --with-dotnet option will be > > needed for the bindings to work) > > > > The docs haven't been updated just yet to show the necessary steps to > > consume the new bindings, but the rough steps are: > > 1. Build LO locally with the --with-dotnet option, or get a daily or > > official release with the new bindings > > 2. Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in > > <LO path>/sdk/ > > 3. Create a .NET 8 project, and add these lines to your .csproj file: > > > > <PropertyGroup> > > <RestoreAdditionalProjectSources>[LO > > path]/sdk/dotnet</RestoreAdditionalProjectSources> > > </PropertyGroup> > > <ItemGroup> > > <PackageReference Include="LibreOffice.Bindings" Version="0.1.0" /> > > </ItemGroup> > > > Hello friend, I compiled version 25.0.0.2, here is my configuration file, > > > > --enable-debug > > --with-visual-studio=2022 > > --with-jdk-home=E:\java > > --with-external-tar=F:/Source/Libre/lo-externalsrc > > -- with - junit = F/Source/Libre/junit - 4.10. The jar > > - with - ant - home = F: / Source/Libre/apache ant -- 1.9.5 > > --enable-pch > > --disable-ccache > > --enable-dbgutil > > --with-strawberry-perl-portable=c:/strawberry > > --host=x86_64-pc-cygwin > > --without-doxygen > > --enable-python=fully-internal > > --without-lxml > > --with-dotnet > > > > After finishing in F:\Source\Libre\lode\lode\dev\core\instdir\sdk\dotnet, I > did not find dotnet directory, only bin and lib directories, what do I do > now, this is machine translation, there may be an error Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in LO path>/sdk/ I'm not sure how to write it here
> After finishing in F:\Source\Libre\lode\lode\dev\core\instdir\sdk\dotnet, I > did not find dotnet directory, only bin and lib directories, what do I do > now, this is machine translation, there may be an error Could you go into the core/ directory, then run `make net_ure.clean` and `make net_ure` (without the ``) and share the output you obtain? > Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in LO path>/sdk/ > I'm not sure how to write it here In the sdk/ directory, you should have a batch file named setsdkenv_windows.bat. Running the script in the command line should enable the LO SDK. Explaining how to run examples with it is a little complex over text, but this session by Mr. Hossein covers the basics: https://youtu.be/zWLFv5AR3uY?t=527 However, this won't be useful if the .NET libraries aren't getting installed to the sdk/dotnet directory. Your build output might help in figuring out why.
(In reply to Ritobroto Mukherjee from comment #11) > > After finishing in F:\Source\Libre\lode\lode\dev\core\instdir\sdk\dotnet, I > > did not find dotnet directory, only bin and lib directories, what do I do > > now, this is machine translation, there may be an error > > Could you go into the core/ directory, then run `make net_ure.clean` and > `make net_ure` (without the ``) and share the output you obtain? > > > Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in LO path>/sdk/ > > I'm not sure how to write it here > > In the sdk/ directory, you should have a batch file named > setsdkenv_windows.bat. Running the script in the command line should enable > the LO SDK. Explaining how to run examples with it is a little complex over > text, but this session by Mr. Hossein covers the basics: > https://youtu.be/zWLFv5AR3uY?t=527 > > However, this won't be useful if the .NET libraries aren't getting installed > to the sdk/dotnet directory. Your build output might help in figuring out > why. output: $ make net_ure. clean make: Nothing to be done for 'net_ure.'. rm -fr F:/Source/Libre/lode/lode/dev/core/test-install rm -fr F:/Source/Libre/lode/lode/dev/core/instdir rm -fr F:/Source/Libre/lode/lode/dev/core/workdir $ make net_ure cd F:/Source/Libre/lode/lode/dev/core/net_ure && C:/Users/Administrator/bin/make -j 12 -rs [build MOD] net_ure [build LOC] net_ure [build BIN] top level modules: net_ure [build LOC] top level modules: net_ure [build ALL] top level modules: build-non-l10n-only build-l10n-only
(In reply to liujian from comment #12) > (In reply to Ritobroto Mukherjee from comment #11) > > > After finishing in F:\Source\Libre\lode\lode\dev\core\instdir\sdk\dotnet, I > > > did not find dotnet directory, only bin and lib directories, what do I do > > > now, this is machine translation, there may be an error > > > > Could you go into the core/ directory, then run `make net_ure.clean` and > > `make net_ure` (without the ``) and share the output you obtain? > > > > > Enable the LO SDK with the setsdkenv_windows or setsdkenv_unix script in LO path>/sdk/ > > > I'm not sure how to write it here > > > > In the sdk/ directory, you should have a batch file named > > setsdkenv_windows.bat. Running the script in the command line should enable > > the LO SDK. Explaining how to run examples with it is a little complex over > > text, but this session by Mr. Hossein covers the basics: > > https://youtu.be/zWLFv5AR3uY?t=527 > > > > However, this won't be useful if the .NET libraries aren't getting installed > > to the sdk/dotnet directory. Your build output might help in figuring out > > why. > > output: > $ make net_ure. clean > make: Nothing to be done for 'net_ure.'. > rm -fr F:/Source/Libre/lode/lode/dev/core/test-install > rm -fr F:/Source/Libre/lode/lode/dev/core/instdir > rm -fr F:/Source/Libre/lode/lode/dev/core/workdir > > > $ make net_ure > cd F:/Source/Libre/lode/lode/dev/core/net_ure && > C:/Users/Administrator/bin/make -j 12 -rs > [build MOD] net_ure > [build LOC] net_ure > [build BIN] top level modules: net_ure > [build LOC] top level modules: net_ure > [build ALL] top level modules: build-non-l10n-only build-l10n-only I installed the net8 sdk The previous input configuration file --with-dotnet=C:/Program Files/dotnet/dotnet.exe should look like this. What am I doing wrong?