Skip to content
This repository was archived by the owner on Nov 13, 2026. It is now read-only.

.NET Native CoreLib Reflection Bringup - #1696

Merged
1 commit merged into
nmirrorfrom
unknown repository
Aug 22, 2016
Merged

1 commit merged into
nmirrorfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 22, 2016

Copy link
Copy Markdown

Restored most of the Reflection surface
area in Project N's S.P.Corelib.dll
to match the bringup in CoreClr
and get it suitable for a N targeting
pack for corefx to consume.

Stuff still do to:

Type/TypeInfo: Something about migrating apis
from TypeInfo to Type makes ILC very cranky
in shared mode. While I find the right
people to sort that out, I'm committing
what I've already got. It's big enough
already.

TypeDelegator: blocked on Type/TypeInfo.
Actually, this probably could live in
the System.Runtime facade, not corelib.
No one uses it inside corelib.

AssemblyName: Just didn't get to this -
will do in future PR.

operator==: They need to be done together
(once Type/TypeInfo is done) to keep MemberInfo:==
from recursing infinitely.

Most of the new apis throw NotImplemented,
but everything that worked in N before
still works.

Things that might look strange:

  • A few odds and ends like System.ModuleHandle
    are just member-less shells since they appear
    in Reflection api signatures. I don't
    plan to own them or fill them out.

  • Moved Type.TryGetEEType() to a helper class
    and converted it to an extension method. The Type.cs
    class that's coming down is basically
    the desktop Type.cs (with 2016-era formatting)
    and it's just nice to have the N-specific
    stuff de-intermingled from it.

  • MethodBody properties that throw
    "new ArgumentNullException("array");"

    Yeah, we just do more efficiently what
    CoreClr does by calling Array.AsReadOnly()
    on a null array fetched from a field
    that's never set and can never be set
    by a derived class since it's private.
    (when the CoreClr framework creates a
    MethodBody, it sets the field from native
    code inside the VM.)

  • RuntimeNamedMethodInfo had an internal
    property named "MethodHandle" (which returns
    a Project N metadata handle.) The
    incoming MethodInfo has an api named
    "MethodHandle". Yay. Renamed.

  • With BindingFlags defined in both Corelib
    and S.R.TypeExtensions, I scanned for
    assemblies that were referencing both.
    S.P.Interop and S.P.TypeLoader were
    referencing it and not using it.

    S.P.R.Execution was referencing
    it just so it could use the
    Type.GetGenericArguments()
    extension method. Since this is a real
    instance member on the incoming Type,
    I just went ahead and added it to
    System.Type now so we can drop that
    reference.

  • BindingFlags.cs: I'm just adding the enum
    values that were missing but the file in
    Project N was so lamely styled, I just
    bulldozed it with the coreclr version instead.

Restored most of the Reflection surface
area in Project N's S.P.Corelib.dll
to match the bringup in CoreClr
and get it suitable for a N targeting
pack for corefx to consume.

Stuff still do to:

  Type/TypeInfo: Something about migrating apis
    from TypeInfo to Type makes ILC very cranky
    in shared mode. While I find the right
    people to sort that out, I'm committing
    what I've already got. It's big enough
    already.

  TypeDelegator: blocked on Type/TypeInfo.
    Actually, this probably could live in
    the System.Runtime facade, not corelib.
    No one uses it inside corelib.

  AssemblyName: Just didn't get to this -
    will do in future PR.

  operator==: They need to be done together
    (once Type/TypeInfo is done) to keep MemberInfo:==
    from recursing infinitely.

Most of the new apis throw NotImplemented,
but everything that worked in N before
still works.

Things that might look strange:

- A few odds and ends like System.ModuleHandle
  are just member-less shells since they appear
  in Reflection api signatures. I don't
  plan to own them or fill them out.

- Moved Type.TryGetEEType() to a helper class
  and converted it to an extension method. The Type.cs
  class that's coming down is basically
  the desktop Type.cs (with 2016-era formatting)
  and it's just nice to have the N-specific
  stuff de-intermingled from it.

- MethodBody properties that throw
  "new ArgumentNullException("array");"

  Yeah, we just do more efficiently what
  CoreClr does by calling Array.AsReadOnly()
  on a null array fetched from a field
  that's never set and can never be set
  by a derived class since it's private.
  (when the CoreClr framework creates a
  MethodBody, it sets the field from native
  code inside the VM.)

- RuntimeNamedMethodInfo had an internal
  property named "MethodHandle" (which returns
  a Project N metadata handle.) The
  incoming MethodInfo has an api named
  "MethodHandle". Yay. Renamed.

- With BindingFlags defined in both Corelib
  and S.R.TypeExtensions, I scanned for
  assemblies that were referencing both.
  S.P.Interop and S.P.TypeLoader were
  referencing it and not using it.

  S.P.R.Execution was referencing
  it just so it could use the
  Type.GetGenericArguments()
  extension method. Since this is a real
  instance member on the incoming Type,
  I just went ahead and added it to
  System.Type now so we can drop that
  reference.

- BindingFlags.cs: I'm just adding the enum
  values that were missing but the file in
  Project N was so lamely styled, I just
  bulldozed it with the coreclr version instead.
@ghost
ghost merged commit ec2f328 into dotnet:nmirror Aug 22, 2016
@ghost
ghost deleted the mon branch August 22, 2016 16:55
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant