LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory or data structure corrupt error openning project and library

Hi there,

 

I have a problem trying to open a project from a .NET application. The codes look like below:

 

LabVIEW.ApplicationClass lv = new LabVIEW.ApplicationClass();
LabVIEW.Project m_proj = lv.OpenProject("C:\\Projects\\LV_Example\\lv_proje​ct1.lvproj");

 

I am getting the error:  LabVIEW: Memory or data structure corrupt. I face to the same error trying to open a library (.lvlib) using openLibrary() function. What can be the reason?

 

Thanks,

Pari sa

0 Kudos
Message 1 of 10
(4,426 Views)

Hey,

 

In a first quick test I was not able to reprocue that.

Could you please provide us with the .cs file you are using and some more information, e.g. the version of LV you are using and what is your purpose to open a project remotely from another development environment.

 

 

Thanks,

Christian

0 Kudos
Message 2 of 10
(4,402 Views)

Pari Sa,

 

reading your error message, i would think that either the whole lvproj, or at least a component which it is using is corrupt.

Can you open the lvproj without any errors manually in LV?

 

I cannot reproduce the error using LV 2009 (without SP1) and C# 2008 running Windows 7. What versions are you using?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 3 of 10
(4,397 Views)

Hi all,

 

I am using visual studio 2008 and LV 2009 (version 5.5.0.0). The aim of the application is that it should be possible to call and open VIs and labview projects (also libraries).

As I mentioned before the application should be able to open a project knowing its path. The lvproj file is not corrupted and I can open it from LV. Even I tried to open it in another test c# project and it is working properly there!! Although everything seems to be same, it is not working here. I can not find the problem. Now the exception has changed to System.InvalidCastException.

 

({System.InvalidCastException: Das Rückgabeargument hat einen ungültigen Typ.
   bei System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)
   bei System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)
   bei System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   bei LabVIEW.ApplicationClass.OpenProject(String Path)
   bei LabViewService.LabViewService.OpenPrj(ITestTask task) in C:\Projects\CopyOfLVService\ClassLibrary1\Service.cs:Zeile 565.})

 

Does anyone know what may be the reason??

 

Thanks in advance,

Pari sa

 

 

0 Kudos
Message 4 of 10
(4,386 Views)

Pari sa,

 

could you please post your c#-solution and the lvproj? It seems to me that this project is a rather small example....

Since my C#-lines are very comparable to yours, there have to be some other differences....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 5 of 10
(4,380 Views)

Norbert,

 

unfortunately I am not allowed to send c# file. But the function look like the following file. And here is the LV project I use. It is almost empty!

 

Thanks for your help,

Pari sa

Download All
0 Kudos
Message 6 of 10
(4,376 Views)

Pari sa,

 

i have no problem opening your lvproj using the following lines:

 

LabVIEW.ApplicationClass lv = new LabVIEW.ApplicationClass();
LabVIEW.Project lvproj = lv.OpenProject("C:\\temp\\lv_project1.lvproj");
lvproj.OpenWindow();

 

I am pondering if your COM link in the C# solution is broken.... therefore, you maybe should try a new project....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 10
(4,365 Views)

Norbert,

 

this is exactly what makes me crazy! I can execute these lines in a simple c# project (exe). The main project produces a dll. I copied all the codes in another project. Still I see the same exception.

In the same project, in which exeption occures trying to open a LV project, I can open and call VIs without any problem. Could it be still the problem of COM link???

 

Thanks and regards,

Pari sa

0 Kudos
Message 8 of 10
(4,358 Views)

Hi,

 

as I have read in some webpages, seems that this problem has nothing to do with the codes inside the project. It looks like if I face to an assembly resolution problem. So I think I should go in this direction.

 

http://blogs.artinsoft.net/mrojas/archive/2009/12/10/return-argument-has-an-invalid-type.aspx

 

Thanks for your help,

Pari sa

0 Kudos
Message 9 of 10
(4,353 Views)

Pari sa,

 

this is good information (at least regarding LV). Hope that you can solve the issue with the information you linked in your last post.

Please let us know if it did since maybe other developer run into the same issue somewhere in the future and this thread could help them out 🙂

 

thanks,

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 10 of 10
(4,337 Views)