Search code examples
c#code-generationsystem.componentmodel

'MatchTimeoutInMilliseconds' error in c# generated file


Issue


This error has only just started appearing in my project and I am unsure on why. I have a 'Silverlight 5' Project file which generates a file. This file contains MatchTimeoutInMilliseconds call which seems to keep erroring:

 'System.ComponentModel.DataAnnotations.RegularExpressionAttribute' does not contain a definition for 'MatchTimeoutInMilliseconds'

I do not have a clue of how i can resolve this issue as it is nothing to do with the code that i have written.

Code


/// <summary>
/// Gets or sets the 'uEmail' value.
/// </summary>
[DataMember()]
[DataType(DataType.EmailAddress)]
[Display(Name="Email address")]
[RegularExpression("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\." +
        ")+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$", ErrorMessage="Please enter a valid e-mail adress", MatchTimeoutInMilliseconds=-1)]
[Required()]
[StringLength(256)]
public string uEmail
{

}

Above is the code that contains the error.

Does anyone know how i can fix this issue?


Solution

  • If you look at MatchTimeoutInMilliseconds property of RegularExpressionAttribute, Version information section, you will see:

    Universal Windows Platform
    Available since 10

    .NET Framework
    Available since 4.6.1

    And you use Silverlight 5 as you said, so it's not supported there. You can fix that but fixing the template you use to not generate this property.