Skip to content

Task fails with ambiguous error on JSON file that has comments #74

@norvegec

Description

@norvegec

Before opening an issue please read this.

Are you reporting a bug or a feature request ?

  • Bug
  • Feature request

Description

When JSON content of input file has comments the task fails with ambiguous message:

##[error]Couldn't apply patch to file: C:\myTargetDir\_configs\appsettings.dev.json
##[error]No files were patched.

Expected behavior

  • Good: output an error that would clearly point to a problem: "malformed JSON content" or "unsupported JSON content at line XXX", etc.
  • Better: ignore comments in JSON

Reproduction

Add this task (ver. 3/4) to a pipeline that works with filesystem (Azure Pipeline Windows 2019 agent pool) with options:

  • Syntax type: Slick Syntax,
  • Target files: appsettings.$(env).json
  • Patch content:
  • Output patched file in logs: checked
  • Fail if no files are patched: checked

and taking into account that file actually exist
the task logs ambiguous error:

##[error]Couldn't apply patch to file: C:\myTargetDir\_configs\appsettings.dev.json
##[error]No files were patched."

# System information

**VSTS or TFS:**
* [x] VSTS
* [ ] TFS

**Agent:**
* [x] Hosted
* [ ] Custom

**OS:**
* [x] Windows
* [ ] Mac
* [ ] Linux


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions