diff --git a/src/TableStorage/DocumentRepository`1.cs b/src/TableStorage/DocumentRepository`1.cs index da8c4f5..6dce806 100644 --- a/src/TableStorage/DocumentRepository`1.cs +++ b/src/TableStorage/DocumentRepository`1.cs @@ -171,7 +171,7 @@ async Task PutBinaryAsync(T entity, CancellationToken cancellation = default) var result = await table.UpsertEntityAsync(new BinaryDocumentEntity(partitionKey, rowKey) { Document = binarySerializer!.Serialize(entity), - Type = typeof(T).FullName.Replace('+', '.'), + Type = typeof(T).FullName?.Replace('+', '.'), Version = documentVersion, MajorVersion = documentMajorVersion, MinorVersion = documentMinorVersion, @@ -236,7 +236,7 @@ async Task PutStringAsync(T entity, CancellationToken cancellation = default) var result = await table.UpsertEntityAsync(new DocumentEntity(partitionKey, rowKey) { Document = stringSerializer!.Serialize(entity), - Type = typeof(T).FullName.Replace('+', '.'), + Type = typeof(T).FullName?.Replace('+', '.'), Version = documentVersion, MajorVersion = documentMajorVersion, MinorVersion = documentMinorVersion, diff --git a/src/TableStorage/Http.cs b/src/TableStorage/Http.cs index 498a7e3..15876e5 100644 --- a/src/TableStorage/Http.cs +++ b/src/TableStorage/Http.cs @@ -36,13 +36,13 @@ public static HttpRequestMessage AddAuthorizationHeader(this HttpRequestMessage request.Headers.Add("x-ms-date", date); } - var resource = request.RequestUri.GetComponents(UriComponents.Path, UriFormat.Unescaped); + var resource = request.RequestUri?.GetComponents(UriComponents.Path, UriFormat.Unescaped); var toSign = string.Format("{0}\n/{1}/{2}", request.Headers.GetValues("x-ms-date").First(), account.Credentials.AccountName, - resource.TrimStart('/')); + resource?.TrimStart('/')); - var hasher = new HMACSHA256(Convert.FromBase64String(account.Credentials.Key)); + var hasher = new HMACSHA256(Convert.FromBase64String(account.Credentials.Key ?? "")); var signature = hasher.ComputeHash(Encoding.UTF8.GetBytes(toSign)); var authentication = new AuthenticationHeaderValue("SharedKeyLite", account.Credentials.AccountName + ":" + Convert.ToBase64String(signature));