Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

System.TypeInitializationException: The type initializer for 'NationalInstruments.UI.Internal.WaveformPlotElement' threw an exception.

Solved!
Go to solution

Hello group

 

 I currently have an problem with an aplication that I have developed. I am using VS2008 and C# with Measurement Studio Version 8.6.0.189. My aplication uses NI controls to display various charts and diagrams.

I have tested my application on my desktop and on various other PCs and virtual machines (including Windows 7 Beta, XP) and it works as I expected. For the Installer I used the normal Microsoft tool build into VS 2008.

Now my customer has problem to run the application on a notebook with windows XP. The installer runs fine and installs .NET 2.0 and my application as I expected. The customer can start the application, but when the program comes to an point, where I internal create and initialize the elements of an WaveformGraph, I receive the following exeption:

 

System.TypeInitializationException: The type initializer for 'NationalInstruments.UI.Internal.WaveformPlotElement' threw an exception. ---> System.TypeInitializationException: The type initializer for 'NationalInstruments.PrecisionTimeSpan' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'NationalInstruments.Common.Native, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. Diese Anwendung konnte nicht gestartet werden, weil die Anwenungskonfiguration nicht korrekt ist. Zur Problembehebung sollten Sie die Anwendung neu installieren. (Exception from HRESULT: 0x800736B1)
File name: 'NationalInstruments.Common.Native, Version=8.6.35.131, Culture=neutral, PublicKeyToken=18cbae0f9955702a' ---> System.Runtime.InteropServices.COMException (0x800736B1): Diese Anwendung konnte nicht gestartet werden, weil die Anwenungskonfiguration nicht korrekt ist. Zur Problembehebung sollten Sie die Anwendung neu installieren. (Exception from HRESULT: 0x800736B1)
   at NationalInstruments.PrecisionTimeSpan..ctor(Int64 wholeSeconds, UInt64 fractionalSecondTicks)
   at NationalInstruments.PrecisionTimeSpan..cctor()


   --- End of inner exception stack trace ---
   at NationalInstruments.PrecisionTimeSpan.FromSeconds(Double value)
   at NationalInstruments.UI.Internal.WaveformPlotElement..cctor()

--- End of inner exception stack trace ---
   at NationalInstruments.UI.Internal.WaveformPlotElement..ctor(Object obj)
   at NationalInstruments.UI.WaveformPlot.CreateElement()
   at NationalInstruments.UI.ControlEntity..ctor()
   at NationalInstruments.UI.Plot..ctor()
   at NationalInstruments.UI.XYPlot..ctor()
   at NationalInstruments.UI.WaveformPlot..ctor()
   at MosesVideo.SchreiberControl..ctor(AnzeigeObjekte obj, Int32 index, Globals g)
   at MosesVideo.MainWindow.CreateNewAnzeigeObjekt(Int32& iObjektIndex, Int32 iType, Boolean bReload)
   at MosesVideo.MainWindow.MainWindow_MouseUp(Object sender, MouseEventArgs e)
   at System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
 

 


 

This exeption is thown, when I execute the line

plot[i] = new NationalInstruments.UI.WaveformPlot ();

 

 The same code runns fine on every machine I have access to.

 

What's going on here?

 

Regards

 

Stephan Gerhards  

measX GmbH
www.measx.com
0 Kudos
Message 1 of 11
(16,563 Views)

Please have a look at it.

I currently get another error when I try to create a "Gauge". Other Instruments, like "XYControl" or "Meter" work with no problem!!

Her is the error message i get with the Gauge:

 

************** Exception Text **************
System.IO.FileLoadException: Could not load file or assembly 'NationalInstruments.UI.Styles3D, Version=8.6.35.189, Culture=neutral, PublicKeyToken=18cbae0f9955702a' or one of its dependencies. Diese Anwendung konnte nicht gestartet werden, weil die Anwenungskonfiguration nicht korrekt ist. Zur Problembehebung sollten Sie die Anwendung neu installieren. (Exception from HRESULT: 0x800736B1)
File name: 'NationalInstruments.UI.Styles3D, Version=8.6.35.189, Culture=neutral, PublicKeyToken=18cbae0f9955702a' ---> System.Runtime.InteropServices.COMException (0x800736B1): Diese Anwendung konnte nicht gestartet werden, weil die Anwenungskonfiguration nicht korrekt ist. Zur Problembehebung sollten Sie die Anwendung neu installieren. (Exception from HRESULT: 0x800736B1)
   at NationalInstruments.UI.GaugeStyle.Sunken3DBaseImpl.DrawDialBorder(Graphics graphics, Rectangle dialBorderBounds, RectangleF dialBounds)
   at NationalInstruments.UI.GaugeStyle.GaugeBaseImpl.DrawDial(IRadialNumericPointer context, RadialNumericPointerStyleDrawArgs args)
   at NationalInstruments.UI.RadialNumericPointerStyle.Draw(INumericPointer context, NumericPointerStyleDrawArgs args, Double value)
   at NationalInstruments.UI.GaugeStyle.Draw(INumericPointer context, NumericPointerStyleDrawArgs args, Double value)
   at NationalInstruments.UI.Internal.NumericPointerElement.DrawForeground(ComponentDrawArgsInternal args)
   at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
   at NationalInstruments.Restricted.ControlElement.DrawChildren(ComponentDrawArgsInternal args, Rectangle clipRectangle)
   at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1, Boolean A_2)
   at NationalInstruments.Restricted.ControlElement.a(ComponentDrawArgsInternal A_0, Rectangle A_1)
   at NationalInstruments.Restricted.ControlElement.Paint(PaintEventArgs e)
   at NationalInstruments.UI.WindowsForms.ControlBase.OnPaint(PaintEventArgs e)
   at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
   at System.Windows.Forms.Control.WmPaint(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

measX GmbH
www.measx.com
0 Kudos
Message 2 of 11
(16,551 Views)

Hi

 

please attach a small example program to reproduce this here and tell us the hard and software configuration of this notebook.

Do you have another notebook same type? Will it run there without errors?

Regards
DianaS
0 Kudos
Message 3 of 11
(16,517 Views)

Hello
Thank you for your answer.


I do not have any problem on every computer that I have tested here. On every machine I tested, it works perfectly.
My customer will send me the notebook with teh problem. So I hope, that I can see more when I have it here in my office.
The only difference I know is, that the customer has an English Windows XP with german language pack, I only have german XP System here.

 

Regards

 

Stephan Gerhards  

 

measX GmbH
www.measx.com
0 Kudos
Message 4 of 11
(16,514 Views)

It seems to me that you have not included the Microsoft_VC90_ATL_x86.msm and Microsoft_VC90_CRT_x86.msm merge modules in your application (for VS2008 applications, which is your case.). Since you have created a VisualStudio based installer project, can you add these 2 merge modules (they will normally be located in Program Files\Common Files\Merge Modules directory) and then give that application to your client to see if it works ?

 

You should make sure that you include all the required mergemodules in your application. Sometimes, the VisualStudio does not detect every dependent merge modules correctly.I suggest that you look at the following help document (in the VisualStudio integrated help) that lists what merge modules you need to include when you want to deploy applications built with different Measurement Studio assemblies:

NI Measurement Studio Help --> Deploying Applications --> Merge Modules and Deployment Files --> .NET Merge Modules.

Also of help to you might be:

NI Measurement Studio Help --> Deploying Applications -->  Deploying Windows Applications.

-Mahesh
National Instruments
0 Kudos
Message 5 of 11
(16,497 Views)
Solution
Accepted by stephan.gerhards

Hi all

 

Finaly I found a solution. I had to add the "Microsoft_VC90_CRT.msm" and  the MICROSOFT_VC80_CRT manually to my installer and then it works also on the labtops of my customer.

 

Regards

 

Stephan Gerhards  

measX GmbH
www.measx.com
0 Kudos
Message 6 of 11
(16,366 Views)

Hi,

 

I am also getting the same type of exception for Range. But if i am giving the Exe to the customer and not the installer then what i have to do?

 

Thanks ,

vaira muthu. 

0 Kudos
Message 7 of 11
(15,584 Views)

Hi vaira,

 

You need to ensure that you give your customer all the underlying dependencies that your application needs. In this case, you need to make sure that the VC9 runtime components are on that system in order for your application to run. I would highly suggest just creating a simple installer and giving that to your customer to run. If you create it in Visual Studio, you get only 2 files (i.e. default of Setup.exe and Setup.msi) which really isn't that much. This guarantees that you end-user meets all the requirements you specify in order to use your application successfully.  

 

Just my thoughts

 

-Jonathan 

Jonathan N.
National Instruments
0 Kudos
Message 8 of 11
(15,560 Views)

Hi Jonathan,

 

Thanks for you reply.

 

Can you please specify the link where i can download the vc9 components. I searched for vc9 runtime components. But it is linking to the visual c++ redistribute package. Is that right one?.. I am using NationalInstruments.UI.dll. So please give me the link.

 

Thanks a lot Jonathan, 🙂

Vaira Muthu.

--------------------------------------- 

0 Kudos
Message 9 of 11
(15,550 Views)

Hi Vaira,

 

The Visual C++ 2008 Redistributable Package is what your end-users need to install to get the underlying unmanaged components. The merge modules mentioned earlier in this post contain the same components that the redistributable package installs. You only need those components if you are using 3D styles in your UI. This information is documented in the Measurement Studio .NET XCOPY Deployment Files help topic.

 

Best Regards, 

Jonathan N.
National Instruments
0 Kudos
Message 10 of 11
(15,536 Views)