Skip to content

[net48] Upgrading 3rd-party library causes System.Configuration.ConfigurationErrorsException. #116963

Closed
@msfcolombo

Description

@msfcolombo

Description

Upgrading 3rd-party library causes error reading app.config.

This is related to this issue: Azure/azure-cosmos-dotnet-v3#5148.

The Azure/azure-cosmos-dotnet-v3 team could not root cause and asked me to create a ticket for dotnet/runtime team.

The following error happens after upgrading to Cosmos DB SDK v3:
 

Failed to create database: System.Configuration.ConfigurationErrorsException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException: Unrecognized configuration section system.diagnostics. (<redacted.exe.config> line 464)
   at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
   at System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)
   at System.Configuration.ClientConfigurationSystem.EnsureInit(String configKey)
   --- End of inner exception stack trace ---
   at System.Configuration.ConfigurationManager.PrepareConfigSystem()
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.ConfigurationManager.get_AppSettings()
   at Microsoft.Azure.Cosmos.DocumentClient.Initialize(Uri serviceEndpoint, ConnectionPolicy connectionPolicy, Nullable`1 desiredConsistencyLevel, HttpMessageHandler handler, ISessionContainer sessionContainer, Nullable`1 enableCpuMonitor, IStoreClientFactory storeClientFactory, TokenCredential tokenCredential, String cosmosClientId, RemoteCertificateValidationCallback remoteCertificateValidationCallback, CosmosClientTelemetryOptions cosmosClientTelemetryOptions)
   at Microsoft.Azure.Cosmos.DocumentClient..ctor(Uri serviceEndpoint, AuthorizationTokenProvider cosmosAuthorization, EventHandler`1 sendingRequestEventArgs, ConnectionPolicy connectionPolicy, Nullable`1 desiredConsistencyLevel, JsonSerializerSettings serializerSettings, ApiType apitype, EventHandler`1 receivedResponseEventArgs, HttpMessageHandler handler, ISessionContainer sessionContainer, Nullable`1 enableCpuMonitor, Func`2 transportClientHandlerFactory, IStoreClientFactory storeClientFactory, Boolean isLocalQuorumConsistency, String cosmosClientId, RemoteCertificateValidationCallback remoteCertificateValidationCallback, CosmosClientTelemetryOptions cosmosClientTelemetryOptions, IChaosInterceptorFactory chaosInterceptorFactory)
   at Microsoft.Azure.Cosmos.ClientContextCore.Create(CosmosClient cosmosClient, CosmosClientOptions clientOptions)
   at Microsoft.Azure.Cosmos.CosmosClient..ctor(String accountEndpoint, AuthorizationTokenProvider authorizationTokenProvider, CosmosClientOptions clientOptions)

This is a legacy system that uses net48. We did attempt to remove settings, but we ended up losing telemetry. Please help us root causing this.

Reproduction Steps

Confidential. Please contact me for bug reproduction steps.

Expected behavior

No exception should not be thrown.

Actual behavior

The exception is thrown.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions