Skip to content

Commit

Permalink
.NET 9 (#3576)
Browse files Browse the repository at this point in the history
* .NET 9

* format

* update

* update

* update

* Update .editorconfig

* Update Directory.Build.props

* UT seems it changed

* Update tests/Neo.VM.Tests/UT_ScriptBuilder.cs

* fixes

* resolve a conflict

* fixed bug

* Fixes

* Update packages

* fix ut

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
  • Loading branch information
5 people authored Nov 28, 2024
1 parent 3878045 commit 1703774
Show file tree
Hide file tree
Showing 58 changed files with 154 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM mcr.microsoft.com/devcontainers/dotnet:8.0-jammy
FROM mcr.microsoft.com/devcontainers/dotnet:9.0-jammy
# Install the libleveldb-dev package
RUN apt-get update && apt-get install -y libleveldb-dev
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [published]

env:
DOTNET_VERSION: 8.0.x
DOTNET_VERSION: 9.0.x
DIST_DIR: ./dist

jobs:
Expand All @@ -29,7 +29,7 @@ jobs:
- name: Build (neo-cli)
run: |
dotnet publish ./src/Neo.CLI \
--framework net8.0 \
--framework net9.0 \
--configuration Release \
--runtime linux-x64 \
--self-contained true \
Expand All @@ -49,7 +49,7 @@ jobs:
- name: Build (LevelDbStore)
run: |
dotnet build ./src/Plugins/LevelDBStore \
--framework net8.0 \
--framework net9.0 \
--configuration Release \
--output ${{ env.DIST_DIR }}/Plugins/LevelDBStore \
--verbosity normal \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:

env:
DOTNET_VERSION: 8.0.x
DOTNET_VERSION: 9.0.x

jobs:

Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
brew install leveldb
dotnet build
cp -vp /opt/homebrew/Cellar/leveldb/1.23_1/lib/libleveldb.dylib ./tests/Neo.Plugins.Storage.Tests/bin/Debug/net8.0/
cp -vp /opt/homebrew/Cellar/leveldb/1.23_1/lib/libleveldb.dylib ./tests/Neo.Plugins.Storage.Tests/bin/Debug/net9.0/
dotnet test --blame-hang --blame-crash --no-build
- name: Test (windows)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

# Define environment variables
env:
DOTNET_VERSION: 8.0.x
DOTNET_VERSION: 9.0.x
CONFIGURATION: Release

jobs:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

# Define environment variables
env:
DOTNET_VERSION: 8.0.x
DOTNET_VERSION: 9.0.x
CONFIGURATION: Release
DIST_PATH: /tmp/dist
OUTPUT_PATH: /tmp/out
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
run: |
dotnet publish ./src/Neo.CLI \
--version-suffix ${{ matrix.runtime }} \
--framework net8.0 \
--framework net9.0 \
--configuration ${{ env.CONFIGURATION }} \
--runtime ${{ matrix.runtime }} \
--self-contained true \
Expand All @@ -128,7 +128,7 @@ jobs:
run: |
dotnet build ./src/Plugins/LevelDBStore \
--version-suffix ${{ matrix.runtime }} \
--framework net8.0 \
--framework net9.0 \
--configuration ${{ env.CONFIGURATION }} \
--output ${{ env.OUTPUT_PATH }}/${{ matrix.runtime }}/Plugins/LevelDBStore \
--verbosity normal \
Expand Down
6 changes: 3 additions & 3 deletions benchmarks/Neo.Benchmarks/Neo.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<RootNamespace>Neo</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="System.IO.Hashing" Version="9.0.0" />
<ProjectReference Include="..\..\src\Neo\Neo.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<RootNamespace>Neo.Extensions</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<ProjectReference Include="..\..\src\Neo.Extensions\Neo.Extensions.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions benchmarks/Neo.VM.Benchmarks/Neo.VM.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<RootNamespace>Neo.VM</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.3" />
<ProjectReference Include="..\..\src\Neo.Extensions\Neo.Extensions.csproj" />
<ProjectReference Include="..\..\src\Neo.Json\Neo.Json.csproj" />
<ProjectReference Include="..\..\src\Neo.VM\Neo.VM.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.12" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<ProjectReference Include="..\..\tests\Neo.VM.Tests\Neo.VM.Tests.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.202",
"version": "9.0.100",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/Neo.CLI/test-neo-cli.exp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set timeout 10
exp_internal true

# Start neo-cli
spawn dotnet ./bin/Neo.CLI/net8.0/neo-cli.dll
spawn dotnet ./bin/Neo.CLI/net9.0/neo-cli.dll

# Expect the main input prompt
expect {
Expand Down
4 changes: 2 additions & 2 deletions src/Neo.CLI/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,13 @@ private void WriteBlocks(uint start, uint count, string path, bool writeStart)
if (writeStart)
{
fs.Seek(sizeof(uint), SeekOrigin.Begin);
fs.Read(buffer, 0, buffer.Length);
fs.ReadExactly(buffer);
start += BitConverter.ToUInt32(buffer, 0);
fs.Seek(sizeof(uint), SeekOrigin.Begin);
}
else
{
fs.Read(buffer, 0, buffer.Length);
fs.ReadExactly(buffer);
start = BitConverter.ToUInt32(buffer, 0);
fs.Seek(0, SeekOrigin.Begin);
}
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.CLI/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS Build
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:9.0 AS Build

# Run this from the repository root folder
COPY src .
COPY NuGet.Config /Neo.CLI

WORKDIR /Neo.CLI
RUN dotnet restore && dotnet publish -f net8.0 -c Release -o /app
RUN dotnet restore && dotnet publish -f net9.0 -c Release -o /app

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0 AS Final
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:9.0 AS Final
RUN apt-get update && apt-get install -y \
screen \
libleveldb-dev \
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.CLI/Neo.CLI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AssemblyTitle>Neo.CLI</AssemblyTitle>
<AssemblyName>neo-cli</AssemblyName>
<OutputType>Exe</OutputType>
Expand Down
4 changes: 2 additions & 2 deletions src/Neo.ConsoleService/Neo.ConsoleService.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<PackageId>Neo.ConsoleService</PackageId>
<Nullable>enable</Nullable>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="8.0.0" />
<PackageReference Include="System.ServiceProcess.ServiceController" Version="9.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<VersionPrefix>0.3.0</VersionPrefix>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>Neo.Cryptography.BLS12_381</PackageId>
<OutputPath>../../bin/$(PackageId)</OutputPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/Neo.Extensions/Neo.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageId>Neo.Extensions</PackageId>
Expand All @@ -10,8 +10,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka" Version="1.5.26" />
<PackageReference Include="System.IO.Hashing" Version="8.0.0" />
<PackageReference Include="Akka" Version="1.5.31" />
<PackageReference Include="System.IO.Hashing" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions src/Neo.GUI/GUI/ChangePasswordDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
// modifications are permitted.

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Neo.GUI
{
internal partial class ChangePasswordDialog : Form
{
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string OldPassword
{
get
Expand All @@ -28,6 +30,7 @@ public string OldPassword
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string NewPassword
{
get
Expand Down
3 changes: 3 additions & 0 deletions src/Neo.GUI/GUI/CreateWalletDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// modifications are permitted.

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Neo.GUI
Expand All @@ -21,6 +22,7 @@ public CreateWalletDialog()
InitializeComponent();
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Password
{
get
Expand All @@ -34,6 +36,7 @@ public string Password
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string WalletPath
{
get
Expand Down
2 changes: 2 additions & 0 deletions src/Neo.GUI/GUI/ImportPrivateKeyDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// modifications are permitted.

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Neo.GUI
Expand All @@ -21,6 +22,7 @@ public ImportPrivateKeyDialog()
InitializeComponent();
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string[] WifStrings
{
get
Expand Down
3 changes: 3 additions & 0 deletions src/Neo.GUI/GUI/OpenWalletDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
// modifications are permitted.

using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Neo.GUI
Expand All @@ -21,6 +22,7 @@ public OpenWalletDialog()
InitializeComponent();
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string Password
{
get
Expand All @@ -33,6 +35,7 @@ public string Password
}
}

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public string WalletPath
{
get
Expand Down
3 changes: 3 additions & 0 deletions src/Neo.GUI/GUI/TxOutListBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ internal partial class TxOutListBox : UserControl
{
public event EventHandler ItemsChanged;

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public AssetDescriptor Asset { get; set; }

public int ItemCount => listBox1.Items.Count;

public IEnumerable<TxOutListBoxItem> Items => listBox1.Items.OfType<TxOutListBoxItem>();

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public bool ReadOnly
{
get
Expand All @@ -42,6 +44,7 @@ public bool ReadOnly
}

private UInt160 _script_hash = null;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public UInt160 ScriptHash
{
get
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.GUI/Neo.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Copyright>2016-2024 The Neo Project</Copyright>
<AssemblyTitle>Neo.GUI</AssemblyTitle>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<TargetFramework>net9.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<RootNamespace>Neo</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
Expand Down
2 changes: 1 addition & 1 deletion src/Neo.IO/Neo.IO.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1;net8.0</TargetFrameworks>
<TargetFrameworks>netstandard2.1;net9.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
<PackageId>Neo.IO</PackageId>
Expand Down
Loading

0 comments on commit 1703774

Please sign in to comment.