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.

Array reading error (VT_R4)

More
10 Dec 2013 07:33 #1599 by support
Replied by support on topic Array reading error (VT_R4)
Hello,

is this error just in the "help" window of Visual Studio (i.e. just a documentation/help issue), or does cause more serious consequences as well?

This looks like some kind of version mismatch. Have you been using other build of Version 5.23 before, or an earlier version (e.g. number 5.22, or less?)

Can you please check your Global Assembly Cache, to see if multiple versions of the same assembly aren't present? (and if so, delete the incorrect ones; or delete them all, and reinstall the product).

Also, please check you solution/project directory (and, in general, the whole computer..._ - if there are copies of the (old) assemblies, clean them all, and rebuild.

I hope this helps.

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

More
07 Dec 2013 22:36 - 08 Dec 2013 17:33 #1597 by Gardoni
Replied by Gardoni on topic Array reading error (VT_R4)
Hello.
After your modification (v5.23) I can read properly VT_R4 arrays from Iconics-generated OPC server. Just one more "strange" issue. After installing v5.23 I have both in VS2010 and VS2012 the attached error (see picture). Even if I have this error, I can compile, I can execute, I can debug and I can read the OPC array, but Visual Studio always have this error (Unknown method ' 'ReadItemValue of '__3c___3e_c_DisplayClass21' '
Please give me your opinion. If you need I can post the zipped VS project
Thanks, Davide
Attachments:
Last edit: 08 Dec 2013 17:33 by Gardoni.

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

More
05 Dec 2013 15:30 #1591 by support
Replied by support on topic Array reading error (VT_R4)
I have analyzed the problem. It is a bit of a mystery. What happens is that (unlike the ICONICS Data Spy), we are in a .NET world, and thus at some point we need to convert the incoming VARIANT into a .NET object.
The underlying method used to do this is Microsoft's Marshal.GetObjectForNativeVariant. And in this method, it throws the SafeArrayTypeMismatchException for the VT_ARRAY | VT_R4 that comes from your server.

Further inspection of the VARIANT shows that it is, in a way, truly invalid: in its parray->fFeatures, it has the FADF_HAVEVARTYPE flag (0x80) set, which indicates that the high word of the parray->cLocks field should contain the VARTYPE - but it contains zero instead. Re-setting the FADF_HAVEVARTYPE resolves the problem, and the value then converts in Marshal.GetObjectForNativeVariant successfully. I have modified our code so that it sanitizes the incoming variants in this way.

So far so good - but the mysterious part is that similarly "broken" variants appear to be very common, AND in most cases, the Marshal.GetObjectForNativeVariant converts them just fine (including your VT_ARRAY | VT_I4). I do not know why it has decided to refuse just certain VARIANTs that come just from your server. Also note that there are parts in between the server and the client, such as the OPC Proxy, that may change the VARIANT - so it may even be OK on your side too.

Anyway, a new, more forgiving build of QuickOPC 5.23 (494.1) is now on the Web site for download.

Best regards

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

More
03 Dec 2013 17:00 #1589 by support
Replied by support on topic Array reading error (VT_R4)
I can confirm that I was able to run your server and connect to it.
I will try to reproduce and troubleshoot the problem later - hopefully by tomorrow.

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

More
02 Dec 2013 11:43 #1582 by Gardoni
Replied by Gardoni on topic Array reading error (VT_R4)
Hello.
OK, send me your email so I can give you access to our FTP server where you can download OPC server files.
Mine is This email address is being protected from spambots. You need JavaScript enabled to view it.

THanks, Davide

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

More
29 Nov 2013 16:45 #1579 by support
Replied by support on topic Array reading error (VT_R4)
Yes, this is possible too. Let me know how I can get hold of the server. I can also give you a FTP location to upload to, if you like (attaching to the forum topic is probably not the right way to go).

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

More
29 Nov 2013 15:34 #1578 by Gardoni
Replied by Gardoni on topic Array reading error (VT_R4)
Hello. It is possible. I have a proposal for you. To have this OPC server on your test PC you, you simply have to copy a folder, register the opcserver with /regserver and tell the configurator which config. file it must use. After, you can check the problem directly on your machine. Is it useful for you?
If not I can collect information needed.
BR
Davide

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

More
29 Nov 2013 15:27 #1577 by support
Replied by support on topic Array reading error (VT_R4)
I understand now. Thanks for explanation. I do not see anything wrong with your code, either.
Can you please post the as much as possible about the exception, then? The call stack, the Source property, etc.

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

More
29 Nov 2013 15:16 #1576 by Gardoni
Replied by Gardoni on topic Array reading error (VT_R4)
Hello. Sorry. I manually add the row with the VT_I4 array reading to underline that the same call for a VT_I4 array has success, the same for VT_R4 array not.
Original code is without first row. Sorry for the inconvenience.
Davide

private void button1_Click(object sender, EventArgs e)
{
EasyDAClient client = new EasyDAClient();
object p = new object();
Stopwatch sw = new Stopwatch();

sw.Start();

// Array of VT_R4, error
p = client.ReadItemValue("", "OPCTestLab.OPCAnalyzer.1", "InjectPC.IdraSystem.Data.ExtraParameters");

MessageBox.Show(sw.ElapsedMilliseconds.ToString());
sw.Reset();
}

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

More
29 Nov 2013 15:02 #1575 by support
Replied by support on topic Array reading error (VT_R4)
The trace file you have sent me cannot be from this code.

It does not contain the first read, for "InjectPC.IdraSystem.Data.ExtraParameters1". It only shows the second read, for "InjectPC.IdraSystem.Data.ExtraParameters".

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

Moderators: support
Time to create page: 0.077 seconds