-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Platform Specific Analyzer #2083
Conversation
…alyzer and documentation
Types not present are existing types added in previous SDK versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
# Platform Specific Analyzer | ||
|
||
The [writing version adaptive](https://docs.microsoft.com/windows/uwp/debug-test-perf/version-adaptive-code) code, the developers should ensure that code checks for presence of API before calling it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird wording, should be
When writing version adaptive code...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
| Device family | Universal, 10.0.15063.0 or higher | | ||
| ---------------------------------------------------------------- | ----------------------------------- | | ||
| Namespace | Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer | | ||
| NuGet package | [Microsoft.Toolkit.Uwp.UI.Animations](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer/) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nuget package name is wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixing that too
|
||
## Installation | ||
|
||
The analyzer is available both as a nuget package and also as Visual Studio Extention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could not find the Visual Studio Extension, how do we build it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a vsix solution and building it is as easy as including it in sln however that throws VSTS errors. Need to get that looked into.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Not familiar with VSIX - what's the benefit over having a nuget package? Should we publish both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure we can get it building in VSTS, but in general, I don't think it's as good since it requires everyone to install it. Nice part of nuget analyzers is that they are brought in with the solution so clone-open just works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The VSIX will also need to be added to the list of items sent to the signing service. (and ensure it has the proper filter configuration)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't that the reason the analyzer template supports both vsix and nuget ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but that's a template, doesn't mean you have to support both methods. Most analyzers that I know of just use NuGet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am okay with whatever you and others think 👍 I have no idea about the sort of usage they have plus VSIX would need submissions to VS gallery etc.. maybe its not worth the effort unless there's a strong demand.
We can go nuget to start with. I will fix the docs
{ | ||
public class Program | ||
{ | ||
private static string path = @"D:\UwpApi"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path is hardcoded, should be current directory instead
<PropertyGroup> | ||
<PackageId>Microsoft.Toolkit.Uwp.PlatformSpecificAnalyzer</PackageId> | ||
<PackageVersion>1.0.0.0</PackageVersion> | ||
<Authors>hermi</Authors> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change author, image, and other properties to match other projects
Add ability to analyse field declaration Correct guard instantiation Correct documentation Correct path in diff generator Correct project file properties
@@ -6,22 +6,6 @@ | |||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | |||
</PropertyGroup> | |||
|
|||
<PropertyGroup> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should still have <Title> <Description>
and <PackageTags>
here (see other projects for example)
Beauty of VSIX is install once and use across projects. Nuget is per project. In this instance is prefer VSIX over Nuget |
Maintain differences dictionary to prevent frequent loading from resource.
This is feature complete I believe. |
@azchohfi any good? |
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard1.3</TargetFramework><Title>Windows Community Toolkit UI</Title> | ||
<Description>This .NET standard library provides analyzer and code fixer to ensure that version / platform specific code is well guarded. It is part of the Windows Community Toolkit.</Description> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"code fixes"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope I think the current wording is okay. There is an analyser and code fixer in the project
<Title>Windows Community Toolkit UWP Platform Specific Analyzer</Title> | ||
|
||
<!-- This is a temporary workaround for https://github.com/dotnet/sdk/issues/955 --> | ||
<DebugType>Full</DebugType> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't this been fixed in the latest VS? Oren even opened an issue to remove the workaround on other Toolkit projects #1951
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. @nmetulev asked me to make it same as other projects so I just copied that bit as was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@onovotny, have you verified this is fixed now - should we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be merged today and a separate PR cleaning up all projects would be a good idea if applicable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a problem. Let's merge it.
Issue: #1497
PR Type
What kind of change does this PR introduce?
<- Feature >
What is the current behavior?
No platform / version analyzers
What is the new behavior?
Added Platform Specific Differences Generator and Roslyn code Analyzer + Fixer
PR Checklist
Please check if your PR fulfills the following requirements:
Other information