View Full Version : Strange behaviour with square brackets.

01-05-2006, 08:35 AM
Hi there,

I'm using the MapPoint ActiveX through C# .NET.

MapPoint is throwing a COM Exception when I attempt to find a pushpin
by name, where the name is surrounded by square brackets.

ActiveMap.FindPushpin("[TestName]") => fails
ActiveMap.FindPushpin("Test[Name]") => fails
ActiveMap.FindPushpin("[TestName") => fails
ActiveMap.FindPushpin("Test[Name") => fails
ActiveMap.FindPushpin("]TestName[") => succeeds
ActiveMap.FindPushpin("TestName") => succeeds

Of course, the square brackets can easily be removed - just wondering
if anyone has seen this behaviour before or knows why it happens.

Actually what's interesting is that the first call to AddPushpin,
FindPushpin, etc with a "bad" name succeeds. All subsequent calls throw
a COM Exception.


Eric Frost
01-05-2006, 11:14 AM

This is an interesting finding. I am going to point it out to the program manager and try to see if he has any insight.


01-05-2006, 03:00 PM

dont use it (easey remedy) !

Blonde girl go to doctor and tell she hurst in all her body. Everywhere where she push it hurts. After a long investigation the doctor's diagnose was that her finger was broken ...

I hope you ar not blond :)

01-06-2006, 09:47 AM
No [Wilfried] I'm not blonde (sadly).

Of course I have added some replacement code for square brackets and that makes everything work fine (unfortunately I don't have control over the source of the square brackets.) But, of course it's a hack and I can see someone staring at the code 12 months down the line with madness in their eyes...

I guess, to stick with your analogy, I'd really like to know how the blonde managed to break her finger...

01-07-2006, 03:27 AM

I think the hack is probably only solution. I tryed some experiments like trying to escape it or so, but with no result. the '[' trows exception. Wierd.

btw: In fact I dont know how she broken her finger. Maybe while checking if she was ill and then pushing to hard :)