Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

Could not load file or assembly error

More
24 Mar 2023 01:05 #11635 by support
Hello,

yes, this could be the reason. But it is just one of many, it can be anything else too. You can spend your whole life shooting in the dark and trying to guess the reason. For faster results, put in the proper error handling and obtain the error info.

Best regards

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 23:20 #11634 by samirhaj
Ok, thanks.

Quick question: Since the code is identical and the OpcUa communication works on a stand-alone windows server machine (which all firewalls are turned off since it is not connected to the Internet) but it doesn't work on my company laptop (that all firewalls are enabled), could it be that OpcUa communication is blocked because of some Windows firewall? Is this something you have encountered in your easyOpc client that is used by different users?

Best regards.

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 20:25 #11633 by support
Hello,

thanks for the explanation of what you did, it all makes sense. However, there can be literally thousands of possible causes for an issue like "the write was not performed". But, all of them should be accompanied by an error from the methods that does the Write. So, And the error information is the crucial part. So, it is critical that there is a proper error handling for that Write method, and also that it exposes the error info when an error happens.

How precisely the proper error handling looks like depends on the actual method. For example, EasyUAClient.WriteValue throws an exception, but EasyUAClient.WriteMultipleValue does not throw, it returns an array of objects where the errors can be found.

Regards

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 20:14 #11632 by samirhaj
Hi,
Ok, I see.

One strange behavior that is happening is that when I made an installer of the same program and installed it on another machine, it writes to the Opc server fine. The same OpcUa server installed on that machine that I have on my laptop. When I connect the program in debug mode (running on VS) to the Opc server on my laptop, it does not write to Opc server.
But for the sake of making sure it is not the problem with the Opc server, I connected the running program in debug mode on my laptop to the Opc server on that other machine (the machine that I have an installed version of my program) and noticed that it does not write to that Opc server also.

So concluded that this is something wrong with my running program in VS on my laptop. Then I changed my program running in "Debug" mode in VS to "Release" mode (which will be like an installed program similar to the one running on the other machine) and connected that to the local OpcUa server and see that it still doesn't write to Opc server. So the program running from VS in both "Debug" and "Release" mode does not write to my local Opc server as well as the other machine Opc server.

Before we get into the code (which does not seem like to be the issue), does the above explanation rings any bell in your mind about what the root cause can be?

Best regards.

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 17:24 #11631 by support
There is no crash.

You have told the debugger to show you that an exception has been thrown internally, so that's what it does. It *breaks* into the debugger. That is no crash. Turn the option off if you do not want that behavior. It is a behavior of the VS debugger, not of the program itself.

If the program is not doing what it should when the option is off, the reason for the misbehavior will most likely be different. If "it does not write anything to OpcUa server.", are yo properly observing and handling exceptions from the Write call? Post here the relevant piece of code.

Regards

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 17:03 #11629 by samirhaj
Hi,

Yes, I am running in debug mode. When I enable "Common Language Runtime Exceptions" in Visual Studio, the program crashes with an exception as mentioned. But if the Runtime exception is not enabled, it does not crash but I can see that the OpcUa client does not work as it does not write anything to OpcUa server.

When I enabled runtime exception and saw that the client is null, I understood why it does not write to the server.

I tried to run the application in "Release" mode in VS with Runtime Exception enabled as well and still the same exception is thrown. (Crashing the program).

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 16:41 #11627 by support
Hello.

Are you running the program in the debugger, and just observing the exception being thrown?
Or, does it actually crash your program (exception not caught)?

Here is the expected behavior:

- The exception can be thrown
- It is caught internally and the program does not actually crash.

Regards

Please Log in or Create an account to join the conversation.

More
23 Mar 2023 16:06 #11626 by samirhaj
Hi,

I have upgraded to VS 2022 lately. I am running a .Net core Console App. The program is using QuickOpc 5.54. for OpcUa client inside. This was working fin in the VS 2019 version but in the VS 2022, my code crashes (throws an exception) with "Could not load file or assembly 'OpcLabs.EasyOpcForms, Version=5.54.1151.1, Culture=neutral, PublicKeyToken=6faddca41dacb409'. The system cannot find the file specified."

Do you have any suggestion how I can get rid of this exception?

Best regards.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.055 seconds