Closed sanjayprabhu closed 13 years ago
DateTime? seems more appropriate here. My local fix is
In Issue.cs set { ClosedAt = value.ToNullableDateTime(); } } public DateTime? ClosedAt { get; set; }
and the extension method:
internal static class ConversionExtensions
{
public static DateTime? ToNullableDateTime(this string maybeDateTime)
{
if (string.IsNullOrEmpty(maybeDateTime))
return null;
return Convert.ToDateTime(maybeDateTime);
}
}
Fixed, thanks for the contribution..
See https://github.com/erikzaadi/GithubSharp/commit/a9866cc86ce4fd70d00f6cb6bd6a7ec69e287e3c for details..
Erik
Exception when no value for closed_at in the JSON response. I'm assuming this happens for all open issues.
Stack trace: System.ArgumentNullException: String reference not set to an instance of a String. Parameter name: s at System.DateTime.Parse(String s) at GithubSharp.Core.Models.Issue.set_PrivateClosedAt(String value) in Issue.cs: line 33 at ReadIssueFromJson(XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString[]) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, ref DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadArrayOfIssueFromJson(XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString, CollectionDataContract) at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, ref DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle declaredTypeHandle, String name, String ns) at ReadIssuesCollectionFromJson(XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString[]) at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson context) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, Type declaredType, ref DataContract dataContract) at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, String name, String ns) at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) at GithubSharp.Core.Base.JsonConverter.FromJson(String Json) in JsonConverter.cs: line 35 at GithubSharp.Core.Base.BaseAPI.ConsumeJsonUrl(String Url) in BaseAPI.cs: line 97