-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
I've been working on a project, and have been attempting to make it compatible with .Net Framework and .Net Core. When attempting to run it in .Net Core I found that some methods in the .Net API are not supported.
One such example is Thread.Abort. When you try to call Thread.Abort in a .Net Core 2.0 app, you get the following message:
System.PlatformNotSupportedException: 'Thread abort is not supported on this platform.'
You can see the Thread.Abort documentation for .Net Core 2.0 here: https://docs.microsoft.com/en-gb/dotnet/api/system.threading.thread.abort?view=netcore-2.0
As you can see, the documentation is not accurate, there is no mention of this method not being supported.
I would like to update the documentation to accurately reflect the methods that are not supported in .Net Core. I've downloaded the .Net Core source code and found the following methods in Thread.cs that aren't supported:
public void Abort()
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ThreadAbort);
}
public void Abort(object stateInfo)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ThreadAbort);
}
public static void ResetAbort()
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ThreadAbort);
}
[ObsoleteAttribute("Thread.Suspend has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
public void Suspend()
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ThreadSuspend);
}
[ObsoleteAttribute("Thread.Resume has been deprecated. Please use other classes in System.Threading, such as Monitor, Mutex, Event, and Semaphore, to synchronize Threads or protect resources. http://go.microsoft.com/fwlink/?linkid=14202", false)]
public void Resume()
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_ThreadSuspend);
}
This is my first contribution to the dotnet docs, so I looked at the guidelines, and step 1 says to create an issue here, so we can discuss the changes and agree how to proceed.
I was thinking of starting by updating the docs for the Thread class, to state the Abort, ResetAbort, Suspend and Resume methods are not supported in .Net Core, and perhaps specify that they throw PlatformNotSupportedException. How would I do this, only when the documentation is being viewed for .Net Core 2.0? Is there a guide on how to make platform specific changes to the documentation?
After I've successfully update the docs for the Thread class, I was planning on finding all other callsites for PlatformNotSupportedException and work on updating the rest of the documentation accordingly.
Thanks for any help you can offer.