Skip to content

CsvContext.Configuration.ShouldQuote is not used #2292

Open
@gmkado

Description

@gmkado

I'm using v30.0.1 but I believe this is true for the latest.

using var writer = new StreamWriter(_csvStream, Encoding.Default, BufferSize, true);
using var csvWriter = new CsvWriter(writer, CultureInfo.InvariantCulture);
csvWriter.Context.Configuration.ShouldQuote = _ => false;

This seems to use the ConfigurationFunctions.ShouldQuote instead of my delegate, I believe because it gets copied here locally on construction of CsvWriter:

shouldQuote = configuration.ShouldQuote;

I'm updating from v15 to v30, so I'm still trying to figure out all the changes. Is the Context.Configuration meant to expose mutable fields on the writer's configuration? If so, should the WriteField method use configuration.ShouldQuote instead of storing a local copy on construction?

I understand I can set the configuration and pass it to CsvWriter, but seems like Context.Configuration.ShouldQuote should not be settable if its not intended to take effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions