Installed product versions
- Visual Studio: 2022
- This extension: 1.1.21
Description
When calling InternalClose there is a call to Thread.Abort(). This call is no longer possible in .net5 and above. Instead you should use the equivalent of a cancellation token to terminate the rxThread. To support legacy frameworks you might need to roll your own. I would do the changes but I don't want to mess with Lesser GPL (that's a whole different topic)
Steps to recreate
private void InternalClose()
{
Win32.NativeMethods.CancelIo(hPort);
if (rxThread != null)
{
try
{
//rxThread.Abort();
rxCancellationTokenSource.Cancel(); //new
//JH 1.3: Improve robustness of Close in case were followed by Open:
rxThread.Join(100);
}
catch (System.Threading.ThreadAbortException)
{ /* NOP */ }
rxThread = null;
}
Current behavior
Thread.Abort is no longer supported in .Net Core. It was never a a robust solution
Expected behavior
Microsoft has moved to the CancelationToken concept. And something like this should be adopted.
Installed product versions
Description
When calling InternalClose there is a call to Thread.Abort(). This call is no longer possible in .net5 and above. Instead you should use the equivalent of a cancellation token to terminate the rxThread. To support legacy frameworks you might need to roll your own. I would do the changes but I don't want to mess with Lesser GPL (that's a whole different topic)
Steps to recreate
private void InternalClose()
{
Win32.NativeMethods.CancelIo(hPort);
if (rxThread != null)
{
try
{
//rxThread.Abort();
rxCancellationTokenSource.Cancel(); //new
//JH 1.3: Improve robustness of Close in case were followed by Open:
rxThread.Join(100);
}
catch (System.Threading.ThreadAbortException)
{ /* NOP */ }
rxThread = null;
}
Current behavior
Thread.Abort is no longer supported in .Net Core. It was never a a robust solution
Expected behavior
Microsoft has moved to the CancelationToken concept. And something like this should be adopted.