Attempted to read/write protected memory

Good Afternoon,

I have a VB.net program that has worked for several years that analyzes all dimensions of a drawing.

In a particular drawing, the system runs through 4 dimensions before it crashes with a

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt." error.

I have recently upgraded to solidworks 2015.

The DLL version is 23.4.0.56

Here is some code:

swDispDim = swView.GetFirstDisplayDimension5

swDim = swDispDim.GetDimension

swTol = swDim.Tolerance

if swTol.Type = Nothing Then  <--------------- On the fourth dimension, this is where the Read/Write error will occur, when trying to read the value of swTol.Type

Any Ideas?

Thank you very much for your time!

SolidworksApi macros