New Posts New Posts RSS Feed: Ignoring warnings treated as errors
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Ignoring warnings treated as errors

 Post Reply Post Reply Page  <12
Author
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post Topic: Ignoring warnings treated as errors
    Posted: 24-Jul-2012 at 5:08pm
A quick update.  A fellow developer mentioned that this is relatively recent change.  We used to still see warning messages after save.  I looked at some old versions and it looks like the SaveOptions.IgnoreClientValidationErrors property didn't exist in 6.1.6.0?  So this is a relatively new change on DevForce's side.

I saw changes regarding validation in the 6.1.7.1 release notes but I didn't see anything that would lead to this breaking change for us.  Maybe it's just a bug in the new IgnoreClientValidationErrors logic?  (at least...that is what I'm hoping :-)).

Thanks
Back to Top
stephenmcd1 View Drop Down
DevForce MVP
DevForce MVP


Joined: 27-Oct-2009
Location: Los Angeles, CA
Posts: 166
Post Options Post Options   Quote stephenmcd1 Quote  Post ReplyReply Direct Link To This Post Posted: 24-Jul-2012 at 4:45pm
In our application, we have a number of validations that are warnings.  In our minds, we think of warning as "something to tell the user about but not something that should stop them from saving."  I think that roughly follows the idea of a warning verifier result but we've noticed a problem.  As the user is enter data, the warnings correctly show up.  But then when they go to save, the warnings go away.  Perhaps it's a configuration on our end but I'm not entirely sure.

We use the TreatWarningsAsErrors option on all our verifiers.  We do this because:
  1. We want the warnings to show up in the UI (get fired via INotifyDataErrorInfo)
  2. We want the entities to keep track of warnings in their EntityAspect.ValidationErrors collection
When saving, we use the default SaveOptions.IgnoreClientValidationErrors of true.  We don't want the warnings to stop the save.  We do, however, have logic that checks to make sure there aren't any true errors on any of the entities....if so, we stop the save process before it even reaches the point of calling EntityManager.SaveChangesAsync.

I noticed that when IgnoreClientValidationsErrors is set to true, it will clear out all the validation "errors" (including warnings) for all the entities.  That seems to be the part that is messing us up.  When the entities go into the SaveChangesAsync, they have lots of important warnings.  But after the save, the warnings got cleared.

Also, some of our warnings are complicated/expensive....so we can't just re-validate everything after the save to get the warnings added back in.  Or at least.....we really, really don't want to have to do that.  I suppose it might be possible if that is the only way.

Is there something that we are missing here?  It seems like our combination of TreatWarningsAsErrors = true and IgnoreClientValidationErrors = true are somewhat working against each other.
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down