Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

System.TypeInitialization Error

I've created an application using VS10, Measurement Studio 2010,  C# and .NET 4.0. I have followed the instructions on this knowledgebase but I still am not able to run my program on the target machine. It crashes when it first tries to load the program. I get the following error:

 

Log Name: Application
Source: .NET Runtime
Date: 10/10/2012 10:32:25 AM
Event ID: 1026
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Description:
Application: Adipose.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.TypeInitializationException
Stack:
at NationalInstruments.UI.Internal.WaveformPlotElement..ctor(NationalInstruments.Restricted.ControlElement, System.Object)
at NationalInstruments.UI.WaveformPlot.CreateElement()
at NationalInstruments.UI.ControlEntity..ctor()
at NationalInstruments.UI.Plot..ctor()
at NationalInstruments.UI.XYPlot..ctor()
at Adipose.AdiposeMainForm.InitializeComponent()
at Adipose.AdiposeMainForm..ctor()
at Adipose.Program.Main()

 

Can anyone help me with this? As far as I can determine, all of my dependencies are being loaded...

0 Kudos
Message 1 of 20
(7,907 Views)

This error usually indicates that the required merge modules needed when deploying an application using Measurement Studio assemblies have not all been included. Visual Studio does not always detect every dependent merge module. Do you have the following merge modules included in your installer?

 

Microsoft_VC100_ATL_x86.msm 
Microsoft_VC100_CRT_x86.msm 
Microsoft_VC90_CRT_x86.msm 
Microsoft_VC90_MFC_x86.msm 
Microsoft_VC100_CRT_x86.msm (32-bit) 
Microsoft_VC100_CRT_x64.msm (64-bit)

 

The following link contains the required merge modules for the National Instruments UI assembly:

 

http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/netmergemodules/

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 2 of 20
(7,889 Views)

I was missing one of those modules. I went back through the list in the link of all modules required and made sure I had them all but I'm still having problems. I am using the following in my project:

 

NationalInstruments.Analysis.Enterprise

NationalInstruments.Analysis.Professional

NationalInstruments.Analysis.Standard

NationalInstruments.Common

NationalInstruments.NetworkVariable

NationalInstruments.NiLmClientDLL

NationalInstruments.Tdms

NationalInstruments.UI

NationalInstruments.UI.WindowsForms

 

and have the following merge modules in my installer:

 

cvitdms.msm

logos.msm

logosxt.msm

microsoft_vc100_crt_x86.msm

microsoft_vc100_atl_x86.msm

microsoft_vc90_crt_x86.msm

microsoft_vc90_mfc_x86.msm

mkl.msm

mstudiocommon.2010.msm

mstudiocontrols.2010.msm

mstudiocontrolsboolean.2010.msm

mstudiocontrolsgraphs.2010.msm

mstudiocontrolsnumerics.2010.msm

mstudionetworkvariable.2010.msm

mstudioprofessionalanalysis.2010.msm

mstudiostandardanalysis.2010.msm

mstudiotdms.2010.msm

mstudioui.2010.msm

mstudiouidesign.2010.msm

mstudiouiwinforms.2010.msm

nianlys.msm

nimesadll.msm

nimetautils.msm

nimsvc_crt71.msm

nimsvc_stl71.msm

ninetv.msm

policy_9_0_microsoft_vc90_crt_x86.msm

policy_9_0_microsoft_vc90_mfc_x86.msm

tdms.msm

 

However, I'm still getting the same error when I try to run my program on the target computer. I made sure to add a "System Folder" and "Program Files Folder" for the niMetaUtils.msm. What else am I missing? Some of the .dlls end up in the folder with my .exe but most do not. Is that supposed to happen? I left the Module Retargetable folder to default for all of them...

 

Is there a reason Microsoft_VC100_CRT_x86.msm is listed twice? Are they different?

 

Microsoft_VC100_ATL_x86.msm 
Microsoft_VC100_CRT_x86.msm 
Microsoft_VC90_CRT_x86.msm 
Microsoft_VC90_MFC_x86.msm 
Microsoft_VC100_CRT_x86.msm (32-bit) 
Microsoft_VC100_CRT_x64.msm (64-bit)

 

0 Kudos
Message 3 of 20
(7,884 Views)

In what location is Microsoft_VC100_CRT_x86.msm listed twice? What the operating systems of your development and target machine?

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 4 of 20
(7,879 Views)

@Anjelica-W wrote:

This error usually indicates that the required merge modules needed when deploying an application using Measurement Studio assemblies have not all been included. Visual Studio does not always detect every dependent merge module. Do you have the following merge modules included in your installer?

 

Microsoft_VC100_ATL_x86.msm 
Microsoft_VC100_CRT_x86.msm 
Microsoft_VC90_CRT_x86.msm 
Microsoft_VC90_MFC_x86.msm 
Microsoft_VC100_CRT_x86.msm (32-bit) 
Microsoft_VC100_CRT_x64.msm (64-bit)

 

The following link contains the required merge modules for the National Instruments UI assembly:

 

http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/netmergemodules/

Regards,

Anjelica W.
National Instruments
Applications Engineer

No, I mean why did you list them twice? You listed it once without specifying 32 or 64 bit and then again when you did specify. Is there a reason for this?

Is there a reason some of the .dll's end up in the folder with my executable and some do not? Would this be causing my problem?

 

0 Kudos
Message 5 of 20
(7,866 Views)

Sorry for the confusion. In the link, it was listed the second time just to distinguish between the 32 and 64 bit versions. Is your target machine a Windows 7 computer? If please make sure to follow these additional steps:

 

http://digital.ni.com/public.nsf/websearch/046E1B36934C7C198625788000591A1E?OpenDocument

 

Are the DLLs (not found in folder of executable) in other folders/subdirectories of the installer or missing altogether?

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 6 of 20
(7,862 Views)

Yes, the target machine is a 64-bit Windows 7 computer. We are choosing to develop the program as 32-bit. I added that merge module, but still am unable to start my program on the target machine.

 

When I install the application on my target machine, the following DLLs are found in the executable's folder:

 

NationalInstruments.Analysis.Enterprise.dll

NationalInstruments.Analysis.Professional.dll

NationalInstruments.Analysis.Standard.dll

NationalInstruments.Controls.Booleans.dll

NationalInstruments.Controls.dll

NationalInstruments.Controls.Graphs.dll

NationalInstruments.Controls.Numerics.dll

NationalInstruments.NetworkVariable.dll

NationalInstruments.Tdms.dll

NationalInstruments.UI.Design.dll

NationalInstruments.UI.dll

NationalInstruments.UI.Styles.3D.dll

NationalInstruments.UI.WindowsForms.dll

 

The rest of the DLLs are installed in C:\Windows\Microsoft.NET\assembly\GAC_MSIL and C:\Windows\Microsoft.NET\assembly\GAC_32. Is there a reason some install in the GAC and others are in the executable folder?

 

0 Kudos
Message 7 of 20
(7,856 Views)

Any update?

0 Kudos
Message 8 of 20
(7,817 Views)

Sorry about the long response. It is expected behavior for some of the assemblies to install in the Global Assembly Cache (GAC). Similiar to the Shared folder, this folder contains general, basic assemblies that can be used by several applications. The DLLs stored in the executable are more specific to your application.

 

Do you receive these errors on other computers as well?

Can you successfully deploy one of our examples or does it give you the same error?

Regards,

Anjelica W.
National Instruments
Product Marketing Manager
FlexLogger and TestStand
0 Kudos
Message 9 of 20
(7,808 Views)

Yes, I receive the errors on other computers as well. I tried it on a computer that had Measurement Studio installed on it and a couple of computers without. It worked on the computer that had Measurement Studio but not on the ones without it. 

 

I have the same behavior when trying to deploy one of your examples. If it's installed on a computer with Measurement Studio, it works. Otherwise it doesn't work.

0 Kudos
Message 10 of 20
(7,806 Views)