runtime icon indicating copy to clipboard operation
runtime copied to clipboard

Proposal for System.Runtime.CompilerServices.ICastable .NET Core public API

Open shrah opened this issue 9 years ago • 6 comments

We need the System.Runtime.CompilerServices.ICastable for building the CoreCLR version of System.Private.Interop.

Current Workarounds:

Today we use a hack by publishing the System.Private.ICastable.dll though myget and consume it from CoreRT.

Discussion:

The ideal solution would be to expose it as a public .NET Core API possibly in System.Runtime.InteropServices.dll

shrah avatar Oct 03 '17 22:10 shrah

@shrah can you provide more info what is the interface for, how is it used, etc.? See example in API review process

karelz avatar Oct 05 '17 16:10 karelz

What's the value of ICastable to developers outside of interop? As I understand it right now, it's very dangerous and fragile and only fulfills a very specific purpose. If you just have layering problems for System.Private.Interop, we can probably work out something more scoped than making ICastable public.

morganbr avatar Oct 06 '17 03:10 morganbr

ICastable is an interface used by the runtime to support dynamic interface casting. Implementing this interface on a type will allow the type to support interfaces (for the purposes of casting and interface dispatch) that do not appear in its interface map.

An example of ICastable is here __ComObject .

@morganbr that is a good question. I don't have any other use cases for ICastable outside of interop right now.

@jkotas , can you think of any other use cases of ICastable outside of interop?

shrah avatar Oct 09 '17 23:10 shrah

we can probably work out something more scoped than making ICastable public.

  • Compatibility: We want to be able to maintain same level of compatibility for this API as for any other public API.
  • Documentation: It is ok to document this API for use by tools.

can you think of any other use cases of ICastable outside of interop?

Yes, this is primarily to support interop.

jkotas avatar Oct 10 '17 00:10 jkotas

For ProjectN, we have invented CastableObject that fixed some of the issues with ICastable. Would we want to expose the CastableObject instead?

https://github.com/dotnet/corert/blob/master/src/System.Private.CoreLib/src/System/Runtime/CompilerServices/CastableObject.cs

jkotas avatar Oct 10 '17 00:10 jkotas

Closing this issue in lieu of #36654

AaronRobinsonMSFT avatar May 31 '20 17:05 AaronRobinsonMSFT