Cannot convert source type...
I'm getting the following warning/error from ReSharper:
Cannot convert source type 'int \[mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\]' to target type 'int \[VerticalSearch.Controls, Version=1.0.0.0, Culture=neutral\]'
The offending statement: pPager.CurrentIndex = Convert.ToInt32(m_SearchInfo.PageNumber);
where pPager.CurrentIndex is declared as an int. pPager is in an external assembly and I suspect that this has something to do with the warning. The thing is that ReSharper is underlining things in red all over the place.
Finally, the statement executes properly, so it's appears to be a false alarm... (or am I missing something?)
I'm new to ReSharper (saw a coworker using it and thought I'd take it for a spin) and I'm rapidly growing very fond of it. So, how do I make this problem go away?
Thanks!
Please sign in to leave a comment.
Which version of ReSharper do you use?
Does you solution contains mixed full/compact framework projects?
--
Eugene Pasynkov
Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Bill Parrott" <no_reply@jetbrains.com> wrote in message
news:29220626.154561216948575065.JavaMail.jive@app4.labs.intellij.net...
>
>
>
>
>
>
Am running into a similar problem here, Resharper C# 4.1.933.3.
After converting some properties to auto-properties, Resharper seems to be quite lost about them and reports errors: "Cannot convert source type 'typeX' to target type '???'. Its especially funny in the copy ctor, where it knows the local property but not the property of the object passed as parameter.
Example code:
[Serializable]
[System.Xml.Serialization.XmlType(AnonymousType = true)]
public class Settings : MarshalByRefObject
{
public Settings()
{
this.Server = "10.0.0.1";
this.Port = 110;
}
public Settings(Settings r)
{
this.Port = r.Port;
this.Server = r.Server;
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string Server { get; set; }
[System.Xml.Serialization.XmlElement(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public int Port { get; set; }
}
Code compiles and runs just fine. Resharper also started reporting that some fields are never used although they are clearly used in properties.
Deleting the _Resharper.* folder under the solution folder and restarting the IDE resolved the problem (R# had to reparse everything).