Argument type X is not assignable to parameter type Y

I have been seeing some very strange error messages that occur in ReSharper but which aren't actually errors, as the solution compiles without error.

The errors have the form "Argument type X is not assignable to parameter type Y" where X and Y are, in fact, compatible. This happens with types that are part of the regular .NET Framework, and only in one of my solutions.

I read about a similar problem in the KB ( http://support.jetbrains.com/kb/entry.jspa?categoryID=28&externalID=142 ) but doing a clean rebuild did not work. I also tried clearing the cache through the ReSharper options form, which caused it to spend some time "Parsing files". Still, same error.

Example code that causes the problem:

"Argument type 'int[]' is not assignable to parameter type 'System.Collections.Generic.IEnumerable'": List baz = new List(); baz.AddRange( new int[] { 1, 2, 3 } ); "Cannot resolve method 'ToString(System.Globalization.CultureInfo)', ...": int foo = 123; string bar = foo.ToString( CultureInfo.InvariantCulture ); In the former case the issue appears to be that R# does not recognize that int[] implements IEnumerable]]>, in the second it appears that it does not recognize that CultureInfo implements IFormatProvider.

This is only happening in one solution (so far) but it's quite annoying. Any help would be appreciated.

11 comments
Comment actions Permalink

Unfortunately, I cannot reproduce your problem.
Please could you try to create small solution demonstrating this problem,
and send it to us for analysis

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wilhelm Svenselius" <wilhelm.s@remotex.se> wrote in message
news:24161626.1168333248172.JavaMail.itn@is.intellij.net...
>I have been seeing some very strange error messages that occur in ReSharper
>but which aren't actually errors, as the solution compiles without error.
>

The errors have the form "Argument type X is not assignable to parameter
type Y" where X and Y are, in fact, compatible. This happens with types
that are part of the regular .NET Framework, and only in one of my
solutions.

>

I read about a similar problem in the KB (
http://support.jetbrains.com/kb/entry.jspa?categoryID=28&externalID=142 )
but doing a clean rebuild did not work. I also tried clearing the cache
through the ReSharper options form, which caused it to spend some time
"Parsing files". Still, same error.

>

Example code that causes the problem:

>

"Argument type 'int[]' is not assignable to parameter type
'System.Collections.Generic.IEnumerable<int>'":

>

List<int> baz = new List<int>();
baz.AddRange( new int[] { 1, 2, 3 } );

>

"Cannot resolve method 'ToString(System.Globalization.CultureInfo)', ...":

>

int foo = 123;
string bar = foo.ToString( CultureInfo.InvariantCulture );

>

In the former case the issue appears to be that R# does not recognize that
int[] implements IEnumerable<int>, in the second it appears that it does
not recognize that CultureInfo implements IFormatProvider.

>

This is only happening in one solution (so far) but it's quite annoying.
Any help would be appreciated.



0
Comment actions Permalink

The product I am working on consists of many components, each in its own solution. The problem appears in only one solution. The problem does not appear in new solutions that I create, or in any solution other than the specific one affected. So it is not possible for me to reproduce this in an new solution, sorry.

I've noticed something interesting. The affected solution contains both regular Class Libraries and Smart Device Class Libraries. The problem only appears in the Smart Device Class Libraries. Perhaps this is an issue with R# and the .NET Compact Framework 2.0?

If I create a new Smart Device Class Library project in the affected solution, the problem appears in that project. But if I create a new Smart Device Class Library in a different solution, the problem does not appear.

I am guessing R# has saved some solution-specific data somewhere that it is refusing to clean up and which is now messing things up.

0
Comment actions Permalink

You're right - the problem is in mix of FullFramework/CompactFramework
solutions.
We've been reported this problem a few times, but still we cannot reproduce
this ÛÅ :(
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wilhelm Svenselius" <wilhelm.s@remotex.se> wrote in message
news:6111614.1168343547945.JavaMail.itn@is.intellij.net...

The product I am working on consists of many components, each in its own
solution. The problem appears in only one solution. The problem does not
appear in new solutions that I create, or in any solution other than the
specific one affected. So it is not possible for me to reproduce this in
an new solution, sorry.

>

I've noticed something interesting. The affected solution contains both
regular Class Libraries and Smart Device Class Libraries. The problem only
appears in the Smart Device Class Libraries. Perhaps this is an issue with
R# and the .NET Compact Framework 2.0?

>

If I create a new Smart Device Class Library project in the affected
solution, the problem appears in that project. But if I create a new Smart
Device Class Library in a different solution, the problem does not appear.

>

I am guessing R# has saved some solution-specific data somewhere that it
is refusing to clean up and which is now messing things up.



0
Comment actions Permalink

I have managed to create a small solution with two projects (one .NET 2.0, one .NET CF 2.0) where the problem appears!

Please see attached archive and screenshot.



Attachment(s):
Screenshot.png
ResharperBugTest.rar
0
Comment actions Permalink

Bump - any progress on this issue?

0
Comment actions Permalink

This won't be fixed in 2.5.X, and we haven't yet fixed it in 3.0 :(

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wilhelm Svenselius" <wilhelm.s@remotex.se> wrote in message
news:23331385.1170063028799.JavaMail.itn@is.intellij.net...

Bump - any progress on this issue?



0
Comment actions Permalink

Bumping this again. Recently upgraded to latest but that did not fix the problem (not that I expected it). We are also seeing a possibly related problem where some framework classes are showing up twice in autocomplete - typing "ArgumentNull" yields two choices, both called "ArgumentNullException". I expect one of them is from CF and the other is from regular .NET.

We are very much looking forward to a solution to this problem. I imagine it affects anyone who has solutions with mixed NETCF/NET, which happens every time you, for example, add unit tests to an all-CF solution.

0
Comment actions Permalink

Has this been fixed in 3.0?

0
Comment actions Permalink

Upgraded to 3.0 and I am still seeing this bug. Is it really that impossible to fix!?

0
Comment actions Permalink

This problem will be fixed only in the next major version (4.0)

--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Wilhelm Svenselius" <wilhelm.s@remotex.se> wrote in message
news:32218800.1186140698977.JavaMail.itn@is.intellij.net...

Upgraded to 3.0 and I am still seeing this bug. Is it really that
impossible to fix!?



0
Comment actions Permalink

Not particularly helpful - something this central to the correct functioning of the product should be fixable without a major update - but now it works since we upgraded to 4.0, so my problem is essentially resolved.

0

Please sign in to leave a comment.