06-12-2017 05:10 PM
Hello,
I am trying to use LabVIEW 2015 to interface with a Instron Tensile Tester 5969 via the Bluehill 3 API. Based on what I understand from the Bluehill API help, I am using LabVIEW's .NET functions. What I am aiming to do is have LabView start taking data with an extensometer when the Bluehill test begins so that the data is synchronized. I think I have the constructor node organized properly, but I generate a .NET exception, which I understand is not a labVIEW issue, but rather an external issue. I was hoping that someone with more experience with LabVIEW's .NET could look at the code and see if I am just missing something obvious which would result in the .NET exception.
The .NET Exception: Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.Exception: Bluehill is not currently running or you are not connected <append><b>System.Exception</b> in Main Vi.vi
I don't understand why I am getting this error, since I have the Bluehill software running.
06-13-2017 05:44 PM
Hello, at first glance over your code, it looks like it should be good. I don't have the API so I was not able to run the code and reproduce your error. Based on the exception, it looks like Bluehill may not be running or connected. Do you have a method of double checking this?
Andrew M.
06-14-2017 08:38 AM
Hello, unfortunately, I do not have a method to check that bluehill is running, at least, not that I know of. My guess is that somewhere along the line labVIEW doesn't actually connect to the API, since I can be running a test with bluehill, but labVIEW still has the error. But again, I don't know how to check this.
Thanks
Luke J
06-14-2017 09:19 AM
Hi there, have you been able to look at any LabVIEW examples with Bluehill and compare them to your code? I am able to see an example for Bluehill 2 API and connecting to LabVIEW. Additionally, it appears as though if you go to Start>All Programs>Instron>Help>Bluehill Help and click on API help, there may be examples for LabVIEW. I can't see the Bluehill 3 API examples myself, but there may be a LabVIEW example in there. If not, you could try comparing to a Bluehill 2 API LabVIEW example and see if you can find anything.
The link to a Bluehill 2 API LabVIEW example is here: http://dl.dropbox.com/u/16819834/BH_LabView.zip
The link describing this in general is here: http://bluehillusercommunity.blogspot.com/2010/05/api-where-are-some-examples.html
Thanks,
Andrew M
06-14-2017 11:01 AM
Hello
I have looked at the link, but I haven't been able to translate any information over that helps in my situation. Also, based on the VI in that link, Bluehill 2 uses ActiveX, where Bluehill 3 uses .NET, in my understanding. I have tried building some code for Bluehill 3 with ActiveX, but that hasn't got me anywhere.
Also, let me add the Bluehill 3 API help. I am basing a lot of this on this document, so I figure it might be helpful.
Thanks
Luke J
06-14-2017 11:27 AM
I also ran a System Debugger (as noted in another .NET post on the forums) https://technet.microsoft.com/en-us/sysinternals/debugview.aspx
And this is the error log I received:
00000001 0.00000000 [8340] Created new AppDomain: Project1.lvproj for Reflection
00000002 5.48525429 [8340] Created new AppDomain: Project1.lvproj for Run
00000003 5.65337753 [8340] System.NullReferenceException: Object reference not set to an instance of an object.
00000004 5.65337753 [8340] at NationalInstruments.LabVIEW.CrossDomainServer.DNSetAssemblyResolvePaths(LVAssembly** lvAssemblyArray, UInt32 size)
00000005 5.72247314 [8340] DNError: (1172). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
00000006 5.72247314 [8340] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
00000007 5.72247314 [8340] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
00000008 5.72247314 [8340] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
00000009 5.72247314 [8340] at NationalInstruments.LabVIEW.DNRuntime.InvokeMethod(Int32 invokeType, Type type, Object target, String methodName, Type[] parameterTypes, Int32[] parameterFlags, Object[] parameterIds, IntPtr tdArr)
00000010 5.72247314 [8340] Inner Exception: System.Exception: Bluehill is not currently running or you are not connected
00000011 5.72247314 [8340] at Microsoft.VisualBasic.ErrObject.Raise(Int32 Number, Object Source, Object Description, Object HelpFile, Object HelpContext)
00000012 5.72247314 [8340] at Instron.Bluehill.API.APIHelper.RaiseException(Int32 lErrorNumber, String strErrorSource)
00000013 5.72247314 [8340] at Instron.Bluehill.API.Sample.startTest()
00000014 5.72247314 [8340]
00000015 5.72461033 [8340] DNError: Error calling method Instron.Bluehill.API.IAPIClient.SetAPIReference (1172). System.ArgumentNullException: Key cannot be null.
00000016 5.72461033 [8340] Parameter name: key
00000017 5.72461033 [8340] at System.Collections.Hashtable.get_Item(Object key)
00000018 5.72461033 [8340] at NationalInstruments.LabVIEW.SyncInvokeTable.LookupControl(Object key)
00000019 5.72461033 [8340] at NationalInstruments.LabVIEW.DNRuntime.InvokeMethod(Int32 invokeType, Type type, Object target, String methodName, Type[] parameterTypes, Int32[] parameterFlags, Object[] parameterIds, IntPtr tdArr)
00000020 5.72461033 [8340]
00000021 5.72492552 [8340] DNError: Error accessing property Instron.Bluehill.API.Security.UserName (1172). System.ArgumentNullException: Key cannot be null.
00000022 5.72492552 [8340] Parameter name: key
00000023 5.72492552 [8340] at System.Collections.Hashtable.get_Item(Object key)
00000024 5.72492552 [8340] at NationalInstruments.LabVIEW.SyncInvokeTable.LookupControl(Object key)
00000025 5.72492552 [8340] at NationalInstruments.LabVIEW.DNRuntime.InvokeProperty(Int32 invokeType, Type type, Object objectId, String propertyName, Type propertyType, Boolean getProperty, Object& pParameter, IntPtr tdParam)
00000026 5.72492552 [8340]
00000027 5.72673035 [8340] DNError: (1172). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
00000028 5.72673035 [8340] at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
00000029 5.72673035 [8340] at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
00000030 5.72673035 [8340] at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
00000031 5.72673035 [8340] at NationalInstruments.LabVIEW.DNRuntime.InvokeMethod(Int32 invokeType, Type type, Object target, String methodName, Type[] parameterTypes, Int32[] parameterFlags, Object[] parameterIds, IntPtr tdArr)
00000032 5.72673035 [8340] Inner Exception: System.Exception: Bluehill is not currently running or you are not connected
00000033 5.72673035 [8340] at Microsoft.VisualBasic.ErrObject.Raise(Int32 Number, Object Source, Object Description, Object HelpFile, Object HelpContext)
00000034 5.72673035 [8340] at Instron.Bluehill.API.APIHelper.RaiseException(Int32 lErrorNumber, String strErrorSource)
00000035 5.72673035 [8340] at Instron.Bluehill.API.BluehillAPI.openMethod(String MethodFile)
00000036 5.72673035 [8340]
06-15-2017 02:57 PM
Ok, I have been fussing around with my problem and I think I may have pinned down the part of problem. When I hover over the IAPIClient property node, some text pops up briefly. It reads, "BluehillAPI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null". Now, I am no expert, but I know that the API uses 4.0 .NET, not 0.0. I was able to find some info on the null bit as well. I am not sure how to get the Key to not be null yet. (I included the picture for illustration, since I don't think this was in the initial project)
06-15-2017 03:21 PM
That's your problem.
You can't use a "NULL" constant.
06-15-2017 04:11 PM
Thanks for the verification. It is good to actually know what the problem is. I am at bit of a loss as to how to actually deal with it. Is this a problem with how LabVIEW is handling the key, or is the problem coming from the API instead?
Thanks
Luke J
06-15-2017 04:28 PM
To fix it, right click on the constant, change it to a control.
On the front panel, right click on the control, and insert the right object from the .net assembly.