Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add readmes to reflection #76567

Merged
merged 11 commits into from
Oct 7, 2022
7 changes: 7 additions & 0 deletions src/libraries/System.Reflection.Context/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# System.Reflection.Context
Used by `System.ComponentModel` to support [`CustomReflectionContext`](https://learn.microsoft.com/dotnet/api/system.reflection.context.customreflectioncontext).

## Status: [Legacy](../system.reflection/overview.md#status)

## Deployment
https://www.nuget.org/packages/System.Reflection.Context
steveharter marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection.DispatchProxy/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# System.Reflection.DispatchProxy
Supports the [`DispatchProxy`](https://learn.microsoft.com/dotnet/api/system.reflection.dispatchproxy) class which is used to forward methods to another class.

## Status: [Legacy](../system.reflection/overview.md#status)
Although used for key scenarios by the community, it has remained relatively unchanged. Internally it uses [Emit](../System.Reflection.Emit/readme.md) to generate the proxies so it doesn't work on all platforms.

## Deployment
https://www.nuget.org/packages/System.Reflection.Context
steveharter marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection.Emit.ILGeneration/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# System.Reflection.Emit.ILGeneration
Contains types used with [`System.Reflection.Emit`](../system.reflection.emit.readme.md).

## Status: [Inactive](../system.reflection/overview.md#status)

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.Emit.ILGeneration
jeffhandley marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions src/libraries/System.Reflection.Emit.Lightweight/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# System.Reflection.Emit.Lightweight

## Status: [Inactive](../system.reflection/overview.md#status)

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.Emit.Lightweight

## See also
[`System.Reflection.Emit`](../system.reflection.emit/readme.md)
25 changes: 25 additions & 0 deletions src/libraries/System.Reflection.Emit/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# System.Reflection.Emit
Supports generating code dynamically and then running it in-memory. The primary class is [`AssemblyBuilder`](https://learn.microsoft.com/dotnet/api/system.reflection.emit.assemblybuilder).

Not all platforms and runtimes support IL.Emit.

This library is often used with [`System.Reflection.Emit.ILGeneration`](../system.reflection.emit.ilgeneration/readme.md).

## Status: [Inactive](../system.reflection/overview.md#status)
The APIs and functionality are mature, but do get extended occasionally.

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.Emit

### Source
Runtime code for CoreClr:
https://github.com/dotnet/runtime/tree/main/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit
for Mono:
https://github.com/dotnet/runtime/tree/main/src/mono/System.Private.CoreLib/src/System/Reflection/Emit
Shared code between CoreClr and Mono:
https://github.com/dotnet/runtime/tree/main/src/libraries/System.Private.CoreLib/src/System/Reflection/Emit
steveharter marked this conversation as resolved.
Show resolved Hide resolved

### See also

[`System.Reflection.Emit.Lightweight`](..\system.reflection.emit.lightweight.readme.md)
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection.Extensions/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# System.Reflection.Extensions
This supports static extension methods for common reflection types. For similar extensions, see also [`System.Reflection.TypeExtensions`](../System.Reflection.TypeExtensions/readme.md). This assembly contains no implementations; the declared types are forwarded to the runtime.

## Status: [Inactive](../system.reflection/overview.md#status)

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.Extensions
11 changes: 11 additions & 0 deletions src/libraries/System.Reflection.Metadata/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# System.Reflection.Metadata
This provides a low-level API for inspecting raw assembly contents according to ECMA-335. Assemblies and types are not loaded into the current runtime context.

The primary classes are [MetadataReader](https://learn.microsoft.com/dotnet/api/system.reflection.metadata.metadatareader) and [MetadataBuilder](https://learn.microsoft.com/en-us/dotnet/api/system.reflection.metadata.ecma335.metadatabuilder?view=net-6.0).
steveharter marked this conversation as resolved.
Show resolved Hide resolved

## Status: [Inactive](../system.reflection/overview.md#status)
The APIs and functionality are mature, but do get extended occasionally.

## Assemblies
steveharter marked this conversation as resolved.
Show resolved Hide resolved
Inbox
https://www.nuget.org/packages/System.Reflection.Metadata
14 changes: 14 additions & 0 deletions src/libraries/System.Reflection.MetadataLoadContext/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# System.Reflection.MetadataLoadContext
This provides a high-level API for inspecting raw assembly contents according to ECMA-335. Types from an assembly are loaded into the provided [`MetadataLoadContext`](https://learn.microsoft.com/dotnet/api/system.reflection.metadataloadcontext) instance which provide for introspection purposes by returning `System.Type`, `System.MemberInfo`, etc. However, these reflection types do not support invocation.

This library takes a dependency on `System.Reflection.Metadata` for reading the assembly.

## Status: [Inactive](../system.reflection/overview.md#status)
The APIs and functionality are mature, but do get extended occasionally.

## Source
https://github.com/dotnet/runtime/tree/main/src/libraries/System.Reflection.Metadata

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.MetadataLoadContext (contains full code for OOB scenarios).
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection.Primitives/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# System.Reflection.Primitives
Contains reflection types such as [TypeAttributes](https://learn.microsoft.com/dotnet/api/system.reflection.typeattributes). Some of these types are forwarded to the runtime. In the future, the non-forwarded types may be lifted to the runtime and then type forwards added.

## Status: [Legacy](..\system.reflection\overview.md#status)

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.Extensions (to redirect to the appropriate runtime).
8 changes: 8 additions & 0 deletions src/libraries/System.Reflection.TypeExtensions/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# System.Reflection.TypeExtensions
This supports static extension methods for common reflection types. For similar extensions, see also `System.Reflection.Extensions`.

## Status: [Legacy](../system.reflection/overview.md#status)

## Deployment
Inbox
https://www.nuget.org/packages/System.Reflection.TypeExtensions
37 changes: 37 additions & 0 deletions src/libraries/System.Reflection/overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Summary

Reflection is used for late-bound introspection, invocation and IL code generation. It contains:
steveharter marked this conversation as resolved.
Show resolved Hide resolved
- **Runtime introspection and invocation** through [System.Reflection](readme.md). This is what most consider to be "reflection" and supports inspecting assemblies and types that are loaded into the currently executing "runtime context". This introspection is exposed by various reflection types including [`Assembly`](https://learn.microsoft.com/dotnet/api/system.reflection.assembly), [`Type`](https://learn.microsoft.com/dotnet/api/system.type), [`ConstructorInfo`](https://learn.microsoft.com/dotnet/api/system.reflection.constructorinfo), [`MethodInfo`](https://learn.microsoft.com/dotnet/api/system.reflection.methodinfo) and [`FieldInfo`](https://learn.microsoft.com/dotnet/api/system.reflection.fieldinfo). Also supported is the ability to invoke members in a late-bound manner such as through [`MethodBase.Invoke`](https://learn.microsoft.com/dotnet/api/system.reflection.methodbase.invoke).
- **Static introspection** through [System.Reflection.MetadataLoadContext](../System.Reflection.MetadataLoadContext\readme.md). This exposes the same reflection types as runtime introspection, but they are loaded into a "metadata context" where the types returned for introspection do not support invocation, and they are different instances from the types returned from runtime introspection. Because of this, this allows any assembly to be read, even if it's for a different platform provided that all assembly references are accounted for.
- **Runtime generation of IL for invocation** through [System.Reflection.Emit](../System.Reflection.Emit\readme.md). This is used to generate types dynamically which are commonly used to generate proxies and other dynamic classes that may not be known ahead-of-time (in which case C# generation could be used, for example). It is also used to invoke members more efficiently than the [`standard runtime invoke mechanism`](https://learn.microsoft.com/dotnet/api/system.reflection.methodbase.invoke). However, due to recent work in 7.0 (which is to be extended in 8.0), this IL generation is now done automatically so the need to manually generate IL for performance is becoming less useful.
steveharter marked this conversation as resolved.
Show resolved Hide resolved
- **Low-level reading and writing of assemblies** through [System.Reflection.Metadata](../System.Reflection.Metadata\readme.md). This is used for tooling and compiler-like scenarios.
- Other reflection libraries that extend the functionality above or serve as a container assembly to support NetStandard or attribute types emitted by compilers:
- [System.Reflection.Context](../System.Reflection.Context/readme.md)
- [System.Reflection.DispatchProxy](../System.Reflection.DispatchProxy/readme.md)
- [System.Reflection.Extensions](../System.Reflection.Extensions/readme.md)
- [System.Reflection.Primitives](../System.Reflection.Primitives/readme.md)
- [System.Reflection.TypeExtensions](../System.Reflection.TypeExtensions/readme.md)

## <a name="status"></a>Status descriptions
Each library has its own `readme.md` that contains a description plus a current status of:
steveharter marked this conversation as resolved.
Show resolved Hide resolved
- **Legacy**
steveharter marked this conversation as resolved.
Show resolved Hide resolved
steveharter marked this conversation as resolved.
Show resolved Hide resolved
Not under development; maintained for compatibility.
PRs are unlikely to be accepted.
Issues are likely to be closed without fix.
steveharter marked this conversation as resolved.
Show resolved Hide resolved
- **Inactive**
Under minimal development; quality is maintained.
PRs for both features and fixes will be considered.
Issues will be considered for fix or addition to the backlog.
steveharter marked this conversation as resolved.
Show resolved Hide resolved
- **Active**
Under active development by the team.
PRs for both features and fixes will be considered and championed.
Issues will be considered for fix or addition to the backlog.
steveharter marked this conversation as resolved.
Show resolved Hide resolved

steveharter marked this conversation as resolved.
Show resolved Hide resolved
## Futures
The [8.0 roadmap](https://github.com/dotnet/runtime/issues/75358) covers planned work for this release.
jeffhandley marked this conversation as resolved.
Show resolved Hide resolved

In general, active reflection investments include:
- Keeping up with new language and runtime features, including byref-like types and AOT environments.
- Larger, missing features requested by the community, including an `AssemblyBuilder.Save()` mechanism to persist generated IL to an assembly.
- Performance improvements, such as automatically generating IL for invocation cases.
- Bug fixes and smaller features.
17 changes: 17 additions & 0 deletions src/libraries/System.Reflection/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# System.Reflection
Includes commom types such as [`AssemblyName`](https://learn.microsoft.com/dotnet/api/system.reflection.assemblyname) and [`MethodInfo`](https://learn.microsoft.com/dotnet/api/system.reflection.methodinfo).

## Status: [Active](../system.reflection/overview.md#status)
Although these common types are mature, the code base continues to evolve for better performance and to keep up with language and runtime enhancements such as byref-like types.

## Source
Runtime code for CoreClr:
https://github.com/dotnet/runtime/tree/main/src/coreclr/System.Private.CoreLib/src/System/Reflection
for Mono:
https://github.com/dotnet/runtime/tree/main/src/mono/System.Private.CoreLib/src/System/Reflection

Shared code between CoreClr and Mono:
https://github.com/dotnet/runtime/tree/main/src/libraries/System.Private.CoreLib/src/System/Reflection
steveharter marked this conversation as resolved.
Show resolved Hide resolved

## Deployment
Inbox