Proposal for System.Runtime.CompilerServices.ICastable .NET Core public API
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 can you provide more info what is the interface for, how is it used, etc.? See example in API review process
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.
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?
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.
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
Closing this issue in lieu of #36654