Skip to content

Update target frameworks & packages #388

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
24 changes: 12 additions & 12 deletions sandbox/Benchmark/Benchmark.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<Nullable>enable</Nullable>
Expand All @@ -21,24 +21,24 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="BinaryPack" Version="1.0.3" />
<PackageReference Include="K4os.Compression.LZ4" Version="1.2.16" />
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.2.16" />
<PackageReference Include="MessagePack" Version="2.4.35" />
<PackageReference Include="MessagePackAnalyzer" Version="2.4.35">
<PackageReference Include="K4os.Compression.LZ4" Version="1.3.8" />
<PackageReference Include="K4os.Compression.LZ4.Streams" Version="1.3.8" />
<PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="MessagePackAnalyzer" Version="3.1.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="7.0.0">
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
<PackageReference Include="Microsoft.Orleans.CodeGenerator" Version="9.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Orleans.Serialization" Version="7.0.0" />
<PackageReference Include="protobuf-net" Version="3.1.25" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.Orleans.Serialization" Version="9.1.2" />
<PackageReference Include="protobuf-net" Version="3.2.46" />
<PackageReference Include="System.IO.Pipelines" Version="9.0.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion sandbox/Benchmark/BenchmarkNetUtilities/PayloadColumn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;
using Perfolizer.Metrology;

namespace Benchmark.BenchmarkNetUtilities;

Expand Down Expand Up @@ -39,7 +40,7 @@ public string GetValue(Summary summary, BenchmarkCase benchmarkCase)
{
var instance = Activator.CreateInstance(benchmarkCase.Descriptor.Type);
var result = (byte[])methodInfo.Invoke(instance, null)!;
return new SizeValue(result.LongLength).ToString(null);
return new SizeValue(result.LongLength).ToString();
}
else
{
Expand Down
7 changes: 3 additions & 4 deletions sandbox/ClassLibrary/ClassLibrary.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;netstandard2.1</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\MemoryPack.Core\MemoryPack.Core.csproj" />
<ProjectReference Include="..\..\src\MemoryPack.Generator\MemoryPack.Generator.csproj">
<ProjectReference Include="../../src/MemoryPack.Core/MemoryPack.Core.csproj" />
<ProjectReference Include="../../src/MemoryPack.Generator/MemoryPack.Generator.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
6 changes: 3 additions & 3 deletions sandbox/Net6VsNet7/Net6VsNet7.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="all" />
<PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 6 additions & 5 deletions sandbox/SandboxConsoleApp/SandboxConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -16,10 +16,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ConsoleAppFramework" Version="4.2.3" />
<PackageReference Include="MessagePack" Version="2.4.35" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="ConsoleAppFramework" Version="5.4.1" />
<PackageReference Include="MessagePack" Version="3.1.3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.IO.Pipelines" Version="9.0.3" />
</ItemGroup>

<!-- output memoerypack serialization info to directory -->
Expand Down
13 changes: 7 additions & 6 deletions sandbox/SandboxConsoleApp/SystemTextJsonChecker.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using ConsoleAppFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand All @@ -11,18 +12,18 @@ namespace SandboxConsoleApp;
// check the System.Text.Json's constructor select rule.

// For a class, if the only constructor is a parameterized one, that constructor will be used.
// For a struct, or a class with multiple constructors, specify the one to use by applying the[JsonConstructor] attribute.
// For a struct, or a class with multiple constructors, specify the one to use by applying the [JsonConstructor] attribute.
// When the attribute is not used, a public parameterless constructor is always used if present.

// MemoryPack choose class/struct as same rule.
// If has no explicit constrtucotr, use parameterless one.
// If has no explicit constructor, use parameterless one.
// If has a one parameterless/parameterized constructor, choose it.
// If has multiple construcotrs, should apply [MemoryPackConstructor] attribute(no automatically choose one), otherwise generator error it.
// If has multiple constructor, should apply [MemoryPackConstructor] attribute (no automatically choose one), otherwise generator error it.

// The parameter names of a parameterized constructor must match the property names.
// Matching is case-insensitive, and the constructor parameter must match the actual property name.

class SystemTextJsonChecker : ConsoleAppBase
class SystemTextJsonChecker
{
//[RootCommand]
public void JsonConstructorSelector()
Expand Down Expand Up @@ -57,7 +58,7 @@ public void JsonConstructorSelector()
JsonSerializer.Deserialize<Seven>(seven);
}

[RootCommand]
[Command("")]
public void PrivateSerialization()
{
// private field/property can not annnotate JsonInclude
Expand Down
3 changes: 1 addition & 2 deletions sandbox/SandboxNet6/SandboxNet6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10.0</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions sandbox/SandboxWebApp/SandboxWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="4.9.0-beta">
<PackageReference Include="Microsoft.TypeScript.MSBuild" Version="5.8.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFrameworks>net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<OutputType>Library</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -11,7 +11,7 @@

<ItemGroup>
<None Include="../../Icon.png" Pack="true" PackagePath="/" />
<ProjectReference Include="..\MemoryPack.Core\MemoryPack.Core.csproj" />
<ProjectReference Include="../MemoryPack.Core/MemoryPack.Core.csproj" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;netstandard2.1</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand All @@ -17,8 +17,8 @@
</ItemGroup>

<ItemGroup Condition="$(TargetFramework) == 'netstandard2.1'">
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.1" />
<PackageReference Include="System.Collections.Immutable" Version="9.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/MemoryPack.Generator/MemoryPack.Generator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>12</LangVersion>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<Nullable>enable</Nullable>
Expand All @@ -22,8 +22,8 @@
<!-- https://learn.microsoft.com/en-us/visualstudio/extensibility/roslyn-version-support?view=vs-2022 -->
<!-- require to support SyntaxValueProvider.ForAttributeWithMetadataName(Roslyn 4.3.0, VS2022 17.3) -->
<!-- Unity 2022.3.12f1 or newer supports 4.3.0 -->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/MemoryPack.Generator/MemoryPackGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ class GeneratorContext : IGeneratorContext
{
SourceProductionContext context;

public GeneratorContext(SourceProductionContext context, LanguageVersion languageVersion, bool isNet70OrGreater)
public GeneratorContext(SourceProductionContext context, LanguageVersion languageVersion, bool isNet7OrGreater)
{
this.context = context;
this.LanguageVersion = languageVersion;
this.IsNet7OrGreater = isNet70OrGreater;
this.IsNet7OrGreater = isNet7OrGreater;
}

public CancellationToken CancellationToken => context.CancellationToken;
Expand Down
6 changes: 3 additions & 3 deletions src/MemoryPack.Streaming/MemoryPack.Streaming.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;netstandard2.1</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);CS1591;CA2255</NoWarn>
Expand All @@ -15,11 +15,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.IO.Pipelines" Version="6.0.3" />
<PackageReference Include="System.IO.Pipelines" Version="9.0.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MemoryPack.Core\MemoryPack.Core.csproj" />
<ProjectReference Include="../MemoryPack.Core/MemoryPack.Core.csproj" />
</ItemGroup>

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

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;netstandard2.1</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
Expand All @@ -16,8 +16,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\MemoryPack.Core\MemoryPack.Core.csproj" />
<ProjectReference Include="..\..\src\MemoryPack.Generator\MemoryPack.Generator.csproj">
<ProjectReference Include="../MemoryPack.Core/MemoryPack.Core.csproj" />
<ProjectReference Include="../../src/MemoryPack.Generator/MemoryPack.Generator.csproj">
<OutputItemType>Analyzer</OutputItemType>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
Expand Down
8 changes: 4 additions & 4 deletions src/MemoryPack/MemoryPack.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0;netstandard2.1</TargetFrameworks>
<!-- This project is meta package -->
<IncludeBuildOutput>false</IncludeBuildOutput>
<IncludeContentInPack>true</IncludeContentInPack>
Expand All @@ -11,10 +11,10 @@
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="..\..\LICENSE.md" />
<EmbeddedResource Include="../../LICENSE.md" />
<None Include="../../Icon.png" Pack="true" PackagePath="/" />
<ProjectReference Include="..\MemoryPack.Core\MemoryPack.Core.csproj" />
<ProjectReference Include="..\MemoryPack.Generator\MemoryPack.Generator.csproj" />
<ProjectReference Include="../MemoryPack.Core/MemoryPack.Core.csproj" />
<ProjectReference Include="../MemoryPack.Generator/MemoryPack.Generator.csproj" />
</ItemGroup>

</Project>
13 changes: 7 additions & 6 deletions tests/MemoryPack.Tests/MemoryPack.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.1" />
<PackageReference Include="FluentAssertions" Version="[7.2.0]" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="RandomFixtureKit" Version="1.0.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ public partial class MyClass

}
}


4 changes: 2 additions & 2 deletions tests/MemoryPack.Tests/Utils/CSharpGeneratorRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static (Compilation, ImmutableArray<Diagnostic>) RunGenerator(string sour
{
preprocessorSymbols = new[] { "NET7_0_OR_GREATER" };
}
var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp11, preprocessorSymbols: preprocessorSymbols);
var parseOptions = new CSharpParseOptions(LanguageVersion.Latest, preprocessorSymbols: preprocessorSymbols);

var driver = CSharpGeneratorDriver.Create(new MemoryPackGenerator()).WithUpdatedParseOptions(parseOptions);
if (options != null)
Expand All @@ -68,7 +68,7 @@ public static (Compilation, ImmutableArray<Diagnostic>) RunGenerator(string sour

public static (string Key, string Reasons)[][] GetIncrementalGeneratorTrackedStepsReasons(string keyPrefixFilter, params string[] sources)
{
var parseOptions = new CSharpParseOptions(LanguageVersion.CSharp11);
var parseOptions = new CSharpParseOptions(LanguageVersion.Latest);
var driver = CSharpGeneratorDriver.Create(
[new MemoryPackGenerator().AsSourceGenerator()],
driverOptions: new GeneratorDriverOptions(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true))
Expand Down