Core.Dictionary What am I missing

I am using hasKey on a core.dictionary using a string.
String in debugger

Dictionary key in debugger

The hasKey check fails. This is the only occurrence of failure and all keys and comparison strings are built the same way.

Probably something simple but I’m not seeing it.

Could it be a type difference between Text vs. String?

I followed that path earlier but all the other keys match the string comparisons and they are all built in the same method.

[code] dim arsExistingChain(), sLinkTest, arsNewChain() as String

  if arsNewChain.Ubound < arsExistingChain.Ubound + 1 then
    
    DictRelations.Value(sLinkTest) = BuildJoinStrings(arsNewChain)
    
  end if
  
else
  
  DictRelations.Value(sLinkTest) = BuildJoinStrings(arsNewChain)
  
end if

end if[/code]

Just for grins you might want to try reverting to the old Dictionary to see if the problem goes away. If it does, there’s a mysterious bug in the new Dictionary class that will need to be addressed. If it doesn’t, at least you can eliminate the dictionary as the cause.


FWIW, I will on occasion (like maybe twice a year) get code that absolutely should work - usually a boolean comparison of some sort - and after I’ve pulled out my remaining hair and pull out a bottle of wine, I shut down Xojo, clear the cache, and do a machine restart.

One of two things happens. One, I will finally notice where my boneheaded mistake is; or Two, the boolean comparison starts working again.

three - notice the bottle of wine is empty and get another :stuck_out_tongue:

Grins worked. I wish I’d tried it before wasting half a day doubting my code. Overall I’ve had great luck with the new framework and am trying to use it whenever possible. I guess the lesson learned is to rule out the framework first then get back to self doubt :slight_smile:

The trick will be replicating it so the Xojo engineers can replicate it and fix it.

It sounds possible that this is the same issue that a handful of others have ran into, which is that Text and String values are treated as unique entities, regardless of their contents.

I’ve seen the code. Everything is a string.

The odd thing is it is only the one item in the dictionary that is affected. I do believe the dictionary thinks it is text because if you create the entry again using the same code into the same dictionary you end up with both values. I assume one is considered text and the other string.