Giter VIP home page Giter VIP logo

smdn / smdn.reflection.reversegenerating Goto Github PK

View Code? Open in Web Editor NEW
1.0 3.0 0.0 1.45 MB

.NET libraries and tools to reverse-generate C# code from type and member information using reflection

Home Page: https://smdn.jp/works/libs/Smdn.Reflection.ReverseGenerating/

License: MIT License

C# 99.87% F# 0.01% Visual Basic .NET 0.01% PowerShell 0.11%
dotnet csharp msbuild-task nuget-package dotnet-library reflection api-list reverse-generating api-documentation-tool api-outliner dotnet-tools

smdn.reflection.reversegenerating's Introduction

GitHub license tests/main CodeQL

This repository provides the libraries and tools to reverse-generate C# code that describes the type and member information, from the .NET assemblies.

By generating an API list from the library, the types and members provided by the library can be presented in C# code format. This allows you to present an outline of the library API to users in addition to explaining the API through text or sample code.

Example of output: System.Exception, .NET 8.0

Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks

NuGet Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks

This package provides GenerateApiList MSBuild task.

Usage

See examples for details and more usage examples.

  <ItemGroup>
    <!-- Add package reference of Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks. -->
    <PackageReference
      Include="Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks"
      Version="*"
      PrivateAssets="all"
      IncludeAssets="build"
    />
  </ItemGroup>

  <ItemGroup>
    <!-- Specify target assemblies to generate API list. -->
    <GenerateApiListTargetAssemblies Include="..." />
  </ItemGroup>

  <PropertyGroup>
    <!-- (Optional) If you want to import 'Smdn.Reflection.ReverseGenerating.ListApi.MSBuild.Tasks.targets' even if the build target is `pack`. -->
    <ExcludeRestorePackageImports>false</ExcludeRestorePackageImports>
  </PropertyGroup>

  <Target Name="GenerateApiListFromAssemblies" AfterTargets="Pack">
    <!-- Call `GenerateApiList` task -->
    <GenerateApiList Assemblies="@(GenerateApiListTargetAssemblies)">
      <Output TaskParameter="GeneratedFiles" ItemName="GeneratedApiListFiles" />
    </GenerateApiList>

    <Message Text="generated API list: @(GeneratedApiListFiles)" Importance="high" />
  </Target>

Smdn.Reflection.ReverseGenerating.ListApi

NuGet Smdn.Reflection.ReverseGenerating.ListApi

This package provides list-api command line tool.

Installation

Use dotnet tool to install or update list-api command.

# install
dotnet tool install -g Smdn.Reflection.ReverseGenerating.ListApi

# update
dotnet tool update -g Smdn.Reflection.ReverseGenerating.ListApi

# install and update (specifies the target framework explicitly)
dotnet tool install --framework net6.0 -g Smdn.Reflection.ReverseGenerating.ListApi
dotnet tool update --framework net8.0 -g Smdn.Reflection.ReverseGenerating.ListApi

Usage

# Generates the API list.
# The file 'Library-net8.0.apilist.cs' will be generated.
list-api Library/bin/Release/net8.0/Library.dll

# Generates the API list with loading the assembly in the reflection-only context.
list-api --load-reflection-only Library/bin/Release/net8.0/Library.dll

Type list-api --help to show usage about command line arguments and options.

If you are loading an assembly that targets a newer version than the runtime version that the list-api command targets, try running it with the DOTNET_ROLL_FORWARD environment variable.

# Installs list-api targeting .NET 6.0
dotnet tool install --framework net6.0 -g Smdn.Reflection.ReverseGenerating.ListApi

# Uses runtime roll forwarding to load the assembly targeting .NET 8.0
DOTNET_ROLL_FORWARD=LatestMajor list-api Library/bin/Release/net8.0/Library.dll

Limitations

This tool does not provide any options for code styles including spaces, indents, and new lines. Use dotnet format after generating to format such code styles.

Smdn.Reflection.ReverseGenerating

NuGet Smdn.Reflection.ReverseGenerating

This package provides APIs common to reverse generating. See examples or API list of Smdn.Reflection.ReverseGenerating.

Example of output

The files in API list directory is generated using the artifacts of this repository.

For contributers

Contributions are appreciated!

If there's a feature you would like to add or a bug you would like to fix, please read Contribution guidelines and create an Issue or Pull Request.

IssueやPull Requestを送る際は、Contribution guidelinesをご覧頂ください。 可能なら英語が望ましいですが、日本語で構いません。

smdn.reflection.reversegenerating's People

Contributors

smdn avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

smdn.reflection.reversegenerating's Issues

list-api not finding DLLs in other directories including SDK like System.Runtime.dll

Description

I run list-api on DLL built by project. list-api doesn't find DLLs in other directories, but does for the same directory. I think that is what occurs. I might be doing something wrong?

Here list-api is run on a dotnet 8 DLL I built:

~/dev/space-station-14/artifacts/bin/Robust.Packaging/release$ list-api -o /tmp Robust.Shared.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.ModuleHandle.ResolveMethod(QCallModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
[...]

Reproduction steps

$ tar xzf dotnet-sdk-8.0.101-linux-arm64.tar.gz -C ~/.dotnet
$ tar xzf dotnet-sdk-6.0.418-linux-arm64.tar.gz -C ~/.dotnet
$ dotnet tool install -g Smdn.Reflection.ReverseGenerating.ListApi

Run list-api on a dll in the dotnet SDK:

$ list-api -o /tmp ~/.dotnet/sdk/8.0.101/DotnetTools/dotnet-format/System.CommandLine.dll

Expected behavior

list-api should find other DLLs like System.Runtime in the SDK.

Actual behavior

$ list-api -o /tmp ~/.dotnet/sdk/8.0.101/DotnetTools/dotnet-format/System.CommandLine.dll
System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The system cannot find the file specified.
File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral,  PublicKeyToken=b03f5f7f11d50a3a'
   at System.ModuleHandle.ResolveMethod(QCallModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* Methods, Int32 methodInstCount)
   at System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)        
   at System.ModuleHandle.ResolveMethodHandle(Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.RuntimeType.GetMethodBase(RuntimeModule scope, Int32 typeMetadataToken)                          
   at System.Reflection.RuntimeCustomAttributeData..ctor(RuntimeModule scope, MetadataToken caCtorToken, ConstArray& blob)                                          
   at System.Reflection.RuntimeCustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget)
   at System.Reflection.RuntimeCustomAttributeData.Get
[...]

In this case no System.CommandLine.apilist.cs output.
But others give just header:

$ cat Microsoft.Build.Tasks.CodeAnalysis-net6.0.apilist.cs
// Microsoft.Build.Tasks.CodeAnalysis.dll (Microsoft.Build.Tasks.CodeAnalysis)
//   Name: Microsoft.Build.Tasks.CodeAnalysis
//   AssemblyVersion: 4.8.9.7201
//   InformationalVersion: 4.8.0-7.23572.1+7b75981cf3bd520b86ec4ed00ec156c8bc48e4eb
//   TargetFramework: .NETCoreApp,Version=v6.0
//   Configuration: Release
//   Referenced assemblies:
//     Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Collections, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Console, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Diagnostics.Process, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Diagnostics.StackTrace, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.IO.Pipes, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.IO.Pipes.AccessControl, 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.Security.Claims, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Security.Cryptography.Algorithms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Security.Cryptography.Primitives, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Security.Principal.Windows, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Text.Encoding.Extensions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Text.RegularExpressions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Threading, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//     System.Threading.Thread, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
//   Embedded resources:
//     Microsoft.CodeAnalysis.BuildTasks.ErrorString.resources (5,247 bytes, Embedded, ContainedInManifestFile)

Configuration

$ tar xzf dotnet-sdk-8.0.101-linux-arm64.tar.gz -C ~/.dotnet
$ tar xzf dotnet-sdk-6.0.418-linux-arm64.tar.gz -C ~/.dotnet
$ dotnet tool install -g Smdn.Reflection.ReverseGenerating.ListApi

I installed dotnet SDK 6 in order to get list-api to run.

user@localhost:~$ dotnet --info
.NET SDK:                                          
  Version:           8.0.101
 Commit:            6eceda187b                         
 Workload version:  8.0.100-manifests.69afb982
                                                  
Runtime Environment:                                
   OS Name:     debian                                 
   OS Version:  12                                    
   OS Platform: Linux                                  
   RID:         linux-arm64                            
   Base Path:   /home/user/.dotnet/sdk/8.0.101/                                                               .NET workloads installed:
  Workload version: 8.0.100-manifests.69afb982         There are no installed workloads to display.
                                                      
Host:
  Version:      8.0.1                                   
  Architecture: arm64
  Commit:       bf5e279d92 
                           
.NET SDKs installed:                              
   6.0.418 [/home/user/.dotnet/sdk]
   8.0.101 [/home/user/.dotnet/sdk]  
                                                                      
.NET runtimes installed:                                
  Microsoft.AspNetCore.App 6.0.26 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]                     
  Microsoft.AspNetCore.App 8.0.1 [/home/user/.dotnet/shared/Microsoft.AspNetCore.App]                         
  Microsoft.NETCore.App 6.0.26 [/home/user/.dotnet/shared/Microsoft.NETCore.App]                          
  Microsoft.NETCore.App 8.0.1 [/home/user/.dotnet/shared/Microsoft.NETCore.App]       
                                                                           
Other architectures found:                           
   None                                                                                                      

Environment variables:                                  
  DOTNET_ROOT       [/home/user/.dotnet]                                                                    

global.json file:                                    
   Not found                                                                                                 

Learn more:                                             
  https://aka.ms/dotnet/info                                                                                

Download .NET:                                          
  https://aka.ms/dotnet/download

The environment is unusual. Termux on arm64 Android, and proot (like chroot) into Debian system. Could be my environment, or maybe I don't use list-api correctly? I will try on x86_64 desktop in a few days to try a different environment.

Other information

First time trying list-api. List-api works as expected on other DLLs in ~/.dotnet/sdk/8.0.101/ I think because System.Runtime is in same directory.

Generator.GenerateXxx fails with TypeLoadException (does not have an implementation)

Attempting to access MethodInfo of a method that has "no implementation" causes a TypeLoadException, and Generator.GenerateXxx fails.

At least, a usage of System.Text.Json.Utf8JsonWriter.DisposeAsync in the .NET Standard 2.1 assembly raises such an exception.

Reproduction steps

Build a .NET Standard 2.1 assembly with the configuration like below:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.Text.Json" Version="6.0.*" />
  </ItemGroup>
</Project>
public interface ITest {
  void Test(System.Text.Json.Utf8JsonWriter writer);
}

Run list-api with the assembly built above emits the outputs like below:

$ list-api ./bin/Debug/netstandard2.1/lib.dll 
fail: Smdn.Reflection.ReverseGenerating.ListApi[1] generator error on member 'ITest.Test' System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.    at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)    at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()    at System.Reflection.RuntimeMethodInfo.FetchReturnParameter()    at System.Reflection.RuntimeMethodInfo.get_ReturnParameter()    at Smdn.Reflection.ReverseGenerating.Generator.GenerateMethodOrDelegateDeclaration(MethodBase m, Boolean asDelegateDeclaration, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 701    at Smdn.Reflection.ReverseGenerating.Generator.GenerateMethodBaseDeclaration(MethodBase m, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 657    at Smdn.Reflection.ReverseGenerating.Generator.GenerateMemberDeclaration(MemberInfo member, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 274    at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.GenerateTypeContentDeclarations(Int32 nestLevel, Assembly assm, Type t, ISet`1 referencingNamespaces, ApiListWriterOptions options, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 506
Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter+MemberDeclarationException: generator error on member 'ITest.Test'
 ---> System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
   at System.Reflection.RuntimeMethodInfo.FetchReturnParameter()
   at System.Reflection.RuntimeMethodInfo.get_ReturnParameter()
   at Smdn.Reflection.ReverseGenerating.Generator.GenerateMethodOrDelegateDeclaration(MethodBase m, Boolean asDelegateDeclaration, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 701
   at Smdn.Reflection.ReverseGenerating.Generator.GenerateMethodBaseDeclaration(MethodBase m, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 657
   at Smdn.Reflection.ReverseGenerating.Generator.GenerateMemberDeclaration(MemberInfo member, ISet`1 referencingNamespaces, GeneratorOptions options) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/Generator.cs:line 274
   at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.GenerateTypeContentDeclarations(Int32 nestLevel, Assembly assm, Type t, ISet`1 referencingNamespaces, ApiListWriterOptions options, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 506
   --- End of inner exception stack trace ---
   at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.GenerateTypeContentDeclarations(Int32 nestLevel, Assembly assm, Type t, ISet`1 referencingNamespaces, ApiListWriterOptions options, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 512
   at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.GenerateTypeAndMemberDeclarations(Int32 nestLevel, Assembly assm, Type t, ISet`1 referencingNamespaces, ApiListWriterOptions options, Boolean enableNullableAnnotationsOnlyOnTypes, Boolean enableNullableAnnotationsOnlyOnMembers, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 416
   at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.GenerateTypeAndMemberDeclarations(Int32 nestLevel, Assembly assm, IEnumerable`1 types, ISet`1 referencingNamespaces, ApiListWriterOptions options, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 316
   at Smdn.Reflection.ReverseGenerating.ListApi.ApiListWriter.WriteExportedTypes() in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/ApiListWriter.cs:line 203
   at Smdn.Reflection.ReverseGenerating.ListApi.RootCommandImplementation.<>c.<CommandMain>b__20_0(Assembly assm, ValueTuple`4 arg) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi/RootCommandImplementation.cs:line 223
   at Smdn.Reflection.ReverseGenerating.ListApi.AssemblyLoader.UsingAssembly[TArg,TResult](AssemblySource assemblySource, TArg arg, Func`3 actionWithLoadedAssembly, WeakReference& context, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AssemblyLoader.netcore.cs:line 163
   at Smdn.Reflection.ReverseGenerating.ListApi.AssemblyLoader.UsingAssemblyCore[TArg,TResult](AssemblySource assemblySource, Boolean loadIntoReflectionOnlyContext, TArg arg, Func`3 actionWithLoadedAssembly, WeakReference& context, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AssemblyLoader.netcore.cs:line 47
   at Smdn.Reflection.ReverseGenerating.ListApi.AssemblyLoader.UsingAssembly[TArg,TResult](FileInfo assemblyFile, Boolean loadIntoReflectionOnlyContext, TArg arg, Func`3 actionWithLoadedAssembly, WeakReference& context, ILogger logger) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi.Core/Smdn.Reflection.ReverseGenerating.ListApi/AssemblyLoader.cs:line 38
   at Smdn.Reflection.ReverseGenerating.ListApi.RootCommandImplementation.CommandMain(ParseResult parseResult, IConsole console) in /_/src/Smdn.Reflection.ReverseGenerating.ListApi/Smdn.Reflection.ReverseGenerating.ListApi/RootCommandImplementation.cs:line 186

List of similar exceptions

 ---> System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
   at System.Reflection.RuntimeMethodInfo.FetchReturnParameter()
   at System.Reflection.RuntimeMethodInfo.get_ReturnParameter()
 ---> System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParameters()
 ---> System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
   at System.Reflection.RuntimeMethodInfo.get_ReturnType()
   at Smdn.Reflection.MethodInfoExtensions.TryGetEventFromAccessorMethod(MethodInfo accessor, Boolean expectAdd, Boolean expectRemove, EventInfo& ev) in /_/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs:line 144
   at Smdn.Reflection.MethodInfoExtensions.IsEventAccessorMethod(MethodInfo m) in /_/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs:line 113
 ---> System.TypeLoadException: Method 'DisposeAsync' in type 'System.Text.Json.Utf8JsonWriter' from assembly 'System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.<get_Signature>g__LazyCreateSignature|24_0()
   at System.Reflection.RuntimeMethodInfo.get_ReturnType()
   at Smdn.Reflection.MethodInfoExtensions.TryGetEventFromAccessorMethod(MethodInfo accessor, Boolean expectAdd, Boolean expectRemove, EventInfo& ev) in /_/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs:line 144
   at Smdn.Reflection.MethodInfoExtensions.TryGetEventFromAccessorMethod(MethodInfo accessor, EventInfo& ev) in /_/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MethodInfoExtensions.cs:line 127
   at Smdn.Reflection.MemberInfoExtensions.IsHidingInheritedMember(MemberInfo member, Boolean nonPublic) in /_/src/Smdn.Fundamental.Reflection/Smdn.Reflection/MemberInfoExtensions.cs:line 108

Calling CSharpFormatter.FormatTypeName in parallel causes ArgumentException

NullabilityInfoContext.Create does not support parallel call.

Unhandled exception. System.AggregateException: One or more errors occurred. (An item with the same key has already been added. Key: System.Net.WebRequest)
 ---> System.ArgumentException: An item with the same key has already been added. Key: System.Net.WebRequest
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Reflection.NullabilityInfoContext.GetNullableContext(MemberInfo memberInfo)
   at System.Reflection.NullabilityInfoContext.GetNullabilityInfo(MemberInfo memberInfo, Type type, IList`1 customAttributes, Int32 index)
   at System.Reflection.NullabilityInfoContext.Create(ParameterInfo parameterInfo)
   at Smdn.Reflection.ReverseGenerating.CSharpFormatter.FormatTypeName(ParameterInfo p, NullabilityInfoContext nullabilityInfoContext, Boolean typeWithNamespace, Boolean withDeclaringTypeName, Boolean translateLanguagePrimitiveType) in /_/src/Smdn.Reflection.ReverseGenerating/Smdn.Reflection.ReverseGenerating/CSharpFormatter.FormatTypeName.cs:line 142

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.