-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MulticastDelegate, BeginInvoke throws NotSupportedException #16312
Comments
Async delegates are not in .NET Core for several reasons:
|
Can't this be solved by compilation errors instead of runtime exceptions? |
@jaredpar What do you think? |
Generally the compiler enables / disables features by looking at the types for hints. Is there anything we can key on here to know to exclude these members? |
just refreshing this thread to see if something can be done for compilation errors instead of runtime exceptions |
+1 For compiler safety. How does it make sense to make an API available that is guaranteed to be the wrong thing to use? The ideal experience is for |
apparently we're using multicast delegates which are not supported on .NET Standard. see dotnet/corefx#5940
Linking back to the official blog post, in case someone comes across the github issue before finding the post. It has some more details and suggestions how to replace https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/ |
Async delegates have been deprecated in .NET Core (see https://github.com/dotnet/corefx/issues/5940) for reasons such as: * Async delegates use deprecated IAsyncResult-based async pattern. This pattern is generally not supported throughout .NET Core base libraries. * Async delegates depend on remoting (System.Runtime.Remoting) under the hood. Remoting is not supported in .NET Core. For more detailed reasons and migration strategies please refer to https://devblogs.microsoft.com/dotnet/migrating-delegate-begininvoke-calls-for-net-core/ In case of WinForms, async pattern predates the Task-based Asynchronous Pattern and it does not return awaitables. In order to minimise the change to the public API surface we continue to expose the existing API and just re-route the image loading routine to a `Task` runner under the covers. Fixes dotnet#242 Fixes dotnet#1548
Delegate.BeginInvoke was removed in .NET Core. See dotnet/runtime#16312.
…inInvoke in AVAssetImageGeneratorTest. MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312
…inInvoke. MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312
…inInvoke. MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312
…inInvoke in AVAssetImageGeneratorTest. (#9067) MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312
…voke. MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312 Fixes this test failure: DontLink.DontLinkRegressionTests [FAIL] Bug5354 : System.PlatformNotSupportedException : Operation is not supported on this platform. at DontLink.DontLinkRegressionTests.Bug5354() in [...]/xamarin-macios/tests/linker/ios/dont link/DontLinkRegressionTests.cs:line 64 at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
MulticastDelegate.BeginInvoke isn't supported in .NET. Ref: dotnet/runtime#16312
this is now an old issue, but an internal customer pointed me at it today and I see there have grown to be a lot of thumbs up above, over time. @jkotas did you see @jaredpar question above -- do you think it might be feasible? |
This should be an analyzer. It is proposed by dotnet/roslyn-analyzers#2807. dotnet/roslyn-analyzers#2972 was an attempt to implement this analyzer, but it was closed due to unaddressed feedback. Changing Roslyn to stop emitting Resolving as duplicate of dotnet/roslyn-analyzers#2807 |
Got it, thanks for the links. Perhaps someone here might be interested in working on that analyzer. |
cc @wikimonkey in case he's interested in the links/info above. also linking dotnet/docs#34937 |
Invoking the BeginInvoke method of a MulticastDelegate derived delegate compiles fine with .NET Core, but throws a NotSupportedException.
Should this really be the case?
Sample code is here, .NET 4.6 runs ok, but .NET Core fails with the mentioned exception:
https://github.com/ProfessionalCSharp/ProfessionalCSharp6/tree/master/Synchronization/SynchronizationSamples/AsyncDelegate
Thanks,
Christian
The text was updated successfully, but these errors were encountered: