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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- Array reading error (VT_R4)
Array reading error (VT_R4)
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.
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
Please Log in or Create an account to join the conversation.
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.
I will try to reproduce and troubleshoot the problem later - hopefully by tomorrow.
Please Log in or Create an account to join the conversation.
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.
Please Log in or Create an account to join the conversation.
If not I can collect information needed.
BR
Davide
Please Log in or Create an account to join the conversation.
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.
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.
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.
- Forum
- Discussions
- QuickOPC-Classic in .NET
- Reading, Writing, Subscriptions, Property Access
- Array reading error (VT_R4)