-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Methods that throw PlatformNotSupportedException are not documented #3825
Comments
An example of what I'd like to do would be to change this:
To something like this:
|
@DoctaJonez, there is an existing issue, #2934, about PlatformNotSupportedException in general, but it would be great if you could document the exceptions for the Thread class. All .NET implementations, including .NET Core and the .NET Framework, now share a single documentation set. That means that the member descriptions cannot be changed to note the exception. Instead, the exceptions should be noted in the Exceptions section of the member documentation, with a description of the appropriate exception condition. Since the documentation is in ECMAXML format, this involves adding a tag like the following after the Remarks section in the member documentation, something like this:
The only question offhand is whether the exception is thrown on all platforms supported by .NET Core or only on some (particularly Linux and MacOS). The source code suggests it's thrown on all, but I'm not completely certain. @jkotas or @weshaggard, can you confirm? Once we confirm whether the exception is thrown on all platforms supported by .NET Core or only on individual platforms, please let us know whether you're still interested in documenting the exceptions for the Thread class. //cc @jkotas @weshaggard |
I think you're right @rpetrusha. The wiki says that it throws for all platforms: /cc @pjanotti |
Right, Thread.Abort throws PNSE on all .NET Core platforms. BTW: The platform-compat tool cc @terrajobst |
@rpetrusha thank you for the reply. Yes I'm happy to document the exceptions for the Thread class. I'm happy to work through the compatibility spreadsheet and document all of the methods that are unsupported on all 3 platforms (Win, Mac, Linux), as these will be the most straightforward to do. How would we document the others that are only supported on selected platforms? Like this?
It seems a bit clunky, is there a better way of doing it? |
@rpetrusha I'd also like to know if there's a better way of documenting that the method isn't supported rather than just putting an exception into the docs with an addendum. It's a little too subtle for my liking. If we haven't got the capability of showing appropriate documentation for the selected .Net version, why does the user have the option of filtering by .Net version on the API site? It gives the false impression that this documentation is relevant to the selected .Net version. https://docs.microsoft.com/en-gb/dotnet/api/system.threading.thread.abort?view=netcore-2.0 |
The basic problem, @DoctaJonez, is that while the method isn't supported, it is present; the version selector determines whether a type or member is present on a particular .NET version, but it has no way of knowing what the member implementation is. It may be that this is something that the API browser can eventually address, especially since there are now analyzers that detect methods that throw PlatformNotImplementException. But for the foreseeable future, the exception information will have to indicate the individual platforms that throw. I'd phrase the exception message somewhat differently:
//cc @dend edit by @mairaw: updated MacOS to macOS |
@rpetrusha thank you for the explanation. I will work on a pull request to add exceptions as per your example. I will start with a small one for Thread, and then look at other types after getting the Thread PR approved. |
@rpetrusha, I have created the following pull request with the changes for the Thread class. |
|
@TylerBrinkley can you open a new issue for us to investigate this? Or if you prefer to just go ahead and open a PR, we welcome contributions. Thanks! |
check out my answer here |
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 callThread.Abort
in a .Net Core 2.0 app, you get the following message: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.0As 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:
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 theAbort
,ResetAbort
,Suspend
andResume
methods are not supported in .Net Core, and perhaps specify that they throwPlatformNotSupportedException
. 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.
The text was updated successfully, but these errors were encountered: