Skip to content

Instantly share code, notes, and snippets.

@casperOne
Created May 22, 2018 13:21
Show Gist options
  • Save casperOne/ef98a0f9a224b6663d0408a595dfb5e5 to your computer and use it in GitHub Desktop.
Save casperOne/ef98a0f9a224b6663d0408a595dfb5e5 to your computer and use it in GitHub Desktop.
CsvHelper 7.1.0 - CsvWriter NullReferenceException on multiple Dispose calls
using System;
using System.IO;
using CsvHelper;
using Xunit;
namespace CsvHelperDisposeTests
{
public class Tests
{
[Fact]
public void Test_Dispose()
{
// Create a stream.
using (var ms = new MemoryStream())
using (var streamWriter = new StreamWriter(ms))
{
// Create the writer.
var writer = new CsvWriter(streamWriter);
// Dispose twice.
writer.Dispose();
writer.Dispose();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment