Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

VS2008 protected memory read exception

Are there any pointers as to where to look to try to find the root cause of this problem ?
0 Kudos
Message 11 of 48
(4,523 Views)

Hi Paul,

Have you already called into our support department and created a service request? If not, its probably best if we do this to have your issue on record in our support database.

If you could, please post a stack trace when the exception occurs. This will help tell us if the exception is being thrown in NI's libraries or the underlying Intel math libraries. To break execution when an exception is thrown:

1) In the Debug menu, click Exceptions.
2) In the Exceptions dialog box, select Thrown for the entire Common Language Runtime Exceptions category.

Then also enable unmanaged code debugging which I believe you can do by selecting Tools >> Options >> Debugging and highlighting the Just-In-Time category. Then check the Managed and Native options. 

Once the exception is thrown, get the stack trace and then post it.

Thanks

Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 12 of 48
(4,504 Views)
I've just tried to create a service request via email (never done before so I'm not sure if it's correct), but the stack trace isn't very enlightening

First-chance exception at 0x0022b7e0 in WindowsFormsApplication1.exe: 0xC0000005: Access violation.
A first chance exception of type 'System.AccessViolationException' occurred in NationalInstruments.Analysis.Enterprise.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

   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:\Users\pbrown\Documents\Visual Studio 2008\Projects\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs:line 41


so this would seem to not get down to the native level which may have something to do with the obfuscation employed by your assemblies.

Paul
0 Kudos
Message 13 of 48
(4,501 Views)

Hi Paul,

 

One option I wanted to try is to see if you happened to have a copy of LabWindows/CVI? CVI calls into the same analysis DLLs that Measurement Studio does and if we can successfully call the function from CVI without issue, it helps narrow down the issue.


If you don't have CVI, I could create a small CVI exe that you could run and test. You would just need to download the CVI Run-Time Engine.

 

Not sure if that's an option, but just a thought.

 

I'm also double-checking with a few of my co-workers to see if they have any thoughts about the issue as well.


Best Regards,

Jonathan N.
National Instruments
0 Kudos
Message 14 of 48
(4,492 Views)
I upgraded to the latest version a few weeks ago and rebuilding with these DLL's makes it work. However as this seemed number specific I was more concerned that a different set of numbers wouldn't just reintroduce the exception. I have CVI but it's also been upgraded to use the same version of DLL's that now work.

Paul
0 Kudos
Message 15 of 48
(4,491 Views)
I seem to be getting this error again (I'd stopped woring in 2008 until we'd released a client version but am back onto it now)

System.AccessViolationException occurred
  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 TWI.Crackwise.Stresses.GeneralWeightFunction.FitCurve(Double normaliser, Double thickness, String& error) in C:\develop\Crackwise V\Source\Crackwise\Stresses\GeneralWeightFunction.cs:line 122
  InnerException:


currently using
Common 8.1.20.415
Enterprise 8.1.20.472

Although I do have a copy of CVI installed my c is very rusty, so if you want me to test it could you send me a small code snippet to try it with, otherwise has anyone else reported anything like this ? It still seems machine specific as I have another dev machine which it's perfectly fine on using the same code.

Thanks

Paul
0 Kudos
Message 16 of 48
(4,243 Views)
Hi Paul,

I tried your code snippet on several other machnes as well as a Vista laptop and was still unable to reproduce the issue. The next step I want to try is providing you with a simple CVI application that does the same thing to see if you received a crash.  I'm not at a computer right now which has CVI but tomorrow I should be able to post a small example.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 17 of 48
(4,160 Views)
Hi Paul,

Attached is the equivalent CVI example that I would like you to run. It uses the same data and the same underlying DLL so I am expecting to see the some GPF or error occur when you run the code. 

If you have never used CVI before, just double-click on the workspace file (.cws) which will launch CVI. Then just click on the green run arrow or select Run >> Debug Project.

I built this in CVI 8.1.1 just in case you don't have CVI 8.5 which is our latest version out.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 18 of 48
(4,150 Views)
I have 8.5 and have just run it in there with no problems, so I went back to the test app to see what it was doing, it still however fails. I've just run it through windbg and the cvi one too to try and see if there were any different paths being used for the dll's but these seem find, unless you can see something strange below for the .net version
 
Paul
 
ModLoad: 76d70000 76e36000   C:\Windows\system32\ADVAPI32.dll
ModLoad: 75e90000 75f53000   C:\Windows\system32\RPCRT4.dll
ModLoad: 75de0000 75e38000   C:\Windows\system32\SHLWAPI.dll
ModLoad: 75e40000 75e8b000   C:\Windows\system32\GDI32.dll
ModLoad: 76f50000 76fed000   C:\Windows\system32\USER32.dll
ModLoad: 77520000 775ca000   C:\Windows\system32\msvcrt.dll
ModLoad: 774c0000 774de000   C:\Windows\system32\IMM32.DLL
ModLoad: 76ff0000 770b8000   C:\Windows\system32\MSCTF.dll
ModLoad: 774e0000 774e9000   C:\Windows\system32\LPK.DLL
ModLoad: 76bc0000 76c3d000   C:\Windows\system32\USP10.dll
ModLoad: 74960000 74afe000   C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\comctl32.dll
ModLoad: 79e70000 7a3ff000   C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
ModLoad: 717d0000 7186b000   C:\Windows\WinSxS\x86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_d08b6002442c891f\MSVCR80.dll
ModLoad: 75f60000 76a6f000   C:\Windows\system32\shell32.dll
ModLoad: 77110000 77254000   C:\Windows\system32\ole32.dll
ModLoad: 790c0000 79bf6000   C:\Windows\assembly\NativeImages_v2.0.50727_32\mscorlib\5b3e3b0551bcaa722c27dbb089c431e4\mscorlib.ni.dll
ModLoad: 74c60000 74c9f000   C:\Windows\system32\uxtheme.dll
ModLoad: 79060000 790b6000   C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll
ModLoad: 7a440000 7ac2a000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System\267d4c344058092e6950c11594244f90\System.ni.dll
ModLoad: 7ade0000 7af7c000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Drawing\a35f567c4c67d6b1ca9a0023852847a2\System.Drawing.ni.dll
ModLoad: 7afd0000 7bc6c000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Windows.Forms\45ee94a63c463b93e3ff694c6ecd0820\System.Windows.Forms.ni.dll
ModLoad: 5d7d0000 5dc9a000   System.Windows.Forms.dll
ModLoad: 64890000 6498c000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Configuration\15366cc16c2550064601b5167821667d\System.Configuration.ni.dll
ModLoad: 637a0000 63d28000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Xml\02cf61328d59df9b3ec09544f449a781\System.Xml.ni.dll
ModLoad: 73e40000 73feb000   C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6001.18000_none_9e752e5ac9c619f3\gdiplus.dll
ModLoad: 772f0000 77374000   C:\Windows\system32\CLBCatQ.DLL
ModLoad: 77260000 772ed000   C:\Windows\system32\OLEAUT32.dll
ModLoad: 67c60000 67c9c000   image67c60000
ModLoad: 00f80000 00fbc000   image00f80000
ModLoad: 74fe0000 7501b000   C:\Windows\system32\rsaenh.dll
ModLoad: 67c60000 67c9c000   C:\Windows\assembly\GAC_32\NationalInstruments.Analysis.Enterprise\8.1.20.377__4544464cdeaab541\NationalInstruments.Analysis.Enterprise.dll
ModLoad: 74f00000 74f08000   C:\Windows\system32\VERSION.dll
ModLoad: 6ba20000 6ba52000   image6ba20000
ModLoad: 010d0000 01102000   image010d0000
ModLoad: 6ba20000 6ba52000   C:\Windows\assembly\GAC_MSIL\NationalInstruments.Common\8.1.20.415__4544464cdeaab541\NationalInstruments.Common.dll
ModLoad: 65f20000 66b14000   C:\Windows\assembly\NativeImages_v2.0.50727_32\System.Web\369cdfcbaefd8f28200e295c26c2141f\System.Web.ni.dll
ModLoad: 75380000 753c5000   C:\Windows\system32\bcrypt.dll
ModLoad: 10000000 100d6000   C:\Program Files\National Instruments\Shared\Analysis\nianlys.dll
ModLoad: 03dd0000 03e06000   C:\Program Files\National Instruments\Shared\MKL\MKL70\libguide40.dll
ModLoad: 044f0000 04721000   C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_def.dll
ModLoad: 04730000 049e4000   C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p3.dll
ModLoad: 049f0000 04d46000   C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4.dll
ModLoad: 04d50000 05089000   C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_p4p.dll
ModLoad: 05090000 052ab000   C:\Program Files\National Instruments\Shared\MKL\MKL70\mkl_lapack64.dll
(11f4.1648): Access violation - code c0000005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=002fdf10 ebx=00000019 ecx=04404528 edx=002fe570 esi=04403e08 edi=002f8efc
eip=002fb708 esp=002f8e38 ebp=002fe56c iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010206
002fb708 57              push    edi
0 Kudos
Message 19 of 48
(4,146 Views)
Does anyone have any ideas of what is wrong with this.

Are pdb files available to find out where the problem is (presumably somewhere in the .net assemblies as the Labwindows version is fine), or because you obfuscate your dll's is this impossible ?

Paul
0 Kudos
Message 20 of 48
(4,057 Views)