Symbol not found warning for property param name

In this property, Resharper 4.0 beta doesn't like the fact that "Margin" isn't a parameter argument and flags it as a warning:"Cannot resolve symbol 'Margin'

public int Margin
{
get { return margin; }
set
{
if (value ]]> a synonym for "value" for these type of tests? Or as an option?

Cheers
Simon

5 comments
Comment actions Permalink

Well it should be "value", Microsoft does it this way, and the parameter is called value :)

0
Comment actions Permalink

I agree with Simon on this one. Although "value" is the internal name, I think it is much more helpful to allow the name of the property to be substituted for "value" in the Argumenr* exceptions if they are created by a property setter.

0
Comment actions Permalink

Hello,

I agree with Simon on this one. Although "value" is the internal name,
I think it is much more helpful to allow the name of the property to
be substituted for "value" in the Argumenr* exceptions if they are
created by a property setter.


There's only one parameter in such a property setter, so the name does not
actually make any much difference — it's anyway the one and only property
value parameter.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0
Comment actions Permalink

Think of an error report though, that "the error message said 'Must be greater than or equal to 0: value'" vs " the error message said 'Must be greater than or equal to 0: Margin". Clearly allowing, even encouraging, use of the name of the property gives a more descriptive message then requiring the use of 'value'.

PS: For Indexer setters, the rules might be a little different.

0
Comment actions Permalink

Hello,

Think of an error report though, that "the error message said 'Must be
greater than or equal to 0: value'" vs " the error message said 'Must
be greater than or equal to 0: Margin". Clearly allowing, even
encouraging, use of the name of the property gives a more descriptive
message then requiring the use of 'value'.


You have omitted the part of the error message that includes the property
name, like: "Could not set the property Margin. Must be greater than or equal
to 0. Parameter name: value".

If that's some user-friendly code, then it's probably setting the property
via reflection, like the WinForms Designer does, so it has the property name
to include when reporting in a message box.

If that's a catch-and-submit-to-developer case, then the stack traces will
be included, and the property name will get into the stack traces as the
topmost frame.

If we do not have the property name included in the error message, nor are
the stack traces available, then we'll be in trouble if an argument fails
on a property-with-parameters, or just a method. We simply won't know where
it failed. The above property-setter case is but a narrow case when the argument
name is also the member name and there are no other arguments.

This means that the member name must be known by means other than the exception
message string. Thus, it's unimportant if the argument is reported as "value"
or "margin", but the former complies to the formal rules, at least.


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

Please sign in to leave a comment.