profile
viewpoint
Gen Lu genlu Microsoft Redmond, WA

genlu/analysis-net 0

Static analysis framework for .NET programs.

genlu/arcade 0

Tools that provide common build infrastructure for multiple .NET Foundation projects.

genlu/binskim 0

A binary static analysis tool that provides security and correctness results for Windows portable executables.

genlu/cli 0

This repo contains the .NET Core command-line (CLI) tools, used for building .NET Core apps and libraries through your development flow (compiling, NuGet package management, running, testing, ...).

genlu/codeformatter 0

Tool that uses Roslyn to automatically rewrite the source to follow our coding styles

genlu/coreclr.xunit 0

xUnit.net runner for CoreCLR unit test projects

genlu/docs 0

This repository contains .NET Documentation.

genlu/dotnet-api-docs 0

.NET API reference documentation (.NET Framework, .NET Core, .NET Standard and Xamarin)

issue commentdotnet/roslyn-analyzers

Check Web APIs returning ActionResult with status code 2xx

It would go here btw https://github.com/dotnet/aspnetcore/tree/master/src/Analyzers/Analyzers/src

sshanzel

comment created time in an hour

issue commentdotnet/roslyn-analyzers

Helper tool for nullable annotations

Why then did .Net team create this dotnet/runtime#2339 and now also dotnet/runtime#41720?

Probably the runtime team did the annotation based on what types/assemblies they think are used a lot by developers. Types that aren't frequently used or legacy were given a much lower priority to annotate. But that's just a guess of what may have happened.

(Note that the runtime provide public APIs that're used by other developers, so annotating makes a different to consumers, so priority based on API popularity sounds very reasonable. This might not be the same for PowerShell if it doesn't provide public APIs to be used by other developers).

iSazonov

comment created time in an hour

Pull request review commentdotnet/roslyn-analyzers

CA2119: Fix false negative with extended interface

 End Class ");         } +        [Fact, WorkItem(4406, "https://github.com/dotnet/roslyn-analyzers/issues/4406")]+        public async Task CA2119_ExtendedInterface()+        {+            await VerifyCS.VerifyAnalyzerAsync(@"+namespace FxCopRule

nit: No need for the namespace declaration.

Evangelink

comment created time in 2 hours

Pull request review commentdotnet/roslyn-analyzers

CA2119: Fix false negative with extended interface

  using System.Threading.Tasks; using Microsoft.CodeAnalysis.Testing;+using Test.Utilities;

Is anything used from this namespace?

Evangelink

comment created time in 2 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/release/5.0.1xx-to-release/5.0.2xx

delete time in 2 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/2.9.x-to-master

delete time in 2 hours

create barnchdotnet/roslyn-analyzers

branch : merges/2.9.x-to-master

created branch time in 2 hours

issue commentdotnet/roslyn-analyzers

Event handler unhook properly

I don't understand what this rule is supposed to detect. The premisse that hooking an event without unhooking it results in a memory leak is simply not correct.

Take the example of a Winforms application, with a Form with a Button on it. The From has a reference to the Button (through its Controls property), and the Button has a reference to the Form (in its Parent property). Often, the Button's click event is handled by an instance method from the Form. What is the problem? There is no memory leak. When there are no references any more to the Form or the Button (other then their references to eachother and from the delegate), everything will be garbage collected.

curia-damiano

comment created time in 5 hours

issue commentdotnet/roslyn-analyzers

Helper tool for nullable annotations

You could map out the types based on dependencies, or you could just work in a random order. Both approaches seem to take the same amount of time and yield the same final result.

Why then did .Net team create this https://github.com/dotnet/runtime/issues/2339 and now also https://github.com/dotnet/runtime/issues/41720? Why can't other projects do the same? I wouldn't be surprised if Stephan did it from his memory, but most likely he used some document or tool. And mainly to attract help from the community.

In any case, as PowerShell maintainer, I would rather offer contributors a plan than say - grab any piece of code and annotate it. Most likely none of them will do anything at all without this, but if they see that it is possible to pick up a part of the code that is interesting and understandable to them, then they will process it.

iSazonov

comment created time in 5 hours

issue closeddotnet/roslyn-analyzers

CA1506 does not respect TreatWarningsAsErrors/WarningsAsErrors

Analyzer package

Microsoft.CodeAnalysis.FxCopAnalyzers

Package Version

3.3.0-beta1.final

Diagnostic ID

Example: CA1506

Repro steps

  1. Create a small console app
  2. Add the following to the csproj:
<!-- Treat warnings as errors when not run in VS -->
  <PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <WarningsAsErrors />
  </PropertyGroup>
  1. Add a method with too much complexity
  2. Compile in command line
  3. Only warnings
  4. Add a private void A() {} method (ensure CA1822 is enabled)
  5. Compile again, CA1822 is an error and CA1506 is a warning.

Expected behavior

CA1506 is an error.

Actual behavior

CA1506 is a warning.

closed time in 5 hours

Evangelink

issue commentdotnet/roslyn-analyzers

CA1506 does not respect TreatWarningsAsErrors/WarningsAsErrors

From Sam's comment I would say this is only linked to the version of VS, not .net 5.

I will close the ticket as it seems we both no longer see the issue.

Evangelink

comment created time in 5 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/release/5.0.1xx-to-release/5.0.2xx

delete time in 5 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/2.9.x-to-master

delete time in 5 hours

create barnchdotnet/roslyn-analyzers

branch : merges/2.9.x-to-master

created branch time in 5 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/release/5.0.1xx-to-release/5.0.2xx

delete time in 8 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/2.9.x-to-master

delete time in 8 hours

create barnchdotnet/roslyn-analyzers

branch : merges/2.9.x-to-master

created branch time in 8 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/release/5.0.1xx-to-release/5.0.2xx

delete time in 11 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/2.9.x-to-master

delete time in 11 hours

create barnchdotnet/roslyn-analyzers

branch : merges/2.9.x-to-master

created branch time in 11 hours

issue commentdotnet/roslyn-analyzers

CA1506 does not respect TreatWarningsAsErrors/WarningsAsErrors

@Evangelink The problem seems to have gone away. I've since updated my projects to .NET 5 and Visual Studio to 16.8 - that's probably the reason why everything now works as expected.

Evangelink

comment created time in 12 hours

issue commentdotnet/roslyn-analyzers

Helper tool for nullable annotations

PowerShell Engine (System,Managemet,Automation,csproj) has 734 files and 2422 declared types.

This is much smaller than dotnet/roslyn. My experience there suggests the order of annotations doesn't really matter. You could map out the types based on dependencies, or you could just work in a random order. Both approaches seem to take the same amount of time and yield the same final result.

iSazonov

comment created time in 12 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/release/5.0.1xx-to-release/5.0.2xx

delete time in 14 hours

create barnchdotnet/roslyn-analyzers

branch : merges/2.9.x-to-master

created branch time in 14 hours

delete branch dotnet/roslyn-analyzers

delete branch : merges/2.9.x-to-master

delete time in 14 hours

more