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

Fix S3242: Rule should not throw ArgumentException #803

Closed
antrv opened this issue Oct 2, 2017 · 9 comments
Closed

Fix S3242: Rule should not throw ArgumentException #803

antrv opened this issue Oct 2, 2017 · 9 comments
Assignees
Labels
Type: Bug Exceptions and blocking issues during analysis.
Milestone

Comments

@antrv
Copy link

antrv commented Oct 2, 2017

argumentexception

No code sample for reproducing this bug yet (I cannot provide original code).

@antrv
Copy link
Author

antrv commented Oct 2, 2017

I could not catch the descriptive message again, so I attached the screenshot.

@Evangelink
Copy link
Contributor

Hi @antrv,
I was reviewing the code and just saw we build a dictionary with the name of parameters as key (which seems to match your exception). Could you confirm you have any method with multiple parameters with the same name? I will try to make some tests later on but for now we have a lot of things to deal with on SonarLint for VS.

@antrv
Copy link
Author

antrv commented Oct 2, 2017

yes, I have many methods with the same parameter names, only type parameters differ.
for example:
Method<T1, T2>(Tuple<T1, T2> tuple, Action<Tuple<T1, T2>> action)
Method<T1, T2, T3>(Tuple<T1, T2, T3> tuple, Action<Tuple<T1, T2, T3>> action)

@antrv
Copy link
Author

antrv commented Oct 2, 2017

and even (simplified)
Method<T1, T2, T3>(Tuple<Tuple< T1 >, Tuple<T2, T3>> tuple, Action<Tuple< T1 >, Tuple<T2, T3>> action)
and
Method<T1, T2, T3>(Tuple<Tuple<T1, T2>, Tuple< T3 >> tuple, Action<Tuple<T1, T2>, Tuple< T3 >> action)

@Evangelink Evangelink changed the title Rule throws ArgumentException Fix S2342: Rule throws ArgumentException when 2+ params of method have the same name Oct 13, 2017
@Evangelink Evangelink added Area: Rules Type: Bug Exceptions and blocking issues during analysis. labels Oct 13, 2017
@Evangelink
Copy link
Contributor

Hi @antrv,
Sorry to get back to you so late but the only case where I can reproduce the error is actually when I create a method that doesn't compile with 2 or more parameters with the same name. For example:

private void Foo(IList<int> a, IList<string> a)
{
    a.ToList();
}

Does it match your use case or do you think you are having a different bug?

@antrv
Copy link
Author

antrv commented Oct 16, 2017

Hi @Evangelink ,
I think I have a different bug. My code compiles.
Please keep this bug open for a week or two. I will try to provide code sample for it.
Thank you

@Evangelink
Copy link
Contributor

Will do :)

@Evangelink Evangelink self-assigned this Oct 16, 2017
@Evangelink Evangelink changed the title Fix S2342: Rule throws ArgumentException when 2+ params of method have the same name Fix S2342: Rule throws ArgumentException Oct 16, 2017
@Evangelink Evangelink changed the title Fix S2342: Rule throws ArgumentException Fix S3242: Rule throws ArgumentException Oct 16, 2017
@Evangelink Evangelink added this to the 6.6 milestone Oct 18, 2017
@Evangelink Evangelink added the Status: On Hold Postponed or waiting for an answer. label Oct 18, 2017
@Evangelink
Copy link
Contributor

Evangelink commented Oct 23, 2017

Hi @antrv,

We have received a similar bug through the SonarLint Google Group:
image

Both screenshots show an error on the ToDictionary call.

@Evangelink Evangelink removed the Status: On Hold Postponed or waiting for an answer. label Oct 23, 2017
@Evangelink
Copy link
Contributor

Fixed by PR #835

@Evangelink Evangelink changed the title Fix S3242: Rule throws ArgumentException Fix S3242: Rule should not throw ArgumentException Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Exceptions and blocking issues during analysis.
Projects
None yet
Development

No branches or pull requests

2 participants