diff --git a/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj b/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj index bd1532d7c..57b02a23d 100644 --- a/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj +++ b/src/WebJobs.Extensions.CosmosDB/WebJobs.Extensions.CosmosDB.csproj @@ -9,7 +9,7 @@ This package contains binding extensions for Azure Cosmos DB. - + diff --git a/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBTestUtility.cs b/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBTestUtility.cs index 7ddfe52ae..211f56fac 100644 --- a/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBTestUtility.cs +++ b/test/WebJobs.Extensions.CosmosDB.Tests/CosmosDBTestUtility.cs @@ -81,9 +81,14 @@ public static IOrderedQueryable AsOrderedQueryable(this IEnumerable< public static DocumentClientException CreateDocumentClientException(HttpStatusCode status) { - var headers = new NameValueCollection(); - var parameters = new object[] { null, null, headers, status, null }; - return Activator.CreateInstance(typeof(DocumentClientException), BindingFlags.NonPublic | BindingFlags.Instance, null, parameters, null) as DocumentClientException; + Type t = typeof(DocumentClientException); + + var constructor = t.GetConstructor( + BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, + null, new[] { typeof(string), typeof(Exception), typeof(HttpStatusCode?), typeof(Uri), typeof(string) }, null); + + object ex = constructor.Invoke(new object[] { string.Empty, new Exception(), status, null, string.Empty }); + return ex as DocumentClientException; } public static ParameterInfo GetInputParameter()