Unable to create CosmosClient instance when using version 3.3.0 - dotnetcore 2.2 console app
See original GitHub issueDescribe the bug When creating an instance of Microsoft.Azure.Cosmos.CosmosClient in a dotnetcore 2.2 console application an exception is thrown from the CosmosClient constructor. This is only an issue with Microsoft.Azure.Cosmos version 3.3.0, version 3.2.0 works as expected.
using (CosmosClient client = new CosmosClient(endpoint, authKey))
{
}
Stack Trace shows an FormatException being thrown from the DocumentClient.Initialize method when configuring some http headers.
Stack Trace
Unhandled Exception: System.FormatException: The format of value ‘18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64/X64 3.3.0/3.3.0-.NET Core 4.6.27817.03 89710’ is invalid.
at System.Net.Http.Headers.HttpHeaderParser.ParseValue(String value, Object storeValue, Int32& index)
at System.Net.Http.Headers.HttpHeaders.ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, String value)
at System.Net.Http.Headers.HttpHeaders.Add(HeaderDescriptor descriptor, String value)
at Microsoft.Azure.Cosmos.DocumentClient.Initialize(Uri serviceEndpoint, ConnectionPolicy connectionPolicy, Nullable1 desiredConsistencyLevel, HttpMessageHandler handler, ISessionContainer sessionContainer, Nullable
1 enableCpuMonitor, IStoreClientFactory storeClientFactory)
at Microsoft.Azure.Cosmos.DocumentClient…ctor(Uri serviceEndpoint, String authKeyOrResourceToken, EventHandler1 sendingRequestEventArgs, ConnectionPolicy connectionPolicy, Nullable
1 desiredConsistencyLevel, JsonSerializerSettings serializerSettings, ApiType apitype, EventHandler1 receivedResponseEventArgs, HttpMessageHandler handler, ISessionContainer sessionContainer, Nullable
1 enableCpuMonitor, Func`2 transportClientHandlerFactory, IStoreClientFactory storeClientFactory)
at Microsoft.Azure.Cosmos.CosmosClient…ctor(String accountEndpoint, String authKeyOrResourceToken, CosmosClientOptions clientOptions)
To Reproduce Create a new dotnetcore 2.2 console application. Add a reference to a Microsoft.Azure.Cosmos v3.3.0. Attempt to create an instance of the CosmosClient class using a valid endpoint and api key.
Expected behavior The CosmosClient instance is created.
Actual behavior An exception is thrown and the CosmosClient instance is not created.
Environment summary Visual Studio Community 2019 for Mac Version 8.3 (build 1805) Installation UUID: 49761e24-5ec7-4b3d-a0c5-4b1f27352f35 GTK+ 2.24.23 (Raleigh theme) Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)
Package version: 604000198
Mono Framework MDK Runtime: Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit) Package version: 604000198
NuGet Version: 5.3.0.6192
.NET Core SDK SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks SDK Versions: 3.0.100 2.2.401 2.1.701 2.1.700 2.1.505 2.1.504 2.1.402 2.1.4 MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks
.NET Core Runtime Runtime: /usr/local/share/dotnet/dotnet Runtime Versions: 3.0.0 2.2.6 2.1.13 2.1.12 2.1.11 2.1.9 2.1.8 2.1.4 2.0.5
Xamarin.Profiler Version: 1.6.12.26 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
Updater Version: 11
Apple Developer Tools Xcode 10.3 (14492.2) Build 10G8
Xamarin.Mac Version: 6.2.0.42 (Visual Studio Community) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400
Xamarin.iOS Version: 13.2.0.42 (Visual Studio Community) Hash: 5e8a208b Branch: d16-3 Build date: 2019-09-17 14:19:30-0400
Xamarin.Android Version: 10.0.0.43 (Visual Studio Community) Commit: xamarin-android/d16-3/8af1ca8 Android SDK: /Users/patrickdoody/Library/Developer/Xamarin/android-sdk-macosx Supported Android versions: 7.0 (API level 24) 7.1 (API level 25) 8.0 (API level 26) 8.1 (API level 27)
SDK Tools Version: 26.1.1 SDK Platform Tools Version: 29.0.2 SDK Build Tools Version: 29.0.2
Build Information: Mono: mono/mono/2019-06@7af64d1ebe9 Java.Interop: xamarin/java.interop/d16-3@5836f58 LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94 LibZip: nih-at/libzip/rel-1-5-1@b95cf3f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.27.1@8212a2d Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333
Microsoft Mobile OpenJDK Java SDK: /Users/patrickdoody/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25 1.8.0-25 Android Designer EPL code available here: https://github.com/xamarin/AndroidDesigner.EPL
Android SDK Manager Version: 1.4.0.65 Hash: c33b107 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:42:44 UTC
Android Device Manager Version: 1.2.0.115 Hash: 724ea69 Branch: remotes/origin/d16-3 Build date: 2019-09-19 20:43:06 UTC
Xamarin Inspector Version: 1.4.3 Hash: db27525 Branch: 1.4-release Build date: Mon, 09 Jul 2018 21:20:18 GMT Client compatibility: 1
Xamarin Designer Version: 16.3.0.230 Hash: bbe518670 Branch: remotes/origin/d16-3-xcode11 Build date: 2019-09-17 18:39:30 UTC
Build Information Release ID: 803001805 Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1 Build date: 2019-09-20 16:10:55+00 Build branch: release-8.3 Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72
Operating System Mac OS X 10.14.6 Darwin 18.7.0 Darwin Kernel Version 18.7.0 Tue Aug 20 16:57:14 PDT 2019 root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
Enabled user installed extensions Xamarin.Forms HotReload extension 1.4.0 .NET Core support for Mono.Debugging 8.0.5
Additional context Add any other context about the problem here (for example, complete stack traces or logs).
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top GitHub Comments
@ctrlaltdan are you sure you updated to 3.3.2? Can you try deleting the bin and obj folders and making sure you aren’t using a cached version. The user agent string in the error message says it’s version 3.3.0
Yeah, that’s why the change log specifies non-windows.