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

Different serialization output: three dots in the end of serialized yaml #436

Closed
joostas opened this issue Oct 6, 2019 · 6 comments
Closed
Assignees
Labels

Comments

@joostas
Copy link

joostas commented Oct 6, 2019

Serialize simple value to yaml:

var serializer = new Serializer();
var output = serializer.Serialize(42);

output: "42\r\n...\r\n" (three dots at the end)

Serialize array value to yaml:

var serializer = new Serializer();
var output = serializer.Serialize(new int[]{42});

output: "- 42\r\n" (no dots at the end)

Question: Why same serialization setup produces different output in the end of document (...)?
Question: Is it possible to "hide" three dots when converting simple value?


Versions tested:

  • 6.1.2
  • 7.0.0
  • 8.0.0-emit-default-values0565
@aaubry
Copy link
Owner

aaubry commented Oct 6, 2019

This is unexpected, and probably a bug. I'll try look into it tomorrow and get back to you.

@aaubry aaubry added the bug label Oct 6, 2019
@aaubry aaubry self-assigned this Oct 6, 2019
@aaubry aaubry closed this as completed in d856dbc Oct 11, 2019
@aaubry
Copy link
Owner

aaubry commented Oct 11, 2019

This was indeed a bug. The fix will be included in the next release.

aaubry pushed a commit that referenced this issue Oct 19, 2019
@lampenlampen
Copy link

I'm using YamlStream and also get the three dots at the end of the document.

var yamlStream = new YamlStream(new YamlDocument(
    new YamlMappingNode(
        new YamlScalarNode("test"), new YamlScalarNode("42"))));

var stringWriter = new StringWriter();
yamlStream.Save(stringWriter);

// stringwriter: "test: 42\r\n...\r\n"

Is this indented? Is it possible to disable the emitting of the three dots?

Thanks

YamlDotNet version: 8.0.0

@gogowitsch
Copy link

The 3 dots ... are a valid, optional part of the formal YAML file format and indicate the end of a document.

@geferon
Copy link

geferon commented Feb 4, 2021

It's been a while, and saving with a YamlStream still adds the three dots at the end of the file, is there any way to disable it?
It's been more than a year since the last reply, dunno if @lampenlampen is still active but, have you found a way to disable them?

@queil
Copy link

queil commented Oct 7, 2021

@geferon and any other person that land here with the 3 dots. Try serialization instead of saving the stream. https://stackoverflow.com/questions/50878627/yamdocument-to-text-representation-end-with-3-dots

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

6 participants