SdtTagName was throwing lots of exceptions, so I downloaded your code and took a look in debug mode. The ".Element(W.tag)" part was null. I added null checks (via the question marks), and it solved my problem and seems to run quite a bit faster. I did not spend any time trying to understand your code, but if the try/catch is there just for handling nulls, maybe that is no longer needed.
SdtTagName was throwing lots of exceptions, so I downloaded your code and took a look in debug mode. The ".Element(W.tag)" part was null. I added null checks (via the question marks), and it solved my problem and seems to run quite a bit faster. I did not spend any time trying to understand your code, but if the try/catch is there just for handling nulls, maybe that is no longer needed.