Skip to content

Run tests on .NET 6 #2951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 32 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
0aff1b2
Use .NET 6.0 to run tests
hazzik Nov 30, 2021
b8bc108
Use VS2022 image
hazzik Nov 30, 2021
b81d814
Use NETCOREAPP2_0_OR_GREATER condition
hazzik Dec 1, 2021
bf703b0
Migrate to Directory.Build.props
hazzik Dec 1, 2021
5924520
Switch build to .NET 6.0
hazzik Dec 1, 2021
ee5265e
Switch tests to .NET 6
hazzik Dec 1, 2021
67b560b
fixup! Switch tests to .NET 6
hazzik Dec 1, 2021
be40247
Switch build tool to .net 6.0
hazzik Dec 1, 2021
8a54a97
Code review changes
hazzik Dec 1, 2021
8dc5ed2
Try utf8_general_ci collation for the db
hazzik Dec 1, 2021
1cba19d
Update AsyncGenerator
hazzik Dec 5, 2021
fd25bbb
Ignore netstandard. Why it appears here?
hazzik Dec 7, 2021
7d8f3c9
Update packages in a hope it will solve some issues
hazzik Dec 7, 2021
8335277
AppVeyor MySQL: CHARACTER SET utf8
hazzik Dec 8, 2021
f33ab90
Update appveyor.yml
hazzik Dec 8, 2021
94e1676
Update appveyor.yml
hazzik Dec 8, 2021
7182b8d
Update appveyor.yml
hazzik Dec 8, 2021
786c1bc
Update dotnet-tools.json
hazzik Dec 15, 2021
e01feea
Add global.json
hazzik Dec 16, 2021
4b25ff9
Revert NUnit changes
hazzik Dec 16, 2021
168c9e7
Merge branch 'master' of https://github.com/nhibernate/nhibernate-cor…
hazzik Dec 16, 2021
fa4042e
Regenerate async
hazzik Dec 16, 2021
625718f
Put back NHibernate.Build.props
hazzik Dec 16, 2021
90c3663
Update global.json
hazzik Dec 17, 2021
28b3747
Remove not generated files
hazzik Dec 17, 2021
71d7b67
Merge branch 'net6.0-tests' of https://github.com/hazzik/nhibernate-c…
hazzik Dec 17, 2021
951a07a
Fix globaljson
hazzik Dec 17, 2021
21e6fbc
Merge branch 'master' into net6.0-tests
hazzik Jan 3, 2022
038ec6c
Remove Directory.Build.props
hazzik Jan 10, 2022
fbcb9d6
Merge branch 'net6.0-tests' of https://github.com/hazzik/nhibernate-c…
hazzik Jan 10, 2022
73dfddd
Remove redundant defined constant
hazzik Jan 10, 2022
8a70f1f
Revert changes to sln files
hazzik Jan 10, 2022
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
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"isRoot": true,
"tools": {
"csharpasyncgenerator.tool": {
"version": "0.19.1",
"version": "0.20.1",
"commands": [
"async-generator"
]
}
}
}
}
4 changes: 2 additions & 2 deletions .github/workflows/NetCoreTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:

- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1.8.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.x
dotnet-version: 6.0.x

- name: Build and Test
run: |
Expand Down
4 changes: 2 additions & 2 deletions ShowBuildMenu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ testSetupMenu() {
}

testRun(){
dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f netcoreapp2.0
dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f netcoreapp2.0
dotnet test ./src/NHibernate.Test/NHibernate.Test.csproj -f net6.0
dotnet test ./src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj -f net6.0
mainMenu
}

Expand Down
1 change: 1 addition & 0 deletions Tools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ csharpasyncgenerator.commandline/
gitreleasemanager/
obj/
microsoft.*
netstandard.*
2 changes: 1 addition & 1 deletion Tools/BuildTool/BuildTool.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '{build}'
image: Visual Studio 2017
image: Visual Studio 2022
environment:
matrix:
- DB: SqlServer2008
Expand All @@ -8,7 +8,7 @@ environment:
CONNECTION_STRING: Host=localhost;Port=5432;Username=postgres;Password=Password12!;Database=nhibernate;Enlist=true;
- DB: Firebird
- DB: MySQL
CONNECTION_STRING: Server=127.0.0.1;Uid=root;Pwd=Password12!;Database=nhibernate;Old Guids=True;SslMode=none;
CONNECTION_STRING: Server=127.0.0.1;Uid=root;Pwd=Password12!;Database=nhibernate;Old Guids=True;SslMode=none;CharSet=utf8;
- DB: SQLite
init:
# Required for having windows endlines in sources zip
Expand Down Expand Up @@ -42,7 +42,7 @@ before_test:
Start-Service 'MySQL57'
# Create nhibernate database (not handled by NHibernate.TestDatabaseSetup.dll)
$env:MYSQL_PWD = 'Password12!'
& 'C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql' -e 'CREATE DATABASE nhibernate;' --user=root
& 'C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql' -e 'CREATE DATABASE nhibernate CHARACTER SET utf8 COLLATE utf8_general_ci;' --user=root
}
'Odbc' { Start-Service 'MSSQL$SQL2017' }
'PostgreSQL' {
Expand Down
17 changes: 10 additions & 7 deletions build-common/NHibernate.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,26 @@
<FileVersion Condition="'$(VersionSuffix)' != '' AND '$(BuildNumber)' != ''">$(VersionPrefix).$(BuildNumber)</FileVersion>
<FileVersion Condition="'$(FileVersion)' == ''">$(VersionPrefix).0</FileVersion>

<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net461;netcoreapp2.0</NhAppTargetFrameworks>
<NhAppTargetFrameworks Condition ="$(NhAppTargetFrameworks) == ''">net461;net6.0</NhAppTargetFrameworks>
<NhLibTargetFrameworks Condition ="$(NhLibTargetFrameworks) == ''">net461;netcoreapp2.0;netstandard2.0</NhLibTargetFrameworks>
<NhNetFx>false</NhNetFx>
<NhNetFx Condition="$(TargetFramework.StartsWith('net4'))">true</NhNetFx>
<DefineConstants Condition="$(NhNetFx) AND $(NhVbNet) == ''" >NETFX;$(DefineConstants)</DefineConstants>
<!-- Visual Basic requires to use coma (,) as a separator, other project types - semicolon (;) -->
<DefineConstants Condition="$(NhNetFx) AND '$(MSBuildProjectExtension)' != '.vbproj'">NETFX;$(DefineConstants)</DefineConstants>
<DefineConstants Condition="$(NhNetFx) AND '$(MSBuildProjectExtension)' == '.vbproj'">NETFX,$(DefineConstants)</DefineConstants>

<Product>NHibernate</Product>
<Company>NHibernate.info</Company>
<Copyright>Licensed under LGPL.</Copyright>
<Authors>NHibernate community, Hibernate community</Authors>
<NeutralLanguage>en-US</NeutralLanguage>

<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />

<DisableImplicitPackageTargetFallback>True</DisableImplicitPackageTargetFallback>
</PropertyGroup>
<PropertyGroup Condition="'$(IsPackable)' == 'True'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this $(IsPackable) about? I don't think it works properly. At least it seems all this information is now missing in generated nuget package

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-(

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bahusoid. '$(IsPackable)' evaluates to 'true' instead of 'True'.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed here: #3125

<PackageProjectUrl>https://nhibernate.info</PackageProjectUrl>
<PackageIconUrl>https://raw.githubusercontent.com/nhibernate/nhibernate-core/master/logo/NHibernate-NuGet.png</PackageIconUrl>
<PackageIcon>NHibernate-NuGet.png</PackageIcon>
Expand All @@ -35,11 +43,6 @@
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />

<DisableImplicitPackageTargetFallback>True</DisableImplicitPackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
Expand Down
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"version": "6.0.101",
"rollForward": "latestFeature"
}
}
2 changes: 1 addition & 1 deletion psake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Task Test -depends Build {
'NHibernate.Test',
'NHibernate.Test.VisualBasic'
) | ForEach-Object {
$assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "netcoreapp2.0", "$_.dll")
$assembly = [IO.Path]::Combine("src", $_, "bin", "Release", "net6.0", "$_.dll")
Exec {
dotnet $assembly --labels=before --nocolor "--result=$_-TestResult.xml"
}
Expand Down
11 changes: 10 additions & 1 deletion src/AsyncGenerator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
scanForMissingAsyncMembers:
- all: true
- filePath: NHibernate.Test/NHibernate.Test.csproj
targetFramework: netcoreapp2.0
targetFramework: net6.0
concurrentRun: true
applyChanges: true
suppressDiagnosticFailures:
Expand Down Expand Up @@ -230,6 +230,15 @@
- filePathEndsWith: Linq/MathTests.cs
- filePathEndsWith: Linq/ExpressionSessionLeakTest.cs
- filePathEndsWith: Linq/NorthwindDbCreator.cs
ignoreSearchForAsyncCounterparts:
- name: Wait
containingTypeName: Task
- name: Prepare
containingTypeName: DbCommand
- name: Close
containingTypeName: DbConnection
- name: Close
containingTypeName: DbDataReader
cancellationTokens:
enabled: true
scanMethodBody: true
Expand Down
17 changes: 5 additions & 12 deletions src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<NhVbNet>true</NhVbNet>
</PropertyGroup>
<Import Project="../../build-common/NHibernate.props" />
<PropertyGroup>
<Description>The Visual Basic Unit Tests for NHibernate.</Description>
Expand All @@ -11,18 +8,14 @@
<OptionExplicit>On</OptionExplicit>
<OptionStrict>On</OptionStrict>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<DefineConstants>NETCOREAPP2_0,$(DefineConstants)</DefineConstants>
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<OutputType>Exe</OutputType>
<GenerateProgramFile>false</GenerateProgramFile>
</PropertyGroup>
<PropertyGroup Condition="$(NhNetFx)">
<DefineConstants>NETFX,$(DefineConstants)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Remove="**\*.hbm.xml" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netcoreapp2.0'">
<ItemGroup Condition="'$(TargetFramework)'=='net6.0'">
<Compile Remove="**\Issues\NH3302\**" />
</ItemGroup>
<ItemGroup>
Expand All @@ -32,12 +25,12 @@
<None Include="..\NHibernate.Test\App.config" Link="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="NUnit" Version="3.13.2" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.1.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="NUnitLite" Version="3.13.2" />
</ItemGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/NHibernate.Test.VisualBasic/Program.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#If NETCOREAPP2_0
#If NETCOREAPP2_0_OR_GREATER
Public Class Program
Public Shared Function Main(args As String()) As Integer
Return New NUnitLite.AutoRun(GetType(Program).Assembly).Execute(args)
Expand Down
6 changes: 6 additions & 0 deletions src/NHibernate.Test/Async/Criteria/EntityJoinCriteriaTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ public async Task EntityProjectionForEntityJoinAsync()
[Test]
public async Task MixOfJoinsForAssociatedAndNotAssociatedEntitiesAsync()
{
#pragma warning disable CS8073 //The result of the expression is always 'false'
using (var sqlLog = new SqlLogSpy())
using (var session = OpenSession())
{
Expand All @@ -223,6 +224,7 @@ public async Task MixOfJoinsForAssociatedAndNotAssociatedEntitiesAsync()
.Take(1)
.SingleOrDefaultAsync<object>());
}
#pragma warning restore CS8073 //The result of the expression is always 'false'
}

[Test]
Expand All @@ -248,6 +250,7 @@ public async Task EntityJoinForCompositeKeyAsync()
[Test]
public async Task NullLeftEntityJoinAsync()
{
#pragma warning disable CS8073 //The result of the expression is always 'false'
using (var sqlLog = new SqlLogSpy())
using (var session = OpenSession())
{
Expand All @@ -263,11 +266,13 @@ public async Task NullLeftEntityJoinAsync()
Assert.That(NHibernateUtil.IsInitialized(root), Is.True);
Assert.That(sqlLog.Appender.GetEvents().Length, Is.EqualTo(1), "Only one SQL select is expected");
}
#pragma warning restore CS8073 //The result of the expression is always 'false'
}

[Test]
public async Task NullLeftEntityJoinWithEntityProjectionAsync()
{
#pragma warning disable CS8073 //The result of the expression is always 'false'
using (var sqlLog = new SqlLogSpy())
using (var session = OpenSession())
{
Expand All @@ -287,6 +292,7 @@ public async Task NullLeftEntityJoinWithEntityProjectionAsync()
Assert.That(ejLeftNull, Is.Null, "Entity join should be null");
Assert.That(sqlLog.Appender.GetEvents().Length, Is.EqualTo(1), "Only one SQL select is expected");
}
#pragma warning restore CS8073 //The result of the expression is always 'false'
}

[Test]
Expand Down
2 changes: 2 additions & 0 deletions src/NHibernate.Test/Async/Criteria/EntityProjectionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ public async Task EntityProjectionWithLazyPropertiesSinglePropertyFetchAsync()
[Test]
public async Task NullEntityProjectionAsync()
{
#pragma warning disable CS8073 //The result of the expression is always 'false'
using (var session = OpenSession())
{
EntitySimpleChild child1 = null;
Expand All @@ -388,6 +389,7 @@ public async Task NullEntityProjectionAsync()

Assert.That(child1, Is.Null);
}
#pragma warning restore CS8073 //The result of the expression is always 'false'
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions src/NHibernate.Test/Async/Hql/EntityJoinHqlTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,9 @@ public async Task NullableEntityProjectionAsync()
var withNullManyToOneList = await (session.Query<NullableOwner>().Where(x => x.ManyToOne == null).ToListAsync());
var withNullManyToOneJoinedList =
await ((from x in session.Query<NullableOwner>()
from x2 in session.Query<NullableOwner>()
where x == x2 && x.ManyToOne == null && x.OneToOne.Name == null
select x2).ToListAsync());
from x2 in session.Query<NullableOwner>()
where x == x2 && x.ManyToOne == null && x.OneToOne.Name == null
select x2).ToListAsync());
Assert.That(fullList.Count, Is.EqualTo(2));
Assert.That(withValidManyToOneList.Count, Is.EqualTo(0));
Assert.That(withValidManyToOneList2.Count, Is.EqualTo(0));
Expand Down
Loading