Skip to content

Conversation

@jkotas
Copy link
Member

@jkotas jkotas commented Jul 18, 2022

Fixes #72352

@jkotas jkotas requested a review from MichalStrehovsky as a code owner July 18, 2022 05:11
@ghost ghost assigned jkotas Jul 18, 2022
@jkotas
Copy link
Member Author

jkotas commented Jul 18, 2022

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).


_initialApartmentState = state;
return true;
retState = _initialApartmentState;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this != CurrentThread) path needs to have the same error handling and throw InvalidOperationException as the (this == CurrentThread) path.


if (GetThreadStateBit(ThreadState.Unstarted))
{
// Lack of memory is the only expected reason for thread creation failure
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was incorrect assumption. COM initialization can fail with PlatformNotSupportedException on Nano server.

Copy link
Contributor

@tlakollo tlakollo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not an expert in the area, but functionally looks good and the tests are passing. Thanks for the comments too

@jkotas jkotas merged commit a567d4c into dotnet:main Jul 18, 2022
@jkotas jkotas deleted the issue-72352 branch July 18, 2022 19:44
// Lack of memory is the only expected reason for thread creation failure
throw new ThreadStartException(new OutOfMemoryException());
Exception? startException = _startException;
startException = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be _startException = null;

@ghost ghost locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

system.threading.thread.tests work item

3 participants