例如,我得到了错误:
CA1056 URI properties should not be strings Change the type of property 'CoreCallbackServiceConfiguration.UriTemplate' from string to System.Uri.
为适当
[SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "The template should be string")]
[DataMember(Name = "uriTemplate")]
public string UriTemplate { get; set; }
您会看到有属性限制,但我仍然出错。我团队中的其他人没有收到此错误。有什么想法吗?
以下为我工作:
[SuppressMessage("Design", "CA1056:Uri properties should not be strings", Justification = "This is a DB table field")]
请记住,我在.NET Core 3中使用了它。我不确定分析器是否与其他.NET版本相同。