-
Notifications
You must be signed in to change notification settings - Fork 989
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
.NET Core 3.0 Preview 7 - PictureBox.LoadAsync throws an exception. "Operation is not supported on this platform." #1548
Comments
From @ebizupnorth on Monday, July 29, 2019 5:57:12 PM Workaround: var httpClient = new HttpClient();
var stream = await httpClient.GetStreamAsync("https://publicdomainarchive.com/wp-content/uploads/2014/03/public-domain-images-free-stock-photos-high-quality-resolution-downloads-around-the-house-1.jpg");
pictureBox1.Image = Image.FromStream(stream); |
From @carlossanlop on Wednesday, July 31, 2019 7:06:17 PM Thank you @ebizupnorth for the detailed report. I will transfer your issue to the winforms repo. |
I think this was reported previously as #242 but @merriemcgaw misunderstood the comment from corefx and closed as "by design". This is the wrong resolution, what is by design is the implementation in corefx throwing, but that does not mean WinForms can propagate the throw. WinForms needs to update their implementation to keep working in .NET Core. There was a comment afterwards with a link on how to replace Note that the naming of that function |
@weltkante you're right - thank you for catching that, it slipped by me. We'll keep this one open for now. I can't be sure if we'll get it for this 3.0 GA but we'll try. |
This comment has been minimized.
This comment has been minimized.
Erm, above I have linked issue #242 which has the analysis but was closed prematurely due to a misunderstanding. WinForms needs to stop calling #242 also says something about an platform-compat analyzer which can detect such invalid uses of obsolete APIs, dunno but maybe worth checking out to see if WinForms has more bad API usage. |
Thank you @weltkante 👍 |
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
Verified this bug with .Net core 3.0.100-rc1-014190 from release branch, the issue has been fixed. |
From @ebizupnorth on Monday, July 29, 2019 4:28:28 AM
The following code throws an Exception "Operation is not supported on this platform." on .NET Core 3.0 Preview 7. The picture loads fine when using .NET Framework 4.8
Form1.Designer.cs
Form1.resx
Form1.cs
Copied from original issue: dotnet/core#3107
The text was updated successfully, but these errors were encountered: