11-23-2006 05:48 AM
11-24-2006 12:59 AM
11-24-2006 02:08 AM
have you installed your own collectino (TimerPrograms) installed in the VMWare environment?
Hi Ton,
sure, I've put all my .NET assemblies (DLLs) in the same directory like the LabVIEW VIs, on the host system as on the test environment for LV 8.20 within VMware. As I've said before: Other classes work, it's only the generic "TimerPrograms" dictionary that doesn't - obviously because of its constructor that isn't "found"...
Hans
11-27-2006 12:45 PM
11-28-2006 03:22 AM
Hi Brian,
many thanks for your offer to have a look at the DLLs, your help is greatly appreciated! Attached you'll find a small ZIP archive with the following contents:
- BCON.Interface.dll = .NET contract assembly with interface definitions
- BCON.Project.Configuration.dll = .NET assembly with class implementations
- Create TimerPrograms Instance.vi = simple example VI with TimerPrograms() constructor
- Missing TimerPrograms() constructor LV8.20.png = screenshot created under LV 8.20
Some brief explanations: my generic class ConfigurationCollection<T> (within the BCON.Project.Configuration namespace) is derived from a generic Dictionary<string, T>, and the more specialized collection TimerPrograms (namespace BCON.Project.Configuration.Timer) itself derived from ConfigurationCollection<ITimerProgram>.
Therefore TimerPrograms is simply a generic dictionary for TimerProgram objects with some added attributes/methods.
With LV 8.0 on my host system, the example VI works fine. Under LV 8.20 within VMware, the generic collections like TimerPrograms do not list their constructors any longer (while the simple objects like e.g. TimerProgram do), therefore the LV constructor node is broken. I assume it's a missing/not found (.NET 2.0 runtime?) assembly, but unfortunately the constructor dialog does not show any hint if there's a problem reading the interfaces or resolving further references etc.
Hopefully you can find the reason why it doesn't work.
Thanks again + greets,
Hans
11-28-2006 03:49 PM - edited 11-28-2006 03:49 PM
Yeah, I was afraid of this...it isn't going to work as is in 8.20...in truth, it may not work in 8.0 either...you may just not have hit it (or you might never...all depends on what you're doing).
Short Answer: You'll need to hide your generics behind an interface.
Long Answer: The problem comes into the size that type names can reach when you use .NET generics. For example, the killer part for you here is the following base class name of TimerPrograms:
System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[BCON.Interface.Project.Configuration.Timer.ITimerProgram, BCON.Interface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
This name exceeds 255 characters. Why does that matter? Well, here we get into some LabVIEW issues...
Due to history, need and optimization for things such as the Realtime platform, the "type manager" of the internals of LabVIEW restrict some strings to 255 in size. This manager is the thing that handles VI Server, ActiveX, .NET, etc. Before .NET generics, this wasn't a problem because you never ran into a typename that exceeded the size and the various optimizations using 255 limits worked like a champ. Since .NET support for
I'm working on scrubbing these paths to get it to work, but I can't say when you'll have a version of
Message Edited by Lycangeek on 11-28-2006 03:51 PM
11-29-2006 03:21 AM
11-29-2006 02:50 PM
11-29-2006 05:50 PM
I'm using a small, yet flexible open source object factory from Ralf Westphal in my C# clients: http://tinyurl.com/yl4g42
Trying the same in LabVIEW, I got problems with creating the object instances of the generic dictionaries, what made me use the directly referenced constructors again. This worked (under LV 8.0), and I thought the dynamic object creation itself was the problem - but obviously it is not, having your latest info.
The cast node works like desired, no problems with it.
Greetings,
Hans
02-05-2007 12:27 AM