System.TypeInitializationException: The type initializer for 'OpcLabs.EasyOpc.DataAccess.EasyDAClient' threw an exception

1

I had used OPC Web client 3.02 in my applications. Generally, I had started 5 to 6 applications on system startup. Everything works fine without any problem.

Now I am upgrading my applications to Quick OPC Classic 5.12.1308.1

If I start all the 6 applications on system startup (that is all the 6 applications starts at the same time), I get the following error.

Exception Text:

System.TypeInitializationException: The type initializer for 'OpcLabs.EasyOpc.DataAccess.EasyDAClient' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Documents and Settings[user]\Local Settings\Temp\x86_OpcLabs.EasyOpcClassicRaw_5.12.1396.1.dll' or one of its dependencies. The process cannot access the file because it is being used by another process.

(Exception from HRESULT: 0x80070020) File name: 'file:///C:\Documents and Settings[user]\Local Settings\Temp\x86_OpcLabs.EasyOpcClassicRaw_5.12.1396.1.dll' at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, StackCrawlMark& stackMark)

at System.Reflection.Assembly.LoadFrom(String assemblyFile)

at OpcLabs.BaseLib.AssemblyExtension.LoadFrom(String assemblyFile, String requestingPath)

at OpcLabs.BaseLib.AssemblyLoader.LoadFromManifestResourceThroughFile(Assembly manifestAssembly, String resourceName, String fileName, Assembly requestingAssembly)

at OpcLabs.BaseLib.AssemblyLoader.LoadFromManifestResource(Assembly manifestAssembly, AssemblyName assemblyName, Assembly requestingAssembly)

at OpcLabs.BaseLib.AssemblyLoader.InternalLoad(AssemblyName assemblyName, Assembly requestingAssembly)

at OpcLabs.BaseLib.AssemblyLoader.LoadExtended(AssemblyName assemblyName, Assembly requestingAssembly)

at OpcLabs.EasyOpc.Assemblies.get_EasyOpcClassicNetRaw()

at OpcLabs.EasyOpc.DataAccess.EasyDAClient..cctor()

I had tested this issue with the latest versions "Quick OPC Classic 5.12.1396.1" and "Quick OPC Classic 5.20.1016.1". Still I get the same error.

NOTE: If I run the applications individually, it works well. I get this error when I run two or more applications at the same time. Also this error was not occurred all the time.

Steps to reproduce:

  1. Create VB.NET application and add reference EasyOPC.NET Library.
  2. At the code behind of the form, copy and paste the following code.

    Imports OpcLabs.EasyOpc.DataAccess

    Public Class OPCTest1 Public m_objOPCServer As EasyDAClient

    Private Sub OPCTest1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        m_objOPCServer = New EasyDAClient
    End Sub
    

    End Class

  1. In the same way create another VB.NET application 'OPCTest2' and follow the same procedure.

4.Copy the shortcut of OPCTest1 and OPCTest2 applications under the Starup folder on windows server 2008 R2 / Windows 7 / XP.

  1. Restart your machine.

Note : The error raises at the line 'm_objOPCServer = New EasyDAClient'.

vb.net
.net-assembly
plc
opc
asked on Stack Overflow May 21, 2014 by Veera • edited May 22, 2014 by Veera

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0