Smdn.Reflection.ReverseGenerating version 1.1.6
·
175 commits
to main
since this release
Released package
Release notes
The full release notes are available at gist.
Change log
Change log in this release:
- 2023-05-24 update assembly version
- 2023-05-24 add (Type|Member)DeclarationOptions.NullabilityInfoContextLockObject to support locking NullabilityInfoContext
- 2023-05-24 add overloads to CSharpFormatter.FormatParameter/FormatParameterList/FormatTypeName that accepts lock object for NullabilityInfoContext to make issue #20 avoidable
- 2023-05-22 disable trimming
- 2023-05-22 suppress warning CA1502 and CA1506
- 2023-05-22 avoid null reference
- 2023-05-22 empty RootNamespace
- 2023-03-27 add provisional workaround for TypeLoadException (see #31)
API changes
API changes in this release:
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
index c6b1b06..0aff2da 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net45.apilist.cs
@@ -1,134 +1,134 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.5)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.6)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.1.5.0
-// InformationalVersion: 1.1.5+8b0234f9aa81d64e62185c0c566a560c630f934b
+// AssemblyVersion: 1.1.6.0
+// InformationalVersion: 1.1.6+407f242e4289093d014484d0f1940c407f03b605
// TargetFramework: .NETFramework,Version=v4.5
// Configuration: Release
// Referenced assemblies:
// Smdn.Fundamental.Reflection, Version=3.3.2.0, Culture=neutral
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
index 262d7aa..00d37ea 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net47.apilist.cs
@@ -1,133 +1,133 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.5)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.6)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.1.5.0
-// InformationalVersion: 1.1.5+8b0234f9aa81d64e62185c0c566a560c630f934b
+// AssemblyVersion: 1.1.6.0
+// InformationalVersion: 1.1.6+407f242e4289093d014484d0f1940c407f03b605
// TargetFramework: .NETFramework,Version=v4.7
// Configuration: Release
// Referenced assemblies:
// Smdn.Fundamental.Reflection, Version=3.3.2.0, Culture=neutral
// System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs
index ea8743b..25bd0ce 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net6.0.apilist.cs
@@ -1,145 +1,155 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.5)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.6)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.1.5.0
-// InformationalVersion: 1.1.5+8b0234f9aa81d64e62185c0c566a560c630f934b
+// AssemblyVersion: 1.1.6.0
+// InformationalVersion: 1.1.6+407f242e4289093d014484d0f1940c407f03b605
// TargetFramework: .NETCoreApp,Version=v6.0
// Configuration: Release
// Referenced assemblies:
// Smdn.Fundamental.Reflection, Version=3.3.2.0, Culture=neutral
// System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Memory, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime.InteropServices, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+// System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, [MaybeNullWhen(false)] out string? primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
+ public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
+ public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net7.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net7.0.apilist.cs
index b33b140..9a0a982 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net7.0.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-net7.0.apilist.cs
@@ -1,145 +1,155 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.5)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.6)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.1.5.0
-// InformationalVersion: 1.1.5+8b0234f9aa81d64e62185c0c566a560c630f934b
+// AssemblyVersion: 1.1.6.0
+// InformationalVersion: 1.1.6+407f242e4289093d014484d0f1940c407f03b605
// TargetFramework: .NETCoreApp,Version=v7.0
// Configuration: Release
// Referenced assemblies:
// Smdn.Fundamental.Reflection, Version=3.3.2.0, Culture=neutral
// System.Collections, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Linq, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Memory, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
// System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// System.Runtime.InteropServices, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+// System.Threading, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameter(ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameterList(MethodBase m, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
+ public static string FormatParameterList(ParameterInfo[] parameterList, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this EventInfo ev, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this FieldInfo f, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this ParameterInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
+ public static string FormatTypeName(this PropertyInfo p, NullabilityInfoContext? nullabilityInfoContext, object? nullabilityInfoContextLockObject, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, [MaybeNullWhen(false)] out string? primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
+ public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
public NullabilityInfoContext? NullabilityInfoContext { get; set; }
+ public object? NullabilityInfoContextLockObject { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)
diff --git a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
index 68680cc..5b2c0ba 100644
--- a/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
+++ b/doc/api-list/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating-netstandard2.0.apilist.cs
@@ -1,131 +1,131 @@
-// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.5)
+// Smdn.Reflection.ReverseGenerating.dll (Smdn.Reflection.ReverseGenerating-1.1.6)
// Name: Smdn.Reflection.ReverseGenerating
-// AssemblyVersion: 1.1.5.0
-// InformationalVersion: 1.1.5+8b0234f9aa81d64e62185c0c566a560c630f934b
+// AssemblyVersion: 1.1.6.0
+// InformationalVersion: 1.1.6+407f242e4289093d014484d0f1940c407f03b605
// TargetFramework: .NETStandard,Version=v2.0
// Configuration: Release
// Referenced assemblies:
// Smdn.Fundamental.Reflection, Version=3.3.2.0, Culture=neutral
// netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
#nullable enable annotations
using System;
using System.Collections.Generic;
using System.Reflection;
using Smdn.Reflection;
using Smdn.Reflection.ReverseGenerating;
namespace Smdn.Reflection.ReverseGenerating {
public delegate bool AttributeTypeFilter(Type type, ICustomAttributeProvider attributeProvider);
public enum AttributeSectionFormat : int {
Discrete = 1,
List = 0,
}
public enum MethodBodyOption : int {
EmptyImplementation = 1,
None = 0,
ThrowNotImplementedException = 2,
ThrowNull = 3,
}
public static class CSharpFormatter {
public static string EscapeString(string s, bool escapeSingleQuote = false, bool escapeDoubleQuote = false) {}
public static string FormatAccessibility(Accessibility accessibility) {}
public static string FormatParameter(ParameterInfo p, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(MethodBase m, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatParameterList(ParameterInfo[] parameterList, bool typeWithNamespace = true, bool useDefaultLiteral = false) {}
public static string FormatSpecialNameMethod(MethodBase methodOrConstructor, out MethodSpecialName nameType) {}
public static string FormatTypeName(this EventInfo ev, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this FieldInfo f, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this ParameterInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this PropertyInfo p, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatTypeName(this Type t, ICustomAttributeProvider? attributeProvider = null, bool typeWithNamespace = true, bool withDeclaringTypeName = true, bool translateLanguagePrimitiveType = true) {}
public static string FormatValueDeclaration(object? val, Type typeOfValue, bool typeWithNamespace = true, bool findConstantField = false, bool useDefaultLiteral = false) {}
public static bool IsLanguagePrimitiveType(Type t, out string primitiveTypeName) {}
public static IEnumerable<string> ToNamespaceList(Type t) {}
}
public static class Generator {
public static IEnumerable<string> GenerateAttributeList(ICustomAttributeProvider attributeProvider, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
[Obsolete("Use GenerateGenericParameterConstraintDeclaration instead.")]
public static string GenerateGenericArgumentConstraintDeclaration(Type genericArgument, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateGenericParameterConstraintDeclaration(Type genericParameter, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string? GenerateMemberDeclaration(MemberInfo member, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static string GenerateTypeDeclaration(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
public static IEnumerable<string> GenerateTypeDeclarationWithExplicitBaseTypeAndInterfaces(Type t, ISet<string>? referencingNamespaces, GeneratorOptions options) {}
}
public class GeneratorOptions : ICloneable {
public class AttributeDeclarationOptions {
public AttributeDeclarationOptions() {}
public AttributeSectionFormat AccessorFormat { get; set; }
public AttributeSectionFormat AccessorParameterFormat { get; set; }
public AttributeSectionFormat BackingFieldFormat { get; set; }
public AttributeSectionFormat DelegateParameterFormat { get; set; }
public AttributeSectionFormat GenericParameterFormat { get; set; }
public AttributeSectionFormat MethodParameterFormat { get; set; }
public bool OmitAttributeSuffix { get; set; }
public AttributeTypeFilter? TypeFilter { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamedArguments { get; set; }
public bool WithNamespace { get; set; }
}
public class MemberDeclarationOptions {
public MemberDeclarationOptions() {}
public MethodBodyOption AccessorBody { get; set; }
public MethodBodyOption MethodBody { get; set; }
public bool OmitEndOfStatement { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithEnumTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ParameterDeclarationOptions {
public ParameterDeclarationOptions() {}
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class TypeDeclarationOptions {
public TypeDeclarationOptions() {}
public bool OmitEndOfStatement { get; set; }
public bool OmitEnumUnderlyingTypeIfPossible { get; set; }
public bool WithAccessibility { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public class ValueDeclarationOptions {
public ValueDeclarationOptions() {}
public bool UseDefaultLiteral { get; set; }
public bool WithDeclaringTypeName { get; set; }
public bool WithNamespace { get; set; }
}
public GeneratorOptions() {}
public GeneratorOptions.AttributeDeclarationOptions AttributeDeclaration { get; init; }
public bool IgnorePrivateOrAssembly { get; set; }
public string? Indent { get; set; }
public GeneratorOptions.MemberDeclarationOptions MemberDeclaration { get; init; }
public GeneratorOptions.ParameterDeclarationOptions ParameterDeclaration { get; init; }
public bool TranslateLanguagePrimitiveTypeDeclaration { get; set; }
public GeneratorOptions.TypeDeclarationOptions TypeDeclaration { get; init; }
public GeneratorOptions.ValueDeclarationOptions ValueDeclaration { get; init; }
public virtual GeneratorOptions Clone() {}
object ICloneable.Clone() {}
}
}
-// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.1.0.
+// API list generated by Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks v1.2.2.0.
// Smdn.Reflection.ReverseGenerating.ListApi.Core v1.2.0.0 (https://github.com/smdn/Smdn.Reflection.ReverseGenerating)Full changes
Full changes in this release:
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
index 542480a..3ac1547 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating.csproj
@@ -6,11 +6,15 @@ SPDX-License-Identifier: MIT
<PropertyGroup>
<TargetFrameworks>net6.0;net47;net45;netstandard2.0</TargetFrameworks>
<RootNamespace>Smdn.Reflection.ReverseGenerating</RootNamespace>
- <VersionPrefix>1.1.5</VersionPrefix>
+ <VersionPrefix>1.1.6</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PackageValidationBaselineVersion>1.0.0</PackageValidationBaselineVersion>
+ <RootNamespace/> <!-- empty the root namespace so that the namespace is determined only by the directory name, for code style rule IDE0030 -->
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
+ <!-- trimming options -->
+ <PublishTrimmed>false</PublishTrimmed>
+ <EnableTrimAnalyzer>false</EnableTrimAnalyzer>
</PropertyGroup>
<Import Project="..\Sdk.net7.0.props" />
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeName.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeName.cs
index cc00e0f..b518adf 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeName.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeName.cs
@@ -46,6 +46,23 @@ static partial class CSharpFormatter {
bool typeWithNamespace = true,
bool withDeclaringTypeName = true,
bool translateLanguagePrimitiveType = true
+ )
+ => FormatTypeName(
+ f: f ?? throw new ArgumentNullException(nameof(f)),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ withDeclaringTypeName: withDeclaringTypeName,
+ translateLanguagePrimitiveType: translateLanguagePrimitiveType
+ );
+
+ public static string FormatTypeName(
+ this FieldInfo f,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool withDeclaringTypeName = true,
+ bool translateLanguagePrimitiveType = true
)
=> nullabilityInfoContext is null
? FormatTypeName(
@@ -55,7 +72,7 @@ static partial class CSharpFormatter {
translateLanguagePrimitiveType: translateLanguagePrimitiveType
)
: FormatTypeNameWithNullabilityAnnotation(
- nullabilityInfoContext.Create(f ?? throw new ArgumentNullException(nameof(f))),
+ target: nullabilityInfoContext.Create(f ?? throw new ArgumentNullException(nameof(f)), nullabilityInfoContextLockObject),
builder: new(capacity: 32),
options: new(
AttributeProvider: f,
@@ -92,6 +109,23 @@ static partial class CSharpFormatter {
bool typeWithNamespace = true,
bool withDeclaringTypeName = true,
bool translateLanguagePrimitiveType = true
+ )
+ => FormatTypeName(
+ p: p ?? throw new ArgumentNullException(nameof(p)),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ withDeclaringTypeName: withDeclaringTypeName,
+ translateLanguagePrimitiveType: translateLanguagePrimitiveType
+ );
+
+ public static string FormatTypeName(
+ this PropertyInfo p,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool withDeclaringTypeName = true,
+ bool translateLanguagePrimitiveType = true
)
=> nullabilityInfoContext is null
? FormatTypeName(
@@ -101,7 +135,7 @@ static partial class CSharpFormatter {
translateLanguagePrimitiveType: translateLanguagePrimitiveType
)
: FormatTypeNameWithNullabilityAnnotation(
- nullabilityInfoContext.Create(p ?? throw new ArgumentNullException(nameof(p))),
+ target: nullabilityInfoContext.Create(p ?? throw new ArgumentNullException(nameof(p)), nullabilityInfoContextLockObject),
builder: new(capacity: 32),
options: new(
AttributeProvider: p,
@@ -138,6 +172,23 @@ static partial class CSharpFormatter {
bool typeWithNamespace = true,
bool withDeclaringTypeName = true,
bool translateLanguagePrimitiveType = true
+ )
+ => FormatTypeName(
+ p: p ?? throw new ArgumentNullException(nameof(p)),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ withDeclaringTypeName: withDeclaringTypeName,
+ translateLanguagePrimitiveType: translateLanguagePrimitiveType
+ );
+
+ public static string FormatTypeName(
+ this ParameterInfo p,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool withDeclaringTypeName = true,
+ bool translateLanguagePrimitiveType = true
)
=> nullabilityInfoContext is null
? FormatTypeName(
@@ -147,7 +198,7 @@ static partial class CSharpFormatter {
translateLanguagePrimitiveType: translateLanguagePrimitiveType
)
: FormatTypeNameWithNullabilityAnnotation(
- nullabilityInfoContext.Create(p ?? throw new ArgumentNullException(nameof(p))),
+ target: nullabilityInfoContext.Create(p ?? throw new ArgumentNullException(nameof(p)), nullabilityInfoContextLockObject),
builder: new(capacity: 32),
options: new(
AttributeProvider: p,
@@ -184,6 +235,23 @@ static partial class CSharpFormatter {
bool typeWithNamespace = true,
bool withDeclaringTypeName = true,
bool translateLanguagePrimitiveType = true
+ )
+ => FormatTypeName(
+ ev: ev,
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ withDeclaringTypeName: withDeclaringTypeName,
+ translateLanguagePrimitiveType: translateLanguagePrimitiveType
+ );
+
+ public static string FormatTypeName(
+ this EventInfo ev,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool withDeclaringTypeName = true,
+ bool translateLanguagePrimitiveType = true
)
=> nullabilityInfoContext is null
? FormatTypeName(
@@ -193,7 +261,7 @@ static partial class CSharpFormatter {
translateLanguagePrimitiveType: translateLanguagePrimitiveType
)
: FormatTypeNameWithNullabilityAnnotation(
- nullabilityInfoContext.Create(ev ?? throw new ArgumentNullException(nameof(ev))),
+ target: nullabilityInfoContext.Create(ev ?? throw new ArgumentNullException(nameof(ev)), nullabilityInfoContextLockObject),
builder: new(capacity: 32),
options: new(
AttributeProvider: ev,
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
index 0bacdd2..1a45bd1 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameCore.cs
@@ -21,6 +21,7 @@ static partial class CSharpFormatter {
"System".Equals(t.Namespace, StringComparison.Ordinal) &&
t.GetGenericTypeName().Equals("ValueTuple", StringComparison.Ordinal);
+#pragma warning disable CA1502 // TODO: reduce code complexity
internal static string FormatTypeNameCore(
Type t,
FormatTypeNameOptions options
@@ -172,4 +173,5 @@ static partial class CSharpFormatter {
return name;
}
}
+#pragma warning restore CA1502
}
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
index 06366d8..e67be21 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeNameWithNullabilityAnnotation.cs
@@ -66,6 +66,7 @@ static partial class CSharpFormatter {
}
#endif
+#pragma warning disable CA1502 // TODO: reduce code complexity
private static StringBuilder FormatTypeNameWithNullabilityAnnotation(
NullabilityInfo target,
StringBuilder builder,
@@ -208,6 +209,7 @@ static partial class CSharpFormatter {
.Append(GetTypeName(targetType, options))
.Append(GetNullabilityAnnotation(target));
}
+#pragma warning restore CA1502
private static StringBuilder FormatClosedGenericTypeOrGenericTypeDefinition(
NullabilityInfo target,
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
index 89cc7a9..1f660a1 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.cs
@@ -183,16 +183,19 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
#endif
out string primitiveTypeName
)
- => primitiveTypes.TryGetValue(t.FullName ?? string.Empty, out primitiveTypeName);
+ => primitiveTypes.TryGetValue((t ?? throw new ArgumentNullException(nameof(t))).FullName ?? string.Empty, out primitiveTypeName);
public static IEnumerable<string> ToNamespaceList(Type t)
- => t.GetNamespaces(static type => IsLanguagePrimitiveType(type, out _));
+ => (t ?? throw new ArgumentNullException(nameof(t))).GetNamespaces(static type => IsLanguagePrimitiveType(type, out _));
public static string FormatSpecialNameMethod(
MethodBase methodOrConstructor,
out MethodSpecialName nameType
)
{
+ if (methodOrConstructor is null)
+ throw new ArgumentNullException(nameof(methodOrConstructor));
+
nameType = methodOrConstructor.GetNameType();
if (specialMethodNames.TryGetValue(nameType, out var name))
@@ -218,6 +221,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
parameterList: (m ?? throw new ArgumentNullException(nameof(m))).GetParameters(),
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: null,
+ nullabilityInfoContextLockObject: null,
#endif
typeWithNamespace: typeWithNamespace,
useDefaultLiteral: useDefaultLiteral
@@ -233,6 +237,22 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
=> FormatParameterListCore(
parameterList: (m ?? throw new ArgumentNullException(nameof(m))).GetParameters(),
nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ useDefaultLiteral: useDefaultLiteral
+ );
+
+ public static string FormatParameterList(
+ MethodBase m,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool useDefaultLiteral = false
+ )
+ => FormatParameterListCore(
+ parameterList: (m ?? throw new ArgumentNullException(nameof(m))).GetParameters(),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: nullabilityInfoContextLockObject,
typeWithNamespace: typeWithNamespace,
useDefaultLiteral: useDefaultLiteral
);
@@ -247,6 +267,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
parameterList: parameterList ?? throw new ArgumentNullException(nameof(parameterList)),
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: null,
+ nullabilityInfoContextLockObject: null,
#endif
typeWithNamespace: typeWithNamespace,
useDefaultLiteral: useDefaultLiteral
@@ -262,6 +283,22 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
=> FormatParameterListCore(
parameterList: parameterList ?? throw new ArgumentNullException(nameof(parameterList)),
nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ useDefaultLiteral: useDefaultLiteral
+ );
+
+ public static string FormatParameterList(
+ ParameterInfo[] parameterList,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool useDefaultLiteral = false
+ )
+ => FormatParameterListCore(
+ parameterList: parameterList ?? throw new ArgumentNullException(nameof(parameterList)),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: nullabilityInfoContextLockObject,
typeWithNamespace: typeWithNamespace,
useDefaultLiteral: useDefaultLiteral
);
@@ -271,6 +308,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
ParameterInfo[] parameterList,
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
#endif
bool typeWithNamespace = true,
bool useDefaultLiteral = false
@@ -282,6 +320,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
p,
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: nullabilityInfoContextLockObject,
#endif
typeWithNamespace: typeWithNamespace,
useDefaultLiteral: useDefaultLiteral
@@ -294,10 +333,11 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
bool typeWithNamespace = true,
bool useDefaultLiteral = false
)
- => FormatParameter(
+ => FormatParameterCore(
p: p ?? throw new ArgumentNullException(nameof(p)),
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: null,
+ nullabilityInfoContextLockObject: null,
#endif
typeWithNamespace: typeWithNamespace,
typeWithDeclaringTypeName: true,
@@ -320,6 +360,22 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
=> FormatParameter(
p: p ?? throw new ArgumentNullException(nameof(p)),
nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: null,
+ typeWithNamespace: typeWithNamespace,
+ useDefaultLiteral: useDefaultLiteral
+ );
+
+ public static string FormatParameter(
+ ParameterInfo p,
+ NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
+ bool typeWithNamespace = true,
+ bool useDefaultLiteral = false
+ )
+ => FormatParameterCore(
+ p: p ?? throw new ArgumentNullException(nameof(p)),
+ nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: nullabilityInfoContextLockObject,
typeWithNamespace: typeWithNamespace,
typeWithDeclaringTypeName: true,
valueFormatOptions: new(
@@ -332,10 +388,11 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
);
#endif
- internal static string FormatParameter(
+ internal static string FormatParameterCore(
ParameterInfo p,
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
NullabilityInfoContext? nullabilityInfoContext,
+ object? nullabilityInfoContextLockObject,
#endif
bool typeWithNamespace,
bool typeWithDeclaringTypeName,
@@ -365,6 +422,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
#pragma warning disable SA1114
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: nullabilityInfoContext,
+ nullabilityInfoContextLockObject: nullabilityInfoContextLockObject,
#endif
typeWithNamespace: typeWithNamespace,
withDeclaringTypeName: typeWithDeclaringTypeName
@@ -436,7 +494,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
)
=> FormatValueDeclaration(
val: val,
- typeOfValue: typeOfValue,
+ typeOfValue: typeOfValue ?? throw new ArgumentNullException(nameof(typeOfValue)),
options: new(
TranslateLanguagePrimitiveType: true,
TryFindConstantField: findConstantField,
@@ -465,6 +523,7 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
);
}
+#pragma warning disable CA1502 // TODO: reduce code complexity
internal static string FormatValueDeclaration(
object? val,
Type typeOfValue,
@@ -573,4 +632,5 @@ public static partial class CSharpFormatter /* ITypeFormatter */ {
);
}
}
+#pragma warning restore CA1502
}
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
index 0032795..c9f0f96 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.Attributes.cs
@@ -31,6 +31,7 @@ partial class Generator {
DelegateReturnParameter,
}
+#pragma warning disable CA1502, CA1506 // TODO: reduce code complexity
public static IEnumerable<string> GenerateAttributeList(
ICustomAttributeProvider attributeProvider,
ISet<string>? referencingNamespaces,
@@ -106,10 +107,16 @@ partial class Generator {
attributeSectionPrefix = attributeSectionPrefixDefault;
attributeTarget = AttributeTarget.PropertyAccessorMethod;
}
- else if (m.IsEventAccessorMethod()) {
+
+ try {
+ if (m.IsEventAccessorMethod()) {
attributeSectionPrefix = attributeSectionPrefixDefault;
attributeTarget = AttributeTarget.EventAccessorMethod;
}
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ }
break;
}
@@ -269,4 +276,5 @@ partial class Generator {
)
);
}
+#pragma warning restore CA1502, CA1506
}
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
index b14a692..ce749c5 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs
@@ -386,6 +386,7 @@ public static partial class Generator {
#pragma warning disable SA1114
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: memberOptions.NullabilityInfoContext,
+ nullabilityInfoContextLockObject: memberOptions.NullabilityInfoContextLockObject,
#endif
typeWithNamespace: memberOptions.WithNamespace
#pragma warning restore SA1114
@@ -444,6 +445,7 @@ public static partial class Generator {
return sb.ToString();
}
+#pragma warning disable CA1502 // TODO: reduce code complexity
private static string? GeneratePropertyDeclaration(
PropertyInfo property,
ISet<string>? referencingNamespaces,
@@ -508,6 +510,7 @@ public static partial class Generator {
#pragma warning disable SA1114
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: memberOptions.NullabilityInfoContext,
+ nullabilityInfoContextLockObject: memberOptions.NullabilityInfoContextLockObject,
#endif
typeWithNamespace: memberOptions.WithNamespace
#pragma warning restore SA1114
@@ -617,6 +620,7 @@ public static partial class Generator {
return sb.ToString();
}
+#pragma warning restore CA1502
private static void GenerateAccessorDeclaration(
string accessor,
@@ -714,6 +718,7 @@ public static partial class Generator {
options: options
);
+#pragma warning disable CA1502 // TODO: reduce code complexity
private static string? GenerateMethodOrDelegateDeclaration(
MethodBase m,
bool asDelegateDeclaration,
@@ -741,6 +746,9 @@ public static partial class Generator {
NullabilityInfoContext = asDelegateDeclaration
? options.TypeDeclaration.NullabilityInfoContext
: options.MemberDeclaration.NullabilityInfoContext,
+ NullabilityInfoContextLockObject = asDelegateDeclaration
+ ? options.TypeDeclaration.NullabilityInfoContextLockObject
+ : options.MemberDeclaration.NullabilityInfoContextLockObject,
#endif
FormatTypeWithNamespace = asDelegateDeclaration
? options.TypeDeclaration.WithNamespace
@@ -753,18 +761,38 @@ public static partial class Generator {
: options.MemberDeclaration.OmitEndOfStatement,
TranslateLanguagePrimitiveType = options.TranslateLanguagePrimitiveTypeDeclaration,
};
+
var method = m as MethodInfo;
- var methodReturnType = method?.ReturnParameter?.FormatTypeName(
+ string? methodReturnType;
+
+ try {
+ methodReturnType = method?.ReturnParameter?.FormatTypeName(
#pragma warning disable SA1114
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: formattingOptions.NullabilityInfoContext,
+ nullabilityInfoContextLockObject: formattingOptions.NullabilityInfoContextLockObject,
#endif
typeWithNamespace: formattingOptions.FormatTypeWithNamespace
#pragma warning restore SA1114
);
- var methodReturnTypeAttributes = method is null
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ methodReturnType = "<unknown>";
+ }
+
+ string? methodReturnTypeAttributes;
+
+ try {
+ methodReturnTypeAttributes = method is null
? null
: GenerateParameterAttributeList(method.ReturnParameter, referencingNamespaces, options);
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ methodReturnTypeAttributes = "[...]";
+ }
+
var methodGenericParameters = m.IsGenericMethod
? string.Concat(
"<",
@@ -782,12 +810,22 @@ public static partial class Generator {
">"
)
: null;
- var methodParameterList = string.Join(
+
+ string? methodParameterList;
+
+ try {
+ methodParameterList = string.Join(
", ",
m.GetParameters().Select(
p => GenerateParameterDeclaration(p, referencingNamespaces, options)
)
);
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ methodParameterList = "...";
+ }
+
var genericParameters = method is null
? null
: asDelegateDeclaration
@@ -808,12 +846,17 @@ public static partial class Generator {
string? methodName = null;
var isFinalizer = false;
+ try {
referencingNamespaces?.UnionWith(
m
.GetSignatureTypes()
.Where(static mpt => !mpt.ContainsGenericParameters)
.SelectMany(CSharpFormatter.ToNamespaceList)
);
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ }
if (asDelegateDeclaration) {
methodName = m.GetDeclaringTypeOrThrow().FormatTypeName(
@@ -937,6 +980,7 @@ public static partial class Generator {
return sb.Append(methodBody).Append(endOfMethodBody).ToString();
}
+#pragma warning restore CA1502
private static string GenerateParameterDeclaration(
ParameterInfo p,
@@ -947,12 +991,15 @@ public static partial class Generator {
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
var isDelegate = p.Member == p.Member.DeclaringType?.GetDelegateSignatureMethod();
#endif
- var param = CSharpFormatter.FormatParameter(
+ var param = CSharpFormatter.FormatParameterCore(
p,
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: isDelegate
? options.TypeDeclaration.NullabilityInfoContext
: options.MemberDeclaration.NullabilityInfoContext,
+ nullabilityInfoContextLockObject: isDelegate
+ ? options.TypeDeclaration.NullabilityInfoContextLockObject
+ : options.MemberDeclaration.NullabilityInfoContextLockObject,
#endif
typeWithNamespace: options.ParameterDeclaration.WithNamespace,
typeWithDeclaringTypeName: options.ParameterDeclaration.WithDeclaringTypeName,
@@ -1034,6 +1081,7 @@ public static partial class Generator {
#pragma warning disable SA1114
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
nullabilityInfoContext: memberOptions.NullabilityInfoContext,
+ nullabilityInfoContextLockObject: memberOptions.NullabilityInfoContextLockObject,
#endif
typeWithNamespace: memberOptions.WithNamespace
#pragma warning restore SA1114
@@ -1164,6 +1212,7 @@ public static partial class Generator {
out _
);
+#pragma warning disable CA1502 // TODO: reduce code complexity
// TODO: extern, volatile
private static void AppendMemberModifiers(
StringBuilder sb,
@@ -1241,9 +1290,14 @@ public static partial class Generator {
if (isAsyncStateMachine)
sb.Append("async ");
+ try {
if (method is not null && method.GetParameters().Any(IsParameterUnsafe))
sb.Append("unsafe ");
}
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ }
+ }
static bool IsParameterUnsafe(ParameterInfo p)
{
@@ -1255,8 +1309,13 @@ public static partial class Generator {
return false;
}
+ try {
if (member.IsHidingInheritedMember(nonPublic: true))
sb.Append("new ");
+ }
+ catch (TypeLoadException) {
+ // FIXME: https://github.com/smdn/Smdn.Reflection.ReverseGenerating/issues/31
+ }
SWITCH_MEMBER_TYPE:
switch (member) {
@@ -1333,4 +1392,5 @@ public static partial class Generator {
if (propertySetMethodAccessibility.HasValue)
setMethodAccessibility = CSharpFormatter.FormatAccessibility(propertySetMethodAccessibility.Value);
}
+#pragma warning restore CA1502
}
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
index 3525bf7..cb62ecc 100644
--- a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/GeneratorOptions.cs
@@ -37,6 +37,7 @@ public class GeneratorOptions : ICloneable {
public bool OmitEnumUnderlyingTypeIfPossible { get; set; } = false;
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
public NullabilityInfoContext? NullabilityInfoContext { get; set; } = new();
+ public object? NullabilityInfoContextLockObject { get; set; }
#endif
internal TypeDeclarationOptions Clone()
@@ -55,6 +56,7 @@ public class GeneratorOptions : ICloneable {
public MethodBodyOption AccessorBody { get; set; } = MethodBodyOption.EmptyImplementation;
#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
public NullabilityInfoContext? NullabilityInfoContext { get; set; } = new();
+ public object? NullabilityInfoContextLockObject { get; set; }
#endif
internal MemberDeclarationOptions Clone()
diff --git a/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/NullabilityInfoContextExtensions.cs b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/NullabilityInfoContextExtensions.cs
new file mode 100644
index 0000000..35a929b
--- /dev/null
+++ b/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/NullabilityInfoContextExtensions.cs
@@ -0,0 +1,58 @@
+// SPDX-FileCopyrightText: 2023 smdn <smdn@smdn.jp>
+// SPDX-License-Identifier: MIT
+#if SYSTEM_REFLECTION_NULLABILITYINFOCONTEXT
+using System;
+using System.Reflection;
+
+namespace Smdn.Reflection.ReverseGenerating;
+
+/// <summary>
+/// Provides extension methods for <see cref="NullabilityInfoContext"/>.
+/// </summary>
+/// <remarks>
+/// <see cref="NullabilityInfoContext"/> internally caches created <see cref="NullabilityInfo"/> using <see cref="System.Collections.Generic.Dictionary{TKey, TValue}"/>.
+/// This may cause an exception to be thrown if <see cref="NullabilityInfoContext.Create"/> is called concurrently.
+/// So, this class provides extension methods that uses a lock object to lock and then calls <see cref="NullabilityInfoContext.Create"/>.
+/// </remarks>
+internal static class NullabilityInfoContextExtensions {
+ internal static NullabilityInfo Create(this NullabilityInfoContext context, FieldInfo field, object? lockObject)
+ {
+ if (lockObject is null)
+ return context.Create(field);
+
+ lock (lockObject) {
+ return context.Create(field);
+ }
+ }
+
+ internal static NullabilityInfo Create(this NullabilityInfoContext context, PropertyInfo property, object? lockObject)
+ {
+ if (lockObject is null)
+ return context.Create(property);
+
+ lock (lockObject) {
+ return context.Create(property);
+ }
+ }
+
+ internal static NullabilityInfo Create(this NullabilityInfoContext context, ParameterInfo parameter, object? lockObject)
+ {
+ if (lockObject is null)
+ return context.Create(parameter);
+
+ lock (lockObject) {
+ return context.Create(parameter);
+ }
+ }
+
+ internal static NullabilityInfo Create(this NullabilityInfoContext context, EventInfo @event, object? lockObject)
+ {
+ if (lockObject is null)
+ return context.Create(@event);
+
+ lock (lockObject) {
+ return context.Create(@event);
+ }
+ }
+}
+#endifNotes
Full Changelog: releases/Smdn.Reflection.ReverseGenerating-1.1.5...releases/Smdn.Reflection.ReverseGenerating-1.1.6