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.

Error when subscribing multiple items

More
16 Nov 2020 14:23 #9151 by janderscu
Version info below:

1. OpcLabs.EasyOPCClassic.dll - 5.55.422.1 (part of QuickOPC 2019.1)

2. Win Ver - Windows 10 Pro - Build 19041.508

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

More
16 Nov 2020 08:17 #9148 by support
Hello,

please provide:

1. Version of QuickOPC your are using, including the build number (best way to find: locale one of the OpcLabs.*.dll assemblies in Windows Explorer, right-click on it, select Properties, and find the version on the Details tab).

2. Version of Windows - from the WINVER command.

Thank you

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

More
16 Nov 2020 00:36 #9147 by janderscu
I have written a custom OPC classic client in .Net C#. When subscribing multiple items, I get the following error below. I can use other third-party OPC explorer apps to successfully view the servers available and read items. I put try/catch blocks in my own code to attempt to catch it and display additional errors, but nothing is caught in the main code. I think is getting returned straight from the Quick OPC API. FYI, I have run this code on other machines and successfully subscribed to data there, so I do believe it is something unique to this machine. However, any information that can be inferred from that error message that could help me narrow down the problem would be greatly appreciated.


Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at QueryMultipleInterfaces(IUnknown* pUnknown, UInt32 cMQIs, tagMULTI_QI* pMQIs)
at VaryingQueryMultipleInterfaces(IUnknown* pUnknown, UInt32 cMQIs, UInt32 cComSupports, CComSupport** pComSupports, tagMULTI_QI* pMQIs, CComSupport** pComSupportChosen)
at COCKMachine.ConnectServerList(COCKMachine* )
at COCKMachine.ExecuteConnect(COCKMachine* )
at CMachine.Connect(CMachine* )
at CConsumer.RequestMachine(CConsumer* , CMachineClient* pMachineClient, CMachine** pMachine, Boolean AutoDisconnect)
at CClient.ConnectMyMachine(CClient* )
at CClient.ExecuteConnect(CClient* )
at COCKClientBase.ExecuteConnect(COCKClientBase* )
at CAbstractClient.HandleConnectRequest(CAbstractClient* )
at COCKClient.ReceiveAndProcessRequests(COCKClient* )
at COCKClient.ExecuteWork(COCKClient* )
at CAbstractClientWorkerThread.execute(CAbstractClientWorkerThread* )
at CBasicWorkerThread.perform(CBasicWorkerThread* )
at CBasicWorkerThread.process(CBasicWorkerThread* )
at CBasicWorkerThread.threadProc(Void* lpParameter)


THis is my code for adding event handler and subscribing:
static void GetData_DA()
        {
            // Dictionary<System.Guid, OpcLabs.EasyOpc.ServerElement> d = new Dictionary<System.Guid, OpcLabs.EasyOpc.ServerElement>();
            EasyDAItemChangedEventHandler eventHandler = new EasyDAItemChangedEventHandler(client_ItemChanged_DA);
            try
            {
                for (int j = 0; j < addressArray.Count; j++)
                {
                    clients_DA[j].ItemChanged += eventHandler;
                }
 
                Console.WriteLine("Subscribing item...");
                int k = 0;
                for (int j = 0; j < addressArray.Count; j++)
                {
                    var argumentArray = new DAItemGroupArguments[(Int16)chanCountArray[j]];
                    string address = (string)addressArray[j];
                    string hostname = address.Split(",".ToCharArray())[0];
                    string servername = address.Split(",".ToCharArray())[1];
 
                    for (int i = 0; i < (Int16)chanCountArray[j]; i++)
                    {
                        int requestedUpdateRate = Convert.ToInt32(scanRateCopy * 1000);
 
                        //Console.WriteLine(labelListCopy.GetValue(k).ToString());
 
                        argumentArray[i] = new DAItemGroupArguments(hostname.Trim(), servername.Trim(), labelListCopy.GetValue(k).ToString(), requestedUpdateRate, k);
                        k++;
                    }
                    Console.WriteLine("HERE1");
                    int[] error = clients_DA[j].SubscribeMultipleItems(argumentArray);
                    Console.WriteLine("HERE2 " + error[0].ToString());
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("GetData_DA error : " + ex.ToString());
            }
        }
 
        static void client_ItemChanged_DA(object sender, EasyDAItemChangedEventArgs e)
        {
            if (e.Succeeded)
                Console.WriteLine("{0}: {1}", e.Arguments.ItemDescriptor.ItemId, e.Vtq);
            else
            { 
                Console.WriteLine("{0} *** Failure: {1}",
                e.Arguments.ItemDescriptor.ItemId, e.ErrorMessageBrief);
            }
 
        }

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

Moderators: support
Time to create page: 0.054 seconds