strange validation problemstrange validation problem
Old forum URL: forums.lhotka.net/forums/t/4704.aspx
pillesoft posted on Thursday, April 17, 2008
Dear All,
i have a strange behavior in one of my winforms.
the textbox is bound to a BO property.
there are two validation rules for this property:
StringRequired, and MaxLengthRuleArgs
these are working well, but sometimes the errorprovider displays the following message:
"Index 0 does not have a value."
in this case i cannot loose focus from the textbox, the only chance to close the complete application.
where this message comes? how to get of rid?
using csla 3.0.3
thank you
Ivan
Marjon1 replied on Thursday, April 17, 2008
Ivan,
In your setter methods are you using the CanWriteProperty() instead of CanWriteProperty("PropertyName")?
This is a known issue with the CanWriteProperty() function and the reason is has been made obsolete. It's something to do with the way the stack trace works.
This behaviour wouldn't happen in a debug build, but would in a release build.
That was the behavior that I experienced anyway. Hopefully this helps.
Marjon
pillesoft replied on Thursday, April 17, 2008
thank you Marjon,
hm, i thought it is related to the Validation.
of course i google for this, but found only DataGridView related messages.
actualy i use CanWriteProperty(true) in everywhere of my BO properties. shall i change it to CanWriteProperty(PROPERTY)?
i updated to 3.0.4.
tried to catch in the debug without success.
the problem is that this message doesn't come always. i don't have a concrete scenario.
Ivan
JoeFallon1 replied on Thursday, April 17, 2008
Yes - definitely change the property to use the string name (plus any other parameters you may require.) Avoid the deprecated version which uses the stack trace - it is unreliable in some scenarios.
Joe
pillesoft replied on Monday, April 21, 2008
Dear All,
thank you i'll change them.
however, how i know which class, method is deprecated? cause the ProjectTracker in 3.0.4 is still uses CanWriteProperty(true) call.
Ivan
sergeyb replied on Monday, April 21, 2008
They were deprecated in 3.5
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: pillesoft
[mailto:cslanet@lhotka.net]
Sent: Monday, April 21, 2008 8:07 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] strange validation problem
Dear All,
thank you i'll change them.
however, how i know which class, method is deprecated? cause the ProjectTracker
in 3.0.4 is still uses CanWriteProperty(this) call.
Ivan
pillesoft replied on Monday, April 21, 2008
one more question:
shall i change the CanReadProperty(true) methods to CanReadProperty(PROPERTY) methods?
sergeyb replied on Monday, April 21, 2008
You should. Both CanRead and CanWrite without property name
were deprecated in 3.5. Just a small note, replacement for CanReadProperty(true)
is CanReadProperty(PropertyName, true). Second parameter is indicate the
framework should throw an exception if authorization check fails. Same applies
to CanWrite
Sergey Barskiy
Senior Consultant
office: 678.405.0687 |
mobile: 404.388.1899
Microsoft Worldwide Partner of the Year | Custom
Development Solutions, Technical Innovation
From: pillesoft
[mailto:cslanet@lhotka.net]
Sent: Monday, April 21, 2008 8:09 AM
To: Sergey Barskiy
Subject: Re: [CSLA .NET] strange validation problem
one more question:
shall i change the CanReadProperty(true) methods to CanReadProperty(PROPERTY)
methods?
pillesoft replied on Monday, April 21, 2008
thank you
i'll replace everywhere
Ivan
Copyright (c) Marimer LLC