Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

The type initializer for 'NationalInstruments.Analysis.Math.CurveFit' threw an exception.

I'm getting the following message:

  

 

The type initializer for 'NationalInstruments.Analysis.Math.CurveFit' threw an exception. 

 

 

 double slope, offset, mse;  

 

 

 

 

 

FIRST EXAMPLE:

myX[0] = (double) 0.93999981880187988;

myY[0] = (double) -1.0

myX[1] = (double) 4.0599994659423828

myY[1] = (double) 1.0

 

SECOND EXAMPLE:

myX[0] = (double) 0.0;

myY[0] = (double) -1.0  

myX[1] = (double) 0.0

myY[1] = (double) 1.0 

 

 

FitMethod myMethod = FitMethod.LeastSquare;

CurveFit.LinearFit(myX, myY, myMethod, out slope, out offset, out mse);

 

Please help!

 

Jason

 

 

 

 

 

 

 

 

 

 

 

 

 

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

Hi Jason,

 

I was wondering if the two examples imply that it compiles in one, but not the other.  Also, is that the exact code you are attempting to compile, or is it psuedo code?  Is this happening in release mode or debug?

Regards,

Hassan Atassi
Senior Group Manager, Digital Support
0 Kudos
Message 2 of 10
(4,969 Views)

Hi everybody,

 

I receive the same error, when I try to run my applican, which is written in C#. The exact error is:

 

er.PNG

 

I've compiled it with both VS2005 and VS2008, but in both case the same error appears. If there should be any further explanation, please let me know. I certainly elaborate my question. Your help or technical advice is greatly appreciated.

 

thanks,

H__S

0 Kudos
Message 3 of 10
(4,697 Views)

Hi H__S,

 

Thanks for posting on the NI Discussion Forums!

 

I think it would be helpful if you could elaborate a little more on this question. Can you post your code? Which versions of Measurement Studio and Visual Studio do you have installed? Which version of Windows and .NET? Can you click the "Details" button on the error message and post a screenshot of what it displays?

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

Hi Frank,

 

Thank you for your answer. In the image below, we see ALL (!) .NET versions, which I have on my personal notebook:

 

.NET.PNG

 

And in the next image, we can control two different versions of VS, which I have installed on my lap-top:

 

VS.PNG

 

The code, which I'm now working with, was included in the package, which our lab purcheased from LeCroy company, and that says, regarding to Copyright I may not share it in publich. But what I can share with you is my MATLAB demo version source code, which I'm now writing for this device. In fact, I'm attempting to make an interface in MATLAB which allows the user to communicate with a function generator directly. This is what my current project is all about. What I use, are pre-defined and generated SDK files [--- .dll library files] which are released by the company for this device. In MATLAB however, when I run my code, I get the following error:

 

err.png

 

which means, that something is going wrong with my Library files, I guess (I'm not sure). I've also read Measurement Studio Release Notes which was very helpful, and found out that I have to install MStudio 2008, maybe; but I could not find its source. Perhaps it is not availabe for free. What I still do have to share with you is this: I have NOT installed any further version of MStudio on my pc, because I suppose to have it installed when I Installed the function generator's softwares (being used for its interface), released by the company. So, I wonder if this could be the case, but not certain. About the "Detail button" in the previous post, I cannot do it write right now, because I'm not in lab. On Tuesday, I'll check it once more, and post an extra image, (but its message is too long!).

 

thank you again,

H__S 

0 Kudos
Message 5 of 10
(4,667 Views)

Thanks for posting those screenshots. I think I have a better idea of what's going on now.

 

Have you purchased Measurement Studio yourself? You'll need a Measurement Studio license in order to compile code which uses analysis libraries such as NationalInstruments.Analysis.Enterprise; otherwise, you'll receive build errors after the license checker can't find a valid license file. You mentioned that you purchased this code from Teledyne Lecroy, so it seems likely that they used their Measurement Studio license to develop this application.

0 Kudos
Message 6 of 10
(4,647 Views)

Hi Frank,

 

Sorry for being too late to give any further feedback. My problem is now gone. In fact, I've done a couple of subtle things which were useful: first of all, I recompiled my C# source code once more, with my fresh installed Visual Studio 2008, and as a second step, (let's say so!), I changed my working machine as well. We have a "classic" PC in our lab which has tens of NI applications installed on it, and I'm currently using this machine. I think both cases helped me getting rid of those errors. One little note: this PC has no Measurements Studio installed on it, and I think recompiling the code with VS 2008 was really helpful. Thank you so much for your attention and of-course your support.

 

Best wishes,

H__S

0 Kudos
Message 7 of 10
(4,585 Views)

H__S, 

 

I am glad to hear that Frank helped solved the issue and also thank you for posting the solution that worked for you. This helps other users who have similar issues. I wish you best of luck in your future projects!

 

Best Regards,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 8 of 10
(4,563 Views)

Hi,

 

 

I have problems with the "NationalInstruments.Analysis.Enterprise" .NET assembly (please see the attachment).

I have NI Measurement Studio 8.6 installed. A week ago, this assembly worked and now it suddenly stopped working and continuously retrieving me this exception.

 

Can you please tell me why? Is there a possible reason that I don't have a serial number for this copy of Measurement Studio 8.6? Why did it worked a weeke ago, then?!?

 

I am looking forward for your reply. Thank you.

 

 

Best regards,

Alex P.

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

Hi Alex,

 

Please create a new post for this question, as the topic seems to be different from the original. Additionally, the last post here was from 2013 and you should get better visibility from other users in a new thread.

 

Regards,

Kristen M

Automated Test Product Marketing Engineer
National Instruments
0 Kudos
Message 10 of 10
(4,058 Views)