-
Notifications
You must be signed in to change notification settings - Fork 340
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
Trwalke/ruleset updates #3189
Trwalke/ruleset updates #3189
Conversation
dotnet_diagnostic.VSTHRD010.severity = warning | ||
|
||
# Use AsyncLazy<T> | ||
dotnet_diagnostic.VSTHRD011.severity = none #error requires the use of Microsoft.VisualStudio.Threading to get access to the AsyncLazy<T> type |
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.
inorder to enable this we need to use Microsoft.VisualStudio.Threading but the package is not compatable with our .net 45 targets. same with some other older targets.
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.
Yeah, bummer.
I fixed a bunch of errors already but these rules produce an extra 100+ warnings and it may be easier to disable the problematic rules but not sure. Thoughts @bgavrilMS? Should I keep going?
|
@@ -14,20 +14,20 @@ namespace Microsoft.Identity.Client.Platforms | |||
{ | |||
internal static class WebAuthenticationCoreManagerInterop | |||
{ | |||
public static IAsyncOperation<WebTokenRequestResult> RequestTokenForWindowAsync(IntPtr hWnd, WebTokenRequest request) |
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.
These operations are async, but not in the traditional "way", but in the Windows way. You can create your own async API which can be await-ed by simply implementing an interface. The "async" suffix should be here. Please disable the rule for this file.
@@ -190,7 +190,7 @@ private async void OnAcquireSilentlyClickedAsync(object sender, EventArgs e) | |||
} | |||
} | |||
|
|||
private async void OnAcquireClickedAsync(object sender, EventArgs e) | |||
private async Task OnAcquireClickedAsync(object sender, EventArgs e) |
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.
Does the app continue to work? I was under the impression that async event handlers cannot use Task. This is the whole reason why we still have async void
allowed in the language.
@@ -61,7 +61,6 @@ public static string GetiOSAccountKey(string homeAccountId, string environment) | |||
return stringBuilder.ToString().ToLowerInvariant(); | |||
} | |||
|
|||
|
|||
public static string GetiOSServiceKey( |
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.
no changes here, same with some many other files.
requestPtr, | ||
webAccountPtr, | ||
ref guid, | ||
requestPtr, |
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.
was this edit based on a rule?
[HttpGet] | ||
#pragma warning disable UseAsyncSuffix // Use Async suffix | ||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "VSTHRD200:Use \"Async\" suffix for async methods", Justification = "<Pending>")] |
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.
few pending justifications?
This is a huge PR that touches a lot of files, so it must be closed quickly, otherwise merging will be hell. |
@@ -140,6 +140,7 @@ | |||
<Compile Include="$(PathToMsalSources)\**\*.cs" Exclude="$(PathToMsalSources)\obj\**\*.*" /> | |||
<Compile Remove="$(PathToMsalSources)\Platforms\**\*.*;$(PathToMsalSources)\Resources\*.cs" /> | |||
<Compile Remove="$(PathToMsalSources)\PlatformsCommon\PlatformNotSupported\ApiConfig\SystemWebViewOptions.cs" /> | |||
<Compile Remove="GlobalSuppressions3.cs" /> |
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.
Probably dont need this?
Getting some strange errors around .net 4.8 after merging in master. Are you aware of any changes to .net 48? |
@trwalke - yeah, I'm trying to convert all our dev apps to net48, since net47 and net461 are no longer installed by default with VS. |
088a2ba
to
ed09a75
Compare
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.
Main comment is that it could be cleaner to disable some rules in the test editorconfig, instead of adding pragma disable or suppression files. Also can maybe add editorconfigs to different folders, since they are hierarchical.
This should also be merged right after the WAM bug fix PR before any other ones.
dotnet_diagnostic.VSTHRD110.severity = none | ||
|
||
#------------------------------------------------------------------------------------------------------------------------------------------------------------# | ||
# Rules from aspnet |
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.
Add a link here to the page with rules descriptions. I think it's this one, https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/, but may be something else.
dotnet_diagnostic.CA1507.severity = warning | ||
|
||
# CA1725: Parameter names should match base declaration | ||
dotnet_diagnostic.CA1725.severity = suggestion |
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.
Should probably be a warning or error for public API. But should probably be left for a seprate PR.
|
||
# IDE0036: Order modifiers | ||
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion | ||
dotnet_diagnostic.IDE0036.severity = warning |
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.
Maybe set this to none (or at least for now), I don't think we follow the order and might create a lot of warnings.
dotnet_style_allow_multiple_blank_lines_experimental = false | ||
dotnet_diagnostic.IDE2000.severity = warning | ||
|
||
# CA1018: Mark attributes with AttributeUsageAttribute |
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.
These seem to be duplicates of ones above.
@@ -0,0 +1,8 @@ | |||
// This file is used by Code Analysis to maintain SuppressMessage |
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.
Instead of GlobalSuppressions and pragma disable in code, can these rules be disabled in tests editorconfig for all tests?
…library-for-dotnet * 'master' of github.com:AzureAD/microsoft-authentication-library-for-dotnet: (39 commits) OBO for SP with RT support (AzureAD#3266) (AzureAD#3280) Update some projects to net48 (AzureAD#3269) Bump Source Link version (tool change) (AzureAD#3275) Update changelog.txt (AzureAD#3282) Default to WebView1 instead of WebView2 when using AAD or ADFS authorities (AzureAD#3276) Revert "OBO for SP with RT support (AzureAD#3266)" OBO for SP with RT support (AzureAD#3266) Add perf tests for Acquire Token calls with serialization cache and Builders (AzureAD#3250) Minor fix to SuggestedCacheKey comment and update NuGet icon in Readme. (AzureAD#3268) MSAL changelog 4.43.0 (AzureAD#3263) Bogavril/3251 (AzureAD#3255) Fix for AzureAD#3248 - use the correct plugin to sing out (AzureAD#3253) Performance project improvements (AzureAD#3064) Reuse lists in token cache filtering logic. (AzureAD#3233) Update andorid install script to use andorid 30 (AzureAD#3243) Fix for UWP packaging (AzureAD#3239) Pass account to Auth result (AzureAD#3199) App ported to Lab4 (AzureAD#3229) Trwalke/ruleset updates (AzureAD#3189) Conditional Access for Android (AzureAD#3210) ...
Fixes #
Ruleset update
Changes proposed in this request
Enabling critical Async Threading rules
Adding ruleset from asp.net repo