Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
with:
dotnet-version: 3.1.*

- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.*

- name: Run './build.cmd Test Pack'
run: ./build.cmd Test Pack
env:
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/continuousCore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ jobs:
with:
dotnet-version: 3.1.*

- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.*

- name: Run './build.cmd TestCoreOnly'
run: ./build.cmd TestCoreOnly
env:
Expand Down Expand Up @@ -69,6 +74,11 @@ jobs:
with:
dotnet-version: 3.1.*

- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.*

- name: Run './build.cmd TestCoreOnly'
run: ./build.cmd TestCoreOnly
env:
Expand Down
2 changes: 1 addition & 1 deletion Build/Common.Benchmark.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Framework">
<DefaultTargetFrameworks>netcoreapp3.1;net48</DefaultTargetFrameworks>
<DefaultTargetFrameworks>netcoreapp3.1;net48;net50</DefaultTargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion Build/Common.Tests.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup Label="Framework">
<DefaultTargetFrameworks>netcoreapp3.1;net48</DefaultTargetFrameworks>
<DefaultTargetFrameworks>netcoreapp3.1;net48;net50</DefaultTargetFrameworks>
<IsPackable>False</IsPackable>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions Build/Nuke/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.GitVersion;
using Nuke.Common.Tools.Xunit;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
Expand Down Expand Up @@ -89,7 +90,6 @@ partial class Build : Nuke.Common.NukeBuild

void ExecutesCompile(bool excludeNetFramework)
{
DotNet("--info");

Logger.Info(excludeNetFramework ? "Exclude net framework" : "Include net framework");
if (excludeNetFramework)
Expand Down Expand Up @@ -167,7 +167,7 @@ from platform in project.GetPlatformsForTests()
.Executes(() =>
{
var excludeNetFramework = AllProjects.SelectMany(x => x.GetTargetFrameworks()).Distinct()
.Any(x => !x.Contains("standard") || !x.Contains("core"));
.Any(x => !x.Contains("standard") || !x.Contains("core") || !x.Contains("net50"));
ExecutesCompile(excludeNetFramework);
});

Expand All @@ -177,7 +177,7 @@ from platform in project.GetPlatformsForTests()
.Executes(() =>
{
var excludeNetFramework = AllProjects.SelectMany(x => x.GetTargetFrameworks()).Distinct()
.Any(x => !x.Contains("standard") || !x.Contains("core"));
.Any(x => !x.Contains("standard") || !x.Contains("core") || !x.Contains("net50"));
ExecutesTest(excludeNetFramework);
});

Expand Down
2 changes: 1 addition & 1 deletion Build/Nuke/NukeBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>net50</TargetFramework>
<NoWarn>CS0649;CS0169</NoWarn>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<NukeRootDirectory>..\..</NukeRootDirectory>
Expand Down
2 changes: 1 addition & 1 deletion Build/Nuke/ProjectExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static IReadOnlyCollection<string> GetTargetFrameworks(this Project proje
var frameworks = project.GetTargetFrameworks();
if (!excludeNetFramework)
return frameworks.ToList();
return frameworks.Where(x => x.Contains("standard") || x.Contains("core")).ToList();
return frameworks.Where(x => x.Contains("standard") || x.Contains("core") || x.Contains("net50")).ToList();
}

public static IReadOnlyCollection<string> GetPlatforms(this Project project)
Expand Down
14 changes: 6 additions & 8 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ function ExecSafe([scriptblock] $cmd) {
# Print environment variables
Get-Item -Path Env:* | Sort-Object -Property Name | ForEach-Object {"{0}={1}" -f $_.Name,$_.Value}

$DotNetVersion = "3.1.403"

# If dotnet CLI is installed globally and it matches requested version, use for execution
# if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
# $(dotnet --version) -and $LASTEXITCODE -eq 0) {
# $env:DOTNET_EXE = (Get-Command "dotnet").Path
# }
# else {
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
$env:DOTNET_EXE = (Get-Command "dotnet").Path
}
else {
# Download install script
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
Expand All @@ -69,7 +67,7 @@ $DotNetVersion = "3.1.403"
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
# }
}

Write-Output "Path: $($env:DOTNET_EXE)"

Expand Down
11 changes: 11 additions & 0 deletions src/StructLinq.BCL.Tests/ListLayoutTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ namespace StructLinq.BCL.Tests
{
public class ListLayoutTests
{
[Theory]
[InlineData(0)]
[InlineData(10)]
[InlineData(100)]
public void ShouldCountMustBe(int size)
{
var list = Enumerable.Range(-1, size).ToList();
var layout = Unsafe.As<List<int>, ListLayout<int>>(ref list);
layout.Size.Should().Be(size);
}

[Theory]
[InlineData(0)]
[InlineData(10)]
Expand Down
3 changes: 2 additions & 1 deletion src/StructLinq.BCL.Tests/StructLinq.BCL.x64.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net50</TargetFrameworks>
<Platform>x64</Platform>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x64</Platforms>
<RunSettingsFilePath>$(RootDir)\Build\x64.runsettings</RunSettingsFilePath>
<DefineConstants>IS_X64</DefineConstants>
<RootNamespace>StructLinq.BCL.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/StructLinq.BCL.Tests/StructLinq.BCL.x86.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net50</TargetFrameworks>
<Platform>x86</Platform>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>x86</Platforms>
<RunSettingsFilePath>$(RootDir)\Build\x86.runsettings</RunSettingsFilePath>
<DefineConstants>IS_X86</DefineConstants>
<RootNamespace>StructLinq.BCL.Tests</RootNamespace>
</PropertyGroup>

<ItemGroup>
Expand Down
11 changes: 11 additions & 0 deletions src/StructLinq.BCL/Dictionary/DictionaryLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ internal struct Entry<TKey, TValue>
internal TKey Key; // Key of entry
internal TValue Value; // Value of entry
}
#else
#if (NET5_0)

internal struct Entry<TKey, TValue>
{
public uint HashCode;
public int Next;
internal TKey Key; // Key of entry
internal TValue Value; // Value of entry
}
#else
internal struct Entry<TKey, TValue>
{
Expand All @@ -23,5 +33,6 @@ internal struct Entry<TKey, TValue>
internal TKey Key; // Key of entry
internal TValue Value; // Value of entry
}
#endif
#endif
}
11 changes: 2 additions & 9 deletions src/StructLinq.BCL/List/ListLayout.cs
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
// ReSharper disable InconsistentNaming

using System;

namespace StructLinq.BCL.List
{

#if (NETCOREAPP3_0 || NETCOREAPP3_1)
#if (NETCOREAPP3_0 || NETCOREAPP3_1 || NET5_0)

internal class ListLayout<T>
{
internal T[] Items;
#pragma warning disable 169
internal int Size;
#pragma warning restore 169
}
#else
internal class ListLayout<T>
{
internal T[] Items;
#pragma warning disable 169
internal int Size;
#pragma warning disable 169
private int Version;
private object SyncRoot;
#pragma warning restore 169
}

#endif

}
2 changes: 1 addition & 1 deletion src/StructLinq.BCL/StructLinq.BCL.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net452;net472;net48;netcoreapp2.1;netcoreapp2.2;netcoreapp3.0;netcoreapp3.1;net50</TargetFrameworks>
</PropertyGroup>

<PropertyGroup Label="Nuget">
Expand Down
2 changes: 2 additions & 0 deletions src/StructLinq.Tests/AbstractCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public void ShouldClone()
var obj = collection.Clone();

//Assert
#pragma warning disable CA2013 // Do not use ReferenceEquals with value types
Assert.False(object.ReferenceEquals(collection, obj));
#pragma warning restore CA2013 // Do not use ReferenceEquals with value types
obj.Should().BeOfType<TStructCollection>();
var clone = (TStructCollection) obj;
Assert.Equal(collection.ToEnumerable().ToArray(), clone.ToEnumerable().ToArray());
Expand Down
2 changes: 2 additions & 0 deletions src/StructLinq.Tests/AbstractRefCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ public void ShouldClone()
var obj = collection.Clone();

//Assert
#pragma warning disable CA2013 // Do not use ReferenceEquals with value types
Assert.False(object.ReferenceEquals(collection, obj));
#pragma warning restore CA2013 // Do not use ReferenceEquals with value types
obj.Should().BeOfType<TStructCollection>();
var clone = (TStructCollection) obj;
Assert.Equal(collection.ToEnumerable().ToArray(), clone.ToEnumerable().ToArray());
Expand Down
1 change: 0 additions & 1 deletion src/StructLinq.Tests/SumTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Xunit;

namespace StructLinq.Tests
Expand Down