Print Page | Close Window

Ignoring warnings treated as errors

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3552
Printed Date: 13-May-2026 at 12:56am


Topic: Ignoring warnings treated as errors
Posted By: stephenmcd1
Subject: Ignoring warnings treated as errors
Date 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.



Replies:
Posted By: stephenmcd1
Date 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


Posted By: DenisK
Date Posted: 25-Jul-2012 at 12:26pm
Hi Stephen,

You are correct. This is unfortunately a bug in that new IgnoreClientValidationErrors flag logic and breaks the Warnings verifier behavior you described above. I will open a bug report.

If you haven't yet found one, a workaround that I can only think of is to keep track of the Warnings prior to save in a separate collection, such that when the client save is done, you can add back the Warnings. But I hope you already found a better workaround. Please let me know.




Posted By: stephenmcd1
Date Posted: 25-Jul-2012 at 2:23pm
Thanks for the confirmation.  Currently, we hadn't attempted any work arounds.  Our app isn't in production just yet so this is something that we can live with for the moment.

Storing and then restoring the warnings during save seems doable.  Any idea when an official fix would make it's way in to DevForce?  If the fix will come in the next version, we might be able to just wait.  Otherwise, we can look into the temporary workaround you suggested.

Thanks!


Posted By: DenisK
Date Posted: 26-Jul-2012 at 12:02pm
The official fix will be in 6.1.9 however we currently have not scheduled it yet. 

Please let me know should this issue become troublesome for you.


Posted By: stephenmcd1
Date Posted: 26-Jul-2012 at 2:23pm
Great, thanks for the update.  I'm sure that will be fine for us.  If not, I will let you know (or maybe just go with the workaround).  Thanks!


Posted By: stephenmcd1
Date Posted: 20-Nov-2012 at 10:57am
Originally posted by DenisK

The official fix will be in 6.1.9 however we currently have not scheduled it yet.

Did the fix for this make it in to 6.1.9.0?  We just upgraded our application but are still seeing the validations go away after a save.


Posted By: DenisK
Date Posted: 21-Nov-2012 at 1:03pm
Hi Stephen,

We apologize. We missed this bug when releasing 6.1.9. I've put this on a very high priority and asked our lead developer to take a look at it as soon as possible. Please let us know if this issue is blocking you.

Thank you for your patience.


Posted By: stephenmcd1
Date Posted: 21-Nov-2012 at 1:57pm

I know you mentioned a possible workaround....we didn't go down that road because we assumed an official fix would be coming soon.  If the fix can make it into an official release soon, I think we can continue to wait a bit longer.  When do you think the fix would be available?

Thanks.



Posted By: DenisK
Date Posted: 27-Nov-2012 at 8:45am
The fix is now available but I still don't have a date yet for the next official release. Let me find out and get back to you as soon as possible.


Posted By: DenisK
Date Posted: 27-Nov-2012 at 11:55am
Hi Stephen,

We're planning to schedule our next release sometime in mid January. Please let me know if this doesn't work for you.


Posted By: stephenmcd1
Date Posted: 27-Nov-2012 at 1:58pm
That is a long time to wait.  We are coming up on a big code freeze for our application towards the end of December so mid January would be too late for us to be taking a new version of DevForce.  Would there be any way to maybe get a minor new release sooner than then?  Something like a 6.1.9.1? 


Posted By: DenisK
Date Posted: 28-Nov-2012 at 12:14pm
Hi Stephen,

We have decided to release 6.1.10 sooner. 

Just to clarify, the fix is to keep all client validation errors before and after save instead of clearing them. With this fix, you'll be able to keep your warnings after the save comes back from the server. The only difference with the old behavior is that, under the covers, we used to ship the client errors as well to the server, but now, we don't.

Please let me know if any of these is unclear for you.


Posted By: stephenmcd1
Date Posted: 28-Nov-2012 at 1:15pm

That is great news.  The behavior you describe sounds exactly like what we are looking for.

Any estimates on just how much "sooner" the 6.1.10 release would be?  

Thanks!



Posted By: DenisK
Date Posted: 30-Nov-2012 at 11:51am
We expect to have the 6.1.10 patch release sometime next week.


Posted By: stephenmcd1
Date Posted: 30-Nov-2012 at 1:30pm

 Thanks so much. That will help us out.  

And I'll just have to hope that some of the other issues we are seeing (like http://www.ideablade.com/forum/forum_posts.asp?TID=3487&PID=15295&title=table-splitting#15295 - this one or http://www.ideablade.com/forum/forum_posts.asp?TID=3813&PID=15293&title=breaking-change-to-server-save-lifecycle#15293 - this one) will also make it into that release.



Posted By: stephenmcd1
Date Posted: 28-Dec-2012 at 3:08pm
Just wanted to finish out this thread by mentioning that all the issues we were seeing with warnings going away have been fixed in 6.1.11.  Thanks!


Posted By: kimj
Date Posted: 28-Dec-2012 at 3:43pm
Great!  Thanks for the update.



Print Page | Close Window