09-10-2008 01:27 PM
.net constructor node return error 3. The node doesn't take any input, and no output. Return refnum is invalud, 0.
In both 8.5.1, and 8.6.
using System;
using System.Windows;
using System.Windows.Forms;
using System.Drawing;
using System.Collections.Generic;
using System.Text;
namespace test
{
public class Read
{
public int Load(String path)
{
return 0;
}
}
}
Any idea?
Solved! Go to Solution.
09-10-2008 01:46 PM - edited 09-10-2008 01:47 PM
09-10-2008 03:03 PM
09-10-2008 08:33 PM
Create a project in LV and save both the VI and the project. Put the assembly in the same directory.
LV changed from 8.2 to 8.5 in how they load assemblies. There should be more info in the help about it if I'm not mistaken.
-snow
09-11-2008 09:38 AM
snowpunter wrote:Create a project in LV and save both the VI and the project. Put the assembly in the same directory.
That would have no bearing on this issue.
George: It appears that you're using .NET 3.0 given the System.Windows namespace. Perhaps this is a LabVIEW <--> .NET 3.0 issue. When I created the class I was using .NET 2. When I tried to call the constructor using the class compiled under .NET 2.0 with an eval of LabVIEW 8.6 I did not get an error.
09-11-2008 10:05 AM
You're right about .net 3.0. 5 stars went your way.
On a .net 2.0, LabVIEW 8.5.1 pc, no error either.
So is there a work around? Or should I uninstall .net 3.0?
09-11-2008
10:17 AM
- last edited on
06-20-2025
09:51 AM
by
Content Cleaner
So is there a work around?
You can try to force LabVIEW to use .NET 2.0 by adding a labview.exe.config file as discussed here. I had to do that with an assembly that would not work under .NET 2.0.
Or should I uninstall .net 3.0?
Can't answer this one, since I don't know what you're using .NET 3.0 for, or you may be using it elsewhere. ![]()
09-11-2008
11:34 AM
- last edited on
11-01-2025
05:54 PM
by
Content Cleaner
So is there a work around?
You can try to force LabVIEW to use .NET 2.0 by adding a labview.exe.config file as discussed here. I had to do that with an assembly that would not work under .NET 2.0.
This trick doesn't work for programmer somehow. LabVIEW automatically picks the latest version when drop the constructor node.
And it's very painful to try. As LabVIEW expects v1.1.4322, or v2.0.50727.
When I typed in v2.0, LabVIEW went crazy! So I found version 2.0.50727.42 on Microsoft web site. LabVIEW doesn't recognize v2.0.50727.42 either.
09-11-2008 11:56 AM
That's probably because the assembly has been compiled under .NET 3.0. In my case I had an assembly that was compiled under 1.1, but I had both 1.1 and 2.0 on my computer, and I had to make sure that 1.1 was used. I don't have .NET 3.0, so there's no way for me to test this, but the only thing I can suggest is to make sure the assembly is compiled as a .NET 2.0 assembly. This would mean removing those using System.Windows namespaces since they don't exist under .NET 2.0. Unless, of course, you will need them for that assembly.
The only other thing I can suggest is what I had suggested before and to provide an explicit constructor, rather than relying on the default constructor.
09-11-2008 12:16 PM - edited 09-11-2008 12:22 PM
As soon as I drop the .net constructor on the diagram, before link to my dll, LabVIEW popup a dialog window, which says:
The version of the assembly you requested was automatically promoted to a later version by the .NET runtime engine.
My mistake. LabVIEW remembers the last assembly I used.