You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suppress finalizeation of ThreadMethodEntry class #10361
ThreadMethodEntry class have a Finalizer but not implement an IDisposable interface. So, after every call to BeginInvoke/Invoke instance of ThreadMethodEntry will end up in Freachable queue:
We have 3 cases here (for all of them ThreadMethodEntry will end up in Freachable queue any way) :
We not allocate WH.
We allocate WH and use it internally (Invoke) - we not free it. This already violate IAsyncResult.AsyncWaitHandleusing rules.
User allocate WH through IAsyncResult.AsyncWaitHandle (BeginInvoke). And even if he properly Close this WH, ThreadMethodEntry will end up in Freachable queue :(
Proposal
Suggestions:
implement IDisposable?
register for finalization only when WH is allocated.
SuppressFinalize after WH disposed.
If you don't mind in principle, you can assignee this to me. I have some ideas on this matter, and will try to implement them as soon as find time.
@elachlan
Sadly I need to wait until 17.8 become stable enough :(
17.7.7:
error NETSDK1209: The current Visual Studio version does not support targeting .NET 9.0. Either target .NET 9.0 or lower, or use Visual Studio version 17.8 or higher
Activity
elachlan commentedon Nov 23, 2023
@kirsan31
ThreadMethodEntryisprivate, so I don't think a full API review is required. Do you want to submit a PR demonstrating the fix?[-]Implement IDisposable in ThreadMethodEntry class[/-][+]Suppress finalizeation of ThreadMethodEntry class[/+]kirsan31 commentedon Nov 23, 2023
Yea:
kirsan31 commentedon Nov 25, 2023
@elachlan
Sadly I need to wait until 17.8 become stable enough :(
17.7.7:
P.s. error text is a bit contusing 🙄
Fix dotnet#10361. And one more bug.
Fix dotnet#10361.
Fix dotnet#10361.
Fix dotnet#10361.
Suppress finalizeation of ThreadMethodEntry class. Fix #10361. (#10460)
Suppress finalizeation of ThreadMethodEntry class. Fix dotnet#10361. (d…