(SW 2017 SP2.0) When I try to use IExtrudeFeatureData2.LinkToThickness = True Solidworks crashes.

(SW 2017 SP2.0)

I am trying use the API to create a cut extrude in a sheetmetal part.  I want the cut extrude to "link to thickness".  When I try to use IExtrudeFeatureData2.LinkToThickness = True Solidworks crashes.  Is there a method that is more appropriate?

               Dim swSheetMetal As SldWorks.SheetMetalFeatureData

               'There is code that sets the swSheetMetal variable to the Sheetmetal feature definition

                'Sets the thickness value of the sheet metal to a variable.

                dblThk = swSheetMetal.Thickness

                'Creates a Cut Extrusion (blind - link to thickness)

                swModel.FeatureManager.FeatureCut True, False, False, 0, 0, dblThk, dblThk, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1

               

                'Captures the CutExtrusion feature that was just created and links the depth dimension to the thickness of the sheet metal.

                Set swFeature = swSelMgr.GetSelectedObject5(1)

               

                Dim extFeatData As ExtrudeFeatureData2

                Set extFeatData = swFeature.GetDefinition

              

               extFeatData.LinkToThickness = True  '<<>>

SolidworksApi macros