Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

VS2008 protected memory read exception

Hi Paul,

Well that is quite odd as on a Pentium M machine, what I would have expected is that you could delete mkl_def.dll, mkl_p4.dll, and mkl_p4p.dll and note be able to delete mkl_p3.dll.  Are you running under the Administrator account on Vista such that you have permission to delete these DLLs?  We do similar tests internally and don't have any issues deleting these DLLs.

Attached you will find a zip file containing one of our test EXEs along with some MKL DLLs. Please do the following:
  1. Unzip the file and run the exe.
  2. Press any key. You should see that same console window as shown in the attached MKL_Test.png snapshot
  3. Try and delete the DLLs in the folder. Please record the dll which you can not delete.

Thanks

Best Regards,
Jonathan N.
National Instruments
Download All
0 Kudos
Message 31 of 48
(3,583 Views)
I've tried this with these results (after removing the read-only flag)

C:\Temp\7.2.1>attrib
A    R       C:\Temp\7.2.1\libguide40.dll
A            C:\Temp\7.2.1\mkl_def.dll
A    R       C:\Temp\7.2.1\mkl_lapack64.dll
A    R       C:\Temp\7.2.1\mkl_p3.dll
A            C:\Temp\7.2.1\mkl_p4.dll
A    R       C:\Temp\7.2.1\mkl_p4p.dll
A            C:\Temp\7.2.1\TstMKL721.exe

C:\Temp\7.2.1>attrib -R *.*

C:\Temp\7.2.1>del .
C:\Temp\7.2.1\*, Are you sure (Y/N)? y
C:\Temp\7.2.1\libguide40.dll
Access is denied.
C:\Temp\7.2.1\mkl_p4.dll
Access is denied.
C:\Temp\7.2.1\TstMKL721.exe
Access is denied.

C:\Temp\7.2.1>attrib
A            C:\Temp\7.2.1\libguide40.dll
A            C:\Temp\7.2.1\mkl_p4.dll
A            C:\Temp\7.2.1\TstMKL721.exe

C:\Temp\7.2.1>



whilst trying this I noticed that the dll's you sent were read-only, this prompted me to re-try the original application with the following result

C:\Program Files\National Instruments\Shared\MKL\MKL70>attrib
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\libguide40.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\MKL70.7z
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_def.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_lapack64.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p3.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4p.dll

C:\Program Files\National Instruments\Shared\MKL\MKL70>del *.dll
C:\Program Files\National Instruments\Shared\MKL\MKL70\libguide40.dll
Access is denied.
C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_def.dll
Access is denied.
C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_lapack64.dll
Access is denied.
C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p3.dll
Access is denied.
C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4.dll
Access is denied.

C:\Program Files\National Instruments\Shared\MKL\MKL70>attrib
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\libguide40.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\MKL70.7z
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_def.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_lapack64.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p3.dll
A            C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4.dll

C:\Program Files\National Instruments\Shared\MKL\MKL70>

so that wasn't a contributory factor, and I can delete the files when I quit visual studio.

0 Kudos
Message 32 of 48
(3,579 Views)
I have also tested this by adding a modal dialog immediately after the fit and get the same result when trying to remove the files.

Paul
0 Kudos
Message 33 of 48
(3,579 Views)
Hi Paul,

The execution file I sent gives the expected results of having libguide40.dll and mkl_p4.dll remain but its odd that VS doesn't give the same result. 

Two quick questions
1) Do you have Vista SP1 installed on any of the machine? On the ones that don't work?
2) Can you list what all NI SW you have on those machines that don't work? Also list the NI SW on the machines that do work.

Thanks

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 34 of 48
(3,560 Views)
My machine has SP1 installed, however when this started SP1 wasn't even out.
 
As for other NI software, I don't think there was anything except the required dll's on at least 1 machine which failed ( I copied everything to a local dir to make it work and didn't even use an installer to generate c:\program files\national instruments )
 
On my machine it has CVI 8.5 and Measurement studio 8.1  without any instrument drivers.
 
Paul
0 Kudos
Message 35 of 48
(3,558 Views)
Hi Paul,

The strange thing to me is that only one MKL kernel DLL is loaded when using the test application that I sent you which is mkl_p4.dll, while all MKL kernel DLLs are loaded in your application. The correct behavior should be loading only one kernel DLL.  So what I suggest is that you first make a copy of the MKL70 directory and move it to some location for backup purposes. Then delete mkl_def.dll, mkl_p3.dll, mkl_p4p.dll in the MKL70 directory before launching Visual Studio.  Then try running your example application and see if the problem still happens.  This step could help us know whether the exception is caused by the co-existence of multiple MKL kernels.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 36 of 48
(3,530 Views)
Stil using order = 5, which doesn't usually throw an exception:
 
deleting mkl_def.dll - thr program just aborts.
 
deleting mkl_p3.dll or mkl_p4p.dll  and I get an exception.
 
System.DllNotFoundException was unhandled
  Message="Unable to load DLL 'nianlys.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
  Source="NationalInstruments.Analysis.Enterprise"
  TypeName=""
  StackTrace:
       at NationalInstruments.Analysis.Internal.k.a(Double[] A_0, Double[] A_1, Int32 A_2, Int32 A_3, Int32[] A_4, Double[] A_5, Int32 A_6, PolynomialFitAlgorithm A_7, Double[] A_8, Double[] A_9, Double& A_10)
       at NationalInstruments.Analysis.Math.CurveFit.PolynomialFit(Double[] inputXData, Double[] inputYData, Int32 order, PolynomialFitAlgorithm fitAlgorithm, Double[]& coefficients, Double& mse)
       at WindowsFormsApplication1.Form1.button2_Click(Object sender, EventArgs e) in C:\Temp\Example\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 39
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs 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.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WindowsFormsApplication1.Program.Main() in C:\Temp\Example\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:
 
Paul
0 Kudos
Message 37 of 48
(3,530 Views)

Hi Paul,

I have attached a different version of nianlys.dll that I would like you to put in your C:\Program Files\National Instruments\Shared\Analysis\ directory. Take the one that is already there and move it to some location. Then copy the attached file to that Shared\Analysis\ directory. After that, run your test application and see if you get that memory error.

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 38 of 48
(3,502 Views)

I still get the following:

System.AccessViolationException was unhandled
  Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
  Source="NationalInstruments.Analysis.Enterprise"
  StackTrace:
       at NationalInstruments.Analysis.Internal.k.a(Double[] A_0, Double[] A_1, Int32 A_2, Int32 A_3, Int32[] A_4, Double[] A_5, Int32 A_6, PolynomialFitAlgorithm A_7, Double[] A_8, Double[] A_9, Double& A_10)
       at NationalInstruments.Analysis.Math.CurveFit.PolynomialFit(Double[] inputXData, Double[] inputYData, Int32 order, PolynomialFitAlgorithm fitAlgorithm, Double[]& coefficients, Double& mse)
       at WindowsFormsApplication1.Form1.button2_Click(Object sender, EventArgs e) in C:\Temp\Example\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 39
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs 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.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at WindowsFormsApplication1.Program.Main() in C:\Temp\Example\WindowsFormsApplication1\WindowsFormsApplication1\WindowsFormsApplication1\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Paul

0 Kudos
Message 39 of 48
(3,500 Views)
Hi Paul,
 
Can you please now display the loaded modules list like you did before? I just want to see which kernel DLLs are being loaded on your system.
 
Thanks
 
Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 40 of 48
(3,494 Views)