Skip to content

XslCompiledTransform on .net Core Linux crashes - does not happen on Windows, or when enableDebug=true #52436

Closed

Description

@geredwards

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>

area-System.Xml @buyaa-n @joperezr @krwq

Activity

  1. ghost added
    untriaged
    on May 7, 2021
  2. changed the title [-]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[/+] on May 7, 2021
  3. krwq commented on Jun 7, 2021

    @krwq
    Member

    @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.

  4. added
    needs-further-triage
    and removed
    untriaged
    on Jul 12, 2021
  5. added this to the 7.0.0 milestone on Jul 12, 2021
  6. added
    needs-author-action
    on Jul 9, 2022
  7. modified the milestones: 7.0.0, Future on Jul 9, 2022
  8. Repository owner moved this from Future to Done in Triage POD for Reflection, META, etc.on Aug 2, 2022
  9. ghost locked as resolved and limited conversation to collaborators on Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Xmlneeds-author-actionneeds-further-triageno-recent-activity

    Type

    No type

    Projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions