XML Formatter Fails: `RangeError: Invalid count value`

See original GitHub issue

Description

When I was formatting an xml using ALT + SHIFT + F, it stops responding. Nothing, no errors being thrown out as a pop-up.

Screenshots VS Code Output - Extension Host

2019-01-21 14:17:19.085] [exthost] [error] RangeError: Invalid count value
	at String.repeat (native)
	at V2XmlFormatter._getIndent (C:\Users\thomashan\.vscode\extensions\dotjoshjohnson.xml-2.4.0\out\formatting\formatters\v2-xml-formatter.js:206:106)
	at V2XmlFormatter.formatXml (C:\Users\thomashan\.vscode\extensions\dotjoshjohnson.xml-2.4.0\out\formatting\formatters\v2-xml-formatter.js:167:39)
	at XmlFormattingEditProvider.provideDocumentRangeFormattingEdits (C:\Users\thomashan\.vscode\extensions\dotjoshjohnson.xml-2.4.0\out\formatting\xml-formatting-edit-provider.js:39:41)
	at XmlFormattingEditProvider.provideDocumentFormattingEdits (C:\Users\thomashan\.vscode\extensions\dotjoshjohnson.xml-2.4.0\out\formatting\xml-formatting-edit-provider.js:12:21)
	at c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:557:303
	at t.asThenable (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:141:941)
	at new module.exports.t.exports (C:\Users\thomashan\.vscode\extensions\vscjava.vscode-maven-0.13.0\dist\extension.js:126:25764)
	at Object.t.asThenable (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:141:909)
	at e.provideDocumentFormattingEdits (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:557:262)
	at c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:572:705
	at e._withAdapter (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:567:513)
	at e.$provideDocumentFormattingEdits (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:572:667)
	at t._doInvokeHandler (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:658:837)
	at t._invokeHandler (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:658:509)
	at t._receiveRequest (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:657:60)
	at t._receiveOneMessage (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:656:59)
	at c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:653:895
	at c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:130:793
	at e.fire (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:133:218)
	at a (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:186:147)
	at Socket.n._socketDataListener (c:\Users\thomashan\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\node\extensionHostProcess.js:186:368)
	at emitOne (events.js:116:13)
	at Socket.emit (events.js:211:7)
	at addChunk (_stream_readable.js:263:12)
	at readableAddChunk (_stream_readable.js:250:11)
	at Socket.Readable.push (_stream_readable.js:208:10)
	at Pipe.onread (net.js:594:20)

Extension Version v2.4.0 I believe

VS Code Version 1.30.2

Operating System Windows 10

Additional Information

file name: Spring.Data.xml file length: 10922 lines

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
mazunindcommented, Nov 6, 2019

Just had this too. Nothing helps

2reactions
starquakecommented, Feb 12, 2019

I had the same issue. Here’s an example that triggers this:

<?xml version="1.0" encoding="UTF-8"?>
<test1>
    TEST <test2>aaa</test2>
</test1>

or a more realistic example:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" encoding="UTF-8" indent="yes" />

    <xsl:template match="/">
        <file>
            <xsl:apply-templates />
        </file>
    </xsl:template>

    <xsl:template match="*">
        <xsl:message terminate="no">
            WARNING: Unmatched element: <xsl:value-of select="name()"/>
        </xsl:message>
        <xsl:apply-templates/>
    </xsl:template>

</xsl:stylesheet>
Read more comments on GitHub >

github_iconTop Results From Across the Web

RangeError: repeat count must be less than infinity - JavaScript
The JavaScript exception "repeat count must be less than infinity" occurs when the String. prototype.
Read more >
ESLint Error 'Invalid count value' when run with --fix
I have resolved the issue. If there is no blank line before the return statement in anywhere in the code we will get...
Read more >
Platform error codes | ArcGIS Maps SDK for .NET
Error codes are defined here as integers and organized into groups based on category of service. We do our best to never change...
Read more >
Fix "Value does not fall within the expected range" Error in ...
Got this error while checking in a document? Well, the solution is simple – Do not set the required field property to true...
Read more >
src/i18n.js - v8/v8 - Git at Google
Error message for when function object is created with new and it's not ... throw new $RangeError('Illegal value for localeMatcher:' + matcher);.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found