Customer Service | Training | Contact Us
You are here: Home > User Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcObjects 3rd Party IDE (C++, VB, C#, Delphi, etc.) forum

Extension item template bug in IDE Integrat...   Ken Buja Jun 12, 2007
Re: Extension item template bug in IDE Inte...   Ken Buja Jul 19, 2007
Re: Extension item template bug in IDE Inte...   Michael Parry Aug 22, 2007
Re: Extension item template bug in IDE Inte...   Eager Ip Aug 27, 2007
Report Inappropriate Content • Top • Print • Reply    
Subject Extension item template bug in IDE Integration Framework for VS 2005? 
Author Ken Buja 
Date Jun 12, 2007 
Message I'm using the item template for creating an extension in my project which automatically generates code below for setting the State property. However, when testing it in debug mode, I can't enable my extension in the Tools|Extensions dialog. The code never gets past the first line in Set:

If m_enableState <> 0 Or value = m_enableState Then Exit Property

The variable m_enableState is a esriExtensionState constant with three possible values of 1 (enabled for use), 2 (disabled by the user) or 4 (unavailable - not licensed). This if statement will always exit the property since m_enableState will never be 0.

What's the purpose for this line in the code? 
 
Public Property State() As ESRI.ArcGIS.esriSystem.esriExtensionState Implements ESRI.ArcGIS.esriSystem.IExtensionConfig.State
    Get
      Return m_enableState
    End Get
    Set(ByVal value As ESRI.ArcGIS.esriSystem.esriExtensionState)
      If m_enableState <> 0 Or value = m_enableState Then Exit Property

      'Check if ok to enable or disable extension
      Dim requestState As esriExtensionState = value
      If requestState = esriExtensionState.esriESEnabled Then
        'Cannot enable if it's already in unavailable state
        If m_enableState = esriExtensionState.esriESUnavailable Then
          Throw New COMException("Cannot enable extension")
        End If

        'Determine if state can be changed
        Dim checkState As esriExtensionState = StateCheck(True)
        m_enableState = checkState
      ElseIf requestState = esriExtensionState.esriESDisabled Then
        'Determine if state can be changed
        Dim checkState As esriExtensionState = StateCheck(False)
        If (m_enableState <> checkState) Then m_enableState = checkState
      End If
    End Set
  End Property
 
  Ken Buja

National Oceanic and Atmospheric Administration
1305 East-West Highway, N/SCI1
Silver Spring MD 20910-3281
(301) 713-3028 x140
ken.buja@noaa.gov 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Extension item template bug in IDE Integration Framework for VS 2005? 
Author Ken Buja 
Date Jul 19, 2007 
Message I talked to Kevin Deege from ESRI about this while at this year's User Conference. I recently received an email from him about this:

"The code logic seems to be wrong; I agree with you. I don't see a case for the use of this line. I've requested some feedback from the developer responsible to see if it will be fixed in a subsequent release of the software." 
  Ken Buja

National Oceanic and Atmospheric Administration
1305 East-West Highway, N/SCI1
Silver Spring MD 20910-3281
(301) 713-3028 x140
ken.buja@noaa.gov 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Extension item template bug in IDE Integration Framework for VS 2005? 
Author Michael Parry 
Date Aug 22, 2007 
Message Hello,

I noticed this exact same thing and I thought I was losing my mind! I beleive it is an error in the sample code. I commented out the line,

"If m_enableState <> 0 Or value = m_enableState Then Exit Property"

and it seemed to work as predicted after that. I don't know why it worked or what other ramifications resulted, though. I abandoned work with this interface because the project requirements changed and I no longer needed to implement it. Wish I could tell you more about it but I'm new to VB.NET and I'm still feeling my way in the dark...

Cheers,
Michael
 
  Michael Parry
GIS Specialist
AAFC 
   
Report Inappropriate Content • Top • Print • Reply    
Subject Re: Extension item template bug in IDE Integration Framework for VS 2005? 
Author Eager Ip 
Date Aug 27, 2007 
Message The line of code should be changed from
"If m_enableState <> 0 Or value = m_enableState Then Exit Property"

to

"If m_enableState <> 0 And value = m_enableState Then Exit Property"

Note that this mistake is not present in the C# version of the template.

Regards, 
  Eager Ip
ESRI