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

General System.Exception is thrown as a parsing error #541

Open
elishapiiro opened this issue Nov 4, 2020 · 0 comments
Open

General System.Exception is thrown as a parsing error #541

elishapiiro opened this issue Nov 4, 2020 · 0 comments
Labels

Comments

@elishapiiro
Copy link

During parsing an error is encountered:

System.Exception: Exception of type 'System.Exception' was thrown.
   at YamlDotNet.Core.Scanner.ScanPlainScalar(Boolean\u0026 isMultiline)
   at YamlDotNet.Core.Scanner.FetchPlainScalar()
   at YamlDotNet.Core.Scanner.FetchMoreTokens()
   at YamlDotNet.Core.Scanner.MoveNextWithoutConsuming()
   at YamlDotNet.Core.Parser.GetCurrentToken()
   at YamlDotNet.Core.Parser.ParseBlockSequenceEntry(Boolean isFirst)
   at YamlDotNet.Core.Parser.MoveNext()
   at YamlDotNet.RepresentationModel.YamlSequenceNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlMappingNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlSequenceNode.Load(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlNode.ParseNode(IParser parser, DocumentLoadingState state)
   at YamlDotNet.RepresentationModel.YamlDocument..ctor(IParser parser)
   at YamlDotNet.RepresentationModel.YamlStream.Load(IParser parser)

Unfortunately, I don't have access to the yaml document that caused the error, only to the logs.
The code that causes the error :

// yamlString is read from a file and not manipulated in any way.
using var streamReader = new StringReader(yamlString);
var yaml = new YamlStream();
yaml.Load(streamReader);

I believe that a more indicative exception should be thrown in this case.

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