Skip to content
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

Certain TcpClient (and potentially other class) constructors perform I/O #22568

Closed
CIPop opened this issue Jun 29, 2017 · 3 comments
Closed

Certain TcpClient (and potentially other class) constructors perform I/O #22568

CIPop opened this issue Jun 29, 2017 · 3 comments
Assignees
Milestone

Comments

@CIPop
Copy link
Member

CIPop commented Jun 29, 2017

Performing I/O in a constructor is not supported by the UWP policies if that constructor is called on an UI thread.
We need to investigate if we need to change the implementation, obsolete the constructors or at least document this behavior.

@stephentoub
Copy link
Member

We need to investigate if we need to change the implementation

What's the exact limitation? It's it a technical thing (i.e. an exception occurs) or a policy thing (i.e. it's frowned upon and apps that do it are disallowed). If the former, I'm wondering if, for example, on UWP the I/O could just be moved off of the current thread, e.g. instead of:

Connect(hostname, port);

doing the equivalent of:

Task.Run(() => Connect(hostname, port)).GetAwaiter().GetResult();

to initiate the I/O from a non-UI thread.

@DavidGoll
Copy link

DavidGoll commented Jun 29, 2017

@stephentoub It's policy (to prevent UI hangs).
This issue was opened to determine whether these constructors are causing perceivable hangs.

@DavidGoll
Copy link

Triage: This is not expected to have any perceived impact. If it proves to be an issue (e.g., throwing on the constructor, hanging the UI), we will revisit. Will handle via new issues opened for the specific constructor(s) as they are opened.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the UWP6.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants