From cdbe587fa20552f9df8b204c261eb6c442a1aac8 Mon Sep 17 00:00:00 2001 From: MIVerTFT <894972+MIVerTFT@users.noreply.github.com> Date: Tue, 6 Aug 2024 10:59:34 +0300 Subject: [PATCH 1/9] Added support .net 8 --- GrEmit.Tests/GrEmit.Tests.csproj | 2 +- GrEmit.Tests/Test.cs | 13 ++++++ GrEmit/Utils/ReflectionExtensions.cs | 65 ++++++++++++++++++---------- global.json | 2 +- 4 files changed, 56 insertions(+), 26 deletions(-) diff --git a/GrEmit.Tests/GrEmit.Tests.csproj b/GrEmit.Tests/GrEmit.Tests.csproj index 8bd0031..48a14fc 100644 --- a/GrEmit.Tests/GrEmit.Tests.csproj +++ b/GrEmit.Tests/GrEmit.Tests.csproj @@ -2,7 +2,7 @@ false - net45;netcoreapp3.1;net6.0 + net45;netcoreapp3.1;net6.0;net8.0 diff --git a/GrEmit.Tests/Test.cs b/GrEmit.Tests/Test.cs index 648bfb4..4a844a7 100644 --- a/GrEmit.Tests/Test.cs +++ b/GrEmit.Tests/Test.cs @@ -407,6 +407,19 @@ public static void F2(I2 i2) { } + [Test] + public void TestDefineConstructor() + { + var assembly = AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(Guid.NewGuid().ToString()), AssemblyBuilderAccess.Run); + var module = assembly.DefineDynamicModule(Guid.NewGuid().ToString()); + var type = module.DefineType("Zzz", TypeAttributes.Class | TypeAttributes.Public); + var ctr = type.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, null); + using (var il = new GroboIL(ctr)) + { + il.Ret(); + } + } + [Test] public void TestDifferentPathsGeneric() { diff --git a/GrEmit/Utils/ReflectionExtensions.cs b/GrEmit/Utils/ReflectionExtensions.cs index 692b762..9b2f0cf 100644 --- a/GrEmit/Utils/ReflectionExtensions.cs +++ b/GrEmit/Utils/ReflectionExtensions.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -12,9 +12,14 @@ public static class ReflectionExtensions static ReflectionExtensions() { IsMono = Type.GetType("Mono.Runtime") != null; + IsNet8 = Environment.Version.Major == 8; var assembly = typeof(MethodInfo).Assembly; var types = assembly.GetTypes(); + runtimeConstructorBuilder = TryFindType(types, "RuntimeConstructorBuilder") ?? FindType(types, "ConstructorBuilder"); + runtimeMethodBuilder = TryFindType(types, "RuntimeMethodBuilder") ?? FindType(types, "MethodBuilder"); + runtimeGenericTypeParameterBuilder = TryFindType(types, "RuntimeGenericTypeParameterBuilder") ?? FindType(types, "GenericTypeParameterBuilder"); + runtimeTypeBuilder = TryFindType(types, "RuntimeTypeBuilder") ?? FindType(types, "TypeBuilder"); var runtimeTypeType = FindType(types, "RuntimeType"); var monoTypeType = !IsMono ? runtimeTypeType : FindType(types, "MonoType"); @@ -57,11 +62,11 @@ static ReflectionExtensions() returnTypeExtractors[runtimeMethodInfoType] = returnTypeExtractors[runtimeGenericMethodInfoType] = returnTypeExtractors[typeof(DynamicMethod)] - = returnTypeExtractors[typeof(MethodBuilder)] + = returnTypeExtractors[runtimeMethodBuilder] = (Func)(method => method.ReturnType); baseTypeOfTypeExtractors[runtimeTypeType] = baseTypeOfTypeExtractors[monoTypeType] - = baseTypeOfTypeExtractors[typeof(TypeBuilder)] + = baseTypeOfTypeExtractors[runtimeTypeBuilder] = baseTypeOfTypeExtractors[typeof(GenericTypeParameterBuilder)] = baseTypeOfTypeExtractors[byRefTypeType] = baseTypeOfTypeExtractors[pointerTypeType] @@ -70,13 +75,14 @@ static ReflectionExtensions() interfacesOfTypeExtractors[runtimeTypeType] = interfacesOfTypeExtractors[monoTypeType] = (Func)(type => type.GetInterfaces()); - interfacesOfTypeExtractors[typeof(TypeBuilder)] + interfacesOfTypeExtractors[runtimeTypeBuilder] = (Func)(type => GetInterfaces(GetBaseType(type)).Concat(type.GetInterfaces()).Distinct().ToArray()); interfacesOfTypeExtractors[typeof(GenericTypeParameterBuilder)] = (Func)(type => type.GetGenericParameterConstraints()); typeComparers[runtimeTypeType] = typeComparers[monoTypeType] - = typeComparers[typeof(TypeBuilder)] - = typeComparers[typeof(GenericTypeParameterBuilder)] = (Func)((x, y) => x == y); + = typeComparers[runtimeTypeBuilder] + = typeComparers[runtimeGenericTypeParameterBuilder] = (Func)((x, y) => x == y); + typeComparers[byRefTypeType] = typeComparers[pointerTypeType] = typeComparers[arrayTypeType] @@ -93,7 +99,7 @@ static ReflectionExtensions() hashCodeCalculators[runtimeTypeType] = hashCodeCalculators[monoTypeType] = hashCodeCalculators[typeof(TypeBuilder)] - = hashCodeCalculators[typeof(GenericTypeParameterBuilder)] + = hashCodeCalculators[runtimeGenericTypeParameterBuilder] = (Func)(type => type.GetHashCode()); hashCodeCalculators[byRefTypeType] = hashCodeCalculators[pointerTypeType] @@ -127,11 +133,12 @@ static ReflectionExtensions() } return false; }); - assignabilityCheckers[typeof(TypeBuilder)] = (Func)((to, from) => to.IsAssignableFrom(from)); + assignabilityCheckers[runtimeTypeBuilder] = (Func)((to, from) => to.IsAssignableFrom(from)); - parameterTypesExtractors[typeof(MethodBuilder)] + parameterTypesExtractors[runtimeMethodBuilder] = (Func)(method => new MethodBuilderWrapper(method).ParameterTypes); - parameterTypesExtractors[typeof(ConstructorBuilder)] + + parameterTypesExtractors[runtimeConstructorBuilder] = (Func)(method => new ConstructorBuilderWrapper(method).ParameterTypes); parameterTypesExtractors[methodOnTypeBuilderInstType] = (Func)(method => new MethodOnTypeBuilderInstWrapper(method).ParameterTypes); @@ -197,6 +204,7 @@ static ReflectionExtensions() } internal static bool IsMono { get; } + internal static bool IsNet8 { get; } public static Type[] GetParameterTypes(MethodBase method) { @@ -362,6 +370,10 @@ private static Type SubstituteGenericParameters(Type type, Dictionary(parameterTypesField); } @@ -414,9 +426,9 @@ static ConstructorBuilderWrapper() { if (!IsMono) { - var methodBuilderField = typeof(ConstructorBuilder).GetField("m_methodBuilder", BindingFlags.Instance | BindingFlags.NonPublic); + var methodBuilderField = runtimeConstructorBuilder.GetField("m_methodBuilder", BindingFlags.Instance | BindingFlags.NonPublic); if (methodBuilderField == null) - throw new InvalidOperationException("Field 'ConstructorBuilder.m_methodBuilder' is not found"); + throw new InvalidOperationException("Field 'RuntimeConstructorBuilder.m_methodBuilder' is not found"); m_methodBuilderExtractor = FieldsExtractor.GetExtractor(methodBuilderField); } else @@ -453,8 +465,10 @@ private class TypeBuilderInstWrapper { static TypeBuilderInstWrapper() { - string typeFieldName = IsMono ? "generic_type" : "m_type"; - string instFieldName = IsMono ? "type_arguments" : "m_inst"; + string typeFieldName = IsMono ? "generic_type" : (IsNet8 ? "_genericType" : "m_type"); + string instFieldName = IsMono ? "type_arguments" : (IsNet8 ? "_typeArguments" : "m_inst"); + + var typeField = typeBuilderInstType.GetField(typeFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (typeField == null) throw new InvalidOperationException($"Field '{typeBuilderInstType.Name}.{typeFieldName}' is not found"); @@ -548,8 +562,8 @@ private class MethodOnTypeBuilderInstWrapper { static MethodOnTypeBuilderInstWrapper() { - string methodFieldName = IsMono ? "base_method" : "m_method"; - string typeFieldName = IsMono ? "instantiation" : "m_type"; + string methodFieldName = IsMono ? "base_method" : (IsNet8 ? "_method" : "m_method"); + string typeFieldName = IsMono ? "instantiation" : (IsNet8 ? "_type" : "m_type"); var methodField = methodOnTypeBuilderInstType.GetField(methodFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (methodField == null) throw new InvalidOperationException($"Field '{methodOnTypeBuilderInstType.Name}.{methodFieldName}' is not found"); @@ -632,8 +646,8 @@ private class ConstructorOnTypeBuilderInstWrapper { static ConstructorOnTypeBuilderInstWrapper() { - string ctorFieldName = IsMono ? "cb" : "m_ctor"; - string typeFieldName = IsMono ? "instantiation" : "m_type"; + string ctorFieldName = IsMono ? "cb" : (IsNet8 ? "_ctor" : "m_ctor"); + string typeFieldName = IsMono ? "instantiation" : (IsNet8 ? "_type" : "m_type"); var ctorField = constructorOnTypeBuilderInstType.GetField(ctorFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (ctorField == null) throw new InvalidOperationException($"Field '{constructorOnTypeBuilderInstType.Name}.{ctorFieldName}' is not found"); @@ -672,14 +686,17 @@ private class MethodBuilderInstWrapper { static MethodBuilderInstWrapper() { - var methodField = methodBuilderInstType.GetField("m_method", BindingFlags.Instance | BindingFlags.NonPublic); + var mMethodName = IsNet8 ? "_method" : "m_method"; + var methodField = methodBuilderInstType.GetField(mMethodName, BindingFlags.Instance | BindingFlags.NonPublic); if (methodField == null) - throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.m_method' is not found"); + throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.{mMethodName}' is not found"); m_methodExtractor = FieldsExtractor.GetExtractor(methodField); - var instField = methodBuilderInstType.GetField("m_inst", BindingFlags.Instance | BindingFlags.NonPublic); + var mInstName = IsNet8 ? "_inst" : "m_inst"; + var instField = methodBuilderInstType.GetField(mInstName, BindingFlags.Instance | BindingFlags.NonPublic); if (instField == null) - throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.m_inst' is not found"); + throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.{mInstName}' is not found"); m_instExtractor = FieldsExtractor.GetExtractor(instField); + //} } public MethodBuilderInstWrapper(MethodBase inst) diff --git a/global.json b/global.json index d6c2c37..33a0731 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "6.0.100", + "version": "8.0.101", "rollForward": "latestFeature" } } \ No newline at end of file From 929774328fb75c8050002d7777c8c36570ef9a5e Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 16:33:55 +0500 Subject: [PATCH 2/9] future dotnet versions are now also considered when selecting field names --- GrEmit/Utils/ReflectionExtensions.cs | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/GrEmit/Utils/ReflectionExtensions.cs b/GrEmit/Utils/ReflectionExtensions.cs index 9b2f0cf..10592a2 100644 --- a/GrEmit/Utils/ReflectionExtensions.cs +++ b/GrEmit/Utils/ReflectionExtensions.cs @@ -12,7 +12,7 @@ public static class ReflectionExtensions static ReflectionExtensions() { IsMono = Type.GetType("Mono.Runtime") != null; - IsNet8 = Environment.Version.Major == 8; + DotnetVersion = Environment.Version.Major; var assembly = typeof(MethodInfo).Assembly; var types = assembly.GetTypes(); @@ -204,7 +204,7 @@ static ReflectionExtensions() } internal static bool IsMono { get; } - internal static bool IsNet8 { get; } + internal static int DotnetVersion { get; } public static Type[] GetParameterTypes(MethodBase method) { @@ -405,7 +405,7 @@ static MethodBuilderWrapper() string parameterTypesFieldName = IsMono ? "parameters" : "m_parameterTypes"; var parameterTypesField = runtimeMethodBuilder.GetField(parameterTypesFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (parameterTypesField == null) - throw new InvalidOperationException($"Field 'RuntimeMethodBuilder.{parameterTypesFieldName}' is not found"); + throw new InvalidOperationException($"Field '{runtimeMethodBuilder.Name}.{parameterTypesFieldName}' is not found"); m_parameterTypesExtractor = FieldsExtractor.GetExtractor(parameterTypesField); } @@ -428,7 +428,7 @@ static ConstructorBuilderWrapper() { var methodBuilderField = runtimeConstructorBuilder.GetField("m_methodBuilder", BindingFlags.Instance | BindingFlags.NonPublic); if (methodBuilderField == null) - throw new InvalidOperationException("Field 'RuntimeConstructorBuilder.m_methodBuilder' is not found"); + throw new InvalidOperationException($"Field '{runtimeConstructorBuilder.Name}.m_methodBuilder' is not found"); m_methodBuilderExtractor = FieldsExtractor.GetExtractor(methodBuilderField); } else @@ -465,10 +465,8 @@ private class TypeBuilderInstWrapper { static TypeBuilderInstWrapper() { - string typeFieldName = IsMono ? "generic_type" : (IsNet8 ? "_genericType" : "m_type"); - string instFieldName = IsMono ? "type_arguments" : (IsNet8 ? "_typeArguments" : "m_inst"); - - + string typeFieldName = IsMono ? "generic_type" : DotnetVersion < 8 ? "m_type" : "_genericType"; + string instFieldName = IsMono ? "type_arguments" : DotnetVersion < 8 ? "m_inst" : "_typeArguments"; var typeField = typeBuilderInstType.GetField(typeFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (typeField == null) throw new InvalidOperationException($"Field '{typeBuilderInstType.Name}.{typeFieldName}' is not found"); @@ -562,8 +560,8 @@ private class MethodOnTypeBuilderInstWrapper { static MethodOnTypeBuilderInstWrapper() { - string methodFieldName = IsMono ? "base_method" : (IsNet8 ? "_method" : "m_method"); - string typeFieldName = IsMono ? "instantiation" : (IsNet8 ? "_type" : "m_type"); + string methodFieldName = IsMono ? "base_method" : DotnetVersion < 8 ? "m_method" : "_method"; + string typeFieldName = IsMono ? "instantiation" : DotnetVersion < 8 ? "m_type" : "_type"; var methodField = methodOnTypeBuilderInstType.GetField(methodFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (methodField == null) throw new InvalidOperationException($"Field '{methodOnTypeBuilderInstType.Name}.{methodFieldName}' is not found"); @@ -646,8 +644,8 @@ private class ConstructorOnTypeBuilderInstWrapper { static ConstructorOnTypeBuilderInstWrapper() { - string ctorFieldName = IsMono ? "cb" : (IsNet8 ? "_ctor" : "m_ctor"); - string typeFieldName = IsMono ? "instantiation" : (IsNet8 ? "_type" : "m_type"); + string ctorFieldName = IsMono ? "cb" : DotnetVersion < 8 ? "m_ctor" : "_ctor"; + string typeFieldName = IsMono ? "instantiation" : DotnetVersion < 8 ? "m_type" : "_type"; var ctorField = constructorOnTypeBuilderInstType.GetField(ctorFieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (ctorField == null) throw new InvalidOperationException($"Field '{constructorOnTypeBuilderInstType.Name}.{ctorFieldName}' is not found"); @@ -686,17 +684,16 @@ private class MethodBuilderInstWrapper { static MethodBuilderInstWrapper() { - var mMethodName = IsNet8 ? "_method" : "m_method"; + var mMethodName = DotnetVersion < 8 ? "m_method" : "_method"; var methodField = methodBuilderInstType.GetField(mMethodName, BindingFlags.Instance | BindingFlags.NonPublic); if (methodField == null) throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.{mMethodName}' is not found"); m_methodExtractor = FieldsExtractor.GetExtractor(methodField); - var mInstName = IsNet8 ? "_inst" : "m_inst"; + var mInstName = DotnetVersion < 8 ? "m_inst" : "_inst"; var instField = methodBuilderInstType.GetField(mInstName, BindingFlags.Instance | BindingFlags.NonPublic); if (instField == null) throw new InvalidOperationException($"Field '{methodBuilderInstType.Name}.{mInstName}' is not found"); m_instExtractor = FieldsExtractor.GetExtractor(instField); - //} } public MethodBuilderInstWrapper(MethodBase inst) From 39f1ca7c7ecd4b128fb69e068670dbd71599ac67 Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 13:34:05 +0500 Subject: [PATCH 3/9] update actions to net8 --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 008551c..265fd98 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -4,7 +4,7 @@ on: - "**/*.md" pull_request: env: - DOTNET_VERSION: 6.0.x + DOTNET_VERSION: 8.0.x SOLUTION_FILE: GrEmit.sln jobs: test: From 1fa1b6ea30d2612d2594309a42d84de936c53f36 Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 14:13:18 +0500 Subject: [PATCH 4/9] starting with .NET 8, Source Link is included in the .NET SDK and enabled by default --- Directory.Build.props | 1 - 1 file changed, 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index f3505f8..3ff9585 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,7 +14,6 @@ - From c232e3561ef800b61561bc40a071dad36a6c6526 Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 18:17:20 +0500 Subject: [PATCH 5/9] consistent update versions of dotnet and jb tools --- .config/dotnet-tools.json | 2 +- global.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 2a93aa0..fcec912 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2021.2.2", + "version": "2024.1.5", "commands": [ "jb" ] diff --git a/global.json b/global.json index 33a0731..d92fc07 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.101", + "version": "8.0.303", "rollForward": "latestFeature" } } \ No newline at end of file From b7f16f335263564f72ff2d5aaabcf4cb8512e12e Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 18:19:16 +0500 Subject: [PATCH 6/9] style fix --- GrEmit/Utils/ReflectionExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GrEmit/Utils/ReflectionExtensions.cs b/GrEmit/Utils/ReflectionExtensions.cs index 10592a2..7e66358 100644 --- a/GrEmit/Utils/ReflectionExtensions.cs +++ b/GrEmit/Utils/ReflectionExtensions.cs @@ -137,7 +137,7 @@ static ReflectionExtensions() parameterTypesExtractors[runtimeMethodBuilder] = (Func)(method => new MethodBuilderWrapper(method).ParameterTypes); - + parameterTypesExtractors[runtimeConstructorBuilder] = (Func)(method => new ConstructorBuilderWrapper(method).ParameterTypes); parameterTypesExtractors[methodOnTypeBuilderInstType] From 36233204343d5755d6e43bc89b41916e08d8a7a2 Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 18:26:03 +0500 Subject: [PATCH 7/9] Fix compiler warning: replace int->ulong cast with int->uint->ulong to avoid sign-extension and prefer zero-extension. Now, UniqueToken is literally a binary combination of two numbers. --- GrEmit/Utils/HackHelpers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GrEmit/Utils/HackHelpers.cs b/GrEmit/Utils/HackHelpers.cs index e338346..294702b 100644 --- a/GrEmit/Utils/HackHelpers.cs +++ b/GrEmit/Utils/HackHelpers.cs @@ -17,13 +17,13 @@ public static Type GetValueTypeForNullableOrNull(Type mayBeNullable) //NOTE MetadataToken's reassigned on compilation !!! use inside appdomain public static ulong GetMemberUniqueToken(MemberInfo mi) { - return ((ulong)mi.Module.MetadataToken) << 32 | (ulong)mi.MetadataToken; + return ((ulong)mi.Module.MetadataToken << 32) | (uint)mi.MetadataToken; } //BUG может быть одинаков для типов из разных сборок public static ulong GetTypeUniqueToken(Type type) { - return ((ulong)type.Module.MetadataToken) << 32 | (ulong)type.MetadataToken; + return ((ulong)type.Module.MetadataToken << 32) | (uint)type.MetadataToken; } public static ConstructorInfo GetObjectConstruction(Expression> constructorCall, From e257f1e9d64524bc11140a93ba8a29afdf862e7a Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 18:33:41 +0500 Subject: [PATCH 8/9] update .dotsettings to a newer version --- Common.DotSettings | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Common.DotSettings b/Common.DotSettings index 5adb19b..de322c8 100644 --- a/Common.DotSettings +++ b/Common.DotSettings @@ -162,6 +162,22 @@ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Type parameters"><ElementKinds><Kind Name="TYPE_PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Instance" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Instance fields (not private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local variables"><ElementKinds><Kind Name="LOCAL_VARIABLE" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Constant fields (not private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static fields (not private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Methods"><ElementKinds><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="Test" Suffix="" Style="AaBb_AaBb" /><ExtraRule Prefix="" Suffix="Test" Style="AaBb_AaBb" /></Policy></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Parameters"><ElementKinds><Kind Name="PARAMETER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Enum members"><ElementKinds><Kind Name="ENUM_MEMBER" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Types and namespaces"><ElementKinds><Kind Name="NAMESPACE" /><Kind Name="CLASS" /><Kind Name="STRUCT" /><Kind Name="ENUM" /><Kind Name="DELEGATE" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="Test" Suffix="" Style="AaBb" /><ExtraRule Prefix="" Suffix="Test" Style="AaBb" /></Policy></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Local constants"><ElementKinds><Kind Name="LOCAL_CONSTANT" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy><Descriptor Staticness="Any" AccessRightKinds="Any" Description="Interfaces"><ElementKinds><Kind Name="INTERFACE" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Protected, ProtectedInternal, Internal, Public, PrivateProtected" Description="Static readonly fields (not private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /></Policy> + <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy> $object$_On$event$ <Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" /> @@ -203,6 +219,7 @@ True True True + True True True True From 6398d51be9131f9be60677c29235e40a27c83d11 Mon Sep 17 00:00:00 2001 From: borzov Date: Thu, 8 Aug 2024 18:54:08 +0500 Subject: [PATCH 9/9] add old dotnet versions for tests --- .github/workflows/actions.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 265fd98..3b938a8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -17,7 +17,10 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: ${{ env.DOTNET_VERSION }} + dotnet-version: | + ${{ env.DOTNET_VERSION }} + 3.1.x + 6.0.x - name: Install dependencies run: dotnet restore ${{ env.SOLUTION_FILE }} --verbosity minimal && dotnet tool restore