Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML File Patching - SyntaxError: Unexpected number #40

Open
zaengi opened this issue Aug 23, 2017 · 7 comments
Open

XML File Patching - SyntaxError: Unexpected number #40

zaengi opened this issue Aug 23, 2017 · 7 comments
Labels

Comments

@zaengi
Copy link

zaengi commented Aug 23, 2017

Using Slick Syntax on your newest toolset version (Version 2.2.999) leads to an error, which I rather cant debug.

2017-08-23T18:24:12.4598851Z Set workingFolder to default: C:\vsoAgent\tasks\XmlPatch\2.2.999
2017-08-23T18:24:12.9039025Z ##[debug]agent.workFolder=C:\vsoAgent_work
2017-08-23T18:24:12.9039025Z ##[debug]loading inputs and endpoints
2017-08-23T18:24:12.9049040Z ##[debug]loading ENDPOINT_AUTH_$/
2017-08-23T18:24:12.9059043Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2017-08-23T18:24:12.9059043Z ##[debug]loading INPUT_FAILIFNOPATCHAPPLIED
2017-08-23T18:24:12.9069047Z ##[debug]loading INPUT_JSONPATCHCONTENT
2017-08-23T18:24:12.9069047Z ##[debug]loading INPUT_OUTPUTPATCHFILE
2017-08-23T18:24:12.9079019Z ##[debug]loading INPUT_SKIPERRORS
2017-08-23T18:24:12.9079019Z ##[debug]loading INPUT_SYNTAXTYPE
2017-08-23T18:24:12.9089036Z ##[debug]loading INPUT_XMLTARGETFILTERS
2017-08-23T18:24:12.9089036Z ##[debug]loading INPUT_XMLWORKINGDIR
2017-08-23T18:24:12.9099049Z ##[debug]loaded 9
2017-08-23T18:24:13.0879138Z ##[debug]XmlWorkingDir=C:\vsoAgent_work\1\s
2017-08-23T18:24:13.0889663Z ##[debug]JsonPatchContent== //Parameter[@name='dbServer']/@value => "dfg"
2017-08-23T18:24:13.0889663Z = //Parameter[@name='testOutDir']/@value => "\tst\00_satlogs"
2017-08-23T18:24:13.0889663Z = //Parameter[@name='applicationRootDirectory']/@value => "\Release-trunk\drop
2017-08-23T18:24:13.0899706Z ##[debug]OutputPatchFile=true
2017-08-23T18:24:13.0909256Z ##[debug]FailIfNoPatchApplied=true
2017-08-23T18:24:13.0909256Z ##[debug]SkipErrors=false
2017-08-23T18:24:13.0919119Z ##[debug]SyntaxType=slick
2017-08-23T18:24:13.0919119Z ##[debug]XmlTargetFilters=*.runsettings
2017-08-23T18:24:13.0929234Z ##[debug]Namespaces=null
2017-08-23T18:24:13.0959144Z ##[debug]task result: Failed
2017-08-23T18:24:13.0969127Z SyntaxError: Unexpected number
2017-08-23T18:24:13.1039139Z ##[error]SyntaxError: Unexpected number

@sandorfr
Copy link
Member

sandorfr commented Aug 23, 2017 via email

@zaengi
Copy link
Author

zaengi commented Aug 24, 2017

it's a normal VS2015 *.runsettings file, excerpt given here:

val-test.runsettings.txt

@sandorfr
Copy link
Member

There's something weird about the last line of your patch in your logs, it's missing a double quote: //Parameter[@name='applicationRootDirectory']/@value => "\Release-trunk\drop
Is it coming from copy pasting the logs, if not it might be the problem.

We plan on improving those kind of error detection as Microsoft released so validation api for tasks parameters 🎉

@zaengi
Copy link
Author

zaengi commented Sep 1, 2017

Thanks for that good input, it was wrong but didnt solve the problem:

2017-08-31T14:11:39.1871172Z = //Parameter[@name='testOutDir']/@value => "\tst\00_satlogs"
2017-08-31T14:11:39.1881160Z = //Parameter[@name='applicationRootDirectory']/@value => "H:\a\PDS_Release-trunk\drop"
2017-08-31T14:11:39.1921147Z ##[error]SyntaxError: Unexpected number

How can I use "Standard Syntax" instead of "Slick" with XML files?

@sandorfr
Copy link
Member

sandorfr commented Sep 2, 2017

Found the cause it's the same as #4, you have backslashes in your values so they have to be escaped.

= //Parameter[@name='testOutDir']/@value => "\\tst\\00_satlogs"
= //Parameter[@name='applicationRootDirectory']/@value => "H:\\a\\PDS_Release-trunk\\drop"

Regarding the standard Syntax, I woudn't recommend it as it's very verbose. However if you really want to use it, you have samples in the tests : https://github.com/geeklearningio/gl-vsts-tasks-file-patch/blob/master/Tests/XmlPatch/xmlPatcher.spec.ts#L100

@zaengi
Copy link
Author

zaengi commented Sep 6, 2017

Thanks - that solved the problem!
Only one trouble is left despite:
I want to use a common variable for the local paths, but how can I do that, when your build step needs escaped syntax and others dont?

@sandorfr
Copy link
Member

sandorfr commented Sep 6, 2017

yes you are running into the same issue as #4 for that as well and I have to respawn a discussion with vsts team as I really feel uncomfortable introducing a custom syntax to handle escaping.

Meanwhile you can use https://marketplace.visualstudio.com/items?itemName=jessehouwing.jessehouwing-vsts-variable-tasks to transform your variable to an escaped version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants