При попытке загрузить XSLT я получаю ошибку ниже
Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
Получение Ошибки при загрузке XSLT в C# asp.net
string xmlFilePath = Path.Combine(GetAssemblyDirectory(), "TestResult.xml");
string xslFilePath = Path.Combine(GetAssemblyDirectory(), "SingleTableTestResult.xslt");
strResultSummary = strResultSummary.Replace(ProjectPath, ProjectName);
File.WriteAllText(xmlFilePath, strResultSummary, System.Text.Encoding.UTF8);
//get the formatted HTML Report tranformed via xslt
string reportFileData = GenerateTestReport(xmlFilePath, xslFilePath);
//gets the path of the running assembly directory
private static string GetAssemblyDirectory()
{
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
UriBuilder uri = new UriBuilder(codeBase);
string path = Uri.UnescapeDataString(uri.Path);
DashboardBaseLogger.dashBoardlogger.WriteInfo("Directory location: " + Path.GetDirectoryName(path));
return Path.GetDirectoryName(path);
}
//Generates the test report
private string GenerateTestReport(string XMLFilePath, string XSLFilePath)
{
string reportFilePath = string.Empty;
XslCompiledTransform transform = new XslCompiledTransform();
transform.Load(XSLFilePath); //Exception here
reportFilePath = Path.Combine(GetAssemblyDirectory(), "TestResult.html");
transform.Transform(XMLFilePath, reportFilePath);
return reportFilePath;
}
получает исключение здесь transform.Load(XSLFilePath); //Getting an Exception here
Может кто-нибудь поможет мне решить эту проблему? Любая помощь будет принята с благодарностью. Спасибо заранее.
Ошибка, которую вы написали, представляет собой обычное отладочное сообщение, а не исключение Runtime. Можете ли вы вставить try..catch и написать полное исключение? – bdn02
В блоке Catch я получаю исключение System.Threading.ThreadAbort Exception. – Aishu
Есть иннерцепция? – bdn02