Skip to content
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

False report for RS0012 (Do not call ToImmutableDictionary on an ImmutableDictionary value) #1430

Closed
mavasani opened this issue Dec 2, 2017 · 0 comments
Assignees
Labels
Area-Microsoft.CodeAnalysis.NetAnalyzers Bug The product is not behaving according to its current intended design Urgency-Soon
Milestone

Comments

@mavasani
Copy link
Contributor

mavasani commented Dec 2, 2017

Analyzer package

Microsoft.NetCore.Analyzers 2.6.0-beta1

Analyzer

DoNotCallToImmutableCollectionOnAnImmutableCollectionValueAnalyzer

Repro steps

using System.Collections.Immutable;

public class C
{
    void M(ImmutableDictionary<int, int> a)
    {
        ImmutableDictionary<char, char> b = a.ToImmutableDictionary(kv => (char)kv.Key, kv => (char)kv.Value);
    }
}

Expected behavior

No RS0012 as we are producing a dictionary of different key/value types.

Actual behavior

Severity	Code	Description	Project	File	Line	Suppression State
Warning	RS0012	Do not call ToImmutableDictionary on an ImmutableDictionary value	ClassLibrary4	C:\Users\mavasani\source\repos\ClassLibrary3\ClassLibrary4\Class1.cs	7	Active
@mavasani mavasani added Area-Microsoft.CodeAnalysis.NetAnalyzers Bug The product is not behaving according to its current intended design Urgency-Soon labels Dec 2, 2017
@mavasani mavasani added this to the 15.5.Later milestone Dec 2, 2017
@mavasani mavasani self-assigned this Dec 2, 2017
mavasani added a commit to mavasani/roslyn-analyzers that referenced this issue Dec 6, 2017
… underlying collection could be modified by the invoked API.

Fixes dotnet#1430
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Microsoft.CodeAnalysis.NetAnalyzers Bug The product is not behaving according to its current intended design Urgency-Soon
Projects
None yet
Development

No branches or pull requests

1 participant