Repository navigation
Description
Description
We've encountered a really weird issue using XslCompiledTransform on .net Core 3.1 running on Linux.
Variable $tasp in the XSL is set as follows.
<xsl:variable name="tasp">
<xsl:choose>
<xsl:when test="number(Attendance/TermlyAttendance/SessionsPossible) = Attendance/TermlyAttendance/SessionsPossible">
<xsl:value-of select="Attendance/TermlyAttendance/SessionsPossible"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Comparisons are then made against this variable later on in the transform.
Running on Windows, all works fine regardless of enableDebug flag.
Running on Linux, when the xsl:test comparison happens, the variable evaluates to NaN, and therefore all comparisons return false.
If I pass in the enableDebug flag to the XslCompiledTransform as true, the variable evaluates to a number (as expected), and all works fine.
I've proved this by adding the variable to the output of the XSL using
<xsl:element name="tasp_variable_current_value"> <xsl:value-of select="number($tasp)"/> </xsl:element>
Windows output/Linux Debug:
<tasp_variable_initial_value>107</tasp_variable_initial_value> <tasp_variable_current_value>107</tasp_variable_current_value>
Linux non-debug output:
<tasp_variable_initial_value>107</tasp_variable_initial_value> <tasp_variable_current_value>NaN</tasp_variable_current_value>
I am unable to output its value (i.e. value-of-select="$tasp")
That causes either a
"The surrogate pair...is invalid" exception
or a "Stream was too long" IOException.
Configuration
.net Core 3.1
Windows 10 Pro 20H2
Linux Ubuntu 20.4 (running on Windows)
Other information
The behaviour should be identical, regardless of the OS, and the state of the enableDebug flag.
I have got a small project which repos the issue.
XslIssue.zip
**Note that
- if I simplify the ValidationRules XSL more than I have done already in that project, the issue goes away.
- the xsl:if which shows the issue is the one starting on line 159
<xsl:if test="not(Attendance/TermlyAttendance/SessionsUnauthorised)- **
After running, check output.xml. The tasp_variable_current_value should be a number, rather than NaN.
Output for Windows/Linux enable Debug = true
<?xml version="1.0" encoding="utf-8"?>
<ProcessingResults xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<Errors>
<tasp_variable_initial_value>107</tasp_variable_initial_value>
<tasp_variable_current_value>107</tasp_variable_current_value>
Output for Linux, enableDebug = false
<?xml version="1.0" encoding="utf-8"?>
<ProcessingResults xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<Errors>
<tasp_variable_initial_value>107</tasp_variable_initial_value>
<tasp_variable_current_value>NaN</tasp_variable_current_value>
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]XslCompiledTransform on .net Core Linux crashes - does not happen on Windows, or when enableDebug=false[/-][+]XslCompiledTransform on .net Core Linux crashes - does not happen on Windows, or when enableDebug=true[/+]krwq commentedon Jun 7, 2021
@geredwards can you try with the latest preview. There were couple of issues fixed since 3.1 but I'm not sure if this particular one has been fixed. It might be worth confirming.