ISnappingEnvironment - ArcMap crash

482
2
04-20-2011 06:29 AM
JanBurdziej1
New Contributor II
Hi,
I have a tool which uses ISnappingEnvironment:

m_SnappingEnv = TryCast(My.ArcMap.Application.FindExtensionByName("ESRI Snapping"), ISnappingEnvironment)
m_Snapper = m_SnappingEnv.PointSnapper
m_SnappingFeedback = New SnappingFeedbackClass()
m_SnappingFeedback.Initialize(Hook, m_SnappingEnv, True)


It works fine at Windows XP but crashes (at line m_Snapper = m_SnappingEnv.PointSnapper) on another machine (with Win 7 and x86 CPU).
Any ideas what is the reason? There is no error, just ArcMap crashes.

Any help would be appreciated!
Jan
0 Kudos
2 Replies
JohnHauck
Occasional Contributor II
I saw another report of someone having a similar issue. For them finding the extension with the following made the difference. Please try the following:
   Dim snapper As IExtension
   Dim snapperID As UID = New UIDClass  
   snapperID.Value = "esriControls.Snapping"   
   snapper= app.FindExtensionByCLSID(snapperID)
   m_SnappingEnv = TryCast(snapper, ISnappingEnvironment)
0 Kudos
JanBurdziej1
New Contributor II
Hi,
You're right. I've checked that in run time m_SnappingEnv was Nothing. Changing to FindExtensionByCLSID resolved the issue. It seems that it had nothing to do with x86 / CPU, rather it was ArcGIS settings (?), i.e. on one machine "ESRI Snapping" was already activated and could be called by name, on another it had to be called by its ID.
Thanks for your help!
Best regards,
Jan
0 Kudos