dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.16k stars 4.72k forks source link

Implement AOT safe DispatchProxy.Create #73136

Open MichalStrehovsky opened 2 years ago

MichalStrehovsky commented 2 years ago

The generic DispatchProxy.Create can be done ahead of time, but it requires an AOT compiler feature.

ghost commented 2 years ago

Tagging subscribers to this area: @dotnet/area-system-reflection See info in area-owners.md if you want to be subscribed.

Issue Details
The generic DispatchProxy.Create can be done ahead of time, but it requires an AOT compiler feature.
Author: MichalStrehovsky
Assignees: -
Labels: `area-System.Reflection`, `area-NativeAOT-coreclr`
Milestone: 8.0.0
jkotas commented 2 years ago

I do not think it make sense to have this custom build into Native AOT compiler like it was done in .NET Native. We should be looking at this as "reverse Invoke" reflection feature for all runtimes.

steveharter commented 1 year ago

I do not think it make sense to have this custom build into Native AOT compiler like it was done in .NET Native. We should be looking at this as "reverse Invoke" reflection feature for all runtimes.

Is there an existing proposal for this?

@MichalStrehovsky do you plan on working on this - it was originally marked 8.0 so I assume it was important at that time at least.

cc @buyaa-n per our offline discussion

MichalStrehovsky commented 1 year ago

Not planning to work on it. There is an implementation in .NET Native that one can take inspiration from. There might be design docs as well but it was long time ago and I didn't work on any aspect of it.

steveharter commented 1 year ago

Moving to 8.0 for now but we need to discuss whether this is an AOT issue or a reflection\DispatchProxy issue.

steveharter commented 1 year ago

Moving to future; doesn't seem to be high enough priority to make the cut.

steveharter commented 11 months ago

We should take another look at this for v9.

DjArt commented 9 months ago

Is there any workaround?

MichalStrehovsky commented 9 months ago

Is there any workaround?

No workaround, the implementation is full of Reflection.Emit and that's unsupportable in current form.

mconnew commented 1 month ago

Lack of support for DispatchProxy will block apps that use WCF from using the new UWP on .NET 9 capability as that uses native aot. Blog post announcing UWP on .NET 9: https://devblogs.microsoft.com/ifdef-windows/preview-uwp-support-for-dotnet-9-native-aot/