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.

Type Initializer for EasyDAClient threw an exception with ASP.NET Custom Control

More
01 Aug 2020 14:07 #8687 by support
Thank you for more information. I assumed that the assemblies that VS loads will be under a singe directory, from which the App_Web* assemblies would be missing. But apparently VS creates a temp directory for each of the assemblies, so this envisioned way of resolving things would not work.

Yes, the App_Web* assembly is missing from the modules list, because it could not be found&loaded, that is "expected", given what we already know.

Best regards

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

More
30 Jul 2020 19:07 #8686 by Holbach
I've removed the dlls from GAC and did a fresh install (all in a testing environment so minimal production risk) and confirmed I was seeing the issue again.

The path seems straight forward enough with the exception of the directory following ProjectAssemblies

It looks like the dlls are pulled from:
C:\Users\mholbach\AppData\Local\Microsoft\VisualStudio\16.0_8dfc7599\ProjectAssemblies\9n9yucjj01\opclabs.baselib.dll
C:\Users\mholbach\AppData\Local\Microsoft\VisualStudio\16.0_8dfc7599\ProjectAssemblies\lmrqmnap01\opclabs.baselibforms.dll
C:\Users\mholbach\AppData\Local\Microsoft\VisualStudio\16.0_8dfc7599\ProjectAssemblies\cov4fzf-01\opclabs.easyopcclassic.dll
C:\Users\mholbach\AppData\Local\Microsoft\VisualStudio\16.0_8dfc7599\ProjectAssemblies\rkp1tinj01\opclabs.easyopcforms.dll

App_Web_.... .dll is in-fact missing from the modules list.

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

More
30 Jul 2020 17:52 #8685 by support
I am glad it works. Some notes:

1. It looks like that the module paths you have collected are *after* the assemblies were installed in the GAC. That's not really telling much in case we need to resolve it without the GAC in the future - it would have been more interesting to know where those assemblies that got loaded were loaded from when they were *not* in the GAC. And, for the GAC, the different paths you have listed are actually OK - that's how the GAC is structured. But no problem here, I just wanted to clarify.

2. Be aware that after the assemblies are put into the GAC, some things e.g. in Visual Studio will behave differently (and that's why it is not enabled by default in the QuickOPC installer). For example, Visual Studio will not copy the assemblies that are in the GAC to the output folder; which is OK, they are not needed there, because any target project will also find them in the GAC and does not have to have them in the output folder. BUT this assumption no longer holds when the user takes the output folder, thinking that that all necessary files are there, and copies it to a different computer where the assemblies might *not* be in the GAC. So some care need to be taken about "completeness" of the output folder - the customer should know about it.

Best regards

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

More
30 Jul 2020 16:56 #8684 by Holbach
Fantastic your recommendations were 100% spot on.

Attaching the second instance of Visual Studio showed the inner exception to be a FileNotFoundException - specifically for the App_web_OpcLabs.EasyOpcClassicRaw.x86 dll (as you said it might).

I reran the 2020.2 installer and installed the assemblies into GAC after which the issue was resolved. Looking at where the modules are loaded from, it appears the "App_Web_OpcLabs...." dll is being pulled from "C:\WINDOWS\Microsoft.Net\assembly\GAC_32\App_Web_OpcLabs.EasyOpcClassicRaw.x86\........" where the 'non-mixed-mode-assembly' dlls are loaded from "C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\OpcLabs.EasyOpcClassic\........"

So in this case moving the mixed mode assembly dlls over manually would likely not have worked since they were loaded from a different path.

Thank you very much for the help!

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

More
30 Jul 2020 14:14 #8682 by support
Hello,
well, this is quite an advanced scenario, and one that we have never tried.

Is this problem encountered right on the developer's computer, or is he deploying the ASP.NET control to a separate machine where it is then used in VS ?

Getting details of the exception (call stack, inner exceptions, ...) is usually possible by starting a second instance of Visual Studio and attaching it to the already running VS instance.

It is likely that one of the mixed-mode assemblies (those written in Visual C++) could not be located or loaded. In design mode, Visual Studio loads the assemblies from "who knows where" - I could never understand how precisely that works. So, it is possible (I have seen similar situations) that only the normal (C#) QuickOPC assemblies get copied to the temp location which VS then uses, and not the mixed-mode assemblies (App_Web*.dll). Inspecting the Modules windows while debugging the Visual Studio itself (using the 2nd instance as described above) should give the location where the "normal" assemblies are being loaded from - and then, one shoudl check whether the App_Web*.dll assemblies are also present at the same location.

Does, on the same machine, the same dialog work when *not* in VS design mode? If it does, the problem cannot be in Visual C++ runtime libraries, as they are machine-wide.

Can you (or the customer) try to install QuickOPC and select the "Custom" install, and then, when asked, select to install the QuickOPC assemblies into GAC? It might help. But, be prepared that if it does not help, you will then need to remove them from the GAC to prevent other issues - and that needs to be done either some Microsoft command-line tools, or by uninstalling the whole QuickOPC and then installing it without that choice again.

Best regards

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

More
29 Jul 2020 13:23 #8677 by Holbach
I am currently working with a customer who has written a custom ASP.NET control which makes use of the EasyDAClient object.

The problem comes up when in design mode and using the property editor for the control. The code for the editor calls and displays an OpcServerDialog to allow server browsing, and for binding the control to a specific server.

When ShowDialog is called the following error is thrown:

"The type initializer for 'OpcLabs.EasyOpc.DataAccess.EasyDAClient' threw an exception"

Since the error is thrown in design mode and not debug/runtime I am not able to find any detailed exception details unfortunately.

I've seen a few other posts on the forum regarding the Visual C++ Libraries which I have downloaded and installed, and confirmed the correct versions are present.

I have a sample app that I am happy to share if there is an email I can send it to.

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

Moderators: support
Time to create page: 0.054 seconds