dotnet / runtime

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

WCF on Linux is unable to create Channel #59681

Closed mikkeljohnsen closed 2 years ago

mikkeljohnsen commented 3 years ago

Using WCF on Linux fails. DispatchProxy.Create fails with "System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available."

Should this not work on Linux (and I assume macOS aswell). ?

System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available.
  at System.Reflection.DispatchProxy.Create[T,TProxy] () [0x00005] in <bf93afb40a994f349e93d6cf62ac54e3>:0 
  at System.ServiceModel.Channels.ServiceChannelProxy.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelProxy.cs:31 
  at System.ServiceModel.Channels.ServiceChannelFactory.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x0002d] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:377 
  at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel[TChannel] (System.ServiceModel.EndpointAddress address, System.Uri via) [0x0003b] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:345 
  at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x00061] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:522 
  at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:532 
  at System.ServiceModel.ClientBase`1[TChannel].CreateChannel () [0x0000c] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:381 
  at System.ServiceModel.ClientBase`1[TChannel].CreateChannelInternal () [0x00002] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:357 
  at System.ServiceModel.ClientBase`1[TChannel].get_Channel () [0x000ea] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:203 
  at System.ServiceModel.ClientBase`1[TChannel].get_InnerChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:285 
  at CPR104a.DetGodeCPROpslagClient.CPR104a.DetGodeCPROpslag.getPersonInformation (CPR104a.getPersonInformationRequest request) [0x00001] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3894 
  at CPR104a.DetGodeCPROpslagClient+<>c__DisplayClass7_0.<getPersonInformationAsync>b__0 () [0x00000] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3911 
  at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534 
  at System.Threading.Tasks.Task.Execute () [0x00000] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
HongGit commented 3 years ago

@mikkeljohnsen WCF is using DispatchProxy.Create, WCF is depending on that function from runtime, passing down to runtime team.

ghost commented 3 years ago

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

Issue Details
Using WCF on Linux fails. DispatchProxy.Create fails with "System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available." Should this not work on Linux (and I assume macOS aswell). ? ``` System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available. at System.Reflection.DispatchProxy.Create[T,TProxy] () [0x00005] in :0 at System.ServiceModel.Channels.ServiceChannelProxy.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelProxy.cs:31 at System.ServiceModel.Channels.ServiceChannelFactory.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x0002d] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:377 at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel[TChannel] (System.ServiceModel.EndpointAddress address, System.Uri via) [0x0003b] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:345 at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x00061] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:522 at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:532 at System.ServiceModel.ClientBase`1[TChannel].CreateChannel () [0x0000c] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:381 at System.ServiceModel.ClientBase`1[TChannel].CreateChannelInternal () [0x00002] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:357 at System.ServiceModel.ClientBase`1[TChannel].get_Channel () [0x000ea] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:203 at System.ServiceModel.ClientBase`1[TChannel].get_InnerChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:285 at CPR104a.DetGodeCPROpslagClient.CPR104a.DetGodeCPROpslag.getPersonInformation (CPR104a.getPersonInformationRequest request) [0x00001] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3894 at CPR104a.DetGodeCPROpslagClient+<>c__DisplayClass7_0.b__0 () [0x00000] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3911 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534 at System.Threading.Tasks.Task.Execute () [0x00000] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 ```
Author: mikkeljohnsen
Assignees: -
Labels: `area-System.Threading.Channels`, `untriaged`
Milestone: -
ghost commented 3 years ago

Tagging subscribers to this area: @buyaa-n See info in area-owners.md if you want to be subscribed.

Issue Details
Using WCF on Linux fails. DispatchProxy.Create fails with "System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available." Should this not work on Linux (and I assume macOS aswell). ? ``` System.PlatformNotSupportedException : This operation is not supported on .NET Standard as Reflection.Emit is not available. at System.Reflection.DispatchProxy.Create[T,TProxy] () [0x00005] in :0 at System.ServiceModel.Channels.ServiceChannelProxy.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelProxy.cs:31 at System.ServiceModel.Channels.ServiceChannelFactory.CreateProxy[TChannel] (System.ServiceModel.Description.MessageDirection direction, System.ServiceModel.Channels.ServiceChannel serviceChannel) [0x0002d] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:377 at System.ServiceModel.Channels.ServiceChannelFactory.CreateChannel[TChannel] (System.ServiceModel.EndpointAddress address, System.Uri via) [0x0003b] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/Channels/ServiceChannelFactory.cs:345 at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel (System.ServiceModel.EndpointAddress address, System.Uri via) [0x00061] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:522 at System.ServiceModel.ChannelFactory`1[TChannel].CreateChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ChannelFactory.cs:532 at System.ServiceModel.ClientBase`1[TChannel].CreateChannel () [0x0000c] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:381 at System.ServiceModel.ClientBase`1[TChannel].CreateChannelInternal () [0x00002] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:357 at System.ServiceModel.ClientBase`1[TChannel].get_Channel () [0x000ea] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:203 at System.ServiceModel.ClientBase`1[TChannel].get_InnerChannel () [0x00001] in /home/mkj/Projects/wcf/src/System.Private.ServiceModel/src/System/ServiceModel/ClientBase.cs:285 at CPR104a.DetGodeCPROpslagClient.CPR104a.DetGodeCPROpslag.getPersonInformation (CPR104a.getPersonInformationRequest request) [0x00001] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3894 at CPR104a.DetGodeCPROpslagClient+<>c__DisplayClass7_0.b__0 () [0x00000] in /home/mkj/Projects/XMedicus/libwebservicecpr/CPRService104a.cs:3911 at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Future.cs:534 at System.Threading.Tasks.Task.Execute () [0x00000] in /builddir/build/BUILD/mono-6.12.0.107/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319 ```
Author: mikkeljohnsen
Assignees: -
Labels: `area-System.Reflection`, `untriaged`
Milestone: -
buyaa-n commented 3 years ago

@mikkeljohnsen which version of .NET is the code running on? By doc https://docs.microsoft.com/en-us/dotnet/api/system.reflection.dispatchproxy?view=net-5.0iIt is supported on netstandard 2.1 only, it doesn'st seem there is an issue with Linux or any other platform, did you tried with windows?

It would be helpful if you could attach a repro project.

ghost commented 2 years ago

This issue has been automatically marked no recent activity because it has been marked as needs more info but has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no recent activity.

Please refer to our contribution guidelines for tips on what information might be required.

mikkeljohnsen commented 2 years ago

Guess it is mono that is not able to run it. Will reopen if dotnet has the same error, when i'm able to switch to dotnet instead of mono.