runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Improve code coverage for System.Xml.XmlDocument

Open stephentoub opened this issue 11 years ago • 7 comments

According to the current code coverage report, this library is only at 47%. Our general goal is closer to 90%, though this will depend on the library. We should investigate to see whether the current coverage level is appropriate, and if not, improve our test suites to provide better coverage.

stephentoub avatar Feb 19 '15 13:02 stephentoub

@stephentoub, when you have a chance, could you please take a quick look at the PR 1269. I'd like to get feedback on the style and approach so that I can continue working on this issue.

plabovich avatar Mar 30 '15 19:03 plabovich

@stephentoub @krwq I've been working on tests for the next class XmlAttribute. Unfortunately, it's not possible to improve the code coverage a lot due to a technically unreachable code. There are at least 7 overridden methods in the class having code similar to:

    public override XmlNode AppendChild(XmlNode newChild)
    {
        if (PrepareOwnerElementInElementIdAttrMap())
        {
            // unreachable code as the condition is always false
            // some code plus call of the base class implementation
            ResetOwnerElementInElementIdAttrMap(/*...*/);
        }
        else
        {
            // call base implementation
        }
    }

The issue is that PrepareOwnerElementInElementIdAttrMap is set to always return false. The associated comment says it was left behind after removal of schema and if it were removed more methods would have to be removed and it would be harder to add schema back. I'm not sure how much of it is applicable to corefx implementation. My gut feeling says it's not. I'd like to ask for approval to remove the unreachable/unused code.

Looking forward to hearing from you.

plabovich avatar Apr 11 '15 23:04 plabovich

@krwq, is this actually dead code to be removed?

stephentoub avatar Apr 21 '15 12:04 stephentoub

@krwq, could you please take a look when you have a chance? I'd love to continue working on improving System.Xml.XmlDocument.

plabovich avatar Apr 27 '15 15:04 plabovich

It might be a dead code but please do not remove it just yet as there was no concrete decision if we want to bring schema back as it was or make an OOB out of it or not do the work at all.

I want to be as close to desktop as possible with code for now so if I need to add schema back I can do it much easier.

krwq avatar Apr 28 '15 22:04 krwq

I see. Thanks for clarifying.

plabovich avatar Apr 29 '15 19:04 plabovich

This code was moved into System.Private.Xml. It's probably more useful to have new issue for that.

danmoseley avatar Feb 21 '17 05:02 danmoseley