Skip to content

[8.0.1 Regression] OleDb throws "Performance Counters not supported" on initialization #122960

@DW-MaximV

Description

@DW-MaximV

Description

System.Data.OleDb 8.0.1 throws PlatformNotSupportedException: Performance Counters are not supported on this platform when OleDbConnection is initialized inside a custom AssemblyLoadContext on .NET 8.0 Windows.

This is a regression from version 8.0.0, which works without any issues in the same scenario.

Reproduction Steps

  1. Create a custom AssemblyLoadContext with isCollectible: true
  2. Load an assembly that uses System.Data.OleDb into the custom context
  3. Instantiate OleDbConnection via reflection from within the custom context
  4. Exception is thrown during static initialization of DbConnectionPoolCounters

See attached minimal reproduction project:
OleDbCustomContextDemo.zip

Expected behavior

OleDbConnection should initialize successfully in a custom AssemblyLoadContext, as it does in version 8.0.0.

Actual behavior

Exception is thrown:

System.PlatformNotSupportedException: Performance Counters are not supported on this platform.
   at System.Diagnostics.CounterCreationData..ctor(String counterName, String counterHelp, PerformanceCounterType counterType)
   at System.Data.ProviderBase.DbConnectionPoolCounters.CreationData..cctor()

Regression?

No response

Known Workarounds

Downgrade to System.Data.OleDb 8.0.0 - works perfectly.

Configuration

  • Package: System.Data.OleDb 8.0.1
  • Framework: net8.0-windows
  • Runtime: .NET 8.0
  • Platform: Windows x64

Other information

The issue specifically occurs in custom AssemblyLoadContext, not in the default context.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions