Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NationalInstrumnets.UI.Internal.WaveformPlotElement threw an exception

Solved!
Go to solution
Solution
Accepted by AlbertJ

AlbertJ,

 

What if you include the 2010 C++ Runtime as a merge module with your installer? The merge module will be located at \Program Files\Common Files\Merge Modules, and will be called Microsoft_VC100_CRT_x86.msm. If you include that with your installer builds, it should package the vcredist_x86.exe file into your setup.exe. 

 

 

0 Kudos
Message 21 of 36
(3,381 Views)

Daniel, 

 

I have the info you asked for about the C++ runtimes running on the win 8 machine.  I'm attaching a doc file with a screen shot of the info.   I will have acess to the machine for only the next day or so.  Any info you can provide that can help me get things installed and running properly will be a great help.  

 

Thanks, 

 

-Steve

0 Kudos
Message 22 of 36
(3,367 Views)

Thank you Daniel, that worked for me.

 

Regards,

AJ

0 Kudos
Message 23 of 36
(3,361 Views)

Albert--Glad to hear it!

 

Steve--While you have access to the machine, can we get a fusion log of the executable? You can find the instructions here: https://decibel.ni.com/content/people/nickb/blog/2009/06/16/using-fusion-logs-to-debug-net-assembly-...

 

Also, as to why you were unable to run the vcredist.exe, I suspect that you have the C++ Redistributable 2010 SP1 instead of just 2010. You can find the download for SP1 here: http://www.microsoft.com/en-us/download/details.aspx?id=26999 

 

I would suggest trying that and then running your executable. I'll look forward to hearing how it goes!

0 Kudos
Message 24 of 36
(3,351 Views)

Daniel, 

 

I need a bit of clarification... do you want me to try the redistributable that does include SP1, or that does not include SP1? 

0 Kudos
Message 25 of 36
(3,346 Views)

Daniel, 

 

The win 8 machine does not have the WinSDK on it so I can't get the fusion logs.  Unfortunately, I can't install any tools on that machine because it is used for non-development work and we can't put dev tools on it.  The best I can do is install a different version of the C++ redist and see if that helps.   As I mentioned in my previous post, I was unsure which version you wanted me to install.  If you can clarify that, I can try it.   

 

Thanks, 

-Steve

0 Kudos
Message 26 of 36
(3,341 Views)

Steve,

 

My apologies for the confusion. I meant to try the SP1 version of the C++ redistributable. I'll look forward to hearing how that goes.

0 Kudos
Message 27 of 36
(3,335 Views)

Hi

 

Sorry to resurect this old problem but I am currently experiencing this issue deploying a project under the following environment:

Development: x64 C#, VS2012-AnyCPU, MS2013, Win8.1

Deployment: Win7, x64, no NI products

 

I have implemented most suggestions here including:

- install vs2010_redist_x86

- install vs2012 redist SP4 x64

- NI.Common in GAC (no other NI DLLs in GAC)

- All NI DLL's I can find in the exe flat file directory (spend to much time trying to finesse this!)

- Obviously NI.Common.Native is in the exe directory and at v13.0.40.188 (ref attach)

 

Application is a smiple scattergraph which stopped working on customer PC when I added a few waveformgraphs. No hardware is required.

 

Any suggestions would be appreciated.

 

Trace:

 

System.TypeInitializationException: The type initializer for 'NationalInstruments.UI.Internal.WaveformPlotElement' threw an exception. ---> System.BadImageFormatException: Could not load file or assembly 'NationalInstruments.Common.Native, Version=13.0.40.188, Culture=neutral, PublicKeyToken=dc6ad606294fc298' or one of its dependencies. An attempt was made to load a program with an incorrect format.
   at NationalInstruments.PrecisionTimeSpan.FromSeconds(Double value)
   at NationalInstruments.UI.Internal.WaveformPlotElement..cctor()
   --- End of inner exception stack trace ---
   at NationalInstruments.UI.Internal.WaveformPlotElement..ctor(ControlElement parent, Object obj)
   at NationalInstruments.UI.WaveformPlot.CreateElement()
   at NationalInstruments.UI.ControlEntity..ctor()
   at NationalInstruments.UI.Plot..ctor()
   at NationalInstruments.UI.XYPlot..ctor()
   at MY.NS.RrfPlot.InitializeComponent()
   at MY.NS.RrfPlot..ctor(DelStr putMsgDlg, Int32 formHome)
   at MY.NS.RrfPlot..ctor(RrfRadarRawRecType[] radarData, DelStr putMsgDlg, Int32 formHome)
   at MY.NS.RrfForm.PlotData_MouseUp(Object sender, MouseEventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

0 Kudos
Message 28 of 36
(3,156 Views)
Hi Frank334,

System.BadImageFormatExceptions happen when an application tries to load a module that does not match the bitness of the process. Please read the help topic which discusses the nuances of bitness agnostic vs specific Measurement Studio assemblies: zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/64bitsupport/ . NationalInstruments.Common.Native is a bitness specific assembly, so you need to make sure to deploy the version that matches the process that will load it.
Daniel Dorroh
National Instruments
0 Kudos
Message 29 of 36
(3,150 Views)

Hi Daniel

 

Thanks for helping.

 

Unfortunately, I can't follow the link you mentioned and searches have not revealed it, but I understand the application will be addressing the 32bit or 64bit assembly of the NI.Common.Native.dll.

 

I have tried to run the application with all versions of NI.Common.Native that I could find on my development system including from the build directory, GAC32, GAC64, DotNet.Assemblies.Current and DotNet.Assemblies (64bit).Current.  All fail with the same error.

 

When I build the app as 32bit (rather than AnyCpu) it deploys and runs (success, I have a deliverable!). However, when I build 64bit no combination of NI.Common.Native works. I have also installed the 64bit version in the GAC and kept the 32bit version local incase of some interdependance; without success.

 

Finally, when I look at the headers of the two NI.Common.Native.dll's (using beyondcompare) I see one was built using i386 and the other AMD64, however, both files indicate they are for Windows 32bit (ref attach).

 

Clearly, I'm not understanding the 64bit deployment process but have followed the NI instruction closely. Any suggestions/links you can provide to help resolve this will be well recieved.

 

Cheers

Frank

0 Kudos
Message 30 of 36
(3,142 Views)