0

I'm trying to write a C# project that makes use of Bruel & Kjaer 2250 SDK. The SDK installer installs a VisualStudio 2015 Windows Form C# project that I'm able to build. The next step for me was to create a similar project from scratch, so trying to do this and following litterally the BK instructions what happens is that I'm not able to create an instance of of class RemoteAPI in BK.BasicEnv.Application namespace.

I get an exception that tells me these informations:

An unhandled exception of type 'System.NullReferenceException' occurred in BasicEnvRemoteAPI.dll

Additional information: RemoteAPI - Construction: No Instance of EnvOfficeModel.

The constructor call is very simple:

private RemoteAPI api;
...
api = new RemoteAPI();

So the ctor of RemoteAPI is failing because an instance of EnvOfficeModel is missing to it, I've googled a lot and made some tests but the result is always the same for my own project while the B&K example is correctly starting and is able to create an instance of the RemoteAPI class. I also tried to compare the two projects and I'm not able to find a different setting, then I tried to search the B&K installed files and the registry for some hint about the possible causes of this behaviour, but no way ....

If some of you had the same problem and could perhaps drive me to the correct information to solve this problem will be a great thing.

I know that also a REST interface is available to communicate with BK2250 but I would like to use the native communication driver if possile.

Thank you and kind regards.

  • 1
    Please put a question in the title. – Christoph Grimmer Mar 18 '20 at 09:18
  • 1
    Don't you have some support from Brüel & Kjær? The question seems very specific and unlikely to be solved here. – Palle Due Mar 18 '20 at 09:23
  • Can you [edit] your question to include your code that calls the `RemoteAPI` constructor? This seems like another [What is a NullReferenceException and how do I fix it](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – MindSwipe Mar 18 '20 at 09:23
  • @PalleDue Hi, I know and understand your point, I'm not directly in contact with BK as I am an independent software consultant in charge to study a possible solution and for the time being I can't afford B&K paid support, so I tried to ask here, sorry for the noise. – luca paganotti Mar 18 '20 at 09:29
  • @MindSwipe the call is very simple RemoteAPI api = new RemoteAPI() I could add a stack trace but I think it says nothing more that I've just said. – luca paganotti Mar 18 '20 at 09:34
  • Are there any overloads for the constructor? – MindSwipe Mar 18 '20 at 09:37
  • @MindSwipe no RemoteAPI() is the only constructor available – luca paganotti Mar 18 '20 at 09:40
  • 1
    Then the problem is most likely an internal one and there is nothing you can do about it, maybe try contacting B&K – MindSwipe Mar 18 '20 at 09:42
  • @MindSwipe ok, thank you, have a nice day – luca paganotti Mar 18 '20 at 10:13
  • Dear Mr. Paganotti, Pls. be informed that for these applications we provide the SDK and REST interfaces with an example of c #; however, we do not plan to give support on the programming or customization of own programs. Best regards, ------- this was the answer from B&K. – luca paganotti Mar 20 '20 at 15:57

1 Answers1

0

I encountered the issue today,

Verify that you imported the dll in the project correctly (Should appear under References if not it's probably the second issue)

Verify that you are using the .NET Framework and not the .NET Core

I managed to get it working with a Windows Form application using the .NET Framework 4.7.2