Skip to content
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

Upgrade to .NET 8.0 #139

Open
wants to merge 14 commits 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
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
</ItemGroup>

Expand All @@ -71,10 +71,10 @@
properly to the test project output folder, which then causes the test runner to treat the project
as a "self-contained app".
-->
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.4" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.4" />
<PackageReference Include="coverlet.collector" Version="3.0.3" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<Compile Include="$(MSBuildThisFileDirectory)\Common\TestUtilities\AssertEx.cs" Link="AssertEx.cs" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"#r \"bin/Debug/net6.0/Nuqleon.Collections.Specialized.dll\""
"#r \"bin/Debug/net8.0/Nuqleon.Collections.Specialized.dll\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>Specialized data structures implemented for performance. Currently includes an optimized BitArray implementation, and a dictionary implementation optimized for enum keys.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"#r \"bin/Debug/net6.0/Nuqleon.IO.StreamSegment.dll\""
"#r \"bin/Debug/net8.0/Nuqleon.IO.StreamSegment.dll\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>Provides functionality to create a segment over a System.IO.Stream.</Description>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Nuqleon/Core/BCL/Nuqleon.Memory/GettingStarted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"#r \"bin/Debug/net6.0/Nuqleon.Memory.dll\""
"#r \"bin/Debug/net8.0/Nuqleon.Memory.dll\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion Nuqleon/Core/BCL/Nuqleon.Memory/Nuqleon.Memory.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>A collection of utilities for optimizing memory usage.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ private void WriteHeader(StringBuilder sb, string header, char separator)
private void Write(StringBuilder sb, string str)
{
var parts =
#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
str.Replace("\r\n", "\n", StringComparison.Ordinal)
#else
str.Replace("\r\n", "\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"#r \"bin/Debug/net6.0/Nuqleon.Reflection.Virtualization.dll\""
"#r \"bin/Debug/net8.0/Nuqleon.Reflection.Virtualization.dll\""
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>Provides a virtualization layer for reflection.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ protected DefaultReflectionProvider() { }
/// <returns>A <see cref="MethodBase" /> object representing the method or constructor specified by <paramref name="handle" />, in the generic type specified by <paramref name="declaringType" />.</returns>
public override MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType) => MethodBase.GetMethodFromHandle(handle, declaringType);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the location of the assembly as specified originally, for example, in an <see cref="AssemblyName" /> object.
/// </summary>
Expand All @@ -240,7 +240,7 @@ protected DefaultReflectionProvider() { }
/// <returns>An object that represents the entry point of this assembly. If no entry point is found (for example, the assembly is a DLL), null is returned.</returns>
public override MethodInfo GetEntryPoint(Assembly assembly) => assembly.EntryPoint;

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the URI, including escape characters, that represents the codebase.
/// </summary>
Expand All @@ -265,7 +265,7 @@ protected DefaultReflectionProvider() { }
/// <returns>The display name of the assembly.</returns>
public override string GetFullName(Assembly assembly) => assembly.FullName;

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets a value indicating whether the assembly was loaded from the global assembly cache.
/// </summary>
Expand Down Expand Up @@ -1637,7 +1637,7 @@ protected DefaultReflectionProvider() { }
/// <returns>An array of <see cref="MemberInfo" /> objects representing all members defined for the specified type that match the specified binding constraints.-or- An empty array of type <see cref="MemberInfo" />, if no members are defined for the specified type, or if none of the defined members match the binding constraints.</returns>
public override IReadOnlyList<MemberInfo> GetMembers(Type type, BindingFlags bindingAttr) => type.GetMembers(bindingAttr);

#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
/// <summary>
/// Searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints and the specified calling convention.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace System.Reflection
[GeneratedCode("", "1.0.0.0")] // NB: A mirror image of System.Reflection APIs, so considering this to be "generated".
public interface IAssemblyIntrospectionProvider
{
#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the location of the assembly as specified originally, for example, in an <see cref="AssemblyName" /> object.
/// </summary>
Expand All @@ -49,7 +49,7 @@ public interface IAssemblyIntrospectionProvider
/// <returns>An object that represents the entry point of this assembly. If no entry point is found (for example, the assembly is a DLL), null is returned.</returns>
MethodInfo GetEntryPoint(Assembly assembly);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the URI, including escape characters, that represents the codebase.
/// </summary>
Expand All @@ -74,7 +74,7 @@ public interface IAssemblyIntrospectionProvider
/// <returns>The display name of the assembly.</returns>
string GetFullName(Assembly assembly);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets a value indicating whether the assembly was loaded from the global assembly cache.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ public interface ITypeIntrospectionProvider : IMemberInfoIntrospectionProvider,
/// <returns>An array of <see cref="MemberInfo" /> objects representing all members defined for the specified type that match the specified binding constraints.-or- An empty array of type <see cref="MemberInfo" />, if no members are defined for the specified type, or if none of the defined members match the binding constraints.</returns>
IReadOnlyList<MemberInfo> GetMembers(Type type, BindingFlags bindingAttr);

#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
/// <summary>
/// Searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints and the specified calling convention.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public abstract class ReflectionProvider : IReflectionProvider
/// <returns>A <see cref="MethodBase" /> object representing the method or constructor specified by <paramref name="handle" />, in the generic type specified by <paramref name="declaringType" />.</returns>
public abstract MethodBase GetMethodFromHandle(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the location of the assembly as specified originally, for example, in an <see cref="AssemblyName" /> object.
/// </summary>
Expand All @@ -215,7 +215,7 @@ public abstract class ReflectionProvider : IReflectionProvider
/// <returns>An object that represents the entry point of this assembly. If no entry point is found (for example, the assembly is a DLL), null is returned.</returns>
public abstract MethodInfo GetEntryPoint(Assembly assembly);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets the URI, including escape characters, that represents the codebase.
/// </summary>
Expand All @@ -240,7 +240,7 @@ public abstract class ReflectionProvider : IReflectionProvider
/// <returns>The display name of the assembly.</returns>
public abstract string GetFullName(Assembly assembly);

#if !NET6_0
#if !NET8_0
/// <summary>
/// Gets a value indicating whether the assembly was loaded from the global assembly cache.
/// </summary>
Expand Down Expand Up @@ -611,7 +611,7 @@ public abstract class ReflectionProvider : IReflectionProvider
/// <returns>An array of type <see cref="FieldInfo" /> representing the global fields defined on the module that match the specified binding flags; if no global fields match the binding flags, an empty array is returned.</returns>
public abstract IReadOnlyList<FieldInfo> GetFields(Module module, BindingFlags bindingFlags);

#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
/// <summary>
/// Searches for the specified method whose parameters match the specified generic parameter count, argument types and modifiers, using the specified binding constraints and the specified calling convention.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public static class TypeIntrospectionProviderExtensions
/// <returns>An object representing the method that matches the specified requirements, if found; otherwise, null.</returns>
public static MethodInfo GetMethod(this ITypeIntrospectionProvider provider, Type type, string name) => NotNull(NotNull(provider)).GetMethod(type, name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);

#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
/// <summary>
/// Searches for the specified public method whose parameters match the specified generic parameter count and argument types.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static bool SequenceEqual(Type[] left, Type[] right)

public static int GetHashCode<TDefinition>(TDefinition def, Type[] args)
{
#if NET6_0
#if NET8_0
HashCode h = new();

h.Add(def);
Expand Down
2 changes: 1 addition & 1 deletion Nuqleon/Core/BCL/Nuqleon.Time/GettingStarted.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
},
"outputs": [],
"source": [
"#r \"bin/Debug/net6.0/Nuqleon.Time.dll\""
"#r \"bin/Debug/net8.0/Nuqleon.Time.dll\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion Nuqleon/Core/BCL/Nuqleon.Time/Nuqleon.Time.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>A collection of utilities to deal with physical and virtual time.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using System.Linq;
using System.Linq.Expressions;

#if !NET6_0
#if !NET8_0
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
#endif
Expand Down Expand Up @@ -789,7 +789,7 @@ private enum EnumUShort : ushort
Z = ushort.MaxValue,
}

#if !NET6_0 // https://aka.ms/binaryformatter
#if !NET8_0 // https://aka.ms/binaryformatter
[TestMethod]
public void EnumSizeResolutionException_Serialization()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Collections.Generic;
using System.Linq;

#if !NET6_0
#if !NET8_0
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
#endif
Expand Down Expand Up @@ -215,7 +215,7 @@ public void PooledDictionary_GetInstance()
}
}

#if !NET6_0 // https://aka.ms/binaryformatter
#if !NET8_0 // https://aka.ms/binaryformatter
[TestMethod]
public void PooledDictionary_Serialization()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Collections.Generic;
using System.Linq;

#if !NET6_0
#if !NET8_0
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
#endif
Expand Down Expand Up @@ -203,7 +203,7 @@ public void PooledHashSet_GetInstance()
}
}

#if !NET6_0 // https://aka.ms/binaryformatter
#if !NET8_0 // https://aka.ms/binaryformatter
[TestMethod]
public void PooledHashSet_Serialization()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ public void Type_Members_Trivial() => WithProviders(p =>
Assert.AreEqual(substring, p.GetMethod(typeof(string), nameof(string.Substring), BindingFlags.Public | BindingFlags.Instance, binder: null, new[] { typeof(int), typeof(int) }, modifiers: null));
Assert.AreEqual(substring, p.GetMethod(typeof(string), nameof(string.Substring), BindingFlags.Public | BindingFlags.Instance, binder: null, CallingConventions.Any, new[] { typeof(int), typeof(int) }, modifiers: null));

#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
Assert.AreEqual(substring, p.GetMethod(typeof(string), nameof(string.Substring), genericParameterCount: 0, new[] { typeof(int), typeof(int) }));
Assert.AreEqual(substring, p.GetMethod(typeof(string), nameof(string.Substring), genericParameterCount: 0, new[] { typeof(int), typeof(int) }, modifiers: null));
Assert.AreEqual(substring, p.GetMethod(typeof(string), nameof(string.Substring), genericParameterCount: 0, BindingFlags.Public | BindingFlags.Instance, binder: null, new[] { typeof(int), typeof(int) }, modifiers: null));
Expand Down Expand Up @@ -1068,7 +1068,7 @@ public void Assembly_Properties() => WithProviders(p =>
{
var asm = typeof(string).Assembly;

#if !NET6_0
#if !NET8_0
Assert.AreEqual(asm.CodeBase, p.GetCodeBase(asm));
Assert.AreEqual(asm.EscapedCodeBase, p.GetEscapedCodeBase(asm));
Assert.AreEqual(asm.GlobalAssemblyCache, p.GetGlobalAssemblyCache(asm));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public PropertyDataSlim(string name, TypeSlim type)
/// <returns>A hash code.</returns>
public override int GetHashCode() =>
HashHelpers.Combine(
#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
Name?.GetHashCode(StringComparison.Ordinal) ?? 0,
#else
Name?.GetHashCode() ?? 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net472;net8.0</TargetFrameworks>
<Description>Tools for creating and substituting anonymized versions of data model types in expressions.</Description>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private string PrintCycleRich(DataType type)
var sortedTypes =
_namedTypes.OrderBy(kv =>
int.Parse(
#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
kv.Value.Name[TYPEPREFIX.Length..],
#else
kv.Value.Name.Substring(TYPEPREFIX.Length),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ protected virtual int GetHashCodeStructural(object obj, StructuralDataType dataT
}
#else
hash = (int)(hash * Prime) +
#if NET6_0 || NETSTANDARD2_1
#if NET8_0 || NETSTANDARD2_1
property.Name.GetHashCode(StringComparison.Ordinal)
#else
property.Name.GetHashCode()
Expand Down
Loading