Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to detect the error raised on a particular codeline?
    text
    copied!<p>[Please edit the title if you find its not good enough]</p> <p>I have code which triggers XSL-transformation:</p> <pre><code>objMemoryStream = new MemoryStream(); xslTransform = new XslCompiledTransform(); xpathXmlOrig = new XPathDocument("E:\\xslt error\\Simulation_of_error\\input.xml"); xslSettings = new XsltSettings(); xslSettings.EnableScript = true; xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver()); xslTransform.Transform(xpathXmlOrig, null, objMemoryStream); objMemoryStream.Position = 0; StreamReader objStreamReader = new StreamReader(objMemoryStream); </code></pre> <p>The method <code>xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver());</code> is a victim, which fails some times due to some time-out issue.</p> <p>I want to detect the failure of this codeline and execute again until it successfully executes!</p> <p>I tried using "TRY CATCH and WHILE methods":</p> <pre><code>bool flag = true; do { try { xslTransform.Load(strXmlQueryTransformPath, xslSettings, new XmlUrlResolver()); flag = false; } catch { flag = true; } } while (flag); </code></pre> <p>but the problem is "error is getting logged in the log file", Well. The whole code is under one more try statement, which I suspect is writing to log. Which is what I don't want... I don't want end user to know about the failure of this codeline.</p> <p>Is there anyway to get it done?</p> <p><strong>The appearance of error is completely Random. First time when it fails, I try to retrigger the code, which may result in the successful transformation (on next attempt)! This is the reason why I came to conclusion that recall of Load() method would fix the problem.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload