Skip to content

Commit

Permalink
AVRO-2454: Fix CA1063 - Implement IDisposable correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
blachniet committed Sep 4, 2019
1 parent 770acd5 commit 61e5624
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lang/csharp/Avro.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
We disabled these rules initially to get the code analyzers installed in the project.
-->
<Rule Id="CA1062" Action="Info" />
<Rule Id="CA1063" Action="Info" />
<Rule Id="CA1303" Action="Info" />
<Rule Id="CA1305" Action="Info" />
<Rule Id="CA1307" Action="Info" />
Expand All @@ -35,7 +34,6 @@
<Rule Id="CA1721" Action="Info" />
<Rule Id="CA1724" Action="Info" />
<Rule Id="CA1801" Action="Info" />
<Rule Id="CA1816" Action="Info" />
<Rule Id="CA1819" Action="Info" />
<Rule Id="CA1820" Action="Info" />
<Rule Id="CA1822" Action="Info" />
Expand Down
12 changes: 12 additions & 0 deletions lang/csharp/src/apache/main/File/DataFileReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ public void Reset()

/// <inheritdoc/>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Releases resources associated with this <see cref="DataFileReader{T}"/>.
/// </summary>
/// <param name="disposing">
/// True if called from <see cref="Dispose()"/>; false otherwise.
/// </param>
protected virtual void Dispose(bool disposing)
{
_stream.Close();
}
Expand Down
12 changes: 12 additions & 0 deletions lang/csharp/src/apache/main/File/DataFileWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,18 @@ private byte[] GetByteValue(string value)

/// <inheritdoc/>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

/// <summary>
/// Releases resources associated with this <see cref="DataFileWriter{T}"/>.
/// </summary>
/// <param name="disposing">
/// True if called from <see cref="Dispose()"/>; false otherwise.
/// </param>
protected virtual void Dispose(bool disposing)
{
Close();
}
Expand Down

0 comments on commit 61e5624

Please sign in to comment.