-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
As a developer, I get compile time diagnostics for unsupported APIs #47228
Comments
@jeffhandley is this one something you're going to drive? If so we can set you or someone as assignee I think. |
As was mentioned in #42967, we have over 4000 instances of throwing
I suspect we'd want to divide this list up by area so that owners across the areas could review and address the instances in their areas. That could be done either before or after the implementation of an analyzer. We were pondering in #42967 whether or not an analyzer for doing this would be valuable beyond the runtime team, or if this is one we should build directly into the runtime repo. I'm unsure on that myself. |
Talked to @jeffhandley today. #42967 is really about us finding the issues; while that's useful that's not actually what this issue is about. This issue is about the user's experience when they call such an API. They should get a warning. |
#44916 is also filed, and this one would involve reviewing the 4000 occurrences of PNSE that exist. |
If we apply for those |
Could not we use the For example, by my understanding the above CSharpCodeGenerator.FromFileBatch() API is unsupported on .NetCore (or it is only supported on .Net framework) [UnsupportedOSPlatform("netcoreapp")] //[UnsupportedOSPlatform("All")]
// or [SupportedOSPlatform("net46")]
private CompilerResults FromFileBatch(CompilerParameters options, string[] fileNames)
{
throw new PlatformNotSupportedException();
} |
[Brief Meeting Note]:
For the 2 API we discussed in the meeting, |
@buyaa-n what's the current status of this? |
Previously detected PNSEs on cross-platform builds and filed issues with findings, yesterday started the work detecting PNSEs on targeted builds and will file/update issues with findings. Overall this issue will cover the detecting PNSEs and that work will be done within 6.0. But some of the related issues might not make 6.0, depends on the area owners |
My PNSE analysis is done and most findings are reported with separate issues referenced above. There is few APIs having an issue for future support which we decided not to annotate, for now, I did not file issue for them since the discussion we had in #50535. Here is the list of those APIs:
Some of them were missing info in the doc that they are not supported in .Net Core, a PR for updating them is up With that, I think we can close this issue now what do you think @terrajobst @jeffhandley? |
Thanks, @buyaa-n! |
In .NET 5, we introduced a built-in platform analyzer that will check whether you call platform-specific APIs. However, this doesn't cover APIs that always throw
PlatformNotSupportedException
. We should mark those APIs in some fashion as well, for example, by applyingObsoleteAttribute
.We should make sure whatever mechanism we choose for detecting those APIs, that the docs also reflect this.
An example of an unmarked APIs is CSharpCodeGenerator.CreateFromBatch().
The text was updated successfully, but these errors were encountered: