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.

Cannot pass a GCHandle across AppDomains.

More
26 Aug 2010 08:33 #50 by support
Hello.

Can you provide more details? These are the main questions I have at the moment:
Can you tell which statement is throwing the exception? Is it at the SubscribeItem? Or is it somewhere in the event handler?
Do you get any more information with the exception? A call stack maybe?
Can you post more of your code/ Specifically, the event handler code, and indicate how/when in your code the initialization part you already posted is called. If you can post the whole, or maybe stripped-down version of it, that would be great. We have not done any specific tests with WCF.

Are you explicitly creating more AppDomains? Does the error appear maybe just when the code is run under the Visual Studio Test harness (which initializes AppDomains differently?)
QuickOPC is thread safe, but there are specific concerns in relation to event handlers and thus the thread safety of your own code (the documentation has a chapter about it; basically the events can be fired on an arbitrary thread, unless a proper synchronization provider is passed to QuickOPC).
In general, AppDomains are more akin to processes (or processes inside processes), not to threads. It is true that QuickOPC.NET objects (same as other .NET objects) cannot be freely passed between AppDomains. The question is, whether it's something in your code that does this, or whether it has to do with WCF or the QuickOPC itself.

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

  • Peter Siegel
  • Topic Author
  • Visitor
  • Visitor
25 Aug 2010 14:07 #47 by Peter Siegel
Cannot pass a GCHandle across AppDomains. was created by Peter Siegel
Hi!
Sometimes i get the following exception when using the OPC Client from my WCF Service.
Cannot pass a GCHandle across AppDomains.
Parameter name: handle
I can't see where the exception occurs because it says there is no source available.
QuickOPC.net 5.0 is used with .net Framework 4.
Source:
easyDAClient = new EasyDAClient();
easyDAClient.ClientMode.AllowAsynchronousMethod = false;
easyDAClient.ClientMode.AllowSynchronousMethod = true;
easyDAClient.ClientMode.DesiredMethod = DAReadWriteMethod.Synchronous;
easyDAClient.ClientMode.DataSource = DADataSource.ByValueAge;
easyDAClient.ClientMode.DesiredValueAge = 100;
easyDAClient.SubscribeItem("", OPCServerID, datapoint.Name,1,datapoint);
Any Ideas? Is the OPC Client Theadsafe?

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

Moderators: support
Time to create page: 0.039 seconds