runtime: TypeInfo doesn't expose a parameterless constructor

TypeInfo currently doesn’t expose a parameterless constructor. We have several types in our reference assemblies which should be inheriting from TypeInfo but are unable to do so because there is no accessible constructor.

Proposed Surface Area

public abstract class TypeInfo
{
     protected TypeInfo() {}
}

@weshaggard

This is needed to bring System.Reflection.Context up now as we have an ongoing PR blocked on this.

Also, the following items which we’d like to do in the future (and want to prototype in 2.2 timeframe) will be hampered by this:

https://github.com/dotnet/corefx/issues/4491 (System.Reflection.Emit.AssemblyBuilder.Save)

https://github.com/dotnet/corefx/issues/2800 (Assembly.ReflectionOnlyLoad replacement)

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (14 by maintainers)

Most upvoted comments

Video

Let’s start doing this in .NET Core. This doesn’t help the RefEmit case for .NET Standard, but we gonna start somewhere 😃

We could in a future version of netfx but that doesn’t really help us much with shipping a library that needs to work on the existing version.

I’d just as soon make this constructor protected and be done with it. For S.R.C specifically, NETFX can presumably continue to use its own version. But not having this constructor is going to hamper other Reflection work in the future.