azure-cosmos-dotnet-v3: System.AggregateException

We are continuously addressing and improving the SDK, if possible, make sure the problem persist in the latest SDK version.

Describe the bug I described the bug in a blog post: A strange bug in Azure Cosmos DB SQL API account (SDK Version 3 Preview)

To Reproduce Steps to reproduce the behavior. If you can include code snippets or links to repositories containing a repro of the issue that can help us in detecting the scenario it would speed up the resolution.

Expected behavior A clear and concise description of what you expected to happen.

Actual behavior Error: System.AggregateException: One or more errors occurred. (Exception has been thrown by the target of an invocation.) —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.FormatException: Input string was not in a correct format. at System.Number.ThrowOverflowOrFormatException(Boolean overflow, String overflowResourceKey) at System.Double.Parse(String s) at Microsoft.Azure.Cosmos.CosmosResponseMessageHeaders.set__requestCharge(String value) — End of inner exception stack trace — at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at Microsoft.Azure.Cosmos.CosmosResponseMessageHeaders.<>c__DisplayClass43_0.b__3(String value) at Microsoft.Azure.Cosmos.CosmosCustomHeader.Set(String value) at Microsoft.Azure.Cosmos.CosmosMessageHeadersInternal.Add(String headerName, String value) at Microsoft.Azure.Cosmos.CosmosMessageHeadersBase.Add(String headerName, String value) at Microsoft.Azure.Cosmos.Extensions.ToCosmosResponseMessage(DocumentServiceResponse response, CosmosRequestMessage requestMessage) at Microsoft.Azure.Cosmos.Handlers.TransportHandler.SendAsync(CosmosRequestMessage request, CancellationToken cancellationToken) at Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.ExecuteHttpRequestAsync(Func1 callbackMethod, Func3 callShouldRetry, Func3 callShouldRetryException, CancellationToken cancellationToken) at Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.SendAsync(CosmosRequestMessage request, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.Azure.Cosmos.ExecUtils.<>c__DisplayClass3_01.b__0(Task1 task) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location where exception was thrown --- at CosmosGettingStartedDotnetCoreTutorial.Program.ReplaceFamilyItem() in D:\CosmosGettingStartedDotnetCoreTutorial\CosmosGettingStartedDotnetCoreTutorial\Program.cs:line 210 at CosmosGettingStartedDotnetCoreTutorial.Program.GetStartedDemoAsync() in D:\CosmosGettingStartedDotnetCoreTutorial\CosmosGettingStartedDotnetCoreTutorial\Program.cs:line 75 at CosmosGettingStartedDotnetCoreTutorial.Program.Main(String[] args) in D:\CosmosGettingStartedDotnetCoreTutorial\CosmosGettingStartedDotnetCoreTutorial\Program.cs:line 30 ---> (Inner Exception #0) System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Input string was not in a correct format. at System.Number.ThrowOverflowOrFormatException(Boolean overflow, String overflowResourceKey) at System.Double.Parse(String s) at Microsoft.Azure.Cosmos.CosmosResponseMessageHeaders.set__requestCharge(String value) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at Microsoft.Azure.Cosmos.CosmosResponseMessageHeaders.<>c__DisplayClass43_0.b__3(String value) at Microsoft.Azure.Cosmos.CosmosCustomHeader.Set(String value) at Microsoft.Azure.Cosmos.CosmosMessageHeadersInternal.Add(String headerName, String value) at Microsoft.Azure.Cosmos.CosmosMessageHeadersBase.Add(String headerName, String value) at Microsoft.Azure.Cosmos.Extensions.ToCosmosResponseMessage(DocumentServiceResponse response, CosmosRequestMessage requestMessage) at Microsoft.Azure.Cosmos.Handlers.TransportHandler.SendAsync(CosmosRequestMessage request, CancellationToken cancellationToken) at Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.ExecuteHttpRequestAsync(Func1 callbackMethod, Func3 callShouldRetry, Func3 callShouldRetryException, CancellationToken cancellationToken) at Microsoft.Azure.Cosmos.Handlers.AbstractRetryHandler.SendAsync(CosmosRequestMessage request, CancellationToken cancellationToken)<—

End of demo, press any key to exit

Environment summary SDK Version: 3.0.0.1-preview OS Version (e.g. Windows, Linux, MacOSX): Windows 10 Version 809

Additional context Add any other context about the problem here (for example, complete stack traces or logs).

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 37 (14 by maintainers)

Most upvoted comments

I just ran into this one my self. Very hard to debug. Exists on both versions 3.0.0.9 and .10

Workaround: Setting culture info before calling FetchNextSetAsync() seems to work.

System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("en-gb");

Should I create a new bug about this?

@MaherJendoubi The fix was merged and will be included in the next preview release

@MaherJendoubi Just thinking about the code path, the exception and the fact that it was working in a VM, I guess it just was an idea and I tried and was able to repro, but was not sure your case was the same 😄

@ealsur My Laptop is a French OS while my on-prem VM and my Azure VM are English OS.