public static Guid?GetGuidMetadata(this AttributeArgumentSyntax syntax, SemanticModel semanticModel) { Guid guid; if (Guid.TryParse(syntax.GetGuidMetadataValue(), out guid)) { return(guid); } if (Guid.TryParse(syntax.GetGuidMetadataConstantValue(semanticModel), out guid)) { return(guid); } return(null); }