Weird error highlighting

I'm getting what is obviously an erronious error highlight... it compiles
fine, but it's underlined with a wavy red line, and the message is:

" Argument type 'my.name.space.foo' is not assignable to parameter type
'my.name.space.foo' "

The parameter being passed is a property of the (obviously) correct type,
which has only a getter.

Any ideas?

This is in build 93



6 comments
Comment actions Permalink

Paul,

it looks like the problem is in the referenced assemblies and dependencies
among
them. Could you please describe where type 'my.name.space.foo' is defined,
where the red code is
located and what references exist between these two projects.

"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccn4su$n3v$1@is.intellij.net...

I'm getting what is obviously an erronious error highlight... it compiles
fine, but it's underlined with a wavy red line, and the message is:

>

" Argument type 'my.name.space.foo' is not assignable to parameter type
'my.name.space.foo' "

>

The parameter being passed is a property of the (obviously) correct type,
which has only a getter.

>

Any ideas?

>

This is in build 93

>
>



0
Comment actions Permalink

I've found it in another project. I don't see anything unusual with the
references (standard assembly references). Could you give me some clue of
what you think might be the problem? It seems overwhelmingly to be a single
class that is producing this problem, when it is returned as the result of a
method call passed to a parameter, and when it is the result of a property
getter.

It's happening in more than one file.

The type is defined in an assembly dll, which is simply referenced in the
project where the erronious error highlighting is occuring.


"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccoibr$pb1$1@is.intellij.net...

Paul,

>

it looks like the problem is in the referenced assemblies and dependencies
among
them. Could you please describe where type 'my.name.space.foo' is defined,
where the red code is
located and what references exist between these two projects.

>

"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccn4su$n3v$1@is.intellij.net...

I'm getting what is obviously an erronious error highlight... it

compiles

fine, but it's underlined with a wavy red line, and the message is:

>

" Argument type 'my.name.space.foo' is not assignable to parameter type
'my.name.space.foo' "

>

The parameter being passed is a property of the (obviously) correct

type,

which has only a getter.

>

Any ideas?

>

This is in build 93

>
>
>

>
>


0
Comment actions Permalink

Sorry, but I'm still seeing this (build 93, not the lates). And it's making
even less sense now.

The class 'my.name.space.foo' is defined in one project, X.

I have another project, T, that is using it directly. It's using it just
fine. No problems.

In this same project T, I use a class A from project X that takes it as a
parameter, again no problems.

In this same project T, I use a class B from another project, Y, that take
it as a parameter. I get the error.

It should be noted that both class A and B have the same base class, which
is also defined in project X.

So I have two lines of code right next to each other that look essentially
like this:

foo myfoo = new foo();
A a = new A(myFoo);
B b = new B(myFoo);

The first line where an instance of A is declared, is fine. The second
line, where an instance of B is declared, has "myFoo" highlighted, with the
message "Argument type 'my.name.space.foo' is not assignable to parameter
type
'my.name.space.foo' "

This makes no sense to me. I even included both projects X and Y into my
solution (so all three projects, X, Y, and T are there), and all are using
project references.

Any ideas here? It's quite annoying to have code that compiles cleanly and
works perfectly highlighted with an obviously erronious error like that.




A few lines down, I use
"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccoibr$pb1$1@is.intellij.net...

Paul,

>

it looks like the problem is in the referenced assemblies and dependencies
among
them. Could you please describe where type 'my.name.space.foo' is defined,
where the red code is
located and what references exist between these two projects.

>

"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccn4su$n3v$1@is.intellij.net...

I'm getting what is obviously an erronious error highlight... it

compiles

fine, but it's underlined with a wavy red line, and the message is:

>

" Argument type 'my.name.space.foo' is not assignable to parameter type
'my.name.space.foo' "

>

The parameter being passed is a property of the (obviously) correct

type,

which has only a getter.

>

Any ideas?

>

This is in build 93

>
>
>

>
>


0
Comment actions Permalink

Further data.

Project Y has an assembly reference for project X. This seems to be the
problem. But it really shouldn't be a problem, should it? Can't ReSharper
notice that the name space name and class names match perfectly, and supress
the error notification?


-


Re:
>Sorry, but I'm still seeing this (build 93, not the lates). And it's
making
>even less sense now.
>
>The class 'my.name.space.foo' is defined in one project, X.
>
>I have another project, T, that is using it directly. It's using it just
>fine. No problems.
>
>In this same project T, I use a class A from project X that takes it as a
>parameter, again no problems.
>
>In this same project T, I use a class B from another project, Y, that take
>it as a parameter. I get the error.
>
>It should be noted that both class A and B have the same base class, which
>is also defined in project X.
>
>So I have two lines of code right next to each other that look essentially
>like this:
>
>foo myfoo = new foo();
>A a = new A(myFoo);
>B b = new B(myFoo);
>
>The first line where an instance of A is declared, is fine. The second
>line, where an instance of B is declared, has "myFoo" highlighted, with the
>message "Argument type 'my.name.space.foo' is not assignable to parameter
>type
>'my.name.space.foo' "
>
>This makes no sense to me. I even included both projects X and Y into my
>solution (so all three projects, X, Y, and T are there), and all are using
>project references.
>
>Any ideas here? It's quite annoying to have code that compiles cleanly and
>works perfectly highlighted with an obviously erronious error like that.

"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccoibr$pb1$1@is.intellij.net...

Paul,

>

it looks like the problem is in the referenced assemblies and dependencies
among
them. Could you please describe where type 'my.name.space.foo' is defined,
where the red code is
located and what references exist between these two projects.

>

"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccn4su$n3v$1@is.intellij.net...

I'm getting what is obviously an erronious error highlight... it

compiles

fine, but it's underlined with a wavy red line, and the message is:

>

" Argument type 'my.name.space.foo' is not assignable to parameter type
'my.name.space.foo' "

>

The parameter being passed is a property of the (obviously) correct

type,

which has only a getter.

>

Any ideas?

>

This is in build 93

>
>
>

>
>


0
Comment actions Permalink

Paul,

I believe that it is indeed an assembly reference in Y to X that causes the
problem.
If you replace it with the project reference, the error message should
disappear.
Of course, ReSharper can notice that both 'myFoo'
classes in the project X and in the assembly referenced from Y (that is an
output of the project X) have the same qualified name. However, this fact is
not enough to treat these classes indistinguishable:
you can easily declare two classes with the same qualified name (say
Library.Class) in absolutely different assemblies.
If you add references to both assemblies to a C# project, you'll most likely
be unable to specify which
of two Library.Class classes do you mean, and the C# compiler will decide
this on its own.

I realize, however, that your situation is somewhat different - you
reference a project and an assembly that (you know it) is an output of the
project. Currently ReSharper does not attempt to guess that an assembly is
an output of a project, and hence the types from the assembly and from the
project should be considered identical. Perhaps we have to think about
adding such an option in future, though the possibility that the assembly
might get copied to another directory (that is different from the project's
output directory) complicates the matter. May be I've missed it from your
previous posts, but what makes you to reference the assembly, not the
original project?

Thanks,
Dmitry


"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cd1pc2$o0t$1@is.intellij.net...

Further data.

>

Project Y has an assembly reference for project X. This seems to be the
problem. But it really shouldn't be a problem, should it? Can't
ReSharper
notice that the name space name and class names match perfectly, and
supress
the error notification?

>
>

-------------------
Re:

>>Sorry, but I'm still seeing this (build 93, not the lates). And it's

making

>>even less sense now.
>>
>>The class 'my.name.space.foo' is defined in one project, X.
>>
>>I have another project, T, that is using it directly. It's using it just
>>fine. No problems.
>>
>>In this same project T, I use a class A from project X that takes it as a
>>parameter, again no problems.
>>
>>In this same project T, I use a class B from another project, Y, that take
>>it as a parameter. I get the error.
>>
>>It should be noted that both class A and B have the same base class, which
>>is also defined in project X.
>>
>>So I have two lines of code right next to each other that look essentially
>>like this:
>>
>>foo myfoo = new foo();
>>A a = new A(myFoo);
>>B b = new B(myFoo);
>>
>>The first line where an instance of A is declared, is fine. The second
>>line, where an instance of B is declared, has "myFoo" highlighted, with
>>the
>>message "Argument type 'my.name.space.foo' is not assignable to parameter
>>type
>>'my.name.space.foo' "
>>
>>This makes no sense to me. I even included both projects X and Y into my
>>solution (so all three projects, X, Y, and T are there), and all are using
>>project references.
>>
>>Any ideas here? It's quite annoying to have code that compiles cleanly
>>and
>>works perfectly highlighted with an obviously erronious error like that.
>

"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccoibr$pb1$1@is.intellij.net...

>> Paul,
>>
>> it looks like the problem is in the referenced assemblies and
>> dependencies
>> among
>> them. Could you please describe where type 'my.name.space.foo' is
>> defined,
>> where the red code is
>> located and what references exist between these two projects.
>>
>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>> news:ccn4su$n3v$1@is.intellij.net...
>> > I'm getting what is obviously an erronious error highlight... it

compiles

>> > fine, but it's underlined with a wavy red line, and the message is:
>> >
>> > " Argument type 'my.name.space.foo' is not assignable to parameter type
>> > 'my.name.space.foo' "
>> >
>> > The parameter being passed is a property of the (obviously) correct

type,

>> > which has only a getter.
>> >
>> > Any ideas?
>> >
>> > This is in build 93
>> >
>> >
>> >
>>
>>
>



0
Comment actions Permalink

The problem is the project is not mine to muck with. I'm adding the project
to my solution just so I can browse source, but this project is someone
else's and THEY reference the assembly.

We generally use assembly references only, for a great many reasons.
There's a lot of "generated" assemblies, there are LOTS of projects and
assemblies, and VS gets unable and starts corrupting things when you get too
many. But regardless of the reasons, the fact is, I cannot change this. So
the fact that I reference a project (for my own debugging and source
browsing and Resharper requirements) and a dependent project references the
assembly, is a fact of life. It's not going to change. And I really think
Resharper should be able to deal with this. Even if the same exact class is
referenced from two different assemblies, I don't think Resharper should be
trying to display an error... especially since the C# compiler won't
complain.

"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:cd2pm1$ve4$1@is.intellij.net...

Paul,

>

I believe that it is indeed an assembly reference in Y to X that causes

the

problem.
If you replace it with the project reference, the error message should
disappear.
Of course, ReSharper can notice that both 'myFoo'
classes in the project X and in the assembly referenced from Y (that is an
output of the project X) have the same qualified name. However, this fact

is

not enough to treat these classes indistinguishable:
you can easily declare two classes with the same qualified name (say
Library.Class) in absolutely different assemblies.
If you add references to both assemblies to a C# project, you'll most

likely

be unable to specify which
of two Library.Class classes do you mean, and the C# compiler will decide
this on its own.

>

I realize, however, that your situation is somewhat different - you
reference a project and an assembly that (you know it) is an output of the
project. Currently ReSharper does not attempt to guess that an assembly is
an output of a project, and hence the types from the assembly and from the
project should be considered identical. Perhaps we have to think about
adding such an option in future, though the possibility that the assembly
might get copied to another directory (that is different from the

project's

output directory) complicates the matter. May be I've missed it from your
previous posts, but what makes you to reference the assembly, not the
original project?

>

Thanks,
Dmitry

>
>

"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cd1pc2$o0t$1@is.intellij.net...

Further data.

>

Project Y has an assembly reference for project X. This seems to be the
problem. But it really shouldn't be a problem, should it? Can't
ReSharper
notice that the name space name and class names match perfectly, and
supress
the error notification?

>
>

-------------------
Re:

>>Sorry, but I'm still seeing this (build 93, not the lates). And it's

making

>>even less sense now.
>>
>>The class 'my.name.space.foo' is defined in one project, X.
>>
>>I have another project, T, that is using it directly. It's using it

just

>>fine. No problems.
>>
>>In this same project T, I use a class A from project X that takes it as

a

>>parameter, again no problems.
>>
>>In this same project T, I use a class B from another project, Y, that

take

>>it as a parameter. I get the error.
>>
>>It should be noted that both class A and B have the same base class,

which

>>is also defined in project X.
>>
>>So I have two lines of code right next to each other that look

essentially

>>like this:
>>
>>foo myfoo = new foo();
>>A a = new A(myFoo);
>>B b = new B(myFoo);
>>
>>The first line where an instance of A is declared, is fine. The second
>>line, where an instance of B is declared, has "myFoo" highlighted, with
>>the
>>message "Argument type 'my.name.space.foo' is not assignable to

parameter

>>type
>>'my.name.space.foo' "
>>
>>This makes no sense to me. I even included both projects X and Y into

my

>>solution (so all three projects, X, Y, and T are there), and all are

using

>>project references.
>>
>>Any ideas here? It's quite annoying to have code that compiles cleanly
>>and
>>works perfectly highlighted with an obviously erronious error like that.
>

"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccoibr$pb1$1@is.intellij.net...

>> Paul,
>>
>> it looks like the problem is in the referenced assemblies and
>> dependencies
>> among
>> them. Could you please describe where type 'my.name.space.foo' is
>> defined,
>> where the red code is
>> located and what references exist between these two projects.
>>
>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>> news:ccn4su$n3v$1@is.intellij.net...
>> > I'm getting what is obviously an erronious error highlight... it

compiles

>> > fine, but it's underlined with a wavy red line, and the message is:
>> >
>> > " Argument type 'my.name.space.foo' is not assignable to parameter

type

>> > 'my.name.space.foo' "
>> >
>> > The parameter being passed is a property of the (obviously) correct

type,

>> > which has only a getter.
>> >
>> > Any ideas?
>> >
>> > This is in build 93
>> >
>> >
>> >
>>
>>
>
>

>
>


0

Please sign in to leave a comment.