By Design bugs - Coding Sanity
Sunday, July 05, 2009 2:47 PM codingsanity

By Design bugs

Next time you wonder to yourself why a bug exists in Microsoft software, consider the possibility that Microsoft simply want it that way. Some time ago, I wanted to compare two XML documents. Growing despondent about the idea of writing such a system myself, I cast around for options, and encountered the XNodeEqualityComparer. I was thrilled, and made use of it throughout my code.

Some time later I started encountering problems. It seemed that the comparer was marking documents that were identical as being different. When we investigated, we found that this comparer was failing on two main issues. This first was the closing style of tags. It was picking up these two fragments as different:

<setting></setting>

<setting/> 

I must admit I was a bit surprised. Virtually no software that I am aware of sees these two as different, although they are very slightly different according to the W3C specification. This was annoying, but not a complete show stopper. The next error was a little more of a problem. It seems that the XNodeEqualityComparer also picks up attribute ordering as making the documents different.

Thus it would see these two fragments as different:

      <setting name="DefaultFileAcquisitionFolderPath" serializeAs="String">

      <setting serializeAs="String" name="DefaultFileAcquisitionFolderPath">

Now, this one was a killer for me. Our XML was coming from various systems and they had slight differences in their attribute ordering. We could do nothing about these differences whatsoever. I logged the issue with Microsoft, wrote a workaround and forgot about it. After a short while it came back that they wouldn't fix it, they pretty much said that their implementation was correct. This startled me, since I was pretty sure that XML attribute ordering means absolutely nothing. I did some investigation and found this part of the W3C Specification section 3.1:

[Definition: The beginning of every non-empty XML element is marked by a start-tag.]

Start-tag

[40]    STag    ::=    '<' Name (S Attribute)* S? '>' [WFC: Unique Att Spec]
[41]    Attribute    ::=    Name Eq AttValue [VC: Attribute Value Type]
[WFC: No External Entity References]
[WFC: No < in Attribute Values]

The Name in the start- and end-tags gives the element's type. [Definition: The Name-AttValue pairs are referred to as the attribute specifications of the element], [Definition: with the Name in each pair referred to as the attribute name ] and [Definition: the content of the AttValue (the text between the ' or " delimiters) as the attribute value.] Note that the order of attribute specifications in a start-tag or empty-element tag is not significant.

Please re-read that last line: "Note that the order of attribute specifications in a start-tag or empty-element tag is not significant."

Accordingly, I recreated the bug report (since there is no way to request one to be reopened), and included the above information. In the arguments that followed I pointed out that despite all the code that XNodeEqualityComparer calls (specifically the abstract DeepEquals on XElement), it to all intents and purposes does the following:

string value1 = node1.ToString();
string
value2 = node2.ToString();

return value1 == value2;

 

Which makes me wonder what point XNodeQualityComparer has? It ignores the XML specification, ignores how XML itself works and provides no value over a simple ToString. In order to do this it has a great deal of code that is completely and utterly pointless.

 

My last communication from Microsoft before they closed the bug as By Design was the following:

Hi Sean,

This is by design.XNodeEqualityComparer was not designed to stricly adhere to the xml spec.Most people expect attribute ordering to be significant and hence XNodeEqualityComparer was designed that way.

thanks
Nithya Sampathkumar
Program Manager

So, there you have it. If you're using XML and are wondering why the results you're getting are not the same as what the specification says you should be getting, the answer is simple. Microsoft write their code to fit people's expectations of what the specification says rather than what it actually says. I was also a little taken aback about their assertion that most people consider attribute ordering to be significant. When I asked around no-one seemed to.

So, a question to you all: do any of you consider XML attribute ordering significant when comparing documents for equality?

Update: Well, the answer seems to be an overwhelming no, both here and in the reddit thread, so I'm confused about where Nithya gets her "Most people".

Anyway, I have created a little class that implements an XML comparison more, ahem, correctly than Microsoft's. I have also created a byte comparison which shows that Microsoft's implementation is virtually the same as a text compare, but twice as slow. You can read about it here.

Filed under: , ,

Comments

# re: By Design bugs

Sunday, July 05, 2009 7:36 PM by Jonathan Allen

> do any of you consider XML attribute ordering significant when comparing documents for equality?

I do when I'm comparing documents. I don't when I'm reading documents.

Attribute ordering shouldn't matter for semantic equality, true. But semantically speaking a="12.5" and a="12.5000" should also be equal. But when dealing with some people's broken XML parsers, this stuff matters.

# re: By Design bugs

Sunday, July 05, 2009 7:53 PM by XMHell

"So, a question to you all: do any of you consider XML attribute ordering significant when comparing documents for equality?"

No.

# re: By Design bugs

Sunday, July 05, 2009 8:29 PM by Paul Betts

Even if he agreed with it, there's no way to change something as fundamental as an equality comparator once we've released it - software will inevitably rely on the current behavior, and "fixing" it will break someone. There's no ".NET AppCompat Shim" framework, so unfortunately we're stuck with it. FWIW, I definitely agree that ignoring order would be much more useful in real-world scenarios.

# re: By Design bugs

Sunday, July 05, 2009 8:29 PM by M. Howard

As a developer, I expect attribute order to be insignificant.  If I wanted a string compare, I already have string compare.

# re: By Design bugs

Sunday, July 05, 2009 8:30 PM by lollan

Hi,

This is extraordinary, it is so not logical that I really hesitated.

To be able to justify the disrespect of standards by the sentence :

"Most people expect attribute ordering to be significant and hence XNodeEqualityComparer was designed that way."

It's for things like that I tend for important project to do all the critical stuff by myself, now I have to be careful while using .NET because they don't respect standards...

To get back on the subject and reply to your question : I respect the standard so no ordering is not relevant.

Thanks for sharing.

# re: By Design bugs

Sunday, July 05, 2009 8:54 PM by Collin

"Microsoft write their code to fit people's expectations  of what the specification says rather than what it actually says."

It's even worse than that. I'd bet a million dollars that they did no quanitfiable research to discover what people's expecations really are. They're actually writing code to fit their own expectations of what people's expectations are.

# re: By Design bugs

Sunday, July 05, 2009 8:59 PM by Scott

I dontt know, should it be significant?  Let me check the spec...

Oh wait.

# re: By Design bugs

Sunday, July 05, 2009 8:59 PM by Microsoft Sucks

Not at all.  Microsoft is just being lazy.

# re: By Design bugs

Sunday, July 05, 2009 9:06 PM by Josef Assad

I follow the spec. The spec says not significant, that's how I do it. I know no one who thinks it should be significant.

As a matter of fact, I don't think that spec could even have been released if attribute order was significant. It just isn't intuitive for order to count for anything.

# re: By Design bugs

Sunday, July 05, 2009 9:06 PM by John.H

Pouncing on Nithya's grammar, most people also expect that a space shall follow any period that demarcates the end of a sentence.

Perhaps they implemented this by using a string compare on the toString() output.  Makes sense to me!

# re: By Design bugs

Sunday, July 05, 2009 9:11 PM by Mud Kips

So now Microsoft employs indian "engineers" too. GG.

# re: By Design bugs

Sunday, July 05, 2009 9:25 PM by Nope

It's unlikely that MS will change. But you should try to send in a feature request for a less strict method of comparison.

XNodeEquivalenceComparer or something

# re: By Design bugs

Sunday, July 05, 2009 9:30 PM by Reader Experienced with Things Microsoft

I'm glad this is coming to people's attention. It is is something I've known for a long time.

If you ever get to a point when dealing with anything Microsoft where you just can't figure out why something doesn't work, you can follow a basic rule of thumb: you need to do things the way the average user would do it. You can't approach it especially cleverly. By inference, Microsoft's development process is like this: (1) define problem, (2) do user testing to see how people naturally try to solve problem, (3) create something so that what the average person tries actually works but if a person tries it some other way it will fail (4) Stop.

If that information does not solve your Microsoft-related problem, you can go through the following list in order, because it will always work: reboot, turn off the antivirus, reinstall over the top of existing install, rebuild system from scratch, wait until a bug fix is released, pay Microsoft more money, and, finally, recognize that this is the kind of thing that a Microsoft product will never do.

Take the following case in point. Let's say there is a computer with some serious problem. It is refusing to work. It is a problem with the operating system. It won't boot up. If you reboot the system 10 times in a row, it should refuse to boot up each time. Yet, that is sometimes not true with a Microsoft Windows system. This is because Microsoft must have done user testing that found that people would reboot their computer over and over again when it stopped working. Each time there is an unsuccessful boot attempt of Windows, a counter incremeents. If the counter gets to roughly 10, the Windows system actually will boot differently in a very conservative way. Oftentimes, that finally works. Yet, as a computer expert who wants to get paid by people who do not understand computers, explaining that you fixed their system by rebooting it 10 times in a row is usually not something that will result in repeat business. This makes it very difficult to be a computer professional in a world of Microsoft products. Your expertise and authority are constantly being undermined by Microsoft's dumbing-down process. The reward of stupidity is a working computer, according to the Microsoft way.

# re: By Design bugs

Sunday, July 05, 2009 9:34 PM by Beau Gunderson

You should check out the source for XNodeEqualityComparer and see if there are any other gems. :)

# re: By Design bugs

Sunday, July 05, 2009 9:39 PM by Adam Wright

I can categorically say that I don't expect attribute ordering to be significant in XML documents, and that this attitude from Microsoft doesn't surprise me.

To try and salvage some reason for the choice, it may be due to the unusual attribute handling specification in DOM Core Level 1 . The structure storing attributes of an element is the NamedNodeMap (www.w3.org/.../level-one-core.html), which (as expected) is a mapping from names to values.  However, the interface also specifies a length for the map *and* an "item" call that returns the nth item. The usefulness of this call is entirely dependent on a stable ordering for attributes, which nothing else in the standard mandates (and indeed, explicitly eschews when saying that "NamedNodeMaps are not maintained in any particular order").

Not that this forgives what seems to be laziness, but it's a slightly-reasonable justification.

# re: By Design bugs

Sunday, July 05, 2009 10:09 PM by Justin Yost

Let's go with no way would order be important.

# re: By Design bugs

Sunday, July 05, 2009 10:13 PM by Bob

What happened to the tried and true Microsoft practice of adding another argument specifying which matching option to use... :)

# re: By Design bugs

Sunday, July 05, 2009 10:18 PM by Tim

Most people that write software using Microsoft tools are this stupid, yes.  If you want to use tools that are less stupid, stop using Windows.

# re: By Design bugs

Sunday, July 05, 2009 10:24 PM by Ray

That's a tricky question. I think it depends on what "equality" and "significant" mean. A "Not significant" difference is not quite the same as no difference. Though I admit the justice of your interpretation.

I wouldn't expect a strict equality operator to report 1.0 and 1.000000000000000000000000000000000000001 to be equal, even if the difference were deemed "not significant" (indeed, the definition of "significance" is mathematically precise, and still I wouldn't expect it to return true).

If the function were "XNodeEquivalenceComparer", then I'd expect a "true". I'd also expect it to be slow.

Also, your comment about ToString is interesting. If ToString should return different strings for those 2 different nodes, I would expect an == operator to return false for them. Otherwise one would have to argue that ToString should normalize the parameters somehow.

And, no, they aren't the same function either, as a direct equality function is doubtlessly much more time and space efficient than a pair of ToString's followed by a string compare. In a large document that difference is likely significant :-).

# re: By Design bugs

Sunday, July 05, 2009 10:29 PM by laziness

blabla > laziness and shame . comma

go go go ooo and free software ;-)

put the presure

and win

# re: By Design bugs

Sunday, July 05, 2009 10:39 PM by Hans

> do any of you consider XML attribute ordering significant when comparing documents for equality?

Of course. This is such a self-evident concept to XML, that it didn't even occur to me that anyone would be confused on this point - and, even for those who might not quite grasp all the concepts of xml, would have enough sense not to say something that might be embarrassing.

So, either Nithya is giving a careless response, or there is something they know that we don't... or maybe he doesn't know what he's talking about. Who knows...

# re: By Design bugs

Sunday, July 05, 2009 10:52 PM by Alex N

"Microsoft write their code to fit people's expectations  of what the specification says rather than what it actually says."

I think that should be, "Microsoft writes their code to fit Microsoft's expectations of people's expectations  of what the specification says rather than what it actually says."

# re: By Design bugs

Sunday, July 05, 2009 11:02 PM by codingsanity

I'm having a slight problem with comments. They're supposed to be coming through immediately, but for some reason they're waiting for approval even though I have moderation switched off.

So, if your comment doesn't appear immediately, be patient, I will try and get to it at some point.

# re: By Design bugs

Sunday, July 05, 2009 11:40 PM by sunchin

by default, no, attribute ordering should not be significant when comparing xml docs for equality.  if it is present it should be a configurable Property/flag.

strange.

# re: By Design bugs

Sunday, July 05, 2009 11:52 PM by Graham

I'm interested in what else their code considers to be "not significant"...

Do comments in one document and not in the other make a difference to the comparison? Do namespace aliases make a difference? Does whitespace between tags matter? Or between attributes in a tag?

I'd personally say that the whitespace between tags matters, but none of my other suggestions. I've not checked in the spec so I don't know offhand if I'm right here, and I've also no idea about Microsoft's idea of how significant these are...

# re: By Design bugs

Monday, July 06, 2009 12:27 AM by joost

When digitally signing xml documents, you sign a canonicalized version of the document for precisely this reason.Attribute order is significant in this case.

# re: By Design bugs

Monday, July 06, 2009 1:09 AM by Raziel

Considering XML attribute order is stupid, disgusting and morally wrong.

# re: By Design bugs

Monday, July 06, 2009 1:26 AM by JulioHM

As you can see, you are not alone.

Microsoft has a bad habbit of refusing to fix bugs by shouting "By Design" --- but then again... so many other companies out there do the same.

It's annoying, since you are paying for support, and although extreme, this is not the only case.

All in all, you are more than correct. XML was created to represent data, and carry its meaning around the network. It's like stating:

3 + 2 = 5

2 + 3 = 5

Of course, they look different, but they mean the exact same thing. XML was created to convey that exact meaning over the pipe.

As M. Howard pointed out as one of the first to comment: "As a developer, I expect attribute order to be insignificant.  If I wanted a string compare, I already have string compare."

# re: By Design bugs

Monday, July 06, 2009 1:26 AM by Luther Vandross

There is one significant scenario where attribute ordering is significant: digital signature. Yes, I know canonicalizAtion is supposed to address that. But I wonder if their design decision had anything to do with making that "easy".

# re: By Design bugs

Monday, July 06, 2009 2:27 AM by Simon

"So, a question to you all: do any of you consider XML attribute ordering significant when comparing documents for equality?"

No.

# re: By Design bugs

Monday, July 06, 2009 2:41 AM by Beren

Add XNodeRealEqualityComparer so nothing breaks...

# re: By Design bugs

Monday, July 06, 2009 3:10 AM by Samus_

this is a terrible problem, I understand the ideology behind "people just want it to work" I've had to deal in the past with countless non-conforming pages and servers (screen scraping) and dealing with the other side is almost always a real pain so most of the time we just workarounded the problem on our side; that of course applies to us as a USER it shouldn't ever apply to our tools.

I fully blame Microsoft's laziness on this, because yes they might be interested in providing a "compatibility mode" for their product but that should be optional and disabled by default, not being the only choice available.

# re: By Design bugs

Monday, July 06, 2009 5:28 AM by Paul Keeble

This is just the way companies are about fixing their bugs. WebLogic gave me a similar experience with bugs related to their CMS system, that caused very harmful performance problems (that I had fixed in their decompiled code for them and given them the solution!).

Any company that charges for the right to submit bug reports is not going to take bug reports very seriously.

# re: By Design bugs

Monday, July 06, 2009 7:31 AM by ddrt

I was going to answer that question but my computer crashed from an internal error... now I'm on my mac and it's letting me get the word out!

# re: By Design bugs

Monday, July 06, 2009 9:25 AM by Chris

"there's no way to change something as fundamental as an equality comparator once we've released it - software will inevitably rely on the current behavior"

...or you could add an additional function parameter that specifies "follow w3c specification rules" - defaulting to "no".

# re: By Design bugs

Monday, July 06, 2009 9:27 AM by Chad Wilson

I haven't used that tool and am not sure what it's mostly used for, but my argument would be that if it's used mostly as a simple text comparison tool, then it should treat the two items as different, but if it's meant to compare the XML data, then it should treat them equally. Perhaps the tool should have an option to compare text or compare XML.

# re: By Design bugs

Monday, July 06, 2009 12:42 PM by Darryl G

Weighting the order of attributes within an XML node is much like weighting the order in which class variables are declared in the source code of a .cs file when determining whether two class structures offer the same representation or not. It's a ridiculous concept and leaves me feeling a little bit sadder and a lot more angry than usual.

However, that being said, the bug probably came about as a result of a severe programming flaw that slipped past whatever MS use for a QA department. Retrofitting a fix into production code, where a developer may have been ingorant (too lazy to read) of the specification and relied on this "feature" somehow, would be nigh impossible and could lead to more support calls than the business deems viable.

If I were MS I wouldn’t be too keen on fixing it either for a number of reasons.

1. It admits fault and that would be unacceptable for MS. This does seem ridiculous when you consider the damage that their marketing dept. have done to their corporate image over the last two years.

2. It costs resource time, a massive refactoring project and the logistical effort of applying patches over Windows Update.

3. It isn’t mission critical as the problem can be circumvented by implementing massive document reformatting pipelines to order attributes in their declared order within the document DTD.

4. Not enough people are making a noise about it to pry the developers away from all the hype-generating new technologies that MS are doubtlessly working on.

It's a hard reality, but these are the things that we need to learn to live with when dealing with an MS implementation of an open standard.

# re: By Design bugs

Monday, July 06, 2009 1:04 PM by codingsanity

Due to the interest in this, I've written a little library to do the comparison more flexibly. It is based on the way that the MS code works, and shows how little effort is required to make such a comparison work, it comes to just over 40 SLOC.

I will blog about it soon, but in the meantime it is available if anyone wants it. Currently it is pretty much untested or profiled though.

# re: By Design bugs

Monday, July 06, 2009 2:05 PM by Abdul

@ Mud Kips: Not just Microsoft, but Apple, Intel, Oracle, Google and HP as well. Are you feeling threatened?

# re: By Design bugs

Monday, July 06, 2009 3:44 PM by Some Guy

I found the same type of thing from Microsoft when doing some UDP  network applications in XP. If your application sends out UDP packets that are over the MTU set in a Windows environment, unexpected behavior can occur on the receiving end.  

If the receiving host doesn't have the sending host in the ARP cache (ie, it's the first time it's ever received anything from them), it will automatically drop UDP packets while waiting for the ARP table to be propagated.  So your application has a message that is fragmented into 2 UDP packets,  the OS will just drop the first one and keep the second until your ARP cache has been primed.  I know UDP has no guarantee of service but there is nothing in any standard that says to drop the packet.  

If i want to send something lazily over UDP, I should be able to without the OS interfering.

There's a KB article: support.microsoft.com/.../233401

It says it complies with the standard of keeping one packet, but why delete?  It was a hassle to send out heartbeat messages everytime I wanted to send out something over UDP.

I know it wasn't the best design using UDP, but it was a customer requirement that couldn't be changed.

# re: By Design bugs

Monday, July 06, 2009 4:07 PM by Adam

No.

What Microsoft's describing is what a string compare is for, not an XML compare. I expect <attribute="15.50/> to be equal to <attribute="15.5"></attribute>

A string compare would (and should) come back as not equal, but an XML compare should come back equal, since from an XML point of view they are one and the same.

# re: By Design bugs

Monday, July 06, 2009 4:07 PM by Adam

No.

What Microsoft's describing is what a string compare is for, not an XML compare. I expect <attribute="15.50/> to be equal to <attribute="15.5"></attribute>

A string compare would (and should) come back as not equal, but an XML compare should come back equal, since from an XML point of view they are one and the same.

# re: By Design bugs

Monday, July 06, 2009 4:29 PM by Neil

To join in the Chorus... NO!!! Of course order is not significant. I wonder if they screwed up other irrelevant differences, such as the case of the attribute name? What about the same order and case, but varying numbers of spaces between attribute names? If it fails on these tests, then you can bet that the code is a straight string compare.

Anyway, I can forgive the bug, it's no big deal, but to say that they ain't gonna fix it, and then for someone to say 'it would break existing code' to fix it, well that's just appalling.

It would break nothing to add a new method to do it properly, leaving existing code intact and giving new code a chance to do it right.

Personally, I doubt very much that any developer would code it this way by choice - if you were writing it, you would realise it's just a string compare and you would tell your manager about it.

Instead, I think what happened is that it was implemented correctly, but then there was a mad panic about performance and in the subsequent review some genius realised they could replace the whole method with a string compare, so they did exactly that.

Their explanation that there was some discussion about what a user would expect from this method is laughable, I doubt more than one person put any thought into it.

# re: By Design bugs

Monday, July 06, 2009 4:40 PM by Joe

This is ridiculous on the part of Microsoft. The points you make in this article are right on - well done!  I see this as a systemic problem with MS reminiscent of their Internet Explorer 'unique' behaviors.  Gotta love companies dumbing down/ignoring standards.

# re: By Design bugs

Monday, July 06, 2009 4:40 PM by Joe

This is ridiculous on the part of Microsoft. The points you make in this article are right on - well done!  I see this as a systemic problem with MS reminiscent of their Internet Explorer 'unique' behaviors.  Gotta love companies dumbing down/ignoring standards.

# re: By Design bugs

Monday, July 06, 2009 4:52 PM by Gigaplex

"I expect <attribute="15.50/> to be equal to <attribute="15.5"></attribute>"

I disagree with that particular case. 15.50 and 15.5 mean 2 different things to me - while it is interpreted as the same value while reading, the extra decimal point in 15.50 conveys some implied precision advantage. Let's say some software was writing 15.513 to XML using either 1dp or 2dp. One will go to 15.5 and the other to 15.51. Next entry is 15.504, which is written as 15.5 and 15.50. Treating these as equivalent suggests that 15.513 is equivalent to 15.504, which is false if your precision is 2dp.

# re: By Design bugs

Monday, July 06, 2009 5:07 PM by Lance Fisher

I don't consider them the same.  It seems so hit and miss when you dig some method out of the BCL.  Some are gems, others are just dirt like this.

# re: By Design bugs

Monday, July 06, 2009 5:11 PM by MikeyTG

Of course attribute ordering does not matter. You don't even need to see the spec to understand this, why go to the trouble of naming the attributes if they have to appear in a specific order?

Everyone expects there to be one space between elements, does the compare blow up if it sees a different number of spaces in one document? I guess MS says yes!

# re: By Design bugs

Monday, July 06, 2009 5:15 PM by bshock

Isn't M$ already famous for screwing over standards in a way?  Isn't their "embrace and extend" doctrine just a strategic variation on this?  Start with the standard, then add things outside the standard until your users are stuck in M$-only land.

# By Design - Adam Haile

Monday, July 06, 2009 5:37 PM by By Design - Adam Haile

Pingback from  By Design - Adam Haile

# re: By Design bugs

Monday, July 06, 2009 5:38 PM by steamer25

Simple solution: Create XNodeEqualityComparer2 with correct implementation. Deprecate XNodeEqualityComparer and document the difference. People who integrate the incorrect implementation do not break and everyone else gets something useful.

# re: By Design bugs

Monday, July 06, 2009 5:39 PM by Tim

I agree that attribute order should be insignificant. If it helps any, you might consider implementing your comparison using canonical XML byte-streams, which you can generate using

XmlDsigC14NTransform. This isn't as elegant as the node comparer, on the other hand, it might work correctly.

# re: By Design bugs

Monday, July 06, 2009 5:49 PM by Brian

Two interpretations... both valid in a given context.  Sounds like there should be an optional parameter to XNodeEqualityComparer to indicate if attribute order is considered significant.

If a Spec's implements a Standard.. well sort of; what are expectations as to how/what differences are communicated?

# re: By Design bugs

Monday, July 06, 2009 5:50 PM by Brian

Two interpretations... both valid in a given context.  Sounds like there should be an optional parameter to XNodeEqualityComparer to indicate if attribute order is considered significant.

If a Spec's implements a Standard.. well sort of; what are expectations as to how/what differences are communicated?

# re: By Design bugs

Monday, July 06, 2009 6:09 PM by Fabio Maulo

IMO it is a bug.

Btw you shouldn't take Microsoft as only one entity. Microsoft has different teams and each team should be considered as a stand-alone entity. For example a like how work the .NET team, MEF team, ASP.NET MVC team, a very little bit EntityFramework team, but I don't like MsSQL team.

# re: By Design bugs

Monday, July 06, 2009 6:12 PM by Fabio Maulo

Perhaps a good proposal is:

Equal can stay as is (compare the "full" equality)

Improvement request:

node.Equivalent(nodeToCompare)

# re: By Design bugs

Monday, July 06, 2009 6:25 PM by Chris

Really?

If it worked the other way, you would be just as upset. Quit being a hater.

Support Fabio Maulo's idea instead of being an extremist.

Improvement request:

node.Equivalent(nodeToCompare)

# re: By Design bugs

Monday, July 06, 2009 7:10 PM by Josh

They over engineered the == operator? Except it ignores whitespace right?

# re: By Design bugs

Monday, July 06, 2009 7:14 PM by Raytracer

First, Nithya's a female name, so people should stop referring to her as 'he'.

And Mud Kips, if Microsoft don't want to follow standards, you can blame them. I'm pretty sure they hire the best of programmers, and your comment about Indian engineers was totally unwarranted.

# re: By Design bugs

Monday, July 06, 2009 7:15 PM by Jason

Being a hater? They are blatantly ignoring the spec. On the other hand I would agree that they could at the very least add node.Equivalent() or something similar although that is still just sad. What is to be expected though? Microsoft has been ignoring or "improving on" most W3C specifications anyway.

# re: By Design bugs

Monday, July 06, 2009 7:20 PM by Allan

Semantically they are equivalent, so I think it's a but.  As to what most customers expect; there should be a option to toggle such "features" on or off.  

Yeah I know it's bloat but nothing compares to hiding Flight Simulator inside Excel.

# re: By Design bugs

Monday, July 06, 2009 9:07 PM by Hank

Thought:

Does writing out XML using MS' toolkit change the attribute ordering?  If so, then why not write out both files first and compare those- you would then have two valid files.

# re: By Design bugs

Monday, July 06, 2009 9:53 PM by Scott

"I expect <attribute="15.50/> to be equal to <attribute="15.5"></attribute>"

"I disagree with that particular case. 15.50 and 15.5 mean 2 different things to me - while it is interpreted as the same value while reading, the extra decimal point in 15.50 conveys some implied precision advantage. Let's say some software was writing 15.513 to XML using either 1dp or 2dp. One will go to 15.5 and the other to 15.51. Next entry is 15.504, which is written as 15.5 and 15.50. Treating these as equivalent suggests that 15.513 is equivalent to 15.504, which is false if your precision is 2dp."

Both of you are wrong. :-)

You're both assuming that "15.5" and "15.50" are numeric values. They might not be; they could be Dewey Decimal, or strangely formatted order numbers, or even a period-delimited list of the number of turnips I have in each row of my garden.

In the absence of semantic information, "15.5" and "15.50" must be considered different values.

That said, attribute order being treated as significant for comparison purposes is a bad idea.

# re: By Design bugs

Monday, July 06, 2009 9:55 PM by Pipo

@Paul Betts:

QUOTING YOU: '...and "fixing" it will break someone.'

Maybe you should try this thing called versioning?

# By Design bugs - Sean Hederman

Tuesday, July 07, 2009 1:58 AM by DotNetShoutout

Thank you for submitting this cool story - Trackback from DotNetShoutout

# The Technology Post for July 6th, 2009 | I love .NET!

Tuesday, July 07, 2009 3:03 AM by The Technology Post for July 6th, 2009 | I love .NET!

Pingback from  The Technology Post for July 6th, 2009 | I love .NET!

# The Technology Post for July 6th, 2009 | Nexo IT - Information Technology News

Pingback from  The Technology Post for July 6th, 2009 | Nexo IT - Information Technology News

# re: By Design bugs

Tuesday, July 07, 2009 3:55 AM by television spy

I don't consider it significant, and they should def fix this.

# Twitted by azninsect

Tuesday, July 07, 2009 5:05 AM by Twitted by azninsect

Pingback from  Twitted by azninsect

# re: By Design bugs

Tuesday, July 07, 2009 7:01 AM by Silicontrip

I love how Microsoft hide bad design behind a blanket statement "Most users expect..."   Which means We're going to do what we want, If we deem the standard too hard or not the Microsoft way, we'll just do it our way and say "most users expect."  

I've heard this one statement fits all from them for quite some time, they had a "but we're innovating" when they broke Java and Sun sued them.

This will probably explain why windows crashes so much.  Two components have incompatibility problems because neither adhered to the standard but went for what most of their users expect.  But most of our users expect 1 to mean success, But most of our users expect 1 to mean failure...

# Reflective Perspective - Chris Alcock &raquo; The Morning Brew #384

Pingback from  Reflective Perspective - Chris Alcock  &raquo; The Morning Brew #384

# A more standard XML comparison

Tuesday, July 07, 2009 9:45 AM by Coding Sanity

After the fun and games of trying to get MS to implement an XML comparison based vaguely on standards

# re: By Design bugs

Tuesday, July 07, 2009 9:55 AM by Matt

what do you expect, Indian developer on their XML parser?

# Twitted by vincicat

Tuesday, July 07, 2009 12:46 PM by Twitted by vincicat

Pingback from  Twitted by vincicat

# The Technology Post for July 6th, 2009 | rapid-DEV.net

Tuesday, July 07, 2009 1:46 PM by The Technology Post for July 6th, 2009 | rapid-DEV.net

Pingback from  The Technology Post for July 6th, 2009 | rapid-DEV.net

# re: By Design bugs

Tuesday, July 07, 2009 9:09 PM by codingsanity

I must say that I'm disappointed that some people both here and on the reddit thread have chosen to use racial slurs. The race of the program manager has absolutely nothing to do with the issue.

# re: By Design bugs

Sunday, July 12, 2009 12:32 AM by Picky

> But semantically speaking a="12.5" and a="12.5000" should also be equal.

Semantically? Without taking the XSD into consideration, there is absolutely no reason to say those two are equal.  Who is to say those are not two strings separated by a decimal?  Or the same number with varying levels of precision (important) as opposed to just its displayed precision.

# re: By Design bugs

Thursday, July 16, 2009 4:16 PM by Gábor

For me, it is obvious.

MS did not like to make big changes in the software.

So MS made up a false reason, why their software works that way.

And that is it, MS closed the bug report.

For me the attribute order is insignificant.

If MS is good, MS would make its software to work both way.

(I.e.: strictly comparing the to source AND ignoring the attribute order.)