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.

OPC-UA Endpoint DomainMismatch, and ObjectDisposedException

More
20 Jul 2016 07:44 #4242 by support
This issue is fixed in QuickOPC 5.40.302.1. This build is now on our public Web site for download, and in NuGet gallery.

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

More
13 Jul 2016 07:22 #4227 by Erik
Hello,

Thank you for your answer, your example proved very usefull!

I made the suggested changes and it worked right away. Then switched to the new methods and it still works. So, Thank you!

Kind regards,

Erik

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

More
13 Jul 2016 06:44 - 13 Jul 2016 06:44 #4226 by support
Please verify that the SubscribeMonitoredItem overload you are calling is the right one. E.g. by hovering over the methods call in the editor, and checking the type and meaning of the arguments.

There have been changes in version 5.40 which actually make the callback delegate you are using obsolete. Please read the What's New document. I recommend 1) using the EasyUADataChangeNotificationEventArgs instead of EasyUAMonitoredItemChangedEventArgs in the callback, and 2) because of the number of overloads of SubscribeMonitoredItem, qualify each argument with its name: such as:
handle = uaClient.SubscribeMonitoredItem(
    endpointDescriptor: serverUri, 
    nodeDescriptor: string.Format(NodeDescriptorFormat, nodeId), 
    samplingInterval: interval, 
    dataChangeCallback: callback);

Best regards
Last edit: 13 Jul 2016 06:44 by support.
The following user(s) said Thank You: Erik

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

More
13 Jul 2016 06:17 - 13 Jul 2016 06:17 #4225 by Erik
Hello

I removed the following call from our program:
UAClient.SetOpcCompliance();

That indeed prevents the crash issue. However, I still don't get any callbacks on my subscriptions. We subscribe with:
handle = uaClient.SubscribeMonitoredItem(serverUri, string.Format(NodeDescriptorFormat, nodeId), interval, callback);

An example callback:
private void OpcRgbColor_MonitoredItemChanged(object sender, OpcLabs.EasyOpc.UA.OperationModel.EasyUAMonitoredItemChangedEventArgs e)
{
    if (e.Exception == null)
    {
        LineUserControl.InkTrainColor = convertToColorFromArgb(e);
    }
    else
    {
        Logger.Error(string.Format("{0}[{1}].diRgbColor : {2}", MachineConfiguration.Module.Name, MachineConfiguration.ModuleNumber, e.Exception.GetBaseException().Message));
    }
}
It appears to subscribe succesfully (atleast, "handle" gets a value), but our callback function is never called.

Our HMI log:

File Attachment:

File Name: HMI_2016-07-13.txt
File Size:19 KB


OPC Trace log:

File Attachment:

File Name: HMI-OPCTra...7-13.txt
File Size:484 KB


Best regards,

Erik
Attachments:
Last edit: 13 Jul 2016 06:17 by Erik.

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

More
12 Jul 2016 13:24 - 12 Jul 2016 13:27 #4224 by support
Thank you.

Do not use
    EasyUAClient.AdaptableParameters = EasyUAAdaptableParameters.OpcCompliance;

unless absolutely necessary. Just stay with the defaults, and if there is a specific need to tweak something, change just one specific parameter. The EasyUAAdaptableParameters.OpcCompliance changes too many things at once, mainly to worse.

I have preliminary result about the ObjectDisposedException. It is a bug on our side which appears when following parameters is set:
EasyUAClient.AdaptableParameters.SessionParameters.CheckEndpointDomain = true;

(and which, in turn, is part of the EasyUAAdaptableParameters.OpcCompliance parameter set).

We will try to have a fix for you during the next week. By that time, removing the usage of EasyUAAdaptableParameters.OpcCompliance, or setting the parameter afterwards as below, is a workaround.
EasyUAClient.AdaptableParameters.SessionParameters.CheckEndpointDomain = false;

Best regards
Last edit: 12 Jul 2016 13:27 by support.

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

More
12 Jul 2016 13:11 #4223 by Erik
Hello

We use the following code:
namespace DGpS.OPC
{
    public class UAClient : IDisposable
    {
	private EasyUAClient uaClient;
 
        public UAClient()
        {
            uaClient = new EasyUAClient();
        }
 
        public static void SetOpcCompliance()
        {
            EasyUAClient.AdaptableParameters = EasyUAAdaptableParameters.OpcCompliance;
        }
 
        public CheckData checkCommunication(string serverUri, string nodeDescriptorFormatstring, string nodeMainDescriptor, string nodeId)
        {
            CheckData result = new CheckData(serverUri, nodeDescriptorFormatstring, nodeMainDescriptor, nodeId);
            result.Messsage = string.Empty;
            result.Quality = false;
 
            try
            {
                string setUANodeDescriptor = string.Format("{0};{1}.{2}", nodeDescriptorFormatstring, nodeMainDescriptor, nodeId);
                result.value = uaClient.ReadValue(new UAEndpointDescriptor(serverUri), new UANodeDescriptor(setUANodeDescriptor));
                result.Quality = true;
            }
            catch (UAException e)
            {
                result.Messsage = (e.GetBaseException().Message.ToString());
            }
 
            return result;
        }
 
	//Read, write and subscribe methods
    }
}
 
    public class CheckData
    {
        public CheckData(string serverUri, string nodeDescriptorFormat, string nodeMainDescription, string nodeId)
        {
            ServerUri = serverUri;
            NodeDescriptorFormat = nodeDescriptorFormat;
            NodeMainDescription = nodeMainDescription;
            NodeId = nodeId;
        }
 
        public string ServerUri { get; private set; }
        public string NodeDescriptorFormat { get; private set; }
        public string NodeMainDescription { get; private set; }
        public string NodeId { get; private set; }
        public bool Quality { get; set; }
        public string Messsage { get; set; }
        public object value { get; set; }
    }

Our OPC logging:
namespace DGpS.OPC
{
    public static class OPCLogging
    {
        public static void Activate()
        {
            EasyUAClient.LogEntry += EasyUAClient_LogEntry;
        }
 
        private static void EasyUAClient_LogEntry(object sender, OpcLabs.BaseLib.Diagnostics.LogEntryEventArgs e)
        {
            //OPC version 5.40
            switch (e.EntryType)
            {
                case OpcLabs.BaseLib.Diagnostics.LogEntryType.Error:
                    Logging.Logger.Error(string.Format("EasyUAClient: {1}, {0}", e.Message, e.Source));
                    break;
                case OpcLabs.BaseLib.Diagnostics.LogEntryType.Warning:
                    Logging.Logger.Warning(string.Format("EasyUAClient: {1}, {0}", e.Message, e.Source));
                    break;
                case OpcLabs.BaseLib.Diagnostics.LogEntryType.Information:
                    Logging.Logger.Info(string.Format("EasyUAClient: {1}, {0}", e.Message, e.Source));
                    break;
                default:
                    Logging.Logger.Debug(string.Format("EasyUAClient: {1}, {0} Type: {2} Category:{3}", e.Message, e.Source, e.EntryType, e.Category));
                    break;
            }
        }
    }
}

Then we call our code in the following order:
OPCLogging.Activate();
UAClient.SetOpcCompliance();
UAClient _uaClient = new DGpS.OPC.UAClient();
 
//Check if we have a connection
While(CheckingConnection)
{
    DGpS.OPC.CheckData refObect = _uaClient.checkCommunication(mc.PLC.UAAddress, nodeDescriptorFormat, mc.PLC.NodeDescriptor, nodeID);
    //Process result
}
if(OPC_Connection)
{
    //Start HMI
    //Create new UAClient(s)
    //Create Subscriptions
}

If you need anny more information, dont hesitate to ask!

Best regards

Erik

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

More
12 Jul 2016 12:29 #4222 by support
Have you changed the static or instance parameters of EasyUAClient since your last tests?
Can you post a code showing how you initialize these?

In the default state, these parts of code should not even be called, unless you specifically enable them.

Nevertheless, the ObjectDisposedException should not be happening, and I have forwarded it to the programmer for investigation.

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

More
12 Jul 2016 07:52 - 12 Jul 2016 08:09 #4221 by Erik
Hello

I finally had time to look into this update and I run into the following issue:



With the following stacktrace
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'AllowEndpointDomainControl'.
   at System.Windows.Forms.Control.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.ControlCollection.Add(Control value)
   at OpcLabs.BaseLib.Forms.ParallelNotifierForm.SetCustomControl(Control customControl)
   at OpcLabs.BaseLib.Forms.ParallelNotifierForm.ShowSelectedNotification()
   at OpcLabs.BaseLib.Forms.ParallelNotifierForm.SelectedNotificationChanged()
   at OpcLabs.BaseLib.Forms.ParallelNotifierForm.notificationListView_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ListView.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ListView.WmReflectNotify(Message& m)
   at System.Windows.Forms.ListView.WndProc(Message& m)
   at OpcLabs.BaseLib.Forms.ListViewNoFlicker.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I have no idea where this is comming from. We have no such object and I never saw annything related to it.

After clicking continue I get a notification window with the following warning:



Waiting 30 seconds I then get:



Clicking yes results in our HMI starting, however, not OPC communication seems to take place. Rr atleast, not a single callback appears to be working (most of our communication is trough callbacks).

Our HMI log appears to show nothing unusual:

File Attachment:

File Name: HMI_2016-07-12.txt
File Size:33 KB


And a OPCTrace:

File Attachment:

File Name: HMI-OPCTrace.7z
File Size:39 KB


Is there anny other information I could get you to help fix this problem?

Best regards

Erik
Last edit: 12 Jul 2016 08:09 by Erik.

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

Moderators: support
Time to create page: 0.101 seconds