Botframework-emulator: Cannot open bot files with comments

Created on 30 Jan 2019  ·  4Comments  ·  Source: microsoft/BotFramework-Emulator

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Version

4.2.1

Describe the bug

Bot Framework Emulator cannot open a bot file which contains comments in the JSON.

To Reproduce

Steps to reproduce the behavior:

  1. I have extended my bot file with sample code from https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-qna?view=azure-bot-service-4.0&tabs=cs, section "Update the .bot file"
  2. I try to open the bot file in Bot Framework emulator
  3. In Bot Framework emulator I geht the notification: "Error while trying to switch to bot: [path to file]"
  4. When I remove the comment from the JSON in the bot file the bot file opens with no issues.

Expected behavior

Bot Framework Emulator should open bot files which have comments in the JSON.

Screenshots

n/a

Additional context

n/a

[bug]

Most helpful comment

Hello @pkirch ,

Thanks for reporting!

JSON is not supposed to contain comments, as it is meant for configuration, and if it does they are supposed to be removed before being processed by code that parses JSON (methods like Javacsripts's JSON.parse()). The creator of JSON even said it himself.

It would not be a trivial amount of work to enable parsing of JSON containing comments within the emulator: behavior that seems to be discouraged anyways.

The real problem here seems to be how we provide the JSON in the sample.

All 4 comments

Hello @pkirch ,

Thanks for reporting!

JSON is not supposed to contain comments, as it is meant for configuration, and if it does they are supposed to be removed before being processed by code that parses JSON (methods like Javacsripts's JSON.parse()). The creator of JSON even said it himself.

It would not be a trivial amount of work to enable parsing of JSON containing comments within the emulator: behavior that seems to be discouraged anyways.

The real problem here seems to be how we provide the JSON in the sample.

@tonyanziano can we use the Issue Transfer feature to xfer this to the docs repo, then?

@brandonh-msft That sounds reasonable to me. I actually don't have access to the transfer feature due to lack of access or flighting, but I will find someone who does and get this transferred.

@pkirch & @brandonh-msft

I was about to open an issue over on the Bot Service Docs repo and found that the same issue was just filed 22 hours ago:

https://github.com/MicrosoftDocs/bot-docs/issues/806

So you can track the status there.

Was this page helpful?
0 / 5 - 0 ratings