Skip to content

Commit

Permalink
Removed dependency on System.Linq.Async.
Browse files Browse the repository at this point in the history
Updated package reference versions.
  • Loading branch information
JoshClose committed Feb 29, 2024
1 parent 5055256 commit 2efe3a4
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
31 changes: 13 additions & 18 deletions src/CsvHelper/CsvHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,46 +48,41 @@
<None Include="Icon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<!-- All .NET Versions-->
<ItemGroup>
<PackageReference Include="System.Linq.Async" Version="4.0.0" />
</ItemGroup>

<!-- .NET 4.6.2 -->
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
</ItemGroup>

<!-- .NET 4.7 -->
<ItemGroup Condition="'$(TargetFramework)' == 'net47'">
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
</ItemGroup>

<!-- .NET 4.8 -->
<ItemGroup Condition="'$(TargetFramework)' == 'net48'">
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
</ItemGroup>

<!-- .NET Standard 2.0 -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.0.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Memory" Version="4.5.0" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.2" />
</ItemGroup>

<!-- .NET Standard 2.1 -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 5 additions & 2 deletions src/CsvHelper/CsvWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using CsvHelper.Expressions;
using CsvHelper.TypeConversion;
using System;
using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using System.Dynamic;
Expand Down Expand Up @@ -773,7 +772,11 @@ private async Task<bool> WriteHeaderAsync<T>(IAsyncEnumerable<T> records)
return hasHeaderBeenWritten;
}

return WriteHeader(await records.FirstOrDefaultAsync());
var enumerator = records.GetAsyncEnumerator();
await enumerator.MoveNextAsync().ConfigureAwait(false);
var header = enumerator.Current;

return WriteHeader(header);
}

private bool WriteHeader<T>(IEnumerable<T> records)
Expand Down
6 changes: 6 additions & 0 deletions tests/CsvHelper.Tests/Compatibility/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#if NETFRAMEWORK
namespace System.Runtime.CompilerServices
{
internal static class IsExternalInit { }
}
#endif
6 changes: 3 additions & 3 deletions tests/CsvHelper.Tests/CsvHelper.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!--<TargetFrameworks>net8.0;net7.0;net6.0;net48;net47;net462</TargetFrameworks>-->
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net7.0;net6.0;net48;net47;net462</TargetFrameworks>
<!--<TargetFrameworks>net8.0</TargetFrameworks>-->
<LangVersion>preview</LangVersion>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>CsvHelper.snk</AssemblyOriginatorKeyFile>
Expand All @@ -16,7 +16,7 @@
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="System.Linq.Async" Version="5.0.0" />
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down

0 comments on commit 2efe3a4

Please sign in to comment.