Error DDL nddsc not found (Visual Studio C#)

14 posts / 0 new
Last post
Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9
Error DDL nddsc not found (Visual Studio C#)

Hi community, 

 

After building and running my project in Visual Studio 2019 I get the following error.

System.DllNotFoundException: 'Cannot load DLL nddsc ...' HRESULT: 0x8007007E

 

 

- I used the RTI Connext package from NuGet (version 6.1.0.3). This installed Rti.ConnextDds and Rti.ConnextDds.Native.

- The project is based on .NET Framework 4.6.1

- With rtiddsgen I created the hello_world.cs and hello_worldPlugin.cs from hello_world.idl from example 2 of the example documenation C#

  https://community.rti.com/static/documentation/connext-dds/6.1.0/doc/manuals/connext_dds_professional/getting_started_guide/csharp/intro_pubsub_csharp.html#

  %NDDSHOME%/bin/rtiddsgen.bat -language c# -ppDisable hello_world.idl

- I added the license key to the global NuGet.config file

<add key="RTI" value="C:\Users\<my user name>\rti_connext_dds-6.1.0\lib\dotnet" />

 

 

The code in the Main:

static void Main(string[] args)
{
  int domainId = 1;.
  DomainParticipant participant = DomainParticipantFactory.Instance.CreateParticipant(domainId);
  Topic<HelloWorld> topic = participant.CreateTopic<HelloWorld>("HelloWorld topic");
  Publisher publisher = participant.CreatePublisher();
  DataWriter<HelloWorld> writer = publisher.CreateDataWriter(topic); 

  while (true) ;  
}  

 

It builds without errors.

 

How can this problem be solved? Thanks in advance!

 

 

AttachmentSize
Image icon temp_2021-10-28_091003_-_kopie.png52.55 KB
Offline
Last seen: 1 month 2 weeks ago
Joined: 04/02/2013
Posts: 196

Hi Paul,

Are you running your application on a 32-bit or a 64-bit Windows machine?

Only 64-bit architectures have built-in support in the NuGet package (see supported platforms). 32-bit Windows can still be used with 6.1.0.3 and later, but you need to install the Connext DDS i86Win32VS2017 target and make the installed libraries available to the C# application, for example by adding <installation dir>/lib/i86Win32VS2017 to the PATH.

Alex

 

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Alex,

 

Thanks for your fast response! And yes, I'm running the application on a 64-bit (x64 based) machine with x64 selected in VS2019.

I added the <installation dir>/lib/x64Win64VS2017 folder to my PATH, but this didn't help either. 

 

Also I tried adding the nddsc.dll library as reference in the project, but this also gives an error:

A reference to ...\nddsc.dll could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.

 

I'm thinking a few things:

 - What components/workloads do I need for VS? I have the .NET Framework 4.6.1 targeting pack and SDK. Also the Workload .NET desktop development and Universal Windows Platform development.

 - I assume it does work on VS2019?

 - Is it a problem that RTI Connext is installed in the user directory (per user)?

 

Thanks in advance!

Offline
Last seen: 1 month 2 weeks ago
Joined: 04/02/2013
Posts: 196

You don't need to install any target to work on 64-bit Windows, so that's not the issue.

Yes, the API works on VS2019 and .NET Framework 4.6.1 (https://community.rti.com/kb/using-net-framework-new-rti-connext-c-api)

Could you try .NET 5 (https://dotnet.microsoft.com/download) and see if that doesn't work for you either?

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Alex,

 

Thanks for your comment. I tried .NET 5 and that works perfectly. 

I installed the NuGet libraries (the license key is in the global NuGet.config). With .NET 5 however, it didn't automatically installed Rti.Connext.Dds.Native where it did with .NET Framework 4.6.1.

 

The problem is that we have another library that needs to work on .NET Framework. Are there some more thing I could try?

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Dear Alex,

 

Today I also tried setting up a project with the link you send earlier. I used the VS2019 A.

The .idl I used is the hello_world.idl from the C# examples

%NDDSHOME%/bin/rtiddsgen.bat -language c# hello_world.idl -example netcoreapp2.1 -ppDisable

 

And then I set the target framework to net47 in the .csproj.

<TargetFramework>net47</TargetFramework>  

 

Just as the previous time, it builds find and starts the console application. Then you can choose for 'pub' and 'sub' (in the Hello World example). 

After typing in 'pub' and 'sub' and hitting 'enter'. The program chrashes with the same error message as before.

System.DllNotFoundException: 'Cannot load DLL nddsc ...' HRESULT: 0x8007007E 

 

As mentioned in the previous post, the .NET 5 works good.

 

Thanks in advance!

Paul

irene's picture
Offline
Last seen: 2 years 11 months ago
Joined: 11/08/2017
Posts: 15

Hi Paul,

Did you add to the PATH the directory where the Connext libraries are? I think you already did. C and C++ Libraries should be located in C:\Users\<my user name>\rti_connext_dds-6.1.0\lib\<arch>\

Did you try to run the applications via CMD instead of directly from VS? 

Also, sometimes it could happen that a library that is needed is missing, so, in this case, you may want to check the dependencies of the nddsc library, Dependency Walker provided with Visual Studio can help you, or using dumpbin.

 

Let me know how it goes!

- Irene 

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Irene,

 

Thanks, I indeed added the C:\Users\<user>\rti_connext_dds-6.1.0\lib\x64Win64VS2017 to my PATH (with <user> replaced by my username). And also the nddsc.dll and nddscore.dll are located there (I didn't changed them).

 

Running the .exe files via CMD gave the same error. See the attached picture.

 

I used 'Dependencies' from Lucasg for checking the dependencies. Thanks for letting me know such programs exist! This gave the error that the 'nddsc module could not be found on disk' and also the nddscore module. Also check the attached picture.

 

Thanks in advance!

Paul

irene's picture
Offline
Last seen: 2 years 11 months ago
Joined: 11/08/2017
Posts: 15

Hi Paul,

To discard possible issues: Could you try two things?

1 - Build and execute your application but in RELEASE mode

2 - Copy the nddsc and nddscore libraries to the folder where you are executing the application and try to run it (I know... this is only to test the behavior :) )

 

Please, use CMD.

 

Let me know how it goes!

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Irene,

 

Building (with VS) and executing with (cmd) doensn't work. However, when the nddsc and nddscore libraries are in the folder it works! Thanks for that suggestion. 

When the libraries are in the folder (debug/net461 or release/net461) building and executing with VS also works.

I earlier tried to add the libraries via VS to the folder, but it gave the error that the libraries are not correct/didn't work.

 

Weird that it workes this way (and not the other), somehow it is not recognising the libraries in the PATH?

irene's picture
Offline
Last seen: 2 years 11 months ago
Joined: 11/08/2017
Posts: 15

Hi Paul,

That's good news! Now we know that, for some reason, the application is not able to load the libraries from the installation path. Actually, it isn't able to find them. 

It doesn't make sense to me that there is a specific issue recognizing the libraries when trying to load them from the location set in the PATH: they are the same ones that you copied to the folder where the executable is.

So, may it be possible that the PATH doesn't really point to the correct location, maybe a typo? or that for some reason the PATH variable is being overwritten? or maybe the application is looking for the libraries to be in a different location...

Can you check the PATH variable in CMD before running the example? So you can check exactly what it contains.

 

Waiting for your reply!

 

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Irene, 

 

It works! I just discovered that the environment variables on my machine only works with admin rights. Thanks for your suggestion about the 'path' command in CMD. 

So the only thing I need to do to get the libraries working is to start Visual Studio/CMD up as administrator. Really glad that it works now!

 

So lessons learned... Thanks for the great help of your side (also Alex)!

 

irene's picture
Offline
Last seen: 2 years 11 months ago
Joined: 11/08/2017
Posts: 15

Hi!

Or you can try just setting the PATH variable with the right value just after opening CMD, before running any application :)

set PATH=%PATH%;C:\Users\<user>\rti_connext_dds-6.1.0\lib\x64Win64VS2017

 

I'm glad I could help,

Irene

 

Offline
Last seen: 2 years 11 months ago
Joined: 10/27/2021
Posts: 9

Hi Irene, 

 

Yes, thanks! But now it's also possible to debug with VS :)

 

Thanks again!