Open-XML-SDK icon indicating copy to clipboard operation
Open-XML-SDK copied to clipboard

Instrument project with DiagnosticSource

Open twsouthwick opened this issue 5 years ago • 2 comments

In order to better identify and root cause issues, it would be helpful to get in depth logs as to what the system is doing. DiagnosticSource would be ideal for this. I haven't used it personally, but wanted to track a work item to add support for it within the project.

twsouthwick avatar Jul 15 '20 16:07 twsouthwick

@twsouthwick Hi there. I've wanted to open new issue here but it might be not appropriate, so let me ask my question here. Is there any approach to get depth, lineNumber or position of current node? As it's done using native XmlTextReader: https://docs.microsoft.com/en-us/dotnet/api/system.xml.xmltextreader.lineposition?view=netcore-3.1

while (reader.Read()){
       switch (reader.NodeType){
         case XmlNodeType.Element:
           Console.Write("{0} {1},{2}  ", reader.Depth, reader.LineNumber, reader.LinePosition);
           Console.WriteLine("<{0}>", reader.Name);
           break;
       }
    }

I have tried to get Depth of OpenXMLReader, but it seems that it is returning depth of element in some stack which is not real depth of current xml node.

I would appreciate any answer. Thank you in advance.

amanbolat avatar Sep 07 '20 15:09 amanbolat

Feel free to open a new issue if you find a limitation of the sdk. I'm not available to look into it right now, but maybe others will. We want to keep issues scoped to single issues

twsouthwick avatar Sep 07 '20 15:09 twsouthwick