Monday, January 25, 2016

.NET 4.5 Bug: Either ErrorMessageString or ErrorMessageResourceName must be set, but not both

When running an ASP.NET application on top of .NET 4.5, we encountered the following error:

Either ErrorMessageString or ErrorMessageResourceName must be set, but not both

image

The strange this was that we only noticed the issue on our test environment. On our local machine the application worked fine.

Luckily an explanation was found on the following blog: http://gunnarpeipman.com/2015/02/either-errormessagestring-or-errormessageresourcename-must-be-set-but-not-both/

It seems that this is a bug in .NET 4.5, as we had .NET 4.6 running on our local machine, it explained that we couldn’t reproduce the issue on our local dev machines.

As a workaround, you can follow the suggestion as mentioned in the post. Add an ‘ErrorMessage=null’ property to your Data Annotation:

1 comment:

Smith Cole said...

Hi, Thanks for sharing new updated information with us. When running an ASP.NET application on top of.NET 4.5, Either Error Message String or Error Message Resource Name must be set, but not both. I have a little bit idea about.net when I hosted my website through Myasp.net. keep blogging like this.